Refactor Emoji tab indicators to refer keyboard theme

Bug: 14419121
Change-Id: I7086923fff153039c2d011bbccbfd04eb687a76a
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
deleted file mode 100644
index 84e63df..0000000
--- a/java/res/drawable-hdpi/emoji_category_tab_selected_holo_dark.9.png
+++ /dev/null
Binary files differ
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
new file mode 100644
index 0000000..9138cef
--- /dev/null
+++ b/java/res/drawable-hdpi/emoji_category_tab_selected_ics.9.png
Binary files differ
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
new file mode 100644
index 0000000..345d05e
--- /dev/null
+++ b/java/res/drawable-hdpi/emoji_category_tab_selected_klp.9.png
Binary files differ
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
new file mode 100644
index 0000000..ca981f4
--- /dev/null
+++ b/java/res/drawable-hdpi/emoji_category_tab_selected_lxx_dark.9.png
Binary files differ
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
new file mode 100644
index 0000000..10b1dd2
--- /dev/null
+++ b/java/res/drawable-hdpi/emoji_category_tab_unselected_lxx_dark.9.png
Binary files differ
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
deleted file mode 100644
index 4b00f35..0000000
--- a/java/res/drawable-mdpi/emoji_category_tab_selected_holo_dark.9.png
+++ /dev/null
Binary files differ
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
new file mode 100644
index 0000000..1731b46
--- /dev/null
+++ b/java/res/drawable-mdpi/emoji_category_tab_selected_ics.9.png
Binary files differ
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
new file mode 100644
index 0000000..6354b99
--- /dev/null
+++ b/java/res/drawable-mdpi/emoji_category_tab_selected_klp.9.png
Binary files differ
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
new file mode 100644
index 0000000..a08735c
--- /dev/null
+++ b/java/res/drawable-mdpi/emoji_category_tab_selected_lxx_dark.9.png
Binary files differ
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
new file mode 100644
index 0000000..4cf8f5c
--- /dev/null
+++ b/java/res/drawable-mdpi/emoji_category_tab_unselected_lxx_dark.9.png
Binary files differ
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
deleted file mode 100644
index 95e5f43..0000000
--- a/java/res/drawable-xhdpi/emoji_category_tab_selected_holo_dark.9.png
+++ /dev/null
Binary files differ
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
new file mode 100644
index 0000000..11bc966
--- /dev/null
+++ b/java/res/drawable-xhdpi/emoji_category_tab_selected_ics.9.png
Binary files differ
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
new file mode 100644
index 0000000..5e8549b
--- /dev/null
+++ b/java/res/drawable-xhdpi/emoji_category_tab_selected_klp.9.png
Binary files differ
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
new file mode 100644
index 0000000..65a54b8
--- /dev/null
+++ b/java/res/drawable-xhdpi/emoji_category_tab_selected_lxx_dark.png
Binary files differ
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
new file mode 100644
index 0000000..666b354
--- /dev/null
+++ b/java/res/drawable-xhdpi/emoji_category_tab_unselected_lxx_dark.9.png
Binary files differ
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
deleted file mode 100644
index e5efc58..0000000
--- a/java/res/drawable-xxhdpi/emoji_category_tab_selected_holo_dark.9.png
+++ /dev/null
Binary files differ
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
new file mode 100644
index 0000000..b13ee2b
--- /dev/null
+++ b/java/res/drawable-xxhdpi/emoji_category_tab_selected_ics.9.png
Binary files differ
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
new file mode 100644
index 0000000..c81e651
--- /dev/null
+++ b/java/res/drawable-xxhdpi/emoji_category_tab_selected_klp.9.png
Binary files differ
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
new file mode 100644
index 0000000..084554f
--- /dev/null
+++ b/java/res/drawable-xxhdpi/emoji_category_tab_selected_lxx_dark.9.png
Binary files differ
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
new file mode 100644
index 0000000..62547a9
--- /dev/null
+++ b/java/res/drawable-xxhdpi/emoji_category_tab_unselected_lxx_dark.9.png
Binary files differ
diff --git a/java/res/layout/emoji_palettes_view.xml b/java/res/layout/emoji_palettes_view.xml
index d764caa..e2933f9 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 80bb6f2..307ef13 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 12cb71f..0eee08d 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 df26fb3..c5d3f55 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 00a4de5..f7ca5a3 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 b206560..96d0478 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 05dd659..7fb122a 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 f5aa107..a6b0891 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;
 
-public final class EmojiCategoryPageIndicatorView extends LinearLayout {
+import com.android.inputmethod.latin.R;
+
+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 77c183a..fbc1282 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 @@
         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() {