Loading res/drawable/drop_target_background.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?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. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:drawable="@drawable/drop_target_frame_hover" /> <item android:state_selected="false" android:drawable="@drawable/drop_target_frame" /> </selector> No newline at end of file res/values/styles.xml +1 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ <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:background">@drawable/drop_target_frame</item> <item name="android:background">@drawable/drop_target_background</item> </style> <style name="DropTargetButton" parent="DropTargetButtonBase" /> Loading src/com/android/launcher3/ButtonDropTarget.java +3 −7 Original line number Diff line number Diff line Loading @@ -142,11 +142,6 @@ 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) { Loading @@ -172,7 +167,7 @@ public abstract class ButtonDropTarget extends TextView } d.dragView.setAlpha(DRAG_VIEW_HOVER_OVER_OPACITY); setBackgroundDrawable(R.drawable.drop_target_frame_hover); setSelected(true); if (d.stateAnnouncer != null) { d.stateAnnouncer.cancel(); } Loading @@ -190,7 +185,7 @@ public abstract class ButtonDropTarget extends TextView if (!d.dragComplete) { d.dragView.setAlpha(1f); setBackgroundDrawable(R.drawable.drop_target_frame); setSelected(false); } else { d.dragView.setAlpha(DRAG_VIEW_HOVER_OVER_OPACITY); } Loading Loading @@ -230,6 +225,7 @@ public abstract class ButtonDropTarget extends TextView public void onDragEnd() { mActive = false; setOnClickListener(null); setSelected(false); } /** Loading Loading
res/drawable/drop_target_background.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?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. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:drawable="@drawable/drop_target_frame_hover" /> <item android:state_selected="false" android:drawable="@drawable/drop_target_frame" /> </selector> No newline at end of file
res/values/styles.xml +1 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ <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:background">@drawable/drop_target_frame</item> <item name="android:background">@drawable/drop_target_background</item> </style> <style name="DropTargetButton" parent="DropTargetButtonBase" /> Loading
src/com/android/launcher3/ButtonDropTarget.java +3 −7 Original line number Diff line number Diff line Loading @@ -142,11 +142,6 @@ 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) { Loading @@ -172,7 +167,7 @@ public abstract class ButtonDropTarget extends TextView } d.dragView.setAlpha(DRAG_VIEW_HOVER_OVER_OPACITY); setBackgroundDrawable(R.drawable.drop_target_frame_hover); setSelected(true); if (d.stateAnnouncer != null) { d.stateAnnouncer.cancel(); } Loading @@ -190,7 +185,7 @@ public abstract class ButtonDropTarget extends TextView if (!d.dragComplete) { d.dragView.setAlpha(1f); setBackgroundDrawable(R.drawable.drop_target_frame); setSelected(false); } else { d.dragView.setAlpha(DRAG_VIEW_HOVER_OVER_OPACITY); } Loading Loading @@ -230,6 +225,7 @@ public abstract class ButtonDropTarget extends TextView public void onDragEnd() { mActive = false; setOnClickListener(null); setSelected(false); } /** Loading