summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher2/AllApps2D.java14
-rw-r--r--src/com/android/launcher2/AllAppsPagedView.java24
-rw-r--r--src/com/android/launcher2/AppWidgetResizeFrame.java2
-rw-r--r--src/com/android/launcher2/ApplicationInfo.java19
-rw-r--r--src/com/android/launcher2/BubbleTextView.java3
-rw-r--r--src/com/android/launcher2/Launcher.java13
-rw-r--r--src/com/android/launcher2/LauncherAppWidgetHostView.java4
-rw-r--r--src/com/android/launcher2/PagedView.java31
-rw-r--r--src/com/android/launcher2/Workspace.java8
9 files changed, 76 insertions, 42 deletions
diff --git a/src/com/android/launcher2/AllApps2D.java b/src/com/android/launcher2/AllApps2D.java
index a9423be1f..1cbb99994 100644
--- a/src/com/android/launcher2/AllApps2D.java
+++ b/src/com/android/launcher2/AllApps2D.java
@@ -313,19 +313,9 @@ public class AllApps2D
mVisibleAppsList.clear();
if (appType == AppType.ALL) {
mVisibleAppsList.addAll(mAllAppsList);
- } else {
- int searchFlags = 0;
-
- if (appType == AppType.APP) {
- searchFlags = ApplicationInfo.APP_FLAG;
- } else if (appType == AppType.GAME) {
- searchFlags = ApplicationInfo.GAME_FLAG;
- } else if (appType == AppType.DOWNLOADED) {
- searchFlags = ApplicationInfo.DOWNLOADED_FLAG;
- }
-
+ } else if (appType == AppType.DOWNLOADED) {
for (ApplicationInfo info : mAllAppsList) {
- if ((info.flags & searchFlags) != 0) {
+ if ((info.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0) {
mVisibleAppsList.add(info);
}
}
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index bfe6ec171..4158b4ad2 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -203,11 +203,21 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
}
}
- private void setupDragMode() {
+ private void setupDragMode(ApplicationInfo info) {
mLauncher.getWorkspace().shrink(Workspace.ShrinkState.BOTTOM_VISIBLE);
- DeleteZone allAppsDeleteZone = (DeleteZone)
- mLauncher.findViewById(R.id.all_apps_delete_zone);
- allAppsDeleteZone.setDragAndDropEnabled(true);
+
+ // Only show the uninstall button if the app is uninstallable.
+ if ((info.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0) {
+ DeleteZone allAppsDeleteZone = (DeleteZone)
+ mLauncher.findViewById(R.id.all_apps_delete_zone);
+ allAppsDeleteZone.setDragAndDropEnabled(true);
+
+ if ((info.flags & ApplicationInfo.UPDATED_SYSTEM_APP_FLAG) != 0) {
+ allAppsDeleteZone.setText(R.string.delete_zone_label_all_apps_system_app);
+ } else {
+ allAppsDeleteZone.setText(R.string.delete_zone_label_all_apps);
+ }
+ }
ApplicationInfoDropTarget allAppsInfoButton =
(ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
@@ -240,12 +250,12 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
if (!v.isInTouchMode()) return false;
if (!super.beginDragging(v)) return false;
- // Start drag mode after the item is selected
- setupDragMode();
-
ApplicationInfo app = (ApplicationInfo) v.getTag();
app = new ApplicationInfo(app);
+ // Start drag mode after the item is selected
+ setupDragMode(app);
+
// get icon (top compound drawable, index is 1)
final TextView tv = (TextView) v;
final Drawable icon = tv.getCompoundDrawables()[1];
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index 6ddb5b8c3..d17bc5abd 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -55,7 +55,7 @@ public class AppWidgetResizeFrame extends FrameLayout {
mItemInfo = itemInfo;
mCellLayout = cellLayout;
mWidgetView = widgetView;
- mResizeMode = widgetView.getAppWidgetInfo().resizableMode;
+ mResizeMode = widgetView.getAppWidgetInfo().resizeMode;
final AppWidgetProviderInfo info = widgetView.getAppWidgetInfo();
int[] result = mCellLayout.rectToCell(info.minWidth, info.minHeight, null);
diff --git a/src/com/android/launcher2/ApplicationInfo.java b/src/com/android/launcher2/ApplicationInfo.java
index 3adea373e..1d948b738 100644
--- a/src/com/android/launcher2/ApplicationInfo.java
+++ b/src/com/android/launcher2/ApplicationInfo.java
@@ -59,9 +59,9 @@ class ApplicationInfo extends ItemInfo {
ComponentName componentName;
- static final int APP_FLAG = 1;
- static final int GAME_FLAG = 2;
- static final int DOWNLOADED_FLAG = 4;
+ static final int DOWNLOADED_FLAG = 1;
+ static final int UPDATED_SYSTEM_APP_FLAG = 2;
+
int flags = 0;
ApplicationInfo() {
@@ -83,17 +83,12 @@ class ApplicationInfo extends ItemInfo {
int appFlags = pm.getApplicationInfo(packageName, 0).flags;
if ((appFlags & android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0) {
flags |= DOWNLOADED_FLAG;
- }
- if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
- flags |= DOWNLOADED_FLAG;
- }
- firstInstallTime = pm.getPackageInfo(packageName, 0).firstInstallTime;
- // TODO: Figure out how to determine what is a game
- // If it's not a game, it's an app
- if ((flags & GAME_FLAG) == 0) {
- flags |= APP_FLAG;
+ if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
+ flags |= UPDATED_SYSTEM_APP_FLAG;
+ }
}
+ firstInstallTime = pm.getPackageInfo(packageName, 0).firstInstallTime;
} catch (NameNotFoundException e) {
Log.d(TAG, "PackageManager.getApplicationInfo failed for " + packageName);
}
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index 203883eb5..f708e2fda 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -171,9 +171,8 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca
}
/**
- * Draw the View v into the given Canvas.
+ * Draw this BubbleTextView into the given Canvas.
*
- * @param v the view to draw
* @param destCanvas the canvas to draw on
* @param padding the horizontal and vertical padding to use when drawing
*/
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 3cd65b168..3df8c4a6c 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1224,7 +1224,7 @@ public final class Launcher extends Activity
* @param appWidgetId The app widget id
* @param cellInfo The position on screen where to create the widget.
*/
- private void completeAddAppWidget(int appWidgetId, int screen) {
+ private void completeAddAppWidget(final int appWidgetId, int screen) {
AppWidgetProviderInfo appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
// Calculate the grid spans needed to fit this widget
@@ -1254,7 +1254,16 @@ public final class Launcher extends Activity
}
if (!foundCellSpan) {
- if (appWidgetId != -1) mAppWidgetHost.deleteAppWidgetId(appWidgetId);
+ if (appWidgetId != -1) {
+ // Deleting an app widget ID is a void call but writes to disk before returning
+ // to the caller...
+ final LauncherAppWidgetHost appWidgetHost = mAppWidgetHost;
+ new Thread("deleteAppWidgetId") {
+ public void run() {
+ mAppWidgetHost.deleteAppWidgetId(appWidgetId);
+ }
+ }.start();
+ }
showOutOfSpaceMessage();
return;
}
diff --git a/src/com/android/launcher2/LauncherAppWidgetHostView.java b/src/com/android/launcher2/LauncherAppWidgetHostView.java
index 7c5de850d..7f60cac3d 100644
--- a/src/com/android/launcher2/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher2/LauncherAppWidgetHostView.java
@@ -122,8 +122,4 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView
}
super.onVisibilityChanged(changedView, visibility);
}
-
- public int getResizableMode() {
- return getAppWidgetInfo().resizableMode;
- }
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index c2fcd9f21..26ea4a812 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -30,6 +30,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.ActionMode;
+import android.view.InputDevice;
+import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
@@ -1077,6 +1079,35 @@ public abstract class PagedView extends ViewGroup {
return true;
}
+ @Override
+ public boolean onGenericMotionEvent(MotionEvent event) {
+ if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_SCROLL: {
+ // Handle mouse (or ext. device) by shifting the page depending on the scroll
+ final float vscroll;
+ final float hscroll;
+ if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
+ vscroll = 0;
+ hscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
+ } else {
+ vscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);
+ hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
+ }
+ if (hscroll != 0 || vscroll != 0) {
+ if (hscroll > 0 || vscroll > 0) {
+ scrollRight();
+ } else {
+ scrollLeft();
+ }
+ return true;
+ }
+ }
+ }
+ }
+ return super.onGenericMotionEvent(event);
+ }
+
private void acquireVelocityTrackerAndAddMovement(MotionEvent ev) {
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 65aeff480..3e5a96795 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -690,7 +690,11 @@ public class Workspace extends SmoothPagedView
// parallax effects
mWallpaperWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
mWallpaperHeight = (int)(maxDim * wallpaperTravelToScreenHeightRatio(maxDim, minDim));
- mWallpaperManager.suggestDesiredDimensions(mWallpaperWidth, mWallpaperHeight);
+ new Thread("setWallpaperDimension") {
+ public void run() {
+ mWallpaperManager.suggestDesiredDimensions(mWallpaperWidth, mWallpaperHeight);
+ }
+ }.start();
}
public void setVerticalWallpaperOffset(float offset) {
@@ -2305,7 +2309,7 @@ public class Workspace extends SmoothPagedView
final LauncherAppWidgetHostView hostView = (LauncherAppWidgetHostView) cell;
AppWidgetProviderInfo pinfo = hostView.getAppWidgetInfo();
- if (pinfo.resizableMode != AppWidgetProviderInfo.RESIZE_NONE) {
+ if (pinfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) {
post(new Runnable() {
public void run() {
children.addResizeFrame(info, hostView,