Merge "Make Emoji palette more Quantum light compliant"
commit
d7c520bb74
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2014, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:state_focused="true"
|
||||||
|
android:color="@color/key_text_color_holo" />
|
||||||
|
<item
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:color="@color/key_text_color_holo" />
|
||||||
|
<item
|
||||||
|
android:state_selected="true"
|
||||||
|
android:color="@color/key_text_color_holo" />
|
||||||
|
<item
|
||||||
|
android:color="@color/key_text_inactive_color_lmp" />
|
||||||
|
</selector>
|
|
@ -88,7 +88,7 @@
|
||||||
name="EmojiPalettesView.LMP"
|
name="EmojiPalettesView.LMP"
|
||||||
parent="MainKeyboardView.LMP"
|
parent="MainKeyboardView.LMP"
|
||||||
>
|
>
|
||||||
<item name="emojiTabLabelColor">@color/emoji_tab_label_color_holo</item>
|
<item name="emojiTabLabelColor">@color/emoji_tab_label_color_lmp</item>
|
||||||
</style>
|
</style>
|
||||||
<style
|
<style
|
||||||
name="MoreKeysKeyboard.LMP"
|
name="MoreKeysKeyboard.LMP"
|
||||||
|
|
|
@ -33,6 +33,7 @@ import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TabHost;
|
import android.widget.TabHost;
|
||||||
|
@ -45,6 +46,7 @@ import com.android.inputmethod.keyboard.internal.EmojiPageKeyboardView;
|
||||||
import com.android.inputmethod.keyboard.internal.EmojiPalettesAdapter;
|
import com.android.inputmethod.keyboard.internal.EmojiPalettesAdapter;
|
||||||
import com.android.inputmethod.keyboard.internal.KeyDrawParams;
|
import com.android.inputmethod.keyboard.internal.KeyDrawParams;
|
||||||
import com.android.inputmethod.keyboard.internal.KeyVisualAttributes;
|
import com.android.inputmethod.keyboard.internal.KeyVisualAttributes;
|
||||||
|
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
|
||||||
import com.android.inputmethod.latin.Constants;
|
import com.android.inputmethod.latin.Constants;
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
import com.android.inputmethod.latin.SubtypeSwitcher;
|
import com.android.inputmethod.latin.SubtypeSwitcher;
|
||||||
|
@ -74,8 +76,10 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
private EmojiPalettesAdapter mEmojiPalettesAdapter;
|
private EmojiPalettesAdapter mEmojiPalettesAdapter;
|
||||||
private final EmojiLayoutParams mEmojiLayoutParams;
|
private final EmojiLayoutParams mEmojiLayoutParams;
|
||||||
|
|
||||||
|
private ImageButton mDeleteKey;
|
||||||
private TextView mAlphabetKeyLeft;
|
private TextView mAlphabetKeyLeft;
|
||||||
private TextView mAlphabetKeyRight;
|
private TextView mAlphabetKeyRight;
|
||||||
|
private ImageButton mSpacebar;
|
||||||
private TabHost mTabHost;
|
private TabHost mTabHost;
|
||||||
private ViewPager mEmojiPager;
|
private ViewPager mEmojiPager;
|
||||||
private int mCurrentPagerPosition = 0;
|
private int mCurrentPagerPosition = 0;
|
||||||
|
@ -147,6 +151,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
final TextView textView = (TextView)LayoutInflater.from(getContext()).inflate(
|
final TextView textView = (TextView)LayoutInflater.from(getContext()).inflate(
|
||||||
R.layout.emoji_keyboard_tab_label, null);
|
R.layout.emoji_keyboard_tab_label, null);
|
||||||
textView.setText(mEmojiCategory.getCategoryLabel(categoryId));
|
textView.setText(mEmojiCategory.getCategoryLabel(categoryId));
|
||||||
|
textView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
textView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
|
textView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
|
||||||
textView.setTextColor(mTabLabelColor);
|
textView.setTextColor(mTabLabelColor);
|
||||||
tspec.setIndicator(textView);
|
tspec.setIndicator(textView);
|
||||||
|
@ -184,10 +189,10 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
mEmojiLayoutParams.setActionBarProperties(actionBar);
|
mEmojiLayoutParams.setActionBarProperties(actionBar);
|
||||||
|
|
||||||
// deleteKey depends only on OnTouchListener.
|
// deleteKey depends only on OnTouchListener.
|
||||||
final ImageView deleteKey = (ImageView)findViewById(R.id.emoji_keyboard_delete);
|
mDeleteKey = (ImageButton)findViewById(R.id.emoji_keyboard_delete);
|
||||||
deleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
|
mDeleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
|
||||||
deleteKey.setTag(Constants.CODE_DELETE);
|
mDeleteKey.setTag(Constants.CODE_DELETE);
|
||||||
deleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);
|
mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);
|
||||||
|
|
||||||
// {@link #mAlphabetKeyLeft}, {@link #mAlphabetKeyRight, and spaceKey depend on
|
// {@link #mAlphabetKeyLeft}, {@link #mAlphabetKeyRight, and spaceKey depend on
|
||||||
// {@link View.OnClickListener} as well as {@link View.OnTouchListener}.
|
// {@link View.OnClickListener} as well as {@link View.OnTouchListener}.
|
||||||
|
@ -206,12 +211,12 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
mAlphabetKeyRight.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
|
mAlphabetKeyRight.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
|
||||||
mAlphabetKeyRight.setOnTouchListener(this);
|
mAlphabetKeyRight.setOnTouchListener(this);
|
||||||
mAlphabetKeyRight.setOnClickListener(this);
|
mAlphabetKeyRight.setOnClickListener(this);
|
||||||
final ImageView spaceKey = (ImageView)findViewById(R.id.emoji_keyboard_space);
|
mSpacebar = (ImageButton)findViewById(R.id.emoji_keyboard_space);
|
||||||
spaceKey.setBackgroundResource(mSpacebarBackgroundId);
|
mSpacebar.setBackgroundResource(mSpacebarBackgroundId);
|
||||||
spaceKey.setTag(Constants.CODE_SPACE);
|
mSpacebar.setTag(Constants.CODE_SPACE);
|
||||||
spaceKey.setOnTouchListener(this);
|
mSpacebar.setOnTouchListener(this);
|
||||||
spaceKey.setOnClickListener(this);
|
mSpacebar.setOnClickListener(this);
|
||||||
mEmojiLayoutParams.setKeyProperties(spaceKey);
|
mEmojiLayoutParams.setKeyProperties(mSpacebar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -353,7 +358,9 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startEmojiPalettes(final String switchToAlphaLabel,
|
public void startEmojiPalettes(final String switchToAlphaLabel,
|
||||||
final KeyVisualAttributes keyVisualAttr) {
|
final KeyVisualAttributes keyVisualAttr, final KeyboardIconsSet iconSet) {
|
||||||
|
mDeleteKey.setImageDrawable(iconSet.getIconDrawable(KeyboardIconsSet.NAME_DELETE_KEY));
|
||||||
|
mSpacebar.setImageDrawable(iconSet.getIconDrawable(KeyboardIconsSet.NAME_SPACE_KEY));
|
||||||
final KeyDrawParams params = new KeyDrawParams();
|
final KeyDrawParams params = new KeyDrawParams();
|
||||||
params.updateParams(mEmojiLayoutParams.getActionBarHeight(), keyVisualAttr);
|
params.updateParams(mEmojiLayoutParams.getActionBarHeight(), keyVisualAttr);
|
||||||
setupAlphabetKey(mAlphabetKeyLeft, switchToAlphaLabel, params);
|
setupAlphabetKey(mAlphabetKeyLeft, switchToAlphaLabel, params);
|
||||||
|
|
|
@ -253,10 +253,11 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
// Implements {@link KeyboardState.SwitchActions}.
|
// Implements {@link KeyboardState.SwitchActions}.
|
||||||
@Override
|
@Override
|
||||||
public void setEmojiKeyboard() {
|
public void setEmojiKeyboard() {
|
||||||
|
final Keyboard keyboard = mKeyboardView.getKeyboard();
|
||||||
mMainKeyboardFrame.setVisibility(View.GONE);
|
mMainKeyboardFrame.setVisibility(View.GONE);
|
||||||
mEmojiPalettesView.startEmojiPalettes(
|
mEmojiPalettesView.startEmojiPalettes(
|
||||||
mKeyboardTextsSet.getText(KeyboardTextsSet.SWITCH_TO_ALPHA_KEY_LABEL),
|
mKeyboardTextsSet.getText(KeyboardTextsSet.SWITCH_TO_ALPHA_KEY_LABEL),
|
||||||
mKeyboardView.getKeyVisualAttribute());
|
mKeyboardView.getKeyVisualAttribute(), keyboard.mIconsSet);
|
||||||
mEmojiPalettesView.setVisibility(View.VISIBLE);
|
mEmojiPalettesView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,10 @@ public final class KeyboardIconsSet {
|
||||||
throw new RuntimeException("unknown icon name: " + name);
|
throw new RuntimeException("unknown icon name: " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Drawable getIconDrawable(final String name) {
|
||||||
|
return getIconDrawable(getIconId(name));
|
||||||
|
}
|
||||||
|
|
||||||
public Drawable getIconDrawable(final int iconId) {
|
public Drawable getIconDrawable(final int iconId) {
|
||||||
if (isValidIconId(iconId)) {
|
if (isValidIconId(iconId)) {
|
||||||
return mIcons[iconId];
|
return mIcons[iconId];
|
||||||
|
|
Loading…
Reference in New Issue