1
0
mirror of https://github.com/stom79/exodus-android-app synced 2024-12-23 14:28:12 +01:00

Remove filter in reports

This commit is contained in:
stom79 2018-04-14 15:29:39 +02:00
parent 37050d78fc
commit 543941fc94
2 changed files with 21 additions and 9 deletions

View File

@ -20,7 +20,6 @@ package org.eu.exodus_privacy.exodusprivacy;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.app.SearchManager;
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.design.widget.Snackbar;
@ -29,6 +28,7 @@ import android.os.Bundle;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.inputmethod.InputMethodManager;
import org.eu.exodus_privacy.exodusprivacy.adapters.ApplicationListAdapter;
import org.eu.exodus_privacy.exodusprivacy.databinding.MainBinding;
@ -40,6 +40,8 @@ public class MainActivity extends AppCompatActivity {
AppListFragment appList;
ReportFragment report;
SearchView searchView;
private Menu mMenu;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -80,6 +82,13 @@ public class MainActivity extends AppCompatActivity {
transaction.addToBackStack(null);
transaction.replace(R.id.fragment_container,report);
transaction.commit();
searchView.clearFocus();
if (mMenu != null)
(mMenu.findItem(R.id.action_filter)).collapseActionView();
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
assert imm != null;
imm.hideSoftInputFromWindow(mainBinding.fragmentContainer.getWindowToken(), 0);
};
appList = AppListFragment.newInstance(networkListener,onAppClickListener);
@ -101,12 +110,10 @@ public class MainActivity extends AppCompatActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
mMenu = menu;
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.action_filter).getActionView();
assert searchManager != null;
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView = (SearchView) menu.findItem(R.id.action_filter).getActionView();
searchView.setIconifiedByDefault(false);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override

View File

@ -28,11 +28,10 @@ import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;
import org.eu.exodus_privacy.exodusprivacy.R;
import org.eu.exodus_privacy.exodusprivacy.adapters.PermissionListAdapter;
@ -44,7 +43,6 @@ import org.eu.exodus_privacy.exodusprivacy.objects.Report;
import org.eu.exodus_privacy.exodusprivacy.objects.Tracker;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@ -65,6 +63,7 @@ public class ReportFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@ -180,4 +179,10 @@ public class ReportFragment extends Fragment {
public void setPackageInfo(PackageInfo packageInfo) {
this.packageInfo = packageInfo;
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
MenuItem item = menu.findItem(R.id.action_filter);
item.setVisible(false);
}
}