am 0f33e614: Implement Floating Action Button more keys keyboard

* commit '0f33e614c0799fa3a14a2c32db4bf0654df039da':
  Implement Floating Action Button more keys keyboard
This commit is contained in:
Tadashi G. Takaoka 2014-09-08 05:47:40 +00:00 committed by Android Git Automerger
commit 40b0e3a4c8
10 changed files with 117 additions and 3 deletions

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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_pressed="true"
android:drawable="@drawable/btn_keyboard_key_active_pressed_lxx_dark" />
<item android:drawable="@drawable/btn_keyboard_key_active_lxx_dark" />
</selector>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 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_pressed="true"
android:drawable="@drawable/btn_keyboard_key_active_pressed_lxx_light" />
<item android:drawable="@drawable/btn_keyboard_key_active_lxx_light" />
</selector>

View File

@ -0,0 +1,32 @@
<?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.
*/
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<com.android.inputmethod.keyboard.MoreKeysKeyboardView
android:id="@+id/more_keys_keyboard_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?attr/moreKeysKeyboardViewForActionStyle" />
</LinearLayout>

View File

@ -32,6 +32,8 @@
<attr name="moreKeysKeyboardStyle" format="reference" /> <attr name="moreKeysKeyboardStyle" format="reference" />
<!-- MoreKeysKeyboardView style --> <!-- MoreKeysKeyboardView style -->
<attr name="moreKeysKeyboardViewStyle" format="reference" /> <attr name="moreKeysKeyboardViewStyle" format="reference" />
<!-- MoreKeysKeyboardView style for action key -->
<attr name="moreKeysKeyboardViewForActionStyle" format="reference" />
<!-- Suggestions strip style --> <!-- Suggestions strip style -->
<attr name="suggestionStripViewStyle" format="reference" /> <attr name="suggestionStripViewStyle" format="reference" />
<!-- Suggestion word style --> <!-- Suggestion word style -->
@ -119,6 +121,8 @@
<attr name="keyPreviewDismissAnimator" format="reference" /> <attr name="keyPreviewDismissAnimator" format="reference" />
<!-- Layout resource for more keys keyboard --> <!-- Layout resource for more keys keyboard -->
<attr name="moreKeysKeyboardLayout" format="reference" /> <attr name="moreKeysKeyboardLayout" format="reference" />
<!-- Layout resource for more keys keyboard of action key -->
<attr name="moreKeysKeyboardForActionLayout" format="reference" />
<attr name="backgroundDimAlpha" format="integer" /> <attr name="backgroundDimAlpha" format="integer" />
<!-- More keys keyboard will shown at touched point. --> <!-- More keys keyboard will shown at touched point. -->
<attr name="showMoreKeysKeyboardAtTouchedPoint" format="boolean" /> <attr name="showMoreKeysKeyboardAtTouchedPoint" format="boolean" />

View File

@ -25,7 +25,9 @@
<item name="mainKeyboardViewStyle">@style/MainKeyboardView.ICS</item> <item name="mainKeyboardViewStyle">@style/MainKeyboardView.ICS</item>
<item name="emojiPalettesViewStyle">@style/EmojiPalettesView.ICS</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.ICS</item>
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.ICS</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.ICS</item>
<!-- Note: ICS theme uses the same style for both general more keys and action more keys. -->
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.ICS</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.ICS</item>
<item name="moreKeysKeyboardViewForActionStyle">@style/MoreKeysKeyboardView.ICS</item>
<item name="suggestionStripViewStyle">@style/SuggestionStripView.ICS</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.ICS</item>
<item name="suggestionWordStyle">@style/SuggestionWord.ICS</item> <item name="suggestionWordStyle">@style/SuggestionWord.ICS</item>
</style> </style>

View File

@ -25,7 +25,9 @@
<item name="mainKeyboardViewStyle">@style/MainKeyboardView.KLP</item> <item name="mainKeyboardViewStyle">@style/MainKeyboardView.KLP</item>
<item name="emojiPalettesViewStyle">@style/EmojiPalettesView.KLP</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.KLP</item>
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.KLP</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.KLP</item>
<!-- Note: KLP theme uses the same style for both general more keys and action more keys. -->
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.KLP</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.KLP</item>
<item name="moreKeysKeyboardViewForActionStyle">@style/MoreKeysKeyboardView.KLP</item>
<item name="suggestionStripViewStyle">@style/SuggestionStripView.KLP</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.KLP</item>
<item name="suggestionWordStyle">@style/SuggestionWord.KLP</item> <item name="suggestionWordStyle">@style/SuggestionWord.KLP</item>
</style> </style>

