|
@@ -3,6 +3,9 @@ package de.tudarmstadt.informatik.hostage.ui2.fragment;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
|
|
|
+import android.app.Activity;
|
|
|
+import android.app.AlertDialog;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.os.Bundle;
|
|
|
import android.text.format.DateFormat;
|
|
|
import android.view.LayoutInflater;
|
|
@@ -11,12 +14,15 @@ import android.view.MenuInflater;
|
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
+import android.widget.Button;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.ScrollView;
|
|
|
import android.widget.TextView;
|
|
|
import de.tudarmstadt.informatik.hostage.R;
|
|
|
import de.tudarmstadt.informatik.hostage.deprecated.UglyDbHelper;
|
|
|
import de.tudarmstadt.informatik.hostage.logging.Record;
|
|
|
+import de.tudarmstadt.informatik.hostage.ui.LogFilter;
|
|
|
+import de.tudarmstadt.informatik.hostage.ui2.activity.MainActivity;
|
|
|
|
|
|
/**
|
|
|
* Created by Julien on 02.03.14.
|
|
@@ -74,6 +80,7 @@ public class RecordDetailFragment extends UpNavigatibleFragment {
|
|
|
private TextView mRecordDetailsTextBssid;
|
|
|
private TextView mRecordDetailsTextRemoteip;
|
|
|
private TextView mRecordDetailsTextProtocol;
|
|
|
+ private Button mRecordDeleteButton;
|
|
|
|
|
|
public void setRecord(Record rec) {
|
|
|
this.record = rec;
|
|
@@ -120,6 +127,7 @@ public class RecordDetailFragment extends UpNavigatibleFragment {
|
|
|
mRecordDetailsTextBssid = (TextView) view.findViewById(R.id.record_details_text_bssid);
|
|
|
mRecordDetailsTextRemoteip = (TextView) view.findViewById(R.id.record_details_text_remoteip);
|
|
|
mRecordDetailsTextProtocol = (TextView) view.findViewById(R.id.record_details_text_protocol);
|
|
|
+ mRecordDeleteButton = (Button) view.findViewById(R.id.record_delete_button);
|
|
|
}
|
|
|
|
|
|
private void configurateRootView(View rootView) {
|
|
@@ -172,6 +180,35 @@ public class RecordDetailFragment extends UpNavigatibleFragment {
|
|
|
|
|
|
mRecordOverviewConversation.addView(row);
|
|
|
}
|
|
|
+
|
|
|
+ mRecordDeleteButton.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ Activity activity = getActivity();
|
|
|
+ if (activity == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ new AlertDialog.Builder(getActivity())
|
|
|
+ .setTitle(android.R.string.dialog_alert_title)
|
|
|
+ .setMessage(R.string.record_details_confirm_delete)
|
|
|
+ .setPositiveButton(R.string.yes,
|
|
|
+ new DialogInterface.OnClickListener() {
|
|
|
+ public void onClick(DialogInterface dialog,
|
|
|
+ int which) {
|
|
|
+ dbh.deleteByAttackID(record.getAttack_id());
|
|
|
+
|
|
|
+ // TODO: just navigate back...
|
|
|
+ RecordOverviewFragment recordOverviewFragment = new RecordOverviewFragment();
|
|
|
+ recordOverviewFragment.setFilter(new LogFilter());
|
|
|
+ recordOverviewFragment.setGroupKey("Protocol");
|
|
|
+
|
|
|
+ MainActivity.getInstance().injectFragment(recordOverviewFragment, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ).setNegativeButton(R.string.no, null)
|
|
|
+ .setIcon(android.R.drawable.ic_dialog_alert).show();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/*****************************
|