mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
add pref for hiding language key
This commit is contained in:
parent
067a8bf190
commit
6c6c24ca84
56 changed files with 196 additions and 312 deletions
|
@ -48,7 +48,7 @@
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:defaultToDeviceProtectedStorage="true"
|
android:defaultToDeviceProtectedStorage="true"
|
||||||
android:directBootAware="true"
|
android:directBootAware="true"
|
||||||
android:extractNativeLibs="false">
|
android:extractNativeLibs="false">
|
||||||
|
|
||||||
<!-- Services -->
|
<!-- Services -->
|
||||||
<service android:name="LatinIME"
|
<service android:name="LatinIME"
|
||||||
|
|
|
@ -178,7 +178,7 @@ class AccessibilityUtils private constructor() {
|
||||||
private val TAG = AccessibilityUtils::class.java.simpleName
|
private val TAG = AccessibilityUtils::class.java.simpleName
|
||||||
private val CLASS = AccessibilityUtils::class.java.name
|
private val CLASS = AccessibilityUtils::class.java.name
|
||||||
private val PACKAGE = AccessibilityUtils::class.java.getPackage()!!.name
|
private val PACKAGE = AccessibilityUtils::class.java.getPackage()!!.name
|
||||||
public val instance = AccessibilityUtils()
|
val instance = AccessibilityUtils()
|
||||||
/*
|
/*
|
||||||
* Setting this constant to {@code false} will disable all keyboard
|
* Setting this constant to {@code false} will disable all keyboard
|
||||||
* accessibility code, regardless of whether Accessibility is turned on in
|
* accessibility code, regardless of whether Accessibility is turned on in
|
||||||
|
|
|
@ -145,7 +145,7 @@ open class KeyboardAccessibilityDelegate<KV : KeyboardView?>(protected val mKeyb
|
||||||
if (DEBUG_HOVER) {
|
if (DEBUG_HOVER) {
|
||||||
Log.d(TAG, "onHoverEnter: key=$key")
|
Log.d(TAG, "onHoverEnter: key=$key")
|
||||||
}
|
}
|
||||||
key?.let { onHoverEnterTo(it) }
|
key.let { onHoverEnterTo(it) }
|
||||||
mLastHoverKey = key
|
mLastHoverKey = key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,9 +159,9 @@ open class KeyboardAccessibilityDelegate<KV : KeyboardView?>(protected val mKeyb
|
||||||
val key = getHoverKeyOf(event)
|
val key = getHoverKeyOf(event)
|
||||||
if (key !== lastKey) {
|
if (key !== lastKey) {
|
||||||
lastKey?.let { onHoverExitFrom(it) }
|
lastKey?.let { onHoverExitFrom(it) }
|
||||||
key?.let { onHoverEnterTo(it) }
|
key.let { onHoverEnterTo(it) }
|
||||||
}
|
}
|
||||||
key?.let { onHoverMoveWithin(it) }
|
key.let { onHoverMoveWithin(it) }
|
||||||
mLastHoverKey = key
|
mLastHoverKey = key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,7 @@ class MainKeyboardAccessibilityDelegate(mainKeyboardView: MainKeyboardView,
|
||||||
val codePointOfNoPanelAutoMoreKey = key.moreKeys!![0].mCode
|
val codePointOfNoPanelAutoMoreKey = key.moreKeys!![0].mCode
|
||||||
val text: String = KeyCodeDescriptionMapper.instance.getDescriptionForCodePoint(
|
val text: String = KeyCodeDescriptionMapper.instance.getDescriptionForCodePoint(
|
||||||
mKeyboardView!!.context, codePointOfNoPanelAutoMoreKey)!!
|
mKeyboardView!!.context, codePointOfNoPanelAutoMoreKey)!!
|
||||||
text?.let { sendWindowStateChanged(it) }
|
text.let { sendWindowStateChanged(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,33 +12,13 @@ import org.dslul.openboard.inputmethod.latin.common.LocaleUtils
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
object InputMethodSubtypeCompatUtils {
|
object InputMethodSubtypeCompatUtils {
|
||||||
private val TAG = InputMethodSubtypeCompatUtils::class.java.simpleName
|
|
||||||
// Note that InputMethodSubtype(int nameId, int iconId, String locale, String mode,
|
|
||||||
// String extraValue, boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype, int id)
|
|
||||||
// has been introduced in API level 17 (Build.VERSION_CODE.JELLY_BEAN_MR1).
|
|
||||||
private val CONSTRUCTOR_INPUT_METHOD_SUBTYPE = CompatUtils.getConstructor(InputMethodSubtype::class.java,
|
|
||||||
Int::class.javaPrimitiveType, Int::class.javaPrimitiveType, String::class.java, String::class.java, String::class.java, Boolean::class.javaPrimitiveType,
|
|
||||||
Boolean::class.javaPrimitiveType, Int::class.javaPrimitiveType)
|
|
||||||
|
|
||||||
@kotlin.jvm.JvmStatic
|
|
||||||
fun newInputMethodSubtype(nameId: Int, iconId: Int, locale: String?,
|
|
||||||
mode: String?, extraValue: String?, isAuxiliary: Boolean,
|
|
||||||
overridesImplicitlyEnabledSubtype: Boolean, id: Int): InputMethodSubtype? {
|
|
||||||
return if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
|
|
||||||
InputMethodSubtype(nameId, iconId, locale, mode, extraValue, isAuxiliary,
|
|
||||||
overridesImplicitlyEnabledSubtype)
|
|
||||||
} else CompatUtils.newInstance(CONSTRUCTOR_INPUT_METHOD_SUBTYPE,
|
|
||||||
nameId, iconId, locale, mode, extraValue, isAuxiliary,
|
|
||||||
overridesImplicitlyEnabledSubtype, id) as InputMethodSubtype
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note that InputMethodSubtype.getLanguageTag() is expected to be available in Android N+.
|
// Note that InputMethodSubtype.getLanguageTag() is expected to be available in Android N+.
|
||||||
private val GET_LANGUAGE_TAG = CompatUtils.getMethod(InputMethodSubtype::class.java, "getLanguageTag")
|
private val GET_LANGUAGE_TAG = CompatUtils.getMethod(InputMethodSubtype::class.java, "getLanguageTag")
|
||||||
|
|
||||||
@kotlin.jvm.JvmStatic
|
@kotlin.jvm.JvmStatic
|
||||||
fun getLocaleObject(subtype: InputMethodSubtype): Locale { // Locale.forLanguageTag() is available only in Android L and later.
|
fun getLocaleObject(subtype: InputMethodSubtype): Locale { // Locale.forLanguageTag() is available only in Android L and later.
|
||||||
if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
|
||||||
val languageTag = CompatUtils.invoke(subtype, null, GET_LANGUAGE_TAG) as String
|
val languageTag = CompatUtils.invoke(subtype, null, GET_LANGUAGE_TAG) as String?
|
||||||
if (!TextUtils.isEmpty(languageTag)) {
|
if (!TextUtils.isEmpty(languageTag)) {
|
||||||
return Locale.forLanguageTag(languageTag)
|
return Locale.forLanguageTag(languageTag)
|
||||||
}
|
}
|
||||||
|
@ -46,9 +26,4 @@ object InputMethodSubtypeCompatUtils {
|
||||||
return LocaleUtils.constructLocaleFromString(subtype.locale)
|
return LocaleUtils.constructLocaleFromString(subtype.locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
|
|
||||||
Log.w(TAG, "Warning!!! Constructor is not defined.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -35,53 +35,6 @@ object SuggestionSpanUtils {
|
||||||
return spannable
|
return spannable
|
||||||
}
|
}
|
||||||
|
|
||||||
@UsedForTesting
|
|
||||||
fun getTextWithSuggestionSpan(context: Context?,
|
|
||||||
pickedWord: String, suggestedWords: SuggestedWords, locale: Locale?): CharSequence {
|
|
||||||
if (TextUtils.isEmpty(pickedWord) || suggestedWords.isEmpty
|
|
||||||
|| suggestedWords.isPrediction || suggestedWords.isPunctuationSuggestions) {
|
|
||||||
return pickedWord
|
|
||||||
}
|
|
||||||
val suggestionsList = ArrayList<String>()
|
|
||||||
for (i in 0 until suggestedWords.size()) {
|
|
||||||
if (suggestionsList.size >= SuggestionSpan.SUGGESTIONS_MAX_SIZE) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
val info = suggestedWords.getInfo(i)
|
|
||||||
if (info.isKindOf(SuggestedWordInfo.KIND_PREDICTION)) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
val word = suggestedWords.getWord(i)
|
|
||||||
if (!TextUtils.equals(pickedWord, word)) {
|
|
||||||
suggestionsList.add(word.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val suggestionSpan = SuggestionSpan(context, locale,
|
|
||||||
suggestionsList.toTypedArray(), 0 /* flags */, null)
|
|
||||||
val spannable: Spannable = SpannableString(pickedWord)
|
|
||||||
spannable.setSpan(suggestionSpan, 0, pickedWord.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
|
||||||
return spannable
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns first [Locale] found in the given array of [SuggestionSpan].
|
|
||||||
* @param suggestionSpans the array of [SuggestionSpan] to be examined.
|
|
||||||
* @return the first [Locale] found in `suggestionSpans`. `null` when not
|
|
||||||
* found.
|
|
||||||
*/
|
|
||||||
@UsedForTesting
|
|
||||||
fun findFirstLocaleFromSuggestionSpans(
|
|
||||||
suggestionSpans: Array<SuggestionSpan>): Locale? {
|
|
||||||
for (suggestionSpan in suggestionSpans) {
|
|
||||||
val localeString = suggestionSpan.locale
|
|
||||||
if (TextUtils.isEmpty(localeString)) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return LocaleUtils.constructLocaleFromString(localeString)
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (DebugFlags.DEBUG_ENABLED) {
|
if (DebugFlags.DEBUG_ENABLED) {
|
||||||
if (OBJ_FLAG_AUTO_CORRECTION == null) {
|
if (OBJ_FLAG_AUTO_CORRECTION == null) {
|
||||||
|
|
|
@ -34,7 +34,6 @@ object UserManagerCompatUtils {
|
||||||
val userManager = context.getSystemService(UserManager::class.java)
|
val userManager = context.getSystemService(UserManager::class.java)
|
||||||
?: return LOCK_STATE_UNKNOWN
|
?: return LOCK_STATE_UNKNOWN
|
||||||
val result = CompatUtils.invoke(userManager, null, METHOD_isUserUnlocked) as Boolean
|
val result = CompatUtils.invoke(userManager, null, METHOD_isUserUnlocked) as Boolean
|
||||||
?: return LOCK_STATE_UNKNOWN
|
|
||||||
return if (result) LOCK_STATE_UNLOCKED else LOCK_STATE_LOCKED
|
return if (result) LOCK_STATE_UNLOCKED else LOCK_STATE_LOCKED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public interface KeyboardActionListener {
|
||||||
* @param repeatCount how many times the key was repeated. Zero if it is the first press.
|
* @param repeatCount how many times the key was repeated. Zero if it is the first press.
|
||||||
* @param isSinglePointer true if pressing has occurred while no other key is being pressed.
|
* @param isSinglePointer true if pressing has occurred while no other key is being pressed.
|
||||||
*/
|
*/
|
||||||
public void onPressKey(int primaryCode, int repeatCount, boolean isSinglePointer);
|
void onPressKey(int primaryCode, int repeatCount, boolean isSinglePointer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the user releases a key. This is sent after the {@link #onCodeInput} is called.
|
* Called when the user releases a key. This is sent after the {@link #onCodeInput} is called.
|
||||||
|
@ -39,7 +39,7 @@ public interface KeyboardActionListener {
|
||||||
* @param withSliding true if releasing has occurred because the user slid finger from the key
|
* @param withSliding true if releasing has occurred because the user slid finger from the key
|
||||||
* to other key without releasing the finger.
|
* to other key without releasing the finger.
|
||||||
*/
|
*/
|
||||||
public void onReleaseKey(int primaryCode, boolean withSliding);
|
void onReleaseKey(int primaryCode, boolean withSliding);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a key code to the listener.
|
* Send a key code to the listener.
|
||||||
|
@ -56,57 +56,57 @@ public interface KeyboardActionListener {
|
||||||
* @param isKeyRepeat true if this is a key repeat, false otherwise
|
* @param isKeyRepeat true if this is a key repeat, false otherwise
|
||||||
*/
|
*/
|
||||||
// TODO: change this to send an Event object instead
|
// TODO: change this to send an Event object instead
|
||||||
public void onCodeInput(int primaryCode, int x, int y, boolean isKeyRepeat);
|
void onCodeInput(int primaryCode, int x, int y, boolean isKeyRepeat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a string of characters to the listener.
|
* Sends a string of characters to the listener.
|
||||||
*
|
*
|
||||||
* @param text the string of characters to be registered.
|
* @param text the string of characters to be registered.
|
||||||
*/
|
*/
|
||||||
public void onTextInput(String text);
|
void onTextInput(String text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when user started batch input.
|
* Called when user started batch input.
|
||||||
*/
|
*/
|
||||||
public void onStartBatchInput();
|
void onStartBatchInput();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the ongoing batch input points data.
|
* Sends the ongoing batch input points data.
|
||||||
* @param batchPointers the batch input points representing the user input
|
* @param batchPointers the batch input points representing the user input
|
||||||
*/
|
*/
|
||||||
public void onUpdateBatchInput(InputPointers batchPointers);
|
void onUpdateBatchInput(InputPointers batchPointers);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends the final batch input points data.
|
* Sends the final batch input points data.
|
||||||
*
|
*
|
||||||
* @param batchPointers the batch input points representing the user input
|
* @param batchPointers the batch input points representing the user input
|
||||||
*/
|
*/
|
||||||
public void onEndBatchInput(InputPointers batchPointers);
|
void onEndBatchInput(InputPointers batchPointers);
|
||||||
|
|
||||||
public void onCancelBatchInput();
|
void onCancelBatchInput();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when user released a finger outside any key.
|
* Called when user released a finger outside any key.
|
||||||
*/
|
*/
|
||||||
public void onCancelInput();
|
void onCancelInput();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when user finished sliding key input.
|
* Called when user finished sliding key input.
|
||||||
*/
|
*/
|
||||||
public void onFinishSlidingInput();
|
void onFinishSlidingInput();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a non-"code input" custom request to the listener.
|
* Send a non-"code input" custom request to the listener.
|
||||||
* @return true if the request has been consumed, false otherwise.
|
* @return true if the request has been consumed, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean onCustomRequest(int requestCode);
|
boolean onCustomRequest(int requestCode);
|
||||||
public void onMovePointer(int steps);
|
void onMovePointer(int steps);
|
||||||
public void onMoveDeletePointer(int steps);
|
void onMoveDeletePointer(int steps);
|
||||||
public void onUpWithDeletePointerActive();
|
void onUpWithDeletePointerActive();
|
||||||
|
|
||||||
public static final KeyboardActionListener EMPTY_LISTENER = new Adapter();
|
KeyboardActionListener EMPTY_LISTENER = new Adapter();
|
||||||
|
|
||||||
public static class Adapter implements KeyboardActionListener {
|
class Adapter implements KeyboardActionListener {
|
||||||
@Override
|
@Override
|
||||||
public void onPressKey(int primaryCode, int repeatCount, boolean isSinglePointer) {}
|
public void onPressKey(int primaryCode, int repeatCount, boolean isSinglePointer) {}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -462,10 +462,10 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate(
|
mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate(
|
||||||
R.layout.input_view, null);
|
R.layout.input_view, null);
|
||||||
mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame);
|
mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame);
|
||||||
mEmojiPalettesView = (EmojiPalettesView)mCurrentInputView.findViewById(
|
mEmojiPalettesView = mCurrentInputView.findViewById(
|
||||||
R.id.emoji_palettes_view);
|
R.id.emoji_palettes_view);
|
||||||
|
|
||||||
mKeyboardView = (MainKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
|
mKeyboardView = mCurrentInputView.findViewById(R.id.keyboard_view);
|
||||||
mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled);
|
mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled);
|
||||||
mKeyboardView.setKeyboardActionListener(mLatinIME);
|
mKeyboardView.setKeyboardActionListener(mLatinIME);
|
||||||
mEmojiPalettesView.setHardwareAcceleratedDrawingEnabled(
|
mEmojiPalettesView.setHardwareAcceleratedDrawingEnabled(
|
||||||
|
|
|
@ -450,7 +450,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
||||||
Log.w(TAG, "Cannot find root view");
|
Log.w(TAG, "Cannot find root view");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ViewGroup windowContentView = (ViewGroup)rootView.findViewById(android.R.id.content);
|
final ViewGroup windowContentView = rootView.findViewById(android.R.id.content);
|
||||||
// Note: It'd be very weird if we get null by android.R.id.content.
|
// Note: It'd be very weird if we get null by android.R.id.content.
|
||||||
if (windowContentView == null) {
|
if (windowContentView == null) {
|
||||||
Log.w(TAG, "Cannot find android.R.id.content view to add DrawingPreviewPlacerView");
|
Log.w(TAG, "Cannot find android.R.id.content view to add DrawingPreviewPlacerView");
|
||||||
|
@ -618,7 +618,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
||||||
final View container = key.isActionKey() ? mMoreKeysKeyboardForActionContainer
|
final View container = key.isActionKey() ? mMoreKeysKeyboardForActionContainer
|
||||||
: mMoreKeysKeyboardContainer;
|
: mMoreKeysKeyboardContainer;
|
||||||
final MoreKeysKeyboardView moreKeysKeyboardView =
|
final MoreKeysKeyboardView moreKeysKeyboardView =
|
||||||
(MoreKeysKeyboardView)container.findViewById(R.id.more_keys_keyboard_view);
|
container.findViewById(R.id.more_keys_keyboard_view);
|
||||||
moreKeysKeyboardView.setKeyboard(moreKeysKeyboard);
|
moreKeysKeyboardView.setKeyboard(moreKeysKeyboard);
|
||||||
container.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
container.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
|
||||||
|
|
|
@ -20,25 +20,25 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
public interface MoreKeysPanel {
|
public interface MoreKeysPanel {
|
||||||
public interface Controller {
|
interface Controller {
|
||||||
/**
|
/**
|
||||||
* Add the {@link MoreKeysPanel} to the target view.
|
* Add the {@link MoreKeysPanel} to the target view.
|
||||||
* @param panel the panel to be shown.
|
* @param panel the panel to be shown.
|
||||||
*/
|
*/
|
||||||
public void onShowMoreKeysPanel(final MoreKeysPanel panel);
|
void onShowMoreKeysPanel(final MoreKeysPanel panel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the current {@link MoreKeysPanel} from the target view.
|
* Remove the current {@link MoreKeysPanel} from the target view.
|
||||||
*/
|
*/
|
||||||
public void onDismissMoreKeysPanel();
|
void onDismissMoreKeysPanel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instructs the parent to cancel the panel (e.g., when entering a different input mode).
|
* Instructs the parent to cancel the panel (e.g., when entering a different input mode).
|
||||||
*/
|
*/
|
||||||
public void onCancelMoreKeysPanel();
|
void onCancelMoreKeysPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Controller EMPTY_CONTROLLER = new Controller() {
|
Controller EMPTY_CONTROLLER = new Controller() {
|
||||||
@Override
|
@Override
|
||||||
public void onShowMoreKeysPanel(final MoreKeysPanel panel) {}
|
public void onShowMoreKeysPanel(final MoreKeysPanel panel) {}
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,14 +60,14 @@ public interface MoreKeysPanel {
|
||||||
*/
|
*/
|
||||||
// TODO: Currently the MoreKeysPanel is inside a container view that is added to the parent.
|
// TODO: Currently the MoreKeysPanel is inside a container view that is added to the parent.
|
||||||
// Consider the simpler approach of placing the MoreKeysPanel itself into the parent view.
|
// Consider the simpler approach of placing the MoreKeysPanel itself into the parent view.
|
||||||
public void showMoreKeysPanel(View parentView, Controller controller, int pointX,
|
void showMoreKeysPanel(View parentView, Controller controller, int pointX,
|
||||||
int pointY, KeyboardActionListener listener);
|
int pointY, KeyboardActionListener listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dismisses the more keys panel and calls the controller's onDismissMoreKeysPanel to remove
|
* Dismisses the more keys panel and calls the controller's onDismissMoreKeysPanel to remove
|
||||||
* the panel's container view.
|
* the panel's container view.
|
||||||
*/
|
*/
|
||||||
public void dismissMoreKeysPanel();
|
void dismissMoreKeysPanel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a move event on the more keys panel.
|
* Process a move event on the more keys panel.
|
||||||
|
@ -77,7 +77,7 @@ public interface MoreKeysPanel {
|
||||||
* @param pointerId pointer id touch point
|
* @param pointerId pointer id touch point
|
||||||
* @param eventTime timestamp of touch point
|
* @param eventTime timestamp of touch point
|
||||||
*/
|
*/
|
||||||
public void onMoveEvent(final int x, final int y, final int pointerId, final long eventTime);
|
void onMoveEvent(final int x, final int y, final int pointerId, final long eventTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a down event on the more keys panel.
|
* Process a down event on the more keys panel.
|
||||||
|
@ -87,7 +87,7 @@ public interface MoreKeysPanel {
|
||||||
* @param pointerId pointer id touch point
|
* @param pointerId pointer id touch point
|
||||||
* @param eventTime timestamp of touch point
|
* @param eventTime timestamp of touch point
|
||||||
*/
|
*/
|
||||||
public void onDownEvent(final int x, final int y, final int pointerId, final long eventTime);
|
void onDownEvent(final int x, final int y, final int pointerId, final long eventTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process an up event on the more keys panel.
|
* Process an up event on the more keys panel.
|
||||||
|
@ -97,7 +97,7 @@ public interface MoreKeysPanel {
|
||||||
* @param pointerId pointer id touch point
|
* @param pointerId pointer id touch point
|
||||||
* @param eventTime timestamp of touch point
|
* @param eventTime timestamp of touch point
|
||||||
*/
|
*/
|
||||||
public void onUpEvent(final int x, final int y, final int pointerId, final long eventTime);
|
void onUpEvent(final int x, final int y, final int pointerId, final long eventTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translate X-coordinate of touch event to the local X-coordinate of this
|
* Translate X-coordinate of touch event to the local X-coordinate of this
|
||||||
|
@ -106,7 +106,7 @@ public interface MoreKeysPanel {
|
||||||
* @param x the global X-coordinate
|
* @param x the global X-coordinate
|
||||||
* @return the local X-coordinate to this {@link MoreKeysPanel}
|
* @return the local X-coordinate to this {@link MoreKeysPanel}
|
||||||
*/
|
*/
|
||||||
public int translateX(int x);
|
int translateX(int x);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translate Y-coordinate of touch event to the local Y-coordinate of this
|
* Translate Y-coordinate of touch event to the local Y-coordinate of this
|
||||||
|
@ -115,22 +115,22 @@ public interface MoreKeysPanel {
|
||||||
* @param y the global Y-coordinate
|
* @param y the global Y-coordinate
|
||||||
* @return the local Y-coordinate to this {@link MoreKeysPanel}
|
* @return the local Y-coordinate to this {@link MoreKeysPanel}
|
||||||
*/
|
*/
|
||||||
public int translateY(int y);
|
int translateY(int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show this {@link MoreKeysPanel} in the parent view.
|
* Show this {@link MoreKeysPanel} in the parent view.
|
||||||
*
|
*
|
||||||
* @param parentView the {@link ViewGroup} that hosts this {@link MoreKeysPanel}.
|
* @param parentView the {@link ViewGroup} that hosts this {@link MoreKeysPanel}.
|
||||||
*/
|
*/
|
||||||
public void showInParent(ViewGroup parentView);
|
void showInParent(ViewGroup parentView);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove this {@link MoreKeysPanel} from the parent view.
|
* Remove this {@link MoreKeysPanel} from the parent view.
|
||||||
*/
|
*/
|
||||||
public void removeFromParent();
|
void removeFromParent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether the panel is currently being shown.
|
* Return whether the panel is currently being shown.
|
||||||
*/
|
*/
|
||||||
public boolean isShowingInParent();
|
boolean isShowingInParent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ final class EmojiPageKeyboardView extends KeyboardView implements
|
||||||
private static final long KEY_RELEASE_DELAY_TIME = 30; // msec
|
private static final long KEY_RELEASE_DELAY_TIME = 30; // msec
|
||||||
|
|
||||||
public interface OnKeyEventListener {
|
public interface OnKeyEventListener {
|
||||||
public void onPressKey(Key key);
|
void onPressKey(Key key);
|
||||||
public void onReleaseKey(Key key);
|
void onReleaseKey(Key key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final OnKeyEventListener EMPTY_LISTENER = new OnKeyEventListener() {
|
private static final OnKeyEventListener EMPTY_LISTENER = new OnKeyEventListener() {
|
||||||
|
|
|
@ -163,7 +163,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
mTabHost = (TabHost)findViewById(R.id.emoji_category_tabhost);
|
mTabHost = findViewById(R.id.emoji_category_tabhost);
|
||||||
mTabHost.setup();
|
mTabHost.setup();
|
||||||
for (final EmojiCategory.CategoryProperties properties
|
for (final EmojiCategory.CategoryProperties properties
|
||||||
: mEmojiCategory.getShownCategories()) {
|
: mEmojiCategory.getShownCategories()) {
|
||||||
|
@ -182,7 +182,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
|
|
||||||
mEmojiPalettesAdapter = new EmojiPalettesAdapter(mEmojiCategory, this);
|
mEmojiPalettesAdapter = new EmojiPalettesAdapter(mEmojiCategory, this);
|
||||||
|
|
||||||
mEmojiPager = (ViewPager)findViewById(R.id.emoji_keyboard_pager);
|
mEmojiPager = findViewById(R.id.emoji_keyboard_pager);
|
||||||
mEmojiPager.setAdapter(mEmojiPalettesAdapter);
|
mEmojiPager.setAdapter(mEmojiPalettesAdapter);
|
||||||
mEmojiPager.setOnPageChangeListener(this);
|
mEmojiPager.setOnPageChangeListener(this);
|
||||||
mEmojiPager.setOffscreenPageLimit(0);
|
mEmojiPager.setOffscreenPageLimit(0);
|
||||||
|
@ -190,18 +190,18 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
mEmojiLayoutParams.setPagerProperties(mEmojiPager);
|
mEmojiLayoutParams.setPagerProperties(mEmojiPager);
|
||||||
|
|
||||||
mEmojiCategoryPageIndicatorView =
|
mEmojiCategoryPageIndicatorView =
|
||||||
(EmojiCategoryPageIndicatorView)findViewById(R.id.emoji_category_page_id_view);
|
findViewById(R.id.emoji_category_page_id_view);
|
||||||
mEmojiCategoryPageIndicatorView.setColors(
|
mEmojiCategoryPageIndicatorView.setColors(
|
||||||
mCategoryPageIndicatorColor, mCategoryPageIndicatorBackground);
|
mCategoryPageIndicatorColor, mCategoryPageIndicatorBackground);
|
||||||
mEmojiLayoutParams.setCategoryPageIdViewProperties(mEmojiCategoryPageIndicatorView);
|
mEmojiLayoutParams.setCategoryPageIdViewProperties(mEmojiCategoryPageIndicatorView);
|
||||||
|
|
||||||
setCurrentCategoryId(mEmojiCategory.getCurrentCategoryId(), true /* force */);
|
setCurrentCategoryId(mEmojiCategory.getCurrentCategoryId(), true /* force */);
|
||||||
|
|
||||||
final LinearLayout actionBar = (LinearLayout)findViewById(R.id.emoji_action_bar);
|
final LinearLayout actionBar = findViewById(R.id.emoji_action_bar);
|
||||||
mEmojiLayoutParams.setActionBarProperties(actionBar);
|
mEmojiLayoutParams.setActionBarProperties(actionBar);
|
||||||
|
|
||||||
// deleteKey depends only on OnTouchListener.
|
// deleteKey depends only on OnTouchListener.
|
||||||
mDeleteKey = (ImageButton)findViewById(R.id.emoji_keyboard_delete);
|
mDeleteKey = findViewById(R.id.emoji_keyboard_delete);
|
||||||
mDeleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
|
mDeleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
|
||||||
mDeleteKey.setTag(Constants.CODE_DELETE);
|
mDeleteKey.setTag(Constants.CODE_DELETE);
|
||||||
mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);
|
mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);
|
||||||
|
@ -213,12 +213,12 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
||||||
// if the event is canceled by moving off the finger from the view.
|
// if the event is canceled by moving off the finger from the view.
|
||||||
// The text on alphabet keys are set at
|
// The text on alphabet keys are set at
|
||||||
// {@link #startEmojiPalettes(String,int,float,Typeface)}.
|
// {@link #startEmojiPalettes(String,int,float,Typeface)}.
|
||||||
mAlphabetKeyLeft = (TextView)findViewById(R.id.emoji_keyboard_alphabet_left);
|
mAlphabetKeyLeft = findViewById(R.id.emoji_keyboard_alphabet_left);
|
||||||
mAlphabetKeyLeft.setBackgroundResource(mFunctionalKeyBackgroundId);
|
mAlphabetKeyLeft.setBackgroundResource(mFunctionalKeyBackgroundId);
|
||||||
mAlphabetKeyLeft.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
|
mAlphabetKeyLeft.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
|
||||||
mAlphabetKeyLeft.setOnTouchListener(this);
|
mAlphabetKeyLeft.setOnTouchListener(this);
|
||||||
mAlphabetKeyLeft.setOnClickListener(this);
|
mAlphabetKeyLeft.setOnClickListener(this);
|
||||||
mAlphabetKeyRight = (TextView)findViewById(R.id.emoji_keyboard_alphabet_right);
|
mAlphabetKeyRight = findViewById(R.id.emoji_keyboard_alphabet_right);
|
||||||
mAlphabetKeyRight.setBackgroundResource(mFunctionalKeyBackgroundId);
|
mAlphabetKeyRight.setBackgroundResource(mFunctionalKeyBackgroundId);
|
||||||
mAlphabetKeyRight.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
|
mAlphabetKeyRight.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
|
||||||
mAlphabetKeyRight.setOnTouchListener(this);
|
mAlphabetKeyRight.setOnTouchListener(this);
|
||||||
|
|
|
@ -27,11 +27,11 @@ import org.dslul.openboard.inputmethod.latin.common.InputPointers;
|
||||||
*/
|
*/
|
||||||
public class BatchInputArbiter {
|
public class BatchInputArbiter {
|
||||||
public interface BatchInputArbiterListener {
|
public interface BatchInputArbiterListener {
|
||||||
public void onStartBatchInput();
|
void onStartBatchInput();
|
||||||
public void onUpdateBatchInput(
|
void onUpdateBatchInput(
|
||||||
final InputPointers aggregatedPointers, final long moveEventTime);
|
final InputPointers aggregatedPointers, final long moveEventTime);
|
||||||
public void onStartUpdateBatchInputTimer();
|
void onStartUpdateBatchInputTimer();
|
||||||
public void onEndBatchInput(final InputPointers aggregatedPointers, final long upEventTime);
|
void onEndBatchInput(final InputPointers aggregatedPointers, final long upEventTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The starting time of the first stroke of a gesture input.
|
// The starting time of the first stroke of a gesture input.
|
||||||
|
|
|
@ -29,14 +29,14 @@ public interface DrawingProxy {
|
||||||
* @param key the {@link Key} that is being pressed.
|
* @param key the {@link Key} that is being pressed.
|
||||||
* @param withPreview true if key popup preview should be displayed.
|
* @param withPreview true if key popup preview should be displayed.
|
||||||
*/
|
*/
|
||||||
public void onKeyPressed(@Nonnull Key key, boolean withPreview);
|
void onKeyPressed(@Nonnull Key key, boolean withPreview);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a key is being released.
|
* Called when a key is being released.
|
||||||
* @param key the {@link Key} that is being released.
|
* @param key the {@link Key} that is being released.
|
||||||
* @param withAnimation when true, key popup preview should be dismissed with animation.
|
* @param withAnimation when true, key popup preview should be dismissed with animation.
|
||||||
*/
|
*/
|
||||||
public void onKeyReleased(@Nonnull Key key, boolean withAnimation);
|
void onKeyReleased(@Nonnull Key key, boolean withAnimation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start showing more keys keyboard of a key that is being long pressed.
|
* Start showing more keys keyboard of a key that is being long pressed.
|
||||||
|
@ -46,23 +46,23 @@ public interface DrawingProxy {
|
||||||
* keyboard.
|
* keyboard.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public MoreKeysPanel showMoreKeysKeyboard(@Nonnull Key key, @Nonnull PointerTracker tracker);
|
MoreKeysPanel showMoreKeysKeyboard(@Nonnull Key key, @Nonnull PointerTracker tracker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a while-typing-animation.
|
* Start a while-typing-animation.
|
||||||
* @param fadeInOrOut {@link #FADE_IN} starts while-typing-fade-in animation.
|
* @param fadeInOrOut {@link #FADE_IN} starts while-typing-fade-in animation.
|
||||||
* {@link #FADE_OUT} starts while-typing-fade-out animation.
|
* {@link #FADE_OUT} starts while-typing-fade-out animation.
|
||||||
*/
|
*/
|
||||||
public void startWhileTypingAnimation(int fadeInOrOut);
|
void startWhileTypingAnimation(int fadeInOrOut);
|
||||||
public static final int FADE_IN = 0;
|
int FADE_IN = 0;
|
||||||
public static final int FADE_OUT = 1;
|
int FADE_OUT = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show sliding-key input preview.
|
* Show sliding-key input preview.
|
||||||
* @param tracker the {@link PointerTracker} that is currently doing the sliding-key input.
|
* @param tracker the {@link PointerTracker} that is currently doing the sliding-key input.
|
||||||
* null to dismiss the sliding-key input preview.
|
* null to dismiss the sliding-key input preview.
|
||||||
*/
|
*/
|
||||||
public void showSlidingKeyInputPreview(@Nullable PointerTracker tracker);
|
void showSlidingKeyInputPreview(@Nullable PointerTracker tracker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show gesture trails.
|
* Show gesture trails.
|
||||||
|
@ -70,10 +70,10 @@ public interface DrawingProxy {
|
||||||
* @param showsFloatingPreviewText when true, a gesture floating preview text will be shown
|
* @param showsFloatingPreviewText when true, a gesture floating preview text will be shown
|
||||||
* with this <code>tracker</code>'s trail.
|
* with this <code>tracker</code>'s trail.
|
||||||
*/
|
*/
|
||||||
public void showGestureTrail(@Nonnull PointerTracker tracker, boolean showsFloatingPreviewText);
|
void showGestureTrail(@Nonnull PointerTracker tracker, boolean showsFloatingPreviewText);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dismiss a gesture floating preview text without delay.
|
* Dismiss a gesture floating preview text without delay.
|
||||||
*/
|
*/
|
||||||
public void dismissGestureFloatingPreviewTextWithoutDelay();
|
void dismissGestureFloatingPreviewTextWithoutDelay();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,10 +69,7 @@ public final class KeySpecParser {
|
||||||
}
|
}
|
||||||
// This is a workaround to have a key that has a supplementary code point. We can't put a
|
// This is a workaround to have a key that has a supplementary code point. We can't put a
|
||||||
// string in resource as a XML entity of a supplementary code point or a surrogate pair.
|
// string in resource as a XML entity of a supplementary code point or a surrogate pair.
|
||||||
if (keySpec.startsWith(PREFIX_HEX, labelEnd + 1)) {
|
return keySpec.startsWith(PREFIX_HEX, labelEnd + 1);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
|
|
@ -603,9 +603,9 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_CASE.equals(tag)) {
|
if (TAG_CASE.equals(tag)) {
|
||||||
selected |= parseCase(parser, row, selected ? true : skip);
|
selected |= parseCase(parser, row, selected || skip);
|
||||||
} else if (TAG_DEFAULT.equals(tag)) {
|
} else if (TAG_DEFAULT.equals(tag)) {
|
||||||
selected |= parseDefault(parser, row, selected ? true : skip);
|
selected |= parseDefault(parser, row, selected || skip);
|
||||||
} else {
|
} else {
|
||||||
throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_SWITCH);
|
throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_SWITCH);
|
||||||
}
|
}
|
||||||
|
@ -625,10 +625,10 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
final boolean selected = parseCaseCondition(parser);
|
final boolean selected = parseCaseCondition(parser);
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
// Processing Rows.
|
// Processing Rows.
|
||||||
parseKeyboardContent(parser, selected ? skip : true);
|
parseKeyboardContent(parser, !selected || skip);
|
||||||
} else {
|
} else {
|
||||||
// Processing Keys.
|
// Processing Keys.
|
||||||
parseRowContent(parser, row, selected ? skip : true);
|
parseRowContent(parser, row, !selected || skip);
|
||||||
}
|
}
|
||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,27 +42,27 @@ public final class KeyboardState {
|
||||||
private static final boolean DEBUG_INTERNAL_ACTION = false;
|
private static final boolean DEBUG_INTERNAL_ACTION = false;
|
||||||
|
|
||||||
public interface SwitchActions {
|
public interface SwitchActions {
|
||||||
public static final boolean DEBUG_ACTION = false;
|
boolean DEBUG_ACTION = false;
|
||||||
|
|
||||||
public void setAlphabetKeyboard();
|
void setAlphabetKeyboard();
|
||||||
public void setAlphabetManualShiftedKeyboard();
|
void setAlphabetManualShiftedKeyboard();
|
||||||
public void setAlphabetAutomaticShiftedKeyboard();
|
void setAlphabetAutomaticShiftedKeyboard();
|
||||||
public void setAlphabetShiftLockedKeyboard();
|
void setAlphabetShiftLockedKeyboard();
|
||||||
public void setAlphabetShiftLockShiftedKeyboard();
|
void setAlphabetShiftLockShiftedKeyboard();
|
||||||
public void setEmojiKeyboard();
|
void setEmojiKeyboard();
|
||||||
public void setSymbolsKeyboard();
|
void setSymbolsKeyboard();
|
||||||
public void setSymbolsShiftedKeyboard();
|
void setSymbolsShiftedKeyboard();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to call back {@link KeyboardState#onUpdateShiftState(int, int)}.
|
* Request to call back {@link KeyboardState#onUpdateShiftState(int, int)}.
|
||||||
*/
|
*/
|
||||||
public void requestUpdatingShiftState(final int autoCapsFlags, final int recapitalizeMode);
|
void requestUpdatingShiftState(final int autoCapsFlags, final int recapitalizeMode);
|
||||||
|
|
||||||
public static final boolean DEBUG_TIMER_ACTION = false;
|
boolean DEBUG_TIMER_ACTION = false;
|
||||||
|
|
||||||
public void startDoubleTapShiftKeyTimer();
|
void startDoubleTapShiftKeyTimer();
|
||||||
public boolean isInDoubleTapShiftKeyTimeout();
|
boolean isInDoubleTapShiftKeyTimeout();
|
||||||
public void cancelDoubleTapShiftKeyTimer();
|
void cancelDoubleTapShiftKeyTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final SwitchActions mSwitchActions;
|
private final SwitchActions mSwitchActions;
|
||||||
|
|
|
@ -139,10 +139,7 @@ public final class MoreKeySpec {
|
||||||
final int code = moreKey.mCode;
|
final int code = moreKey.mCode;
|
||||||
if (Character.isAlphabetic(code) && mCodes.indexOfKey(code) >= 0) {
|
if (Character.isAlphabetic(code) && mCodes.indexOfKey(code) >= 0) {
|
||||||
return true;
|
return true;
|
||||||
} else if (code == Constants.CODE_OUTPUT_TEXT && mTexts.contains(moreKey.mOutputText)) {
|
} else return code == Constants.CODE_OUTPUT_TEXT && mTexts.contains(moreKey.mOutputText);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,10 @@ public final class PointerTrackerQueue {
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
public interface Element {
|
public interface Element {
|
||||||
public boolean isModifier();
|
boolean isModifier();
|
||||||
public boolean isInDraggingFinger();
|
boolean isInDraggingFinger();
|
||||||
public void onPhantomUpEvent(long eventTime);
|
void onPhantomUpEvent(long eventTime);
|
||||||
public void cancelTrackingForAction();
|
void cancelTrackingForAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int INITIAL_CAPACITY = 10;
|
private static final int INITIAL_CAPACITY = 10;
|
||||||
|
|
|
@ -26,13 +26,13 @@ public interface TimerProxy {
|
||||||
* Start a timer to detect if a user is typing keys.
|
* Start a timer to detect if a user is typing keys.
|
||||||
* @param typedKey the key that is typed.
|
* @param typedKey the key that is typed.
|
||||||
*/
|
*/
|
||||||
public void startTypingStateTimer(@Nonnull Key typedKey);
|
void startTypingStateTimer(@Nonnull Key typedKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a user is key typing.
|
* Check if a user is key typing.
|
||||||
* @return true if a user is in typing.
|
* @return true if a user is in typing.
|
||||||
*/
|
*/
|
||||||
public boolean isTypingState();
|
boolean isTypingState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a timer to simulate repeated key presses while a user keep pressing a key.
|
* Start a timer to simulate repeated key presses while a user keep pressing a key.
|
||||||
|
@ -40,7 +40,7 @@ public interface TimerProxy {
|
||||||
* @param repeatCount the number of times that the key is repeating. Starting from 1.
|
* @param repeatCount the number of times that the key is repeating. Starting from 1.
|
||||||
* @param delay the interval delay to the next key repeat, in millisecond.
|
* @param delay the interval delay to the next key repeat, in millisecond.
|
||||||
*/
|
*/
|
||||||
public void startKeyRepeatTimerOf(@Nonnull PointerTracker tracker, int repeatCount, int delay);
|
void startKeyRepeatTimerOf(@Nonnull PointerTracker tracker, int repeatCount, int delay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a timer to detect a long pressed key.
|
* Start a timer to detect a long pressed key.
|
||||||
|
@ -49,59 +49,59 @@ public interface TimerProxy {
|
||||||
* @param tracker the {@link PointerTracker} that starts long pressing.
|
* @param tracker the {@link PointerTracker} that starts long pressing.
|
||||||
* @param delay the delay to fire the long press timer, in millisecond.
|
* @param delay the delay to fire the long press timer, in millisecond.
|
||||||
*/
|
*/
|
||||||
public void startLongPressTimerOf(@Nonnull PointerTracker tracker, int delay);
|
void startLongPressTimerOf(@Nonnull PointerTracker tracker, int delay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel timers for detecting a long pressed key and a long press shift key.
|
* Cancel timers for detecting a long pressed key and a long press shift key.
|
||||||
* @param tracker cancel long press timers of this {@link PointerTracker}.
|
* @param tracker cancel long press timers of this {@link PointerTracker}.
|
||||||
*/
|
*/
|
||||||
public void cancelLongPressTimersOf(@Nonnull PointerTracker tracker);
|
void cancelLongPressTimersOf(@Nonnull PointerTracker tracker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel a timer for detecting a long pressed shift key.
|
* Cancel a timer for detecting a long pressed shift key.
|
||||||
*/
|
*/
|
||||||
public void cancelLongPressShiftKeyTimer();
|
void cancelLongPressShiftKeyTimer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel timers for detecting repeated key press, long pressed key, and long pressed shift key.
|
* Cancel timers for detecting repeated key press, long pressed key, and long pressed shift key.
|
||||||
* @param tracker the {@link PointerTracker} that starts timers to be canceled.
|
* @param tracker the {@link PointerTracker} that starts timers to be canceled.
|
||||||
*/
|
*/
|
||||||
public void cancelKeyTimersOf(@Nonnull PointerTracker tracker);
|
void cancelKeyTimersOf(@Nonnull PointerTracker tracker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a timer to detect double tapped shift key.
|
* Start a timer to detect double tapped shift key.
|
||||||
*/
|
*/
|
||||||
public void startDoubleTapShiftKeyTimer();
|
void startDoubleTapShiftKeyTimer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel a timer of detecting double tapped shift key.
|
* Cancel a timer of detecting double tapped shift key.
|
||||||
*/
|
*/
|
||||||
public void cancelDoubleTapShiftKeyTimer();
|
void cancelDoubleTapShiftKeyTimer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a timer of detecting double tapped shift key is running.
|
* Check if a timer of detecting double tapped shift key is running.
|
||||||
* @return true if detecting double tapped shift key is on going.
|
* @return true if detecting double tapped shift key is on going.
|
||||||
*/
|
*/
|
||||||
public boolean isInDoubleTapShiftKeyTimeout();
|
boolean isInDoubleTapShiftKeyTimeout();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a timer to fire updating batch input while <code>tracker</code> is on hold.
|
* Start a timer to fire updating batch input while <code>tracker</code> is on hold.
|
||||||
* @param tracker the {@link PointerTracker} that stops moving.
|
* @param tracker the {@link PointerTracker} that stops moving.
|
||||||
*/
|
*/
|
||||||
public void startUpdateBatchInputTimer(@Nonnull PointerTracker tracker);
|
void startUpdateBatchInputTimer(@Nonnull PointerTracker tracker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel a timer of firing updating batch input.
|
* Cancel a timer of firing updating batch input.
|
||||||
* @param tracker the {@link PointerTracker} that resumes moving or ends gesture input.
|
* @param tracker the {@link PointerTracker} that resumes moving or ends gesture input.
|
||||||
*/
|
*/
|
||||||
public void cancelUpdateBatchInputTimer(@Nonnull PointerTracker tracker);
|
void cancelUpdateBatchInputTimer(@Nonnull PointerTracker tracker);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel all timers of firing updating batch input.
|
* Cancel all timers of firing updating batch input.
|
||||||
*/
|
*/
|
||||||
public void cancelAllUpdateBatchInputTimers();
|
void cancelAllUpdateBatchInputTimers();
|
||||||
|
|
||||||
public static class Adapter implements TimerProxy {
|
class Adapter implements TimerProxy {
|
||||||
@Override
|
@Override
|
||||||
public void startTypingStateTimer(@Nonnull Key typedKey) {}
|
public void startTypingStateTimer(@Nonnull Key typedKey) {}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -68,7 +68,7 @@ public final class BinaryDictionaryFileDumper {
|
||||||
private static final boolean SHOULD_VERIFY_CHECKSUM =
|
private static final boolean SHOULD_VERIFY_CHECKSUM =
|
||||||
DecoderSpecificConstants.SHOULD_VERIFY_CHECKSUM;
|
DecoderSpecificConstants.SHOULD_VERIFY_CHECKSUM;
|
||||||
|
|
||||||
private static final String DICTIONARY_PROJECTION[] = { "id" };
|
private static final String[] DICTIONARY_PROJECTION = {"id"};
|
||||||
|
|
||||||
private static final String QUERY_PARAMETER_MAY_PROMPT_USER = "mayPrompt";
|
private static final String QUERY_PARAMETER_MAY_PROMPT_USER = "mayPrompt";
|
||||||
private static final String QUERY_PARAMETER_TRUE = "true";
|
private static final String QUERY_PARAMETER_TRUE = "true";
|
||||||
|
@ -143,7 +143,7 @@ public final class BinaryDictionaryFileDumper {
|
||||||
final String clientId = context.getString(R.string.dictionary_pack_client_id);
|
final String clientId = context.getString(R.string.dictionary_pack_client_id);
|
||||||
final ContentProviderClient client = context.getContentResolver().
|
final ContentProviderClient client = context.getContentResolver().
|
||||||
acquireContentProviderClient(getProviderUriBuilder("").build());
|
acquireContentProviderClient(getProviderUriBuilder("").build());
|
||||||
if (null == client) return Collections.<WordListInfo>emptyList();
|
if (null == client) return Collections.emptyList();
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
try {
|
try {
|
||||||
final Uri.Builder builder = getContentUriBuilderForType(clientId, client,
|
final Uri.Builder builder = getContentUriBuilderForType(clientId, client,
|
||||||
|
@ -161,9 +161,9 @@ public final class BinaryDictionaryFileDumper {
|
||||||
reinitializeClientRecordInDictionaryContentProvider(context, client, clientId);
|
reinitializeClientRecordInDictionaryContentProvider(context, client, clientId);
|
||||||
cursor = client.query(queryUri, DICTIONARY_PROJECTION, null, null, null);
|
cursor = client.query(queryUri, DICTIONARY_PROJECTION, null, null, null);
|
||||||
}
|
}
|
||||||
if (null == cursor) return Collections.<WordListInfo>emptyList();
|
if (null == cursor) return Collections.emptyList();
|
||||||
if (cursor.getCount() <= 0 || !cursor.moveToFirst()) {
|
if (cursor.getCount() <= 0 || !cursor.moveToFirst()) {
|
||||||
return Collections.<WordListInfo>emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
final ArrayList<WordListInfo> list = new ArrayList<>();
|
final ArrayList<WordListInfo> list = new ArrayList<>();
|
||||||
do {
|
do {
|
||||||
|
@ -179,13 +179,13 @@ public final class BinaryDictionaryFileDumper {
|
||||||
// happens when the content provider got suddenly killed because it crashed or because
|
// happens when the content provider got suddenly killed because it crashed or because
|
||||||
// the user disabled it through Settings.
|
// the user disabled it through Settings.
|
||||||
Log.e(TAG, "RemoteException: communication with the dictionary pack cut", e);
|
Log.e(TAG, "RemoteException: communication with the dictionary pack cut", e);
|
||||||
return Collections.<WordListInfo>emptyList();
|
return Collections.emptyList();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// A crash here is dangerous because crashing here would brick any encrypted device -
|
// A crash here is dangerous because crashing here would brick any encrypted device -
|
||||||
// we need the keyboard to be up and working to enter the password, so we don't want
|
// we need the keyboard to be up and working to enter the password, so we don't want
|
||||||
// to die no matter what. So let's be as safe as possible.
|
// to die no matter what. So let's be as safe as possible.
|
||||||
Log.e(TAG, "Unexpected exception communicating with the dictionary pack", e);
|
Log.e(TAG, "Unexpected exception communicating with the dictionary pack", e);
|
||||||
return Collections.<WordListInfo>emptyList();
|
return Collections.emptyList();
|
||||||
} finally {
|
} finally {
|
||||||
if (null != cursor) {
|
if (null != cursor) {
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
@ -263,7 +263,7 @@ public final class BinaryDictionaryFileDumper {
|
||||||
* @param output an output stream to copy the data to.
|
* @param output an output stream to copy the data to.
|
||||||
*/
|
*/
|
||||||
public static void checkMagicAndCopyFileTo(final BufferedInputStream input,
|
public static void checkMagicAndCopyFileTo(final BufferedInputStream input,
|
||||||
final BufferedOutputStream output) throws FileNotFoundException, IOException {
|
final BufferedOutputStream output) throws IOException {
|
||||||
// Check the magic number
|
// Check the magic number
|
||||||
final int length = MAGIC_NUMBER_VERSION_2.length;
|
final int length = MAGIC_NUMBER_VERSION_2.length;
|
||||||
final byte[] magicNumberBuffer = new byte[length];
|
final byte[] magicNumberBuffer = new byte[length];
|
||||||
|
|
|
@ -47,9 +47,6 @@ public class ContactsDictionaryUtils {
|
||||||
*/
|
*/
|
||||||
public static boolean useFirstLastBigramsForLocale(final Locale locale) {
|
public static boolean useFirstLastBigramsForLocale(final Locale locale) {
|
||||||
// TODO: Add firstname/lastname bigram rules for other languages.
|
// TODO: Add firstname/lastname bigram rules for other languages.
|
||||||
if (locale != null && locale.getLanguage().equals(Locale.ENGLISH.getLanguage())) {
|
return locale != null && locale.getLanguage().equals(Locale.ENGLISH.getLanguage());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,8 +103,8 @@ public class ContactsManager {
|
||||||
* Interface to implement for classes interested in getting notified for updates
|
* Interface to implement for classes interested in getting notified for updates
|
||||||
* to Contacts content provider.
|
* to Contacts content provider.
|
||||||
*/
|
*/
|
||||||
public static interface ContactsChangedListener {
|
public interface ContactsChangedListener {
|
||||||
public void onContactsChange();
|
void onContactsChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,13 +44,13 @@ import javax.annotation.Nullable;
|
||||||
*/
|
*/
|
||||||
public interface DictionaryFacilitator {
|
public interface DictionaryFacilitator {
|
||||||
|
|
||||||
public static final String[] ALL_DICTIONARY_TYPES = new String[] {
|
String[] ALL_DICTIONARY_TYPES = new String[] {
|
||||||
Dictionary.TYPE_MAIN,
|
Dictionary.TYPE_MAIN,
|
||||||
Dictionary.TYPE_CONTACTS,
|
Dictionary.TYPE_CONTACTS,
|
||||||
Dictionary.TYPE_USER_HISTORY,
|
Dictionary.TYPE_USER_HISTORY,
|
||||||
Dictionary.TYPE_USER};
|
Dictionary.TYPE_USER};
|
||||||
|
|
||||||
public static final String[] DYNAMIC_DICTIONARY_TYPES = new String[] {
|
String[] DYNAMIC_DICTIONARY_TYPES = new String[] {
|
||||||
Dictionary.TYPE_CONTACTS,
|
Dictionary.TYPE_CONTACTS,
|
||||||
Dictionary.TYPE_USER_HISTORY,
|
Dictionary.TYPE_USER_HISTORY,
|
||||||
Dictionary.TYPE_USER};
|
Dictionary.TYPE_USER};
|
||||||
|
|
|
@ -260,7 +260,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
||||||
final Method factoryMethod = dictClass.getMethod(DICT_FACTORY_METHOD_NAME,
|
final Method factoryMethod = dictClass.getMethod(DICT_FACTORY_METHOD_NAME,
|
||||||
DICT_FACTORY_METHOD_ARG_TYPES);
|
DICT_FACTORY_METHOD_ARG_TYPES);
|
||||||
final Object dict = factoryMethod.invoke(null /* obj */,
|
final Object dict = factoryMethod.invoke(null /* obj */,
|
||||||
new Object[] { context, locale, dictFile, dictNamePrefix, account });
|
context, locale, dictFile, dictNamePrefix, account);
|
||||||
return (ExpandableBinaryDictionary) dict;
|
return (ExpandableBinaryDictionary) dict;
|
||||||
} catch (final NoSuchMethodException | SecurityException | IllegalAccessException
|
} catch (final NoSuchMethodException | SecurityException | IllegalAccessException
|
||||||
| IllegalArgumentException | InvocationTargetException e) {
|
| IllegalArgumentException | InvocationTargetException e) {
|
||||||
|
@ -468,18 +468,12 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
||||||
// of these methods.
|
// of these methods.
|
||||||
public boolean hasAtLeastOneInitializedMainDictionary() {
|
public boolean hasAtLeastOneInitializedMainDictionary() {
|
||||||
final Dictionary mainDict = mDictionaryGroup.getDict(Dictionary.TYPE_MAIN);
|
final Dictionary mainDict = mDictionaryGroup.getDict(Dictionary.TYPE_MAIN);
|
||||||
if (mainDict != null && mainDict.isInitialized()) {
|
return mainDict != null && mainDict.isInitialized();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAtLeastOneUninitializedMainDictionary() {
|
public boolean hasAtLeastOneUninitializedMainDictionary() {
|
||||||
final Dictionary mainDict = mDictionaryGroup.getDict(Dictionary.TYPE_MAIN);
|
final Dictionary mainDict = mDictionaryGroup.getDict(Dictionary.TYPE_MAIN);
|
||||||
if (mainDict == null || !mainDict.isInitialized()) {
|
return mainDict == null || !mainDict.isInitialized();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitForLoadingMainDictionaries(final long timeout, final TimeUnit unit)
|
public void waitForLoadingMainDictionaries(final long timeout, final TimeUnit unit)
|
||||||
|
@ -507,7 +501,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
||||||
NgramContext ngramContextForCurrentWord = ngramContext;
|
NgramContext ngramContextForCurrentWord = ngramContext;
|
||||||
for (int i = 0; i < words.length; i++) {
|
for (int i = 0; i < words.length; i++) {
|
||||||
final String currentWord = words[i];
|
final String currentWord = words[i];
|
||||||
final boolean wasCurrentWordAutoCapitalized = (i == 0) ? wasAutoCapitalized : false;
|
final boolean wasCurrentWordAutoCapitalized = (i == 0) && wasAutoCapitalized;
|
||||||
addWordToUserHistory(mDictionaryGroup, ngramContextForCurrentWord, currentWord,
|
addWordToUserHistory(mDictionaryGroup, ngramContextForCurrentWord, currentWord,
|
||||||
wasCurrentWordAutoCapitalized, (int) timeStampInSeconds,
|
wasCurrentWordAutoCapitalized, (int) timeStampInSeconds,
|
||||||
blockPotentiallyOffensive);
|
blockPotentiallyOffensive);
|
||||||
|
|
|
@ -39,7 +39,7 @@ final class EmojiAltPhysicalKeyDetector {
|
||||||
|
|
||||||
private List<EmojiHotKeys> mHotKeysList;
|
private List<EmojiHotKeys> mHotKeysList;
|
||||||
|
|
||||||
private static class HotKeySet extends HashSet<Pair<Integer, Integer>> { };
|
private static class HotKeySet extends HashSet<Pair<Integer, Integer>> { }
|
||||||
|
|
||||||
private abstract class EmojiHotKeys {
|
private abstract class EmojiHotKeys {
|
||||||
private final String mName;
|
private final String mName;
|
||||||
|
|
|
@ -394,7 +394,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
*/
|
*/
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
public interface UpdateEntriesForInputEventsCallback {
|
public interface UpdateEntriesForInputEventsCallback {
|
||||||
public void onFinished();
|
void onFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,8 +42,8 @@ public final class InputView extends FrameLayout {
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
final SuggestionStripView suggestionStripView =
|
final SuggestionStripView suggestionStripView =
|
||||||
(SuggestionStripView)findViewById(R.id.suggestion_strip_view);
|
findViewById(R.id.suggestion_strip_view);
|
||||||
mMainKeyboardView = (MainKeyboardView)findViewById(R.id.keyboard_view);
|
mMainKeyboardView = findViewById(R.id.keyboard_view);
|
||||||
mKeyboardTopPaddingForwarder = new KeyboardTopPaddingForwarder(
|
mKeyboardTopPaddingForwarder = new KeyboardTopPaddingForwarder(
|
||||||
mMainKeyboardView, suggestionStripView);
|
mMainKeyboardView, suggestionStripView);
|
||||||
mMoreSuggestionsViewCanceler = new MoreSuggestionsViewCanceler(
|
mMoreSuggestionsViewCanceler = new MoreSuggestionsViewCanceler(
|
||||||
|
@ -162,9 +162,7 @@ public final class InputView extends FrameLayout {
|
||||||
if (me.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
if (me.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
// If the down event happens in the forwarding area, successive
|
// If the down event happens in the forwarding area, successive
|
||||||
// {@link MotionEvent}s should be forwarded to <code>ReceiverView</code>.
|
// {@link MotionEvent}s should be forwarded to <code>ReceiverView</code>.
|
||||||
if (needsToForward(x, y)) {
|
return needsToForward(x, y);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1962,12 +1962,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// TODO: Revisit here to reorganize the settings. Probably we can/should use different
|
// TODO: Revisit here to reorganize the settings. Probably we can/should use different
|
||||||
// strategy once the implementation of
|
// strategy once the implementation of
|
||||||
// {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} is defined well.
|
// {@link InputMethodManager#shouldOfferSwitchingToNextInputMethod} is defined well.
|
||||||
final boolean fallbackValue = mSettings.getCurrent().isLanguageSwitchKeyEnabled();
|
return mSettings.getCurrent().isLanguageSwitchKeyEnabled();
|
||||||
final IBinder token = getWindow().getWindow().getAttributes().token;
|
|
||||||
if (token == null) {
|
|
||||||
return fallbackValue;
|
|
||||||
}
|
|
||||||
return mRichImm.shouldOfferSwitchingToNextInputMethod(token, fallbackValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNavigationBarVisibility(final boolean visible) {
|
private void setNavigationBarVisibility(final boolean visible) {
|
||||||
|
|
|
@ -100,8 +100,8 @@ public class PersonalDictionaryLookup implements Closeable {
|
||||||
/**
|
/**
|
||||||
* Interface to implement for classes interested in getting notified of updates.
|
* Interface to implement for classes interested in getting notified of updates.
|
||||||
*/
|
*/
|
||||||
public static interface PersonalDictionaryListener {
|
public interface PersonalDictionaryListener {
|
||||||
public void onUpdate();
|
void onUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Set<PersonalDictionaryListener> mListeners = new HashSet<>();
|
private final Set<PersonalDictionaryListener> mListeners = new HashSet<>();
|
||||||
|
|
|
@ -783,11 +783,8 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int codePointAfterCursor = Character.codePointAt(after, 0);
|
final int codePointAfterCursor = Character.codePointAt(after, 0);
|
||||||
if (spacingAndPunctuations.isWordSeparator(codePointAfterCursor)
|
return !spacingAndPunctuations.isWordSeparator(codePointAfterCursor)
|
||||||
|| spacingAndPunctuations.isWordConnector(codePointAfterCursor)) {
|
&& !spacingAndPunctuations.isWordConnector(codePointAfterCursor);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeTrailingSpace() {
|
public void removeTrailingSpace() {
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class RichInputMethodSubtype {
|
||||||
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static final RichInputMethodSubtype DUMMY_NO_LANGUAGE_SUBTYPE =
|
private static final RichInputMethodSubtype DUMMY_NO_LANGUAGE_SUBTYPE =
|
||||||
new RichInputMethodSubtype(InputMethodSubtypeCompatUtils.newInputMethodSubtype(
|
new RichInputMethodSubtype(new InputMethodSubtype(
|
||||||
R.string.subtype_no_language_qwerty, R.drawable.ic_ime_switcher_dark,
|
R.string.subtype_no_language_qwerty, R.drawable.ic_ime_switcher_dark,
|
||||||
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
|
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
|
||||||
EXTRA_VALUE_OF_DUMMY_NO_LANGUAGE_SUBTYPE,
|
EXTRA_VALUE_OF_DUMMY_NO_LANGUAGE_SUBTYPE,
|
||||||
|
@ -201,7 +201,7 @@ public class RichInputMethodSubtype {
|
||||||
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
+ "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE;
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private static final RichInputMethodSubtype DUMMY_EMOJI_SUBTYPE = new RichInputMethodSubtype(
|
private static final RichInputMethodSubtype DUMMY_EMOJI_SUBTYPE = new RichInputMethodSubtype(
|
||||||
InputMethodSubtypeCompatUtils.newInputMethodSubtype(
|
new InputMethodSubtype(
|
||||||
R.string.subtype_emoji, R.drawable.ic_ime_switcher_dark,
|
R.string.subtype_emoji, R.drawable.ic_ime_switcher_dark,
|
||||||
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
|
SubtypeLocaleUtils.NO_LANGUAGE, KEYBOARD_MODE,
|
||||||
EXTRA_VALUE_OF_DUMMY_EMOJI_SUBTYPE,
|
EXTRA_VALUE_OF_DUMMY_EMOJI_SUBTYPE,
|
||||||
|
|
|
@ -92,7 +92,7 @@ public final class Suggest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnGetSuggestedWordsCallback {
|
public interface OnGetSuggestedWordsCallback {
|
||||||
public void onGetSuggestedWords(final SuggestedWords suggestedWords);
|
void onGetSuggestedWords(final SuggestedWords suggestedWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getSuggestedWords(final WordComposer wordComposer,
|
public void getSuggestedWords(final WordComposer wordComposer,
|
||||||
|
|
|
@ -485,11 +485,8 @@ public final class StringUtils {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// If it has both a period and a slash, it looks like an URL.
|
// If it has both a period and a slash, it looks like an URL.
|
||||||
if (hasPeriod && hasSlash) {
|
return hasPeriod && hasSlash;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// Otherwise, it doesn't look like an URL.
|
// Otherwise, it doesn't look like an URL.
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,11 +44,11 @@ final class CustomInputStylePreference extends DialogPreference
|
||||||
private static final boolean DEBUG_SUBTYPE_ID = false;
|
private static final boolean DEBUG_SUBTYPE_ID = false;
|
||||||
|
|
||||||
interface Listener {
|
interface Listener {
|
||||||
public void onRemoveCustomInputStyle(CustomInputStylePreference stylePref);
|
void onRemoveCustomInputStyle(CustomInputStylePreference stylePref);
|
||||||
public void onSaveCustomInputStyle(CustomInputStylePreference stylePref);
|
void onSaveCustomInputStyle(CustomInputStylePreference stylePref);
|
||||||
public void onAddCustomInputStyle(CustomInputStylePreference stylePref);
|
void onAddCustomInputStyle(CustomInputStylePreference stylePref);
|
||||||
public SubtypeLocaleAdapter getSubtypeLocaleAdapter();
|
SubtypeLocaleAdapter getSubtypeLocaleAdapter();
|
||||||
public KeyboardLayoutSetAdapter getKeyboardLayoutSetAdapter();
|
KeyboardLayoutSetAdapter getKeyboardLayoutSetAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String KEY_PREFIX = "subtype_pref_";
|
private static final String KEY_PREFIX = "subtype_pref_";
|
||||||
|
@ -115,9 +115,9 @@ final class CustomInputStylePreference extends DialogPreference
|
||||||
@Override
|
@Override
|
||||||
protected View onCreateDialogView() {
|
protected View onCreateDialogView() {
|
||||||
final View v = super.onCreateDialogView();
|
final View v = super.onCreateDialogView();
|
||||||
mSubtypeLocaleSpinner = (Spinner) v.findViewById(R.id.subtype_locale_spinner);
|
mSubtypeLocaleSpinner = v.findViewById(R.id.subtype_locale_spinner);
|
||||||
mSubtypeLocaleSpinner.setAdapter(mProxy.getSubtypeLocaleAdapter());
|
mSubtypeLocaleSpinner.setAdapter(mProxy.getSubtypeLocaleAdapter());
|
||||||
mKeyboardLayoutSetSpinner = (Spinner) v.findViewById(R.id.keyboard_layout_set_spinner);
|
mKeyboardLayoutSetSpinner = v.findViewById(R.id.keyboard_layout_set_spinner);
|
||||||
mKeyboardLayoutSetSpinner.setAdapter(mProxy.getKeyboardLayoutSetAdapter());
|
mKeyboardLayoutSetSpinner.setAdapter(mProxy.getKeyboardLayoutSetAdapter());
|
||||||
// All keyboard layout names are in the Latin script and thus left to right. That means
|
// All keyboard layout names are in the Latin script and thus left to right. That means
|
||||||
// the view would align them to the left even if the system locale is RTL, but that
|
// the view would align them to the left even if the system locale is RTL, but that
|
||||||
|
@ -233,7 +233,7 @@ final class CustomInputStylePreference extends DialogPreference
|
||||||
|
|
||||||
public SavedState(final Parcel source) {
|
public SavedState(final Parcel source) {
|
||||||
super(source);
|
super(source);
|
||||||
mSubtype = (InputMethodSubtype)source.readParcelable(null);
|
mSubtype = source.readParcelable(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("hiding")
|
@SuppressWarnings("hiding")
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class RadioButtonPreference extends Preference {
|
||||||
*
|
*
|
||||||
* @param preference This preference.
|
* @param preference This preference.
|
||||||
*/
|
*/
|
||||||
public void onRadioButtonClicked(RadioButtonPreference preference);
|
void onRadioButtonClicked(RadioButtonPreference preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean mIsSelected;
|
private boolean mIsSelected;
|
||||||
|
@ -74,7 +74,7 @@ public class RadioButtonPreference extends Preference {
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(final View view) {
|
protected void onBindView(final View view) {
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
mRadioButton = (RadioButton)view.findViewById(R.id.radio_button);
|
mRadioButton = view.findViewById(R.id.radio_button);
|
||||||
mRadioButton.setChecked(mIsSelected);
|
mRadioButton.setChecked(mIsSelected);
|
||||||
mRadioButton.setOnClickListener(mClickListener);
|
mRadioButton.setOnClickListener(mClickListener);
|
||||||
view.setOnClickListener(mClickListener);
|
view.setOnClickListener(mClickListener);
|
||||||
|
|
|
@ -31,12 +31,12 @@ import org.dslul.openboard.inputmethod.latin.R;
|
||||||
public final class SeekBarDialogPreference extends DialogPreference
|
public final class SeekBarDialogPreference extends DialogPreference
|
||||||
implements SeekBar.OnSeekBarChangeListener {
|
implements SeekBar.OnSeekBarChangeListener {
|
||||||
public interface ValueProxy {
|
public interface ValueProxy {
|
||||||
public int readValue(final String key);
|
int readValue(final String key);
|
||||||
public int readDefaultValue(final String key);
|
int readDefaultValue(final String key);
|
||||||
public void writeValue(final int value, final String key);
|
void writeValue(final int value, final String key);
|
||||||
public void writeDefaultValue(final String key);
|
void writeDefaultValue(final String key);
|
||||||
public String getValueText(final int value);
|
String getValueText(final int value);
|
||||||
public void feedbackValue(final int value);
|
void feedbackValue(final int value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int mMaxValue;
|
private final int mMaxValue;
|
||||||
|
@ -68,10 +68,10 @@ public final class SeekBarDialogPreference extends DialogPreference
|
||||||
@Override
|
@Override
|
||||||
protected View onCreateDialogView() {
|
protected View onCreateDialogView() {
|
||||||
final View view = super.onCreateDialogView();
|
final View view = super.onCreateDialogView();
|
||||||
mSeekBar = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar);
|
mSeekBar = view.findViewById(R.id.seek_bar_dialog_bar);
|
||||||
mSeekBar.setMax(mMaxValue - mMinValue);
|
mSeekBar.setMax(mMaxValue - mMinValue);
|
||||||
mSeekBar.setOnSeekBarChangeListener(this);
|
mSeekBar.setOnSeekBarChangeListener(this);
|
||||||
mValueView = (TextView)view.findViewById(R.id.seek_bar_dialog_value);
|
mValueView = view.findViewById(R.id.seek_bar_dialog_value);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,18 +266,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
R.integer.config_key_preview_linger_timeout))));
|
R.integer.config_key_preview_linger_timeout))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean readShowsLanguageSwitchKey(final SharedPreferences prefs) {
|
|
||||||
if (prefs.contains(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY)) {
|
|
||||||
final boolean suppressLanguageSwitchKey = prefs.getBoolean(
|
|
||||||
PREF_SUPPRESS_LANGUAGE_SWITCH_KEY, false);
|
|
||||||
final SharedPreferences.Editor editor = prefs.edit();
|
|
||||||
editor.remove(PREF_SUPPRESS_LANGUAGE_SWITCH_KEY);
|
|
||||||
editor.putBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, !suppressLanguageSwitchKey);
|
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
return prefs.getBoolean(PREF_SHOW_LANGUAGE_SWITCH_KEY, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String readPrefAdditionalSubtypes(final SharedPreferences prefs,
|
public static String readPrefAdditionalSubtypes(final SharedPreferences prefs,
|
||||||
final Resources res) {
|
final Resources res) {
|
||||||
final String predefinedPrefSubtypes = AdditionalSubtypeUtils.createPrefSubtypes(
|
final String predefinedPrefSubtypes = AdditionalSubtypeUtils.createPrefSubtypes(
|
||||||
|
|
|
@ -139,11 +139,8 @@ public class SettingsValues {
|
||||||
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
||||||
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
||||||
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res) && mInputAttributes.mShouldShowVoiceInputKey;
|
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res) && mInputAttributes.mShouldShowVoiceInputKey;
|
||||||
mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
|
mIncludesOtherImesInLanguageSwitchList = !Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS || prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false) /* forcibly */;
|
||||||
? prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false)
|
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
|
||||||
: true /* forcibly */;
|
|
||||||
mShowsLanguageSwitchKey = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
|
|
||||||
? Settings.readShowsLanguageSwitchKey(prefs) : true /* forcibly */;
|
|
||||||
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
||||||
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
|
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
|
||||||
mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true)
|
mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true)
|
||||||
|
|
|
@ -59,7 +59,7 @@ public abstract class SubScreenFragment extends PreferenceFragment
|
||||||
if (listPreference == null) {
|
if (listPreference == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final CharSequence entries[] = listPreference.getEntries();
|
final CharSequence[] entries = listPreference.getEntries();
|
||||||
final int entryIndex = listPreference.findIndexOfValue(listPreference.getValue());
|
final int entryIndex = listPreference.findIndexOfValue(listPreference.getValue());
|
||||||
listPreference.setSummary(entryIndex < 0 ? null : entries[entryIndex]);
|
listPreference.setSummary(entryIndex < 0 ? null : entries[entryIndex]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public final class SetupStartIndicatorView extends LinearLayout {
|
||||||
setOrientation(HORIZONTAL);
|
setOrientation(HORIZONTAL);
|
||||||
LayoutInflater.from(context).inflate(R.layout.setup_start_indicator_label, this);
|
LayoutInflater.from(context).inflate(R.layout.setup_start_indicator_label, this);
|
||||||
|
|
||||||
final LabelView labelView = (LabelView)findViewById(R.id.setup_start_label);
|
final LabelView labelView = findViewById(R.id.setup_start_label);
|
||||||
labelView.setIndicatorView(findViewById(R.id.setup_start_indicator));
|
labelView.setIndicatorView(findViewById(R.id.setup_start_indicator));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,18 +135,18 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
|
||||||
|
|
||||||
final String applicationName = getResources().getString(getApplicationInfo().labelRes);
|
final String applicationName = getResources().getString(getApplicationInfo().labelRes);
|
||||||
mWelcomeScreen = findViewById(R.id.setup_welcome_screen);
|
mWelcomeScreen = findViewById(R.id.setup_welcome_screen);
|
||||||
final TextView welcomeTitle = (TextView)findViewById(R.id.setup_welcome_title);
|
final TextView welcomeTitle = findViewById(R.id.setup_welcome_title);
|
||||||
welcomeTitle.setText(getString(R.string.setup_welcome_title, applicationName));
|
welcomeTitle.setText(getString(R.string.setup_welcome_title, applicationName));
|
||||||
|
|
||||||
mSetupScreen = findViewById(R.id.setup_steps_screen);
|
mSetupScreen = findViewById(R.id.setup_steps_screen);
|
||||||
final TextView stepsTitle = (TextView)findViewById(R.id.setup_title);
|
final TextView stepsTitle = findViewById(R.id.setup_title);
|
||||||
stepsTitle.setText(getString(R.string.setup_steps_title, applicationName));
|
stepsTitle.setText(getString(R.string.setup_steps_title, applicationName));
|
||||||
|
|
||||||
final SetupStepIndicatorView indicatorView =
|
final SetupStepIndicatorView indicatorView =
|
||||||
(SetupStepIndicatorView)findViewById(R.id.setup_step_indicator);
|
findViewById(R.id.setup_step_indicator);
|
||||||
mSetupStepGroup = new SetupStepGroup(indicatorView);
|
mSetupStepGroup = new SetupStepGroup(indicatorView);
|
||||||
|
|
||||||
mStep1Bullet = (TextView)findViewById(R.id.setup_step1_bullet);
|
mStep1Bullet = findViewById(R.id.setup_step1_bullet);
|
||||||
mStep1Bullet.setOnClickListener(this);
|
mStep1Bullet.setOnClickListener(this);
|
||||||
final SetupStep step1 = new SetupStep(STEP_1, applicationName,
|
final SetupStep step1 = new SetupStep(STEP_1, applicationName,
|
||||||
mStep1Bullet, findViewById(R.id.setup_step1),
|
mStep1Bullet, findViewById(R.id.setup_step1),
|
||||||
|
@ -194,7 +194,7 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
|
||||||
.authority(getPackageName())
|
.authority(getPackageName())
|
||||||
.path(Integer.toString(R.raw.setup_welcome_video))
|
.path(Integer.toString(R.raw.setup_welcome_video))
|
||||||
.build();
|
.build();
|
||||||
final VideoView welcomeVideoView = (VideoView)findViewById(R.id.setup_welcome_video);
|
final VideoView welcomeVideoView = findViewById(R.id.setup_welcome_video);
|
||||||
welcomeVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
welcomeVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onPrepared(final MediaPlayer mp) {
|
public void onPrepared(final MediaPlayer mp) {
|
||||||
|
@ -213,13 +213,13 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mWelcomeVideoView = welcomeVideoView;
|
mWelcomeVideoView = welcomeVideoView;
|
||||||
mWelcomeImageView = (ImageView)findViewById(R.id.setup_welcome_image);
|
mWelcomeImageView = findViewById(R.id.setup_welcome_image);
|
||||||
|
|
||||||
mActionStart = findViewById(R.id.setup_start_label);
|
mActionStart = findViewById(R.id.setup_start_label);
|
||||||
mActionStart.setOnClickListener(this);
|
mActionStart.setOnClickListener(this);
|
||||||
mActionNext = findViewById(R.id.setup_next);
|
mActionNext = findViewById(R.id.setup_next);
|
||||||
mActionNext.setOnClickListener(this);
|
mActionNext.setOnClickListener(this);
|
||||||
mActionFinish = (TextView)findViewById(R.id.setup_finish);
|
mActionFinish = findViewById(R.id.setup_finish);
|
||||||
mActionFinish.setCompoundDrawablesRelativeWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_setup_finish),
|
mActionFinish.setCompoundDrawablesRelativeWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_setup_finish),
|
||||||
null, null, null);
|
null, null, null);
|
||||||
mActionFinish.setOnClickListener(this);
|
mActionFinish.setOnClickListener(this);
|
||||||
|
@ -448,14 +448,14 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
|
||||||
mActivatedColor = res.getColor(R.color.setup_text_action);
|
mActivatedColor = res.getColor(R.color.setup_text_action);
|
||||||
mDeactivatedColor = res.getColor(R.color.setup_text_dark);
|
mDeactivatedColor = res.getColor(R.color.setup_text_dark);
|
||||||
|
|
||||||
final TextView titleView = (TextView)mStepView.findViewById(R.id.setup_step_title);
|
final TextView titleView = mStepView.findViewById(R.id.setup_step_title);
|
||||||
titleView.setText(res.getString(title, applicationName));
|
titleView.setText(res.getString(title, applicationName));
|
||||||
mInstruction = (instruction == 0) ? null
|
mInstruction = (instruction == 0) ? null
|
||||||
: res.getString(instruction, applicationName);
|
: res.getString(instruction, applicationName);
|
||||||
mFinishedInstruction = (finishedInstruction == 0) ? null
|
mFinishedInstruction = (finishedInstruction == 0) ? null
|
||||||
: res.getString(finishedInstruction, applicationName);
|
: res.getString(finishedInstruction, applicationName);
|
||||||
|
|
||||||
mActionLabel = (TextView)mStepView.findViewById(R.id.setup_step_action_label);
|
mActionLabel = mStepView.findViewById(R.id.setup_step_action_label);
|
||||||
mActionLabel.setText(res.getString(actionLabel));
|
mActionLabel.setText(res.getString(actionLabel));
|
||||||
if (actionIcon == 0) {
|
if (actionIcon == 0) {
|
||||||
final int paddingEnd = mActionLabel.getPaddingEnd();
|
final int paddingEnd = mActionLabel.getPaddingEnd();
|
||||||
|
@ -469,7 +469,7 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
|
||||||
public void setEnabled(final boolean enabled, final boolean isStepActionAlreadyDone) {
|
public void setEnabled(final boolean enabled, final boolean isStepActionAlreadyDone) {
|
||||||
mStepView.setVisibility(enabled ? View.VISIBLE : View.GONE);
|
mStepView.setVisibility(enabled ? View.VISIBLE : View.GONE);
|
||||||
mBulletView.setTextColor(enabled ? mActivatedColor : mDeactivatedColor);
|
mBulletView.setTextColor(enabled ? mActivatedColor : mDeactivatedColor);
|
||||||
final TextView instructionView = (TextView)mStepView.findViewById(
|
final TextView instructionView = mStepView.findViewById(
|
||||||
R.id.setup_step_instruction);
|
R.id.setup_step_instruction);
|
||||||
instructionView.setText(isStepActionAlreadyDone ? mFinishedInstruction : mInstruction);
|
instructionView.setText(isStepActionAlreadyDone ? mFinishedInstruction : mInstruction);
|
||||||
mActionLabel.setVisibility(isStepActionAlreadyDone ? View.GONE : View.VISIBLE);
|
mActionLabel.setVisibility(isStepActionAlreadyDone ? View.GONE : View.VISIBLE);
|
||||||
|
|
|
@ -546,7 +546,7 @@ final class SuggestionStripLayoutHelper {
|
||||||
|
|
||||||
public void layoutImportantNotice(final View importantNoticeStrip,
|
public void layoutImportantNotice(final View importantNoticeStrip,
|
||||||
final String importantNoticeTitle) {
|
final String importantNoticeTitle) {
|
||||||
final TextView titleView = (TextView)importantNoticeStrip.findViewById(
|
final TextView titleView = importantNoticeStrip.findViewById(
|
||||||
R.id.important_notice_title);
|
R.id.important_notice_title);
|
||||||
final int width = titleView.getWidth() - titleView.getPaddingLeft()
|
final int width = titleView.getWidth() - titleView.getPaddingLeft()
|
||||||
- titleView.getPaddingRight();
|
- titleView.getPaddingRight();
|
||||||
|
|
|
@ -59,9 +59,9 @@ import androidx.core.view.ViewCompat;
|
||||||
public final class SuggestionStripView extends RelativeLayout implements OnClickListener,
|
public final class SuggestionStripView extends RelativeLayout implements OnClickListener,
|
||||||
OnLongClickListener {
|
OnLongClickListener {
|
||||||
public interface Listener {
|
public interface Listener {
|
||||||
public void showImportantNoticeContents();
|
void showImportantNoticeContents();
|
||||||
public void pickSuggestionManually(SuggestedWordInfo word);
|
void pickSuggestionManually(SuggestedWordInfo word);
|
||||||
public void onCodeInput(int primaryCode, int x, int y, boolean isKeyRepeat);
|
void onCodeInput(int primaryCode, int x, int y, boolean isKeyRepeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static final boolean DBG = DebugFlags.DEBUG_ENABLED;
|
static final boolean DBG = DebugFlags.DEBUG_ENABLED;
|
||||||
|
@ -139,8 +139,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
inflater.inflate(R.layout.suggestions_strip, this);
|
inflater.inflate(R.layout.suggestions_strip, this);
|
||||||
|
|
||||||
mSuggestionsStrip = (ViewGroup)findViewById(R.id.suggestions_strip);
|
mSuggestionsStrip = findViewById(R.id.suggestions_strip);
|
||||||
mVoiceKey = (ImageButton)findViewById(R.id.suggestions_strip_voice_key);
|
mVoiceKey = findViewById(R.id.suggestions_strip_voice_key);
|
||||||
mImportantNoticeStrip = findViewById(R.id.important_notice_strip);
|
mImportantNoticeStrip = findViewById(R.id.important_notice_strip);
|
||||||
mStripVisibilityGroup = new StripVisibilityGroup(this, mSuggestionsStrip,
|
mStripVisibilityGroup = new StripVisibilityGroup(this, mSuggestionsStrip,
|
||||||
mImportantNoticeStrip);
|
mImportantNoticeStrip);
|
||||||
|
@ -163,7 +163,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
context, attrs, defStyle, mWordViews, mDividerViews, mDebugInfoViews);
|
context, attrs, defStyle, mWordViews, mDividerViews, mDebugInfoViews);
|
||||||
|
|
||||||
mMoreSuggestionsContainer = inflater.inflate(R.layout.more_suggestions, null);
|
mMoreSuggestionsContainer = inflater.inflate(R.layout.more_suggestions, null);
|
||||||
mMoreSuggestionsView = (MoreSuggestionsView)mMoreSuggestionsContainer
|
mMoreSuggestionsView = mMoreSuggestionsContainer
|
||||||
.findViewById(R.id.more_suggestions_view);
|
.findViewById(R.id.more_suggestions_view);
|
||||||
mMoreSuggestionsBuilder = new MoreSuggestions.Builder(context, mMoreSuggestionsView);
|
mMoreSuggestionsBuilder = new MoreSuggestions.Builder(context, mMoreSuggestionsView);
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
*/
|
*/
|
||||||
public void setListener(final Listener listener, final View inputView) {
|
public void setListener(final Listener listener, final View inputView) {
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
mMainKeyboardView = (MainKeyboardView)inputView.findViewById(R.id.keyboard_view);
|
mMainKeyboardView = inputView.findViewById(R.id.keyboard_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateVisibility(final boolean shouldBeVisible, final boolean isFullscreenMode) {
|
public void updateVisibility(final boolean shouldBeVisible, final boolean isFullscreenMode) {
|
||||||
|
|
|
@ -22,6 +22,6 @@ import org.dslul.openboard.inputmethod.latin.SuggestedWords;
|
||||||
* An object that gives basic control of a suggestion strip and some info on it.
|
* An object that gives basic control of a suggestion strip and some info on it.
|
||||||
*/
|
*/
|
||||||
public interface SuggestionStripViewAccessor {
|
public interface SuggestionStripViewAccessor {
|
||||||
public void setNeutralSuggestionStrip();
|
void setNeutralSuggestionStrip();
|
||||||
public void showSuggestionStrip(final SuggestedWords suggestedWords);
|
void showSuggestionStrip(final SuggestedWords suggestedWords);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ public class UserDictionaryAddWordContents {
|
||||||
private String mSavedShortcut;
|
private String mSavedShortcut;
|
||||||
|
|
||||||
/* package */ UserDictionaryAddWordContents(final View view, final Bundle args) {
|
/* package */ UserDictionaryAddWordContents(final View view, final Bundle args) {
|
||||||
mWordEditText = (EditText)view.findViewById(R.id.user_dictionary_add_word_text);
|
mWordEditText = view.findViewById(R.id.user_dictionary_add_word_text);
|
||||||
mShortcutEditText = (EditText)view.findViewById(R.id.user_dictionary_add_shortcut);
|
mShortcutEditText = view.findViewById(R.id.user_dictionary_add_shortcut);
|
||||||
if (!UserDictionarySettings.IS_SHORTCUT_API_SUPPORTED) {
|
if (!UserDictionarySettings.IS_SHORTCUT_API_SUPPORTED) {
|
||||||
mShortcutEditText.setVisibility(View.GONE);
|
mShortcutEditText.setVisibility(View.GONE);
|
||||||
view.findViewById(R.id.user_dictionary_add_shortcut_label).setVisibility(View.GONE);
|
view.findViewById(R.id.user_dictionary_add_shortcut_label).setVisibility(View.GONE);
|
||||||
|
@ -101,8 +101,8 @@ public class UserDictionaryAddWordContents {
|
||||||
|
|
||||||
/* package */ UserDictionaryAddWordContents(final View view,
|
/* package */ UserDictionaryAddWordContents(final View view,
|
||||||
final UserDictionaryAddWordContents oldInstanceToBeEdited) {
|
final UserDictionaryAddWordContents oldInstanceToBeEdited) {
|
||||||
mWordEditText = (EditText)view.findViewById(R.id.user_dictionary_add_word_text);
|
mWordEditText = view.findViewById(R.id.user_dictionary_add_word_text);
|
||||||
mShortcutEditText = (EditText)view.findViewById(R.id.user_dictionary_add_shortcut);
|
mShortcutEditText = view.findViewById(R.id.user_dictionary_add_shortcut);
|
||||||
mMode = MODE_EDIT;
|
mMode = MODE_EDIT;
|
||||||
mOldWord = oldInstanceToBeEdited.mSavedWord;
|
mOldWord = oldInstanceToBeEdited.mSavedWord;
|
||||||
mOldShortcut = oldInstanceToBeEdited.mSavedShortcut;
|
mOldShortcut = oldInstanceToBeEdited.mSavedShortcut;
|
||||||
|
@ -183,7 +183,7 @@ public class UserDictionaryAddWordContents {
|
||||||
|
|
||||||
// In this class we use the empty string to represent 'all locales' and mLocale cannot
|
// In this class we use the empty string to represent 'all locales' and mLocale cannot
|
||||||
// be null. However the addWord method takes null to mean 'all locales'.
|
// be null. However the addWord method takes null to mean 'all locales'.
|
||||||
UserDictionary.Words.addWord(context, newWord.toString(),
|
UserDictionary.Words.addWord(context, newWord,
|
||||||
FREQUENCY_FOR_USER_DICTIONARY_ADDS, newShortcut, TextUtils.isEmpty(mLocale) ?
|
FREQUENCY_FOR_USER_DICTIONARY_ADDS, newShortcut, TextUtils.isEmpty(mLocale) ?
|
||||||
null : LocaleUtils.constructLocaleFromString(mLocale));
|
null : LocaleUtils.constructLocaleFromString(mLocale));
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class UserDictionaryAddWordFragment extends Fragment
|
||||||
final ArrayList<LocaleRenderer> localesList = mContents.getLocalesList(getActivity());
|
final ArrayList<LocaleRenderer> localesList = mContents.getLocalesList(getActivity());
|
||||||
|
|
||||||
final Spinner localeSpinner =
|
final Spinner localeSpinner =
|
||||||
(Spinner)mRootView.findViewById(R.id.user_dictionary_add_locale);
|
mRootView.findViewById(R.id.user_dictionary_add_locale);
|
||||||
final ArrayAdapter<LocaleRenderer> adapter = new ArrayAdapter<>(
|
final ArrayAdapter<LocaleRenderer> adapter = new ArrayAdapter<>(
|
||||||
getActivity(), android.R.layout.simple_spinner_item, localesList);
|
getActivity(), android.R.layout.simple_spinner_item, localesList);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class UserDictionaryList extends PreferenceFragment {
|
||||||
// enabled subtypes. If we already have the locale-without-country version of the system
|
// enabled subtypes. If we already have the locale-without-country version of the system
|
||||||
// locale, we don't add the system locale to avoid confusion even though it's technically
|
// locale, we don't add the system locale to avoid confusion even though it's technically
|
||||||
// correct to add it.
|
// correct to add it.
|
||||||
if (!localeSet.contains(Locale.getDefault().getLanguage().toString())) {
|
if (!localeSet.contains(Locale.getDefault().getLanguage())) {
|
||||||
localeSet.add(Locale.getDefault().toString());
|
localeSet.add(Locale.getDefault().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,6 @@ public class UserDictionaryLocalePicker extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface LocationChangedListener {
|
public interface LocationChangedListener {
|
||||||
public void onLocaleSelected(Locale locale);
|
void onLocaleSelected(Locale locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,11 +132,7 @@ public class UserDictionarySettings extends ListFragment {
|
||||||
final String locale;
|
final String locale;
|
||||||
if (null != localeFromArguments) {
|
if (null != localeFromArguments) {
|
||||||
locale = localeFromArguments;
|
locale = localeFromArguments;
|
||||||
} else if (null != localeFromIntent) {
|
} else locale = localeFromIntent;
|
||||||
locale = localeFromIntent;
|
|
||||||
} else {
|
|
||||||
locale = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLocale = locale;
|
mLocale = locale;
|
||||||
// WARNING: The following cursor is never closed! TODO: don't put that in a member, and
|
// WARNING: The following cursor is never closed! TODO: don't put that in a member, and
|
||||||
|
@ -145,7 +141,7 @@ public class UserDictionarySettings extends ListFragment {
|
||||||
// closing the cursor, so take care when resolving this TODO). We should either use a
|
// closing the cursor, so take care when resolving this TODO). We should either use a
|
||||||
// regular query and close the cursor, or switch to a LoaderManager and a CursorLoader.
|
// regular query and close the cursor, or switch to a LoaderManager and a CursorLoader.
|
||||||
mCursor = createCursor(locale);
|
mCursor = createCursor(locale);
|
||||||
TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
|
TextView emptyView = getView().findViewById(android.R.id.empty);
|
||||||
emptyView.setText(R.string.user_dict_settings_empty_text);
|
emptyView.setText(R.string.user_dict_settings_empty_text);
|
||||||
|
|
||||||
final ListView listView = getListView();
|
final ListView listView = getListView();
|
||||||
|
|
|
@ -68,7 +68,7 @@ public final class AdditionalSubtypeUtils {
|
||||||
getPlatformVersionIndependentSubtypeId(localeString, keyboardLayoutSetName);
|
getPlatformVersionIndependentSubtypeId(localeString, keyboardLayoutSetName);
|
||||||
// NOTE: In KitKat and later, InputMethodSubtypeBuilder#setIsAsciiCapable is also available.
|
// NOTE: In KitKat and later, InputMethodSubtypeBuilder#setIsAsciiCapable is also available.
|
||||||
// TODO: Use InputMethodSubtypeBuilder#setIsAsciiCapable when appropriate.
|
// TODO: Use InputMethodSubtypeBuilder#setIsAsciiCapable when appropriate.
|
||||||
return InputMethodSubtypeCompatUtils.newInputMethodSubtype(nameId,
|
return new InputMethodSubtype(nameId,
|
||||||
R.drawable.ic_ime_switcher_dark, localeString, KEYBOARD_MODE,
|
R.drawable.ic_ime_switcher_dark, localeString, KEYBOARD_MODE,
|
||||||
platformVersionDependentExtraValues,
|
platformVersionDependentExtraValues,
|
||||||
false /* isAuxiliary */, false /* overrideImplicitlyEnabledSubtype */,
|
false /* isAuxiliary */, false /* overrideImplicitlyEnabledSubtype */,
|
||||||
|
@ -107,7 +107,7 @@ public final class AdditionalSubtypeUtils {
|
||||||
final String[] prefSubtypeArray = prefSubtypes.split(PREF_SUBTYPE_SEPARATOR);
|
final String[] prefSubtypeArray = prefSubtypes.split(PREF_SUBTYPE_SEPARATOR);
|
||||||
final ArrayList<InputMethodSubtype> subtypesList = new ArrayList<>(prefSubtypeArray.length);
|
final ArrayList<InputMethodSubtype> subtypesList = new ArrayList<>(prefSubtypeArray.length);
|
||||||
for (final String prefSubtype : prefSubtypeArray) {
|
for (final String prefSubtype : prefSubtypeArray) {
|
||||||
final String elems[] = prefSubtype.split(LOCALE_AND_LAYOUT_SEPARATOR);
|
final String[] elems = prefSubtype.split(LOCALE_AND_LAYOUT_SEPARATOR);
|
||||||
if (elems.length != LENGTH_WITHOUT_EXTRA_VALUE
|
if (elems.length != LENGTH_WITHOUT_EXTRA_VALUE
|
||||||
&& elems.length != LENGTH_WITH_EXTRA_VALUE) {
|
&& elems.length != LENGTH_WITH_EXTRA_VALUE) {
|
||||||
Log.w(TAG, "Unknown additional subtype specified: " + prefSubtype + " in "
|
Log.w(TAG, "Unknown additional subtype specified: " + prefSubtype + " in "
|
||||||
|
|
|
@ -89,7 +89,7 @@ public final class DebugLogUtils {
|
||||||
if (!sDBG) return;
|
if (!sDBG) return;
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
for (final Object o : args) {
|
for (final Object o : args) {
|
||||||
sb.append(s(o).toString());
|
sb.append(s(o));
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
}
|
}
|
||||||
Log.e(TAG, sb.toString());
|
Log.e(TAG, sb.toString());
|
||||||
|
@ -106,7 +106,7 @@ public final class DebugLogUtils {
|
||||||
if (!sDBG) return;
|
if (!sDBG) return;
|
||||||
final StringBuilder sb = new StringBuilder("\u001B[31m");
|
final StringBuilder sb = new StringBuilder("\u001B[31m");
|
||||||
for (final Object o : args) {
|
for (final Object o : args) {
|
||||||
sb.append(s(o).toString());
|
sb.append(s(o));
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
}
|
}
|
||||||
sb.append("\u001B[0m");
|
sb.append("\u001B[0m");
|
||||||
|
|
|
@ -62,7 +62,7 @@ public final class JsonUtils {
|
||||||
} finally {
|
} finally {
|
||||||
close(reader);
|
close(reader);
|
||||||
}
|
}
|
||||||
return Collections.<Object>emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String listToJsonStr(final List<Object> list) {
|
public static String listToJsonStr(final List<Object> list) {
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
<array
|
<array
|
||||||
name="emoji_nature"
|
name="emoji_nature"
|
||||||
format="string"
|
format="string"
|
||||||
>
|
>1f415
|
||||||
<!-- <item>1f415</item> -->
|
|
||||||
<item>1f436</item>
|
<item>1f436</item>
|
||||||
<item>1f429</item>
|
<item>1f429</item>
|
||||||
<!-- <item>1f408</item> -->
|
<!-- <item>1f408</item> -->
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
android:title="@string/enable_split_keyboard"
|
android:title="@string/enable_split_keyboard"
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_show_language_switch_key"
|
||||||
|
android:title="Show language switch key"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:persistent="true" />
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="pref_resize_keyboard"
|
android:key="pref_resize_keyboard"
|
||||||
android:title="@string/prefs_resize_keyboard"
|
android:title="@string/prefs_resize_keyboard"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue