diff options
Diffstat (limited to 'java')
16 files changed, 53 insertions, 60 deletions
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 differdeleted file mode 100644 index ca981f4f4..000000000 --- a/java/res/drawable-hdpi/emoji_category_tab_selected_lxx_dark.9.png +++ /dev/null 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 differdeleted file mode 100644 index 10b1dd2cb..000000000 --- a/java/res/drawable-hdpi/emoji_category_tab_unselected_lxx_dark.9.png +++ /dev/null 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 differdeleted file mode 100644 index a08735cb4..000000000 --- a/java/res/drawable-mdpi/emoji_category_tab_selected_lxx_dark.9.png +++ /dev/null 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 differdeleted file mode 100644 index 4cf8f5c41..000000000 --- a/java/res/drawable-mdpi/emoji_category_tab_unselected_lxx_dark.9.png +++ /dev/null diff --git a/java/res/drawable-xhdpi/emoji_category_tab_selected_lxx_dark.9.png b/java/res/drawable-xhdpi/emoji_category_tab_selected_lxx_dark.9.png Binary files differdeleted file mode 100644 index 65a54b813..000000000 --- a/java/res/drawable-xhdpi/emoji_category_tab_selected_lxx_dark.9.png +++ /dev/null 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 differdeleted file mode 100644 index 666b35471..000000000 --- a/java/res/drawable-xhdpi/emoji_category_tab_unselected_lxx_dark.9.png +++ /dev/null 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 differdeleted file mode 100644 index 084554f3d..000000000 --- a/java/res/drawable-xxhdpi/emoji_category_tab_selected_lxx_dark.9.png +++ /dev/null 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 differdeleted file mode 100644 index 62547a90f..000000000 --- a/java/res/drawable-xxhdpi/emoji_category_tab_unselected_lxx_dark.9.png +++ /dev/null diff --git a/java/res/layout/emoji_palettes_view.xml b/java/res/layout/emoji_palettes_view.xml index e2933f96f..68fd37261 100644 --- a/java/res/layout/emoji_palettes_view.xml +++ b/java/res/layout/emoji_palettes_view.xml @@ -41,9 +41,7 @@ android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="match_parent" - android:divider="@null" - android:tabStripEnabled="true" - style="?attr/emojiTabWidgetStyle" /> + android:divider="@null" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="0dip" @@ -77,8 +75,7 @@ <com.android.inputmethod.keyboard.emoji.EmojiCategoryPageIndicatorView android:id="@+id/emoji_category_page_id_view" android:layout_width="match_parent" - android:layout_height="2dip" - style="?attr/emojiCategoryPageIndicatorViewStyle" /> + android:layout_height="2dip" /> <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 307ef1351..775a90c48 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -30,10 +30,6 @@ <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 --> @@ -176,6 +172,11 @@ </declare-styleable> <declare-styleable name="EmojiPalettesView"> + <attr name="categoryIndicatorEnabled" format="boolean" /> + <attr name="categoryIndicatorDrawable" format="reference" /> + <attr name="categoryIndicatorBackground" format="reference" /> + <attr name="categoryPageIndicatorColor" format="color" /> + <attr name="categoryPageIndicatorBackground" format="color" /> <attr name="iconEmojiRecentsTab" format="reference" /> <attr name="iconEmojiCategory1Tab" format="reference" /> <attr name="iconEmojiCategory2Tab" format="reference" /> @@ -185,10 +186,6 @@ <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/themes-common.xml b/java/res/values/themes-common.xml index c5d3f55a1..df26fb3b4 100644 --- a/java/res/values/themes-common.xml +++ b/java/res/values/themes-common.xml @@ -110,8 +110,6 @@ <!-- 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 f7ca5a340..319b4aeed 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -25,8 +25,6 @@ <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> @@ -89,6 +87,11 @@ name="EmojiPalettesView.ICS" parent="MainKeyboardView.ICS" > + <item name="categoryIndicatorEnabled">true</item> + <item name="categoryIndicatorDrawable">@drawable/emoji_category_tab_selected_ics</item> + <item name="categoryIndicatorBackground">@drawable/emoji_category_tab_unselected_holo_dark</item> + <item name="categoryPageIndicatorColor">@color/highlight_color_ics</item> + <item name="categoryPageIndicatorBackground">@color/emoji_tab_page_indicator_background_holo</item> <item name="iconEmojiRecentsTab">@drawable/ic_emoji_recents_holo_dark</item> <item name="iconEmojiCategory1Tab">@drawable/ic_emoji_people_holo_dark</item> <item name="iconEmojiCategory2Tab">@drawable/ic_emoji_objects_holo_dark</item> @@ -97,15 +100,6 @@ <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 96d0478ba..208723dd3 100644 --- a/java/res/values/themes-klp.xml +++ b/java/res/values/themes-klp.xml @@ -25,8 +25,6 @@ <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> @@ -89,6 +87,11 @@ name="EmojiPalettesView.KLP" parent="MainKeyboardView.KLP" > + <item name="categoryIndicatorEnabled">true</item> + <item name="categoryIndicatorDrawable">@drawable/emoji_category_tab_selected_klp</item> + <item name="categoryIndicatorBackground">@drawable/emoji_category_tab_unselected_holo_dark</item> + <item name="categoryPageIndicatorColor">@color/highlight_color_klp</item> + <item name="categoryPageIndicatorBackground">@color/emoji_tab_page_indicator_background_holo</item> <item name="iconEmojiRecentsTab">@drawable/ic_emoji_recents_holo_dark</item> <item name="iconEmojiCategory1Tab">@drawable/ic_emoji_people_holo_dark</item> <item name="iconEmojiCategory2Tab">@drawable/ic_emoji_objects_holo_dark</item> @@ -97,15 +100,6 @@ <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 98c045def..e9a295c67 100644 --- a/java/res/values/themes-lxx-dark.xml +++ b/java/res/values/themes-lxx-dark.xml @@ -25,8 +25,6 @@ <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> @@ -90,6 +88,9 @@ name="EmojiPalettesView.LXX_Dark" parent="MainKeyboardView.LXX_Dark" > + <item name="categoryIndicatorEnabled">false</item> + <item name="categoryPageIndicatorColor">@color/highlight_color_lxx_dark</item> + <item name="categoryPageIndicatorBackground">@color/emoji_tab_page_indicator_background_lxx_dark</item> <!-- TODO: Update those icons to LXX_Dark theme. --> <item name="iconEmojiRecentsTab">@drawable/ic_emoji_recents_holo_dark</item> <item name="iconEmojiCategory1Tab">@drawable/ic_emoji_people_holo_dark</item> @@ -99,15 +100,6 @@ <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 a6b089169..43d62c71a 100644 --- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategoryPageIndicatorView.java +++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiCategoryPageIndicatorView.java @@ -17,14 +17,11 @@ package com.android.inputmethod.keyboard.emoji; import android.content.Context; -import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; import android.view.View; -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(); @@ -33,19 +30,17 @@ public final class EmojiCategoryPageIndicatorView extends View { private float mOffset = 0.0f; public EmojiCategoryPageIndicatorView(final Context context, final AttributeSet attrs) { - this(context, attrs, R.attr.emojiCategoryPageIndicatorViewStyle); + this(context, attrs, 0); } 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 setColors(final int foregroundColor, final int backgroundColor) { + mPaint.setColor(foregroundColor); + setBackgroundColor(backgroundColor); } public void setCategoryPageId(final int size, final int id, final float offset) { diff --git a/java/src/com/android/inputmethod/keyboard/emoji/EmojiPalettesView.java b/java/src/com/android/inputmethod/keyboard/emoji/EmojiPalettesView.java index 6b9e880b9..7368f3c72 100644 --- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiPalettesView.java +++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiPalettesView.java @@ -36,6 +36,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TabHost; import android.widget.TabHost.OnTabChangeListener; +import android.widget.TabWidget; import android.widget.TextView; import com.android.inputmethod.keyboard.Key; @@ -68,6 +69,11 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange EmojiPageKeyboardView.OnKeyEventListener { private final int mFunctionalKeyBackgroundId; private final int mSpacebarBackgroundId; + private final boolean mCategoryIndicatorEnabled; + private final int mCategoryIndicatorDrawableResId; + private final int mCategoryIndicatorBackgroundResId; + private final int mCategoryPageIndicatorColor; + private final int mCategoryPageIndicatorBackground; private final DeleteKeyOnTouchListener mDeleteKeyOnTouchListener; private EmojiPalettesAdapter mEmojiPalettesAdapter; private final EmojiLayoutParams mEmojiLayoutParams; @@ -114,6 +120,16 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange R.styleable.EmojiPalettesView, defStyle, R.style.EmojiPalettesView); mEmojiCategory = new EmojiCategory(PreferenceManager.getDefaultSharedPreferences(context), res, layoutSet, emojiPalettesViewAttr); + mCategoryIndicatorEnabled = emojiPalettesViewAttr.getBoolean( + R.styleable.EmojiPalettesView_categoryIndicatorEnabled, false); + mCategoryIndicatorDrawableResId = emojiPalettesViewAttr.getResourceId( + R.styleable.EmojiPalettesView_categoryIndicatorDrawable, 0); + mCategoryIndicatorBackgroundResId = emojiPalettesViewAttr.getResourceId( + R.styleable.EmojiPalettesView_categoryIndicatorBackground, 0); + mCategoryPageIndicatorColor = emojiPalettesViewAttr.getColor( + R.styleable.EmojiPalettesView_categoryPageIndicatorColor, 0); + mCategoryPageIndicatorBackground = emojiPalettesViewAttr.getColor( + R.styleable.EmojiPalettesView_categoryPageIndicatorBackground, 0); emojiPalettesViewAttr.recycle(); mDeleteKeyOnTouchListener = new DeleteKeyOnTouchListener(context); } @@ -152,7 +168,15 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange addTab(mTabHost, properties.mCategoryId); } mTabHost.setOnTabChangedListener(this); - mTabHost.getTabWidget().setStripEnabled(true); + final TabWidget tabWidget = mTabHost.getTabWidget(); + tabWidget.setStripEnabled(mCategoryIndicatorEnabled); + if (mCategoryIndicatorEnabled) { + // On TabWidget's strip, what looks like an indicator is actually a background. + // And what looks like a background are actually left and right drawables. + tabWidget.setBackgroundResource(mCategoryIndicatorDrawableResId); + tabWidget.setLeftStripDrawable(mCategoryIndicatorBackgroundResId); + tabWidget.setRightStripDrawable(mCategoryIndicatorBackgroundResId); + } mEmojiPalettesAdapter = new EmojiPalettesAdapter(mEmojiCategory, this); @@ -165,6 +189,8 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange mEmojiCategoryPageIndicatorView = (EmojiCategoryPageIndicatorView)findViewById(R.id.emoji_category_page_id_view); + mEmojiCategoryPageIndicatorView.setColors( + mCategoryPageIndicatorColor, mCategoryPageIndicatorBackground); mEmojiLayoutParams.setCategoryPageIdViewProperties(mEmojiCategoryPageIndicatorView); setCurrentCategoryId(mEmojiCategory.getCurrentCategoryId(), true /* force */); |