Merge "Update drop target styling based for BC." into sc-dev am: f9f506ca7e

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

Change-Id: I08bc6f06585e3e17a5a67b918bf7544c1aea746d
This commit is contained in:
TreeHugger Robot
2021-04-30 17:00:55 +00:00
committed by Automerger Merge Worker
10 changed files with 69 additions and 20 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"

View File

@@ -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">

View File

@@ -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"

View File

@@ -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 -->

View File

@@ -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" />

View File

@@ -36,6 +36,8 @@ import android.view.accessibility.AccessibilityEvent;
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 @@ public abstract class ButtonDropTarget extends TextView
}
}
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 @@ public abstract class ButtonDropTarget extends TextView
}
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 @@ public abstract class ButtonDropTarget extends TextView
if (!d.dragComplete) {
d.dragView.setAlpha(1f);
setBackgroundDrawable(R.drawable.drop_target_frame);
} else {
d.dragView.setAlpha(DRAG_VIEW_HOVER_OVER_OPACITY);
}

View File

@@ -53,7 +53,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
setDrawable(R.drawable.ic_remove_shadow);
setDrawable(R.drawable.ic_remove_no_shadow);
}
@Override

View File

@@ -108,13 +108,13 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
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);
}
}