diff options
author | Patrick Dubroy <dubroy@google.com> | 2010-09-03 16:25:12 -0700 |
---|---|---|
committer | Patrick Dubroy <dubroy@google.com> | 2010-09-03 16:26:11 -0700 |
commit | 39670182be72e981cc7c26d9099f6e9636d27411 (patch) | |
tree | 1eec55e984ffb60d2726ec9da261b420452d9d2b /src | |
parent | bc6840b316992c6fdd681be419fc767b5de2f226 (diff) | |
download | android_packages_apps_Trebuchet-39670182be72e981cc7c26d9099f6e9636d27411.tar.gz android_packages_apps_Trebuchet-39670182be72e981cc7c26d9099f6e9636d27411.tar.bz2 android_packages_apps_Trebuchet-39670182be72e981cc7c26d9099f6e9636d27411.zip |
For now, just show a toast when user tries to delete a system app.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/DeleteZone.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/android/launcher2/DeleteZone.java b/src/com/android/launcher2/DeleteZone.java index 91ff56fd4..5322f6bc4 100644 --- a/src/com/android/launcher2/DeleteZone.java +++ b/src/com/android/launcher2/DeleteZone.java @@ -27,7 +27,6 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.TransitionDrawable; import android.util.AttributeSet; -import android.util.Log; import android.view.View; import android.view.animation.AccelerateInterpolator; import android.view.animation.AlphaAnimation; @@ -35,6 +34,7 @@ import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.TranslateAnimation; import android.widget.ImageView; +import android.widget.Toast; public class DeleteZone extends ImageView implements DropTarget, DragController.DragListener { private static final int ORIENTATION_HORIZONTAL = 1; @@ -59,6 +59,8 @@ public class DeleteZone extends ImageView implements DropTarget, DragController. private View mHandle; private final Paint mTrashPaint = new Paint(); + private Context mContext = null; + public DeleteZone(Context context, AttributeSet attrs) { this(context, attrs, 0); } @@ -66,6 +68,8 @@ public class DeleteZone extends ImageView implements DropTarget, DragController. public DeleteZone(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); + mContext = context; + final int srcColor = context.getResources().getColor(R.color.delete_color_filter); mTrashPaint.setColorFilter(new PorterDuffColorFilter(srcColor, PorterDuff.Mode.SRC_ATOP)); @@ -97,7 +101,14 @@ public class DeleteZone extends ImageView implements DropTarget, DragController. // On x-large screens, you can uninstall an app by dragging from all apps if (item instanceof ApplicationInfo && LauncherApplication.isScreenXLarge()) { ApplicationInfo appInfo = (ApplicationInfo)item; - mLauncher.startApplicationUninstallActivity(appInfo.componentName); + if ((appInfo.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0) { + mLauncher.startApplicationUninstallActivity(appInfo.componentName); + } else { + // System applications cannot be installed. For now, show a toast explaining that. + // We may give them the option of disabling apps this way. + int messageId = R.string.uninstall_system_app_text; + Toast.makeText(mContext, messageId, Toast.LENGTH_SHORT).show(); + } } if (item.container == -1) return; |