Search in sources :

Example 1 with SettingsFragment

use of org.gateshipone.malp.application.fragments.SettingsFragment 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;
}
Also used : InformationSettingsFragment(org.gateshipone.malp.application.fragments.InformationSettingsFragment) NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) Bundle(android.os.Bundle) FilesFragment(org.gateshipone.malp.application.fragments.serverfragments.FilesFragment) SearchFragment(org.gateshipone.malp.application.fragments.serverfragments.SearchFragment) ServerPropertiesFragment(org.gateshipone.malp.application.fragments.serverfragments.ServerPropertiesFragment) ProfilesFragment(org.gateshipone.malp.application.fragments.ProfilesFragment) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurrentPlaylistView(org.gateshipone.malp.application.views.CurrentPlaylistView) TextView(android.widget.TextView) NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) AlbumTracksFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumTracksFragment) ArtworkSettingsFragment(org.gateshipone.malp.application.fragments.ArtworkSettingsFragment) ServerPropertiesFragment(org.gateshipone.malp.application.fragments.serverfragments.ServerPropertiesFragment) FilesFragment(org.gateshipone.malp.application.fragments.serverfragments.FilesFragment) ProfilesFragment(org.gateshipone.malp.application.fragments.ProfilesFragment) Fragment(android.support.v4.app.Fragment) ArtistsFragment(org.gateshipone.malp.application.fragments.serverfragments.ArtistsFragment) SettingsFragment(org.gateshipone.malp.application.fragments.SettingsFragment) InformationSettingsFragment(org.gateshipone.malp.application.fragments.InformationSettingsFragment) AlbumsFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment) SearchFragment(org.gateshipone.malp.application.fragments.serverfragments.SearchFragment) SavedPlaylistsFragment(org.gateshipone.malp.application.fragments.serverfragments.SavedPlaylistsFragment) MyMusicTabsFragment(org.gateshipone.malp.application.fragments.serverfragments.MyMusicTabsFragment) EditProfileFragment(org.gateshipone.malp.application.fragments.EditProfileFragment) PlaylistTracksFragment(org.gateshipone.malp.application.fragments.serverfragments.PlaylistTracksFragment) FragmentManager(android.support.v4.app.FragmentManager) ArtworkSettingsFragment(org.gateshipone.malp.application.fragments.ArtworkSettingsFragment) SettingsFragment(org.gateshipone.malp.application.fragments.SettingsFragment) InformationSettingsFragment(org.gateshipone.malp.application.fragments.InformationSettingsFragment) FragmentTransaction(android.support.v4.app.FragmentTransaction) MyMusicTabsFragment(org.gateshipone.malp.application.fragments.serverfragments.MyMusicTabsFragment) DrawerLayout(android.support.v4.widget.DrawerLayout) SavedPlaylistsFragment(org.gateshipone.malp.application.fragments.serverfragments.SavedPlaylistsFragment)

Aggregations

Bundle (android.os.Bundle)1 NavigationView (android.support.design.widget.NavigationView)1 Fragment (android.support.v4.app.Fragment)1 FragmentManager (android.support.v4.app.FragmentManager)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 DrawerLayout (android.support.v4.widget.DrawerLayout)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 ArtworkSettingsFragment (org.gateshipone.malp.application.fragments.ArtworkSettingsFragment)1 EditProfileFragment (org.gateshipone.malp.application.fragments.EditProfileFragment)1 InformationSettingsFragment (org.gateshipone.malp.application.fragments.InformationSettingsFragment)1 ProfilesFragment (org.gateshipone.malp.application.fragments.ProfilesFragment)1 SettingsFragment (org.gateshipone.malp.application.fragments.SettingsFragment)1 AlbumTracksFragment (org.gateshipone.malp.application.fragments.serverfragments.AlbumTracksFragment)1 AlbumsFragment (org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment)1 ArtistsFragment (org.gateshipone.malp.application.fragments.serverfragments.ArtistsFragment)1 FilesFragment (org.gateshipone.malp.application.fragments.serverfragments.FilesFragment)1 MyMusicTabsFragment (org.gateshipone.malp.application.fragments.serverfragments.MyMusicTabsFragment)1