diff options
-rw-r--r-- | res/layout/live_lock_component_selection_item.xml | 35 | ||||
-rw-r--r-- | res/values/dimens.xml | 1 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/ComponentSelector.java | 27 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/MyThemeFragment.java | 3 |
4 files changed, 58 insertions, 8 deletions
diff --git a/res/layout/live_lock_component_selection_item.xml b/res/layout/live_lock_component_selection_item.xml new file mode 100644 index 0000000..d9414ba --- /dev/null +++ b/res/layout/live_lock_component_selection_item.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2014 Cyanogen, Inc. +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="@dimen/component_selection_cell_height_live_lock" + android:background="@drawable/component_selection_selector"> + + <FrameLayout + android:id="@+id/wp_content" + android:layout_width="@dimen/component_selection_live_lock_screen_content_width" + android:layout_height="@dimen/component_selection_live_lock_screen_content_height" + android:layout_marginTop="@dimen/component_margin_top" + android:layout_gravity="center_horizontal"> + <ImageView + android:id="@+id/icon" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:scaleType="fitCenter"/> + <View + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/wallpaper_border" /> + </FrameLayout> + + <com.cyngn.theme.widget.LatoTextView + android:id="@+id/title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + style="@style/component_title"/> + +</LinearLayout>
\ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 8eb7bcb..4c77bae 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -14,6 +14,7 @@ <dimen name="component_selection_cell_width">80dp</dimen> <dimen name="component_selection_cell_height">112dp</dimen> <dimen name="component_selection_cell_height_boot_anim">203dp</dimen> + <dimen name="component_selection_cell_height_live_lock">203dp</dimen> <dimen name="component_selection_cell_height_sounds">120dp</dimen> <dimen name="component_selection_content_width">48dp</dimen> <dimen name="component_selection_content_height">@dimen/component_selection_content_width</dimen> 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(); } |