remove unused key popup animation code already marked for removal

This commit is contained in:
Helium314 2023-09-16 21:50:17 +02:00
parent 017c057585
commit 9c272fd881
18 changed files with 1 additions and 413 deletions

View file

@ -173,14 +173,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
keyboardView.setKeyboard(newKeyboard);
mCurrentInputView.setKeyboardTopPadding(newKeyboard.mTopPadding);
keyboardView.setKeyPreviewPopupEnabled(currentSettingsValues.mKeyPreviewPopupOn);
keyboardView.setKeyPreviewAnimationParams(
currentSettingsValues.mHasCustomKeyPreviewAnimationParams,
currentSettingsValues.mKeyPreviewShowUpStartXScale,
currentSettingsValues.mKeyPreviewShowUpStartYScale,
currentSettingsValues.mKeyPreviewShowUpDuration,
currentSettingsValues.mKeyPreviewDismissEndXScale,
currentSettingsValues.mKeyPreviewDismissEndYScale,
currentSettingsValues.mKeyPreviewDismissDuration);
keyboardView.updateShortcutKey(mRichImm.isShortcutImeReady());
final boolean subtypeChanged = (oldKeyboard == null)
|| !newKeyboard.mId.mSubtype.equals(oldKeyboard.mId.mSubtype);

View file

@ -92,9 +92,6 @@ import java.util.WeakHashMap;
* @attr ref R.styleable#MainKeyboardView_keyPreviewLayout
* @attr ref R.styleable#MainKeyboardView_keyPreviewOffset
* @attr ref R.styleable#MainKeyboardView_keyPreviewHeight
* @attr ref R.styleable#MainKeyboardView_keyPreviewLingerTimeout
* @attr ref R.styleable#MainKeyboardView_keyPreviewShowUpAnimator
* @attr ref R.styleable#MainKeyboardView_keyPreviewDismissAnimator
* @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardLayout
* @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardForActionLayout
* @attr ref R.styleable#MainKeyboardView_backgroundDimAlpha
@ -422,27 +419,6 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
mKeyPreviewDrawParams.setPopupEnabled(previewEnabled);
}
/**
* Enables or disables the key preview popup animations and set animations' parameters.
*
* @param hasCustomAnimationParams false to use the default key preview popup animations
* specified by keyPreviewShowUpAnimator and keyPreviewDismissAnimator attributes.
* true to override the default animations with the specified parameters.
* @param showUpStartXScale from this x-scale the show up animation will start.
* @param showUpStartYScale from this y-scale the show up animation will start.
* @param showUpDuration the duration of the show up animation in milliseconds.
* @param dismissEndXScale to this x-scale the dismiss animation will end.
* @param dismissEndYScale to this y-scale the dismiss animation will end.
* @param dismissDuration the duration of the dismiss animation in milliseconds.
*/
public void setKeyPreviewAnimationParams(final boolean hasCustomAnimationParams,
final float showUpStartXScale, final float showUpStartYScale, final int showUpDuration,
final float dismissEndXScale, final float dismissEndYScale, final int dismissDuration) {
mKeyPreviewDrawParams.setAnimationParams(hasCustomAnimationParams,
showUpStartXScale, showUpStartYScale, showUpDuration,
dismissEndXScale, dismissEndYScale, dismissDuration);
}
private void locatePreviewPlacerView() {
getLocationInWindow(mOriginCoords);
mDrawingPreviewPlacerView.setKeyboardViewGeometry(mOriginCoords, getWidth(), getHeight());

View file

@ -99,10 +99,4 @@ public final class KeyPreviewDrawParams {
return mShowPopup;
}
public void setAnimationParams(final boolean hasCustomAnimationParams,
final float showUpStartXScale, final float showUpStartYScale, final int showUpDuration,
final float dismissEndXScale, final float dismissEndYScale, final int dismissDuration) {
//TODO: remove
}
}

View file

