Skip to content

Commit

Permalink
fix: disable 'Clear debug logs' if doesn't have perms
Browse files Browse the repository at this point in the history
  • Loading branch information
cafeed28 committed Feb 29, 2024
1 parent f67c34a commit da283db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/main/java/com/cafeed28/omori/SettingsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit da283db

Please sign in to comment.