mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-13 01:20:27 -07:00
style: code clean up
This commit is contained in:
parent
a3d8b75d07
commit
dacaa03eb7
5 changed files with 29 additions and 24 deletions
|
|
@ -31,6 +31,7 @@ import com.cappielloantonio.tempo.ui.dialog.DeleteDownloadStorageDialog;
|
|||
import com.cappielloantonio.tempo.ui.dialog.DownloadStorageDialog;
|
||||
import com.cappielloantonio.tempo.ui.dialog.StarredSyncDialog;
|
||||
import com.cappielloantonio.tempo.util.DownloadUtil;
|
||||
import com.cappielloantonio.tempo.util.MusicUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
import com.cappielloantonio.tempo.util.UIUtil;
|
||||
import com.cappielloantonio.tempo.viewmodel.SettingViewModel;
|
||||
|
|
@ -85,6 +86,7 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||
checkEqualizer();
|
||||
checkStorage();
|
||||
|
||||
setStreamingCacheSize();
|
||||
setAppLanguage();
|
||||
setVersion();
|
||||
|
||||
|
|
@ -114,22 +116,6 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
ListPreference streamingCachePreference = findPreference("streaming_cache_size");
|
||||
if (streamingCachePreference != null) {
|
||||
streamingCachePreference.setSummaryProvider(new Preference.SummaryProvider<ListPreference>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence provideSummary(@NonNull ListPreference preference) {
|
||||
CharSequence entry = preference.getEntry();
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
long currentSizeMb = DownloadUtil.getStreamingCacheSize(requireActivity()) / (1024 * 1024);
|
||||
return entry + "\nCurrently in use: " + + currentSizeMb + " MiB\nRestarting is required if changed.";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void checkEqualizer() {
|
||||
|
|
@ -165,6 +151,26 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
|||
}
|
||||
}
|
||||
|
||||
private void setStreamingCacheSize() {
|
||||
ListPreference streamingCachePreference = findPreference("streaming_cache_size");
|
||||
|
||||
if (streamingCachePreference != null) {
|
||||
streamingCachePreference.setSummaryProvider(new Preference.SummaryProvider<ListPreference>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence provideSummary(@NonNull ListPreference preference) {
|
||||
CharSequence entry = preference.getEntry();
|
||||
|
||||
if (entry == null) return null;
|
||||
|
||||
long currentSizeMb = DownloadUtil.getStreamingCacheSize(requireActivity()) / (1024 * 1024);
|
||||
|
||||
return getString(R.string.settings_summary_streaming_cache_size, entry, currentSizeMb);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void setAppLanguage() {
|
||||
ListPreference localePref = (ListPreference) findPreference("language");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue