mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Added 'Cancel' drop target from all apps and widget picker.
- Reuse DeleteDropTarget since it's the same effect, but with "Cancel" instead of "Remove" if supportsDeleteDropTarget() returns false. - Rename related strings (but not their values) Bug: 24104015 Bug: 24099531 Change-Id: Ia9fbcaa17bb17f7aa31df1f830298da01544c178
This commit is contained in:
@@ -46,7 +46,14 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
setDrawable(R.drawable.ic_remove_launcher);
|
||||
}
|
||||
|
||||
public static boolean supportsDrop(ItemInfo info) {
|
||||
@Override
|
||||
public void onDragStart(DragSource source, ItemInfo info, int dragAction) {
|
||||
super.onDragStart(source, info, dragAction);
|
||||
setTextBasedOnDragSource(source);
|
||||
}
|
||||
|
||||
/** @return true for items that should have a "Remove" action in accessibility. */
|
||||
public static boolean supportsAccessibleDrop(ItemInfo info) {
|
||||
return (info instanceof ShortcutInfo)
|
||||
|| (info instanceof LauncherAppWidgetInfo)
|
||||
|| (info instanceof FolderInfo);
|
||||
@@ -54,7 +61,17 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
|
||||
@Override
|
||||
protected boolean supportsDrop(DragSource source, ItemInfo info) {
|
||||
return source.supportsDeleteDropTarget() && supportsDrop(info);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the drop target's text to either "Remove" or "Cancel" depending on the drag source.
|
||||
*/
|
||||
public void setTextBasedOnDragSource(DragSource dragSource) {
|
||||
if (!mDeviceProfile.isVerticalBarLayout()) {
|
||||
setText(dragSource.supportsDeleteDropTarget() ? R.string.remove_drop_target_label
|
||||
: android.R.string.cancel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user