去掉抽屉,去掉取消按钮
This commit is contained in:
@@ -89,11 +89,20 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
*/
|
||||
private void setTextBasedOnDragSource(ItemInfo item) {
|
||||
if (!TextUtils.isEmpty(mText)) {
|
||||
mText = getResources().getString(canRemove(item)
|
||||
? R.string.remove_drop_target_label
|
||||
: android.R.string.cancel);
|
||||
// mText = getResources().getString(canRemove(item)
|
||||
//// ? R.string.remove_drop_target_label
|
||||
//// : android.R.string.cancel);
|
||||
//add for hide deletedroptarget
|
||||
if (LauncherAppState.isDisableAllApps()) {
|
||||
android.util.Log.e("Launcher3", "hide delete drop target");
|
||||
mText = getResources().getString(isCanDrop(item)
|
||||
? R.string.remove_drop_target_label
|
||||
: android.R.string.cancel);
|
||||
}
|
||||
setContentDescription(mText);
|
||||
requestLayout();
|
||||
setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +114,13 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
* Set mControlType depending on the drag item.
|
||||
*/
|
||||
private void setControlTypeBasedOnDragSource(ItemInfo item) {
|
||||
mControlType = item.id != ItemInfo.NO_ID ? ControlType.REMOVE_TARGET
|
||||
: ControlType.CANCEL_TARGET;
|
||||
// mControlType = item.id != ItemInfo.NO_ID ? ControlType.REMOVE_TARGET
|
||||
// : ControlType.CANCEL_TARGET;
|
||||
//add for hide deletedroptarget [S]
|
||||
if (LauncherAppState.isDisableAllApps()) {
|
||||
mControlType = isCanDrop(item) ? ControlType.REMOVE_TARGET
|
||||
: ControlType.CANCEL_TARGET;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,8 +142,8 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
modelWriter.abortDelete(itemPage);
|
||||
mLauncher.getUserEventDispatcher().logActionOnControl(TAP, UNDO);
|
||||
};
|
||||
Snackbar.show(mLauncher, R.string.item_removed, R.string.undo,
|
||||
modelWriter::commitDelete, onUndoClicked);
|
||||
// Snackbar.show(mLauncher, R.string.item_removed, R.string.undo,
|
||||
// modelWriter::commitDelete, onUndoClicked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,10 +155,12 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
// Remove the item from launcher and the db, we can ignore the containerInfo in this call
|
||||
// because we already remove the drag view from the folder (if the drag originated from
|
||||
// a folder) in Folder.beginDrag()
|
||||
mLauncher.removeItem(view, item, true /* deleteFromDb */);
|
||||
mLauncher.getWorkspace().stripEmptyScreens();
|
||||
mLauncher.getDragLayer()
|
||||
.announceForAccessibility(getContext().getString(R.string.item_removed));
|
||||
if (!LauncherAppState.isDisableAllApps() || isCanDrop(item)) {
|
||||
mLauncher.removeItem(view, item, true /* deleteFromDb */);
|
||||
mLauncher.getWorkspace().stripEmptyScreens();
|
||||
mLauncher.getDragLayer()
|
||||
.announceForAccessibility(getContext().getString(R.string.item_removed));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,4 +169,9 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
t.controlType = mControlType;
|
||||
return t;
|
||||
}
|
||||
|
||||
private boolean isCanDrop(ItemInfo item) {
|
||||
return !(item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
|
||||
item.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user