Search in sources :

Example 1 with AlbumTracksFragment

use of org.gateshipone.malp.application.fragments.serverfragments.AlbumTracksFragment in project malp by gateship-one.

the class MainActivity method onAlbumSelected.

@Override
public void onAlbumSelected(MPDAlbum album, Bitmap bitmap) {
    if (mNowPlayingDragStatus == DRAG_STATUS.DRAGGED_UP) {
        NowPlayingView nowPlayingView = findViewById(R.id.now_playing_layout);
        if (nowPlayingView != null) {
            View coordinatorLayout = findViewById(R.id.main_coordinator_layout);
            coordinatorLayout.setVisibility(View.VISIBLE);
            nowPlayingView.minimize();
        }
    }
    // Create fragment and give it an argument for the selected article
    AlbumTracksFragment newFragment = new AlbumTracksFragment();
    Bundle args = new Bundle();
    args.putParcelable(AlbumTracksFragment.BUNDLE_STRING_EXTRA_ALBUM, album);
    if (bitmap != null) {
        args.putParcelable(AlbumTracksFragment.BUNDLE_STRING_EXTRA_BITMAP, bitmap);
    }
    newFragment.setArguments(args);
    android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    // Replace whatever is in the fragment_container view with this
    // fragment,
    // and add the transaction to the back stack so the user can navigate
    // back
    newFragment.setEnterTransition(new Slide(Gravity.BOTTOM));
    newFragment.setExitTransition(new Slide(Gravity.TOP));
    transaction.replace(R.id.fragment_container, newFragment, AlbumTracksFragment.TAG);
    transaction.addToBackStack("AlbumTracksFragment");
    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setCheckedItem(R.id.nav_library);
    // Commit the transaction
    transaction.commit();
}
Also used : NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) NavigationView(android.support.design.widget.NavigationView) Slide(android.transition.Slide) Bundle(android.os.Bundle) 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) FragmentTransaction(android.support.v4.app.FragmentTransaction) AlbumTracksFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumTracksFragment)

Aggregations

Bundle (android.os.Bundle)1 NavigationView (android.support.design.widget.NavigationView)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 Slide (android.transition.Slide)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 AlbumTracksFragment (org.gateshipone.malp.application.fragments.serverfragments.AlbumTracksFragment)1 CurrentPlaylistView (org.gateshipone.malp.application.views.CurrentPlaylistView)1 NowPlayingView (org.gateshipone.malp.application.views.NowPlayingView)1