Skip to content

Commit

Permalink
turn off search when tab is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
NihilityT committed Jun 5, 2023
1 parent c26f7d1 commit 08fbd37
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SearchView;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -42,6 +43,7 @@ public class MainFragment extends Fragment implements OnConnectStatusChangedList
private static final String FRAGMENT_EVENT = "event";
private static final String FRAGMENT_APPLICATIONS = "applications";
private static final String FRAGMENT_SETTINGS = "settings";
private MenuItem mSearchItem;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -75,6 +77,7 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_main, menu);
MenuItem item = menu.findItem(R.id.action_enable);
item.setActionView(R.layout.switch_layout);
mSearchItem = menu.findItem(R.id.action_search);
}

@Override
Expand Down Expand Up @@ -141,6 +144,9 @@ public int getCount() {
new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
SearchView searchView = (SearchView) mSearchItem.getActionView();
searchView.setIconified(true);
searchView.setIconified(true);
viewPager.setCurrentItem(item.getOrder());
return true;
}
Expand Down

0 comments on commit 08fbd37

Please sign in to comment.