diff options
-rw-r--r-- | res/values/strings.xml | 7 | ||||
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 31 |
2 files changed, 38 insertions, 0 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 9ad3e2462..7e8bec048 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -25,6 +25,13 @@ <!-- Do not translate. android:process of this application. --> <string name="process" translate="false"><xliff:g id="x"></xliff:g></string> + <!-- Do not translate. We wish to prioritize the Wallpaper and Live Wallpaper pickers, + but because they are in a different package, we need to reference the component in + a non language-dependent way. If the Live Wallpaper picker component name changes + this will have to be updated as well. --> + <string name="live_wallpaper_picker_package_name" translate="false">com.android.wallpaper.livepicker</string> + <string name="live_wallpaper_picker_class_name" translate="false">com.android.wallpaper.livepicker.LiveWallpaperActivity</string> + <!-- General --> <skip /> <!-- Application name --> diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index fabd9e40b..4500744a1 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -18,6 +18,7 @@ package com.android.launcher2; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.List; import org.xmlpull.v1.XmlPullParser; @@ -167,6 +168,22 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen setDragSlopeThreshold(r.getInteger(R.integer.config_appsCustomizeDragSlopeThreshold)/100f); } + /** Removes and returns the ResolveInfo with the specified ComponentName */ + private ResolveInfo removeResolveInfoWithComponentName(List<ResolveInfo> list, + ComponentName cn) { + Iterator<ResolveInfo> iter = list.iterator(); + while (iter.hasNext()) { + ResolveInfo rinfo = iter.next(); + ActivityInfo info = rinfo.activityInfo; + ComponentName c = new ComponentName(info.packageName, info.name); + if (c.equals(cn)) { + iter.remove(); + return rinfo; + } + } + return null; + } + public void onPackagesUpdated() { // Get the list of widgets and shortcuts mWidgets.clear(); @@ -182,6 +199,20 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen PackageManager.GET_META_DATA); Collections.sort(mWallpapers, new LauncherModel.ShortcutNameComparator(mPackageManager)); + // Move Live Wallpapers to the front of the list + Context c = getContext(); + ResolveInfo liveWallpapers = removeResolveInfoWithComponentName(mWallpapers, + new ComponentName(c.getString(R.string.live_wallpaper_picker_package_name), + c.getString(R.string.live_wallpaper_picker_class_name))); + if (liveWallpapers != null) { + mWallpapers.add(0, liveWallpapers); + } + // Move Wallpapers to the front of the list + ResolveInfo wallpapers = removeResolveInfoWithComponentName(mWallpapers, + new ComponentName(c.getPackageName(), WallpaperChooser.class.getName())); + if (wallpapers != null) { + mWallpapers.add(0, wallpapers); + } } /** |