From 5b4b6904ae4d7706ff4c523018787320bc874333 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Thu, 3 Oct 2013 18:15:08 -0700 Subject: [PATCH] Finalize visuals of wallpaper picker items Also, move third-party wallpapers to end of list Bug: 10852962 Bug: 11024560 --- res/layout/wallpaper_picker.xml | 8 ++++---- ...tem.xml => wallpaper_picker_image_picker_item.xml} | 2 ++ ...m.xml => wallpaper_picker_live_wallpaper_item.xml} | 6 ++++-- ...item.xml => wallpaper_picker_third_party_item.xml} | 2 ++ res/values/dimens.xml | 1 + .../android/launcher3/LiveWallpaperListAdapter.java | 2 +- .../ThirdPartyWallpaperPickerListAdapter.java | 11 ++++++++--- .../android/launcher3/WallpaperPickerActivity.java | 2 +- 8 files changed, 23 insertions(+), 11 deletions(-) rename res/layout/{wallpaper_picker_gallery_item.xml => wallpaper_picker_image_picker_item.xml} (96%) rename res/layout/{live_wallpaper_picker_item.xml => wallpaper_picker_live_wallpaper_item.xml} (90%) rename res/layout/{third_party_wallpaper_picker_item.xml => wallpaper_picker_third_party_item.xml} (95%) diff --git a/res/layout/wallpaper_picker.xml b/res/layout/wallpaper_picker.xml index fd66a57be0..c91cc7e6a2 100644 --- a/res/layout/wallpaper_picker.xml +++ b/res/layout/wallpaper_picker.xml @@ -55,10 +55,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > - + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 2910b7c7c7..b4b2367c77 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -24,6 +24,7 @@ 106.5dp 94.5dp + 32dp 94dp diff --git a/src/com/android/launcher3/LiveWallpaperListAdapter.java b/src/com/android/launcher3/LiveWallpaperListAdapter.java index e9e5e79a85..4b597946fd 100644 --- a/src/com/android/launcher3/LiveWallpaperListAdapter.java +++ b/src/com/android/launcher3/LiveWallpaperListAdapter.java @@ -85,7 +85,7 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter View view; if (convertView == null) { - view = mInflater.inflate(R.layout.live_wallpaper_picker_item, parent, false); + view = mInflater.inflate(R.layout.wallpaper_picker_live_wallpaper_item, parent, false); } else { view = convertView; } diff --git a/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java index 70ef7c34f5..494694cbd0 100644 --- a/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java +++ b/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java @@ -22,6 +22,8 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -38,6 +40,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements private final LayoutInflater mInflater; private final PackageManager mPackageManager; + private final int mIconSize; private List mThirdPartyWallpaperPickers = new ArrayList(); @@ -61,6 +64,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements public ThirdPartyWallpaperPickerListAdapter(Context context) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mPackageManager = context.getPackageManager(); + mIconSize = context.getResources().getDimensionPixelSize(R.dimen.wallpaperItemIconSize); final PackageManager pm = mPackageManager; final Intent pickWallpaperIntent = new Intent(Intent.ACTION_SET_WALLPAPER); @@ -117,7 +121,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements View view; if (convertView == null) { - view = mInflater.inflate(R.layout.third_party_wallpaper_picker_item, parent, false); + view = mInflater.inflate(R.layout.wallpaper_picker_third_party_item, parent, false); } else { view = convertView; } @@ -127,8 +131,9 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements ResolveInfo info = mThirdPartyWallpaperPickers.get(position).mResolveInfo; TextView label = (TextView) view.findViewById(R.id.wallpaper_item_label); label.setText(info.loadLabel(mPackageManager)); - label.setCompoundDrawablesWithIntrinsicBounds( - null, info.loadIcon(mPackageManager), null, null); + Drawable icon = info.loadIcon(mPackageManager); + icon.setBounds(new Rect(0, 0, mIconSize, mIconSize)); + label.setCompoundDrawables(null, icon, null, null); return view; } } diff --git a/src/com/android/launcher3/WallpaperPickerActivity.java b/src/com/android/launcher3/WallpaperPickerActivity.java index 12e69d3126..0282eacd44 100644 --- a/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/src/com/android/launcher3/WallpaperPickerActivity.java @@ -295,7 +295,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // Add a tile for the Gallery LinearLayout masterWallpaperList = (LinearLayout) findViewById(R.id.master_wallpaper_list); FrameLayout galleryThumbnail = (FrameLayout) getLayoutInflater(). - inflate(R.layout.wallpaper_picker_gallery_item, masterWallpaperList, false); + inflate(R.layout.wallpaper_picker_image_picker_item, masterWallpaperList, false); setWallpaperItemPaddingToZero(galleryThumbnail); masterWallpaperList.addView(galleryThumbnail, 0);