|
@@ -8,8 +8,6 @@ import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.content.res.Configuration;
|
|
|
import android.graphics.Color;
|
|
|
-import android.graphics.PorterDuff;
|
|
|
-import android.graphics.drawable.Drawable;
|
|
|
import android.os.Bundle;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
@@ -86,12 +84,12 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
static final String CHART_TYPE_TITLE_PIE = MainActivity.getContext().getString(R.string.stats_pie_plot);
|
|
|
static final String CHART_TYPE_TITLE_LINE = MainActivity.getContext().getString(R.string.stats_line_plot);
|
|
|
|
|
|
- static final String DIALOG_PROTOCOLS_TITLE = MainActivity.getContext().getString(R.string.stats_select_protocol_data);
|
|
|
+ //static final String DIALOG_PROTOCOLS_TITLE = MainActivity.getContext().getString(R.string.stats_select_protocol_data);
|
|
|
static final String DIALOG_NETWORK_TITLE = MainActivity.getContext().getString(R.string.stats_select_network_data);
|
|
|
static final String DIALOG_ATTACK_TITLE = MainActivity.getContext().getString(R.string.stats_select_attack_data);
|
|
|
|
|
|
static final String COMPARE_TITLE_AttacksPerProtocol = MainActivity.getContext().getString(R.string.stats_attacks_protocol);
|
|
|
- static final String COMPARE_TITLE_UsesPerProtocol = MainActivity.getContext().getString(R.string.stats_uses_protocol);
|
|
|
+ //static final String COMPARE_TITLE_UsesPerProtocol = MainActivity.getContext().getString(R.string.stats_uses_protocol);
|
|
|
static final String COMPARE_TITLE_AttacksPerDate = MainActivity.getContext().getString(R.string.stats_attacks_date);
|
|
|
static final String COMPARE_TITLE_AttacksPerTime = MainActivity.getContext().getString(R.string.stats_attacks_time);
|
|
|
static final String COMPARE_TITLE_AttacksPerBSSID = MainActivity.getContext().getString(R.string.stats_attacks_bssid);
|
|
@@ -110,6 +108,8 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
private boolean wasBelowTimePicker;
|
|
|
|
|
|
private LogFilter filter;
|
|
|
+
|
|
|
+ /*Maybe used in the future if the users doesn't need a filterbutton in every situation*/
|
|
|
private boolean showFilterButton;
|
|
|
|
|
|
private PieGraph pieGraph;
|
|
@@ -122,7 +122,6 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
private Thread loader;
|
|
|
private ProgressBar spinner;
|
|
|
|
|
|
- private ArrayList<Integer> colorList;
|
|
|
private ArrayList<PlotComparisonItem> currentData;
|
|
|
|
|
|
private HostageDBOpenHelper dbh;
|
|
@@ -133,6 +132,11 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
private String selectedCompareData = COMPARE_TITLE_AttacksPerProtocol;
|
|
|
|
|
|
|
|
|
+ /**The Charttype.
|
|
|
+ * PIE_CHART = 0
|
|
|
+ * BAR_CHART = 1
|
|
|
+ * LINE_CHART = 2
|
|
|
+ */
|
|
|
public enum ChartType {
|
|
|
PIE_CHART(0),
|
|
|
BAR_CHART(1),
|
|
@@ -998,8 +1002,8 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
|
|
|
int count = 0;
|
|
|
for (PlotComparisonItem lineItem : this.currentData){
|
|
|
- ArrayList<PlotComparisonItem> data = lineItem.getOtherData();
|
|
|
- int index = 0;
|
|
|
+ ArrayList<PlotComparisonItem> data = lineItem.getChildItems();
|
|
|
+ //int index = 0;
|
|
|
Line l = new Line();
|
|
|
int lineColor = lineItem.getColor();
|
|
|
l.setColor(lineColor);
|
|
@@ -1021,7 +1025,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
rangeMin_Y = pointItem.getValue2();
|
|
|
rangeMin_X = pointItem.getValue1();
|
|
|
}
|
|
|
- index++;
|
|
|
+ //index++;
|
|
|
count++;
|
|
|
}
|
|
|
linegraph.addLine(l);
|
|
@@ -1077,7 +1081,6 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
rangeMax_Y = rangeMin_Y + maxY;
|
|
|
linegraph.setRangeY(rangeMin_Y, rangeMax_Y);
|
|
|
linegraph.setLineToFill(0);
|
|
|
- linegraph.invalidate();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1102,7 +1105,6 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
}
|
|
|
|
|
|
barGraph.setBars(bars);
|
|
|
- barGraph.invalidate();
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -1365,7 +1367,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
|
|
|
double itemValue = (((double)numbOfAttacks / (double)records.size())*100.);
|
|
|
PlotComparisonItem item = new PlotComparisonItem(groupKey, this.getColor(index), (double) numbOfAttacks, itemValue);
|
|
|
- item.setOtherData(singleLineItems);
|
|
|
+ item.setChildItems(singleLineItems);
|
|
|
plotItems.add(item);
|
|
|
index++;
|
|
|
}
|
|
@@ -1491,7 +1493,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
}
|
|
|
}
|
|
|
PlotComparisonItem otherItem = new PlotComparisonItem(OTHER_CHART_TITLE, this.getOtherColor(), 0., valueOfOthers);
|
|
|
- otherItem.setOtherData(others);
|
|
|
+ otherItem.setChildItems(others);
|
|
|
copy.add(otherItem);
|
|
|
|
|
|
Collections.sort(copy, new Comparator<PlotComparisonItem>() {
|
|
@@ -1652,7 +1654,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
|
|
|
calendar.setTimeInMillis (timeInMillis);
|
|
|
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
|
|
- int min = calendar.get(Calendar.MINUTE);
|
|
|
+ //int min = calendar.get(Calendar.MINUTE);
|
|
|
|
|
|
return hour;
|
|
|
|
|
@@ -1670,7 +1672,7 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
|
|
|
/**
|
|
|
* Returns the given hour as a formated string.
|
|
|
- *
|
|
|
+ * Format: "HH:00"
|
|
|
* */
|
|
|
private String getHourAsTimeString(long hour) {
|
|
|
return "" + hour + ":00";
|
|
@@ -1685,7 +1687,9 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
private String getDateAsDayString(long timeStamp) {
|
|
|
try {
|
|
|
Date netDate = (new Date(timeStamp));
|
|
|
+ DateFormat dateFormat = android.text.format.DateFormat.getMediumDateFormat(this.getActivity());
|
|
|
return dateFormat.format(netDate);
|
|
|
+ //return dateFormat.format(netDate);
|
|
|
} catch (Exception ex) {
|
|
|
return "xx";
|
|
|
}
|
|
@@ -1720,10 +1724,10 @@ public class StatisticsFragment extends Fragment implements ChecklistDialog.Chec
|
|
|
String sortKey = null;
|
|
|
selectedData = new ArrayList<String>();
|
|
|
|
|
|
- if (item.getOtherData() == null){
|
|
|
+ if (item.getChildItems() == null){
|
|
|
selectedData.add(item.getTitle());
|
|
|
} else {
|
|
|
- for (PlotComparisonItem other : item.getOtherData()){
|
|
|
+ for (PlotComparisonItem other : item.getChildItems()){
|
|
|
selectedData.add(other.getTitle());
|
|
|
}
|
|
|
}
|