View File

@ -26,6 +26,7 @@
<item name="emojiPalettesViewStyle">@style/EmojiPalettesView.LXX_Dark</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.LXX_Dark</item>
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.LXX_Dark</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.LXX_Dark</item>
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.LXX_Dark</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.LXX_Dark</item>
<item name="moreKeysKeyboardViewForActionStyle">@style/MoreKeysKeyboardView.LXX_Dark.Action</item>
<item name="suggestionStripViewStyle">@style/SuggestionStripView.LXX_Dark</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.LXX_Dark</item>
<item name="suggestionWordStyle">@style/SuggestionWord.LXX_Dark</item> <item name="suggestionWordStyle">@style/SuggestionWord.LXX_Dark</item>
</style> </style>
@ -57,6 +58,7 @@
name="MainKeyboardView.LXX_Dark" name="MainKeyboardView.LXX_Dark"
parent="KeyboardView.LXX_Dark" parent="KeyboardView.LXX_Dark"
> >
<item name="moreKeysKeyboardForActionLayout">@layout/more_keys_keyboard_for_action_lxx</item>
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_dark</item> <item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_dark</item>
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item> <item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
<item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_lxx</item> <item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_lxx</item>
@ -105,6 +107,14 @@
<item name="keyTypeface">normal</item> <item name="keyTypeface">normal</item>
<item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item> <item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item>
</style> </style>
<style
name="MoreKeysKeyboardView.LXX_Dark.Action"
parent="MoreKeysKeyboardView.LXX_Dark"
>
<item name="android:background">@android:color/transparent</item>
<item name="keyBackground">@drawable/btn_keyboard_key_popup_action_lxx_dark</item>
<item name="divider">@null</item>
</style>
<style <style
name="SuggestionStripView.LXX_Dark" name="SuggestionStripView.LXX_Dark"
parent="KeyboardView.LXX_Dark" parent="KeyboardView.LXX_Dark"

View File

@ -26,6 +26,7 @@
<item name="emojiPalettesViewStyle">@style/EmojiPalettesView.LXX_Light</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.LXX_Light</item>
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.LXX_Light</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.LXX_Light</item>
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.LXX_Light</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.LXX_Light</item>
<item name="moreKeysKeyboardViewForActionStyle">@style/MoreKeysKeyboardView.LXX_Light.Action</item>
<item name="suggestionStripViewStyle">@style/SuggestionStripView.LXX_Light</item> <item name="suggestionStripViewStyle">@style/SuggestionStripView.LXX_Light</item>
<item name="suggestionWordStyle">@style/SuggestionWord.LXX_Light</item> <item name="suggestionWordStyle">@style/SuggestionWord.LXX_Light</item>
</style> </style>
@ -57,6 +58,7 @@
name="MainKeyboardView.LXX_Light" name="MainKeyboardView.LXX_Light"
parent="KeyboardView.LXX_Light" parent="KeyboardView.LXX_Light"
> >
<item name="moreKeysKeyboardForActionLayout">@layout/more_keys_keyboard_for_action_lxx</item>
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_light</item> <item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_light</item>
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item> <item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
<item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_lxx</item> <item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_lxx</item>
@ -105,6 +107,14 @@
<item name="keyTypeface">normal</item> <item name="keyTypeface">normal</item>
<item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item> <item name="verticalCorrection">@dimen/config_more_keys_keyboard_vertical_correction_holo</item>
</style> </style>
<style
name="MoreKeysKeyboardView.LXX_Light.Action"
parent="MoreKeysKeyboardView.LXX_Light"
>
<item name="android:background">@android:color/transparent</item>
<item name="keyBackground">@drawable/btn_keyboard_key_popup_action_lxx_light</item>
<item name="divider">@null</item>
</style>
<style <style
name="SuggestionStripView.LXX_Light" name="SuggestionStripView.LXX_Light"
parent="KeyboardView.LXX_Light" parent="KeyboardView.LXX_Light"

View File

@ -547,6 +547,10 @@ public class Key implements Comparable<Key> {
return this instanceof Spacer; return this instanceof Spacer;
} }
public final boolean isActionKey() {
return mBackgroundType == BACKGROUND_TYPE_ACTION;
}
public final boolean isShift() { public final boolean isShift() {
return mCode == CODE_SHIFT; return mCode == CODE_SHIFT;
} }

View File

