mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-03 13:20:31 +00:00
Force incognito mode option
This commit is contained in:
parent
6498de22cd
commit
075efd1573
10 changed files with 18 additions and 79 deletions
|
@ -152,9 +152,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
|||
final Keyboard newKeyboard = mKeyboardLayoutSet.getKeyboard(keyboardId);
|
||||
keyboardView.setKeyboard(newKeyboard);
|
||||
mCurrentInputView.setKeyboardTopPadding(newKeyboard.mTopPadding);
|
||||
keyboardView.setKeyPreviewPopupEnabled(
|
||||
currentSettingsValues.mKeyPreviewPopupOn,
|
||||
currentSettingsValues.mKeyPreviewPopupDismissDelay);
|
||||
keyboardView.setKeyPreviewPopupEnabled(currentSettingsValues.mKeyPreviewPopupOn);
|
||||
keyboardView.setKeyPreviewAnimationParams(
|
||||
currentSettingsValues.mHasCustomKeyPreviewAnimationParams,
|
||||
currentSettingsValues.mKeyPreviewShowUpStartXScale,
|
||||
|
|
|
@ -412,10 +412,9 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
|||
* Enables or disables the key preview popup. This is a popup that shows a magnified
|
||||
* version of the depressed key. By default the preview is enabled.
|
||||
* @param previewEnabled whether or not to enable the key feedback preview
|
||||
* @param delay the delay after which the preview is dismissed
|
||||
*/
|
||||
public void setKeyPreviewPopupEnabled(final boolean previewEnabled, final int delay) {
|
||||
mKeyPreviewDrawParams.setPopupEnabled(previewEnabled, delay);
|
||||
public void setKeyPreviewPopupEnabled(final boolean previewEnabled) {
|
||||
mKeyPreviewDrawParams.setPopupEnabled(previewEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,10 +507,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy
|
|||
private void dismissKeyPreview(@Nonnull final Key key) {
|
||||
if (isHardwareAccelerated()) {
|
||||
mKeyPreviewChoreographer.dismissKeyPreview(key);
|
||||
return;
|
||||
}
|
||||
// TODO: Implement preference option to control key preview method and duration.
|
||||
mTimerHandler.postDismissKeyPreview(key, mKeyPreviewDrawParams.getLingerTimeout());
|
||||
}
|
||||
|
||||
public void setSlidingKeyInputPreviewEnabled(final boolean enabled) {
|
||||
|
|
|
@ -32,7 +32,6 @@ public final class KeyPreviewDrawParams {
|
|||
public final int mPreviewOffset;
|
||||
public final int mPreviewHeight;
|
||||
public final int mPreviewBackgroundResId;
|
||||
private int mLingerTimeout;
|
||||
private boolean mShowPopup = true;
|
||||
|
||||
// The graphical geometry of the key preview.
|
||||
|
@ -67,8 +66,6 @@ public final class KeyPreviewDrawParams {
|
|||
R.styleable.MainKeyboardView_keyPreviewHeight, 0);
|
||||
mPreviewBackgroundResId = mainKeyboardViewAttr.getResourceId(
|
||||
R.styleable.MainKeyboardView_keyPreviewBackground, 0);
|
||||
mLingerTimeout = mainKeyboardViewAttr.getInt(
|
||||
R.styleable.MainKeyboardView_keyPreviewLingerTimeout, 0);
|
||||
}
|
||||
|
||||
public void setVisibleOffset(final int previewVisibleOffset) {
|
||||
|
@ -100,19 +97,14 @@ public final class KeyPreviewDrawParams {
|
|||
return mVisibleHeight;
|
||||
}
|
||||
|
||||
public void setPopupEnabled(final boolean enabled, final int lingerTimeout) {
|
||||
public void setPopupEnabled(final boolean enabled) {
|
||||
mShowPopup = enabled;
|
||||
mLingerTimeout = lingerTimeout;
|
||||
}
|
||||
|
||||
public boolean isPopupEnabled() {
|
||||
return mShowPopup;
|
||||
}
|
||||
|
||||
public int getLingerTimeout() {
|
||||
return mLingerTimeout;
|
||||
}
|
||||
|
||||
public void setAnimationParams(final boolean hasCustomAnimationParams,
|
||||
final float showUpStartXScale, final float showUpStartYScale, final int showUpDuration,
|
||||
final float dismissEndXScale, final float dismissEndYScale, final int dismissDuration) {
|
||||
|
|
|
@ -1014,8 +1014,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
|
||||
mainKeyboardView.setMainDictionaryAvailability(
|
||||
mDictionaryFacilitator.hasAtLeastOneInitializedMainDictionary());
|
||||
mainKeyboardView.setKeyPreviewPopupEnabled(currentSettingsValues.mKeyPreviewPopupOn,
|
||||
currentSettingsValues.mKeyPreviewPopupDismissDelay);
|
||||
mainKeyboardView.setKeyPreviewPopupEnabled(currentSettingsValues.mKeyPreviewPopupOn);
|
||||
mainKeyboardView.setSlidingKeyInputPreviewEnabled(
|
||||
currentSettingsValues.mSlidingKeyInputPreviewEnabled);
|
||||
mainKeyboardView.setGestureHandlingEnabledByUser(
|
||||
|
|
|
@ -62,53 +62,17 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
|
|||
removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS);
|
||||
}
|
||||
|
||||
// TODO: consolidate key preview dismiss delay with the key preview animation parameters.
|
||||
if (!Settings.readFromBuildConfigIfToShowKeyPreviewPopupOption(res)) {
|
||||
removePreference(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
|
||||
} else {
|
||||
// TODO: Cleanup this setup.
|
||||
final ListPreference keyPreviewPopupDismissDelay =
|
||||
(ListPreference) findPreference(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
|
||||
final String popupDismissDelayDefaultValue = Integer.toString(res.getInteger(
|
||||
R.integer.config_key_preview_linger_timeout));
|
||||
keyPreviewPopupDismissDelay.setEntries(new String[] {
|
||||
res.getString(R.string.key_preview_popup_dismiss_no_delay),
|
||||
res.getString(R.string.key_preview_popup_dismiss_default_delay),
|
||||
});
|
||||
keyPreviewPopupDismissDelay.setEntryValues(new String[] {
|
||||
"0",
|
||||
popupDismissDelayDefaultValue
|
||||
});
|
||||
if (null == keyPreviewPopupDismissDelay.getValue()) {
|
||||
keyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue);
|
||||
}
|
||||
keyPreviewPopupDismissDelay.setEnabled(
|
||||
Settings.readKeyPreviewPopupEnabled(prefs, res));
|
||||
}
|
||||
|
||||
setupKeypressVibrationDurationSettings();
|
||||
setupKeypressSoundVolumeSettings();
|
||||
setupKeyLongpressTimeoutSettings();
|
||||
refreshEnablingsOfKeypressSoundAndVibrationSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
||||
updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) {
|
||||
final Resources res = getResources();
|
||||
if (key.equals(Settings.PREF_POPUP_ON)) {
|
||||
setPreferenceEnabled(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
|
||||
Settings.readKeyPreviewPopupEnabled(prefs, res));
|
||||
} else if (key.equals(Settings.PREF_SHOW_SETUP_WIZARD_ICON)) {
|
||||
if (key.equals(Settings.PREF_SHOW_SETUP_WIZARD_ICON)) {
|
||||
SystemBroadcastReceiver.toggleAppIcon(getActivity());
|
||||
}
|
||||
updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
|
||||
refreshEnablingsOfKeypressSoundAndVibrationSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -84,11 +84,6 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(final SharedPreferences prefs, final String key) {
|
||||
final Resources res = getResources();
|
||||
if (key.equals(Settings.PREF_POPUP_ON)) {
|
||||
setPreferenceEnabled(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
|
||||
Settings.readKeyPreviewPopupEnabled(prefs, res));
|
||||
}
|
||||
refreshEnablingsOfKeypressSoundAndVibrationSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -83,9 +83,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
public static final String PREF_KEYBOARD_HEIGHT_SCALE = "pref_keyboard_height_scale";
|
||||
public static final String PREF_SPACE_TRACKPAD = "pref_space_trackpad";
|
||||
public static final String PREF_DELETE_SWIPE = "pref_delete_swipe";
|
||||
// TODO: consolidate key preview dismiss delay with the key preview animation parameters.
|
||||
public static final String PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY =
|
||||
"pref_key_preview_popup_dismiss_delay";
|
||||
public static final String PREF_ALWAYS_INCOGNITO_MODE =
|
||||
"pref_always_incognito_mode";
|
||||
public static final String PREF_BIGRAM_PREDICTIONS = "next_word_prediction";
|
||||
public static final String PREF_GESTURE_INPUT = "gesture_input";
|
||||
public static final String PREF_VIBRATION_DURATION_SETTINGS =
|
||||
|
@ -262,11 +261,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
return prefs.getBoolean(PREF_POPUP_ON, defaultKeyPreviewPopup);
|
||||
}
|
||||
|
||||
public static int readKeyPreviewPopupDismissDelay(final SharedPreferences prefs,
|
||||
final Resources res) {
|
||||
return Integer.parseInt(prefs.getString(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
|
||||
Integer.toString(res.getInteger(
|
||||
R.integer.config_key_preview_linger_timeout))));
|
||||
public static boolean readAlwaysIncognitoMode(final SharedPreferences prefs) {
|
||||
return prefs.getBoolean(PREF_ALWAYS_INCOGNITO_MODE, true);
|
||||
}
|
||||
|
||||
public static String readPrefAdditionalSubtypes(final SharedPreferences prefs,
|
||||
|
|
|
@ -101,7 +101,6 @@ public class SettingsValues {
|
|||
// Deduced settings
|
||||
public final int mKeypressVibrationDuration;
|
||||
public final float mKeypressSoundVolume;
|
||||
public final int mKeyPreviewPopupDismissDelay;
|
||||
private final boolean mAutoCorrectEnabled;
|
||||
public final float mAutoCorrectionThreshold;
|
||||
public final float mPlausibilityThreshold;
|
||||
|
@ -169,7 +168,6 @@ public class SettingsValues {
|
|||
mKeyLongpressTimeout = Settings.readKeyLongpressTimeout(prefs, res);
|
||||
mKeypressVibrationDuration = Settings.readKeypressVibrationDuration(prefs, res);
|
||||
mKeypressSoundVolume = Settings.readKeypressSoundVolume(prefs, res);
|
||||
mKeyPreviewPopupDismissDelay = Settings.readKeyPreviewPopupDismissDelay(prefs, res);
|
||||
mEnableEmojiAltPhysicalKey = prefs.getBoolean(
|
||||
Settings.PREF_ENABLE_EMOJI_ALT_PHYSICAL_KEY, true);
|
||||
mShowAppIcon = Settings.readShowSetupWizardIcon(prefs, context);
|
||||
|
@ -188,7 +186,7 @@ public class SettingsValues {
|
|||
//&& !mInputAttributes.mInputTypeNoAutoCorrect;
|
||||
mSuggestionsEnabledPerUserSettings = !mInputAttributes.mIsPasswordField &&
|
||||
readSuggestionsEnabled(prefs);
|
||||
mIncognitoModeEnabled = mInputAttributes.mNoLearning;
|
||||
mIncognitoModeEnabled = Settings.readAlwaysIncognitoMode(prefs) || mInputAttributes.mNoLearning;
|
||||
mIsInternal = Settings.isInternal(prefs);
|
||||
mHasCustomKeyPreviewAnimationParams = prefs.getBoolean(
|
||||
DebugSettings.PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS, false);
|
||||
|
@ -412,8 +410,6 @@ public class SettingsValues {
|
|||
sb.append("" + mKeypressVibrationDuration);
|
||||
sb.append("\n mKeypressSoundVolume = ");
|
||||
sb.append("" + mKeypressSoundVolume);
|
||||
sb.append("\n mKeyPreviewPopupDismissDelay = ");
|
||||
sb.append("" + mKeyPreviewPopupDismissDelay);
|
||||
sb.append("\n mAutoCorrectEnabled = ");
|
||||
sb.append("" + mAutoCorrectEnabled);
|
||||
sb.append("\n mAutoCorrectionThreshold = ");
|
||||
|
|
|
@ -607,4 +607,6 @@ Tip: You can download and remove dictionaries by going to <b>Languages &
|
|||
<string name="delete_swipe_summary">Perform a swipe from the delete key to select and remove bigger portions of text at once</string>
|
||||
<string name="space_trackpad_summary">Swipe on the spacebar to move the cursor</string>
|
||||
<string name="more_keys_strip_description">More keys</string>
|
||||
<string name="prefs_force_incognito_mode">Force incognito mode</string>
|
||||
<string name="prefs_force_incognito_mode_summary">Disable learning of new words</string>
|
||||
</resources>
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
xmlns:latin="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/settings_screen_advanced"
|
||||
android:key="screen_advanced">
|
||||
<!-- TODO: consolidate key preview dismiss delay with the key preview animation parameters. -->
|
||||
<ListPreference
|
||||
android:key="pref_key_preview_popup_dismiss_delay"
|
||||
android:title="@string/key_preview_popup_dismiss_delay" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_always_incognito_mode"
|
||||
android:title="@string/prefs_force_incognito_mode"
|
||||
android:summary="@string/prefs_force_incognito_mode_summary"
|
||||
android:defaultValue="false" />
|
||||
<org.dslul.openboard.inputmethod.latin.settings.SeekBarDialogPreference
|
||||
android:key="pref_vibration_duration_settings"
|
||||
android:title="@string/prefs_keypress_vibration_duration_settings"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue