From eeba8cfe7d6055a562b582ef156f80c10060cb2d Mon Sep 17 00:00:00 2001 From: Luis Vidal Date: Thu, 17 Dec 2015 23:18:06 -0800 Subject: Live Lock screen selection Change-Id: Ie1a13d9775e85b61c611ee6037856fef1578c4a8 --- src/com/cyngn/theme/chooser/ComponentSelector.java | 27 +++++++++++++++------- src/com/cyngn/theme/chooser/MyThemeFragment.java | 3 +++ 2 files changed, 22 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/com/cyngn/theme/chooser/ComponentSelector.java b/src/com/cyngn/theme/chooser/ComponentSelector.java index 0f57393..53a0269 100644 --- a/src/com/cyngn/theme/chooser/ComponentSelector.java +++ b/src/com/cyngn/theme/chooser/ComponentSelector.java @@ -82,6 +82,7 @@ public class ComponentSelector extends LinearLayout public static final String EXTERNAL_WALLPAPER = "external"; private static final int EXTRA_WALLPAPER_COMPONENTS = 2; + private static final int EXTRA_LIVE_LOCK_COMPONENTS = 1; protected static final long DEFAULT_COMPONENT_ID = 0; @@ -358,6 +359,9 @@ public class ComponentSelector extends LinearLayout dividerPadding = res.getDimensionPixelSize( R.dimen.component_divider_padding_top_bootani); dividerHeight = res.getDimensionPixelSize(R.dimen.component_divider_height_bootani); + if (mCurrentLoaderId == LOADER_ID_LIVE_LOCK_SCREEN) { + count += EXTRA_LIVE_LOCK_COMPONENTS; + } // fall through to default default: mItemParams = new LayoutParams(screenWidth / mItemsPerPage, @@ -624,16 +628,23 @@ public class ComponentSelector extends LinearLayout } private View newLiveLockScreenView(Cursor cursor, ViewGroup parent, int position) { - cursor.moveToPosition(position); - View v = mInflater.inflate(R.layout.bootani_component_selection_item, parent, + View v = mInflater.inflate(R.layout.live_lock_component_selection_item, parent, false); - int wallpaperIndex = cursor.getColumnIndex(PreviewColumns.LIVE_LOCK_SCREEN_THUMBNAIL); - int pkgNameIndex = cursor.getColumnIndex(ThemesContract.ThemesColumns.PKG_NAME); + ImageView iv = (ImageView) v.findViewById(R.id.icon); + if (position == 0) { + iv.setImageResource(R.drawable.img_wallpaper_none); + v.setTag(R.id.tag_key_package_name,""); + ((TextView) v.findViewById(R.id.title)).setText(R.string.wallpaper_none_title); + } else { + cursor.moveToPosition(position - EXTRA_LIVE_LOCK_COMPONENTS); + int wallpaperIndex = cursor.getColumnIndex(PreviewColumns.LIVE_LOCK_SCREEN_THUMBNAIL); + int pkgNameIndex = cursor.getColumnIndex(ThemesContract.ThemesColumns.PKG_NAME); - ((ImageView) v.findViewById(R.id.preview)).setImageBitmap( - Utils.loadBitmapBlob(cursor, wallpaperIndex)); - setTitle(((TextView) v.findViewById(R.id.title)), cursor); - v.setTag(R.id.tag_key_package_name, cursor.getString(pkgNameIndex)); + iv.setImageBitmap( + Utils.loadBitmapBlob(cursor, wallpaperIndex)); + setTitle(((TextView) v.findViewById(R.id.title)), cursor); + v.setTag(R.id.tag_key_package_name, cursor.getString(pkgNameIndex)); + } v.setOnClickListener(mItemClickListener); return v; } diff --git a/src/com/cyngn/theme/chooser/MyThemeFragment.java b/src/com/cyngn/theme/chooser/MyThemeFragment.java index ab0b485..c8a941b 100644 --- a/src/com/cyngn/theme/chooser/MyThemeFragment.java +++ b/src/com/cyngn/theme/chooser/MyThemeFragment.java @@ -256,6 +256,9 @@ public class MyThemeFragment extends ThemeFragment { if (c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_STATUS_BAR)) == 1) { mSelectedComponentsMap.put(ThemesColumns.MODIFIES_STATUS_BAR, pkgName); } + if (c.getInt(c.getColumnIndex(ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN)) == 1) { + mSelectedComponentsMap.put(ThemesColumns.MODIFIES_LIVE_LOCK_SCREEN, pkgName); + } } c.close(); } -- cgit v1.1