diff --git a/res/drawable/ic_menu_gallery.png b/res/drawable/ic_menu_gallery.png deleted file mode 100644 index f61bbd8bae..0000000000 Binary files a/res/drawable/ic_menu_gallery.png and /dev/null differ diff --git a/res/drawable/ic_menu_notifications.png b/res/drawable/ic_menu_notifications.png deleted file mode 100644 index 866d4e0bd1..0000000000 Binary files a/res/drawable/ic_menu_notifications.png and /dev/null differ diff --git a/res/drawable/ic_menu_preferences.png b/res/drawable/ic_menu_preferences.png deleted file mode 100755 index b8e71412d8..0000000000 Binary files a/res/drawable/ic_menu_preferences.png and /dev/null differ diff --git a/res/layout/widget_search.xml b/res/layout/widget_search.xml index 4343e27924..95e8052184 100644 --- a/res/layout/widget_search.xml +++ b/res/layout/widget_search.xml @@ -36,6 +36,7 @@ android:singleLine="true" android:selectAllOnFocus="true" android:completionThreshold="1" + android:inputType="textAutoComplete|textSearchString" /> + + "Accueil" + "Dossier" + "Sélectionner l\'arrière-plan à partir de" + "Configurer l\'arrière-plan" + "Galerie des arrière-plans" + "L\'application n\'est pas installée sur votre téléphone." + + + "Renommer le dossier" + "OK" + "Annuler" + + + "Application" + "Raccourci" + + + "Widget" + "Arrière-plan" + "Dossier" + "Horloge" + "Cadre d\'image" + "Rechercher" + "Plus d\'espace libre sur l\'écran Accueil." + "Ajouter" + "Arrière-plan" + "Rechercher" + "Notifications" + "Paramètres" + "installer des raccourcis" + "Permet à une application d\'ajouter des raccourcis sans l\'intervention de l\'utilisateur." + "désinstaller les raccourcis" + "Permet à une application de supprimer les raccourcis sans l\'intervention de l\'utilisateur." + + + + + + + + + "Recherche Google" + diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml new file mode 100644 index 0000000000..d94a156035 --- /dev/null +++ b/res/values-it/strings.xml @@ -0,0 +1,46 @@ + + + "Home" + "Cartella" + "Seleziona sfondo da" + "Imposta sfondo" + "Galleria sfondi" + "Applicazione non installata sul telefono." + + + "Rinomina cartella" + "OK" + "Annulla" + + + "Applicazione" + "Collegamento" + + + "Widget" + "Sfondo" + "Cartella" + "Orologio" + "Cornice immagini" + "Ricerca" + "Spazio nella schermata Home esaurito." + "Aggiungi" + "Sfondo" + "Cerca" + "Notifiche" + "Impostazioni" + "aggiungere collegamenti" + "Consente a un\'applicazione di aggiungere collegamenti automaticamente." + "eliminare collegamenti" + "Consente a un\'applicazione di rimuovere collegamenti automaticamente." + + + + + + + + + "Ricerca Google" + diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000000..7657890c94 --- /dev/null +++ b/res/values-zh-rCN/strings.xml @@ -0,0 +1,46 @@ + + + "主页" + "文件夹" + "选择壁纸" + "设置壁纸" + "壁纸图库" + "您的手机上没有安装应用程序。" + + + "重命名文件夹" + "确定" + "取消" + + + "应用程序" + "快捷键" + + + "小工具" + "壁纸" + "文件夹" + "时钟" + "相框" + "搜索" + "该“主页”屏幕上没有多余空间。" + "添加" + "壁纸" + "搜索" + "通知" + "设置" + "安装快捷键" + "允许应用程序在没有用户介入的情况下添加快捷键。" + "卸载快捷键" + "允许应用程序在没有用户介入的情况下删除快捷键。" + + + + + + + + + "Google 搜索" + diff --git a/src/com/android/launcher/HandleView.java b/src/com/android/launcher/HandleView.java index 437d559b71..9afe41cacc 100644 --- a/src/com/android/launcher/HandleView.java +++ b/src/com/android/launcher/HandleView.java @@ -49,7 +49,7 @@ public class HandleView extends ImageView { @Override public View focusSearch(int direction) { View newFocus = super.focusSearch(direction); - if (newFocus == null) { + if (newFocus == null && mLauncher.isDrawerDown()) { final Workspace workspace = mLauncher.getWorkspace(); workspace.dispatchUnhandledMove(null, direction); return (mOrientation == ORIENTATION_HORIZONTAL && direction == FOCUS_DOWN) ? diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java index 928f4caecd..01001c0177 100644 --- a/src/com/android/launcher/Launcher.java +++ b/src/com/android/launcher/Launcher.java @@ -45,6 +45,7 @@ import android.os.IBinder; import android.os.Parcelable; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.Message; import android.provider.*; import android.telephony.PhoneNumberUtils; import android.text.Selection; @@ -260,7 +261,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On private void startLoaders() { sModel.loadApplications(true, this, mLocaleChanged); - sModel.loadUserItems(!mLocaleChanged, this, mLocaleChanged); + sModel.loadUserItems(!mLocaleChanged, this, mLocaleChanged, true); mRestoring = false; } @@ -812,13 +813,13 @@ public final class Launcher extends Activity implements View.OnClickListener, On .setIcon(android.R.drawable.ic_menu_add) .setAlphabeticShortcut('A'); menu.add(0, MENU_WALLPAPER_SETTINGS, 0, R.string.menu_wallpaper) - .setIcon(R.drawable.ic_menu_gallery) + .setIcon(android.R.drawable.ic_menu_gallery) .setAlphabeticShortcut('W'); menu.add(0, MENU_SEARCH, 0, R.string.menu_search) .setIcon(android.R.drawable.ic_search_category_default) .setAlphabeticShortcut(SearchManager.MENU_KEY); menu.add(0, MENU_NOTIFICATIONS, 0, R.string.menu_notifications) - .setIcon(R.drawable.ic_menu_notifications) + .setIcon(android.R.drawable.ic_menu_notifications) .setAlphabeticShortcut('N'); final Intent settings = new Intent(android.provider.Settings.ACTION_SETTINGS); @@ -826,7 +827,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); menu.add(0, MENU_SETTINGS, 0, R.string.menu_settings) - .setIcon(R.drawable.ic_menu_preferences).setAlphabeticShortcut('P') + .setIcon(android.R.drawable.ic_menu_preferences).setAlphabeticShortcut('P') .setIntent(settings); return true; @@ -1111,7 +1112,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On private void onFavoritesChanged() { mDesktopLocked = true; mDrawer.lock(); - sModel.loadUserItems(false, this, false); + sModel.loadUserItems(false, this, false, false); } void onDesktopItemsLoaded() { @@ -1119,7 +1120,80 @@ public final class Launcher extends Activity implements View.OnClickListener, On bindDesktopItems(); mAllAppsGrid.setAdapter(Launcher.getModel().getApplicationsAdapter()); + } + /** + * Refreshes the shortcuts shown on the workspace. + */ + private void bindDesktopItems() { + final ArrayList shortcuts = sModel.getDesktopItems(); + if (shortcuts == null) { + return; + } + + final Workspace workspace = mWorkspace; + int count = workspace.getChildCount(); + for (int i = 0; i < count; i++) { + ((ViewGroup) workspace.getChildAt(i)).removeAllViewsInLayout(); + } + + count = shortcuts.size(); + + final DesktopItemsBinder binder = new DesktopItemsBinder(this, shortcuts); + binder.obtainMessage(DesktopItemsBinder.MESSAGE_BIND_ITEMS, 0, count).sendToTarget(); + } + + private void bindItems(Launcher.DesktopItemsBinder binder, + ArrayList shortcuts, int start, int count) { + + final Workspace workspace = mWorkspace; + final boolean desktopLocked = mDesktopLocked; + + final int end = Math.min(start + DesktopItemsBinder.ITEMS_COUNT, count); + int i = start; + + for ( ; i < end; i++) { + final ItemInfo item = shortcuts.get(i); + switch (item.itemType) { + case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION: + case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: + final View shortcut = createShortcut((ApplicationInfo) item); + workspace.addInScreen(shortcut, item.screen, item.cellX, item.cellY, 1, 1, + !desktopLocked); + break; + case LauncherSettings.Favorites.ITEM_TYPE_USER_FOLDER: + final FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this, + (ViewGroup) workspace.getChildAt(workspace.getCurrentScreen()), + (UserFolderInfo) item); + workspace.addInScreen(newFolder, item.screen, item.cellX, item.cellY, 1, 1, + !desktopLocked); + break; + case LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER: + final FolderIcon newLiveFolder = LiveFolderIcon.fromXml( + R.layout.live_folder_icon, this, + (ViewGroup) workspace.getChildAt(workspace.getCurrentScreen()), + (LiveFolderInfo) item); + workspace.addInScreen(newLiveFolder, item.screen, item.cellX, item.cellY, 1, 1, + !desktopLocked); + break; + default: + final Widget widget = (Widget) item; + final View view = createWidget(mInflater, widget); + view.setTag(widget); + workspace.addWidget(view, widget, !desktopLocked); + } + } + + workspace.requestLayout(); + + if (end >= count) { + finishBindDesktopItems(); + } else { + binder.obtainMessage(DesktopItemsBinder.MESSAGE_BIND_ITEMS, i, count).sendToTarget(); + } + } + + private void finishBindDesktopItems() { if (mSavedState != null) { mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus(); @@ -1152,57 +1226,6 @@ public final class Launcher extends Activity implements View.OnClickListener, On mDrawer.unlock(); } - /** - * Refreshes the shortcuts shown on the workspace. - */ - private void bindDesktopItems() { - final ArrayList shortcuts = sModel.getDesktopItems(); - if (shortcuts == null) { - return; - } - - final Workspace workspace = mWorkspace; - int count = workspace.getChildCount(); - for (int i = 0; i < count; i++) { - ((ViewGroup) workspace.getChildAt(i)).removeAllViewsInLayout(); - } - - count = shortcuts.size(); - for (int i = 0; i < count; i++) { - final ItemInfo item = shortcuts.get(i); - switch (item.itemType) { - case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION: - case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: - final View shortcut = createShortcut((ApplicationInfo) item); - workspace.addInScreen(shortcut, item.screen, item.cellX, item.cellY, 1, 1, - !mDesktopLocked); - break; - case LauncherSettings.Favorites.ITEM_TYPE_USER_FOLDER: - final FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this, - (ViewGroup) mWorkspace.getChildAt(mWorkspace.getCurrentScreen()), - ((UserFolderInfo) item)); - workspace.addInScreen(newFolder, item.screen, item.cellX, item.cellY, 1, 1, - !mDesktopLocked); - break; - case LauncherSettings.Favorites.ITEM_TYPE_LIVE_FOLDER: - final FolderIcon newLiveFolder = LiveFolderIcon.fromXml( - R.layout.live_folder_icon, this, - (ViewGroup) mWorkspace.getChildAt(mWorkspace.getCurrentScreen()), - ((LiveFolderInfo) item)); - workspace.addInScreen(newLiveFolder, item.screen, item.cellX, item.cellY, 1, 1, - !mDesktopLocked); - break; - default: - final Widget widget = (Widget)item; - final View view = createWidget(mInflater, widget); - view.setTag(widget); - workspace.addWidget(view, widget, !mDesktopLocked); - } - } - - workspace.requestLayout(); - } - private View createWidget(LayoutInflater inflater, Widget widget) { final Workspace workspace = mWorkspace; final int screen = workspace.getCurrentScreen(); @@ -1456,7 +1479,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On if (mDesktopLocked) { mDrawer.lock(); - sModel.loadUserItems(false, Launcher.this, false); + sModel.loadUserItems(false, Launcher.this, false, false); } else { final FolderIcon folderIcon = (FolderIcon) mWorkspace.getViewForTag(mFolderInfo); @@ -1466,7 +1489,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On } else { mDesktopLocked = true; mDrawer.lock(); - sModel.loadUserItems(false, Launcher.this, false); + sModel.loadUserItems(false, Launcher.this, false, false); } } } @@ -1635,4 +1658,28 @@ public final class Launcher extends Activity implements View.OnClickListener, On public void onScrollEnded() { } } + + private static class DesktopItemsBinder extends Handler { + static final int MESSAGE_BIND_ITEMS = 0x1; + // Number of items to bind in every pass + static final int ITEMS_COUNT = 6; + + private final ArrayList mShortcuts; + private final WeakReference mLauncher; + + DesktopItemsBinder(Launcher launcher, ArrayList shortcuts) { + mLauncher = new WeakReference(launcher); + mShortcuts = shortcuts; + } + + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MESSAGE_BIND_ITEMS: + Launcher launcher = mLauncher.get(); + if (launcher != null) launcher.bindItems(this, mShortcuts, msg.arg1, msg.arg2); + break; + } + } + } } diff --git a/src/com/android/launcher/LauncherModel.java b/src/com/android/launcher/LauncherModel.java index 0ef2a806b7..314a502d4e 100644 --- a/src/com/android/launcher/LauncherModel.java +++ b/src/com/android/launcher/LauncherModel.java @@ -28,9 +28,9 @@ import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.graphics.drawable.BitmapDrawable; import android.net.Uri; import android.util.Log; +import android.os.Process; import java.util.ArrayList; import java.util.Collections; @@ -45,7 +45,6 @@ import java.net.URISyntaxException; * Maintains in-memory state of the Launcher. It is expected that there should be only one * LauncherModel object held in a static. Also provide APIs for updating the database state * for the Launcher - * */ public class LauncherModel { private static final int UI_NOTIFICATION_RATE = 4; @@ -104,6 +103,13 @@ public class LauncherModel { } mApplicationsLoaded = false; + + if (!isLaunching) { + startApplicationsLoader(launcher); + } + } + + private void startApplicationsLoader(Launcher launcher) { mApplicationsLoader = new ApplicationsLoader(launcher); mLoader = new Thread(mApplicationsLoader, "Applications Loader"); mLoader.start(); @@ -130,6 +136,8 @@ public class LauncherModel { public void run() { mRunning = true; + android.os.Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); + Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); @@ -221,8 +229,11 @@ public class LauncherModel { * Loads all of the items on the desktop, in folders, or in the dock. * These can be apps, shortcuts or widgets */ - void loadUserItems(boolean isLaunching, Launcher launcher, boolean localeChanged) { + void loadUserItems(boolean isLaunching, Launcher launcher, boolean localeChanged, + boolean loadApplications) { + if (isLaunching && mDesktopItems != null && mDesktopItemsLoaded) { + if (loadApplications) startApplicationsLoader(launcher); // We have already loaded our data from the DB launcher.onDesktopItemsLoaded(); return; @@ -240,7 +251,7 @@ public class LauncherModel { } mDesktopItemsLoaded = false; - mDesktopItemsLoader = new DesktopItemsLoader(launcher, localeChanged); + mDesktopItemsLoader = new DesktopItemsLoader(launcher, localeChanged, loadApplications); mDesktopLoader = new Thread(mDesktopItemsLoader, "Desktop Items Loader"); mDesktopLoader.start(); } @@ -317,9 +328,11 @@ public class LauncherModel { private volatile boolean mRunning; private final WeakReference mLauncher; - private boolean mLocaleChanged; + private final boolean mLocaleChanged; + private final boolean mLoadApplications; - DesktopItemsLoader(Launcher launcher, boolean localeChanged) { + DesktopItemsLoader(Launcher launcher, boolean localeChanged, boolean loadApplications) { + mLoadApplications = loadApplications; mLauncher = new WeakReference(launcher); mLocaleChanged = localeChanged; } @@ -532,6 +545,7 @@ public class LauncherModel { launcher.onDesktopItemsLoaded(); } }); + if (mLoadApplications) startApplicationsLoader(launcher); } if (!mStopped) {