From d479e9ec2ee93137469ced269fc0e343a4f6be73 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 23 May 2012 15:14:34 -0700 Subject: Fixing issue with resource ids. (Bug 6532243) Change-Id: Ie4a245a224038a750e60b0203003638fd561713d --- res/values/attrs.xml | 6 ++++++ res/values/strings.xml | 12 ++++++++++++ res/values/styles.xml | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 224daac53..c76a6a5c4 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -157,4 +157,10 @@ + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 1416d40e9..4aee339e4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -260,4 +260,16 @@ s --> Folder: %1$s + + + + + + + + + + + + diff --git a/res/values/styles.xml b/res/values/styles.xml index 3d935a164..08c98c9f2 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -186,4 +186,10 @@ 0.0 2.0 + + + + -- cgit v1.2.3 From a58cc94bee8fc8c8a0c8673b8ad27fa339a8e83c Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 5 Jun 2012 15:47:30 -0700 Subject: Workaround for crashing on rotation. (Bug 6611883) Change-Id: Iae24d865fb5a5572c6d3e8726569d234a60ce05c --- src/com/android/launcher2/Launcher.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 9cae5e596..105d9436b 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -704,7 +704,8 @@ public final class Launcher extends Activity AppWidgetProviderInfo pInfo = lahv.getAppWidgetInfo(); // Remove the current widget which is inflated with the wrong orientation - getWorkspace().getParentCellLayoutForView(lahv).removeView(lahv); + CellLayout cl = getWorkspace().getParentCellLayoutForView(lahv); + if (cl != null) cl.removeView(lahv); // Re-inflate the widget using the correct orientation AppWidgetHostView widget = mAppWidgetHost.createView(this, info.appWidgetId, pInfo); -- cgit v1.2.3 From e6a43a2e267e763d829fd5a1bfd708df0836e30d Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Tue, 5 Jun 2012 16:03:36 -0700 Subject: Fix workaround for crashing on rotation. (Bug 6611883) Change-Id: Iaf9734d156e5aa48f3630f22a42e17d71af37316 --- src/com/android/launcher2/Launcher.java | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 105d9436b..fb29a4131 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -703,17 +703,24 @@ public final class Launcher extends Activity if (lahv != null && lahv.orientationChangedSincedInflation()) { AppWidgetProviderInfo pInfo = lahv.getAppWidgetInfo(); - // Remove the current widget which is inflated with the wrong orientation - CellLayout cl = getWorkspace().getParentCellLayoutForView(lahv); - if (cl != null) cl.removeView(lahv); - // Re-inflate the widget using the correct orientation - AppWidgetHostView widget = mAppWidgetHost.createView(this, info.appWidgetId, pInfo); - - // Add the new widget back - widget.setTag(info); - info.hostView = widget; - getWorkspace().addInScreen(widget, info.container, info.screen, - info.cellX, info.cellY, info.spanX, info.spanY); + Workspace workspace = getWorkspace(); + CellLayout parent = workspace.getParentCellLayoutForView(lahv); + + // It's possible this AppWidgetHostView is associated with a prior Launcher instance + // in which case it will not have a parent in the current hierarchy (ie. after rotation). + // In this case we will be re-inflating the widgets anyhow, so it's not a problem. + if (parent != null) { + // Remove the current widget which is inflated with the wrong orientation + parent.removeView(lahv); + // Re-inflate the widget using the correct orientation + AppWidgetHostView widget = mAppWidgetHost.createView(this, info.appWidgetId, pInfo); + + // Add the new widget back + widget.setTag(info); + info.hostView = widget; + getWorkspace().addInScreen(widget, info.container, info.screen, + info.cellX, info.cellY, info.spanX, info.spanY); + } } } } -- cgit v1.2.3 From 56e1d9b56977f8b7a496435b96870f4ba5342a6d Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Wed, 6 Jun 2012 11:48:13 -0700 Subject: Defer loading widget previews until after All Apps transition Bug: 6615463 --- src/com/android/launcher2/AppsCustomizePagedView.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 45bb08ac9..ac6ec8800 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -310,6 +310,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen private boolean mInTransition; private ArrayList mDeferredSyncWidgetPageItems = new ArrayList(); + private ArrayList mDeferredPrepareLoadWidgetPreviewsTasks = + new ArrayList(); // Used for drawing shortcut previews BitmapCache mCachedShortcutPreviewBitmap = new BitmapCache(); @@ -944,6 +946,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen onSyncWidgetPageItems(d); } mDeferredSyncWidgetPageItems.clear(); + for (Runnable r : mDeferredPrepareLoadWidgetPreviewsTasks) { + r.run(); + } + mDeferredPrepareLoadWidgetPreviewsTasks.clear(); mForceDrawAllChildrenNextFrame = !toWorkspace; } @@ -1027,6 +1033,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } mDeferredSyncWidgetPageItems.clear(); + mDeferredPrepareLoadWidgetPreviewsTasks.clear(); } public void setContentType(ContentType type) { @@ -1515,8 +1522,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen loadWidgetPreviewsInBackground(null, data); onSyncWidgetPageItems(data); } else { - prepareLoadWidgetPreviewsTask(page, items, - maxPreviewWidth, maxPreviewHeight, mWidgetCountX); + if (mInTransition) { + mDeferredPrepareLoadWidgetPreviewsTasks.add(this); + } else { + prepareLoadWidgetPreviewsTask(page, items, + maxPreviewWidth, maxPreviewHeight, mWidgetCountX); + } } } }); -- cgit v1.2.3 From 38054cad68725f176b36ee871af999c0290ab97b Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Wed, 6 Jun 2012 14:10:04 -0700 Subject: Fixing ConcurrentModificationException (issue 6619380) Change-Id: I49d293a79a463d129e829f823d6b213f3d5ffcf4 --- src/com/android/launcher2/Launcher.java | 31 +--------------------------- src/com/android/launcher2/LauncherModel.java | 4 ---- src/com/android/launcher2/Workspace.java | 23 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index fb29a4131..d7dd6480a 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -690,41 +690,13 @@ public final class Launcher extends Activity // Consequently, the widgets will be inflated in the orientation of the foreground activity // (framework issue). On resuming, we ensure that any widgets are inflated for the current // orientation. - reinflateWidgetsIfNecessary(); + getWorkspace().reinflateWidgetsIfNecessary(); // Again, as with the above scenario, it's possible that one or more of the global icons // were updated in the wrong orientation. updateGlobalIcons(); } - void reinflateWidgetsIfNecessary() { - for (LauncherAppWidgetInfo info: LauncherModel.getWidgets()) { - LauncherAppWidgetHostView lahv = (LauncherAppWidgetHostView) info.hostView; - if (lahv != null && lahv.orientationChangedSincedInflation()) { - AppWidgetProviderInfo pInfo = lahv.getAppWidgetInfo(); - - Workspace workspace = getWorkspace(); - CellLayout parent = workspace.getParentCellLayoutForView(lahv); - - // It's possible this AppWidgetHostView is associated with a prior Launcher instance - // in which case it will not have a parent in the current hierarchy (ie. after rotation). - // In this case we will be re-inflating the widgets anyhow, so it's not a problem. - if (parent != null) { - // Remove the current widget which is inflated with the wrong orientation - parent.removeView(lahv); - // Re-inflate the widget using the correct orientation - AppWidgetHostView widget = mAppWidgetHost.createView(this, info.appWidgetId, pInfo); - - // Add the new widget back - widget.setTag(info); - info.hostView = widget; - getWorkspace().addInScreen(widget, info.container, info.screen, - info.cellX, info.cellY, info.spanX, info.spanY); - } - } - } - } - @Override protected void onPause() { // NOTE: We want all transitions from launcher to act as if the wallpaper were enabled @@ -3230,7 +3202,6 @@ public final class Launcher extends Activity item.hostView = mAppWidgetHost.createView(this, appWidgetId, appWidgetInfo); - item.hostView.setAppWidget(appWidgetId, appWidgetInfo); item.hostView.setTag(item); item.onBindAppWidget(this); diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 1b17ef952..fc1a26d4b 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -377,10 +377,6 @@ public class LauncherModel extends BroadcastReceiver { return items; } - static ArrayList getWidgets() { - return sAppWidgets; - } - /** * Find a folder in the db, creating the FolderInfo if necessary, and adding it to folderList. */ diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index ba518890e..8b9662b3b 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -670,6 +670,29 @@ public class Workspace extends SmoothPagedView return super.onInterceptTouchEvent(ev); } + protected void reinflateWidgetsIfNecessary() { + final int clCount = getChildCount(); + for (int i = 0; i < clCount; i++) { + CellLayout cl = (CellLayout) getChildAt(i); + ShortcutAndWidgetContainer swc = cl.getShortcutsAndWidgets(); + final int itemCount = swc.getChildCount(); + for (int j = 0; j < itemCount; j++) { + View v = swc.getChildAt(j); + + if (v.getTag() instanceof LauncherAppWidgetInfo) { + LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) v.getTag(); + LauncherAppWidgetHostView lahv = (LauncherAppWidgetHostView) info.hostView; + if (lahv != null && lahv.orientationChangedSincedInflation()) { + mLauncher.removeAppWidget(info); + // Remove the current widget which is inflated with the wrong orientation + cl.removeView(lahv); + mLauncher.bindAppWidget(info); + } + } + } + } + } + @Override protected void determineScrollingStart(MotionEvent ev) { if (isSmall()) return; -- cgit v1.2.3