mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-18 13:22:03 +00:00
fix unable to change one-handed mode scale
This commit is contained in:
parent
003ec854ab
commit
8fddf94121
2 changed files with 4 additions and 4 deletions
|
@ -78,7 +78,7 @@ class KeyboardWrapperView @JvmOverloads constructor(
|
|||
val changePercent = 2 * sign * (x - motionEvent.rawX) / context.resources.displayMetrics.density
|
||||
if (abs(changePercent) < 1) return@setOnTouchListener true
|
||||
x = motionEvent.rawX
|
||||
val oldScale = Settings.readOneHandedModeScale(context.prefs(), Settings.getValues().mDisplayOrientation == Configuration.ORIENTATION_PORTRAIT)
|
||||
val oldScale = Settings.readOneHandedModeScale(context.prefs(), Settings.getValues().mDisplayOrientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||
val newScale = (oldScale + changePercent / 100f).coerceAtMost(2.5f).coerceAtLeast(0.5f)
|
||||
if (newScale == oldScale) return@setOnTouchListener true
|
||||
Settings.getInstance().writeOneHandedModeScale(newScale)
|
||||
|
|
|
@ -361,7 +361,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
|
||||
public void writeOneHandedModeEnabled(final boolean enabled) {
|
||||
mPrefs.edit().putBoolean(PREF_ONE_HANDED_MODE_PREFIX +
|
||||
(mSettingsValues.mDisplayOrientation == Configuration.ORIENTATION_PORTRAIT), enabled).apply();
|
||||
(mSettingsValues.mDisplayOrientation != Configuration.ORIENTATION_LANDSCAPE), enabled).apply();
|
||||
}
|
||||
|
||||
public static float readOneHandedModeScale(final SharedPreferences prefs, final boolean isLandscape) {
|
||||
|
@ -370,7 +370,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
|
||||
public void writeOneHandedModeScale(final Float scale) {
|
||||
mPrefs.edit().putFloat(PREF_ONE_HANDED_SCALE_PREFIX +
|
||||
(mSettingsValues.mDisplayOrientation == Configuration.ORIENTATION_PORTRAIT), scale).apply();
|
||||
(mSettingsValues.mDisplayOrientation != Configuration.ORIENTATION_LANDSCAPE), scale).apply();
|
||||
}
|
||||
|
||||
public static int readOneHandedModeGravity(final SharedPreferences prefs, final boolean isLandscape) {
|
||||
|
@ -379,7 +379,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
|
||||
public void writeOneHandedModeGravity(final int gravity) {
|
||||
mPrefs.edit().putInt(PREF_ONE_HANDED_GRAVITY_PREFIX +
|
||||
(mSettingsValues.mDisplayOrientation == Configuration.ORIENTATION_PORTRAIT), gravity).apply();
|
||||
(mSettingsValues.mDisplayOrientation != Configuration.ORIENTATION_LANDSCAPE), gravity).apply();
|
||||
}
|
||||
|
||||
public void writeSplitKeyboardEnabled(final boolean enabled, final boolean isLandscape) {
|
||||
|
|
Loading…
Add table
Reference in a new issue