@ -27,20 +27,6 @@ package org.dslul.openboard.inputmethod.latin.settings;
public final class DebugSettings {
public static final String PREF_DEBUG_MODE = "debug_mode";
public static final String PREF_FORCE_NON_DISTINCT_MULTITOUCH = "force_non_distinct_multitouch";
public static final String PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS =
"pref_has_custom_key_preview_animation_params";
public static final String PREF_KEY_PREVIEW_DISMISS_DURATION =
"pref_key_preview_dismiss_duration";
public static final String PREF_KEY_PREVIEW_DISMISS_END_X_SCALE =
"pref_key_preview_dismiss_end_x_scale";
public static final String PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE =
"pref_key_preview_dismiss_end_y_scale";
public static final String PREF_KEY_PREVIEW_SHOW_UP_DURATION =
"pref_key_preview_show_up_duration";
public static final String PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE =
"pref_key_preview_show_up_start_x_scale";
public static final String PREF_KEY_PREVIEW_SHOW_UP_START_Y_SCALE =
"pref_key_preview_show_up_start_y_scale";
public static final String PREF_SHOULD_SHOW_LXX_SUGGESTION_UI =
"pref_should_show_lxx_suggestion_ui";
public static final String PREF_SLIDING_KEY_INPUT_PREVIEW = "pref_sliding_key_input_preview";

View file

@ -19,9 +19,7 @@ package org.dslul.openboard.inputmethod.latin.settings;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Process;
import androidx.annotation.NonNull;
import androidx.preference.Preference;
@ -32,9 +30,6 @@ import org.dslul.openboard.inputmethod.latin.DictionaryDumpBroadcastReceiver;
import org.dslul.openboard.inputmethod.latin.DictionaryFacilitatorImpl;
import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.utils.ApplicationUtils;
import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils;
import java.util.Locale;
/**
* "Debug mode" settings sub screen.
@ -64,23 +59,6 @@ public final class DebugSettingsFragment extends SubScreenFragment
pref.setOnPreferenceClickListener(this);
dictDumpPreferenceGroup.addPreference(pref);
}
final Resources res = getResources();
setupKeyPreviewAnimationDuration(DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_DURATION,
res.getInteger(R.integer.config_key_preview_show_up_duration));
setupKeyPreviewAnimationDuration(DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
res.getInteger(R.integer.config_key_preview_dismiss_duration));
final float defaultKeyPreviewShowUpStartScale = ResourceUtils.getFloatFromFraction(
res, R.fraction.config_key_preview_show_up_start_scale);
final float defaultKeyPreviewDismissEndScale = ResourceUtils.getFloatFromFraction(
res, R.fraction.config_key_preview_dismiss_end_scale);
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE,
defaultKeyPreviewShowUpStartScale);
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_Y_SCALE,
defaultKeyPreviewShowUpStartScale);
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_X_SCALE,
defaultKeyPreviewDismissEndScale);
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE,
defaultKeyPreviewDismissEndScale);
mServiceNeedsRestart = false;
mDebugMode = findPreference(DebugSettings.PREF_DEBUG_MODE);
@ -144,94 +122,4 @@ public final class DebugSettingsFragment extends SubScreenFragment
}
}
private void setupKeyPreviewAnimationScale(final String prefKey, final float defaultValue) {
final SharedPreferences prefs = getSharedPreferences();
final Resources res = getResources();
final SeekBarDialogPreference pref = findPreference(prefKey);
if (pref == null) {
return;
}
pref.setInterface(new SeekBarDialogPreference.ValueProxy() {
private static final float PERCENTAGE_FLOAT = 100.0f;
private float getValueFromPercentage(final int percentage) {
return percentage / PERCENTAGE_FLOAT;
}
private int getPercentageFromValue(final float floatValue) {
return (int)(floatValue * PERCENTAGE_FLOAT);
}
@Override
public void writeValue(final int value, final String key) {
prefs.edit().putFloat(key, getValueFromPercentage(value)).apply();
}
@Override
public void writeDefaultValue(final String key) {
prefs.edit().remove(key).apply();
}
@Override
public int readValue(final String key) {
return getPercentageFromValue(
Settings.readKeyPreviewAnimationScale(prefs, key, defaultValue));
}
@Override
public int readDefaultValue(final String key) {
return getPercentageFromValue(defaultValue);
}
@Override
public String getValueText(final int value) {
if (value < 0) {
return res.getString(R.string.settings_system_default);
}
return String.format(Locale.ROOT, "%d%%", value);
}
@Override
public void feedbackValue(final int value) {}
});
}
private void setupKeyPreviewAnimationDuration(final String prefKey, final int defaultValue) {
final SharedPreferences prefs = getSharedPreferences();
final Resources res = getResources();
final SeekBarDialogPreference pref = findPreference(prefKey);
if (pref == null) {
return;
}
pref.setInterface(new SeekBarDialogPreference.ValueProxy() {
@Override
public void writeValue(final int value, final String key) {
prefs.edit().putInt(key, value).apply();
}
@Override
public void writeDefaultValue(final String key) {
prefs.edit().remove(key).apply();
}
@Override
public int readValue(final String key) {
return Settings.readKeyPreviewAnimationDuration(prefs, key, defaultValue);
}
@Override
public int readDefaultValue(final String key) {
return defaultValue;
}
@Override
public String getValueText(final int value) {
return res.getString(R.string.abbreviation_unit_milliseconds, Integer.toString(value));
}
@Override
public void feedbackValue(final int value) {}
});
}
}

View file

@ -46,13 +46,6 @@ public class LocalSettingsConstants {
// correctly set for it to work on a new device.
DebugSettings.PREF_DEBUG_MODE,
DebugSettings.PREF_FORCE_NON_DISTINCT_MULTITOUCH,
DebugSettings.PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS,
DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_X_SCALE,
DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE,
DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_DURATION,
DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE,
DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_Y_SCALE,
DebugSettings.PREF_SHOULD_SHOW_LXX_SUGGESTION_UI,
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW
};

View file

@ -35,7 +35,6 @@ import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
import org.dslul.openboard.inputmethod.latin.common.Colors;
import org.dslul.openboard.inputmethod.latin.spellcheck.AndroidSpellCheckerService;
import org.dslul.openboard.inputmethod.latin.utils.AsyncResultHolder;
import org.dslul.openboard.inputmethod.latin.utils.ResourceUtils;
import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils;
import org.dslul.openboard.inputmethod.latin.utils.TargetPackageInfoGetterTask;
@ -132,15 +131,6 @@ public class SettingsValues {
// User-defined colors
public final Colors mColors;
// Debug settings
public final boolean mHasCustomKeyPreviewAnimationParams;
public final int mKeyPreviewShowUpDuration;
public final int mKeyPreviewDismissDuration;
public final float mKeyPreviewShowUpStartXScale;
public final float mKeyPreviewShowUpStartYScale;
public final float mKeyPreviewDismissEndXScale;
public final float mKeyPreviewDismissEndYScale;
@Nullable
public final String mAccount;
@ -211,30 +201,7 @@ public class SettingsValues {
readSuggestionsEnabled(prefs);
mIncognitoModeEnabled = Settings.readAlwaysIncognitoMode(prefs) || mInputAttributes.mNoLearning
|| mInputAttributes.mIsPasswordField;
mHasCustomKeyPreviewAnimationParams = prefs.getBoolean(DebugSettings.PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS, false);
mKeyboardHeightScale = Settings.readKeyboardHeight(prefs, DEFAULT_SIZE_SCALE);
mKeyPreviewShowUpDuration = Settings.readKeyPreviewAnimationDuration(
prefs, DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_DURATION,
res.getInteger(R.integer.config_key_preview_show_up_duration));
mKeyPreviewDismissDuration = Settings.readKeyPreviewAnimationDuration(
prefs, DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
res.getInteger(R.integer.config_key_preview_dismiss_duration));
final float defaultKeyPreviewShowUpStartScale = ResourceUtils.getFloatFromFraction(
res, R.fraction.config_key_preview_show_up_start_scale);
final float defaultKeyPreviewDismissEndScale = ResourceUtils.getFloatFromFraction(
res, R.fraction.config_key_preview_dismiss_end_scale);
mKeyPreviewShowUpStartXScale = Settings.readKeyPreviewAnimationScale(
prefs, DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE,
defaultKeyPreviewShowUpStartScale);
mKeyPreviewShowUpStartYScale = Settings.readKeyPreviewAnimationScale(
prefs, DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_Y_SCALE,
defaultKeyPreviewShowUpStartScale);
mKeyPreviewDismissEndXScale = Settings.readKeyPreviewAnimationScale(
prefs, DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_X_SCALE,
defaultKeyPreviewDismissEndScale);
mKeyPreviewDismissEndYScale = Settings.readKeyPreviewAnimationScale(
prefs, DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE,
defaultKeyPreviewDismissEndScale);
mDisplayOrientation = res.getConfiguration().orientation;
mAppWorkarounds = new AsyncResultHolder<>("AppWorkarounds");
final PackageInfo packageInfo = TargetPackageInfoGetterTask.getCachedPackageInfo(
@ -438,18 +405,6 @@ public class SettingsValues {
sb.append("\n mAppWorkarounds = ");
final AppWorkaroundsUtils awu = mAppWorkarounds.get(null, 0);
sb.append("" + (null == awu ? "null" : awu.toString()));
sb.append("\n mKeyPreviewShowUpDuration = ");
sb.append("" + mKeyPreviewShowUpDuration);
sb.append("\n mKeyPreviewDismissDuration = ");
sb.append("" + mKeyPreviewDismissDuration);
sb.append("\n mKeyPreviewShowUpStartScaleX = ");
sb.append("" + mKeyPreviewShowUpStartXScale);
sb.append("\n mKeyPreviewShowUpStartScaleY = ");
sb.append("" + mKeyPreviewShowUpStartYScale);
sb.append("\n mKeyPreviewDismissEndScaleX = ");
sb.append("" + mKeyPreviewDismissEndXScale);
sb.append("\n mKeyPreviewDismissEndScaleY = ");
sb.append("" + mKeyPreviewDismissEndYScale);
return sb.toString();
}
}