Add confirmation dialog for clearing history (#6175)
This commit is contained in:
parent
be8c8cef4d
commit
e4d4c69519
|
@ -1,5 +1,6 @@
|
||||||
package de.danoeh.antennapod.fragment;
|
package de.danoeh.antennapod.fragment;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -7,6 +8,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
|
import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
import de.danoeh.antennapod.event.playback.PlaybackHistoryEvent;
|
import de.danoeh.antennapod.event.playback.PlaybackHistoryEvent;
|
||||||
|
@ -55,7 +57,20 @@ public class PlaybackHistoryFragment extends EpisodesListFragment {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (item.getItemId() == R.id.clear_history_item) {
|
if (item.getItemId() == R.id.clear_history_item) {
|
||||||
DBWriter.clearPlaybackHistory();
|
|
||||||
|
ConfirmationDialog conDialog = new ConfirmationDialog(
|
||||||
|
getActivity(),
|
||||||
|
R.string.clear_history_label,
|
||||||
|
R.string.clear_playback_history_msg) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfirmButtonPressed(DialogInterface dialog) {
|
||||||
|
dialog.dismiss();
|
||||||
|
DBWriter.clearPlaybackHistory();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
conDialog.createNewDialog().show();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
|
|
||||||
<!-- Playback history -->
|
<!-- Playback history -->
|
||||||
<string name="clear_history_label">Clear History</string>
|
<string name="clear_history_label">Clear History</string>
|
||||||
|
<string name="clear_playback_history_msg">This will clear the entire playback history. Are you sure you want to proceed?</string>
|
||||||
|
|
||||||
<!-- Other -->
|
<!-- Other -->
|
||||||
<string name="confirm_label">Confirm</string>
|
<string name="confirm_label">Confirm</string>
|
||||||
|
|
Loading…
Reference in New Issue