Add "force non-distinct multitouch" debug option
Change-Id: I9fd6fabf03515011cedb8aaa30fdb7a77f2d4d12main
parent
610a7d904e
commit
06b7c256b1
|
@ -120,6 +120,7 @@
|
||||||
<!-- Title for Latin keyboard debug settings activity / dialog -->
|
<!-- Title for Latin keyboard debug settings activity / dialog -->
|
||||||
<string name="english_ime_debug_settings">Android keyboard Debug settings</string>
|
<string name="english_ime_debug_settings">Android keyboard Debug settings</string>
|
||||||
<string name="prefs_debug_mode">Debug Mode</string>
|
<string name="prefs_debug_mode">Debug Mode</string>
|
||||||
|
<string name="prefs_force_non_distinct_multitouch">Force non-distinct multitouch</string>
|
||||||
|
|
||||||
<!-- Keyboard theme names -->
|
<!-- Keyboard theme names -->
|
||||||
<string name="layout_basic">Basic</string>
|
<string name="layout_basic">Basic</string>
|
||||||
|
|
|
@ -42,4 +42,10 @@
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="force_non_distinct_multitouch"
|
||||||
|
android:title="@string/prefs_force_non_distinct_multitouch"
|
||||||
|
android:persistent="true"
|
||||||
|
android:defaultValue="false"
|
||||||
|
/>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -28,6 +28,7 @@ import android.view.inputmethod.EditorInfo;
|
||||||
|
|
||||||
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
|
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
|
||||||
import com.android.inputmethod.keyboard.internal.KeyboardState;
|
import com.android.inputmethod.keyboard.internal.KeyboardState;
|
||||||
|
import com.android.inputmethod.latin.DebugSettings;
|
||||||
import com.android.inputmethod.latin.InputView;
|
import com.android.inputmethod.latin.InputView;
|
||||||
import com.android.inputmethod.latin.LatinIME;
|
import com.android.inputmethod.latin.LatinIME;
|
||||||
import com.android.inputmethod.latin.LatinImeLogger;
|
import com.android.inputmethod.latin.LatinImeLogger;
|
||||||
|
@ -53,6 +54,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
|
||||||
|
|
||||||
private SubtypeSwitcher mSubtypeSwitcher;
|
private SubtypeSwitcher mSubtypeSwitcher;
|
||||||
private SharedPreferences mPrefs;
|
private SharedPreferences mPrefs;
|
||||||
|
private boolean mForceNonDistinctMultitouch;
|
||||||
|
|
||||||
private InputView mCurrentInputView;
|
private InputView mCurrentInputView;
|
||||||
private LatinKeyboardView mKeyboardView;
|
private LatinKeyboardView mKeyboardView;
|
||||||
|
@ -92,6 +94,8 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
|
||||||
mState = new KeyboardState(this);
|
mState = new KeyboardState(this);
|
||||||
setContextThemeWrapper(ims, getKeyboardThemeIndex(ims, prefs));
|
setContextThemeWrapper(ims, getKeyboardThemeIndex(ims, prefs));
|
||||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
mForceNonDistinctMultitouch = prefs.getBoolean(
|
||||||
|
DebugSettings.FORCE_NON_DISTINCT_MULTITOUCH_KEY, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getKeyboardThemeIndex(Context context, SharedPreferences prefs) {
|
private static int getKeyboardThemeIndex(Context context, SharedPreferences prefs) {
|
||||||
|
@ -391,6 +395,9 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
|
||||||
|
|
||||||
mKeyboardView = (LatinKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
|
mKeyboardView = (LatinKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
|
||||||
mKeyboardView.setKeyboardActionListener(mInputMethodService);
|
mKeyboardView.setKeyboardActionListener(mInputMethodService);
|
||||||
|
if (mForceNonDistinctMultitouch) {
|
||||||
|
mKeyboardView.setDistinctMultitouch(false);
|
||||||
|
}
|
||||||
|
|
||||||
// This always needs to be set since the accessibility state can
|
// This always needs to be set since the accessibility state can
|
||||||
// potentially change without the input view being re-created.
|
// potentially change without the input view being re-created.
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
/** Listener for {@link KeyboardActionListener}. */
|
/** Listener for {@link KeyboardActionListener}. */
|
||||||
private KeyboardActionListener mKeyboardActionListener;
|
private KeyboardActionListener mKeyboardActionListener;
|
||||||
|
|
||||||
private final boolean mHasDistinctMultitouch;
|
private boolean mHasDistinctMultitouch;
|
||||||
private int mOldPointerCount = 1;
|
private int mOldPointerCount = 1;
|
||||||
private Key mOldKey;
|
private Key mOldKey;
|
||||||
|
|
||||||
|
@ -371,6 +371,10 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
return mHasDistinctMultitouch;
|
return mHasDistinctMultitouch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDistinctMultitouch(boolean hasDistinctMultitouch) {
|
||||||
|
mHasDistinctMultitouch = hasDistinctMultitouch;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When enabled, calls to {@link KeyboardActionListener#onCodeInput} will include key
|
* When enabled, calls to {@link KeyboardActionListener#onCodeInput} will include key
|
||||||
* codes for adjacent keys. When disabled, only the primary key code will be
|
* codes for adjacent keys. When disabled, only the primary key code will be
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class DebugSettings extends PreferenceActivity
|
||||||
|
|
||||||
private static final String TAG = "DebugSettings";
|
private static final String TAG = "DebugSettings";
|
||||||
private static final String DEBUG_MODE_KEY = "debug_mode";
|
private static final String DEBUG_MODE_KEY = "debug_mode";
|
||||||
|
public static final String FORCE_NON_DISTINCT_MULTITOUCH_KEY = "force_non_distinct_multitouch";
|
||||||
|
|
||||||
private boolean mServiceNeedsRestart = false;
|
private boolean mServiceNeedsRestart = false;
|
||||||
private CheckBoxPreference mDebugMode;
|
private CheckBoxPreference mDebugMode;
|
||||||
|
@ -60,6 +61,8 @@ public class DebugSettings extends PreferenceActivity
|
||||||
updateDebugMode();
|
updateDebugMode();
|
||||||
mServiceNeedsRestart = true;
|
mServiceNeedsRestart = true;
|
||||||
}
|
}
|
||||||
|
} else if (key.equals(FORCE_NON_DISTINCT_MULTITOUCH_KEY)) {
|
||||||
|
mServiceNeedsRestart = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue