|
@@ -4,12 +4,15 @@ import android.annotation.SuppressLint;
|
|
|
import android.app.Activity;
|
|
|
import android.app.AlertDialog;
|
|
|
import android.app.FragmentManager;
|
|
|
+import android.content.BroadcastReceiver;
|
|
|
import android.content.Context;
|
|
|
import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
+import android.content.IntentFilter;
|
|
|
import android.content.SharedPreferences;
|
|
|
import android.os.Bundle;
|
|
|
import android.preference.PreferenceManager;
|
|
|
+import android.support.v4.content.LocalBroadcastManager;
|
|
|
import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.Menu;
|
|
@@ -36,6 +39,7 @@ import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
import java.util.Random;
|
|
|
|
|
|
+import de.tudarmstadt.informatik.hostage.Handler;
|
|
|
import de.tudarmstadt.informatik.hostage.Hostage;
|
|
|
import de.tudarmstadt.informatik.hostage.R;
|
|
|
import de.tudarmstadt.informatik.hostage.logging.AttackRecord;
|
|
@@ -58,6 +62,7 @@ import de.tudarmstadt.informatik.hostage.ui.dialog.DateTimeDialogFragment;
|
|
|
import de.tudarmstadt.informatik.hostage.ui.model.ExpandableListItem;
|
|
|
import de.tudarmstadt.informatik.hostage.ui.model.LogFilter;
|
|
|
import de.tudarmstadt.informatik.hostage.ui.model.LogFilter.SortType;
|
|
|
+import de.tudarmstadt.informatik.hostage.ui.model.ServicesListItem;
|
|
|
import de.tudarmstadt.informatik.hostage.ui.popup.AbstractPopup;
|
|
|
import de.tudarmstadt.informatik.hostage.ui.popup.AbstractPopupItem;
|
|
|
import de.tudarmstadt.informatik.hostage.ui.popup.SimplePopupItem;
|
|
@@ -109,6 +114,10 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
|
|
|
|
|
|
Thread loader;
|
|
|
|
|
|
+ private boolean mReceiverRegistered = false;
|
|
|
+ private BroadcastReceiver mReceiver;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/* DATE CONVERSION STUFF*/
|
|
|
static final DateFormat localisedDateFormatter = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());
|
|
@@ -221,6 +230,8 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ this.registerBroadcastReceiver();
|
|
|
+
|
|
|
return rootView;
|
|
|
}
|
|
|
|
|
@@ -355,7 +366,6 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public void onStart() {
|
|
|
super.onStart();
|
|
@@ -604,6 +614,24 @@ public class RecordOverviewFragment extends UpNavigatibleFragment implements Che
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * register a broadcast receiver if not already registered
|
|
|
+ * and also update the number of attacks per protocol
|
|
|
+ */
|
|
|
+ private void registerBroadcastReceiver() {
|
|
|
+ if (!mReceiverRegistered) {
|
|
|
+ mReceiver = new BroadcastReceiver() {
|
|
|
+ @Override
|
|
|
+ public void onReceive(Context context, Intent intent) {
|
|
|
+ RecordOverviewFragment.this.actualiseListViewInBackground();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mReceiver, new IntentFilter(getString(R.string.broadcast)));
|
|
|
+ this.mReceiverRegistered = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Actualises the list in a background thread
|
|
|
*/
|