mirror of
https://github.com/M66B/NetGuard.git
synced 2025-01-01 12:54:07 +00:00
parent
477c3a604a
commit
c665f114b4
2 changed files with 18 additions and 17 deletions
|
@ -78,10 +78,7 @@ public class ActivityLog extends AppCompatActivity implements SharedPreferences.
|
|||
public void run() {
|
||||
if (adapter != null) {
|
||||
adapter.changeCursor(dh.getLog());
|
||||
if (menuSearch != null && menuSearch.isActionViewExpanded()) {
|
||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuSearch);
|
||||
adapter.getFilter().filter(searchView.getQuery().toString());
|
||||
}
|
||||
applyFilter();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -219,10 +216,7 @@ public class ActivityLog extends AppCompatActivity implements SharedPreferences.
|
|||
if (live) {
|
||||
dh.addLogChangedListener(listener);
|
||||
adapter.changeCursor(dh.getLog());
|
||||
if (menuSearch != null && menuSearch.isActionViewExpanded()) {
|
||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuSearch);
|
||||
adapter.getFilter().filter(searchView.getQuery().toString());
|
||||
}
|
||||
applyFilter();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,21 +322,16 @@ public class ActivityLog extends AppCompatActivity implements SharedPreferences.
|
|||
if (live) {
|
||||
dh.addLogChangedListener(listener);
|
||||
adapter.changeCursor(dh.getLog());
|
||||
applyFilter();
|
||||
} else
|
||||
dh.removeLogChangedListener(listener);
|
||||
return true;
|
||||
|
||||
case R.id.menu_log_resolve:
|
||||
item.setChecked(!item.isChecked());
|
||||
resolve = item.isChecked();
|
||||
prefs.edit().putBoolean("resolve", resolve).apply();
|
||||
adapter = new LogAdapter(this, dh.getLog(), resolve);
|
||||
adapter.setFilterQueryProvider(new FilterQueryProvider() {
|
||||
public Cursor runQuery(CharSequence constraint) {
|
||||
return dh.searchLog(constraint.toString());
|
||||
}
|
||||
});
|
||||
lvLog.setAdapter(adapter);
|
||||
prefs.edit().putBoolean("resolve", item.isChecked()).apply();
|
||||
adapter.setResolve(item.isChecked());
|
||||
adapter.notifyDataSetChanged();
|
||||
return true;
|
||||
|
||||
case R.id.menu_pcap_enabled:
|
||||
|
@ -375,6 +364,7 @@ public class ActivityLog extends AppCompatActivity implements SharedPreferences.
|
|||
@Override
|
||||
protected void onPostExecute(Object o) {
|
||||
adapter.changeCursor(dh.getLog());
|
||||
applyFilter();
|
||||
}
|
||||
}.execute();
|
||||
return true;
|
||||
|
@ -391,6 +381,13 @@ public class ActivityLog extends AppCompatActivity implements SharedPreferences.
|
|||
}
|
||||
}
|
||||
|
||||
private void applyFilter() {
|
||||
if (adapter != null && menuSearch != null && menuSearch.isActionViewExpanded()) {
|
||||
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuSearch);
|
||||
adapter.getFilter().filter(searchView.getQuery().toString());
|
||||
}
|
||||
}
|
||||
|
||||
private Intent getIntentPCAPDocument() {
|
||||
Intent intent;
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
|
|
|
@ -104,6 +104,10 @@ public class LogAdapter extends CursorAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
public void setResolve(boolean resolve) {
|
||||
this.resolve = resolve;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View newView(Context context, Cursor cursor, ViewGroup parent) {
|
||||
return LayoutInflater.from(context).inflate(R.layout.log, parent, false);
|
||||
|
|
Loading…
Reference in a new issue