mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-18 16:03:12 +00:00
work off some "todo"s, mostly related to colors
make threshold score for autocorrect depedent on autocorrect threshold
This commit is contained in:
parent
eebaa2881b
commit
bc9150b007
17 changed files with 75 additions and 140 deletions
|
@ -150,8 +150,8 @@ public class KeyboardView extends View {
|
||||||
mKeyBackground.getPadding(mKeyBackgroundPadding);
|
mKeyBackground.getPadding(mKeyBackgroundPadding);
|
||||||
mFunctionalKeyBackground = mColors.getDrawable(BackgroundType.FUNCTIONAL, keyboardViewAttr);
|
mFunctionalKeyBackground = mColors.getDrawable(BackgroundType.FUNCTIONAL, keyboardViewAttr);
|
||||||
mSpacebarBackground = mColors.getDrawable(BackgroundType.SPACE, keyboardViewAttr);
|
mSpacebarBackground = mColors.getDrawable(BackgroundType.SPACE, keyboardViewAttr);
|
||||||
if (this instanceof MoreKeysKeyboardView && mColors.getThemeStyle().equals(KeyboardTheme.THEME_STYLE_HOLO)) // todo: this logic should be in Colors
|
if (this instanceof MoreKeysKeyboardView)
|
||||||
mActionKeyBackground = mColors.getDrawable(BackgroundType.ADJUSTED_BACKGROUND, keyboardViewAttr);
|
mActionKeyBackground = mColors.getDrawable(BackgroundType.ACTION_MORE_KEYS, keyboardViewAttr);
|
||||||
else
|
else
|
||||||
mActionKeyBackground = mColors.getDrawable(BackgroundType.ACTION, keyboardViewAttr);
|
mActionKeyBackground = mColors.getDrawable(BackgroundType.ACTION, keyboardViewAttr);
|
||||||
|
|
||||||
|
@ -598,11 +598,10 @@ public class KeyboardView extends View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setKeyIconColor(Key key, Drawable icon, Keyboard keyboard) {
|
private void setKeyIconColor(Key key, Drawable icon, Keyboard keyboard) {
|
||||||
if (key.isAccentColored() && !(mColors.getThemeStyle().equals(KeyboardTheme.THEME_STYLE_HOLO))) { // todo: this logic should not be here
|
if (key.isAccentColored()) {
|
||||||
icon.setColorFilter(mColors.getActionKeyIconColorFilter());
|
icon.setColorFilter(mColors.getActionKeyIconColorFilter());
|
||||||
} else if (key.isShift() && keyboard != null) {
|
} else if (key.isShift() && keyboard != null) {
|
||||||
// todo (idea): replace shift icon with white one and use the normal multiply filters
|
// todo: switch to multiply after changing keyboard symbols to white icons
|
||||||
// this could allow different shift icon with nicer coloring
|
|
||||||
if (keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED
|
if (keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED
|
||||||
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED
|
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED
|
||||||
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED
|
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED
|
||||||
|
|
|
@ -164,7 +164,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
||||||
|
|
||||||
// Gesture floating preview text
|
// Gesture floating preview text
|
||||||
// TODO: Make this parameter customizable by user via settings.
|
// TODO: Make this parameter customizable by user via settings.
|
||||||
private int mGestureFloatingPreviewTextLingerTimeout;
|
private final int mGestureFloatingPreviewTextLingerTimeout;
|
||||||
|
|
||||||
private final KeyDetector mKeyDetector;
|
private final KeyDetector mKeyDetector;
|
||||||
private final NonDistinctMultitouchHelper mNonDistinctMultitouchHelper;
|
private final NonDistinctMultitouchHelper mNonDistinctMultitouchHelper;
|
||||||
|
@ -218,10 +218,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
||||||
mLanguageOnSpacebarTextRatio = mainKeyboardViewAttr.getFraction(
|
mLanguageOnSpacebarTextRatio = mainKeyboardViewAttr.getFraction(
|
||||||
R.styleable.MainKeyboardView_languageOnSpacebarTextRatio, 1, 1, 1.0f);
|
R.styleable.MainKeyboardView_languageOnSpacebarTextRatio, 1, 1, 1.0f);
|
||||||
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
final Colors colors = Settings.getInstance().getCurrent().mColors;
|
||||||
if (colors.getThemeStyle().equals(KeyboardTheme.THEME_STYLE_HOLO)) // todo: this logic should be in Colors
|
mLanguageOnSpacebarTextColor = colors.getSpaceBarText(); //mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_languageOnSpacebarTextColor, 0);
|
||||||
mLanguageOnSpacebarTextColor = colors.getKeyText();
|
|
||||||
else
|
|
||||||
mLanguageOnSpacebarTextColor = colors.getKeyHintText(); //mainKeyboardViewAttr.getColor(R.styleable.MainKeyboardView_languageOnSpacebarTextColor, 0);
|
|
||||||
mLanguageOnSpacebarTextShadowRadius = mainKeyboardViewAttr.getFloat(
|
mLanguageOnSpacebarTextShadowRadius = mainKeyboardViewAttr.getFloat(
|
||||||
R.styleable.MainKeyboardView_languageOnSpacebarTextShadowRadius,
|
R.styleable.MainKeyboardView_languageOnSpacebarTextShadowRadius,
|
||||||
LANGUAGE_ON_SPACEBAR_TEXT_SHADOW_RADIUS_DISABLED);
|
LANGUAGE_ON_SPACEBAR_TEXT_SHADOW_RADIUS_DISABLED);
|
||||||
|
@ -541,9 +538,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
||||||
public void showGestureFloatingPreviewText(@NonNull final SuggestedWords suggestedWords,
|
public void showGestureFloatingPreviewText(@NonNull final SuggestedWords suggestedWords,
|
||||||
final boolean dismissDelayed) {
|
final boolean dismissDelayed) {
|
||||||
locatePreviewPlacerView();
|
locatePreviewPlacerView();
|
||||||
final GestureFloatingTextDrawingPreview gestureFloatingTextDrawingPreview =
|
mGestureFloatingTextDrawingPreview.setSuggestedWords(suggestedWords);
|
||||||
mGestureFloatingTextDrawingPreview;
|
|
||||||
gestureFloatingTextDrawingPreview.setSuggestedWords(suggestedWords);
|
|
||||||
if (dismissDelayed) {
|
if (dismissDelayed) {
|
||||||
mTimerHandler.postDismissGestureFloatingPreviewText(
|
mTimerHandler.postDismissGestureFloatingPreviewText(
|
||||||
mGestureFloatingPreviewTextLingerTimeout);
|
mGestureFloatingPreviewTextLingerTimeout);
|
||||||
|
@ -919,7 +914,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
||||||
// Draw language text with shadow
|
// Draw language text with shadow
|
||||||
final float descent = paint.descent();
|
final float descent = paint.descent();
|
||||||
final float textHeight = -paint.ascent() + descent;
|
final float textHeight = -paint.ascent() + descent;
|
||||||
final float baseline = height / 2 + textHeight / 2;
|
final float baseline = height / 2f + textHeight / 2;
|
||||||
if (mLanguageOnSpacebarTextShadowRadius > 0.0f) {
|
if (mLanguageOnSpacebarTextShadowRadius > 0.0f) {
|
||||||
paint.setShadowLayer(mLanguageOnSpacebarTextShadowRadius, 0, 0,
|
paint.setShadowLayer(mLanguageOnSpacebarTextShadowRadius, 0, 0,
|
||||||
mLanguageOnSpacebarTextShadowColor);
|
mLanguageOnSpacebarTextShadowColor);
|
||||||
|
@ -928,7 +923,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
||||||
}
|
}
|
||||||
paint.setColor(mLanguageOnSpacebarTextColor);
|
paint.setColor(mLanguageOnSpacebarTextColor);
|
||||||
paint.setAlpha(mLanguageOnSpacebarAnimAlpha);
|
paint.setAlpha(mLanguageOnSpacebarAnimAlpha);
|
||||||
canvas.drawText(language, width / 2, baseline - descent, paint);
|
canvas.drawText(language, width / 2f, baseline - descent, paint);
|
||||||
paint.clearShadowLayer();
|
paint.clearShadowLayer();
|
||||||
paint.setTextScaleX(1.0f);
|
paint.setTextScaleX(1.0f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme
|
|
||||||
import org.dslul.openboard.inputmethod.latin.ClipboardHistoryEntry
|
import org.dslul.openboard.inputmethod.latin.ClipboardHistoryEntry
|
||||||
import org.dslul.openboard.inputmethod.latin.ClipboardHistoryManager
|
import org.dslul.openboard.inputmethod.latin.ClipboardHistoryManager
|
||||||
import org.dslul.openboard.inputmethod.latin.R
|
import org.dslul.openboard.inputmethod.latin.R
|
||||||
|
@ -69,8 +68,7 @@ class ClipboardAdapter(
|
||||||
}
|
}
|
||||||
clipboardLayoutParams.setItemProperties(view)
|
clipboardLayoutParams.setItemProperties(view)
|
||||||
val colors = Settings.getInstance().current.mColors
|
val colors = Settings.getInstance().current.mColors
|
||||||
if (colors.themeStyle == KeyboardTheme.THEME_STYLE_HOLO) // todo: this logic should be in Colors, not here
|
pinnedIconView.colorFilter = colors.clipboardPinFilter
|
||||||
pinnedIconView.colorFilter = colors.accentColorFilter
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setContent(historyEntry: ClipboardHistoryEntry?) {
|
fun setContent(historyEntry: ClipboardHistoryEntry?) {
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package org.dslul.openboard.inputmethod.keyboard.clipboard
|
package org.dslul.openboard.inputmethod.keyboard.clipboard
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Canvas
|
|
||||||
import android.graphics.Paint
|
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import org.dslul.openboard.inputmethod.latin.settings.Settings
|
|
||||||
|
|
||||||
class ClipboardHistoryRecyclerView @JvmOverloads constructor(
|
class ClipboardHistoryRecyclerView @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
|
@ -56,25 +53,4 @@ class ClipboardHistoryRecyclerView @JvmOverloads constructor(
|
||||||
adapter?.registerAdapterDataObserver(adapterDataObserver)
|
adapter?.registerAdapterDataObserver(adapterDataObserver)
|
||||||
}
|
}
|
||||||
|
|
||||||
class BottomDividerItemDecoration(dividerHeight: Int, dividerColor: Int) : RecyclerView.ItemDecoration() {
|
|
||||||
|
|
||||||
private val paint = Paint()
|
|
||||||
|
|
||||||
init {
|
|
||||||
paint.color = dividerColor
|
|
||||||
paint.strokeWidth = dividerHeight.toFloat()
|
|
||||||
paint.colorFilter = Settings.getInstance().current.mColors.getThatBackgroundFilter()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDrawOver(canvas: Canvas, parent: RecyclerView, state: State) {
|
|
||||||
super.onDrawOver(canvas, parent, state)
|
|
||||||
canvas.drawLine(parent.paddingLeft.toFloat(),
|
|
||||||
parent.height - paint.strokeWidth / 2,
|
|
||||||
parent.width.toFloat() - parent.paddingRight.toFloat(),
|
|
||||||
parent.height - paint.strokeWidth / 2 ,
|
|
||||||
paint
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
package org.dslul.openboard.inputmethod.keyboard.clipboard
|
package org.dslul.openboard.inputmethod.keyboard.clipboard
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
|
@ -31,7 +30,6 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
|
|
||||||
private val clipboardLayoutParams = ClipboardLayoutParams(context.resources)
|
private val clipboardLayoutParams = ClipboardLayoutParams(context.resources)
|
||||||
private val pinIconId: Int
|
private val pinIconId: Int
|
||||||
private val dividerColor: Int
|
|
||||||
private val functionalKeyBackgroundId: Int
|
private val functionalKeyBackgroundId: Int
|
||||||
private val keyBackgroundId: Int
|
private val keyBackgroundId: Int
|
||||||
|
|
||||||
|
@ -47,15 +45,10 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
init {
|
init {
|
||||||
val clipboardViewAttr = context.obtainStyledAttributes(attrs,
|
val clipboardViewAttr = context.obtainStyledAttributes(attrs,
|
||||||
R.styleable.ClipboardHistoryView, defStyle, R.style.ClipboardHistoryView)
|
R.styleable.ClipboardHistoryView, defStyle, R.style.ClipboardHistoryView)
|
||||||
pinIconId = clipboardViewAttr.getResourceId(
|
pinIconId = clipboardViewAttr.getResourceId(R.styleable.ClipboardHistoryView_iconPinnedClip, 0)
|
||||||
R.styleable.ClipboardHistoryView_iconPinnedClip, 0)
|
|
||||||
// todo: remove the divider completely?
|
|
||||||
dividerColor = Color.TRANSPARENT //clipboardViewAttr.getColor(R.styleable.ClipboardHistoryView_dividerBackground, 0)
|
|
||||||
clipboardViewAttr.recycle()
|
clipboardViewAttr.recycle()
|
||||||
val keyboardViewAttr = context.obtainStyledAttributes(attrs,
|
val keyboardViewAttr = context.obtainStyledAttributes(attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView)
|
||||||
R.styleable.KeyboardView, defStyle, R.style.KeyboardView)
|
keyBackgroundId = keyboardViewAttr.getResourceId(R.styleable.KeyboardView_keyBackground, 0)
|
||||||
keyBackgroundId = keyboardViewAttr.getResourceId(
|
|
||||||
R.styleable.KeyboardView_keyBackground, 0)
|
|
||||||
functionalKeyBackgroundId = keyboardViewAttr.getResourceId(
|
functionalKeyBackgroundId = keyboardViewAttr.getResourceId(
|
||||||
R.styleable.KeyboardView_functionalKeyBackground, keyBackgroundId)
|
R.styleable.KeyboardView_functionalKeyBackground, keyBackgroundId)
|
||||||
keyboardViewAttr.recycle()
|
keyboardViewAttr.recycle()
|
||||||
|
@ -65,8 +58,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||||
val res = context.resources
|
val res = context.resources
|
||||||
// The main keyboard expands to the entire this {@link KeyboardView}.
|
// The main keyboard expands to the entire this {@link KeyboardView}.
|
||||||
val width = (ResourceUtils.getDefaultKeyboardWidth(res)
|
val width = (ResourceUtils.getDefaultKeyboardWidth(res) + paddingLeft + paddingRight)
|
||||||
+ paddingLeft + paddingRight)
|
|
||||||
val height = (ResourceUtils.getDefaultKeyboardHeight(res)
|
val height = (ResourceUtils.getDefaultKeyboardHeight(res)
|
||||||
+ res.getDimensionPixelSize(R.dimen.config_suggestions_strip_height)
|
+ res.getDimensionPixelSize(R.dimen.config_suggestions_strip_height)
|
||||||
+ paddingTop + paddingBottom)
|
+ paddingTop + paddingBottom)
|
||||||
|
@ -85,9 +77,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
|
||||||
clipboardRecyclerView = findViewById<ClipboardHistoryRecyclerView>(R.id.clipboard_list).apply {
|
clipboardRecyclerView = findViewById<ClipboardHistoryRecyclerView>(R.id.clipboard_list).apply {
|
||||||
val colCount = resources.getInteger(R.integer.config_clipboard_keyboard_col_count)
|
val colCount = resources.getInteger(R.integer.config_clipboard_keyboard_col_count)
|
||||||
layoutManager = StaggeredGridLayoutManager(colCount, StaggeredGridLayoutManager.VERTICAL)
|
layoutManager = StaggeredGridLayoutManager(colCount, StaggeredGridLayoutManager.VERTICAL)
|
||||||
val dividerHeight = resources.getDimensionPixelSize(R.dimen.config_clipboard_divider_height)
|
@Suppress("deprecation") // "no cache" should be fine according to warning in https://developer.android.com/reference/android/view/ViewGroup#setPersistentDrawingCache(int)
|
||||||
addItemDecoration(ClipboardHistoryRecyclerView.BottomDividerItemDecoration(dividerHeight, dividerColor))
|
|
||||||
@Suppress("deprecation") // no cache should be fine according to warning in https://developer.android.com/reference/android/view/ViewGroup#setPersistentDrawingCache(int)
|
|
||||||
persistentDrawingCache = PERSISTENT_NO_CACHE
|
persistentDrawingCache = PERSISTENT_NO_CACHE
|
||||||
clipboardLayoutParams.setListProperties(this)
|
clipboardLayoutParams.setListProperties(this)
|
||||||
placeholderView = this@ClipboardHistoryView.placeholderView
|
placeholderView = this@ClipboardHistoryView.placeholderView
|
||||||
|
|
|
@ -211,7 +211,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
final RestartAfterDeviceUnlockReceiver mRestartAfterDeviceUnlockReceiver = new RestartAfterDeviceUnlockReceiver();
|
final RestartAfterDeviceUnlockReceiver mRestartAfterDeviceUnlockReceiver = new RestartAfterDeviceUnlockReceiver();
|
||||||
|
|
||||||
private AlertDialog mOptionsDialog; // todo: this is always null -> remove?
|
private AlertDialog mOptionsDialog;
|
||||||
|
|
||||||
private final boolean mIsHardwareAcceleratedDrawingEnabled;
|
private final boolean mIsHardwareAcceleratedDrawingEnabled;
|
||||||
|
|
||||||
|
@ -1419,8 +1419,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
if (isShowingOptionDialog()) return false;
|
if (isShowingOptionDialog()) return false;
|
||||||
if (requestCode == Constants.CUSTOM_CODE_SHOW_INPUT_METHOD_PICKER) {
|
if (requestCode == Constants.CUSTOM_CODE_SHOW_INPUT_METHOD_PICKER) {
|
||||||
if (mRichImm.hasMultipleEnabledIMEsOrSubtypes(true /* include aux subtypes */)) {
|
if (mRichImm.hasMultipleEnabledIMEsOrSubtypes(true /* include aux subtypes */)) {
|
||||||
InputMethodPickerKt.showInputMethodPicker(this, mRichImm, mKeyboardSwitcher.getMainKeyboardView().getWindowToken());
|
mOptionsDialog = InputMethodPickerKt.createInputMethodPickerDialog(this, mRichImm, mKeyboardSwitcher.getMainKeyboardView().getWindowToken());
|
||||||
return true; // todo: don't show and return if dialog already shown? but how can this happen?
|
mOptionsDialog.show();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,9 @@ import org.dslul.openboard.inputmethod.latin.utils.SubtypeLocaleUtils;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.dslul.openboard.inputmethod.latin.common.Constants.Subtype.KEYBOARD_MODE;
|
import static org.dslul.openboard.inputmethod.latin.common.Constants.Subtype.KEYBOARD_MODE;
|
||||||
|
|
||||||
|
@ -392,38 +390,13 @@ public class RichInputMethodManager {
|
||||||
updateShortcutIme();
|
updateShortcutIme();
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: remove?
|
|
||||||
public boolean isSystemLocaleSameAsLocaleOfAllEnabledSubtypesOfEnabledImes() {
|
|
||||||
final Locale systemLocale = mContext.getResources().getConfiguration().locale;
|
|
||||||
final Set<InputMethodSubtype> enabledSubtypesOfEnabledImes = new HashSet<>();
|
|
||||||
final InputMethodManager inputMethodManager = getInputMethodManager();
|
|
||||||
final List<InputMethodInfo> enabledInputMethodInfoList =
|
|
||||||
inputMethodManager.getEnabledInputMethodList();
|
|
||||||
for (final InputMethodInfo info : enabledInputMethodInfoList) {
|
|
||||||
final List<InputMethodSubtype> enabledSubtypes =
|
|
||||||
inputMethodManager.getEnabledInputMethodSubtypeList(
|
|
||||||
info, true /* allowsImplicitlySelectedSubtypes */);
|
|
||||||
if (enabledSubtypes.isEmpty()) {
|
|
||||||
// An IME with no subtypes is found.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
enabledSubtypesOfEnabledImes.addAll(enabledSubtypes);
|
|
||||||
}
|
|
||||||
for (final InputMethodSubtype subtype : enabledSubtypesOfEnabledImes) {
|
|
||||||
if (!subtype.isAuxiliary() && !subtype.getLocale().isEmpty()
|
|
||||||
&& !systemLocale.equals(SubtypeLocaleUtils.getSubtypeLocale(subtype))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateCurrentSubtype(final InputMethodSubtype subtype) {
|
private void updateCurrentSubtype(final InputMethodSubtype subtype) {
|
||||||
SubtypeSettingsKt.setSelectedSubtype(DeviceProtectedUtils.getSharedPreferences(mContext), subtype);
|
SubtypeSettingsKt.setSelectedSubtype(DeviceProtectedUtils.getSharedPreferences(mContext), subtype);
|
||||||
mCurrentRichInputMethodSubtype = RichInputMethodSubtype.getRichInputMethodSubtype(subtype);
|
mCurrentRichInputMethodSubtype = RichInputMethodSubtype.getRichInputMethodSubtype(subtype);
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: what is shortcutIme? the voice input? if yes, rename it and other things like mHasShortcutKey
|
// todo: is shortcutIme only voice input, or can it be something else?
|
||||||
|
// if always voice input, rename it and other things like mHasShortcutKey
|
||||||
private void updateShortcutIme() {
|
private void updateShortcutIme() {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "Update shortcut IME from : "
|
Log.d(TAG, "Update shortcut IME from : "
|
||||||
|
@ -495,12 +468,6 @@ public class RichInputMethodManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShortcutImeReady() {
|
public boolean isShortcutImeReady() {
|
||||||
if (mShortcutInputMethodInfo == null) {
|
return mShortcutInputMethodInfo != null;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (mShortcutSubtype == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.dslul.openboard.inputmethod.latin.common.Constants;
|
||||||
import org.dslul.openboard.inputmethod.latin.common.InputPointers;
|
import org.dslul.openboard.inputmethod.latin.common.InputPointers;
|
||||||
import org.dslul.openboard.inputmethod.latin.common.StringUtils;
|
import org.dslul.openboard.inputmethod.latin.common.StringUtils;
|
||||||
import org.dslul.openboard.inputmethod.latin.define.DebugFlags;
|
import org.dslul.openboard.inputmethod.latin.define.DebugFlags;
|
||||||
|
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||||
import org.dslul.openboard.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
import org.dslul.openboard.inputmethod.latin.settings.SettingsValuesForSuggestion;
|
||||||
import org.dslul.openboard.inputmethod.latin.utils.AutoCorrectionUtils;
|
import org.dslul.openboard.inputmethod.latin.utils.AutoCorrectionUtils;
|
||||||
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
|
import com.android.inputmethod.latin.utils.BinaryDictionaryUtils;
|
||||||
|
@ -306,9 +307,6 @@ public final class Suggest {
|
||||||
final int firstOccurrenceOfTypedWordInSuggestions,
|
final int firstOccurrenceOfTypedWordInSuggestions,
|
||||||
final SuggestedWordInfo typedWordFirstOccurrenceWordInfo
|
final SuggestedWordInfo typedWordFirstOccurrenceWordInfo
|
||||||
) {
|
) {
|
||||||
// todo:
|
|
||||||
// tune the suggestion score thresholds (currently 900k, maybe should depend on autocorrect)
|
|
||||||
// maybe tune the empty word suggestion min difference (currently 20, seems quite ok)
|
|
||||||
final String consideredWord = trailingSingleQuotesCount > 0
|
final String consideredWord = trailingSingleQuotesCount > 0
|
||||||
? typedWordString.substring(0, typedWordString.length() - trailingSingleQuotesCount)
|
? typedWordString.substring(0, typedWordString.length() - trailingSingleQuotesCount)
|
||||||
: typedWordString;
|
: typedWordString;
|
||||||
|
@ -322,6 +320,7 @@ public final class Suggest {
|
||||||
// We allow auto-correction if whitelisting is not required or the word is whitelisted,
|
// We allow auto-correction if whitelisting is not required or the word is whitelisted,
|
||||||
// or if the word had more than one char and was not suggested.
|
// or if the word had more than one char and was not suggested.
|
||||||
final boolean allowsToBeAutoCorrected;
|
final boolean allowsToBeAutoCorrected;
|
||||||
|
final int scoreLimit = Settings.getInstance().getCurrent().mScoreLimitForAutocorrect;
|
||||||
if ((SHOULD_AUTO_CORRECT_USING_NON_WHITE_LISTED_SUGGESTION || whitelistedWord != null)
|
if ((SHOULD_AUTO_CORRECT_USING_NON_WHITE_LISTED_SUGGESTION || whitelistedWord != null)
|
||||||
|| (consideredWord.length() > 1 && (sourceDictionaryOfRemovedWord == null)) // more than 1 letter and not in dictionary
|
|| (consideredWord.length() > 1 && (sourceDictionaryOfRemovedWord == null)) // more than 1 letter and not in dictionary
|
||||||
) {
|
) {
|
||||||
|
@ -331,7 +330,7 @@ public final class Suggest {
|
||||||
putEmptyWordSuggestions.run();
|
putEmptyWordSuggestions.run();
|
||||||
final SuggestedWordInfo first = firstAndTypedWordEmptyInfos.get(0);
|
final SuggestedWordInfo first = firstAndTypedWordEmptyInfos.get(0);
|
||||||
final SuggestedWordInfo typed = firstAndTypedWordEmptyInfos.get(1);
|
final SuggestedWordInfo typed = firstAndTypedWordEmptyInfos.get(1);
|
||||||
if (firstSuggestionInContainer.mScore > 900000) {
|
if (firstSuggestionInContainer.mScore > scoreLimit) {
|
||||||
allowsToBeAutoCorrected = true; // suggestion has good score, allow
|
allowsToBeAutoCorrected = true; // suggestion has good score, allow
|
||||||
} else if (first == null) {
|
} else if (first == null) {
|
||||||
allowsToBeAutoCorrected = false; // no autocorrect if first suggestion unknown in this context
|
allowsToBeAutoCorrected = false; // no autocorrect if first suggestion unknown in this context
|
||||||
|
@ -396,23 +395,21 @@ public final class Suggest {
|
||||||
// is determined, see #isAllowedByAutoCorrectionWithSpaceFilter.
|
// is determined, see #isAllowedByAutoCorrectionWithSpaceFilter.
|
||||||
// TODO: this should not have its own logic here but be handled by the dictionary.
|
// TODO: this should not have its own logic here but be handled by the dictionary.
|
||||||
final boolean allowed = isAllowedByAutoCorrectionWithSpaceFilter(firstSuggestion);
|
final boolean allowed = isAllowedByAutoCorrectionWithSpaceFilter(firstSuggestion);
|
||||||
if (allowed && typedWordFirstOccurrenceWordInfo != null && typedWordFirstOccurrenceWordInfo.mScore > 900000) {
|
if (allowed && typedWordFirstOccurrenceWordInfo != null && typedWordFirstOccurrenceWordInfo.mScore > scoreLimit) {
|
||||||
// typed word is valid and has good score
|
// typed word is valid and has good score
|
||||||
// do not auto-correct if typed word is better match than first suggestion
|
// do not auto-correct if typed word is better match than first suggestion
|
||||||
final SuggestedWordInfo first = firstSuggestionInContainer != null ? firstSuggestionInContainer : firstSuggestion;
|
final SuggestedWordInfo first = firstSuggestionInContainer != null ? firstSuggestionInContainer : firstSuggestion;
|
||||||
final Locale dictLocale = dictionaryFacilitator.getCurrentLocale();
|
final Locale dictLocale = dictionaryFacilitator.getCurrentLocale();
|
||||||
|
|
||||||
if (first.mScore < 900000) {
|
if (first.mScore < scoreLimit) {
|
||||||
// don't allow if suggestion has too low score
|
// don't allow if suggestion has too low score
|
||||||
// todo: maybe lower this to ~600k? 500k will be too aggressive
|
|
||||||
// or make it depend on autocorrect threshold
|
|
||||||
return new boolean[]{ true, false };
|
return new boolean[]{ true, false };
|
||||||
}
|
}
|
||||||
if (first.mSourceDict.mLocale != typedWordFirstOccurrenceWordInfo.mSourceDict.mLocale) {
|
if (first.mSourceDict.mLocale != typedWordFirstOccurrenceWordInfo.mSourceDict.mLocale) {
|
||||||
// dict locale different -> return the better match
|
// dict locale different -> return the better match
|
||||||
return new boolean[]{ true, dictLocale == first.mSourceDict.mLocale };
|
return new boolean[]{ true, dictLocale == first.mSourceDict.mLocale };
|
||||||
}
|
}
|
||||||
// todo: this may need tuning, especially the score difference thing
|
// the score difference may need tuning, but so far it seems alright
|
||||||
final int firstWordBonusScore = (first.isKindOf(SuggestedWordInfo.KIND_WHITELIST) ? 20 : 0) // large bonus because it's wanted by dictionary
|
final int firstWordBonusScore = (first.isKindOf(SuggestedWordInfo.KIND_WHITELIST) ? 20 : 0) // large bonus because it's wanted by dictionary
|
||||||
+ (StringUtils.isLowerCaseAscii(typedWordString) ? 5 : 0) // small bonus because typically only ascii is typed (applies to latin keyboards only)
|
+ (StringUtils.isLowerCaseAscii(typedWordString) ? 5 : 0) // small bonus because typically only ascii is typed (applies to latin keyboards only)
|
||||||
+ (first.mScore > typedWordFirstOccurrenceWordInfo.mScore ? 5 : 0); // small bonus if score is higher
|
+ (first.mScore > typedWordFirstOccurrenceWordInfo.mScore ? 5 : 0); // small bonus if score is higher
|
||||||
|
|
|
@ -11,7 +11,8 @@ import android.view.View
|
||||||
import androidx.core.graphics.BlendModeColorFilterCompat
|
import androidx.core.graphics.BlendModeColorFilterCompat
|
||||||
import androidx.core.graphics.BlendModeCompat
|
import androidx.core.graphics.BlendModeCompat
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme
|
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme.THEME_STYLE_HOLO
|
||||||
|
import org.dslul.openboard.inputmethod.keyboard.KeyboardTheme.THEME_STYLE_MATERIAL
|
||||||
import org.dslul.openboard.inputmethod.keyboard.MoreKeysKeyboardView
|
import org.dslul.openboard.inputmethod.keyboard.MoreKeysKeyboardView
|
||||||
import org.dslul.openboard.inputmethod.keyboard.emoji.EmojiPageKeyboardView
|
import org.dslul.openboard.inputmethod.keyboard.emoji.EmojiPageKeyboardView
|
||||||
import org.dslul.openboard.inputmethod.latin.R
|
import org.dslul.openboard.inputmethod.latin.R
|
||||||
|
@ -33,6 +34,7 @@ class Colors (
|
||||||
val navBar: Int
|
val navBar: Int
|
||||||
val adjustedBackground: Int
|
val adjustedBackground: Int
|
||||||
val adjustedKeyText: Int
|
val adjustedKeyText: Int
|
||||||
|
val spaceBarText: Int
|
||||||
|
|
||||||
// todo (later): evaluate which colors, colorFilters and colorStateLists are actually necessary
|
// todo (later): evaluate which colors, colorFilters and colorStateLists are actually necessary
|
||||||
// also, ideally the color filters would be private and chosen internally depending on type
|
// also, ideally the color filters would be private and chosen internally depending on type
|
||||||
|
@ -48,6 +50,7 @@ class Colors (
|
||||||
val keyTextFilter: ColorFilter
|
val keyTextFilter: ColorFilter
|
||||||
val accentColorFilter: ColorFilter
|
val accentColorFilter: ColorFilter
|
||||||
val actionKeyIconColorFilter: ColorFilter?
|
val actionKeyIconColorFilter: ColorFilter?
|
||||||
|
val clipboardPinFilter: ColorFilter?
|
||||||
|
|
||||||
private val backgroundStateList: ColorStateList
|
private val backgroundStateList: ColorStateList
|
||||||
private val keyStateList: ColorStateList
|
private val keyStateList: ColorStateList
|
||||||
|
@ -59,13 +62,18 @@ class Colors (
|
||||||
val keyboardBackground: Drawable?
|
val keyboardBackground: Drawable?
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (themeStyle == KeyboardTheme.THEME_STYLE_HOLO) {
|
accentColorFilter = colorFilter(accent)
|
||||||
|
if (themeStyle == THEME_STYLE_HOLO) {
|
||||||
val darkerBackground = adjustLuminosityAndKeepAlpha(background, -0.2f)
|
val darkerBackground = adjustLuminosityAndKeepAlpha(background, -0.2f)
|
||||||
navBar = darkerBackground
|
navBar = darkerBackground
|
||||||
keyboardBackground = GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, intArrayOf(background, darkerBackground))
|
keyboardBackground = GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, intArrayOf(background, darkerBackground))
|
||||||
|
spaceBarText = keyText
|
||||||
|
clipboardPinFilter = accentColorFilter
|
||||||
} else {
|
} else {
|
||||||
navBar = background
|
navBar = background
|
||||||
keyboardBackground = null
|
keyboardBackground = null
|
||||||
|
spaceBarText = keyHintText
|
||||||
|
clipboardPinFilter = null
|
||||||
}
|
}
|
||||||
|
|
||||||
// create color filters, todo: maybe better / simplify
|
// create color filters, todo: maybe better / simplify
|
||||||
|
@ -92,12 +100,12 @@ class Colors (
|
||||||
functionalKeyBackgroundFilter = colorFilter(functionalKey)
|
functionalKeyBackgroundFilter = colorFilter(functionalKey)
|
||||||
spaceBarFilter = colorFilter(spaceBar)
|
spaceBarFilter = colorFilter(spaceBar)
|
||||||
backgroundStateList = stateList(brightenOrDarken(background, true), background)
|
backgroundStateList = stateList(brightenOrDarken(background, true), background)
|
||||||
keyStateList = if (themeStyle == KeyboardTheme.THEME_STYLE_HOLO) stateList(keyBackground, keyBackground)
|
keyStateList = if (themeStyle == THEME_STYLE_HOLO) stateList(keyBackground, keyBackground)
|
||||||
else stateList(brightenOrDarken(keyBackground, true), keyBackground)
|
else stateList(brightenOrDarken(keyBackground, true), keyBackground)
|
||||||
functionalKeyStateList = stateList(brightenOrDarken(functionalKey, true), functionalKey)
|
functionalKeyStateList = stateList(brightenOrDarken(functionalKey, true), functionalKey)
|
||||||
actionKeyStateList = if (themeStyle == KeyboardTheme.THEME_STYLE_HOLO) functionalKeyStateList
|
actionKeyStateList = if (themeStyle == THEME_STYLE_HOLO) functionalKeyStateList
|
||||||
else stateList(brightenOrDarken(accent, true), accent)
|
else stateList(brightenOrDarken(accent, true), accent)
|
||||||
spaceBarStateList = if (themeStyle == KeyboardTheme.THEME_STYLE_HOLO) stateList(spaceBar, spaceBar)
|
spaceBarStateList = if (themeStyle == THEME_STYLE_HOLO) stateList(spaceBar, spaceBar)
|
||||||
else stateList(brightenOrDarken(spaceBar, true), spaceBar)
|
else stateList(brightenOrDarken(spaceBar, true), spaceBar)
|
||||||
} else {
|
} else {
|
||||||
// need to set color to background if key borders are disabled, or there will be ugly keys
|
// need to set color to background if key borders are disabled, or there will be ugly keys
|
||||||
|
@ -107,16 +115,17 @@ class Colors (
|
||||||
backgroundStateList = stateList(brightenOrDarken(background, true), background)
|
backgroundStateList = stateList(brightenOrDarken(background, true), background)
|
||||||
keyStateList = backgroundStateList
|
keyStateList = backgroundStateList
|
||||||
functionalKeyStateList = backgroundStateList
|
functionalKeyStateList = backgroundStateList
|
||||||
actionKeyStateList = if (themeStyle == KeyboardTheme.THEME_STYLE_HOLO) functionalKeyStateList
|
actionKeyStateList = if (themeStyle == THEME_STYLE_HOLO) functionalKeyStateList
|
||||||
else stateList(brightenOrDarken(accent, true), accent)
|
else stateList(brightenOrDarken(accent, true), accent)
|
||||||
spaceBarStateList = stateList(brightenOrDarken(spaceBar, true), spaceBar)
|
spaceBarStateList = stateList(brightenOrDarken(spaceBar, true), spaceBar)
|
||||||
}
|
}
|
||||||
keyTextFilter = colorFilter(keyText, BlendModeCompat.SRC_ATOP)
|
keyTextFilter = colorFilter(keyText, BlendModeCompat.SRC_ATOP)
|
||||||
accentColorFilter = colorFilter(accent)
|
actionKeyIconColorFilter = when {
|
||||||
actionKeyIconColorFilter =
|
themeStyle == THEME_STYLE_HOLO -> keyTextFilter
|
||||||
if (isBrightColor(accent)) // the white icon may not have enough contrast, and can't be adjusted by the user
|
// the white icon may not have enough contrast, and can't be adjusted by the user
|
||||||
colorFilter(Color.DKGRAY, BlendModeCompat.SRC_ATOP)
|
isBrightColor(accent) -> colorFilter(Color.DKGRAY, BlendModeCompat.SRC_ATOP)
|
||||||
else null
|
else -> null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** set background colors including state list to the drawable */
|
/** set background colors including state list to the drawable */
|
||||||
|
@ -128,9 +137,12 @@ class Colors (
|
||||||
BackgroundType.ACTION -> actionKeyStateList
|
BackgroundType.ACTION -> actionKeyStateList
|
||||||
BackgroundType.SPACE -> spaceBarStateList
|
BackgroundType.SPACE -> spaceBarStateList
|
||||||
BackgroundType.ADJUSTED_BACKGROUND -> adjustedBackgroundStateList
|
BackgroundType.ADJUSTED_BACKGROUND -> adjustedBackgroundStateList
|
||||||
BackgroundType.SUGGESTION -> if (!hasKeyBorders && themeStyle == KeyboardTheme.THEME_STYLE_MATERIAL)
|
BackgroundType.SUGGESTION -> if (!hasKeyBorders && themeStyle == THEME_STYLE_MATERIAL)
|
||||||
adjustedBackgroundStateList
|
adjustedBackgroundStateList
|
||||||
else backgroundStateList
|
else backgroundStateList
|
||||||
|
BackgroundType.ACTION_MORE_KEYS -> if (themeStyle == THEME_STYLE_HOLO)
|
||||||
|
adjustedBackgroundStateList
|
||||||
|
else actionKeyStateList
|
||||||
}
|
}
|
||||||
DrawableCompat.setTintMode(background, PorterDuff.Mode.MULTIPLY)
|
DrawableCompat.setTintMode(background, PorterDuff.Mode.MULTIPLY)
|
||||||
DrawableCompat.setTintList(background, colorStateList)
|
DrawableCompat.setTintList(background, colorStateList)
|
||||||
|
@ -142,14 +154,18 @@ class Colors (
|
||||||
|
|
||||||
fun getDrawable(type: BackgroundType, attr: TypedArray): Drawable {
|
fun getDrawable(type: BackgroundType, attr: TypedArray): Drawable {
|
||||||
val drawable = when (type) {
|
val drawable = when (type) {
|
||||||
BackgroundType.KEY, BackgroundType.ADJUSTED_BACKGROUND, BackgroundType.BACKGROUND, BackgroundType.SUGGESTION ->
|
BackgroundType.KEY, BackgroundType.ADJUSTED_BACKGROUND, BackgroundType.BACKGROUND,
|
||||||
attr.getDrawable(R.styleable.KeyboardView_keyBackground)?.mutate()
|
BackgroundType.SUGGESTION, BackgroundType.ACTION_MORE_KEYS ->
|
||||||
BackgroundType.FUNCTIONAL -> attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)?.mutate()
|
attr.getDrawable(R.styleable.KeyboardView_keyBackground)
|
||||||
BackgroundType.SPACE -> attr.getDrawable(R.styleable.KeyboardView_spacebarBackground)?.mutate()
|
BackgroundType.FUNCTIONAL -> attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)
|
||||||
BackgroundType.ACTION -> if (themeStyle == KeyboardTheme.THEME_STYLE_HOLO && hasKeyBorders) // no borders has a very small pressed drawable otherwise
|
BackgroundType.SPACE -> attr.getDrawable(R.styleable.KeyboardView_spacebarBackground)
|
||||||
attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)?.mutate()
|
BackgroundType.ACTION -> {
|
||||||
else attr.getDrawable(R.styleable.KeyboardView_keyBackground)?.mutate()
|
if (themeStyle == THEME_STYLE_HOLO && hasKeyBorders) // no borders has a very small pressed drawable otherwise
|
||||||
} ?: attr.getDrawable(R.styleable.KeyboardView_keyBackground)?.mutate()!! // keyBackground always exists
|
attr.getDrawable(R.styleable.KeyboardView_functionalKeyBackground)
|
||||||
|
else
|
||||||
|
attr.getDrawable(R.styleable.KeyboardView_keyBackground)
|
||||||
|
}
|
||||||
|
}?.mutate() ?: attr.getDrawable(R.styleable.KeyboardView_keyBackground)?.mutate()!! // keyBackground always exists
|
||||||
|
|
||||||
setBackgroundColor(drawable, type)
|
setBackgroundColor(drawable, type)
|
||||||
return drawable
|
return drawable
|
||||||
|
@ -169,5 +185,5 @@ class Colors (
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class BackgroundType {
|
enum class BackgroundType {
|
||||||
BACKGROUND, KEY, FUNCTIONAL, ACTION, SPACE, ADJUSTED_BACKGROUND, SUGGESTION
|
BACKGROUND, KEY, FUNCTIONAL, ACTION, ACTION_MORE_KEYS, SPACE, ADJUSTED_BACKGROUND, SUGGESTION
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,12 +81,11 @@ class LanguageFakeSettingsFragment : Fragment(R.layout.language_fake_settings) {
|
||||||
sortedSubtypes.clear()
|
sortedSubtypes.clear()
|
||||||
// list of all subtypes, any subtype added to sortedSubtypes will be removed to avoid duplicates
|
// list of all subtypes, any subtype added to sortedSubtypes will be removed to avoid duplicates
|
||||||
val allSubtypes = getAllAvailableSubtypes().toMutableList()
|
val allSubtypes = getAllAvailableSubtypes().toMutableList()
|
||||||
// maybe make use of the map used by SubtypeSettings for performance reasons?
|
// todo: re-write this, it's hard to understand
|
||||||
|
// also consider that more _ZZ languages might be added
|
||||||
fun List<Locale>.sortedAddToSubtypesAndRemoveFromAllSubtypes() {
|
fun List<Locale>.sortedAddToSubtypesAndRemoveFromAllSubtypes() {
|
||||||
val subtypesToAdd = mutableListOf<SubtypeInfo>()
|
val subtypesToAdd = mutableListOf<SubtypeInfo>()
|
||||||
forEach { locale ->
|
forEach { locale ->
|
||||||
// this could be rather slow with looping multiple times over all ~100 subtypes,
|
|
||||||
// but usually there aren't many locales to be checked, and usually the first loop already finds a match
|
|
||||||
val localeString = locale.toString()
|
val localeString = locale.toString()
|
||||||
val iterator = allSubtypes.iterator()
|
val iterator = allSubtypes.iterator()
|
||||||
var added = false
|
var added = false
|
||||||
|
@ -112,8 +111,6 @@ class LanguageFakeSettingsFragment : Fragment(R.layout.language_fake_settings) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// special treatment for the known languages with _ZZ types
|
// special treatment for the known languages with _ZZ types
|
||||||
// todo: later: make it a bit less weird... and probably faster
|
|
||||||
// consider that more _ZZ languages might be added
|
|
||||||
if (!added && (locale.language == "sr" || locale.language == "hi")) {
|
if (!added && (locale.language == "sr" || locale.language == "hi")) {
|
||||||
val languageString = locale.language
|
val languageString = locale.language
|
||||||
val iter = allSubtypes.iterator()
|
val iter = allSubtypes.iterator()
|
||||||
|
|
|
@ -94,9 +94,9 @@ public final class SettingsFragment extends PreferenceFragmentCompat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: got a crash because it wasn't initialized...
|
// sometimes wrong languages are returned when not initializing on creation of LatinIME
|
||||||
// but sometimes wrong languages are returned when not initializing on creation of LatinIME
|
// this might be a bug, at least it's not documented
|
||||||
// maybe wait until some user actually encounters this bug, initializing here is really rare
|
// but anyway, here is really rare (LatinIme should be loaded when the settings are opened)
|
||||||
SubtypeSettingsKt.init(getActivity());
|
SubtypeSettingsKt.init(getActivity());
|
||||||
|
|
||||||
findPreference("screen_languages").setSummary(getEnabledSubtypesLabel());
|
findPreference("screen_languages").setSummary(getEnabledSubtypesLabel());
|
||||||
|
|
|
@ -120,6 +120,7 @@ public class SettingsValues {
|
||||||
public final float mKeypressSoundVolume;
|
public final float mKeypressSoundVolume;
|
||||||
private final boolean mAutoCorrectEnabled;
|
private final boolean mAutoCorrectEnabled;
|
||||||
public final float mAutoCorrectionThreshold;
|
public final float mAutoCorrectionThreshold;
|
||||||
|
public final int mScoreLimitForAutocorrect;
|
||||||
public final float mPlausibilityThreshold;
|
public final float mPlausibilityThreshold;
|
||||||
public final boolean mAutoCorrectionEnabledPerUserSettings;
|
public final boolean mAutoCorrectionEnabledPerUserSettings;
|
||||||
private final boolean mSuggestionsEnabledPerUserSettings;
|
private final boolean mSuggestionsEnabledPerUserSettings;
|
||||||
|
@ -179,6 +180,8 @@ public class SettingsValues {
|
||||||
mAutoCorrectionThreshold = mAutoCorrectEnabled
|
mAutoCorrectionThreshold = mAutoCorrectEnabled
|
||||||
? readAutoCorrectionThreshold(res, prefs)
|
? readAutoCorrectionThreshold(res, prefs)
|
||||||
: AUTO_CORRECTION_DISABLED_THRESHOLD;
|
: AUTO_CORRECTION_DISABLED_THRESHOLD;
|
||||||
|
mScoreLimitForAutocorrect = (mAutoCorrectionThreshold < 0) ? 600000 // very aggressive
|
||||||
|
: (mAutoCorrectionThreshold < 0.07 ? 800000 : 950000); // aggressive or modest
|
||||||
mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
|
mBigramPredictionEnabled = readBigramPredictionEnabled(prefs, res);
|
||||||
mDoubleSpacePeriodTimeout = res.getInteger(R.integer.config_double_space_period_timeout);
|
mDoubleSpacePeriodTimeout = res.getInteger(R.integer.config_double_space_period_timeout);
|
||||||
mHasHardwareKeyboard = Settings.readHasHardwareKeyboard(res.getConfiguration());
|
mHasHardwareKeyboard = Settings.readHasHardwareKeyboard(res.getConfiguration());
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.dslul.openboard.inputmethod.latin.R
|
||||||
import org.dslul.openboard.inputmethod.latin.RichInputMethodManager
|
import org.dslul.openboard.inputmethod.latin.RichInputMethodManager
|
||||||
|
|
||||||
// similar to what showSubtypePicker does in https://github.com/rkkr/simple-keyboard/blob/master/app/src/main/java/rkr/simplekeyboard/inputmethod/latin/RichInputMethodManager.java
|
// similar to what showSubtypePicker does in https://github.com/rkkr/simple-keyboard/blob/master/app/src/main/java/rkr/simplekeyboard/inputmethod/latin/RichInputMethodManager.java
|
||||||
fun showInputMethodPicker(latinIme: LatinIME, richImm: RichInputMethodManager, windowToken: IBinder) {
|
fun createInputMethodPickerDialog(latinIme: LatinIME, richImm: RichInputMethodManager, windowToken: IBinder): AlertDialog {
|
||||||
val pm = latinIme.packageManager
|
val pm = latinIme.packageManager
|
||||||
val thisImi = richImm.inputMethodInfoOfThisIme
|
val thisImi = richImm.inputMethodInfoOfThisIme
|
||||||
val currentSubtype = richImm.currentSubtype.rawSubtype
|
val currentSubtype = richImm.currentSubtype.rawSubtype
|
||||||
|
@ -76,5 +76,5 @@ fun showInputMethodPicker(latinIme: LatinIME, richImm: RichInputMethodManager, w
|
||||||
layoutParams?.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG
|
layoutParams?.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG
|
||||||
window?.attributes = layoutParams
|
window?.attributes = layoutParams
|
||||||
window?.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
|
window?.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM)
|
||||||
dialog.show()
|
return dialog
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,6 @@
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="ClipboardHistoryView">
|
<declare-styleable name="ClipboardHistoryView">
|
||||||
<attr name="dividerBackground" format="color" />
|
|
||||||
<attr name="iconPinnedClip" format="reference" />
|
<attr name="iconPinnedClip" format="reference" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,6 @@
|
||||||
<dimen name="config_emoji_category_page_id_height">2dp</dimen>
|
<dimen name="config_emoji_category_page_id_height">2dp</dimen>
|
||||||
|
|
||||||
<!-- Common configuration of clipboard keyboard -->
|
<!-- Common configuration of clipboard keyboard -->
|
||||||
<dimen name="config_clipboard_divider_height">1.5dp</dimen>
|
|
||||||
<dimen name="config_clipboard_pinned_icon_size">18dp</dimen>
|
<dimen name="config_clipboard_pinned_icon_size">18dp</dimen>
|
||||||
|
|
||||||
<!-- Inset used in Accessibility mode to avoid accidental key presses when a finger slides off the screen. -->
|
<!-- Inset used in Accessibility mode to avoid accidental key presses when a finger slides off the screen. -->
|
||||||
|
|
|
@ -104,7 +104,6 @@
|
||||||
parent="MainKeyboardView.HoloBase"
|
parent="MainKeyboardView.HoloBase"
|
||||||
>
|
>
|
||||||
<item name="iconPinnedClip">@drawable/ic_clipboard_pin_holo_dark</item>
|
<item name="iconPinnedClip">@drawable/ic_clipboard_pin_holo_dark</item>
|
||||||
<item name="dividerBackground">@color/emoji_tab_page_indicator_background_holo</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style
|
<style
|
||||||
name="MoreKeysKeyboard.HoloBase"
|
name="MoreKeysKeyboard.HoloBase"
|
||||||
|
|
|
@ -84,7 +84,6 @@
|
||||||
parent="MainKeyboardView.LXX_Base"
|
parent="MainKeyboardView.LXX_Base"
|
||||||
>
|
>
|
||||||
<item name="iconPinnedClip">@drawable/ic_clipboard_pin_lxx_light</item>
|
<item name="iconPinnedClip">@drawable/ic_clipboard_pin_lxx_light</item>
|
||||||
<item name="dividerBackground">@color/emoji_tab_page_indicator_background_lxx_base</item>
|
|
||||||
</style>
|
</style>
|
||||||
<style
|
<style
|
||||||
name="MoreKeysKeyboard.LXX_Base"
|
name="MoreKeysKeyboard.LXX_Base"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue