|
@@ -13,18 +13,22 @@ import android.annotation.SuppressLint;
|
|
import android.app.Fragment;
|
|
import android.app.Fragment;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
|
+import android.graphics.Color;
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
|
+import android.text.SpannableString;
|
|
|
|
+import android.text.style.ForegroundColorSpan;
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
import android.view.Menu;
|
|
import android.view.Menu;
|
|
import android.view.MenuInflater;
|
|
import android.view.MenuInflater;
|
|
import android.view.MenuItem;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
-import android.widget.AbsListView;
|
|
|
|
import android.widget.AdapterView;
|
|
import android.widget.AdapterView;
|
|
|
|
+import android.widget.ImageButton;
|
|
import android.widget.ListAdapter;
|
|
import android.widget.ListAdapter;
|
|
import android.widget.ListView;
|
|
import android.widget.ListView;
|
|
-import android.widget.SimpleAdapter;
|
|
|
|
|
|
+import android.widget.PopupMenu;
|
|
|
|
+import android.widget.PopupMenu.OnMenuItemClickListener;
|
|
import android.widget.Toast;
|
|
import android.widget.Toast;
|
|
import de.tudarmstadt.informatik.hostage.R;
|
|
import de.tudarmstadt.informatik.hostage.R;
|
|
import de.tudarmstadt.informatik.hostage.logging.DatabaseHandler;
|
|
import de.tudarmstadt.informatik.hostage.logging.DatabaseHandler;
|
|
@@ -32,6 +36,7 @@ import de.tudarmstadt.informatik.hostage.logging.Record;
|
|
import de.tudarmstadt.informatik.hostage.logging.Record.TYPE;
|
|
import de.tudarmstadt.informatik.hostage.logging.Record.TYPE;
|
|
import de.tudarmstadt.informatik.hostage.ui.LogFilter;
|
|
import de.tudarmstadt.informatik.hostage.ui.LogFilter;
|
|
import de.tudarmstadt.informatik.hostage.ui.LogFilter.SortType;
|
|
import de.tudarmstadt.informatik.hostage.ui.LogFilter.SortType;
|
|
|
|
+import de.tudarmstadt.informatik.hostage.ui2.adapter.RecordListAdapter;
|
|
import de.tudarmstadt.informatik.hostage.ui2.dialog.ChecklistDialog;
|
|
import de.tudarmstadt.informatik.hostage.ui2.dialog.ChecklistDialog;
|
|
import de.tudarmstadt.informatik.hostage.ui2.dialog.DateTimeDialogFragment;
|
|
import de.tudarmstadt.informatik.hostage.ui2.dialog.DateTimeDialogFragment;
|
|
|
|
|
|
@@ -45,7 +50,7 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
static final String FILTER_MENU_TITLE_TIMESTAMP_BELOW = "To Date";
|
|
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_TIMESTAMP_ABOVE = "From Date";
|
|
static final String FILTER_MENU_TITLE_SORTING = "Sort by";
|
|
static final String FILTER_MENU_TITLE_SORTING = "Sort by";
|
|
- static final String FILTER_MENU_TITLE_REMOVE = "Remove";
|
|
|
|
|
|
+ static final String FILTER_MENU_TITLE_REMOVE = "Reset Filter";
|
|
|
|
|
|
private boolean wasBelowTimePicker;
|
|
private boolean wasBelowTimePicker;
|
|
|
|
|
|
@@ -56,16 +61,17 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
|
|
|
|
|
|
|
public RecordOverviewFragment(){}
|
|
public RecordOverviewFragment(){}
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
setHasOptionsMenu(true);
|
|
setHasOptionsMenu(true);
|
|
}
|
|
}
|
|
|
|
+
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
Bundle savedInstanceState) {
|
|
Bundle savedInstanceState) {
|
|
|
|
|
|
-
|
|
|
|
dbh = new DatabaseHandler(this.getActivity().getBaseContext());
|
|
dbh = new DatabaseHandler(this.getActivity().getBaseContext());
|
|
// Get the message from the intent
|
|
// Get the message from the intent
|
|
Intent intent = this.getActivity().getIntent();
|
|
Intent intent = this.getActivity().getIntent();
|
|
@@ -88,19 +94,69 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
|
|
|
|
registerListClickCallback(mylist);
|
|
registerListClickCallback(mylist);
|
|
|
|
|
|
|
|
+ ImageButton filterButton = (ImageButton) rootView.findViewById(R.id.FilterButton);
|
|
|
|
+ filterButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
+ RecordOverviewFragment.this.openFilterPopupMenuOnView(v);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ filterButton.setVisibility(this.showFilterButton? View.VISIBLE : View.INVISIBLE);
|
|
|
|
+
|
|
|
|
+ ImageButton sortButton = (ImageButton) rootView.findViewById(R.id.SortButton);
|
|
|
|
+ sortButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
+ public void onClick(View v) {
|
|
|
|
+ // Open SortMenu
|
|
|
|
+ RecordOverviewFragment.this.openSortingDialog();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
return rootView;
|
|
return rootView;
|
|
}
|
|
}
|
|
-
|
|
|
|
- private void clearFilter(){
|
|
|
|
- this.filter = new LogFilter();
|
|
|
|
- this.filter.setProtocols(this.protocolTitles());
|
|
|
|
- this.filter.setBSSIDs(this.bssids());
|
|
|
|
- this.filter.setESSIDs(this.essids());
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
|
|
+ super.onCreateOptionsMenu(menu, inflater);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean onFilterMenuItemSelected(MenuItem item) {
|
|
|
|
+ String title = item.getTitle().toString();
|
|
|
|
+
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_BSSID)){
|
|
|
|
+ this.openBSSIDFilterDialog();
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_ESSID)){
|
|
|
|
+ this.openESSIDFilterDialog();
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
|
|
|
|
+ this.openProtocolsFilterDialog();
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_SORTING)){
|
|
|
|
+ this.openSortingDialog();
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_REMOVE)){
|
|
|
|
+ this.clearFilter();
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_TIMESTAMP_BELOW)){
|
|
|
|
+ this.openTimestampToFilterDialog();
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_TIMESTAMP_ABOVE)){
|
|
|
|
+ this.openTimestampFromFilterDialog();
|
|
|
|
+ }
|
|
|
|
+ return super.onOptionsItemSelected(item);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*****************************
|
|
|
|
+ *
|
|
|
|
+ * ListView Stuff
|
|
|
|
+ *
|
|
|
|
+ * ***************************/
|
|
|
|
|
|
private void populateListViewFromDB(ListView mylist) {
|
|
private void populateListViewFromDB(ListView mylist) {
|
|
|
|
|
|
- ArrayList<HashMap<String, String>> Items = new ArrayList<HashMap<String, String>>();
|
|
|
|
|
|
+ ArrayList<HashMap<String, String>> items = new ArrayList<HashMap<String, String>>();
|
|
|
|
|
|
ArrayList<Record> data = dbh.getRecordsForFilter(this.filter);
|
|
ArrayList<Record> data = dbh.getRecordsForFilter(this.filter);
|
|
|
|
|
|
@@ -112,14 +168,14 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
map.put(this.getString(R.string.RecordProtocol), val.getProtocol());
|
|
map.put(this.getString(R.string.RecordProtocol), val.getProtocol());
|
|
map.put(this.getString(R.string.RecordTimestamp),
|
|
map.put(this.getString(R.string.RecordTimestamp),
|
|
this.getDateAsString(val.getTimestamp()));
|
|
this.getDateAsString(val.getTimestamp()));
|
|
- Items.add(map);
|
|
|
|
|
|
+ items.add(map);
|
|
}
|
|
}
|
|
|
|
|
|
// Adding Items to ListView
|
|
// Adding Items to ListView
|
|
String keys[] = new String[] { this.getString(R.string.RecordBSSID), this.getString(R.string.RecordSSID), this.getString(R.string.RecordProtocol), this.getString(R.string.RecordTimestamp)};
|
|
String keys[] = new String[] { this.getString(R.string.RecordBSSID), this.getString(R.string.RecordSSID), this.getString(R.string.RecordProtocol), this.getString(R.string.RecordTimestamp)};
|
|
int ids[] = new int[] {R.id.RecordTextFieldBSSID, R.id.RecordTextFieldSSID, R.id.RecordTextFieldProtocol, R.id.RecordTextFieldTimestamp };
|
|
int ids[] = new int[] {R.id.RecordTextFieldBSSID, R.id.RecordTextFieldSSID, R.id.RecordTextFieldProtocol, R.id.RecordTextFieldTimestamp };
|
|
|
|
|
|
- ListAdapter adapter = new SimpleAdapter(this.getActivity(), Items, R.layout.loglist_row, keys, ids);
|
|
|
|
|
|
+ ListAdapter adapter = new RecordListAdapter(this.getActivity(), items, R.layout.loglist_row, keys, ids);
|
|
|
|
|
|
mylist.setAdapter(adapter);
|
|
mylist.setAdapter(adapter);
|
|
}
|
|
}
|
|
@@ -176,82 +232,64 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*****************************
|
|
|
|
+ *
|
|
|
|
+ * Date Transform
|
|
|
|
+ *
|
|
|
|
+ * ***************************/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @SuppressLint("SimpleDateFormat")
|
|
|
|
+ private String getDateAsString(long timeStamp) {
|
|
|
|
|
|
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
|
|
|
- super.onCreateOptionsMenu(menu, inflater);
|
|
|
|
- if(this.showFilterButton){
|
|
|
|
- for(String title : this.filterTitles()){
|
|
|
|
- MenuItem item = menu.add(title);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
|
|
|
+ Date netDate = (new Date(timeStamp));
|
|
|
|
+ return sdf.format(netDate);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return "xx";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*****************************
|
|
|
|
+ *
|
|
|
|
+ * Getter / Setter
|
|
|
|
+ *
|
|
|
|
+ * ***************************/
|
|
|
|
|
|
- @Override
|
|
|
|
- public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
- String title = item.getTitle().toString();
|
|
|
|
-
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_BSSID)){
|
|
|
|
- this.openBSSIDFilterDialog();
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_ESSID)){
|
|
|
|
- this.openESSIDFilterDialog();
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
|
|
|
|
- this.openProtocolsFilterDialog();
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_SORTING)){
|
|
|
|
- this.openSortingDialog();
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_REMOVE)){
|
|
|
|
- this.clearFilter();
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_TIMESTAMP_BELOW)){
|
|
|
|
- this.openTimestampToFilterDialog();
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_TIMESTAMP_ABOVE)){
|
|
|
|
- this.openTimestampFromFilterDialog();
|
|
|
|
- }
|
|
|
|
- return super.onOptionsItemSelected(item);
|
|
|
|
|
|
+ public boolean isShowFilterButton() {
|
|
|
|
+ return showFilterButton;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setShowFilterButton(boolean showFilterButton) {
|
|
|
|
+ this.showFilterButton = showFilterButton;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /*****************************
|
|
|
|
+ *
|
|
|
|
+ * Open Dialog Methods
|
|
|
|
+ *
|
|
|
|
+ * ***************************/
|
|
|
|
+
|
|
|
|
|
|
private void openBSSIDFilterDialog(){
|
|
private void openBSSIDFilterDialog(){
|
|
- Intent intent = this.getActivity().getIntent();
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_TITLE_KEY, FILTER_MENU_TITLE_BSSID);
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_IS_MULTIPLECHOICE_KEY, true);
|
|
|
|
-
|
|
|
|
- intent.putStringArrayListExtra(ChecklistDialog.DIALOG_TITLE_ARRAY_KEY, this.bssids());
|
|
|
|
- intent.putStringArrayListExtra(ChecklistDialog.DIALOG_MULTIPLECHOICE_SELECTED_KEY, this.selectedBSSIDs());
|
|
|
|
-
|
|
|
|
- ChecklistDialog newFragment = new ChecklistDialog();
|
|
|
|
|
|
+ ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_BSSID,this.bssids(), this.selectedBSSIDs(), true , this);
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_BSSID);
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_BSSID);
|
|
}
|
|
}
|
|
|
|
|
|
private void openESSIDFilterDialog(){
|
|
private void openESSIDFilterDialog(){
|
|
-
|
|
|
|
- Intent intent = this.getActivity().getIntent();
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_TITLE_KEY, FILTER_MENU_TITLE_ESSID);
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_IS_MULTIPLECHOICE_KEY, true);
|
|
|
|
-
|
|
|
|
- intent.putStringArrayListExtra(ChecklistDialog.DIALOG_TITLE_ARRAY_KEY, this.essids());
|
|
|
|
- intent.putStringArrayListExtra(ChecklistDialog.DIALOG_MULTIPLECHOICE_SELECTED_KEY, this.selectedESSIDs());
|
|
|
|
-
|
|
|
|
- ChecklistDialog newFragment = new ChecklistDialog();
|
|
|
|
|
|
+ ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_ESSID,this.essids(), this.selectedESSIDs(), true , this);
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_ESSID);
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_ESSID);
|
|
}
|
|
}
|
|
|
|
|
|
private void openProtocolsFilterDialog(){
|
|
private void openProtocolsFilterDialog(){
|
|
- Intent intent = this.getActivity().getIntent();
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_TITLE_KEY, FILTER_MENU_TITLE_PROTOCOLS);
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_IS_MULTIPLECHOICE_KEY, true);
|
|
|
|
-
|
|
|
|
- intent.putStringArrayListExtra(ChecklistDialog.DIALOG_TITLE_ARRAY_KEY, this.protocolTitles());
|
|
|
|
- intent.putStringArrayListExtra(ChecklistDialog.DIALOG_MULTIPLECHOICE_SELECTED_KEY, this.selectedProtocols());
|
|
|
|
-
|
|
|
|
- ChecklistDialog newFragment = new ChecklistDialog();
|
|
|
|
|
|
+ ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_PROTOCOLS,this.protocolTitles(), this.selectedProtocols(), true , this);
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_PROTOCOLS);
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_PROTOCOLS);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -268,63 +306,41 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
}
|
|
}
|
|
|
|
|
|
private void openSortingDialog(){
|
|
private void openSortingDialog(){
|
|
- Intent intent = this.getActivity().getIntent();
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_TITLE_KEY, FILTER_MENU_TITLE_SORTING);
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_IS_MULTIPLECHOICE_KEY, false);
|
|
|
|
-
|
|
|
|
- intent.putStringArrayListExtra(ChecklistDialog.DIALOG_TITLE_ARRAY_KEY, this.sortTypeTtiles());
|
|
|
|
- intent.putExtra(ChecklistDialog.DIALOG_SELECTED_INDEX_KEY, this.filter.sorttype.getValue());
|
|
|
|
-
|
|
|
|
- ChecklistDialog newFragment = new ChecklistDialog();
|
|
|
|
|
|
+ ChecklistDialog newFragment = new ChecklistDialog(FILTER_MENU_TITLE_SORTING,this.sortTypeTtiles(), this.selectedSorttype(), false , this);
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_SORTING);
|
|
newFragment.show(this.getActivity().getFragmentManager(), FILTER_MENU_TITLE_SORTING);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /*****************************
|
|
|
|
+ *
|
|
|
|
+ * Filter Stuff
|
|
|
|
+ *
|
|
|
|
+ * ***************************/
|
|
|
|
|
|
- public void onDialogPositiveClick(ChecklistDialog dialog) {
|
|
|
|
- // TODO Auto-generated method stub
|
|
|
|
- String title = dialog.getTitle();
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_BSSID)){
|
|
|
|
- this.filter.setBSSIDs(dialog.getSelectedItemTitles());
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_ESSID)){
|
|
|
|
- this.filter.setESSIDs(dialog.getSelectedItemTitles());
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
|
|
|
|
- this.filter.setProtocols(dialog.getSelectedItemTitles());
|
|
|
|
- }
|
|
|
|
- if(title.equals(FILTER_MENU_TITLE_SORTING)){
|
|
|
|
- ArrayList<String> titles = dialog.getSelectedItemTitles();
|
|
|
|
- String t = titles.get(0);
|
|
|
|
- int sortType = this.sortTypeTtiles().indexOf(t);
|
|
|
|
- this.filter.setSorttype(SortType.values()[sortType]);
|
|
|
|
|
|
+ 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);
|
|
}
|
|
}
|
|
- this.populateListViewFromDB(this.listView);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void onDialogNegativeClick(ChecklistDialog dialog) {
|
|
|
|
- // nothing in here
|
|
|
|
|
|
+ filterMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
|
|
|
|
+ public boolean onMenuItemClick(MenuItem item) {
|
|
|
|
+ RecordOverviewFragment.this.onFilterMenuItemSelected(item);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ filterMenu.show();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
- @SuppressLint("SimpleDateFormat")
|
|
|
|
- private String getDateAsString(long timeStamp) {
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
|
|
|
- Date netDate = (new Date(timeStamp));
|
|
|
|
- return sdf.format(netDate);
|
|
|
|
- } catch (Exception ex) {
|
|
|
|
- return "xx";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public boolean isShowFilterButton() {
|
|
|
|
- return showFilterButton;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void setShowFilterButton(boolean showFilterButton) {
|
|
|
|
- this.showFilterButton = showFilterButton;
|
|
|
|
|
|
+ private void clearFilter(){
|
|
|
|
+ this.filter = new LogFilter();
|
|
|
|
+ this.filter.setProtocols(this.protocolTitles());
|
|
|
|
+ this.filter.setBSSIDs(this.bssids());
|
|
|
|
+ this.filter.setESSIDs(this.essids());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -336,8 +352,16 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
}
|
|
}
|
|
return titles;
|
|
return titles;
|
|
}
|
|
}
|
|
- public ArrayList<String> selectedProtocols(){
|
|
|
|
- return this.filter.protocols;
|
|
|
|
|
|
+ public boolean[] selectedProtocols(){
|
|
|
|
+ ArrayList<String> protocols = this.protocolTitles();
|
|
|
|
+ boolean[] selected = new boolean[protocols.size()];
|
|
|
|
+
|
|
|
|
+ int i = 0;
|
|
|
|
+ for(String protocol : protocols){
|
|
|
|
+ selected[i] =(this.filter.protocols.contains(protocol));
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ return selected;
|
|
}
|
|
}
|
|
|
|
|
|
public ArrayList<String> sortTypeTtiles(){
|
|
public ArrayList<String> sortTypeTtiles(){
|
|
@@ -352,42 +376,109 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
//titles.add("ID");
|
|
//titles.add("ID");
|
|
return titles;
|
|
return titles;
|
|
}
|
|
}
|
|
|
|
+ public boolean[] selectedSorttype(){
|
|
|
|
+ ArrayList<String> types = this.sortTypeTtiles();
|
|
|
|
+ boolean[] selected = new boolean[types.size()];
|
|
|
|
+ int i = 0;
|
|
|
|
+ for(String sorttype : types){
|
|
|
|
+ selected[i] =(this.filter.sorttype.toString() == sorttype);
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ return selected;
|
|
|
|
+ }
|
|
|
|
|
|
public ArrayList<String> bssids(){
|
|
public ArrayList<String> bssids(){
|
|
- ArrayList<String> titles = new ArrayList<String>();
|
|
|
|
ArrayList<String> records = dbh.getUniqueBSSIDRecords();
|
|
ArrayList<String> records = dbh.getUniqueBSSIDRecords();
|
|
-
|
|
|
|
return records;
|
|
return records;
|
|
}
|
|
}
|
|
- public ArrayList<String> selectedBSSIDs(){
|
|
|
|
- return this.filter.BSSIDs;
|
|
|
|
|
|
+ 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.BSSIDs.contains(bssid));
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ return selected;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public ArrayList<String> essids(){
|
|
public ArrayList<String> essids(){
|
|
- ArrayList<String> titles = new ArrayList<String>();
|
|
|
|
ArrayList<String> records = dbh.getUniqueESSIDRecords();
|
|
ArrayList<String> records = dbh.getUniqueESSIDRecords();
|
|
-
|
|
|
|
return records;
|
|
return records;
|
|
}
|
|
}
|
|
- public ArrayList<String> selectedESSIDs(){
|
|
|
|
- return this.filter.ESSIDs;
|
|
|
|
|
|
+ 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.ESSIDs.contains(essid));
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ return selected;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private ArrayList<String> filterTitles(){
|
|
|
|
|
|
+ private ArrayList<String> filterMenuTitles(){
|
|
ArrayList<String> titles = new ArrayList<String>();
|
|
ArrayList<String> titles = new ArrayList<String>();
|
|
titles.add(FILTER_MENU_TITLE_BSSID);
|
|
titles.add(FILTER_MENU_TITLE_BSSID);
|
|
titles.add(FILTER_MENU_TITLE_ESSID);
|
|
titles.add(FILTER_MENU_TITLE_ESSID);
|
|
titles.add(FILTER_MENU_TITLE_PROTOCOLS);
|
|
titles.add(FILTER_MENU_TITLE_PROTOCOLS);
|
|
titles.add(FILTER_MENU_TITLE_TIMESTAMP_ABOVE);
|
|
titles.add(FILTER_MENU_TITLE_TIMESTAMP_ABOVE);
|
|
titles.add(FILTER_MENU_TITLE_TIMESTAMP_BELOW);
|
|
titles.add(FILTER_MENU_TITLE_TIMESTAMP_BELOW);
|
|
- titles.add(FILTER_MENU_TITLE_SORTING);
|
|
|
|
titles.add(FILTER_MENU_TITLE_REMOVE);
|
|
titles.add(FILTER_MENU_TITLE_REMOVE);
|
|
return titles;
|
|
return titles;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /*****************************
|
|
|
|
+ *
|
|
|
|
+ * Listener Actions
|
|
|
|
+ *
|
|
|
|
+ * ***************************/
|
|
|
|
+
|
|
|
|
+ public void onDateTimePickerPositiveClick(DateTimeDialogFragment dialog) {
|
|
|
|
+ if(this.wasBelowTimePicker){
|
|
|
|
+ this.filter.setBelowTimestamp(dialog.getDate());
|
|
|
|
+ } else {
|
|
|
|
+ this.filter.setAboveTimestamp(dialog.getDate());
|
|
|
|
+ }
|
|
|
|
+ this.populateListViewFromDB(listView);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void onDateTimePickerNegativeClick(DateTimeDialogFragment dialog) {
|
|
|
|
+ if(this.wasBelowTimePicker){
|
|
|
|
+ this.filter.setBelowTimestamp(Long.MAX_VALUE);
|
|
|
|
+ } else {
|
|
|
|
+ this.filter.setAboveTimestamp(Long.MIN_VALUE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void onDialogPositiveClick(ChecklistDialog dialog) {
|
|
|
|
+ String title = dialog.getTitle();
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_BSSID)){
|
|
|
|
+ this.filter.setBSSIDs(dialog.getSelectedItemTitles());
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_ESSID)){
|
|
|
|
+ this.filter.setESSIDs(dialog.getSelectedItemTitles());
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_PROTOCOLS)){
|
|
|
|
+ this.filter.setProtocols(dialog.getSelectedItemTitles());
|
|
|
|
+ }
|
|
|
|
+ if(title.equals(FILTER_MENU_TITLE_SORTING)){
|
|
|
|
+ ArrayList<String> titles = dialog.getSelectedItemTitles();
|
|
|
|
+ String t = titles.get(0);
|
|
|
|
+ int sortType = this.sortTypeTtiles().indexOf(t);
|
|
|
|
+ this.filter.setSorttype(SortType.values()[sortType]);
|
|
|
|
+ }
|
|
|
|
+ this.populateListViewFromDB(this.listView);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void onDialogNegativeClick(ChecklistDialog dialog) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
/*****************************
|
|
/*****************************
|
|
@@ -432,17 +523,5 @@ public class RecordOverviewFragment extends Fragment implements ChecklistDialog.
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public void onDateTimePickerPositiveClick(DateTimeDialogFragment dialog) {
|
|
|
|
- if(this.wasBelowTimePicker){
|
|
|
|
- this.filter.setBelowTimestamp(dialog.getDate());
|
|
|
|
- } else {
|
|
|
|
- this.filter.setAboveTimestamp(dialog.getDate());
|
|
|
|
- }
|
|
|
|
- this.populateListViewFromDB(listView);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void onDateTimePickerNegativeClick(DateTimeDialogFragment dialog) {
|
|
|
|
- // nothing in here
|
|
|
|
- }
|
|
|
|
|
|
|
|
}
|
|
}
|