From 1e4e6ddb38d0b867d0564be834f3425ed53d46e1 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Mon, 23 Sep 2013 23:02:05 +0100 Subject: Refactoring to better support mixed wallpaper sources Change-Id: I3b47a8f56d418c6f2e7b9fd469427c3056def8d8 --- .../launcher3/ThirdPartyWallpaperPickerListAdapter.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java') diff --git a/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java index 9fd0d0a5f..ab2f5d72a 100644 --- a/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java +++ b/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java @@ -41,6 +41,21 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements private List mThirdPartyWallpaperPickers = new ArrayList(); + public static class ThirdPartyWallpaperTile extends WallpaperPickerActivity.WallpaperTileInfo { + private ResolveInfo mResolveInfo; + public ThirdPartyWallpaperTile(ResolveInfo resolveInfo) { + mResolveInfo = resolveInfo; + } + public void onClick(WallpaperPickerActivity a) { + final ComponentName itemComponentName = new ComponentName( + mResolveInfo.activityInfo.packageName, mResolveInfo.activityInfo.name); + Intent launchIntent = new Intent(Intent.ACTION_SET_WALLPAPER); + launchIntent.setComponent(itemComponentName); + Utilities.startActivityForResultSafely( + a, launchIntent, WallpaperPickerActivity.PICK_WALLPAPER_THIRD_PARTY_ACTIVITY); + } + } + public ThirdPartyWallpaperPickerListAdapter(Context context) { mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mPackageManager = context.getPackageManager(); @@ -88,7 +103,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements return mThirdPartyWallpaperPickers.size(); } - public Object getItem(int position) { + public ResolveInfo getItem(int position) { return mThirdPartyWallpaperPickers.get(position); } -- cgit v1.2.3