1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-23 08:17:51 +00:00

Close search view on refresh

This commit is contained in:
M66B 2015-10-27 08:04:39 +01:00
parent 421866c496
commit b879e83c5f

View file

@ -37,6 +37,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
private boolean running = false;
private RuleAdapter adapter = null;
private MenuItem searchItem = null;
private static final int REQUEST_VPN = 1;
@ -149,6 +150,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
@Override
protected void onPostExecute(List<Rule> result) {
if (running) {
if (searchItem != null)
MenuItemCompat.collapseActionView(searchItem);
adapter = new RuleAdapter(result, ActivityMain.this);
rvApplication.setAdapter(adapter);
}
@ -176,7 +179,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
inflater.inflate(R.menu.main, menu);
// Search
MenuItem searchItem = menu.findItem(R.id.menu_search);
searchItem = menu.findItem(R.id.menu_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override