summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Mast <andy@cyngn.com>2014-07-18 09:55:58 -0700
committerAndy Mast <andy@cyngn.com>2014-07-18 17:29:35 +0000
commitb7ae0f625293cdd459dc18c0156292f7f081e991 (patch)
tree01fb681c9a40ffb4aee81beab0e3e337d611203c
parentcd6809851399756fcd26f13386d747142bedf4b8 (diff)
downloadpackages_apps_ThemeChooser-b7ae0f625293cdd459dc18c0156292f7f081e991.tar.gz
packages_apps_ThemeChooser-b7ae0f625293cdd459dc18c0156292f7f081e991.tar.bz2
packages_apps_ThemeChooser-b7ae0f625293cdd459dc18c0156292f7f081e991.zip
Fix missing wp card text
Change-Id: I5604c160ffe9763bee12870abc0410bd55e93664
-rw-r--r--res/layout/v2card_label.xml10
-rw-r--r--res/layout/v2wallpaper_card.xml19
-rw-r--r--src/org/cyanogenmod/theme/chooserv2/WallpaperCardView.java29
3 files changed, 28 insertions, 30 deletions
diff --git a/res/layout/v2card_label.xml b/res/layout/v2card_label.xml
deleted file mode 100644
index 2db3011..0000000
--- a/res/layout/v2card_label.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/label"
- android:layout_width="match_parent"
- android:layout_height="@dimen/label_height"
- android:paddingLeft="@dimen/card_padding_left_right"
- android:text="@string/wallpaper_label"
- android:textColor="@color/wallpaper_label"
- android:background="@drawable/wallpaper_label_bg"
- style="@style/card_label"/> \ No newline at end of file
diff --git a/res/layout/v2wallpaper_card.xml b/res/layout/v2wallpaper_card.xml
new file mode 100644
index 0000000..36061bb
--- /dev/null
+++ b/res/layout/v2wallpaper_card.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <ImageView
+ android:id="@+id/image"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop" />
+ <TextView
+ android:id="@+id/label"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/label_height"
+ android:paddingLeft="@dimen/card_padding_left_right"
+ android:text="@string/wallpaper_label"
+ android:textColor="@color/wallpaper_label"
+ android:background="@drawable/wallpaper_label_bg"
+ style="@style/card_label"/>
+</FrameLayout>
diff --git a/src/org/cyanogenmod/theme/chooserv2/WallpaperCardView.java b/src/org/cyanogenmod/theme/chooserv2/WallpaperCardView.java
index e22984f..b159afa 100644
--- a/src/org/cyanogenmod/theme/chooserv2/WallpaperCardView.java
+++ b/src/org/cyanogenmod/theme/chooserv2/WallpaperCardView.java
@@ -1,9 +1,10 @@
package org.cyanogenmod.theme.chooserv2;
import android.content.Context;
-import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -12,6 +13,7 @@ import org.cyanogenmod.theme.chooser.R;
public class WallpaperCardView extends ComponentCardView {
protected ImageView mImage;
+ protected TextView mLabel;
public WallpaperCardView(Context context) {
this(context, null);
@@ -27,28 +29,15 @@ public class WallpaperCardView extends ComponentCardView {
setBackgroundResource(R.drawable.card_bg);
- // Wallpaper Image
- mImage = new ImageView(context);
- mImage.setScaleType(ImageView.ScaleType.CENTER_CROP);
- addView(mImage);
-
- // Wallpaper Label - inflated because programmatic styles is hard
- mLabel = (TextView) inflate(context, R.layout.v2card_label, null);
- addView(mLabel);
+ LayoutInflater inflater = LayoutInflater.from(mContext);
+ FrameLayout frameLayout =
+ (FrameLayout) inflater.inflate(R.layout.v2wallpaper_card, this, false);
+ addView(frameLayout);
+ mLabel = (TextView) frameLayout.findViewById(R.id.label);
+ mImage = (ImageView) frameLayout.findViewById(R.id.image);
}
public void setWallpaper(Drawable drawable) {
mImage.setImageDrawable(drawable);
}
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- int childLeft = mPaddingLeft;
- int childRight = r - mPaddingRight;
- int childTop = mPaddingTop;
- int childBottom = b - mPaddingBottom;
-
- mImage.layout(childLeft, childTop, childRight, childBottom);
- mLabel.layout(childLeft, childTop, childRight, childTop + mLabel.getMeasuredHeight());
- }
}