Merge "Update drop target styling based for BC." into sc-dev am: f9f506ca7e am: bd8eec859f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14332405
Change-Id: Ibdc94a202a0c285871a516056afcfbb2b01e2335
diff --git a/res/drawable/drop_target_frame.xml b/res/drawable/drop_target_frame.xml
new file mode 100644
index 0000000..fa6dafd
--- /dev/null
+++ b/res/drawable/drop_target_frame.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="@android:color/transparent" />
+ <corners android:radius="28dp" />
+ <stroke android:width="2dp" android:color="?android:attr/colorAccent" />
+</shape>
\ No newline at end of file
diff --git a/res/drawable/drop_target_frame_hover.xml b/res/drawable/drop_target_frame_hover.xml
new file mode 100644
index 0000000..7d0e919
--- /dev/null
+++ b/res/drawable/drop_target_frame_hover.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="?android:attr/colorAccent" />
+ <corners android:radius="28dp" />
+</shape>
\ No newline at end of file
diff --git a/res/drawable/ic_block_no_shadow.xml b/res/drawable/ic_block_no_shadow.xml
index edeb4c6..be9aa07 100644
--- a/res/drawable/ic_block_no_shadow.xml
+++ b/res/drawable/ic_block_no_shadow.xml
@@ -14,10 +14,10 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportHeight="24.0"
- android:viewportWidth="24.0"
+ android:width="20dp"
+ android:height="20dp"
+ android:viewportHeight="20.0"
+ android:viewportWidth="20.0"
android:tint="?android:attr/textColorPrimary">
<path
android:fillColor="@android:color/white"
diff --git a/res/drawable/ic_remove_no_shadow.xml b/res/drawable/ic_remove_no_shadow.xml
index 2c706db..10f1e43 100644
--- a/res/drawable/ic_remove_no_shadow.xml
+++ b/res/drawable/ic_remove_no_shadow.xml
@@ -14,8 +14,8 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
+ android:width="20dp"
+ android:height="20dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:tint="?android:attr/textColorPrimary">
diff --git a/res/drawable/ic_uninstall_no_shadow.xml b/res/drawable/ic_uninstall_no_shadow.xml
index 6aff102..14cecac 100644
--- a/res/drawable/ic_uninstall_no_shadow.xml
+++ b/res/drawable/ic_uninstall_no_shadow.xml
@@ -14,10 +14,10 @@
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"
+ android:width="20dp"
+ android:height="20dp"
+ android:viewportWidth="20.0"
+ android:viewportHeight="20.0"
android:tint="?android:attr/textColorPrimary" >
<path
android:fillColor="@android:color/white"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 600a550..dd14eaa 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -158,7 +158,7 @@
<!-- Dragging -->
<!-- Drag padding to add to the bottom of drop targets -->
<dimen name="drop_target_drag_padding">14dp</dimen>
- <dimen name="drop_target_text_size">14sp</dimen>
+ <dimen name="drop_target_text_size">20sp</dimen>
<dimen name="drop_target_shadow_elevation">2dp</dimen>
<!-- the distance an icon must be dragged before button drop targets accept it -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 5ae4e3f..97a5760 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -258,14 +258,11 @@
<item name="android:drawablePadding">7.5dp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
- <item name="android:textColor">?attr/workspaceTextColor</item>
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">@dimen/drop_target_text_size</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">end</item>
- <item name="android:shadowColor">?attr/workspaceShadowColor</item>
- <item name="android:shadowDx">0.0</item>
- <item name="android:shadowDy">1.0</item>
- <item name="android:shadowRadius">4.0</item>
+ <item name="android:background">@drawable/drop_target_frame</item>
</style>
<style name="DropTargetButton" parent="DropTargetButtonBase" />
diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java
index a26217c..00317f7 100644
--- a/src/com/android/launcher3/ButtonDropTarget.java
+++ b/src/com/android/launcher3/ButtonDropTarget.java
@@ -36,6 +36,8 @@
import android.widget.PopupWindow;
import android.widget.TextView;
+import androidx.appcompat.content.res.AppCompatResources;
+
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragLayer;
@@ -142,6 +144,11 @@
}
}
+ private void setBackgroundDrawable(int resId) {
+ Drawable bd = AppCompatResources.getDrawable(getContext(), resId);
+ setBackground(bd);
+ }
+
@Override
public final void onDragEnter(DragObject d) {
if (!mAccessibleDrag && !mTextVisible) {
@@ -167,6 +174,7 @@
}
d.dragView.setAlpha(DRAG_VIEW_HOVER_OVER_OPACITY);
+ setBackgroundDrawable(R.drawable.drop_target_frame_hover);
if (d.stateAnnouncer != null) {
d.stateAnnouncer.cancel();
}
@@ -184,6 +192,7 @@
if (!d.dragComplete) {
d.dragView.setAlpha(1f);
+ setBackgroundDrawable(R.drawable.drop_target_frame);
} else {
d.dragView.setAlpha(DRAG_VIEW_HOVER_OVER_OPACITY);
}
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index e46aad2..80ec192 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -53,7 +53,7 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- setDrawable(R.drawable.ic_remove_shadow);
+ setDrawable(R.drawable.ic_remove_no_shadow);
}
@Override
diff --git a/src/com/android/launcher3/SecondaryDropTarget.java b/src/com/android/launcher3/SecondaryDropTarget.java
index 858b72e..05cef38 100644
--- a/src/com/android/launcher3/SecondaryDropTarget.java
+++ b/src/com/android/launcher3/SecondaryDropTarget.java
@@ -108,13 +108,13 @@
mCurrentAccessibilityAction = action;
if (action == UNINSTALL) {
- setDrawable(R.drawable.ic_uninstall_shadow);
+ setDrawable(R.drawable.ic_uninstall_no_shadow);
updateText(R.string.uninstall_drop_target_label);
} else if (action == DISMISS_PREDICTION) {
- setDrawable(R.drawable.ic_block_shadow);
+ setDrawable(R.drawable.ic_block_no_shadow);
updateText(R.string.dismiss_prediction_label);
} else if (action == RECONFIGURE) {
- setDrawable(R.drawable.ic_setup_shadow);
+ setDrawable(R.drawable.ic_setting);
updateText(R.string.gadget_setup_text);
}
}