|
@@ -426,6 +426,33 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public void openDeleteFilteredAttacksDialog() {
|
|
|
+ // Use the Builder class for convenient dialog construction
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
|
|
+
|
|
|
+ String deleteAttacksTitle = MainActivity.getInstance().getString(R.string.deleteAttacksTitle);
|
|
|
+ String cancelTitle = MainActivity.getInstance().getString(R.string.cancel);
|
|
|
+ String deleteTitle = MainActivity.getInstance().getString(R.string.delete);
|
|
|
+
|
|
|
+ builder.setMessage(deleteAttacksTitle)
|
|
|
+ .setPositiveButton(deleteTitle, new DialogInterface.OnClickListener() {
|
|
|
+ private RecordOverviewFragment recordOverviewFragment = null;
|
|
|
+ public void onClick(DialogInterface dialog, int id) {
|
|
|
+ recordOverviewFragment.deleteFilteredAttacks();
|
|
|
+ }
|
|
|
+ public DialogInterface.OnClickListener init(RecordOverviewFragment rf){
|
|
|
+ this.recordOverviewFragment = rf;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+ }.init(this))
|
|
|
+ .setNegativeButton(cancelTitle, new DialogInterface.OnClickListener() {
|
|
|
+ public void onClick(DialogInterface dialog, int id) {
|
|
|
+ // User cancelled the dialog
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
@@ -1328,6 +1355,15 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Deletes the current displayed attacks.
|
|
|
+ */
|
|
|
+ public void deleteFilteredAttacks(){
|
|
|
+ LogFilter filter = this.filter;
|
|
|
+ dbh.deleteAttacksByFilter(filter);
|
|
|
+ this.actualiseListViewInBackground();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Will be called if the users clicks the negativ button on a ChechlistDialog.
|
|
|
* @param dialog {@link ChecklistDialog ChecklistDialog }
|