Merge "Update 600dp clings." into jb-dev
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml
index 19d2152..c2b88d5 100644
--- a/res/values-ru/strings.xml
+++ b/res/values-ru/strings.xml
@@ -75,13 +75,13 @@
<string name="cab_widget_selection_text" msgid="962527270506951955">"Выбран 1 виджет"</string>
<string name="cab_folder_selection_text" msgid="8916111874189565067">"Выбрана 1 папка"</string>
<string name="cab_shortcut_selection_text" msgid="8115847384500412878">"Выбран 1 ярлык"</string>
- <string name="permlab_install_shortcut" msgid="1201690825493376489">"устанавливать ярлыки"</string>
+ <string name="permlab_install_shortcut" msgid="1201690825493376489">"Установка ярлыков"</string>
<string name="permdesc_install_shortcut" msgid="8634424803272077038">"Приложение сможет самостоятельно добавлять ярлыки."</string>
<string name="permlab_uninstall_shortcut" msgid="7696645932555926449">"удалять ярлыки"</string>
<string name="permdesc_uninstall_shortcut" msgid="274355570620220977">"Приложение сможет самостоятельно удалять ярлыки."</string>
- <string name="permlab_read_settings" msgid="3452408290738106747">"считывать настройки и ярлыки главного экрана"</string>
+ <string name="permlab_read_settings" msgid="3452408290738106747">"Просмотр настроек и ярлыков главного экрана"</string>
<string name="permdesc_read_settings" msgid="5788109303585403679">"Приложение получит доступ к данным о настройках и ярлыках на главном экране."</string>
- <string name="permlab_write_settings" msgid="1360567537236705628">"изменять настройки и ярлыки главного экрана"</string>
+ <string name="permlab_write_settings" msgid="1360567537236705628">"Изменение настроек и ярлыков главного экрана"</string>
<string name="permdesc_write_settings" msgid="8530105489115785531">"Приложение сможет изменять настройки и ярлыки на главном экране."</string>
<string name="gadget_error_text" msgid="8359351016167075858">"Не удалось загрузить виджет"</string>
<string name="uninstall_system_app_text" msgid="6429814133777046491">"Это системное приложение, его нельзя удалить."</string>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 45bb08a..ac6ec88 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -310,6 +310,8 @@
private boolean mInTransition;
private ArrayList<AsyncTaskPageData> mDeferredSyncWidgetPageItems =
new ArrayList<AsyncTaskPageData>();
+ private ArrayList<Runnable> mDeferredPrepareLoadWidgetPreviewsTasks =
+ new ArrayList<Runnable>();
// Used for drawing shortcut previews
BitmapCache mCachedShortcutPreviewBitmap = new BitmapCache();
@@ -944,6 +946,10 @@
onSyncWidgetPageItems(d);
}
mDeferredSyncWidgetPageItems.clear();
+ for (Runnable r : mDeferredPrepareLoadWidgetPreviewsTasks) {
+ r.run();
+ }
+ mDeferredPrepareLoadWidgetPreviewsTasks.clear();
mForceDrawAllChildrenNextFrame = !toWorkspace;
}
@@ -1027,6 +1033,7 @@
}
}
mDeferredSyncWidgetPageItems.clear();
+ mDeferredPrepareLoadWidgetPreviewsTasks.clear();
}
public void setContentType(ContentType type) {
@@ -1515,8 +1522,12 @@
loadWidgetPreviewsInBackground(null, data);
onSyncWidgetPageItems(data);
} else {
- prepareLoadWidgetPreviewsTask(page, items,
- maxPreviewWidth, maxPreviewHeight, mWidgetCountX);
+ if (mInTransition) {
+ mDeferredPrepareLoadWidgetPreviewsTasks.add(this);
+ } else {
+ prepareLoadWidgetPreviewsTask(page, items,
+ maxPreviewWidth, maxPreviewHeight, mWidgetCountX);
+ }
}
}
});
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index fb29a41..d7dd648 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -690,41 +690,13 @@
// 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 @@
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 1b17ef9..fc1a26d 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -377,10 +377,6 @@
return items;
}
- static ArrayList<LauncherAppWidgetInfo> 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 ba51889..8b9662b 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -670,6 +670,29 @@
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;