diff options
author | 2014-05-16 10:32:04 +0900 | |
---|---|---|
committer | 2014-05-20 01:16:25 +0900 | |
commit | 437be2d5c4ee60f9c880369985eadde4a3a22957 (patch) | |
tree | 85ef27f006396e3c9ed3d023efd528cdf801973b /java | |
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')
29 files changed, 72 insertions, 23 deletions
diff --git a/java/res/drawable-hdpi/emoji_category_tab_selected_holo_dark.9.png b/java/res/drawable-hdpi/emoji_category_tab_selected_holo_dark.9.png Binary files differdeleted file mode 100644 index 84e63df17..000000000 --- a/java/res/drawable-hdpi/emoji_category_tab_selected_holo_dark.9.png +++ /dev/null diff --git a/java/res/drawable-hdpi/emoji_category_tab_selected_ics.9.png b/java/res/drawable-hdpi/emoji_category_tab_selected_ics.9.png Binary files differnew file mode 100644 index 000000000..9138cef9c --- /dev/null +++ b/java/res/drawable-hdpi/emoji_category_tab_selected_ics.9.png diff --git a/java/res/drawable-hdpi/emoji_category_tab_selected_klp.9.png b/java/res/drawable-hdpi/emoji_category_tab_selected_klp.9.png Binary files differnew file mode 100644 index 000000000..345d05e9d --- /dev/null +++ b/java/res/drawable-hdpi/emoji_category_tab_selected_klp.9.png diff --git a/java/res/drawable-hdpi/emoji_category_tab_selected_lxx_dark.9.png b/java/res/drawable-hdpi/emoji_category_tab_selected_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..ca981f4f4 --- /dev/null +++ b/java/res/drawable-hdpi/emoji_category_tab_selected_lxx_dark.9.png diff --git a/java/res/drawable-hdpi/emoji_category_tab_unselected_lxx_dark.9.png b/java/res/drawable-hdpi/emoji_category_tab_unselected_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..10b1dd2cb --- /dev/null +++ b/java/res/drawable-hdpi/emoji_category_tab_unselected_lxx_dark.9.png diff --git a/java/res/drawable-mdpi/emoji_category_tab_selected_holo_dark.9.png b/java/res/drawable-mdpi/emoji_category_tab_selected_holo_dark.9.png Binary files differdeleted file mode 100644 index 4b00f350a..000000000 --- a/java/res/drawable-mdpi/emoji_category_tab_selected_holo_dark.9.png +++ /dev/null diff --git a/java/res/drawable-mdpi/emoji_category_tab_selected_ics.9.png b/java/res/drawable-mdpi/emoji_category_tab_selected_ics.9.png Binary files differnew file mode 100644 index 000000000..1731b46ad --- /dev/null +++ b/java/res/drawable-mdpi/emoji_category_tab_selected_ics.9.png diff --git a/java/res/drawable-mdpi/emoji_category_tab_selected_klp.9.png b/java/res/drawable-mdpi/emoji_category_tab_selected_klp.9.png Binary files differnew file mode 100644 index 000000000..6354b997a --- /dev/null +++ b/java/res/drawable-mdpi/emoji_category_tab_selected_klp.9.png diff --git a/java/res/drawable-mdpi/emoji_category_tab_selected_lxx_dark.9.png b/java/res/drawable-mdpi/emoji_category_tab_selected_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..a08735cb4 --- /dev/null +++ b/java/res/drawable-mdpi/emoji_category_tab_selected_lxx_dark.9.png diff --git a/java/res/drawable-mdpi/emoji_category_tab_unselected_lxx_dark.9.png b/java/res/drawable-mdpi/emoji_category_tab_unselected_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..4cf8f5c41 --- /dev/null +++ b/java/res/drawable-mdpi/emoji_category_tab_unselected_lxx_dark.9.png diff --git a/java/res/drawable-xhdpi/emoji_category_tab_selected_holo_dark.9.png b/java/res/drawable-xhdpi/emoji_category_tab_selected_holo_dark.9.png Binary files differdeleted file mode 100644 index 95e5f4341..000000000 --- a/java/res/drawable-xhdpi/emoji_category_tab_selected_holo_dark.9.png +++ /dev/null diff --git a/java/res/drawable-xhdpi/emoji_category_tab_selected_ics.9.png b/java/res/drawable-xhdpi/emoji_category_tab_selected_ics.9.png Binary files differnew file mode 100644 index 000000000..11bc966b0 --- /dev/null +++ b/java/res/drawable-xhdpi/emoji_category_tab_selected_ics.9.png diff --git a/java/res/drawable-xhdpi/emoji_category_tab_selected_klp.9.png b/java/res/drawable-xhdpi/emoji_category_tab_selected_klp.9.png Binary files differnew file mode 100644 index 000000000..5e8549bdd --- /dev/null +++ b/java/res/drawable-xhdpi/emoji_category_tab_selected_klp.9.png diff --git a/java/res/drawable-xhdpi/emoji_category_tab_selected_lxx_dark.png b/java/res/drawable-xhdpi/emoji_category_tab_selected_lxx_dark.png Binary files differnew file mode 100644 index 000000000..65a54b813 --- /dev/null +++ b/java/res/drawable-xhdpi/emoji_category_tab_selected_lxx_dark.png diff --git a/java/res/drawable-xhdpi/emoji_category_tab_unselected_lxx_dark.9.png b/java/res/drawable-xhdpi/emoji_category_tab_unselected_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..666b35471 --- /dev/null +++ b/java/res/drawable-xhdpi/emoji_category_tab_unselected_lxx_dark.9.png diff --git a/java/res/drawable-xxhdpi/emoji_category_tab_selected_holo_dark.9.png b/java/res/drawable-xxhdpi/emoji_category_tab_selected_holo_dark.9.png Binary files differdeleted file mode 100644 index e5efc5828..000000000 --- a/java/res/drawable-xxhdpi/emoji_category_tab_selected_holo_dark.9.png +++ /dev/null diff --git a/java/res/drawable-xxhdpi/emoji_category_tab_selected_ics.9.png b/java/res/drawable-xxhdpi/emoji_category_tab_selected_ics.9.png Binary files differnew file mode 100644 index 000000000..b13ee2b6a --- /dev/null +++ b/java/res/drawable-xxhdpi/emoji_category_tab_selected_ics.9.png diff --git a/java/res/drawable-xxhdpi/emoji_category_tab_selected_klp.9.png b/java/res/drawable-xxhdpi/emoji_category_tab_selected_klp.9.png Binary files differnew file mode 100644 index 000000000..c81e651dd --- /dev/null +++ b/java/res/drawable-xxhdpi/emoji_category_tab_selected_klp.9.png diff --git a/java/res/drawable-xxhdpi/emoji_category_tab_selected_lxx_dark.9.png b/java/res/drawable-xxhdpi/emoji_category_tab_selected_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..084554f3d --- /dev/null +++ b/java/res/drawable-xxhdpi/emoji_category_tab_selected_lxx_dark.9.png diff --git a/java/res/drawable-xxhdpi/emoji_category_tab_unselected_lxx_dark.9.png b/java/res/drawable-xxhdpi/emoji_category_tab_unselected_lxx_dark.9.png Binary files differnew file mode 100644 index 000000000..62547a90f --- /dev/null +++ b/java/res/drawable-xxhdpi/emoji_category_tab_unselected_lxx_dark.9.png diff --git a/java/res/layout/emoji_palettes_view.xml b/java/res/layout/emoji_palettes_view.xml index d764caa91..e2933f96f 100644 --- a/java/res/layout/emoji_palettes_view.xml +++ b/java/res/layout/emoji_palettes_view.xml @@ -41,11 +41,9 @@ android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@drawable/emoji_category_tab_selected_holo_dark" android:divider="@null" android:tabStripEnabled="true" - android:tabStripLeft="@drawable/emoji_category_tab_unselected_holo_dark" - android:tabStripRight="@drawable/emoji_category_tab_unselected_holo_dark" /> + style="?attr/emojiTabWidgetStyle" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="0dip" @@ -79,8 +77,8 @@ <com.android.inputmethod.keyboard.emoji.EmojiCategoryPageIndicatorView android:id="@+id/emoji_category_page_id_view" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@color/emoji_category_page_id_background_holo" /> + android:layout_height="2dip" + style="?attr/emojiCategoryPageIndicatorViewStyle" /> <LinearLayout android:id="@+id/emoji_action_bar" android:orientation="horizontal" diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 80bb6f244..307ef1351 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -30,6 +30,10 @@ <attr name="keyPreviewTextViewStyle" format="reference"/> <!-- EmojiPalettesView style --> <attr name="emojiPalettesViewStyle" format="reference" /> + <!-- TabWidget of EmojiPlettesView style --> + <attr name="emojiTabWidgetStyle" format="reference" /> + <!-- EmojiCategoryPageIndicatorView style --> + <attr name="emojiCategoryPageIndicatorViewStyle" format="reference" /> <!-- MoreKeysKeyboard style --> <attr name="moreKeysKeyboardStyle" format="reference" /> <!-- MoreKeysKeyboardView style --> @@ -181,6 +185,10 @@ <attr name="iconEmojiCategory6Tab" format="reference" /> </declare-styleable> + <declare-styleable name="EmojiCategoryPageIndicatorView"> + <attr name="emojiCategoryPageIndicatorColor" format="color" /> + </declare-styleable> + <declare-styleable name="SuggestionStripView"> <attr name="suggestionStripOptions" format="integer"> <!-- This should be aligned with SuggestionStripLayoutHelper.AUTO_CORRECT_* and etc. --> diff --git a/java/res/values/colors.xml b/java/res/values/colors.xml index 12cb71f2e..0eee08de2 100644 --- a/java/res/values/colors.xml +++ b/java/res/values/colors.xml @@ -34,6 +34,7 @@ <color name="spacebar_text_color_holo">#FFC0C0C0</color> <color name="spacebar_text_shadow_color_holo">#80000000</color> <color name="gesture_floating_preview_color_holo">#C0000000</color> + <color name="emoji_tab_page_indicator_background_holo">#111111</color> <!-- Color resources for KLP theme. Base color = F0F0F0 --> <color name="highlight_color_klp">#FFF0F0F0</color> <color name="typed_word_color_klp">#D8F0F0F0</color> @@ -53,12 +54,11 @@ <color name="suggestions_strip_background_lxx_dark">#263238</color> <color name="suggested_word_background_selected_lxx_dark">#384248</color> <color name="gesture_floating_preview_color_lxx_dark">#C0000000</color> + <color name="emoji_tab_page_indicator_background_lxx_dark">#263238</color> <!-- Color resources for setup wizard and tutorial --> <color name="setup_background">#FFEBEBEB</color> <color name="setup_text_dark">#FF707070</color> <color name="setup_text_action">@android:color/holo_blue_light</color> <color name="setup_step_background">@android:color/background_light</color> <color name="setup_welcome_video_margin_color">#FFCCCCCC</color> - <color name="emoji_category_page_id_background_holo">#FF000000</color> - <color name="emoji_category_page_id_foreground_holo">#80FFFFFF</color> </resources> diff --git a/java/res/values/themes-common.xml b/java/res/values/themes-common.xml index df26fb3b4..c5d3f55a1 100644 --- a/java/res/values/themes-common.xml +++ b/java/res/values/themes-common.xml @@ -110,6 +110,8 @@ <!-- Though {@link EmojiPalettesView} doesn't extend {@link KeyboardView}, some views inside it, for instance delete button, need themed {@link KeyboardView} attributes. --> <style name="EmojiPalettesView" /> + <style name="EmojiTabWidget" /> + <style name="EmojiCategoryPageIndicatorView" /> <style name="MoreKeysKeyboard" /> <style name="MoreKeysKeyboardView" diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index 00a4de54b..f7ca5a340 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -25,6 +25,8 @@ <item name="mainKeyboardViewStyle">@style/MainKeyboardView.ICS</item> <item name="keyPreviewTextViewStyle">@style/KeyPreviewTextView.ICS</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.ICS</item> + <item name="emojiTabWidgetStyle">@style/EmojiTabWidget.ICS</item> + <item name="emojiCategoryPageIndicatorViewStyle">@style/EmojiCategoryPageIndicatorView.ICS</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.ICS</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.ICS</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.ICS</item> @@ -95,6 +97,15 @@ <item name="iconEmojiCategory5Tab">@drawable/ic_emoji_symbols_holo_dark</item> <item name="iconEmojiCategory6Tab">@drawable/ic_emoji_emoticons_holo_dark</item> </style> + <style name="EmojiCategoryPageIndicatorView.ICS"> + <item name="android:background">@color/emoji_tab_page_indicator_background_holo</item> + <item name="emojiCategoryPageIndicatorColor">@color/highlight_color_ics</item> + </style> + <style name="EmojiTabWidget.ICS"> + <item name="android:background">@drawable/emoji_category_tab_selected_ics</item> + <item name="android:tabStripLeft">@drawable/emoji_category_tab_unselected_holo_dark</item> + <item name="android:tabStripRight">@drawable/emoji_category_tab_unselected_holo_dark</item> + </style> <style name="MoreKeysKeyboard.ICS" parent="Keyboard.ICS" diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml index b206560e0..96d0478ba 100644 --- a/java/res/values/themes-klp.xml +++ b/java/res/values/themes-klp.xml @@ -25,6 +25,8 @@ <item name="mainKeyboardViewStyle">@style/MainKeyboardView.KLP</item> <item name="keyPreviewTextViewStyle">@style/KeyPreviewTextView.KLP</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.KLP</item> + <item name="emojiTabWidgetStyle">@style/EmojiTabWidget.KLP</item> + <item name="emojiCategoryPageIndicatorViewStyle">@style/EmojiCategoryPageIndicatorView.KLP</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.KLP</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.KLP</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.KLP</item> @@ -95,6 +97,15 @@ <item name="iconEmojiCategory5Tab">@drawable/ic_emoji_symbols_holo_dark</item> <item name="iconEmojiCategory6Tab">@drawable/ic_emoji_emoticons_holo_dark</item> </style> + <style name="EmojiCategoryPageIndicatorView.KLP"> + <item name="android:background">@color/emoji_tab_page_indicator_background_holo</item> + <item name="emojiCategoryPageIndicatorColor">@color/highlight_color_klp</item> + </style> + <style name="EmojiTabWidget.KLP"> + <item name="android:background">@drawable/emoji_category_tab_selected_klp</item> + <item name="android:tabStripLeft">@drawable/emoji_category_tab_unselected_holo_dark</item> + <item name="android:tabStripRight">@drawable/emoji_category_tab_unselected_holo_dark</item> + </style> <style name="MoreKeysKeyboard.KLP" parent="Keyboard.KLP" diff --git a/java/res/values/themes-lxx-dark.xml b/java/res/values/themes-lxx-dark.xml index 05dd6596b..7fb122a79 100644 --- a/java/res/values/themes-lxx-dark.xml +++ b/java/res/values/themes-lxx-dark.xml @@ -25,6 +25,8 @@ <item name="mainKeyboardViewStyle">@style/MainKeyboardView.LXX_Dark</item> <item name="keyPreviewTextViewStyle">@style/KeyPreviewTextView.LXX_Dark</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.LXX_Dark</item> + <item name="emojiTabWidgetStyle">@style/EmojiTabWidget.LXX_Dark</item> + <item name="emojiCategoryPageIndicatorViewStyle">@style/EmojiCategoryPageIndicatorView.LXX_Dark</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.LXX_Dark</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.LXX_Dark</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.LXX_Dark</item> @@ -97,6 +99,15 @@ <item name="iconEmojiCategory5Tab">@drawable/ic_emoji_symbols_holo_dark</item> <item name="iconEmojiCategory6Tab">@drawable/ic_emoji_emoticons_holo_dark</item> </style> + <style name="EmojiCategoryPageIndicatorView.LXX_Dark"> + <item name="android:background">@color/emoji_tab_page_indicator_background_lxx_dark</item> + <item name="emojiCategoryPageIndicatorColor">@color/highlight_color_lxx_dark</item> + </style> + <style name="EmojiTabWidget.LXX_Dark"> + <item name="android:background">@drawable/emoji_category_tab_selected_lxx_dark</item> + <item name="android:tabStripLeft">@drawable/emoji_category_tab_unselected_lxx_dark</item> + <item name="android:tabStripRight">@drawable/emoji_category_tab_unselected_lxx_dark</item> + </style> <style name="MoreKeysKeyboard.LXX_Dark" parent="Keyboard.LXX_Dark" 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() { |