summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-11-08 17:21:15 -0800
committerRomain Guy <romainguy@android.com>2009-11-08 17:21:15 -0800
commit8cfd0d28d1cb57c98f83ad5da8cc77dbaca5914e (patch)
tree50560cd662e0e06e4724c1bbbe86c5417d508b4e
parent2f26cced2d4257c4fb106939447d901ae971b4d1 (diff)
downloadandroid_packages_wallpapers_LivePicker-8cfd0d28d1cb57c98f83ad5da8cc77dbaca5914e.zip
android_packages_wallpapers_LivePicker-8cfd0d28d1cb57c98f83ad5da8cc77dbaca5914e.tar.gz
android_packages_wallpapers_LivePicker-8cfd0d28d1cb57c98f83ad5da8cc77dbaca5914e.tar.bz2
Sort live wallpapers alphabetically and UI tweaks.
Previously the order of the live wallpapers could change every time the user opened the live wallpaper picker. Not cool.
-rw-r--r--res/layout/live_wallpaper_entry.xml1
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java16
2 files changed, 17 insertions, 0 deletions
diff --git a/res/layout/live_wallpaper_entry.xml b/res/layout/live_wallpaper_entry.xml
index 29be991..ce48242 100644
--- a/res/layout/live_wallpaper_entry.xml
+++ b/res/layout/live_wallpaper_entry.xml
@@ -19,6 +19,7 @@
android:layout_height="wrap_content"
android:paddingLeft="4dip"
+ android:paddingRight="4dip"
android:minHeight="?android:attr/listPreferredItemHeight">
<ImageView
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java b/src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java
index 44493ee..0a680fe 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperListActivity.java
@@ -43,7 +43,10 @@ import android.text.Html;
import java.util.ArrayList;
import java.util.List;
+import java.util.Collections;
+import java.util.Comparator;
import java.io.IOException;
+import java.text.Collator;
import org.xmlpull.v1.XmlPullParserException;
@@ -90,6 +93,19 @@ public class LiveWallpaperListActivity extends ListActivity implements AdapterVi
Canvas canvas = new Canvas();
+ Collections.sort(list, new Comparator<ResolveInfo>() {
+ final Collator mCollator;
+
+ {
+ mCollator = Collator.getInstance();
+ }
+
+ public int compare(ResolveInfo info1, ResolveInfo info2) {
+ return mCollator.compare(info1.loadLabel(mPackageManager),
+ info2.loadLabel(mPackageManager));
+ }
+ });
+
for (int i = 0; i < listSize; i++) {
ResolveInfo resolveInfo = list.get(i);
ComponentInfo ci = resolveInfo.serviceInfo;