use of org.gateshipone.malp.application.fragments.serverfragments.ServerPropertiesFragment in project malp by gateship-one.
the class MainActivity method onNavigationItemSelected.
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
View coordinatorLayout = findViewById(R.id.main_coordinator_layout);
coordinatorLayout.setVisibility(View.VISIBLE);
NowPlayingView nowPlayingView = findViewById(R.id.now_playing_layout);
if (nowPlayingView != null) {
nowPlayingView.minimize();
}
FragmentManager fragmentManager = getSupportFragmentManager();
// clear backstack
fragmentManager.popBackStackImmediate("", FragmentManager.POP_BACK_STACK_INCLUSIVE);
Fragment fragment = null;
String fragmentTag = "";
if (id == R.id.nav_library) {
// Handle the camera action
fragment = new MyMusicTabsFragment();
fragmentTag = MyMusicTabsFragment.TAG;
} else if (id == R.id.nav_saved_playlists) {
fragment = new SavedPlaylistsFragment();
fragmentTag = SavedPlaylistsFragment.TAG;
} else if (id == R.id.nav_files) {
fragment = new FilesFragment();
fragmentTag = FilesFragment.TAG;
Bundle args = new Bundle();
args.putString(FilesFragment.EXTRA_FILENAME, "");
} else if (id == R.id.nav_search) {
fragment = new SearchFragment();
fragmentTag = SearchFragment.TAG;
} else if (id == R.id.nav_profiles) {
fragment = new ProfilesFragment();
fragmentTag = ProfilesFragment.TAG;
} else if (id == R.id.nav_app_settings) {
fragment = new SettingsFragment();
fragmentTag = SettingsFragment.TAG;
} else if (id == R.id.nav_server_properties) {
fragment = new ServerPropertiesFragment();
fragmentTag = ServerPropertiesFragment.TAG;
} else if (id == R.id.nav_information) {
fragment = new InformationSettingsFragment();
fragmentTag = InformationSettingsFragment.class.getSimpleName();
}
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
// Do the actual fragment transaction
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.fragment_container, fragment, fragmentTag);
transaction.commit();
return true;
}
Aggregations