@ -89,6 +89,7 @@ import java.util.WeakHashMap;
* @attr ref R.styleable#MainKeyboardView_keyPreviewShowUpAnimator * @attr ref R.styleable#MainKeyboardView_keyPreviewShowUpAnimator
* @attr ref R.styleable#MainKeyboardView_keyPreviewDismissAnimator * @attr ref R.styleable#MainKeyboardView_keyPreviewDismissAnimator
* @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardLayout * @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardLayout
* @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardForActionLayout
* @attr ref R.styleable#MainKeyboardView_backgroundDimAlpha * @attr ref R.styleable#MainKeyboardView_backgroundDimAlpha
* @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint * @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint
* @attr ref R.styleable#MainKeyboardView_gestureFloatingPreviewTextLingerTimeout * @attr ref R.styleable#MainKeyboardView_gestureFloatingPreviewTextLingerTimeout
@ -148,6 +149,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
private final Paint mBackgroundDimAlphaPaint = new Paint(); private final Paint mBackgroundDimAlphaPaint = new Paint();
private boolean mNeedsToDimEntireKeyboard; private boolean mNeedsToDimEntireKeyboard;
private final View mMoreKeysKeyboardContainer; private final View mMoreKeysKeyboardContainer;
private final View mMoreKeysKeyboardForActionContainer;
private final WeakHashMap<Key, Keyboard> mMoreKeysKeyboardCache = new WeakHashMap<>(); private final WeakHashMap<Key, Keyboard> mMoreKeysKeyboardCache = new WeakHashMap<>();
private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint; private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint;
// More keys panel (used by both more keys keyboard and more suggestions view) // More keys panel (used by both more keys keyboard and more suggestions view)
@ -232,6 +234,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
final int moreKeysKeyboardLayoutId = mainKeyboardViewAttr.getResourceId( final int moreKeysKeyboardLayoutId = mainKeyboardViewAttr.getResourceId(
R.styleable.MainKeyboardView_moreKeysKeyboardLayout, 0); R.styleable.MainKeyboardView_moreKeysKeyboardLayout, 0);
final int moreKeysKeyboardForActionLayoutId = mainKeyboardViewAttr.getResourceId(
R.styleable.MainKeyboardView_moreKeysKeyboardForActionLayout,
moreKeysKeyboardLayoutId);
mConfigShowMoreKeysKeyboardAtTouchedPoint = mainKeyboardViewAttr.getBoolean( mConfigShowMoreKeysKeyboardAtTouchedPoint = mainKeyboardViewAttr.getBoolean(
R.styleable.MainKeyboardView_showMoreKeysKeyboardAtTouchedPoint, false); R.styleable.MainKeyboardView_showMoreKeysKeyboardAtTouchedPoint, false);
@ -249,8 +254,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
mSlidingKeyInputDrawingPreview.setDrawingView(mDrawingPreviewPlacerView); mSlidingKeyInputDrawingPreview.setDrawingView(mDrawingPreviewPlacerView);
mainKeyboardViewAttr.recycle(); mainKeyboardViewAttr.recycle();
mMoreKeysKeyboardContainer = LayoutInflater.from(getContext()) final LayoutInflater inflater = LayoutInflater.from(getContext());
.inflate(moreKeysKeyboardLayoutId, null); mMoreKeysKeyboardContainer = inflater.inflate(moreKeysKeyboardLayoutId, null);
mMoreKeysKeyboardForActionContainer = inflater.inflate(
moreKeysKeyboardForActionLayoutId, null);
mLanguageOnSpacebarFadeoutAnimator = loadObjectAnimator( mLanguageOnSpacebarFadeoutAnimator = loadObjectAnimator(
languageOnSpacebarFadeoutAnimatorResId, this); languageOnSpacebarFadeoutAnimatorResId, this);
mAltCodeKeyWhileTypingFadeoutAnimator = loadObjectAnimator( mAltCodeKeyWhileTypingFadeoutAnimator = loadObjectAnimator(
@ -582,7 +589,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
mMoreKeysKeyboardCache.put(key, moreKeysKeyboard); mMoreKeysKeyboardCache.put(key, moreKeysKeyboard);
} }
final View container = mMoreKeysKeyboardContainer; final View container = key.isActionKey() ? mMoreKeysKeyboardForActionContainer
: mMoreKeysKeyboardContainer;
final MoreKeysKeyboardView moreKeysKeyboardView = final MoreKeysKeyboardView moreKeysKeyboardView =
(MoreKeysKeyboardView)container.findViewById(R.id.more_keys_keyboard_view); (MoreKeysKeyboardView)container.findViewById(R.id.more_keys_keyboard_view);
moreKeysKeyboardView.setKeyboard(moreKeysKeyboard); moreKeysKeyboardView.setKeyboard(moreKeysKeyboard);