diff --git a/app/src/main/java/com/termux/app/settings/DebuggingPreferencesFragment.java b/app/src/main/java/com/termux/app/settings/DebuggingPreferencesFragment.java index e6dc03c6..9944cf61 100644 --- a/app/src/main/java/com/termux/app/settings/DebuggingPreferencesFragment.java +++ b/app/src/main/java/com/termux/app/settings/DebuggingPreferencesFragment.java @@ -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; } diff --git a/app/src/main/java/com/termux/app/settings/preferences/TermuxAppSharedPreferences.java b/app/src/main/java/com/termux/app/settings/preferences/TermuxAppSharedPreferences.java index 18be3803..33c12d90 100644 --- a/app/src/main/java/com/termux/app/settings/preferences/TermuxAppSharedPreferences.java +++ b/app/src/main/java/com/termux/app/settings/preferences/TermuxAppSharedPreferences.java @@ -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); + } + } diff --git a/app/src/main/java/com/termux/app/settings/preferences/TermuxPreferenceConstants.java b/app/src/main/java/com/termux/app/settings/preferences/TermuxPreferenceConstants.java index a760a1bf..605e9f06 100644 --- a/app/src/main/java/com/termux/app/settings/preferences/TermuxPreferenceConstants.java +++ b/app/src/main/java/com/termux/app/settings/preferences/TermuxPreferenceConstants.java @@ -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; + } /** diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9de363d1..a186ce46 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -118,4 +118,10 @@ Logs will not have entries for terminal view keys. (Default) 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. + + + Plugin Error Notifications + Disable flashes and notifications for plugin errors. + Show flashes and notifications for plugin errors. (Default) + diff --git a/app/src/main/res/xml/debugging_preferences.xml b/app/src/main/res/xml/debugging_preferences.xml index ba1f328d..af126ff3 100644 --- a/app/src/main/res/xml/debugging_preferences.xml +++ b/app/src/main/res/xml/debugging_preferences.xml @@ -16,6 +16,12 @@ app:summaryOn="@string/terminal_view_key_logging_on" app:title="@string/terminal_view_key_logging_title" /> + +