diff options
author | 2014-05-16 10:32:04 +0900 | |
---|---|---|
committer | 2014-05-20 01:16:25 +0900 | |
commit | 437be2d5c4ee60f9c880369985eadde4a3a22957 (patch) | |
tree | 85ef27f006396e3c9ed3d023efd528cdf801973b /java/src | |
parent | 27ca9f1bf17c1d275faed939d529f07bb57e28f3 (diff) | |
download | latinime-437be2d5c4ee60f9c880369985eadde4a3a22957.tar.gz latinime-437be2d5c4ee60f9c880369985eadde4a3a22957.tar.xz latinime-437be2d5c4ee60f9c880369985eadde4a3a22957.zip |
Refactor Emoji tab indicators to refer keyboard theme
Bug: 14419121
Change-Id: I7086923fff153039c2d011bbccbfd04eb687a76a
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/emoji/EmojiCategoryPageIndicatorView.java | 27 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/emoji/EmojiLayoutParams.java | 13 |
2 files changed, 24 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategoryPageIndicatorView.java b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategoryPageIndicatorView.java index f5aa1079e..a6b089169 100644 --- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategoryPageIndicatorView.java +++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategoryPageIndicatorView.java @@ -16,29 +16,36 @@ package com.android.inputmethod.keyboard.emoji; -import com.android.inputmethod.latin.R; - import android.content.Context; +import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; -import android.widget.LinearLayout; +import android.view.View; + +import com.android.inputmethod.latin.R; -public final class EmojiCategoryPageIndicatorView extends LinearLayout { +public final class EmojiCategoryPageIndicatorView extends View { private static final float BOTTOM_MARGIN_RATIO = 1.0f; private final Paint mPaint = new Paint(); private int mCategoryPageSize = 0; private int mCurrentCategoryPageId = 0; private float mOffset = 0.0f; - public EmojiCategoryPageIndicatorView(final Context context) { - this(context, null /* attrs */); + public EmojiCategoryPageIndicatorView(final Context context, final AttributeSet attrs) { + this(context, attrs, R.attr.emojiCategoryPageIndicatorViewStyle); } - public EmojiCategoryPageIndicatorView(final Context context, final AttributeSet attrs) { - super(context, attrs); - mPaint.setColor(context.getResources().getColor( - R.color.emoji_category_page_id_foreground_holo)); + public EmojiCategoryPageIndicatorView(final Context context, final AttributeSet attrs, + final int defStyle) { + super(context, attrs, defStyle); + final TypedArray indicatorViewAttr = context.obtainStyledAttributes(attrs, + R.styleable.EmojiCategoryPageIndicatorView, defStyle, + R.style.EmojiCategoryPageIndicatorView); + final int indicatorColor = indicatorViewAttr.getColor( + R.styleable.EmojiCategoryPageIndicatorView_emojiCategoryPageIndicatorColor, 0); + indicatorViewAttr.recycle(); + mPaint.setColor(indicatorColor); } public void setCategoryPageId(final int size, final int id, final float offset) { diff --git a/java/src/com/android/inputmethod/keyboard/emoji/EmojiLayoutParams.java b/java/src/com/android/inputmethod/keyboard/emoji/EmojiLayoutParams.java index 77c183a99..fbc12829f 100644 --- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiLayoutParams.java +++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiLayoutParams.java @@ -16,14 +16,15 @@ package com.android.inputmethod.keyboard.emoji; -import com.android.inputmethod.latin.R; -import com.android.inputmethod.latin.utils.ResourceUtils; - import android.content.res.Resources; import android.support.v4.view.ViewPager; +import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; +import com.android.inputmethod.latin.R; +import com.android.inputmethod.latin.utils.ResourceUtils; + final class EmojiLayoutParams { private static final int DEFAULT_KEYBOARD_ROWS = 4; @@ -67,10 +68,10 @@ final class EmojiLayoutParams { vp.setLayoutParams(lp); } - public void setCategoryPageIdViewProperties(final LinearLayout ll) { - final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) ll.getLayoutParams(); + public void setCategoryPageIdViewProperties(final View v) { + final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) v.getLayoutParams(); lp.height = mEmojiCategoryPageIdViewHeight; - ll.setLayoutParams(lp); + v.setLayoutParams(lp); } public int getActionBarHeight() { |