mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-13 01:20:27 -07:00
Merge pull request #190 from kmod-midori/streaming-cache
feat: cache streaming contents
This commit is contained in:
commit
d08c113d99
7 changed files with 152 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ import com.cappielloantonio.tempo.ui.activity.MainActivity;
|
|||
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.Preferences;
|
||||
import com.cappielloantonio.tempo.util.UIUtil;
|
||||
import com.cappielloantonio.tempo.viewmodel.SettingViewModel;
|
||||
|
|
@ -113,6 +114,22 @@ 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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue