|
@@ -48,9 +48,9 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
static final String SELECTED_KEY = "Selected";
|
|
|
static final String OTHERS_KEY = "Other";
|
|
|
|
|
|
- static final String FILTER_MENU_TITLE_BSSID = "BSSID";
|
|
|
- static final String FILTER_MENU_TITLE_ESSID = "ESSID";
|
|
|
- static final String FILTER_MENU_TITLE_PROTOCOLS = "Protocols";
|
|
|
+ static final String FILTER_MENU_TITLE_BSSID = "Filter by BSSID";
|
|
|
+ static final String FILTER_MENU_TITLE_ESSID = "Filter by ESSID";
|
|
|
+ static final String FILTER_MENU_TITLE_PROTOCOLS = "Filter by Protocol";
|
|
|
static final String FILTER_MENU_TITLE_TIMESTAMP_BELOW = "To Date";
|
|
|
static final String FILTER_MENU_TITLE_TIMESTAMP_ABOVE = "From Date";
|
|
|
static final String FILTER_MENU_TITLE_SORTING = "Sort by";
|
|
@@ -351,7 +351,7 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
}
|
|
|
|
|
|
private void openSortingDialog(){
|
|
|
- ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_SORTING,this.sortTypeTtiles(), this.selectedSorttype(), false , this);
|
|
|
+ ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_SORTING,this.sortTypeTiles(), this.selectedSorttype(), false , this);
|
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_SORTING);
|
|
|
}
|
|
|
|
|
@@ -399,11 +399,15 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
private void openFilterPopupMenuOnView(View v){
|
|
|
// Open FilterMenu
|
|
|
PopupMenu filterMenu = new PopupMenu(getBaseContext(), v);
|
|
|
+
|
|
|
for(String title : RecordOverviewFragment.this.filterMenuTitles()){
|
|
|
// Set a white Title
|
|
|
SpannableString styledMenuTitle = new SpannableString(title);
|
|
|
- styledMenuTitle.setSpan(new ForegroundColorSpan(Color.parseColor("#FFFFFF")), 0, title.length(), 0);
|
|
|
- filterMenu.getMenu().add(styledMenuTitle);
|
|
|
+ styledMenuTitle.setSpan(new ForegroundColorSpan(Color.parseColor("#FFFFFF")), 0, title.length(), 0);
|
|
|
+
|
|
|
+ MenuItem item = filterMenu.getMenu().add(styledMenuTitle);
|
|
|
+ item.setCheckable(this.isFilterSetForTitle(title));
|
|
|
+ if (item.isCheckable()) item.setChecked(true);
|
|
|
}
|
|
|
filterMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
|
|
public boolean onMenuItemClick(MenuItem item) {
|
|
@@ -414,6 +418,24 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
filterMenu.show();
|
|
|
}
|
|
|
|
|
|
+ private boolean isFilterSetForTitle(String title){
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_BSSID)){
|
|
|
+ return this.filter.hasBSSIDs();
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_ESSID)){
|
|
|
+ return this.filter.hasESSIDs();
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
|
|
|
+ return this.filter.hasProtocols();
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_TIMESTAMP_BELOW)){
|
|
|
+ return this.filter.hasBelowTimestamp();
|
|
|
+ }
|
|
|
+ if (title.equals(FILTER_MENU_TITLE_TIMESTAMP_ABOVE)){
|
|
|
+ return this.filter.hasAboveTimestamp();
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
private void clearFilter(){
|
|
|
if(filter == null) this.filter = new LogFilter();
|
|
@@ -459,7 +481,7 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
return selected;
|
|
|
}
|
|
|
|
|
|
- public ArrayList<String> sortTypeTtiles(){
|
|
|
+ public ArrayList<String> sortTypeTiles(){
|
|
|
ArrayList<String> titles = new ArrayList<String>();
|
|
|
titles.add("Time");
|
|
|
titles.add("Protocol");
|
|
@@ -472,7 +494,7 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
return titles;
|
|
|
}
|
|
|
public boolean[] selectedSorttype(){
|
|
|
- ArrayList<String> types = this.sortTypeTtiles();
|
|
|
+ ArrayList<String> types = this.sortTypeTiles();
|
|
|
boolean[] selected = new boolean[types.size()];
|
|
|
int i = 0;
|
|
|
for(String sorttype : types){
|
|
@@ -581,7 +603,7 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
ArrayList<String> titles = dialog.getSelectedItemTitles();
|
|
|
if (titles.size() == 0) return;
|
|
|
String t = titles.get(0);
|
|
|
- int sortType = this.sortTypeTtiles().indexOf(t);
|
|
|
+ int sortType = this.sortTypeTiles().indexOf(t);
|
|
|
this.filter.setSorttype(SortType.values()[sortType]);
|
|
|
}
|
|
|
if (title.equals(FILTER_MENU_TITLE_GROUP)){
|