mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 10:45:23 +08:00
Added plugin_error_notifications_enabled preference
This will allow user to control whether flashes and notifications for plugin errors are enabled or not. The `TermuxPreferenceConstants` classes has been updated to `v0.4.0`. Check its Changelog sections for info on changes.
This commit is contained in:
@@ -108,6 +108,9 @@ class DebuggingPreferencesDataStore extends PreferenceDataStore {
|
||||
case "terminal_view_key_logging_enabled":
|
||||
mPreferences.setTerminalViewKeyLoggingEnabled(value);
|
||||
break;
|
||||
case "plugin_error_notifications_enabled":
|
||||
mPreferences.setPluginErrorNotificationsEnabled(value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -118,6 +121,8 @@ class DebuggingPreferencesDataStore extends PreferenceDataStore {
|
||||
switch (key) {
|
||||
case "terminal_view_key_logging_enabled":
|
||||
return mPreferences.getTerminalViewKeyLoggingEnabled();
|
||||
case "plugin_error_notifications_enabled":
|
||||
return mPreferences.getPluginErrorNotificationsEnabled();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@@ -130,4 +130,14 @@ public class TermuxAppSharedPreferences {
|
||||
SharedPreferenceUtils.setBoolean(mSharedPreferences, TERMUX_APP.KEY_TERMINAL_VIEW_KEY_LOGGING_ENABLED, value, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean getPluginErrorNotificationsEnabled() {
|
||||
return SharedPreferenceUtils.getBoolean(mSharedPreferences, TERMUX_APP.KEY_PLUGIN_ERROR_NOTIFICATIONS_ENABLED, TERMUX_APP.DEFAULT_VALUE_PLUGIN_ERROR_NOTIFICATIONS_ENABLED);
|
||||
}
|
||||
|
||||
public void setPluginErrorNotificationsEnabled(boolean value) {
|
||||
SharedPreferenceUtils.setBoolean(mSharedPreferences, TERMUX_APP.KEY_PLUGIN_ERROR_NOTIFICATIONS_ENABLED, value, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.termux.app.settings.preferences;
|
||||
|
||||
/*
|
||||
* Version: v0.3.0
|
||||
* Version: v0.4.0
|
||||
*
|
||||
* Changelog
|
||||
*
|
||||
@@ -16,7 +16,12 @@ package com.termux.app.settings.preferences;
|
||||
* Termux app and its plugins. This will allow {@link com.termux.app.TermuxSettings} to
|
||||
* manage preferences of plugins as well if they don't have launcher activity themselves
|
||||
* and also allow plugin apps to make changes to preferences from background.
|
||||
* - Added `KEY_LOG_LEVEL` to `TERMUX_TASKER_APP` scope.
|
||||
* - Added following to `TERMUX_TASKER_APP`:
|
||||
* `KEY_LOG_LEVEL`.
|
||||
*
|
||||
* - 0.4.0 (2021-03-13)
|
||||
* - Added following to `TERMUX_APP`:
|
||||
* `KEY_PLUGIN_ERROR_NOTIFICATIONS_ENABLED` and `DEFAULT_VALUE_PLUGIN_ERROR_NOTIFICATIONS_ENABLED`.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -71,6 +76,12 @@ public final class TermuxPreferenceConstants {
|
||||
public static final String KEY_TERMINAL_VIEW_KEY_LOGGING_ENABLED = "terminal_view_key_logging_enabled";
|
||||
public static final boolean DEFAULT_VALUE_TERMINAL_VIEW_KEY_LOGGING_ENABLED = false;
|
||||
|
||||
/**
|
||||
* Defines the key for whether flashes and notifications for plugin errors are enabled or not
|
||||
*/
|
||||
public static final String KEY_PLUGIN_ERROR_NOTIFICATIONS_ENABLED = "plugin_error_notifications_enabled";
|
||||
public static final boolean DEFAULT_VALUE_PLUGIN_ERROR_NOTIFICATIONS_ENABLED = true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -118,4 +118,10 @@
|
||||
<string name="terminal_view_key_logging_off">Logs will not have entries for terminal view keys. (Default)</string>
|
||||
<string name="terminal_view_key_logging_on">Logcat logs will have entries for terminal view keys. These are very verbose and should be disabled under normal circumstances or will cause performance issues.</string>
|
||||
|
||||
|
||||
<!-- Plugin Error Notifications -->
|
||||
<string name="plugin_error_notifications_title">Plugin Error Notifications</string>
|
||||
<string name="plugin_error_notifications_off">Disable flashes and notifications for plugin errors.</string>
|
||||
<string name="plugin_error_notifications_on">Show flashes and notifications for plugin errors. (Default)</string>
|
||||
|
||||
</resources>
|
||||
|
@@ -16,6 +16,12 @@
|
||||
app:summaryOn="@string/terminal_view_key_logging_on"
|
||||
app:title="@string/terminal_view_key_logging_title" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="plugin_error_notifications_enabled"
|
||||
app:summaryOff="@string/plugin_error_notifications_off"
|
||||
app:summaryOn="@string/plugin_error_notifications_on"
|
||||
app:title="@string/plugin_error_notifications_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
Reference in New Issue
Block a user