am 02b8d91b: am 7e1f5a2d: Make sure to set symbol keyboard shifted
Merge commit '02b8d91b2dbe4290d4b09d93a22efbc5552326db' * commit '02b8d91b2dbe4290d4b09d93a22efbc5552326db': Make sure to set symbol keyboard shiftedmain
commit
e56e2d85df
|
@ -23,9 +23,9 @@ import android.preference.PreferenceManager;
|
||||||
import android.view.InflateException;
|
import android.view.InflateException;
|
||||||
|
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
private KeyboardId mSymbolsShiftedId;
|
private KeyboardId mSymbolsShiftedId;
|
||||||
|
|
||||||
private KeyboardId mCurrentId;
|
private KeyboardId mCurrentId;
|
||||||
private final Map<KeyboardId, SoftReference<LatinKeyboard>> mKeyboards;
|
private final HashMap<KeyboardId, SoftReference<LatinKeyboard>> mKeyboards;
|
||||||
|
|
||||||
private int mMode = MODE_NONE; /** One of the MODE_XXX values */
|
private int mMode = MODE_NONE; /** One of the MODE_XXX values */
|
||||||
private int mImeOptions;
|
private int mImeOptions;
|
||||||
|
@ -194,11 +194,17 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
public final boolean mEnableShiftLock;
|
public final boolean mEnableShiftLock;
|
||||||
public final boolean mHasVoice;
|
public final boolean mHasVoice;
|
||||||
|
|
||||||
|
private final int mHashCode;
|
||||||
|
|
||||||
public KeyboardId(int xml, int mode, boolean enableShiftLock, boolean hasVoice) {
|
public KeyboardId(int xml, int mode, boolean enableShiftLock, boolean hasVoice) {
|
||||||
this.mXml = xml;
|
this.mXml = xml;
|
||||||
this.mKeyboardMode = mode;
|
this.mKeyboardMode = mode;
|
||||||
this.mEnableShiftLock = enableShiftLock;
|
this.mEnableShiftLock = enableShiftLock;
|
||||||
this.mHasVoice = hasVoice;
|
this.mHasVoice = hasVoice;
|
||||||
|
|
||||||
|
this.mHashCode = Arrays.hashCode(new Object[] {
|
||||||
|
xml, mode, enableShiftLock, hasVoice
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyboardId(int xml, boolean hasVoice) {
|
public KeyboardId(int xml, boolean hasVoice) {
|
||||||
|
@ -219,8 +225,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (mXml + 1) * (mKeyboardMode + 1) * (mEnableShiftLock ? 2 : 1)
|
return mHashCode;
|
||||||
* (mHasVoice ? 4 : 8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +383,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleShift() {
|
public void toggleShift() {
|
||||||
if (mCurrentId.equals(mSymbolsId)) {
|
if (isAlphabetMode())
|
||||||
|
return;
|
||||||
|
if (mCurrentId.equals(mSymbolsId) || !mCurrentId.equals(mSymbolsShiftedId)) {
|
||||||
LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
|
LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
|
||||||
mCurrentId = mSymbolsShiftedId;
|
mCurrentId = mSymbolsShiftedId;
|
||||||
mInputView.setKeyboard(symbolsShiftedKeyboard);
|
mInputView.setKeyboard(symbolsShiftedKeyboard);
|
||||||
|
@ -390,7 +397,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
symbolsShiftedKeyboard.setShiftLocked(true);
|
symbolsShiftedKeyboard.setShiftLocked(true);
|
||||||
symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(),
|
symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(),
|
||||||
mMode, mImeOptions);
|
mMode, mImeOptions);
|
||||||
} else if (mCurrentId.equals(mSymbolsShiftedId)) {
|
} else {
|
||||||
LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
|
LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
|
||||||
mCurrentId = mSymbolsId;
|
mCurrentId = mSymbolsId;
|
||||||
mInputView.setKeyboard(symbolsKeyboard);
|
mInputView.setKeyboard(symbolsKeyboard);
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class LatinIME extends InputMethodService
|
||||||
private AlertDialog mOptionsDialog;
|
private AlertDialog mOptionsDialog;
|
||||||
private AlertDialog mVoiceWarningDialog;
|
private AlertDialog mVoiceWarningDialog;
|
||||||
|
|
||||||
KeyboardSwitcher mKeyboardSwitcher;
|
/* package */ KeyboardSwitcher mKeyboardSwitcher;
|
||||||
|
|
||||||
private UserDictionary mUserDictionary;
|
private UserDictionary mUserDictionary;
|
||||||
private UserBigramDictionary mUserBigramDictionary;
|
private UserBigramDictionary mUserBigramDictionary;
|
||||||
|
@ -168,7 +168,7 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
private Hints mHints;
|
private Hints mHints;
|
||||||
|
|
||||||
Resources mResources;
|
private Resources mResources;
|
||||||
|
|
||||||
private String mInputLocale;
|
private String mInputLocale;
|
||||||
private String mSystemLocale;
|
private String mSystemLocale;
|
||||||
|
@ -306,7 +306,7 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler mHandler = new Handler() {
|
/* package */ Handler mHandler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
|
@ -338,7 +338,8 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override public void onCreate() {
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
LatinImeLogger.init(this);
|
LatinImeLogger.init(this);
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
//setStatusIcon(R.drawable.ime_qwerty);
|
//setStatusIcon(R.drawable.ime_qwerty);
|
||||||
|
@ -395,7 +396,7 @@ public class LatinIME extends InputMethodService
|
||||||
* Loads a dictionary or multiple separated dictionary
|
* Loads a dictionary or multiple separated dictionary
|
||||||
* @return returns array of dictionary resource ids
|
* @return returns array of dictionary resource ids
|
||||||
*/
|
*/
|
||||||
static int[] getDictionary(Resources res) {
|
/* package */ static int[] getDictionary(Resources res) {
|
||||||
String packageName = LatinIME.class.getPackage().getName();
|
String packageName = LatinIME.class.getPackage().getName();
|
||||||
XmlResourceParser xrp = res.getXml(R.xml.dictionary);
|
XmlResourceParser xrp = res.getXml(R.xml.dictionary);
|
||||||
ArrayList<Integer> dictionaries = new ArrayList<Integer>();
|
ArrayList<Integer> dictionaries = new ArrayList<Integer>();
|
||||||
|
@ -1013,9 +1014,6 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reloadKeyboards() {
|
private void reloadKeyboards() {
|
||||||
if (mKeyboardSwitcher == null) {
|
|
||||||
mKeyboardSwitcher = new KeyboardSwitcher(this);
|
|
||||||
}
|
|
||||||
mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher);
|
mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher);
|
||||||
if (mKeyboardSwitcher.getInputView() != null
|
if (mKeyboardSwitcher.getInputView() != null
|
||||||
&& mKeyboardSwitcher.getKeyboardMode() != KeyboardSwitcher.MODE_NONE) {
|
&& mKeyboardSwitcher.getKeyboardMode() != KeyboardSwitcher.MODE_NONE) {
|
||||||
|
@ -2406,20 +2404,20 @@ public class LatinIME extends InputMethodService
|
||||||
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_START_TUTORIAL), 500);
|
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_START_TUTORIAL), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tutorialDone() {
|
/* package */ void tutorialDone() {
|
||||||
mTutorial = null;
|
mTutorial = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void promoteToUserDictionary(String word, int frequency) {
|
/* package */ void promoteToUserDictionary(String word, int frequency) {
|
||||||
if (mUserDictionary.isValidWord(word)) return;
|
if (mUserDictionary.isValidWord(word)) return;
|
||||||
mUserDictionary.addWord(word, frequency);
|
mUserDictionary.addWord(word, frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
WordComposer getCurrentWord() {
|
/* package */ WordComposer getCurrentWord() {
|
||||||
return mWord;
|
return mWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean getPopupOn() {
|
/* package */ boolean getPopupOn() {
|
||||||
return mPopupOn;
|
return mPopupOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2624,7 +2622,8 @@ public class LatinIME extends InputMethodService
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
|
@Override
|
||||||
|
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
|
||||||
super.dump(fd, fout, args);
|
super.dump(fd, fout, args);
|
||||||
|
|
||||||
final Printer p = new PrintWriterPrinter(fout);
|
final Printer p = new PrintWriterPrinter(fout);
|
||||||
|
|
|
@ -47,10 +47,9 @@ import android.widget.PopupWindow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A view that renders a virtual {@link LatinKeyboard}. It handles rendering of keys and
|
* A view that renders a virtual {@link LatinKeyboard}. It handles rendering of keys and
|
||||||
|
@ -199,7 +198,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
private PopupWindow mMiniKeyboardPopup;
|
private PopupWindow mMiniKeyboardPopup;
|
||||||
private LatinKeyboardBaseView mMiniKeyboard;
|
private LatinKeyboardBaseView mMiniKeyboard;
|
||||||
private View mMiniKeyboardParent;
|
private View mMiniKeyboardParent;
|
||||||
private Map<Key,View> mMiniKeyboardCache;
|
private final WeakHashMap<Key, View> mMiniKeyboardCache = new WeakHashMap<Key, View>();
|
||||||
private int mMiniKeyboardOriginX;
|
private int mMiniKeyboardOriginX;
|
||||||
private int mMiniKeyboardOriginY;
|
private int mMiniKeyboardOriginY;
|
||||||
private long mMiniKeyboardPopupTime;
|
private long mMiniKeyboardPopupTime;
|
||||||
|
@ -489,7 +488,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
mPaint.setAlpha(255);
|
mPaint.setAlpha(255);
|
||||||
|
|
||||||
mPadding = new Rect(0, 0, 0, 0);
|
mPadding = new Rect(0, 0, 0, 0);
|
||||||
mMiniKeyboardCache = new HashMap<Key,View>();
|
|
||||||
mKeyBackground.getPadding(mPadding);
|
mKeyBackground.getPadding(mPadding);
|
||||||
|
|
||||||
mSwipeThreshold = (int) (500 * res.getDisplayMetrics().density);
|
mSwipeThreshold = (int) (500 * res.getDisplayMetrics().density);
|
||||||
|
|
Loading…
Reference in New Issue