Merge "Fix some bugs in widget pickers." into sc-dev am: b42513fbc5

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14339826

Change-Id: Iac3ab67df16feae242faaec1d9449946ed9f3a8a
This commit is contained in:
Alina Zaidi
2021-04-30 09:44:35 +00:00
committed by Automerger Merge Worker
10 changed files with 59 additions and 14 deletions

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2021, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?android:attr/colorAccent" />
</selector>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2021, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/white" />
</selector>

View File

@@ -14,6 +14,6 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?android:attr/colorAccent" />
<solid android:color="@color/arrow_tip_view_bg" />
<corners android:radius="8dp" />
</shape>

View File

@@ -14,6 +14,6 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="?android:attr/textColorPrimaryInverse" />
<solid android:color="@color/widgets_picker_surface" />
<corners android:radius="24dp" />
</shape>

View File

@@ -53,6 +53,7 @@
style="@style/Widget.DeviceDefault.Button.Rounded.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:onClick="onCancelClick"
android:text="@android:string/cancel" />
@@ -64,7 +65,8 @@
style="@style/Widget.DeviceDefault.Button.Rounded.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:onClick="onPlaceAutomaticallyClick"
android:text="@string/place_automatically" />
android:text="@string/add_to_home_screen" />
</LinearLayout>
</LinearLayout>

View File

@@ -16,6 +16,7 @@
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
@@ -38,7 +39,7 @@
android:paddingBottom="5dp"
android:gravity="center"
android:layout_gravity="center_vertical"
android:textColor="@android:color/white"
android:textColor="@color/arrow_tip_view_content"
android:textSize="16sp"/>
<ImageView
android:id="@+id/dismiss"
@@ -50,7 +51,7 @@
android:layout_marginEnd="2dp"
android:alpha="0.7"
android:src="@drawable/ic_remove_no_shadow"
android:tint="@android:color/white"
android:tint="@color/arrow_tip_view_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/accessibility_close"/>
</LinearLayout>

View File

@@ -24,7 +24,7 @@
android:layout_weight="1"
android:inputType="text"
android:imeOptions="actionSearch"
android:textColor="?android:attr/textColorSecondary"
android:textColor="?android:attr/textColorPrimary"
android:textColorHint="?android:attr/textColorTertiary"/>
<ImageButton

View File

@@ -57,8 +57,8 @@
<string name="widget_accessible_dims_format">%1$d wide by %2$d high</string>
<!-- Message to tell the user to press and hold a widget/icon to add it -->
<string name="add_item_request_drag_hint">Touch &amp; hold to place manually</string>
<!-- Button label to automatically add icon on home screen [CHAR_LIMIT=50] -->
<string name="place_automatically">Add automatically</string>
<!-- Button label to automatically add a widget to home screen [CHAR_LIMIT=50] -->
<string name="add_to_home_screen">Add to Home screen</string>
<!-- Label for showing the number of widgets an app has in the full widgets picker.
[CHAR_LIMIT=25] -->
<plurals name="widgets_count">

View File

@@ -22,7 +22,6 @@ import android.graphics.Paint;
import android.graphics.drawable.ShapeDrawable;
import android.os.Handler;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
@@ -108,10 +107,7 @@ public class ArrowTipView extends AbstractFloatingView {
ShapeDrawable arrowDrawable = new ShapeDrawable(TriangleShape.create(
arrowLp.width, arrowLp.height, false));
Paint arrowPaint = arrowDrawable.getPaint();
TypedValue typedValue = new TypedValue();
context.getTheme()
.resolveAttribute(android.R.attr.colorAccent, typedValue, true);
arrowPaint.setColor(ContextCompat.getColor(getContext(), typedValue.resourceId));
arrowPaint.setColor(ContextCompat.getColor(getContext(), R.color.arrow_tip_view_bg));
// The corner path effect won't be reflected in the shadow, but shouldn't be noticeable.
arrowPaint.setPathEffect(new CornerPathEffect(
context.getResources().getDimension(R.dimen.arrow_toast_corner_radius)));

View File

@@ -28,7 +28,7 @@ import java.util.regex.Pattern;
public class AddToHomeScreenPrompt {
private static final Pattern ADD_AUTOMATICALLY =
Pattern.compile("^Add automatically$", CASE_INSENSITIVE);
Pattern.compile("^Add to Home screen$", CASE_INSENSITIVE);
private final LauncherInstrumentation mLauncher;
private final UiObject2 mWidgetCell;