summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DeleteDropTarget.java
diff options
context:
space:
mode:
authorMathew Inwood <mathewi@google.com>2013-11-25 17:01:34 +0000
committerMathew Inwood <mathewi@google.com>2013-11-28 10:17:07 +0000
commit1eeb3fc9d874d98dfb43883d17efb4202d83d88a (patch)
tree86e1bc78a3fb98957bc3a3a61b4b60f2b020cf99 /src/com/android/launcher3/DeleteDropTarget.java
parent0a23daaca14ab7fd107ee3e4043b5793760e02c1 (diff)
downloadandroid_packages_apps_Trebuchet-1eeb3fc9d874d98dfb43883d17efb4202d83d88a.tar.gz
android_packages_apps_Trebuchet-1eeb3fc9d874d98dfb43883d17efb4202d83d88a.tar.bz2
android_packages_apps_Trebuchet-1eeb3fc9d874d98dfb43883d17efb4202d83d88a.zip
Generalize support for 'App Info', 'Uninstall' and 'Delete'
This allows other DragSource's to allow this behaviour, instead of it being tied to specific source types. Change-Id: I06b7c39b1b34a0ae141245bcc13b6a0873a4c0fd
Diffstat (limited to 'src/com/android/launcher3/DeleteDropTarget.java')
-rw-r--r--src/com/android/launcher3/DeleteDropTarget.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index 4023dafb6..7e0e5ebd7 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -95,7 +95,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
}
private boolean isAllAppsApplication(DragSource source, Object info) {
- return (source instanceof AppsCustomizePagedView) && (info instanceof AppInfo);
+ return source.supportsAppInfoDropTarget() && (info instanceof AppInfo);
}
private boolean isAllAppsWidget(DragSource source, Object info) {
if (source instanceof AppsCustomizePagedView) {
@@ -175,6 +175,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
boolean isVisible = true;
boolean useUninstallLabel = !AppsCustomizePagedView.DISABLE_ALL_APPS &&
isAllAppsApplication(source, info);
+ boolean useDeleteLabel = !useUninstallLabel && source.supportsDeleteDropTarget();
// If we are dragging an application from AppsCustomize, only show the control if we can
// delete the app (it was downloaded), and rename the string to "uninstall" in such a case.
@@ -185,15 +186,17 @@ public class DeleteDropTarget extends ButtonDropTarget {
if (useUninstallLabel) {
setCompoundDrawablesRelativeWithIntrinsicBounds(mUninstallDrawable, null, null, null);
- } else {
+ } else if (useDeleteLabel) {
setCompoundDrawablesRelativeWithIntrinsicBounds(mRemoveDrawable, null, null, null);
+ } else {
+ isVisible = false;
}
mCurrentDrawable = (TransitionDrawable) getCurrentDrawable();
mActive = isVisible;
resetHoverColor();
((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE);
- if (getText().length() > 0) {
+ if (isVisible && getText().length() > 0) {
setText(useUninstallLabel ? R.string.delete_target_uninstall_label
: R.string.delete_target_label);
}