merge in jb-mr1-release history after reset to jb-mr1-dev
diff --git a/res/layout/custom_workspace_cling.xml b/res/layout/custom_workspace_cling.xml
new file mode 100644
index 0000000..5bdc587
--- /dev/null
+++ b/res/layout/custom_workspace_cling.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- dummy layout, to be replaced in overlays -->
+<com.android.launcher2.Cling
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+ launcher:drawIdentifier="workspace_custom">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="20dp"
+ android:textColor="@android:color/holo_blue_light"
+ android:text="@string/dummy_custom_cling_error_message"
+ android:gravity="left"
+ android:layout_gravity="bottom|left"
+ />
+</com.android.launcher2.Cling>
diff --git a/res/values-am/strings.xml b/res/values-am/strings.xml
index 2319638..63a0972 100644
--- a/res/values-am/strings.xml
+++ b/res/values-am/strings.xml
@@ -91,7 +91,7 @@
<string name="default_scroll_format" msgid="4057140866420001240">"ገጽ %1$d የ %2$d"</string>
<string name="workspace_scroll_format" msgid="1704767047951143301">"መነሻ ማያ ገጽ %1$d ከ%2$d"</string>
<string name="apps_customize_apps_scroll_format" msgid="5494241912377704885">"Appsገጽ %1$d የ %2$d"</string>
- <string name="apps_customize_widgets_scroll_format" msgid="5383009742241717437">"ምግብሮች ገጽ %1$d የ %2$d"</string>
+ <string name="apps_customize_widgets_scroll_format" msgid="5383009742241717437">"ፍርግሞች ገጽ %1$d የ %2$d"</string>
<string name="workspace_cling_title" msgid="738396473989890567">"እቤትህ እንዳለህ ሆነሀ ዘና በል"</string>
<string name="workspace_cling_move_item" msgid="791013895761065070">"ተወዳጅ መተግበሪያዎችህን እዚህ ላይ ማስቀመጥ ትችላለህ፡፡"</string>
<string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"ሁሉንም መተግበሪያዎችህን ለማየት፣ ክቡን ንካ::"</string>
diff --git a/res/values-ca/strings.xml b/res/values-ca/strings.xml
index 6ed84db..dc1f72f 100644
--- a/res/values-ca/strings.xml
+++ b/res/values-ca/strings.xml
@@ -19,13 +19,13 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="application_name" msgid="8424725141379931883">"Barra d\'execució ràpida"</string>
- <string name="home" msgid="5921706419368316758">"Pàgina d\'inici"</string>
+ <string name="application_name" msgid="8424725141379931883">"Menú d\'aplicacions"</string>
+ <string name="home" msgid="5921706419368316758">"Casa"</string>
<string name="uid_name" msgid="3371120195364560632">"Aplicacions principals d\'Android"</string>
<string name="folder_name" msgid="8551881338202938211"></string>
<string name="chooser_wallpaper" msgid="6063168087625352235">"Selecciona fons de pantalla de"</string>
- <string name="wallpaper_instructions" msgid="4215640646180727542">"Defineix l\'empaperat"</string>
- <string name="pick_wallpaper" msgid="5630222540525626723">"Empaperats"</string>
+ <string name="wallpaper_instructions" msgid="4215640646180727542">"Estableix el fons de pantalla"</string>
+ <string name="pick_wallpaper" msgid="5630222540525626723">"Fons de pantalla"</string>
<string name="activity_not_found" msgid="217823393239365967">"L\'aplicació no s\'ha instal·lat."</string>
<string name="widgets_tab_label" msgid="9145860100000983599">"Widgets"</string>
<string name="long_press_widget_to_add" msgid="7395697462851217506">"Mantén premut un widget per triar-lo."</string>
@@ -40,7 +40,7 @@
<string name="group_applications" msgid="2103752818818161976">"Aplicacions"</string>
<string name="group_shortcuts" msgid="9133529424900391877">"Dreceres"</string>
<string name="group_widgets" msgid="6704978494073105844">"Widgets"</string>
- <string name="group_wallpapers" msgid="1568191644272224858">"Empaperats"</string>
+ <string name="group_wallpapers" msgid="1568191644272224858">"Fons de pantalla"</string>
<string name="completely_out_of_space" msgid="1759078539443491182">"No queda espai a les pantalles d\'inici."</string>
<string name="out_of_space" msgid="8365249326091984698">"Ja no queda espai en aquesta pantalla Inici."</string>
<string name="hotseat_out_of_space" msgid="6304886797358479361">"No queda espai al hotseat."</string>
@@ -92,8 +92,8 @@
<string name="workspace_scroll_format" msgid="1704767047951143301">"Pantalla d\'inici %1$d de %2$d"</string>
<string name="apps_customize_apps_scroll_format" msgid="5494241912377704885">"Pàgina d\'aplicacions %1$d de %2$d"</string>
<string name="apps_customize_widgets_scroll_format" msgid="5383009742241717437">"Pàgina de widgets %1$d de %2$d"</string>
- <string name="workspace_cling_title" msgid="738396473989890567">"Posa\'t còmode"</string>
- <string name="workspace_cling_move_item" msgid="791013895761065070">"Pots posar les teves aplicacions preferides aquí."</string>
+ <string name="workspace_cling_title" msgid="738396473989890567">"Personalitza el teu escriptori"</string>
+ <string name="workspace_cling_move_item" msgid="791013895761065070">"Ací pots col·locar les teves aplicacions preferides."</string>
<string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"Per veure totes les aplicacions, toca el cercle."</string>
<string name="all_apps_cling_title" msgid="2559734712581447107">"Tria algunes aplicacions"</string>
<string name="all_apps_cling_add_item" msgid="5665035103260318891">"Per afegir una aplicació a la pantalla d\'inici, mantén-la premuda."</string>
diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml
index 9f48ef2..abdb30a 100644
--- a/res/values-fa/strings.xml
+++ b/res/values-fa/strings.xml
@@ -92,11 +92,11 @@
<string name="workspace_scroll_format" msgid="1704767047951143301">"صفحهٔ اصلی %1$d از %2$d"</string>
<string name="apps_customize_apps_scroll_format" msgid="5494241912377704885">"صفحه برنامهها %1$d از %2$d"</string>
<string name="apps_customize_widgets_scroll_format" msgid="5383009742241717437">"صفحه ابزارکها %1$d از %2$d"</string>
- <string name="workspace_cling_title" msgid="738396473989890567">"احساس کنید در خانه هستید"</string>
- <string name="workspace_cling_move_item" msgid="791013895761065070">"برنامههای مورد دلخواه خود را میتوانید در اینجا قرار دهید."</string>
+ <string name="workspace_cling_title" msgid="738396473989890567">"منزل خودتان است"</string>
+ <string name="workspace_cling_move_item" msgid="791013895761065070">"میتوانید برنامههای دلخواه خود را اینجا بگذارید."</string>
<string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"برای مشاهدهٔ تمام برنامههای خود، حلقه را لمس کنید."</string>
- <string name="all_apps_cling_title" msgid="2559734712581447107">"انتخاب چند برنامه"</string>
- <string name="all_apps_cling_add_item" msgid="5665035103260318891">"برای افزودن یک برنامه به صفحهٔ اصلی خود، آن را لمس کرده و نگه دارید."</string>
+ <string name="all_apps_cling_title" msgid="2559734712581447107">"چندتا برنامه انتخاب کنید"</string>
+ <string name="all_apps_cling_add_item" msgid="5665035103260318891">"اگر میخواهید برنامهای را به صفحهٔ اصلی خود اضافه کنید، آن را لمس کرده و نگه دارید."</string>
<string name="folder_cling_title" msgid="4308949882377840953">"برنامههای خود را با پوشهها سازماندهی کنید"</string>
<string name="folder_cling_move_item" msgid="270598675060435169">"برای جابجا کردن یک برنامه، آن را لمس کرده و نگهدارید."</string>
<string name="folder_cling_create_folder" msgid="8352867485656129478">"برای ایجاد یک پوشه جدید در صفحهٔ اصلی خود، یک برنامه را در بالای دیگری قرار دهید."</string>
diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml
index 7e29730..a049d2e 100644
--- a/res/values-ja/strings.xml
+++ b/res/values-ja/strings.xml
@@ -61,7 +61,7 @@
<string name="accessibility_voice_search_button" msgid="3938249215065842475">"音声検索"</string>
<string name="accessibility_all_apps_button" msgid="8803738611398979849">"アプリ"</string>
<string name="accessibility_delete_button" msgid="3628162007991023603">"削除"</string>
- <string name="delete_zone_label_all_apps_system_app" msgid="3683920959591819044">"アップデートをアンインストール"</string>
+ <string name="delete_zone_label_all_apps_system_app" msgid="3683920959591819044">"アップデートを削除"</string>
<string name="menu_add" msgid="3065046628354640854">"追加"</string>
<string name="menu_manage_apps" msgid="2308685199463588895">"アプリの管理"</string>
<string name="menu_wallpaper" msgid="5837429080911269832">"壁紙"</string>
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
index 676edcb..c09d328 100644
--- a/res/values-sw/strings.xml
+++ b/res/values-sw/strings.xml
@@ -68,7 +68,7 @@
<string name="menu_search" msgid="4826514464423239041">"Tafuta"</string>
<string name="menu_notifications" msgid="6424587053194766192">"Arifa"</string>
<string name="menu_settings" msgid="3946232973327980394">"Mipangilio ya mfumo"</string>
- <string name="menu_help" msgid="4901160661634590633">"Msaada"</string>
+ <string name="menu_help" msgid="4901160661634590633">"Usaidizi"</string>
<string name="cab_menu_delete_app" msgid="4089398025537640349">"Sanidua programu"</string>
<string name="cab_menu_app_info" msgid="914548323652698884">"Maelezo ya programu"</string>
<string name="cab_app_selection_text" msgid="6378522164293415735">"Programu 1 imechaguliwa"</string>
@@ -95,7 +95,7 @@
<string name="apps_customize_apps_scroll_format" msgid="5494241912377704885">"Ukurasa wa programu %1$d ya %2$d"</string>
<string name="apps_customize_widgets_scroll_format" msgid="5383009742241717437">"Ukurasa wa wijeti %1$d ya %2$d"</string>
<string name="workspace_cling_title" msgid="738396473989890567">"Jisikie huru"</string>
- <string name="workspace_cling_move_item" msgid="791013895761065070">"Unaweza kuweka prog zako uzipendazo hapa."</string>
+ <string name="workspace_cling_move_item" msgid="791013895761065070">"Unaweza kuweka programu zako uzipendazo hapa."</string>
<string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"Kutazama programu zako zote, gusa duara."</string>
<string name="all_apps_cling_title" msgid="2559734712581447107">"Chagua programu kadhaa"</string>
<string name="all_apps_cling_add_item" msgid="5665035103260318891">"Ili kuongeza programu kwa skrini yako ya Nyumbani, iguse na uishikilie."</string>
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 4e8281e..439709a 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -72,7 +72,7 @@
<!-- The size of the image which sits behind the preview of the folder contents -->
<dimen name="folder_cell_width">96dp</dimen>
<dimen name="folder_cell_height">96dp</dimen>
- <dimen name="folder_preview_size">75dp</dimen>
+ <dimen name="folder_preview_size">70dp</dimen>
<dimen name="folder_width_gap">2dp</dimen>
<dimen name="folder_height_gap">2dp</dimen>
<dimen name="folder_padding">4dp</dimen>
diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml
index 5031ea9..5cb330c 100644
--- a/res/values-uk/strings.xml
+++ b/res/values-uk/strings.xml
@@ -95,7 +95,7 @@
<string name="workspace_cling_title" msgid="738396473989890567">"Влаштовуйтеся зручніше"</string>
<string name="workspace_cling_move_item" msgid="791013895761065070">"Тут можна розмістити вибрані програми."</string>
<string name="workspace_cling_open_all_apps" msgid="2459977609848572588">"Щоб побачити всі свої програми, торкніться кола."</string>
- <string name="all_apps_cling_title" msgid="2559734712581447107">"Виберіть декілька програм"</string>
+ <string name="all_apps_cling_title" msgid="2559734712581447107">"Виберіть програми"</string>
<string name="all_apps_cling_add_item" msgid="5665035103260318891">"Щоб додати програму на головний екран, торкніться й утримуйте її."</string>
<string name="folder_cling_title" msgid="4308949882377840953">"Організовуйте програми за допомогою папок"</string>
<string name="folder_cling_move_item" msgid="270598675060435169">"Щоб перемістити програму, торкніться й утримуйте її."</string>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index d497c2d..628884f 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -22,6 +22,9 @@
<dimen name="cling_text_block_offset_x">0dp</dimen>
<dimen name="cling_text_block_offset_y">0dp</dimen>
<dimen name="reveal_radius">48dp</dimen>
+ <!-- entries for custom clings, will be set in overlays -->
+ <add-resource type="dimen" name="custom_cling_margin_top" />
+ <add-resource type="dimen" name="custom_cling_margin_right" />
<!-- Workspace -->
<!-- qsb_bar_height_inset represents qsb_bar_height minus the padding
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4aee339..0ea12c4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -244,6 +244,8 @@
<string name="folder_cling_create_folder">To make a new folder on your Home screen, stack one app on top of another.</string>
<!-- The text on the button to dismiss a cling [CHAR_LIMIT=none] -->
<string name="cling_dismiss">OK</string>
+ <!-- Error message on dummy custom cling layout [DO NOT TRANSLATE] -->
+ <string name="dummy_custom_cling_error_message">Error: custom workspace layout passed in but custom cling was not overwritten</string>
<add-resource type="string" name="default_folder_name" />
<!-- Folder accessibility -->
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index b717261..5580381 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -449,8 +449,10 @@
if (mMaxAppCellCountX > -1) {
maxCellCountX = Math.min(maxCellCountX, mMaxAppCellCountX);
}
+ // Temp hack for now: only use the max cell count Y for widget layout
+ int maxWidgetCellCountY = maxCellCountY;
if (mMaxAppCellCountY > -1) {
- maxCellCountY = Math.min(maxCellCountY, mMaxAppCellCountY);
+ maxWidgetCellCountY = Math.min(maxWidgetCellCountY, mMaxAppCellCountY);
}
// Now that the data is ready, we can calculate the content width, the number of cells to
@@ -466,6 +468,7 @@
// Force a measure to update recalculate the gaps
int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
+ mWidgetSpacingLayout.calculateCellCount(width, height, maxCellCountX, maxWidgetCellCountY);
mWidgetSpacingLayout.measure(widthSpec, heightSpec);
mContentWidth = mWidgetSpacingLayout.getContentWidth();
diff --git a/src/com/android/launcher2/HideFromAccessibilityHelper.java b/src/com/android/launcher2/HideFromAccessibilityHelper.java
new file mode 100644
index 0000000..0b2ce5b
--- /dev/null
+++ b/src/com/android/launcher2/HideFromAccessibilityHelper.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher2;
+
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewGroup.OnHierarchyChangeListener;
+
+import java.util.HashMap;
+
+public class HideFromAccessibilityHelper implements OnHierarchyChangeListener {
+ private HashMap<View, Integer> mPreviousValues;
+ boolean mHide;
+ boolean mOnlyAllApps;
+
+ public HideFromAccessibilityHelper() {
+ mPreviousValues = new HashMap<View, Integer>();
+ mHide = false;
+ }
+
+ public void setImportantForAccessibilityToNo(View v, boolean onlyAllApps) {
+ mOnlyAllApps = onlyAllApps;
+ setImportantForAccessibilityToNoHelper(v);
+ mHide = true;
+ }
+
+ private void setImportantForAccessibilityToNoHelper(View v) {
+ mPreviousValues.put(v, v.getImportantForAccessibility());
+ v.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
+
+ // Call method on children recursively
+ if (v instanceof ViewGroup) {
+ ViewGroup vg = (ViewGroup) v;
+ vg.setOnHierarchyChangeListener(this);
+ for (int i = 0; i < vg.getChildCount(); i++) {
+ View child = vg.getChildAt(i);
+
+ if (includeView(child)) {
+ setImportantForAccessibilityToNoHelper(child);
+ }
+ }
+ }
+ }
+
+ public void restoreImportantForAccessibility(View v) {
+ if (mHide) {
+ restoreImportantForAccessibilityHelper(v);
+ }
+ mHide = false;
+ }
+
+ private void restoreImportantForAccessibilityHelper(View v) {
+ v.setImportantForAccessibility(mPreviousValues.get(v));
+ mPreviousValues.remove(v);
+
+ // Call method on children recursively
+ if (v instanceof ViewGroup) {
+ ViewGroup vg = (ViewGroup) v;
+
+ // We assume if a class implements OnHierarchyChangeListener, it listens
+ // to changes to any of its children (happens to be the case in Launcher)
+ if (vg instanceof OnHierarchyChangeListener) {
+ vg.setOnHierarchyChangeListener((OnHierarchyChangeListener) vg);
+ } else {
+ vg.setOnHierarchyChangeListener(null);
+ }
+ for (int i = 0; i < vg.getChildCount(); i++) {
+ View child = vg.getChildAt(i);
+ if (includeView(child)) {
+ restoreImportantForAccessibilityHelper(child);
+ }
+ }
+ }
+ }
+
+ public void onChildViewAdded(View parent, View child) {
+ if (mHide && includeView(child)) {
+ setImportantForAccessibilityToNoHelper(child);
+ }
+ }
+
+ public void onChildViewRemoved(View parent, View child) {
+ if (mHide && includeView(child)) {
+ restoreImportantForAccessibilityHelper(child);
+ }
+ }
+
+ private boolean includeView(View v) {
+ return !hasAncestorOfType(v, Cling.class) &&
+ (!mOnlyAllApps || hasAncestorOfType(v, AppsCustomizeTabHost.class));
+ }
+
+ private boolean hasAncestorOfType(View v, Class c) {
+ return v != null &&
+ (v.getClass().equals(c) ||
+ (v.getParent() instanceof ViewGroup &&
+ hasAncestorOfType((ViewGroup) v.getParent(), c)));
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index e31df56..6095a2f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -300,6 +300,9 @@
private BubbleTextView mWaitingForResume;
+ private HideFromAccessibilityHelper mHideFromAccessibilityHelper
+ = new HideFromAccessibilityHelper();
+
private Runnable mBuildLayersRunnable = new Runnable() {
public void run() {
if (mWorkspace != null) {
@@ -3661,8 +3664,9 @@
return true;
}
+
private Cling initCling(int clingId, int[] positionData, boolean animate, int delay) {
- Cling cling = (Cling) findViewById(clingId);
+ final Cling cling = (Cling) findViewById(clingId);
if (cling != null) {
cling.init(this, positionData);
cling.setVisibility(View.VISIBLE);
@@ -3679,11 +3683,21 @@
} else {
cling.setAlpha(1f);
}
+ cling.setFocusableInTouchMode(true);
+ cling.post(new Runnable() {
+ public void run() {
+ cling.setFocusable(true);
+ cling.requestFocus();
+ }
+ });
+ mHideFromAccessibilityHelper.setImportantForAccessibilityToNo(
+ mDragLayer, clingId == R.id.all_apps_cling);
}
return cling;
}
+
private void dismissCling(final Cling cling, final String flag, int duration) {
- if (cling != null) {
+ if (cling != null && cling.getVisibility() == View.VISIBLE) {
ObjectAnimator anim = LauncherAnimUtils.ofFloat(cling, "alpha", 0f);
anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
@@ -3701,8 +3715,10 @@
};
});
anim.start();
+ mHideFromAccessibilityHelper.restoreImportantForAccessibility(mDragLayer);
}
}
+
private void removeCling(int id) {
final View cling = findViewById(id);
if (cling != null) {
@@ -3713,6 +3729,7 @@
parent.removeView(cling);
}
});
+ mHideFromAccessibilityHelper.restoreImportantForAccessibility(mDragLayer);
}
}
@@ -3732,6 +3749,20 @@
if (isClingsEnabled() &&
!mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false) &&
!skipCustomClingIfNoAccounts() ) {
+ // If we're not using the default workspace layout, replace workspace cling
+ // with a custom workspace cling (usually specified in an overlay)
+ // For now, only do this on tablets
+ if (mSharedPrefs.getInt(LauncherProvider.DEFAULT_WORKSPACE_RESOURCE_ID, 0) != 0 &&
+ LauncherApplication.isScreenLarge()) {
+ // Use a custom cling
+ View cling = findViewById(R.id.workspace_cling);
+ ViewGroup clingParent = (ViewGroup) cling.getParent();
+ int clingIndex = clingParent.indexOfChild(cling);
+ clingParent.removeViewAt(clingIndex);
+ View customCling = mInflater.inflate(R.layout.custom_workspace_cling, clingParent, false);
+ clingParent.addView(customCling, clingIndex);
+ customCling.setId(R.id.workspace_cling);
+ }
initCling(R.id.workspace_cling, null, false, 0);
} else {
removeCling(R.id.workspace_cling);
diff --git a/src/com/android/launcher2/LauncherProvider.java b/src/com/android/launcher2/LauncherProvider.java
index 74cf7a4..8097ac9 100644
--- a/src/com/android/launcher2/LauncherProvider.java
+++ b/src/com/android/launcher2/LauncherProvider.java
@@ -74,6 +74,8 @@
static final String PARAMETER_NOTIFY = "notify";
static final String DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED =
"DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED";
+ static final String DEFAULT_WORKSPACE_RESOURCE_ID =
+ "DEFAULT_WORKSPACE_RESOURCE_ID";
private static final String ACTION_APPWIDGET_DEFAULT_WORKSPACE_CONFIGURE =
"com.android.launcher.action.APPWIDGET_DEFAULT_WORKSPACE_CONFIGURE";
@@ -206,18 +208,23 @@
/**
* @param workspaceResId that can be 0 to use default or non-zero for specific resource
*/
- synchronized public void loadDefaultFavoritesIfNecessary(int workspaceResId) {
+ synchronized public void loadDefaultFavoritesIfNecessary(int origWorkspaceResId) {
String spKey = LauncherApplication.getSharedPreferencesKey();
SharedPreferences sp = getContext().getSharedPreferences(spKey, Context.MODE_PRIVATE);
if (sp.getBoolean(DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED, false)) {
+ int workspaceResId = origWorkspaceResId;
+
// Use default workspace resource if none provided
if (workspaceResId == 0) {
- workspaceResId = R.xml.default_workspace;
+ workspaceResId = sp.getInt(DEFAULT_WORKSPACE_RESOURCE_ID, R.xml.default_workspace);
}
// Populate favorites table with initial favorites
SharedPreferences.Editor editor = sp.edit();
editor.remove(DB_CREATED_BUT_DEFAULT_WORKSPACE_NOT_LOADED);
+ if (origWorkspaceResId != 0) {
+ editor.putInt(DEFAULT_WORKSPACE_RESOURCE_ID, origWorkspaceResId);
+ }
mOpenHelper.loadFavorites(mOpenHelper.getWritableDatabase(), workspaceResId);
editor.commit();
}