Update drop target styling based for BC.

Spec: https://docs.google.com/presentation/d/1UxdDh8EFhPbdRWRwzjbpgL-j02ew4Ew3eG3XBCeoYdo/edit#slide=id.vXfwHn8

Demo: https://drive.google.com/file/d/1ZIa3Dgo85vdVkfPm7aGJDyctZQR_c8Xx/view?usp=sharing

Test: manual
Bug: 184713740
Change-Id: I17dbbf1f7bbc40939cfc0fedb506a35f39ecc2e3
This commit is contained in:
Yogisha Dixit
2021-04-28 13:45:37 +01:00
parent 5354abb0e7
commit a3a6f51b12
10 changed files with 69 additions and 20 deletions

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);
}