Search in sources :

Example 1 with AlbumsFragment

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

the class MainActivity method showAlbumsForPath.

@Override
public void showAlbumsForPath(String path) {
    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
    AlbumsFragment newFragment = new AlbumsFragment();
    Bundle args = new Bundle();
    args.putString(AlbumsFragment.BUNDLE_STRING_EXTRA_PATH, path);
    newFragment.setArguments(args);
    android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    newFragment.setEnterTransition(new Slide(GravityCompat.getAbsoluteGravity(GravityCompat.START, getResources().getConfiguration().getLayoutDirection())));
    newFragment.setExitTransition(new Slide(GravityCompat.getAbsoluteGravity(GravityCompat.END, getResources().getConfiguration().getLayoutDirection())));
    // 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
    transaction.replace(R.id.fragment_container, newFragment, AlbumsFragment.TAG);
    transaction.addToBackStack("DirectoryAlbumsFragment");
    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) AlbumsFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment) 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)

Example 2 with AlbumsFragment

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

the class MainActivity method onArtistSelected.

@Override
public void onArtistSelected(MPDArtist artist, 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
    AlbumsFragment newFragment = new AlbumsFragment();
    Bundle args = new Bundle();
    args.putString(AlbumsFragment.BUNDLE_STRING_EXTRA_ARTISTNAME, artist.getArtistName());
    args.putParcelable(AlbumsFragment.BUNDLE_STRING_EXTRA_ARTIST, artist);
    // Transfer the bitmap to the next fragment
    if (bitmap != null) {
        args.putParcelable(AlbumsFragment.BUNDLE_STRING_EXTRA_BITMAP, bitmap);
    }
    newFragment.setArguments(args);
    android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    newFragment.setEnterTransition(new Slide(Gravity.BOTTOM));
    newFragment.setExitTransition(new Slide(Gravity.TOP));
    // 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
    transaction.replace(R.id.fragment_container, newFragment, AlbumsFragment.TAG);
    transaction.addToBackStack("ArtistAlbumsFragment");
    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) AlbumsFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment) 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)

Aggregations

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