|
@@ -75,6 +75,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
static final String COMPARE_TITLE_AttacksPerTime = "Attacks per time";
|
|
|
static final String COMPARE_TITLE_AttacksPerBSSID = "Attacks per BSSID";
|
|
|
static final String COMPARE_TITLE_AttacksPerESSID = "Attacks per ESSID";
|
|
|
+ static final String FILTER_MENU_PROTOCOL_SINGLE_CHOICE_TITLE = "Select Protocol";
|
|
|
|
|
|
|
|
|
static final String OTHER_CHART_TITLE = "Other";
|
|
@@ -245,6 +246,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
|
|
|
public void setChartType(ChartType type){
|
|
|
boolean shouldChange = true;
|
|
|
+ this.clearFilter();
|
|
|
if (this.currentPlotView != null){
|
|
|
if (type == ChartType.PIE_CHART){
|
|
|
shouldChange = ! (this.currentPlotView instanceof PieGraph);
|
|
@@ -275,8 +277,9 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
this.currentPlotView = this.getPlotViewForType(type);
|
|
|
this.currentPlotView.setVisibility(View.VISIBLE);
|
|
|
|
|
|
- this.actualiseCurrentPlot();
|
|
|
}
|
|
|
+ this.actualiseCurrentPlot();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public View getPlotViewForType(ChartType type){
|
|
@@ -321,8 +324,6 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
}
|
|
|
|
|
|
private void userSelectMenuItem(AbstractPopupItem item){
|
|
|
- //int id = item.getItemId();
|
|
|
- //this.setChartType(ChartType.create(id));
|
|
|
// OPEN A DIALOG TO SPECIFY THE VISUALISE DATA
|
|
|
if (item.getTitle().equals(MENU_TITLE_PROTOCOLS)){
|
|
|
this.openProtocolDataDialog();
|
|
@@ -370,6 +371,15 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
public void onDialogPositiveClick(ChecklistDialog dialog) {
|
|
|
String title = dialog.getTitle();
|
|
|
ArrayList<String> titles =dialog.getSelectedItemTitles();
|
|
|
+
|
|
|
+ if (title.equals(FILTER_MENU_PROTOCOL_SINGLE_CHOICE_TITLE)){
|
|
|
+ this.filter.setProtocols(titles);
|
|
|
+ this.actualiseCurrentPlot();
|
|
|
+ String fragTitle = "" + this.getCurrentSelectedProtocol() + ": " + this.selectedCompareData;
|
|
|
+ this.setTitle(fragTitle);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (titles.size() != 0){
|
|
|
String data = titles.get(0);
|
|
|
this.setTitle(data);
|
|
@@ -387,6 +397,9 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
ChartType chartType = ChartType.BAR_CHART;
|
|
|
this.selectedCompareData = data;
|
|
|
this.setChartType(chartType);
|
|
|
+
|
|
|
+ String fragTitle = "" + this.getCurrentSelectedProtocol() + ": " + this.selectedCompareData;
|
|
|
+ this.setTitle(fragTitle);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -431,6 +444,15 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
*
|
|
|
* */
|
|
|
private void openFilterMenuOnView(View anchor){
|
|
|
+ ArrayList<String> titles = this.protocolTitles();
|
|
|
+ boolean[] selected = new boolean[titles.size()];
|
|
|
+ int i = 0;
|
|
|
+ for (String title : titles){
|
|
|
+ selected[i] = title.equals(this.getCurrentSelectedProtocol());
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ 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);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -481,6 +503,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
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()));
|
|
|
plotLayout.addView(this.barGraph);
|
|
|
+ this.barGraph.setShowBarText(false);
|
|
|
this.barGraph.setPopupImageID(R.drawable.popup_black);
|
|
|
this.barGraph.setOnBarClickedListener(new BarGraph.OnBarClickedListener() {
|
|
|
@Override
|
|
@@ -525,6 +548,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
|
|
|
this.lineGraph.removeAllLines();
|
|
|
Line l = new Line();
|
|
|
+ l.setColor(this.getColor(0));
|
|
|
|
|
|
for (PlotComparisonItem item : this.currentData){
|
|
|
LinePoint p = new LinePoint();
|
|
@@ -552,8 +576,8 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
for (PlotComparisonItem item : this.currentData){
|
|
|
Bar d = new Bar();
|
|
|
d.setColor(item.getColor());
|
|
|
- d.setName(item.getTitle());
|
|
|
- Double value2 = (Double) item.getValue2();
|
|
|
+ Long value2 = item.getValue2().longValue();
|
|
|
+ d.setName("" + value2);
|
|
|
d.setValue(value2.floatValue());
|
|
|
bars.add(d);
|
|
|
}
|
|
@@ -632,10 +656,14 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
return this.attacksPerProtocols();
|
|
|
}
|
|
|
public ArrayList<PlotComparisonItem> getBarData(){
|
|
|
- ArrayList<String> protocolTitles = this.getSelectedProtocolTitles();
|
|
|
+ String protocol = this.getCurrentSelectedProtocol();
|
|
|
+
|
|
|
+ if (protocol.length() > 0){
|
|
|
+ if (this.selectedCompareData.equals(COMPARE_TITLE_AttacksPerESSID)){
|
|
|
+ return this.attacksPerESSID(protocol);
|
|
|
+ }
|
|
|
|
|
|
- if (protocolTitles != null && protocolTitles.size() != 0){
|
|
|
- String protocol = this.getSelectedProtocolTitles().get(0);
|
|
|
+ // DEFAULT
|
|
|
return this.attacksPerBSSID(protocol);
|
|
|
}
|
|
|
|
|
@@ -856,7 +884,15 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
/*
|
|
|
* FILTER STUFF
|
|
|
* */
|
|
|
- public ArrayList<String> protocolTitles(){
|
|
|
+ private String getCurrentSelectedProtocol(){
|
|
|
+ ArrayList<String> protocolTitles = this.getSelectedProtocolTitles();
|
|
|
+ if (protocolTitles != null && protocolTitles.size() != 0){
|
|
|
+ return this.getSelectedProtocolTitles().get(0);
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ public ArrayList<String> protocolTitles(){
|
|
|
ArrayList<String> titles = new ArrayList<String>();
|
|
|
for (String protocol : this.getResources().getStringArray(
|
|
|
R.array.protocols)) {
|