Merge pull request #2550 from TeamNewPipe/clear_playback_states
Clear playback states
This commit is contained in:
commit
85d1888ba7
4 changed files with 43 additions and 4 deletions
|
@ -19,6 +19,7 @@ import io.reactivex.disposables.Disposable;
|
|||
public class HistorySettingsFragment extends BasePreferenceFragment {
|
||||
private String cacheWipeKey;
|
||||
private String viewsHistoryClearKey;
|
||||
private String playbackStatesClearKey;
|
||||
private String searchHistoryClearKey;
|
||||
private HistoryRecordManager recordManager;
|
||||
private CompositeDisposable disposables;
|
||||
|
@ -28,6 +29,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
|||
super.onCreate(savedInstanceState);
|
||||
cacheWipeKey = getString(R.string.metadata_cache_wipe_key);
|
||||
viewsHistoryClearKey = getString(R.string.clear_views_history_key);
|
||||
playbackStatesClearKey = getString(R.string.clear_playback_states_key);
|
||||
searchHistoryClearKey = getString(R.string.clear_search_history_key);
|
||||
recordManager = new HistoryRecordManager(getActivity());
|
||||
disposables = new CompositeDisposable();
|
||||
|
@ -63,7 +65,7 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
|||
ErrorActivity.ErrorInfo.make(
|
||||
UserAction.DELETE_FROM_HISTORY,
|
||||
"none",
|
||||
"Delete view history",
|
||||
"Delete playback states",
|
||||
R.string.general_error)));
|
||||
|
||||
final Disposable onDelete = recordManager.deleteWholeStreamHistory()
|
||||
|
@ -101,6 +103,33 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
|||
.show();
|
||||
}
|
||||
|
||||
if (preference.getKey().equals(playbackStatesClearKey)) {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.delete_playback_states_alert)
|
||||
.setNegativeButton(R.string.cancel, ((dialog, which) -> dialog.dismiss()))
|
||||
.setPositiveButton(R.string.delete, ((dialog, which) -> {
|
||||
|
||||
final Disposable onDeletePlaybackStates = recordManager.deleteCompelteStreamStateHistory()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
howManyDeleted -> Toast.makeText(getActivity(),
|
||||
R.string.watch_history_states_deleted,
|
||||
Toast.LENGTH_SHORT).show(),
|
||||
throwable -> ErrorActivity.reportError(getContext(),
|
||||
throwable,
|
||||
SettingsActivity.class, null,
|
||||
ErrorActivity.ErrorInfo.make(
|
||||
UserAction.DELETE_FROM_HISTORY,
|
||||
"none",
|
||||
"Delete playback states",
|
||||
R.string.general_error)));
|
||||
|
||||
disposables.add(onDeletePlaybackStates);
|
||||
}))
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
|
||||
if (preference.getKey().equals(searchHistoryClearKey)) {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.delete_search_history_alert)
|
||||
|
|
|
@ -153,13 +153,14 @@
|
|||
<string name="enable_playback_resume_key" translatable="false">enable_playback_resume</string>
|
||||
<string name="enable_playback_state_lists_key" translatable="false">enable_playback_state_lists</string>
|
||||
|
||||
<string name="import_data">import_data</string>
|
||||
<string name="export_data">export_data</string>
|
||||
<string name="import_data" translatable="false">import_data</string>
|
||||
<string name="export_data" translatable="false">export_data</string>
|
||||
|
||||
<string name="download_thumbnail_key" translatable="false">download_thumbnail_key</string>
|
||||
|
||||
<string name="metadata_cache_wipe_key" translatable="false">cache_wipe_key</string>
|
||||
<string name="clear_views_history_key" translatable="false">clear_play_history</string>
|
||||
<string name="clear_playback_states_key" translatable="false">clear_playback_states</string>
|
||||
<string name="clear_search_history_key" translatable="false">clear_search_history</string>
|
||||
|
||||
<string name="downloads_storage_ask" translatable="false">downloads_storage_ask</string>
|
||||
|
|
|
@ -171,9 +171,12 @@
|
|||
<string name="import_data_summary">Overrides your current history and subscriptions</string>
|
||||
<string name="export_data_summary">Export history, subscriptions and playlists</string>
|
||||
<string name="clear_views_history_title">Clear watch history</string>
|
||||
<string name="clear_views_history_summary">Deletes the history of played streams</string>
|
||||
<string name="clear_views_history_summary">Deletes the history of played streams and the playback positions</string>
|
||||
<string name="delete_view_history_alert">Delete entire watch history?</string>
|
||||
<string name="watch_history_deleted">Watch history deleted.</string>
|
||||
<string name="clear_playback_states_title">Delete playback positions</string>
|
||||
<string name="clear_playback_states_summary">Deletes all playback positions</string>
|
||||
<string name="delete_playback_states_alert">Delete all playback positions?</string>
|
||||
<string name="watch_history_states_deleted">Playback positions deleted.</string>
|
||||
<string name="clear_search_history_title">Clear search history</string>
|
||||
<string name="clear_search_history_summary">Deletes history of search keywords</string>
|
||||
|
|
|
@ -51,6 +51,12 @@
|
|||
android:title="@string/clear_views_history_title"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/clear_playback_states_key"
|
||||
android:summary="@string/clear_playback_states_summary"
|
||||
android:title="@string/clear_playback_states_title"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<Preference
|
||||
android:key="@string/clear_search_history_key"
|
||||
android:summary="@string/clear_search_history_summary"
|
||||
|
|
Loading…
Reference in a new issue