Add Keyboard Theme Switcher
Change-Id: If1bf7d20e4f8a47a7c0429d2445431dc73c1b31b
Before Width: | Height: | Size: 200 B After Width: | Height: | Size: 200 B |
36
java/res/drawable/btn_keyboard_key2.xml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2010 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">
|
||||||
|
|
||||||
|
<!-- Toggle keys. Use checkable/checked state. -->
|
||||||
|
|
||||||
|
<item android:state_checkable="true" android:state_checked="true"
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_pressed_on" />
|
||||||
|
<item android:state_checkable="true" android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_fulltrans_pressed" />
|
||||||
|
<item android:state_checkable="true" android:state_checked="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_normal_on" />
|
||||||
|
<item android:state_checkable="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_fulltrans_normal" />
|
||||||
|
|
||||||
|
<!-- Normal keys -->
|
||||||
|
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_fulltrans_pressed" />
|
||||||
|
<item android:drawable="@drawable/btn_keyboard_key_fulltrans_normal" />
|
||||||
|
</selector>
|
36
java/res/drawable/btn_keyboard_key3.xml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2010 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">
|
||||||
|
|
||||||
|
<!-- Toggle keys. Use checkable/checked state. -->
|
||||||
|
|
||||||
|
<item android:state_checkable="true" android:state_checked="true"
|
||||||
|
android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_pressed_on" />
|
||||||
|
<item android:state_checkable="true" android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_fulltrans_normal" />
|
||||||
|
<item android:state_checkable="true" android:state_checked="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_normal_on" />
|
||||||
|
<item android:state_checkable="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_fulltrans_pressed" />
|
||||||
|
|
||||||
|
<!-- Normal keys -->
|
||||||
|
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:drawable="@drawable/btn_keyboard_key_fulltrans_normal" />
|
||||||
|
<item android:drawable="@drawable/btn_keyboard_key_fulltrans_pressed" />
|
||||||
|
</selector>
|
BIN
java/res/drawable/btn_keyboard_toggle_off.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
java/res/drawable/btn_keyboard_toggle_on.png
Normal file
After Width: | Height: | Size: 812 B |
BIN
java/res/drawable/keyboard_background_2.jpg
Normal file
After Width: | Height: | Size: 125 KiB |
BIN
java/res/drawable/keyboard_background_3.jpg
Normal file
After Width: | Height: | Size: 280 KiB |
BIN
java/res/drawable/keyboard_background_4.jpg
Executable file
After Width: | Height: | Size: 191 KiB |
BIN
java/res/drawable/keyboard_background_5.jpg
Normal file
After Width: | Height: | Size: 3.6 KiB |
29
java/res/layout/input2.xml
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.android.inputmethod.latin.LatinKeyboardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@android:id/keyboardView"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:keyBackground="@drawable/btn_keyboard_key3"
|
||||||
|
android:background="@android:color/black"
|
||||||
|
/>
|
29
java/res/layout/input3.xml
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.android.inputmethod.latin.LatinKeyboardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@android:id/keyboardView"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:keyBackground="@drawable/btn_keyboard_key2"
|
||||||
|
android:background="@drawable/keyboard_background_4"
|
||||||
|
/>
|
29
java/res/layout/input4.xml
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.android.inputmethod.latin.LatinKeyboardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@android:id/keyboardView"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:keyBackground="@drawable/btn_keyboard_key3"
|
||||||
|
android:background="@drawable/keyboard_background_4"
|
||||||
|
/>
|
29
java/res/layout/input5.xml
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.android.inputmethod.latin.LatinKeyboardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@android:id/keyboardView"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:keyBackground="@drawable/btn_keyboard_key2"
|
||||||
|
android:background="@drawable/keyboard_background_5"
|
||||||
|
/>
|
29
java/res/layout/input6.xml
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<com.android.inputmethod.latin.LatinKeyboardView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@android:id/keyboardView"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:keyBackground="@drawable/btn_keyboard_key3"
|
||||||
|
android:background="@drawable/keyboard_background_5"
|
||||||
|
/>
|
|
@ -328,4 +328,30 @@
|
||||||
<string name="prefs_enable_log">Enable user feedback</string>
|
<string name="prefs_enable_log">Enable user feedback</string>
|
||||||
<!-- Description for sending logs -->
|
<!-- Description for sending logs -->
|
||||||
<string name="prefs_description_log">Help improve this input method editor by automatically sending usage statistics and crash reports to Google.</string>
|
<string name="prefs_description_log">Help improve this input method editor by automatically sending usage statistics and crash reports to Google.</string>
|
||||||
|
|
||||||
|
<string name="keyboard_layout">Keyboard Theme</string>
|
||||||
|
<string name="layout_basic" translatable="false">Basic</string>
|
||||||
|
<string name="layout_high_contrast" translatable="false">Basic (High Contrast)</string>
|
||||||
|
<string name="layout_blue_ribbon" translatable="false">Blue Ribbon</string>
|
||||||
|
<string name="layout_dazzle" translatable="false">Dazzle</string>
|
||||||
|
<string name="layout_blue_ribbon_high" translatable="false">Blue Ribbon (High Contrast)</string>
|
||||||
|
<string name="layout_dazzle_high" translatable="false">Dazzle (High Contrast)</string>
|
||||||
|
|
||||||
|
<string-array name="keyboard_layout_modes" translatable="false">
|
||||||
|
<item>@string/layout_basic</item>
|
||||||
|
<item>@string/layout_high_contrast</item>
|
||||||
|
<item>@string/layout_blue_ribbon</item>
|
||||||
|
<item>@string/layout_blue_ribbon_high</item>
|
||||||
|
<item>@string/layout_dazzle</item>
|
||||||
|
<item>@string/layout_dazzle_high</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="keyboard_layout_modes_values" translatable="false">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
|
<item>5</item>
|
||||||
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -53,6 +53,15 @@
|
||||||
android:defaultValue="@string/voice_mode_main"
|
android:defaultValue="@string/voice_mode_main"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:key="keyboard_layout"
|
||||||
|
android:title="@string/keyboard_layout"
|
||||||
|
android:persistent="true"
|
||||||
|
android:entryValues="@array/keyboard_layout_modes_values"
|
||||||
|
android:entries="@array/keyboard_layout_modes"
|
||||||
|
android:defaultValue="2"
|
||||||
|
/>
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:title="@string/language_selection_title"
|
android:title="@string/language_selection_title"
|
||||||
android:summary="@string/language_selection_summary">
|
android:summary="@string/language_selection_summary">
|
||||||
|
|
|
@ -21,11 +21,12 @@ import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
public class KeyboardSwitcher {
|
public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
public static final int MODE_TEXT = 1;
|
public static final int MODE_TEXT = 1;
|
||||||
public static final int MODE_SYMBOLS = 2;
|
public static final int MODE_SYMBOLS = 2;
|
||||||
|
@ -56,10 +57,15 @@ public class KeyboardSwitcher {
|
||||||
KEYBOARDMODE_EMAIL,
|
KEYBOARDMODE_EMAIL,
|
||||||
KEYBOARDMODE_IM,
|
KEYBOARDMODE_IM,
|
||||||
KEYBOARDMODE_WEB};
|
KEYBOARDMODE_WEB};
|
||||||
|
private static final String PREF_KEYBOARD_LAYOUT = "keyboard_layout";
|
||||||
|
private static final int[] LAYOUTS = new int [] {
|
||||||
|
R.layout.input, R.layout.input2, R.layout.input3, R.layout.input4, R.layout.input5,
|
||||||
|
R.layout.input6
|
||||||
|
};
|
||||||
|
private static final String DEFAULT_LAYOUT_ID = "0";
|
||||||
|
|
||||||
//LatinIME mContext;
|
|
||||||
Context mContext;
|
Context mContext;
|
||||||
InputMethodService mInputMethodService;
|
LatinIME mInputMethodService;
|
||||||
|
|
||||||
private KeyboardId mSymbolsId;
|
private KeyboardId mSymbolsId;
|
||||||
private KeyboardId mSymbolsShiftedId;
|
private KeyboardId mSymbolsShiftedId;
|
||||||
|
@ -79,14 +85,20 @@ public class KeyboardSwitcher {
|
||||||
private int mLastDisplayWidth;
|
private int mLastDisplayWidth;
|
||||||
private LanguageSwitcher mLanguageSwitcher;
|
private LanguageSwitcher mLanguageSwitcher;
|
||||||
private Locale mInputLocale;
|
private Locale mInputLocale;
|
||||||
private boolean mEnableMultipleLanguages;
|
|
||||||
|
|
||||||
KeyboardSwitcher(Context context, InputMethodService ims) {
|
private int mLayoutId;
|
||||||
|
|
||||||
|
KeyboardSwitcher(Context context, LatinIME ims) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mKeyboards = new HashMap<KeyboardId, LatinKeyboard>();
|
mKeyboards = new HashMap<KeyboardId, LatinKeyboard>();
|
||||||
mSymbolsId = new KeyboardId(R.xml.kbd_symbols, false);
|
mSymbolsId = new KeyboardId(R.xml.kbd_symbols, false);
|
||||||
mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift, false);
|
mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift, false);
|
||||||
mInputMethodService = ims;
|
mInputMethodService = ims;
|
||||||
|
|
||||||
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ims);
|
||||||
|
int mLayoutId = Integer.valueOf(prefs.getString(PREF_KEYBOARD_LAYOUT, DEFAULT_LAYOUT_ID));
|
||||||
|
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
changeLatinKeyboardView(mLayoutId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,7 +110,6 @@ public class KeyboardSwitcher {
|
||||||
void setLanguageSwitcher(LanguageSwitcher languageSwitcher) {
|
void setLanguageSwitcher(LanguageSwitcher languageSwitcher) {
|
||||||
mLanguageSwitcher = languageSwitcher;
|
mLanguageSwitcher = languageSwitcher;
|
||||||
mInputLocale = mLanguageSwitcher.getInputLocale();
|
mInputLocale = mLanguageSwitcher.getInputLocale();
|
||||||
mEnableMultipleLanguages = mLanguageSwitcher.getLocaleCount() > 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInputView(LatinKeyboardView inputView) {
|
void setInputView(LatinKeyboardView inputView) {
|
||||||
|
@ -140,6 +151,7 @@ public class KeyboardSwitcher {
|
||||||
this(xml, 0, false, hasVoice);
|
this(xml, 0, false, hasVoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
return other instanceof KeyboardId && equals((KeyboardId) other);
|
return other instanceof KeyboardId && equals((KeyboardId) other);
|
||||||
}
|
}
|
||||||
|
@ -150,6 +162,7 @@ public class KeyboardSwitcher {
|
||||||
&& other.mEnableShiftLock == this.mEnableShiftLock;
|
&& other.mEnableShiftLock == this.mEnableShiftLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (mXml + 1) * (mKeyboardMode + 1) * (mEnableShiftLock ? 2 : 1)
|
return (mXml + 1) * (mKeyboardMode + 1) * (mEnableShiftLock ? 2 : 1)
|
||||||
* (mHasVoice ? 4 : 8);
|
* (mHasVoice ? 4 : 8);
|
||||||
|
@ -348,4 +361,38 @@ public class KeyboardSwitcher {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LatinKeyboardView getInputView() {
|
||||||
|
return mInputView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void recreateInputView() {
|
||||||
|
changeLatinKeyboardView(mLayoutId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeLatinKeyboardView(int newLayout, boolean forceReset) {
|
||||||
|
if (mLayoutId != newLayout || mInputView == null || forceReset) {
|
||||||
|
if (LAYOUTS.length <= newLayout) {
|
||||||
|
newLayout = Integer.valueOf(DEFAULT_LAYOUT_ID);
|
||||||
|
}
|
||||||
|
mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater().inflate(
|
||||||
|
LAYOUTS[newLayout], null);
|
||||||
|
mInputView.setOnKeyboardActionListener(mInputMethodService);
|
||||||
|
mLayoutId = newLayout;
|
||||||
|
}
|
||||||
|
mInputMethodService.mHandler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if (mInputView != null) {
|
||||||
|
mInputMethodService.setInputView(mInputView);
|
||||||
|
}
|
||||||
|
mInputMethodService.updateInputViewShown();
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
|
if (PREF_KEYBOARD_LAYOUT.equals(key)) {
|
||||||
|
changeLatinKeyboardView(
|
||||||
|
Integer.valueOf(sharedPreferences.getString(key, DEFAULT_LAYOUT_ID)), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class LatinIME extends InputMethodService
|
||||||
private static final int POS_SETTINGS = 0;
|
private static final int POS_SETTINGS = 0;
|
||||||
private static final int POS_METHOD = 1;
|
private static final int POS_METHOD = 1;
|
||||||
|
|
||||||
private LatinKeyboardView mInputView;
|
//private LatinKeyboardView mInputView;
|
||||||
private CandidateViewContainer mCandidateViewContainer;
|
private CandidateViewContainer mCandidateViewContainer;
|
||||||
private CandidateView mCandidateView;
|
private CandidateView mCandidateView;
|
||||||
private Suggest mSuggest;
|
private Suggest mSuggest;
|
||||||
|
@ -248,8 +248,9 @@ public class LatinIME extends InputMethodService
|
||||||
break;
|
break;
|
||||||
case MSG_START_TUTORIAL:
|
case MSG_START_TUTORIAL:
|
||||||
if (mTutorial == null) {
|
if (mTutorial == null) {
|
||||||
if (mInputView.isShown()) {
|
if (mKeyboardSwitcher.getInputView().isShown()) {
|
||||||
mTutorial = new Tutorial(LatinIME.this, mInputView);
|
mTutorial = new Tutorial(
|
||||||
|
LatinIME.this, mKeyboardSwitcher.getInputView());
|
||||||
mTutorial.start();
|
mTutorial.start();
|
||||||
} else {
|
} else {
|
||||||
// Try again soon if the view is not yet showing
|
// Try again soon if the view is not yet showing
|
||||||
|
@ -394,15 +395,12 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateInputView() {
|
public View onCreateInputView() {
|
||||||
mInputView = (LatinKeyboardView) getLayoutInflater().inflate(
|
mKeyboardSwitcher.recreateInputView();
|
||||||
R.layout.input, null);
|
|
||||||
mKeyboardSwitcher.setInputView(mInputView);
|
|
||||||
mKeyboardSwitcher.makeKeyboards(true);
|
mKeyboardSwitcher.makeKeyboards(true);
|
||||||
mInputView.setOnKeyboardActionListener(this);
|
|
||||||
mKeyboardSwitcher.setKeyboardMode(
|
mKeyboardSwitcher.setKeyboardMode(
|
||||||
KeyboardSwitcher.MODE_TEXT, 0,
|
KeyboardSwitcher.MODE_TEXT, 0,
|
||||||
shouldShowVoiceButton(makeFieldContext(), getCurrentInputEditorInfo()));
|
shouldShowVoiceButton(makeFieldContext(), getCurrentInputEditorInfo()));
|
||||||
return mInputView;
|
return mKeyboardSwitcher.getInputView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -419,8 +417,9 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStartInputView(EditorInfo attribute, boolean restarting) {
|
public void onStartInputView(EditorInfo attribute, boolean restarting) {
|
||||||
|
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
||||||
// In landscape mode, this method gets called without the input view being created.
|
// In landscape mode, this method gets called without the input view being created.
|
||||||
if (mInputView == null) {
|
if (inputView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +528,7 @@ public class LatinIME extends InputMethodService
|
||||||
attribute.imeOptions, enableVoiceButton);
|
attribute.imeOptions, enableVoiceButton);
|
||||||
updateShiftKeyState(attribute);
|
updateShiftKeyState(attribute);
|
||||||
}
|
}
|
||||||
mInputView.closing();
|
inputView.closing();
|
||||||
mComposing.setLength(0);
|
mComposing.setLength(0);
|
||||||
mPredicting = false;
|
mPredicting = false;
|
||||||
mDeleteCount = 0;
|
mDeleteCount = 0;
|
||||||
|
@ -545,7 +544,7 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
updateCorrectionMode();
|
updateCorrectionMode();
|
||||||
|
|
||||||
mInputView.setProximityCorrectionEnabled(true);
|
inputView.setProximityCorrectionEnabled(true);
|
||||||
mPredictionOn = mPredictionOn && (mCorrectionMode > 0 || mShowSuggestions);
|
mPredictionOn = mPredictionOn && (mCorrectionMode > 0 || mShowSuggestions);
|
||||||
checkTutorial(attribute.privateImeOptions);
|
checkTutorial(attribute.privateImeOptions);
|
||||||
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
|
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
|
||||||
|
@ -563,8 +562,8 @@ public class LatinIME extends InputMethodService
|
||||||
mVoiceInput.flushLogs();
|
mVoiceInput.flushLogs();
|
||||||
mVoiceInput.cancel();
|
mVoiceInput.cancel();
|
||||||
}
|
}
|
||||||
if (mInputView != null) {
|
if (mKeyboardSwitcher.getInputView() != null) {
|
||||||
mInputView.closing();
|
mKeyboardSwitcher.getInputView().closing();
|
||||||
}
|
}
|
||||||
if (mAutoDictionary != null) mAutoDictionary.flushPendingWrites();
|
if (mAutoDictionary != null) mAutoDictionary.flushPendingWrites();
|
||||||
}
|
}
|
||||||
|
@ -708,7 +707,8 @@ public class LatinIME extends InputMethodService
|
||||||
// TODO: Remove this if we support candidates with hard keyboard
|
// TODO: Remove this if we support candidates with hard keyboard
|
||||||
if (onEvaluateInputViewShown()) {
|
if (onEvaluateInputViewShown()) {
|
||||||
// Show the candidates view only if input view is showing
|
// Show the candidates view only if input view is showing
|
||||||
super.setCandidatesViewShown(shown && mInputView != null && mInputView.isShown());
|
super.setCandidatesViewShown(shown && mKeyboardSwitcher.getInputView() != null
|
||||||
|
&& mKeyboardSwitcher.getInputView().isShown());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,8 +724,8 @@ public class LatinIME extends InputMethodService
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
case KeyEvent.KEYCODE_BACK:
|
case KeyEvent.KEYCODE_BACK:
|
||||||
if (event.getRepeatCount() == 0 && mInputView != null) {
|
if (event.getRepeatCount() == 0 && mKeyboardSwitcher.getInputView() != null) {
|
||||||
if (mInputView.handleBack()) {
|
if (mKeyboardSwitcher.getInputView().handleBack()) {
|
||||||
return true;
|
return true;
|
||||||
} else if (mTutorial != null) {
|
} else if (mTutorial != null) {
|
||||||
mTutorial.close();
|
mTutorial.close();
|
||||||
|
@ -757,8 +757,10 @@ public class LatinIME extends InputMethodService
|
||||||
if (mTutorial != null) {
|
if (mTutorial != null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
||||||
// Enable shift key and DPAD to do selections
|
// Enable shift key and DPAD to do selections
|
||||||
if (mInputView != null && mInputView.isShown() && mInputView.isShifted()) {
|
if (inputView != null && inputView.isShown()
|
||||||
|
&& inputView.isShifted()) {
|
||||||
event = new KeyEvent(event.getDownTime(), event.getEventTime(),
|
event = new KeyEvent(event.getDownTime(), event.getEventTime(),
|
||||||
event.getAction(), event.getKeyCode(), event.getRepeatCount(),
|
event.getAction(), event.getKeyCode(), event.getRepeatCount(),
|
||||||
event.getDeviceId(), event.getScanCode(),
|
event.getDeviceId(), event.getScanCode(),
|
||||||
|
@ -791,7 +793,7 @@ public class LatinIME extends InputMethodService
|
||||||
mKeyboardSwitcher = new KeyboardSwitcher(this, this);
|
mKeyboardSwitcher = new KeyboardSwitcher(this, this);
|
||||||
}
|
}
|
||||||
mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher);
|
mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher);
|
||||||
if (mInputView != null) {
|
if (mKeyboardSwitcher.getInputView() != null) {
|
||||||
mKeyboardSwitcher.setVoiceMode(mEnableVoice && mEnableVoiceButton, mVoiceOnPrimary);
|
mKeyboardSwitcher.setVoiceMode(mEnableVoice && mEnableVoiceButton, mVoiceOnPrimary);
|
||||||
}
|
}
|
||||||
mKeyboardSwitcher.makeKeyboards(true);
|
mKeyboardSwitcher.makeKeyboards(true);
|
||||||
|
@ -819,9 +821,10 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
public void updateShiftKeyState(EditorInfo attr) {
|
public void updateShiftKeyState(EditorInfo attr) {
|
||||||
InputConnection ic = getCurrentInputConnection();
|
InputConnection ic = getCurrentInputConnection();
|
||||||
if (attr != null && mInputView != null && mKeyboardSwitcher.isAlphabetMode()
|
if (attr != null && mKeyboardSwitcher.getInputView() != null
|
||||||
&& ic != null) {
|
&& mKeyboardSwitcher.isAlphabetMode() && ic != null) {
|
||||||
mInputView.setShifted(mCapsLock || getCursorCapsMode(ic, attr) != 0);
|
mKeyboardSwitcher.getInputView().setShifted(
|
||||||
|
mCapsLock || getCursorCapsMode(ic, attr) != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,7 +1073,8 @@ public class LatinIME extends InputMethodService
|
||||||
if (mKeyboardSwitcher.isAlphabetMode()) {
|
if (mKeyboardSwitcher.isAlphabetMode()) {
|
||||||
// Alphabet keyboard
|
// Alphabet keyboard
|
||||||
checkToggleCapsLock();
|
checkToggleCapsLock();
|
||||||
mInputView.setShifted(mCapsLock || !mInputView.isShifted());
|
mKeyboardSwitcher.getInputView().setShifted(mCapsLock
|
||||||
|
|| !mKeyboardSwitcher.getInputView().isShifted());
|
||||||
} else {
|
} else {
|
||||||
mKeyboardSwitcher.toggleShift();
|
mKeyboardSwitcher.toggleShift();
|
||||||
}
|
}
|
||||||
|
@ -1093,7 +1097,7 @@ public class LatinIME extends InputMethodService
|
||||||
mWord.reset();
|
mWord.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mInputView.isShifted()) {
|
if (mKeyboardSwitcher.getInputView().isShifted()) {
|
||||||
// TODO: This doesn't work with ß, need to fix it in the next release.
|
// TODO: This doesn't work with ß, need to fix it in the next release.
|
||||||
if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT
|
if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT
|
||||||
|| keyCodes[0] > Character.MAX_CODE_POINT) {
|
|| keyCodes[0] > Character.MAX_CODE_POINT) {
|
||||||
|
@ -1102,7 +1106,7 @@ public class LatinIME extends InputMethodService
|
||||||
primaryCode = new String(keyCodes, 0, 1).toUpperCase().charAt(0);
|
primaryCode = new String(keyCodes, 0, 1).toUpperCase().charAt(0);
|
||||||
}
|
}
|
||||||
if (mPredicting) {
|
if (mPredicting) {
|
||||||
if (mInputView.isShifted() && mComposing.length() == 0) {
|
if (mKeyboardSwitcher.getInputView().isShifted() && mComposing.length() == 0) {
|
||||||
mWord.setCapitalized(true);
|
mWord.setCapitalized(true);
|
||||||
}
|
}
|
||||||
mComposing.append((char) primaryCode);
|
mComposing.append((char) primaryCode);
|
||||||
|
@ -1197,12 +1201,12 @@ public class LatinIME extends InputMethodService
|
||||||
mVoiceInput.cancel();
|
mVoiceInput.cancel();
|
||||||
}
|
}
|
||||||
requestHideSelf(0);
|
requestHideSelf(0);
|
||||||
mInputView.closing();
|
mKeyboardSwitcher.getInputView().closing();
|
||||||
TextEntryState.endSession();
|
TextEntryState.endSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkToggleCapsLock() {
|
private void checkToggleCapsLock() {
|
||||||
if (mInputView.getKeyboard().isShifted()) {
|
if (mKeyboardSwitcher.getInputView().getKeyboard().isShifted()) {
|
||||||
toggleCapsLock();
|
toggleCapsLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1214,8 @@ public class LatinIME extends InputMethodService
|
||||||
private void toggleCapsLock() {
|
private void toggleCapsLock() {
|
||||||
mCapsLock = !mCapsLock;
|
mCapsLock = !mCapsLock;
|
||||||
if (mKeyboardSwitcher.isAlphabetMode()) {
|
if (mKeyboardSwitcher.isAlphabetMode()) {
|
||||||
((LatinKeyboard) mInputView.getKeyboard()).setShiftLocked(mCapsLock);
|
((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).setShiftLocked(
|
||||||
|
mCapsLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1238,8 +1243,8 @@ public class LatinIME extends InputMethodService
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
mRecognizing = false;
|
mRecognizing = false;
|
||||||
if (mInputView != null) {
|
if (mKeyboardSwitcher.getInputView() != null) {
|
||||||
setInputView(mInputView);
|
setInputView(mKeyboardSwitcher.getInputView());
|
||||||
}
|
}
|
||||||
updateInputViewShown();
|
updateInputViewShown();
|
||||||
}});
|
}});
|
||||||
|
@ -1338,7 +1343,7 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
Window window = mVoiceWarningDialog.getWindow();
|
Window window = mVoiceWarningDialog.getWindow();
|
||||||
WindowManager.LayoutParams lp = window.getAttributes();
|
WindowManager.LayoutParams lp = window.getAttributes();
|
||||||
lp.token = mInputView.getWindowToken();
|
lp.token = mKeyboardSwitcher.getInputView().getWindowToken();
|
||||||
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
||||||
window.setAttributes(lp);
|
window.setAttributes(lp);
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||||
|
@ -1374,7 +1379,8 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
final List<CharSequence> nBest = new ArrayList<CharSequence>();
|
final List<CharSequence> nBest = new ArrayList<CharSequence>();
|
||||||
boolean capitalizeFirstWord = preferCapitalization()
|
boolean capitalizeFirstWord = preferCapitalization()
|
||||||
|| (mKeyboardSwitcher.isAlphabetMode() && mInputView.isShifted());
|
|| (mKeyboardSwitcher.isAlphabetMode()
|
||||||
|
&& mKeyboardSwitcher.getInputView().isShifted());
|
||||||
for (String c : mVoiceResults.candidates) {
|
for (String c : mVoiceResults.candidates) {
|
||||||
if (capitalizeFirstWord) {
|
if (capitalizeFirstWord) {
|
||||||
c = Character.toUpperCase(c.charAt(0)) + c.substring(1, c.length());
|
c = Character.toUpperCase(c.charAt(0)) + c.substring(1, c.length());
|
||||||
|
@ -1432,7 +1438,8 @@ public class LatinIME extends InputMethodService
|
||||||
private void updateSuggestions() {
|
private void updateSuggestions() {
|
||||||
mSuggestionShouldReplaceCurrentWord = false;
|
mSuggestionShouldReplaceCurrentWord = false;
|
||||||
|
|
||||||
((LatinKeyboard) mInputView.getKeyboard()).setPreferredLetters(null);
|
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
||||||
|
((LatinKeyboard) inputView.getKeyboard()).setPreferredLetters(null);
|
||||||
|
|
||||||
// Check if we have a suggestion engine attached.
|
// Check if we have a suggestion engine attached.
|
||||||
if ((mSuggest == null || !isPredictionOn()) && !mVoiceInputHighlighted) {
|
if ((mSuggest == null || !isPredictionOn()) && !mVoiceInputHighlighted) {
|
||||||
|
@ -1444,17 +1451,20 @@ public class LatinIME extends InputMethodService
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<CharSequence> stringList = mSuggest.getSuggestions(mInputView, mWord, false);
|
List<CharSequence> stringList = mSuggest.getSuggestions(inputView,
|
||||||
|
mWord, false);
|
||||||
int[] nextLettersFrequencies = mSuggest.getNextLettersFrequencies();
|
int[] nextLettersFrequencies = mSuggest.getNextLettersFrequencies();
|
||||||
|
|
||||||
((LatinKeyboard) mInputView.getKeyboard()).setPreferredLetters(nextLettersFrequencies);
|
((LatinKeyboard) inputView.getKeyboard()).setPreferredLetters(
|
||||||
|
nextLettersFrequencies);
|
||||||
|
|
||||||
boolean correctionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasMinimalCorrection();
|
boolean correctionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasMinimalCorrection();
|
||||||
//|| mCorrectionMode == mSuggest.CORRECTION_FULL;
|
//|| mCorrectionMode == mSuggest.CORRECTION_FULL;
|
||||||
CharSequence typedWord = mWord.getTypedWord();
|
CharSequence typedWord = mWord.getTypedWord();
|
||||||
// If we're in basic correct
|
// If we're in basic correct
|
||||||
boolean typedWordValid = mSuggest.isValidWord(typedWord) ||
|
boolean typedWordValid = mSuggest.isValidWord(typedWord) ||
|
||||||
(preferCapitalization() && mSuggest.isValidWord(typedWord.toString().toLowerCase()));
|
(preferCapitalization()
|
||||||
|
&& mSuggest.isValidWord(typedWord.toString().toLowerCase()));
|
||||||
if (mCorrectionMode == Suggest.CORRECTION_FULL) {
|
if (mCorrectionMode == Suggest.CORRECTION_FULL) {
|
||||||
correctionAvailable |= typedWordValid;
|
correctionAvailable |= typedWordValid;
|
||||||
}
|
}
|
||||||
|
@ -1556,10 +1566,12 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pickSuggestion(CharSequence suggestion) {
|
private void pickSuggestion(CharSequence suggestion) {
|
||||||
|
LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
||||||
if (mCapsLock) {
|
if (mCapsLock) {
|
||||||
suggestion = suggestion.toString().toUpperCase();
|
suggestion = suggestion.toString().toUpperCase();
|
||||||
} else if (preferCapitalization()
|
} else if (preferCapitalization()
|
||||||
|| (mKeyboardSwitcher.isAlphabetMode() && mInputView.isShifted())) {
|
|| (mKeyboardSwitcher.isAlphabetMode()
|
||||||
|
&& inputView.isShifted())) {
|
||||||
suggestion = suggestion.toString().toUpperCase().charAt(0)
|
suggestion = suggestion.toString().toUpperCase().charAt(0)
|
||||||
+ suggestion.subSequence(1, suggestion.length()).toString();
|
+ suggestion.subSequence(1, suggestion.length()).toString();
|
||||||
}
|
}
|
||||||
|
@ -1574,7 +1586,7 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
mPredicting = false;
|
mPredicting = false;
|
||||||
mCommittedLength = suggestion.length();
|
mCommittedLength = suggestion.length();
|
||||||
((LatinKeyboard) mInputView.getKeyboard()).setPreferredLetters(null);
|
((LatinKeyboard) inputView.getKeyboard()).setPreferredLetters(null);
|
||||||
setNextSuggestions();
|
setNextSuggestions();
|
||||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||||
}
|
}
|
||||||
|
@ -1674,7 +1686,7 @@ public class LatinIME extends InputMethodService
|
||||||
ClipboardManager cm = ((ClipboardManager)getSystemService(CLIPBOARD_SERVICE));
|
ClipboardManager cm = ((ClipboardManager)getSystemService(CLIPBOARD_SERVICE));
|
||||||
CharSequence text = cm.getText();
|
CharSequence text = cm.getText();
|
||||||
if (!TextUtils.isEmpty(text)) {
|
if (!TextUtils.isEmpty(text)) {
|
||||||
mInputView.startPlaying(text.toString());
|
mKeyboardSwitcher.getInputView().startPlaying(text.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1725,7 +1737,7 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
public void onRelease(int primaryCode) {
|
public void onRelease(int primaryCode) {
|
||||||
// Reset any drag flags in the keyboard
|
// Reset any drag flags in the keyboard
|
||||||
((LatinKeyboard) mInputView.getKeyboard()).keyReleased();
|
((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).keyReleased();
|
||||||
//vibrate();
|
//vibrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1777,7 +1789,7 @@ public class LatinIME extends InputMethodService
|
||||||
// if mAudioManager is null, we don't have the ringer state yet
|
// if mAudioManager is null, we don't have the ringer state yet
|
||||||
// mAudioManager will be set by updateRingerMode
|
// mAudioManager will be set by updateRingerMode
|
||||||
if (mAudioManager == null) {
|
if (mAudioManager == null) {
|
||||||
if (mInputView != null) {
|
if (mKeyboardSwitcher.getInputView() != null) {
|
||||||
updateRingerMode();
|
updateRingerMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1804,8 +1816,9 @@ public class LatinIME extends InputMethodService
|
||||||
if (!mVibrateOn) {
|
if (!mVibrateOn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mInputView != null) {
|
if (mKeyboardSwitcher.getInputView() != null) {
|
||||||
mInputView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP,
|
mKeyboardSwitcher.getInputView().performHapticFeedback(
|
||||||
|
HapticFeedbackConstants.KEYBOARD_TAP,
|
||||||
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1956,7 +1969,7 @@ public class LatinIME extends InputMethodService
|
||||||
mOptionsDialog = builder.create();
|
mOptionsDialog = builder.create();
|
||||||
Window window = mOptionsDialog.getWindow();
|
Window window = mOptionsDialog.getWindow();
|
||||||
WindowManager.LayoutParams lp = window.getAttributes();
|
WindowManager.LayoutParams lp = window.getAttributes();
|
||||||
lp.token = mInputView.getWindowToken();
|
lp.token = mKeyboardSwitcher.getInputView().getWindowToken();
|
||||||
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
||||||
window.setAttributes(lp);
|
window.setAttributes(lp);
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||||
|
@ -1966,7 +1979,8 @@ public class LatinIME extends InputMethodService
|
||||||
private void changeKeyboardMode() {
|
private void changeKeyboardMode() {
|
||||||
mKeyboardSwitcher.toggleSymbols();
|
mKeyboardSwitcher.toggleSymbols();
|
||||||
if (mCapsLock && mKeyboardSwitcher.isAlphabetMode()) {
|
if (mCapsLock && mKeyboardSwitcher.isAlphabetMode()) {
|
||||||
((LatinKeyboard) mInputView.getKeyboard()).setShiftLocked(mCapsLock);
|
((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).setShiftLocked(
|
||||||
|
mCapsLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||||
|
|