mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-15 22:42:47 +00:00
add option to also vibrate in dnd mode
This commit is contained in:
parent
d4d3ba16e0
commit
548bf64c9d
6 changed files with 15 additions and 1 deletions
|
@ -92,7 +92,7 @@ public final class AudioAndHapticFeedbackManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performHapticFeedback(final View viewToPerformHapticFeedbackOn) {
|
public void performHapticFeedback(final View viewToPerformHapticFeedbackOn) {
|
||||||
if (!mSettingsValues.mVibrateOn || mDoNotDisturb) {
|
if (!mSettingsValues.mVibrateOn || (mDoNotDisturb && !mSettingsValues.mVibrateInDndMode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mSettingsValues.mKeypressVibrationDuration >= 0) {
|
if (mSettingsValues.mKeypressVibrationDuration >= 0) {
|
||||||
|
|
|
@ -45,6 +45,7 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
||||||
|
|
||||||
if (!AudioAndHapticFeedbackManager.getInstance().hasVibrator()) {
|
if (!AudioAndHapticFeedbackManager.getInstance().hasVibrator()) {
|
||||||
removePreference(Settings.PREF_VIBRATE_ON);
|
removePreference(Settings.PREF_VIBRATE_ON);
|
||||||
|
removePreference(Settings.PREF_VIBRATE_IN_DND_MODE);
|
||||||
removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS);
|
removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +113,8 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
setPreferenceVisible(Settings.PREF_VIBRATION_DURATION_SETTINGS,
|
setPreferenceVisible(Settings.PREF_VIBRATION_DURATION_SETTINGS,
|
||||||
Settings.readVibrationEnabled(prefs, res));
|
Settings.readVibrationEnabled(prefs, res));
|
||||||
|
setPreferenceVisible(Settings.PREF_VIBRATE_IN_DND_MODE,
|
||||||
|
Settings.readVibrationEnabled(prefs, res));
|
||||||
setPreferenceVisible(Settings.PREF_KEYPRESS_SOUND_VOLUME,
|
setPreferenceVisible(Settings.PREF_KEYPRESS_SOUND_VOLUME,
|
||||||
Settings.readKeypressSoundEnabled(prefs, res));
|
Settings.readKeypressSoundEnabled(prefs, res));
|
||||||
setPreferenceVisible(Settings.PREF_CLIPBOARD_HISTORY_RETENTION_TIME,
|
setPreferenceVisible(Settings.PREF_CLIPBOARD_HISTORY_RETENTION_TIME,
|
||||||
|
|
|
@ -88,6 +88,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
||||||
|
|
||||||
public static final String PREF_AUTO_CAP = "auto_cap";
|
public static final String PREF_AUTO_CAP = "auto_cap";
|
||||||
public static final String PREF_VIBRATE_ON = "vibrate_on";
|
public static final String PREF_VIBRATE_ON = "vibrate_on";
|
||||||
|
public static final String PREF_VIBRATE_IN_DND_MODE = "vibrate_in_dnd_mode";
|
||||||
public static final String PREF_SOUND_ON = "sound_on";
|
public static final String PREF_SOUND_ON = "sound_on";
|
||||||
public static final String PREF_POPUP_ON = "popup_on";
|
public static final String PREF_POPUP_ON = "popup_on";
|
||||||
public static final String PREF_AUTO_CORRECTION = "auto_correction";
|
public static final String PREF_AUTO_CORRECTION = "auto_correction";
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class SettingsValues {
|
||||||
// From preferences
|
// From preferences
|
||||||
public final boolean mAutoCap;
|
public final boolean mAutoCap;
|
||||||
public final boolean mVibrateOn;
|
public final boolean mVibrateOn;
|
||||||
|
public final boolean mVibrateInDndMode;
|
||||||
public final boolean mSoundOn;
|
public final boolean mSoundOn;
|
||||||
public final boolean mKeyPreviewPopupOn;
|
public final boolean mKeyPreviewPopupOn;
|
||||||
public final boolean mShowsVoiceInputKey;
|
public final boolean mShowsVoiceInputKey;
|
||||||
|
@ -155,6 +156,7 @@ public class SettingsValues {
|
||||||
// Get the settings preferences
|
// Get the settings preferences
|
||||||
mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true) && ScriptUtils.scriptSupportsUppercase(mLocale);
|
mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true) && ScriptUtils.scriptSupportsUppercase(mLocale);
|
||||||
mVibrateOn = Settings.readVibrationEnabled(prefs, res);
|
mVibrateOn = Settings.readVibrationEnabled(prefs, res);
|
||||||
|
mVibrateInDndMode = prefs.getBoolean(Settings.PREF_VIBRATE_IN_DND_MODE, false);
|
||||||
mSoundOn = Settings.readKeypressSoundEnabled(prefs, res);
|
mSoundOn = Settings.readKeypressSoundEnabled(prefs, res);
|
||||||
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
|
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
|
||||||
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
<string name="use_contacts_for_spellchecking_option_summary">Spell checker uses entries from your contact list</string>
|
<string name="use_contacts_for_spellchecking_option_summary">Spell checker uses entries from your contact list</string>
|
||||||
<!-- Option to provide vibrate/haptic feedback on keypress -->
|
<!-- Option to provide vibrate/haptic feedback on keypress -->
|
||||||
<string name="vibrate_on_keypress">Vibrate on keypress</string>
|
<string name="vibrate_on_keypress">Vibrate on keypress</string>
|
||||||
|
<!-- Option to provide vibrate/haptic feedback on keypress even in do not disturb mode -->
|
||||||
|
<string name="vibrate_in_dnd_mode">Vibrate in do not disturb mode</string>
|
||||||
<!-- Option to play back sound on keypress in soft keyboard -->
|
<!-- Option to play back sound on keypress in soft keyboard -->
|
||||||
<string name="sound_on_keypress">Sound on keypress</string>
|
<string name="sound_on_keypress">Sound on keypress</string>
|
||||||
<!-- Option to control whether or not to show a popup with a larger font on each key press. -->
|
<!-- Option to control whether or not to show a popup with a larger font on each key press. -->
|
||||||
|
|
|
@ -43,6 +43,12 @@
|
||||||
android:title="@string/prefs_keypress_vibration_duration_settings"
|
android:title="@string/prefs_keypress_vibration_duration_settings"
|
||||||
latin:maxValue="@integer/config_max_vibration_duration" />
|
latin:maxValue="@integer/config_max_vibration_duration" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="vibrate_in_dnd_mode"
|
||||||
|
android:title="@string/vibrate_in_dnd_mode"
|
||||||
|
android:defaultValue="@bool/config_default_vibration_enabled"
|
||||||
|
android:persistent="true" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="sound_on"
|
android:key="sound_on"
|
||||||
android:title="@string/sound_on_keypress"
|
android:title="@string/sound_on_keypress"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue