|
@@ -2,6 +2,8 @@ package de.tudarmstadt.informatik.hostage.ui2.fragment;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
import android.app.Fragment;
|
|
|
+import android.app.FragmentManager;
|
|
|
+import android.app.FragmentTransaction;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.Color;
|
|
@@ -38,24 +40,31 @@ import de.tudarmstadt.informatik.hostage.logging.UglyDbHelper;
|
|
|
import de.tudarmstadt.informatik.hostage.ui.LogFilter;
|
|
|
import de.tudarmstadt.informatik.hostage.ui2.adapter.StatisticListAdapter;
|
|
|
import de.tudarmstadt.informatik.hostage.ui2.dialog.ChecklistDialog;
|
|
|
+import de.tudarmstadt.informatik.hostage.ui2.dialog.DateTimeDialogFragment;
|
|
|
import de.tudarmstadt.informatik.hostage.ui2.helper.ColorSequenceGenerator;
|
|
|
import de.tudarmstadt.informatik.hostage.ui2.model.PlotComparisonItem;
|
|
|
import de.tudarmstadt.informatik.hostage.ui2.popup.AbstractPopup;
|
|
|
import de.tudarmstadt.informatik.hostage.ui2.popup.AbstractPopupItem;
|
|
|
import de.tudarmstadt.informatik.hostage.ui2.popup.SimplePopupItem;
|
|
|
import de.tudarmstadt.informatik.hostage.ui2.popup.SimplePopupTable;
|
|
|
+import de.tudarmstadt.informatik.hostage.ui2.popup.SplitPopupItem;
|
|
|
|
|
|
/**
|
|
|
* Created by Julien on 16.02.14.
|
|
|
*/
|
|
|
-public class StatisticsFragment extends Fragment implements ChecklistDialog.ChecklistDialogListener {
|
|
|
+public class StatisticsFragment extends Fragment implements ChecklistDialog.ChecklistDialogListener, DateTimeDialogFragment.DateTimeDialogFragmentListener {
|
|
|
|
|
|
static final String FILTER_MENU_TITLE_BSSID = "BSSID";
|
|
|
static final String FILTER_MENU_TITLE_ESSID = "ESSID";
|
|
|
- static final String FILTER_MENU_TITLE_PROTOCOLS = "Protocol";
|
|
|
+ static final String FILTER_MENU_TITLE_PROTOCOLS = "Protocols";
|
|
|
+ static final String FILTER_MENU_TITLE_PROTOCOL = "Protocol";
|
|
|
static final String FILTER_MENU_TITLE_TIMESTAMP_BELOW = "Latest";
|
|
|
static final String FILTER_MENU_TITLE_TIMESTAMP_ABOVE = "Earliest";
|
|
|
|
|
|
+ static final String FILTER_MENU_TITLE_REMOVE = "Reset Filter";
|
|
|
+ static final String FILTER_MENU_POPUP_TITLE = "Filter by";
|
|
|
+
|
|
|
+
|
|
|
static final String MENU_TITLE_PROTOCOLS = "Protocols";
|
|
|
static final String MENU_TITLE_NETWORK = "Networks";
|
|
|
static final String MENU_TITLE_ATTACKS = "Attacks";
|
|
@@ -178,7 +187,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
this.legendListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
|
- StatisticsFragment.this.userTappedOnItem(i);
|
|
|
+ StatisticsFragment.this.userTappedOnLegendItem(i);
|
|
|
}
|
|
|
});
|
|
|
this.rootView = rootView;
|
|
@@ -209,11 +218,10 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
ImageButton visualButton = (ImageButton) rootView.findViewById(R.id.plot_data_button);
|
|
|
visualButton.setOnClickListener(new View.OnClickListener() {
|
|
|
public void onClick(View v) {
|
|
|
- StatisticsFragment.this.openPopupMenuOnView(v);
|
|
|
+ StatisticsFragment.this.openBarSelectionMenuOnView(v);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- this.setTitle(this.selectedCompareData);
|
|
|
|
|
|
ImageButton filterButton = this.getFilterButton();
|
|
|
filterButton.setOnClickListener(new View.OnClickListener() {
|
|
@@ -221,6 +229,12 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
StatisticsFragment.this.openFilterMenuOnView(v);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ if (this.currentPlotView instanceof BarGraph){
|
|
|
+ this.setTitle("" + this.getCurrentSelectedProtocol() + ": " +this.selectedCompareData);
|
|
|
+ } else {
|
|
|
+ this.setTitle(this.selectedCompareData);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void setTitle(String title){
|
|
@@ -243,6 +257,12 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
super.onStart();
|
|
|
this.actualiseCurrentPlot();
|
|
|
this.currentPlotView.invalidate();
|
|
|
+
|
|
|
+ if (this.currentPlotView instanceof BarGraph){
|
|
|
+ this.setTitle("" + this.getCurrentSelectedProtocol() + ": " +this.selectedCompareData);
|
|
|
+ } else {
|
|
|
+ this.setTitle(this.selectedCompareData);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void setChartType(ChartType type){
|
|
@@ -251,27 +271,29 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
if (this.currentPlotView != null){
|
|
|
if (type == ChartType.PIE_CHART){
|
|
|
shouldChange = ! (this.currentPlotView instanceof PieGraph);
|
|
|
+ // SET FILTER BUTTON HIDDEN
|
|
|
+ ImageButton filterButton = this.getFilterButton();
|
|
|
+ if (filterButton != null) filterButton.setVisibility(View.GONE);
|
|
|
} else {
|
|
|
if (this.pieGraph != null)
|
|
|
- this.pieGraph.setVisibility(View.INVISIBLE);
|
|
|
+ this.pieGraph.setVisibility(View.GONE);
|
|
|
+ // SHOW FILTER BUTTON
|
|
|
+ ImageButton filterButton = this.getFilterButton();
|
|
|
+ if (filterButton != null) filterButton.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
if (type == ChartType.LINE_CHART){
|
|
|
shouldChange = ! (this.currentPlotView instanceof LineGraph);
|
|
|
} else {
|
|
|
if (this.lineGraph != null)
|
|
|
- this.lineGraph.setVisibility(View.INVISIBLE);
|
|
|
+ this.lineGraph.setVisibility(View.GONE);
|
|
|
}
|
|
|
if (type == ChartType.BAR_CHART){
|
|
|
shouldChange = ! (this.currentPlotView instanceof BarGraph);
|
|
|
- // SHOW FILTER BUTTON
|
|
|
- ImageButton filterButton = this.getFilterButton();
|
|
|
- if (filterButton != null) filterButton.setVisibility(View.VISIBLE);
|
|
|
+
|
|
|
} else {
|
|
|
if (this.barGraph != null)
|
|
|
- this.barGraph.setVisibility(View.INVISIBLE);
|
|
|
- // SET FILTER BUTTON HIDDEN
|
|
|
- ImageButton filterButton = this.getFilterButton();
|
|
|
- if (filterButton != null) filterButton.setVisibility(View.INVISIBLE);
|
|
|
+ this.barGraph.setVisibility(View.GONE);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if (shouldChange){
|
|
@@ -302,7 +324,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
/*
|
|
|
* MENU
|
|
|
* */
|
|
|
- private void openPopupMenuOnView(View anchorView){
|
|
|
+ private void openBarSelectionMenuOnView(View anchorView){
|
|
|
SimplePopupTable visualiseMenu = new SimplePopupTable(this.getActivity(), new AbstractPopup.OnPopupItemClickListener() {
|
|
|
public void onItemClick(Object ob) {
|
|
|
if (ob instanceof AbstractPopupItem){
|
|
@@ -317,7 +339,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
SimplePopupItem item = new SimplePopupItem(this.getActivity());
|
|
|
item.setTitle(title);
|
|
|
item.setItemId(id);
|
|
|
- item.setSelected(this.isFilterSetForTitle(title));
|
|
|
+ item.setSelected(false);
|
|
|
visualiseMenu.addItem(item);
|
|
|
id++;
|
|
|
}
|
|
@@ -327,7 +349,10 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
private void userSelectMenuItem(AbstractPopupItem item){
|
|
|
// OPEN A DIALOG TO SPECIFY THE VISUALISE DATA
|
|
|
if (item.getTitle().equals(MENU_TITLE_PROTOCOLS)){
|
|
|
- this.openProtocolDataDialog();
|
|
|
+ ChartType chartType = ChartType.PIE_CHART;
|
|
|
+ this.selectedCompareData = COMPARE_TITLE_AttacksPerProtocol;
|
|
|
+ this.setChartType(chartType);
|
|
|
+ this.setTitle(COMPARE_TITLE_AttacksPerProtocol);
|
|
|
}
|
|
|
if (item.getTitle().equals(MENU_TITLE_NETWORK)){
|
|
|
this.openNetworkDataDialog();
|
|
@@ -373,6 +398,11 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
String title = dialog.getTitle();
|
|
|
ArrayList<String> titles =dialog.getSelectedItemTitles();
|
|
|
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
|
|
|
+ this.filter.setProtocols(titles.size() == 0 ? this.protocolTitles() : titles);
|
|
|
+ this.actualiseCurrentPlot();
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (title.equals(FILTER_MENU_PROTOCOL_SINGLE_CHOICE_TITLE)){
|
|
|
this.filter.setProtocols(titles);
|
|
|
this.actualiseCurrentPlot();
|
|
@@ -380,6 +410,16 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
this.setTitle(fragTitle);
|
|
|
return;
|
|
|
}
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_ESSID)){
|
|
|
+ this.filter.setESSIDs(titles);
|
|
|
+ this.actualiseCurrentPlot();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_BSSID)){
|
|
|
+ this.filter.setBSSIDs(titles);
|
|
|
+ this.actualiseCurrentPlot();
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
if (titles.size() != 0){
|
|
|
String data = titles.get(0);
|
|
@@ -428,8 +468,8 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
}
|
|
|
private ArrayList<String> getDialogNetworkDataTitle(){
|
|
|
ArrayList<String> data = new ArrayList<String>();
|
|
|
- data.add(COMPARE_TITLE_AttacksPerBSSID);
|
|
|
data.add(COMPARE_TITLE_AttacksPerESSID);
|
|
|
+ data.add(COMPARE_TITLE_AttacksPerBSSID);
|
|
|
return data;
|
|
|
}
|
|
|
private boolean[] selectedData(ArrayList<String> data){
|
|
@@ -445,6 +485,107 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
*
|
|
|
* */
|
|
|
private void openFilterMenuOnView(View anchor){
|
|
|
+ SimplePopupTable filterMenu = new SimplePopupTable(this.getActivity(), new AbstractPopup.OnPopupItemClickListener() {
|
|
|
+ public void onItemClick(Object ob) {
|
|
|
+ if (ob instanceof AbstractPopupItem){
|
|
|
+ AbstractPopupItem item = (AbstractPopupItem) ob;
|
|
|
+ StatisticsFragment.this.onFilterMenuItemSelected(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ filterMenu.setTitle(FILTER_MENU_POPUP_TITLE);
|
|
|
+ for(String title : StatisticsFragment.this.filterMenuTitles()){
|
|
|
+ AbstractPopupItem item = null;
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_TIMESTAMP_BELOW)) continue;
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_TIMESTAMP_ABOVE)){
|
|
|
+ item = new SplitPopupItem(this.getActivity());
|
|
|
+ item.setValue(SplitPopupItem.RIGHT_TITLE, FILTER_MENU_TITLE_TIMESTAMP_BELOW);
|
|
|
+ item.setValue(SplitPopupItem.LEFT_TITLE, FILTER_MENU_TITLE_TIMESTAMP_ABOVE);
|
|
|
+ if (this.filter.hasBelowTimestamp()){
|
|
|
+ item.setValue(SplitPopupItem.RIGHT_SUBTITLE, this.getDateAsString(this.filter.belowTimestamp));
|
|
|
+ }
|
|
|
+ if (this.filter.hasAboveTimestamp()){
|
|
|
+ item.setValue(SplitPopupItem.LEFT_SUBTITLE, this.getDateAsString(this.filter.aboveTimestamp));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item = new SimplePopupItem(this.getActivity());
|
|
|
+ item.setTitle(title);
|
|
|
+ ((SimplePopupItem)item).setSelected(this.isFilterSetForTitle(title));
|
|
|
+ }
|
|
|
+
|
|
|
+ filterMenu.addItem(item);
|
|
|
+ }
|
|
|
+ if (this.filter.isSet()){
|
|
|
+ AbstractPopupItem item = new SimplePopupItem(this.getActivity());
|
|
|
+ item.setTitle(FILTER_MENU_TITLE_REMOVE);
|
|
|
+ filterMenu.addItem(item);
|
|
|
+ }
|
|
|
+ filterMenu.showOnView(anchor);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void onFilterMenuItemSelected(AbstractPopupItem item){
|
|
|
+ if (item instanceof SplitPopupItem){
|
|
|
+ SplitPopupItem sItem = (SplitPopupItem) item;
|
|
|
+ this.wasBelowTimePicker = sItem.wasRightTouch;
|
|
|
+ if (this.wasBelowTimePicker){
|
|
|
+ this.openTimestampToFilterDialog();
|
|
|
+ } else {
|
|
|
+ this.openTimestampFromFilterDialog();
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String title = item.getTitle();
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_ESSID)){
|
|
|
+ this.openESSIDFilterDialog();
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_BSSID)){
|
|
|
+ this.openBSSIDFilterDialog();
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_PROTOCOL)){
|
|
|
+ this.openFilterDialogSelectProtocol();
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
|
|
|
+ this.openProtocolsFilterDialog();
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_REMOVE)){
|
|
|
+ this.clearFilter();
|
|
|
+ this.actualiseCurrentPlot();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ArrayList<String> filterMenuTitles(){
|
|
|
+ ArrayList<String> titles = new ArrayList<String>();
|
|
|
+ if (this.currentPlotView instanceof LineGraph){
|
|
|
+ titles.add(FILTER_MENU_TITLE_ESSID);
|
|
|
+ titles.add(FILTER_MENU_TITLE_PROTOCOLS);
|
|
|
+ titles.add(FILTER_MENU_TITLE_TIMESTAMP_ABOVE);
|
|
|
+ if (this.filter.hasESSIDs() || this.filter.hasATimestamp()){
|
|
|
+ titles.add(FILTER_MENU_TITLE_REMOVE);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ titles.add(FILTER_MENU_TITLE_PROTOCOL);
|
|
|
+ String protocol = this.getCurrentSelectedProtocol();
|
|
|
+ if (protocol.length() > 0){
|
|
|
+ if (this.selectedCompareData.equals(COMPARE_TITLE_AttacksPerBSSID)){
|
|
|
+ titles.add(FILTER_MENU_TITLE_BSSID);
|
|
|
+ }
|
|
|
+ // DEFAULT
|
|
|
+ titles.add(FILTER_MENU_TITLE_ESSID);
|
|
|
+ }
|
|
|
+ titles.add(FILTER_MENU_TITLE_TIMESTAMP_ABOVE);
|
|
|
+ if (this.filter.hasProtocols() || this.filter.hasATimestamp() || this.filter.hasESSIDs() || this.filter.hasBSSIDs()){
|
|
|
+ titles.add(FILTER_MENU_TITLE_REMOVE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return titles;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void openProtocolsFilterDialog(){
|
|
|
+ ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_PROTOCOLS,this.protocolTitles(), this.selectedProtocols(), true , this);
|
|
|
+ newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_PROTOCOLS);
|
|
|
+ }
|
|
|
+ private void openFilterDialogSelectProtocol(){
|
|
|
ArrayList<String> titles = this.protocolTitles();
|
|
|
boolean[] selected = new boolean[titles.size()];
|
|
|
int i = 0;
|
|
@@ -454,21 +595,97 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
}
|
|
|
ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_PROTOCOL_SINGLE_CHOICE_TITLE, titles, selected, false , this);
|
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_PROTOCOL_SINGLE_CHOICE_TITLE);
|
|
|
+ }
|
|
|
|
|
|
+ private void openESSIDFilterDialog(){
|
|
|
+ ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_ESSID, this.essids(), this.selectedESSIDs(), true , this);
|
|
|
+ newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_ESSID);
|
|
|
}
|
|
|
|
|
|
+ private void openBSSIDFilterDialog(){
|
|
|
+ ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_BSSID, this.bssids(), this.selectedBSSIDs(), true , this);
|
|
|
+ newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_BSSID);
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * PLOT TOUCH HANDLING
|
|
|
- *
|
|
|
- * */
|
|
|
- public void onSliceClick(int index){
|
|
|
- this.userTappedOnItem(index);
|
|
|
+ private void openTimestampFromFilterDialog(){
|
|
|
+ this.wasBelowTimePicker = false;
|
|
|
+ DateTimeDialogFragment newFragment = new DateTimeDialogFragment(this.getActivity());
|
|
|
+ newFragment.setDateChangeListener(this);
|
|
|
+ newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_TIMESTAMP_ABOVE);
|
|
|
+
|
|
|
+ if (this.filter.aboveTimestamp != Long.MIN_VALUE)newFragment.setDate(this.filter.aboveTimestamp);
|
|
|
}
|
|
|
- public void onBarClick(int index){
|
|
|
- this.userTappedOnItem(index);
|
|
|
+
|
|
|
+ private void openTimestampToFilterDialog(){
|
|
|
+ this.wasBelowTimePicker = true;
|
|
|
+ DateTimeDialogFragment newFragment = new DateTimeDialogFragment(this.getActivity());
|
|
|
+ newFragment.setDateChangeListener(this);
|
|
|
+ newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_TIMESTAMP_BELOW);
|
|
|
+ if (this.filter.belowTimestamp != Long.MAX_VALUE) newFragment.setDate(this.filter.belowTimestamp);
|
|
|
+ }
|
|
|
+
|
|
|
+ public ArrayList<String> essids(){
|
|
|
+ ArrayList<String> records;
|
|
|
+ if (this.currentPlotView instanceof BarGraph){
|
|
|
+ records = dbh.getUniqueESSIDRecordsForProtocol(this.getCurrentSelectedProtocol());
|
|
|
+ } else {
|
|
|
+ records = dbh.getUniqueESSIDRecords();
|
|
|
+ }
|
|
|
+ return records;
|
|
|
+ }
|
|
|
+ public boolean[] selectedESSIDs(){
|
|
|
+ ArrayList<String> essids = this.essids();
|
|
|
+ boolean[] selected = new boolean[essids.size()];
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ for(String essid : essids){
|
|
|
+ selected[i] =(this.filter.getESSIDs().contains(essid));
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ return selected;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ArrayList<String> bssids(){
|
|
|
+ ArrayList<String> records ;
|
|
|
+ if (this.currentPlotView instanceof BarGraph){
|
|
|
+ records = dbh.getUniqueBSSIDRecordsForProtocol(this.getCurrentSelectedProtocol());
|
|
|
+ } else {
|
|
|
+ records = dbh.getUniqueBSSIDRecords();
|
|
|
+ }
|
|
|
+ return records;
|
|
|
+ }
|
|
|
+ public boolean[] selectedBSSIDs(){
|
|
|
+ ArrayList<String> bssids = this.bssids();
|
|
|
+
|
|
|
+ boolean[] selected = new boolean[bssids.size()];
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ for(String bssid : bssids){
|
|
|
+ selected[i] =(this.filter.getBSSIDs().contains(bssid));
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ return selected;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void onDateTimePickerPositiveClick(DateTimeDialogFragment dialog) {
|
|
|
+ if(this.wasBelowTimePicker){
|
|
|
+ this.filter.setBelowTimestamp(dialog.getDate());
|
|
|
+ } else {
|
|
|
+ this.filter.setAboveTimestamp(dialog.getDate());
|
|
|
+ }
|
|
|
+ this.actualiseCurrentPlot();
|
|
|
}
|
|
|
+
|
|
|
+ public void onDateTimePickerNegativeClick(DateTimeDialogFragment dialog) {
|
|
|
+ if(this.wasBelowTimePicker){
|
|
|
+ this.filter.setBelowTimestamp(Long.MAX_VALUE);
|
|
|
+ } else {
|
|
|
+ this.filter.setAboveTimestamp(Long.MIN_VALUE);
|
|
|
+ }
|
|
|
+ this.actualiseCurrentPlot();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/*
|
|
|
*
|
|
|
* PLOT TYPES
|
|
@@ -502,7 +719,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
if (this.barGraph == null) {
|
|
|
this.barGraph = new BarGraph(this.getActivity());
|
|
|
LinearLayout plotLayout = (LinearLayout) this.rootView.findViewById(R.id.plot_layout);
|
|
|
- this.barGraph.setLayoutParams(new ViewGroup.LayoutParams(plotLayout.getWidth() - plotLayout.getPaddingLeft() - plotLayout.getPaddingRight(), plotLayout.getHeight() - - plotLayout.getPaddingTop() - plotLayout.getPaddingBottom()));
|
|
|
+ this.barGraph.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT ));
|
|
|
plotLayout.addView(this.barGraph);
|
|
|
this.barGraph.setShowBarText(false);
|
|
|
this.barGraph.setPopupImageID(R.drawable.popup_black);
|
|
@@ -545,23 +762,81 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
if (this.currentData == null){
|
|
|
this.currentData = new ArrayList<PlotComparisonItem>();
|
|
|
}
|
|
|
- int index = 0;
|
|
|
|
|
|
this.lineGraph.removeAllLines();
|
|
|
- Line l = new Line();
|
|
|
- l.setColor(this.getColor(0));
|
|
|
+ double rangeMax_Y = 0;
|
|
|
+ double rangeMin_Y = 0;
|
|
|
+
|
|
|
+ double rangeMax_X = 0;
|
|
|
+ double rangeMin_X = 0;
|
|
|
+
|
|
|
+ int count = 0;
|
|
|
+ for (PlotComparisonItem lineItem : this.currentData){
|
|
|
+ ArrayList<PlotComparisonItem> data = lineItem.getOtherData();
|
|
|
+ int index = 0;
|
|
|
+ Line l = new Line();
|
|
|
+ int lineColor = lineItem.getColor();
|
|
|
+ l.setColor(lineColor);
|
|
|
+
|
|
|
+ for (PlotComparisonItem pointItem : data){
|
|
|
+ LinePoint p = new LinePoint();
|
|
|
+ p.setX(pointItem.getValue1());
|
|
|
+ Double value2 = pointItem.getValue2();
|
|
|
+ p.setY(value2);
|
|
|
+ p.setColor(lineColor);
|
|
|
+ l.addPoint(p);
|
|
|
+ rangeMax_Y = Math.max(pointItem.getValue2(), rangeMax_Y);
|
|
|
+ rangeMax_X = Math.max(pointItem.getValue1(), rangeMax_X);
|
|
|
+
|
|
|
+ if (count != 0){
|
|
|
+ rangeMin_Y = Math.min(pointItem.getValue2(), rangeMin_Y);
|
|
|
+ rangeMin_X = Math.min(pointItem.getValue1(), rangeMin_X);
|
|
|
+ } else {
|
|
|
+ rangeMin_Y = pointItem.getValue2();
|
|
|
+ rangeMin_X = pointItem.getValue1();
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ this.lineGraph.addLine(l);
|
|
|
+ }
|
|
|
+ // add a bit more space
|
|
|
+ rangeMax_Y++;
|
|
|
+ rangeMin_Y--;
|
|
|
|
|
|
- for (PlotComparisonItem item : this.currentData){
|
|
|
- LinePoint p = new LinePoint();
|
|
|
- p.setX(index);
|
|
|
- Double value2 = (Double) item.getValue2();
|
|
|
- p.setY(value2.floatValue());
|
|
|
- p.setColor(item.getColor());
|
|
|
- l.addPoint(p);
|
|
|
- index++;
|
|
|
+ boolean shouldUseDate = this.selectedCompareData.equals(COMPARE_TITLE_AttacksPerDate);
|
|
|
+ if (shouldUseDate){
|
|
|
+ this.lineGraph.resetXLimits();
|
|
|
+
|
|
|
+ if (this.filter.hasBelowTimestamp()){
|
|
|
+ rangeMax_X = Math.max(this.filter.belowTimestamp, rangeMax_X);
|
|
|
+ }
|
|
|
+ if (this.filter.hasAboveTimestamp()){
|
|
|
+ rangeMin_X = Math.min(this.filter.aboveTimestamp, rangeMin_X);
|
|
|
+ }
|
|
|
+
|
|
|
+ double stepRange = (rangeMax_X - rangeMin_X)/(60*60*24*1000);
|
|
|
+ this.lineGraph.setxAxisStep(Math.max(1, (float) Math.min(stepRange, 4)));
|
|
|
+
|
|
|
+ this.lineGraph.setRangeX(rangeMin_X , rangeMax_X);
|
|
|
+
|
|
|
+ this.lineGraph.setConverter(new LineGraph.AxisDataConverter() {
|
|
|
+ @Override
|
|
|
+ public String convertDataForX_Position(double x) {
|
|
|
+ return StatisticsFragment.this.getDateAsDayString((long)x);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public String convertDataForY_Position(double y){
|
|
|
+ return "" + (long)y;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.lineGraph.setxAxisStep(12.f);
|
|
|
+ this.lineGraph.setRangeX(0, 24);
|
|
|
+ this.lineGraph.setConverter(null);
|
|
|
}
|
|
|
- this.lineGraph.addLine(l);
|
|
|
- this.lineGraph.setRangeY(0, index);
|
|
|
+
|
|
|
+ this.lineGraph.setRangeY(rangeMin_Y, rangeMax_Y);
|
|
|
this.lineGraph.setLineToFill(0);
|
|
|
this.lineGraph.invalidate();
|
|
|
}
|
|
@@ -597,7 +872,6 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
return this.dbh.getRecordsForFilter(this.filter);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public void actualiseCurrentPlot(){
|
|
|
LinearLayout plotLayout = (LinearLayout) this.rootView.findViewById(R.id.plot_layout);
|
|
|
View plot = this.currentPlotView;
|
|
@@ -605,25 +879,38 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
this.currentPlotView = this.getPieGraphView();
|
|
|
plot = this.currentPlotView;
|
|
|
}
|
|
|
- if (plot.getVisibility() == View.INVISIBLE) plot.setVisibility(View.VISIBLE);
|
|
|
+ if (plot.getParent() != null && !plot.getParent().equals(plotLayout)){
|
|
|
+ LinearLayout linLayout = (LinearLayout)plot.getParent();
|
|
|
+ linLayout.removeView(plot);
|
|
|
+ plot.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT ));
|
|
|
+ plotLayout.addView(plot);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (plot.getVisibility() == View.GONE) plot.setVisibility(View.VISIBLE);
|
|
|
|
|
|
if (plot instanceof PieGraph){
|
|
|
PieGraph pie = (PieGraph) plot;
|
|
|
this.setPieGraphData(pie);
|
|
|
+ // HIDE FILTER BUTTON
|
|
|
+ ImageButton filterButton = this.getFilterButton();
|
|
|
+ if (filterButton != null) filterButton.setVisibility(View.GONE);
|
|
|
} else {
|
|
|
if (this.pieGraph != null){
|
|
|
- this.pieGraph.setVisibility(View.INVISIBLE);
|
|
|
+ this.pieGraph.setVisibility(View.GONE);
|
|
|
if (this.pieGraph.getParent() != null){
|
|
|
plotLayout.removeView(this.pieGraph);
|
|
|
}
|
|
|
}
|
|
|
+ // SHOW FILTER BUTTON
|
|
|
+ ImageButton filterButton = this.getFilterButton();
|
|
|
+ if (filterButton != null) filterButton.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
if (plot instanceof BarGraph){
|
|
|
BarGraph bar = (BarGraph) plot;
|
|
|
this.setBarGraphData(bar);
|
|
|
} else {
|
|
|
if (this.barGraph != null){
|
|
|
- this.barGraph.setVisibility(View.INVISIBLE);
|
|
|
+ this.barGraph.setVisibility(View.GONE);
|
|
|
if (this.barGraph.getParent() != null){
|
|
|
plotLayout.removeView(this.barGraph);
|
|
|
}
|
|
@@ -634,7 +921,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
this.setLineGraphData(line);
|
|
|
}else {
|
|
|
if (this.lineGraph != null){
|
|
|
- this.lineGraph.setVisibility(View.INVISIBLE);
|
|
|
+ this.lineGraph.setVisibility(View.GONE);
|
|
|
if (this.lineGraph.getParent() != null){
|
|
|
plotLayout.removeView(this.lineGraph);
|
|
|
}
|
|
@@ -650,9 +937,6 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
}
|
|
|
|
|
|
public ArrayList<PlotComparisonItem> getPieData(){
|
|
|
- if (this.selectedCompareData.equals(COMPARE_TITLE_UsesPerProtocol)){
|
|
|
- return this.usesPerProtocol();
|
|
|
- }
|
|
|
// DEFAULT
|
|
|
return this.attacksPerProtocols();
|
|
|
}
|
|
@@ -663,20 +947,14 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
if (this.selectedCompareData.equals(COMPARE_TITLE_AttacksPerESSID)){
|
|
|
return this.attacksPerESSID(protocol);
|
|
|
}
|
|
|
-
|
|
|
// DEFAULT
|
|
|
return this.attacksPerBSSID(protocol);
|
|
|
}
|
|
|
-
|
|
|
// Nothing available
|
|
|
return new ArrayList<PlotComparisonItem>();
|
|
|
}
|
|
|
public ArrayList<PlotComparisonItem> getLineData(){
|
|
|
- if (this.selectedCompareData.equals(COMPARE_TITLE_AttacksPerTime)){
|
|
|
- return this.attacksPerTime();
|
|
|
- }
|
|
|
- // DEFAULT
|
|
|
- return this.attacksPerDate();
|
|
|
+ return this.attacksPerTime();
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -702,90 +980,85 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
});
|
|
|
return this.resizeData(plotItems);
|
|
|
}
|
|
|
- public ArrayList<PlotComparisonItem> usesPerProtocol(){
|
|
|
- ArrayList<PlotComparisonItem> plotItems = new ArrayList<PlotComparisonItem>();
|
|
|
- for (String title : this.getSelectedProtocolTitles()){
|
|
|
- /*At the moment there is no possibillity to get the number of uses for each protocol*/
|
|
|
- // TODO GET USES PER PROTOCOL
|
|
|
- int uses = 0;
|
|
|
- if (uses == 0) continue;
|
|
|
- // ADD ITEMS
|
|
|
- }
|
|
|
- Collections.sort(plotItems, new Comparator<PlotComparisonItem>() {
|
|
|
- @Override
|
|
|
- public int compare(PlotComparisonItem s1, PlotComparisonItem s2) {
|
|
|
- return s1.getTitle().compareToIgnoreCase(s2.getTitle());
|
|
|
- }
|
|
|
- });
|
|
|
- return plotItems;
|
|
|
- }
|
|
|
/*LINE PLOT DATA*/
|
|
|
- public ArrayList<PlotComparisonItem> attacksPerDate(){
|
|
|
- ArrayList<PlotComparisonItem> plotItems = new ArrayList<PlotComparisonItem>();
|
|
|
- HashMap<Long, ArrayList<Record> > recordMap = new HashMap<Long, ArrayList<Record> >();
|
|
|
+
|
|
|
+ public ArrayList<PlotComparisonItem> attacksPerTime(){
|
|
|
+ HashMap<String,HashMap<Long, ArrayList<Record> > > lineMap = new HashMap<String, HashMap<Long, ArrayList<Record>>>();
|
|
|
+
|
|
|
+ boolean shouldUseDate = this.selectedCompareData.equals(COMPARE_TITLE_AttacksPerDate);
|
|
|
|
|
|
for (Record record : this.getFetchedRecords()){
|
|
|
long timestamp = record.getTimestamp();
|
|
|
- long date = this.getDateFromMilliseconds(timestamp);
|
|
|
- ArrayList<Record> list = recordMap.get(date);
|
|
|
- if (list == null){
|
|
|
- list = new ArrayList<Record>();
|
|
|
- recordMap.put(date, list);
|
|
|
+ long time = 0;
|
|
|
+ if (shouldUseDate){
|
|
|
+ time = this.getDateFromMilliseconds(timestamp);
|
|
|
+ } else {
|
|
|
+ time = this.getDayHourFromDate(timestamp);
|
|
|
}
|
|
|
- list.add(record);
|
|
|
- }
|
|
|
- int index = 0;
|
|
|
- for (long date : recordMap.keySet()){
|
|
|
- ArrayList<Record> list = recordMap.get(date);
|
|
|
- if (list.size() == 0) continue;
|
|
|
- // TODO SET CORRECT COLOR
|
|
|
- PlotComparisonItem item = new PlotComparisonItem(this.getDateAsDayString(date), this.getColor(0), (double) date, (double)list.size());
|
|
|
- plotItems.add(item);
|
|
|
- index++;
|
|
|
- }
|
|
|
- Collections.sort(plotItems, new Comparator<PlotComparisonItem>() {
|
|
|
- @Override
|
|
|
- public int compare(PlotComparisonItem s1, PlotComparisonItem s2) {
|
|
|
- return s1.getValue1().compareTo(s2.getValue1());
|
|
|
+
|
|
|
+ // GET CORRECT MAP
|
|
|
+ HashMap<Long, ArrayList<Record> > recordMap;
|
|
|
+ String groupKey = record.getSsid();
|
|
|
+ if (lineMap.containsKey(groupKey)){
|
|
|
+ recordMap = lineMap.get(record.getSsid());
|
|
|
+ } else {
|
|
|
+ recordMap = new HashMap<Long, ArrayList<Record> >();
|
|
|
+ lineMap.put(groupKey, recordMap);
|
|
|
}
|
|
|
- });
|
|
|
- return plotItems;
|
|
|
- }
|
|
|
- public ArrayList<PlotComparisonItem> attacksPerTime(){
|
|
|
- ArrayList<PlotComparisonItem> plotItems = new ArrayList<PlotComparisonItem>();
|
|
|
- HashMap<Long, ArrayList<Record> > recordMap = new HashMap<Long, ArrayList<Record> >();
|
|
|
|
|
|
- for (Record record : this.getFetchedRecords()){
|
|
|
- long timestamp = record.getTimestamp();
|
|
|
- long time = this.getDayHourFromDate(timestamp);
|
|
|
- ArrayList<Record> list = recordMap.get(time);
|
|
|
- if (list == null){
|
|
|
+ // GET LIST OF RECORDS
|
|
|
+ ArrayList<Record> list;
|
|
|
+ if (recordMap.containsKey(time)){
|
|
|
+ list = recordMap.get(time);
|
|
|
+ } else {
|
|
|
list = new ArrayList<Record>();
|
|
|
recordMap.put(time, list);
|
|
|
}
|
|
|
list.add(record);
|
|
|
}
|
|
|
+
|
|
|
+ ArrayList<PlotComparisonItem> plotItems = new ArrayList<PlotComparisonItem>();
|
|
|
+
|
|
|
int index = 0;
|
|
|
- for (long time : recordMap.keySet()){
|
|
|
- ArrayList<Record> list = recordMap.get(time);
|
|
|
- if (list.size() == 0) continue;
|
|
|
- // TODO SET CURRECT COLOR
|
|
|
- PlotComparisonItem item = new PlotComparisonItem(this.getDateAsTimeString(time), this.getColor(0) , (double)time, (double) list.size());
|
|
|
+ for (String groupKey : lineMap.keySet()){
|
|
|
+ HashMap<Long, ArrayList<Record> > recordMap = lineMap.get(groupKey);
|
|
|
+ ArrayList<PlotComparisonItem> singleLineItems = new ArrayList<PlotComparisonItem>();
|
|
|
+
|
|
|
+ for (long time : recordMap.keySet()){
|
|
|
+ ArrayList<Record>list = recordMap.get(time);
|
|
|
+ if (list.size() == 0) continue;
|
|
|
+ PlotComparisonItem item = new PlotComparisonItem(this.getHourAsTimeString(time), 0 , (double)time, (double) list.size());
|
|
|
+ singleLineItems.add(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ Collections.sort(singleLineItems, new Comparator<PlotComparisonItem>() {
|
|
|
+ @Override
|
|
|
+ public int compare(PlotComparisonItem s1, PlotComparisonItem s2) {
|
|
|
+ return s1.getValue1().compareTo(s2.getValue1());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ PlotComparisonItem item = new PlotComparisonItem(groupKey, this.getColor(index), 0., (double) singleLineItems.size());
|
|
|
+ item.setOtherData(singleLineItems);
|
|
|
plotItems.add(item);
|
|
|
index++;
|
|
|
}
|
|
|
Collections.sort(plotItems, new Comparator<PlotComparisonItem>() {
|
|
|
@Override
|
|
|
public int compare(PlotComparisonItem s1, PlotComparisonItem s2) {
|
|
|
- return s1.getValue1().compareTo(s2.getValue1());
|
|
|
+ return s2.getValue2().compareTo(s1.getValue2());
|
|
|
}
|
|
|
});
|
|
|
- return plotItems;
|
|
|
+ return plotItems;
|
|
|
}
|
|
|
// BAR PLOT DATA
|
|
|
public ArrayList<PlotComparisonItem> attacksPerBSSID(String protocol){
|
|
|
LogFilter filter = new LogFilter();
|
|
|
ArrayList<String> protocollist = new ArrayList<String>();
|
|
|
+ filter.setAboveTimestamp(this.filter.getAboveTimestamp());
|
|
|
+ filter.setBelowTimestamp(this.filter.getBelowTimestamp());
|
|
|
+ filter.setBSSIDs(this.filter.getBSSIDs());
|
|
|
protocollist.add(protocol);
|
|
|
filter.setProtocols(protocollist);
|
|
|
|
|
@@ -819,6 +1092,9 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
}
|
|
|
public ArrayList<PlotComparisonItem> attacksPerESSID(String protocol){
|
|
|
LogFilter filter = new LogFilter();
|
|
|
+ filter.setAboveTimestamp(this.filter.getAboveTimestamp());
|
|
|
+ filter.setBelowTimestamp(this.filter.getBelowTimestamp());
|
|
|
+ filter.setESSIDs(this.filter.getESSIDs());
|
|
|
ArrayList<String> protocollist = new ArrayList<String>();
|
|
|
protocollist.add(protocol);
|
|
|
filter.setProtocols(protocollist);
|
|
@@ -1001,39 +1277,33 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
long millisInDay = 60 * 60 * 24 * 1000;
|
|
|
return (timeInMillis / millisInDay) * millisInDay;
|
|
|
|
|
|
- /*
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTimeInMillis (timeInMillis);
|
|
|
-
|
|
|
- int year = calendar.get(Calendar.YEAR) ;
|
|
|
- int month = calendar.get(Calendar.MONTH);
|
|
|
- int day = calendar.get(Calendar.DATE);
|
|
|
+ }
|
|
|
|
|
|
- calendar.set(year, month, day, 0,0);
|
|
|
- return calendar.getTimeInMillis();
|
|
|
- */
|
|
|
+ /*
|
|
|
+ *
|
|
|
+ * */
|
|
|
+ private String getHourAsTimeString(long hour) {
|
|
|
+ return "" + hour + ":00";
|
|
|
}
|
|
|
|
|
|
- static final DateFormat timeFormat = new SimpleDateFormat("H:mm");
|
|
|
+ static final DateFormat dateFormat = new SimpleDateFormat("d.M.yyyy");
|
|
|
@SuppressLint("SimpleDateFormat")
|
|
|
- private String getDateAsTimeString(long timeStamp) {
|
|
|
- return "" + timeStamp + ":00";
|
|
|
- /*
|
|
|
+ private String getDateAsDayString(long timeStamp) {
|
|
|
try {
|
|
|
Date netDate = (new Date(timeStamp));
|
|
|
- return timeFormat.format(netDate);
|
|
|
+ return dateFormat.format(netDate);
|
|
|
} catch (Exception ex) {
|
|
|
return "xx";
|
|
|
}
|
|
|
- */
|
|
|
}
|
|
|
|
|
|
- static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
|
|
@SuppressLint("SimpleDateFormat")
|
|
|
- private String getDateAsDayString(long timeStamp) {
|
|
|
+ private String getDateAsString(long timeStamp) {
|
|
|
+
|
|
|
try {
|
|
|
+ DateFormat sdf = new SimpleDateFormat("H:mm dd/MM/yyyy");
|
|
|
Date netDate = (new Date(timeStamp));
|
|
|
- return dateFormat.format(netDate);
|
|
|
+ return sdf.format(netDate);
|
|
|
} catch (Exception ex) {
|
|
|
return "xx";
|
|
|
}
|
|
@@ -1043,10 +1313,11 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
/**
|
|
|
* USERINTERACTION
|
|
|
*/
|
|
|
- private void userTappedOnItem(int index){
|
|
|
+ private void userTappedOnLegendItem(int index){
|
|
|
if (index < this.currentData.size()){
|
|
|
PlotComparisonItem item = this.currentData.get(index);
|
|
|
ArrayList<String> selectedData;
|
|
|
+ String sortKey = null;
|
|
|
selectedData = new ArrayList<String>();
|
|
|
|
|
|
if (item.getOtherData() == null){
|
|
@@ -1061,20 +1332,61 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
filter.setProtocols(selectedData);
|
|
|
}
|
|
|
if (this.currentPlotView instanceof BarGraph){
|
|
|
- // TODO set data for BSSID / ESSID
|
|
|
+
|
|
|
+ if (this.selectedCompareData.equals(COMPARE_TITLE_AttacksPerESSID)){
|
|
|
+ filter.setESSIDs(selectedData);
|
|
|
+ sortKey = "ESSID";
|
|
|
+ } else {
|
|
|
+ filter.setBSSIDs(selectedData);
|
|
|
+ sortKey = "BSSID";
|
|
|
+ }
|
|
|
+ ArrayList<String> currentSelectedProtocol = new ArrayList<String>();
|
|
|
+ currentSelectedProtocol.add(this.getCurrentSelectedProtocol());
|
|
|
+ filter.setProtocols(currentSelectedProtocol);
|
|
|
}
|
|
|
if (this.currentPlotView instanceof LineGraph){
|
|
|
- // TODO set data for BSSID / ESSID
|
|
|
+ selectedData = new ArrayList<String>();
|
|
|
+ selectedData.add(item.getTitle());
|
|
|
+ filter.setESSIDs(selectedData);
|
|
|
+ filter.setProtocols(this.filter.getProtocols());
|
|
|
+ sortKey = "ESSID";
|
|
|
}
|
|
|
|
|
|
- this.pushRecordOverviewForFilter(filter);
|
|
|
+ if (this.filter.hasATimestamp()){
|
|
|
+ filter.setAboveTimestamp(this.filter.getAboveTimestamp());
|
|
|
+ filter.setBelowTimestamp(this.filter.getBelowTimestamp());
|
|
|
+ }
|
|
|
+
|
|
|
+ this.pushRecordOverviewForFilter(filter, sortKey);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ public void onSliceClick(int index){
|
|
|
|
|
|
}
|
|
|
+ public void onBarClick(int index){
|
|
|
+ this.userTappedOnLegendItem(index);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void pushRecordOverviewForFilter(LogFilter filter, String sortKey){
|
|
|
|
|
|
- private void pushRecordOverviewForFilter(LogFilter filter){
|
|
|
+ FragmentManager fm = this.getActivity().getFragmentManager();
|
|
|
+
|
|
|
+ if (fm != null){
|
|
|
+ RecordOverviewFragment newFragment = new RecordOverviewFragment();
|
|
|
+ newFragment.setFilter(filter);
|
|
|
+
|
|
|
+ if (sortKey != null && sortKey.length() != 0) newFragment.setGroupKey(sortKey);
|
|
|
+
|
|
|
+ FragmentTransaction transaction = fm.beginTransaction();
|
|
|
+ transaction.replace(R.id.content_frame, newFragment, newFragment.getTag());
|
|
|
+ transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
|
|
|
+ transaction.addToBackStack(null);
|
|
|
+
|
|
|
+ transaction.commit();
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|