Merge "Synchronizing on the new-apps list before modifying it. (Bug 6621553)" into jb-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 20c4a9d..dbeb7bc 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -74,7 +74,7 @@
android:stateNotNeeded="true"
android:theme="@style/Theme"
android:windowSoftInputMode="adjustPan"
- android:screenOrientation="portrait">
+ android:screenOrientation="nosensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
diff --git a/res/layout-sw600dp-port/all_apps_cling.xml b/res/layout-sw600dp-port/all_apps_cling.xml
index 95d7ff2..0498224 100644
--- a/res/layout-sw600dp-port/all_apps_cling.xml
+++ b/res/layout-sw600dp-port/all_apps_cling.xml
@@ -41,9 +41,10 @@
<Button
style="@style/ClingButton"
android:id="@+id/cling_dismiss"
+ android:minWidth="168dp"
android:textSize="24sp"
- android:layout_marginBottom="27dp"
+ android:layout_marginTop="235dp"
android:layout_marginRight="36dp"
- android:layout_gravity="bottom|right"
+ android:layout_gravity="top|right"
android:onClick="dismissAllAppsCling" />
</com.android.launcher2.Cling>
diff --git a/res/layout-sw600dp-port/folder_cling.xml b/res/layout-sw600dp-port/folder_cling.xml
index 1b6c1a0..e3a9caa 100644
--- a/res/layout-sw600dp-port/folder_cling.xml
+++ b/res/layout-sw600dp-port/folder_cling.xml
@@ -42,6 +42,7 @@
<Button
style="@style/ClingButton"
android:id="@+id/cling_dismiss"
+ android:minWidth="168dp"
android:textSize="24sp"
android:layout_marginBottom="27dp"
android:layout_marginRight="36dp"
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 7784cd6..61329ad 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 bbee787..659077f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -690,33 +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();
-
- // Remove the current widget which is inflated with the wrong orientation
- getWorkspace().getParentCellLayoutForView(lahv).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
@@ -3226,7 +3206,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 f1ef0c9..11eb3c1 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;