From da283db3146185cd7fcdbdd7c4e36d359c215a17 Mon Sep 17 00:00:00 2001 From: cafeed28 Date: Thu, 29 Feb 2024 17:42:38 +0500 Subject: [PATCH] fix: disable 'Clear debug logs' if doesn't have perms --- app/src/main/java/com/cafeed28/omori/SettingsFragment.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/cafeed28/omori/SettingsFragment.java b/app/src/main/java/com/cafeed28/omori/SettingsFragment.java index db8621a..1052853 100644 --- a/app/src/main/java/com/cafeed28/omori/SettingsFragment.java +++ b/app/src/main/java/com/cafeed28/omori/SettingsFragment.java @@ -145,11 +145,13 @@ private void updatePreferences(SharedPreferences preferences) { Preference directoryPreference = findPreference(PREFERENCE_DIRECTORY); Preference oneLoaderPreference = findPreference(PREFERENCE_ONELOADER); Preference logsPreference = findPreference(PREFERENCE_LOGS); - if (directoryPreference == null || oneLoaderPreference == null || logsPreference == null) return; + Preference logsClearPreference = findPreference(PREFERENCE_LOGS_CLEAR); + if (directoryPreference == null || oneLoaderPreference == null || logsPreference == null || logsClearPreference == null) return; directoryPreference.setSummary(String.format("Current: %s", preferences.getString(PREFERENCE_DIRECTORY, "not set"))); oneLoaderPreference.setEnabled(canPlay(getContext(), mPreferences)); logsPreference.setEnabled(checkPermissions(getContext())); + logsClearPreference.setEnabled(checkPermissions(getContext())); } private void requestPermissions() {