Search in sources :

Example 1 with MediaDetailFragment

use of fr.free.nrw.commons.media.MediaDetailFragment in project apps-android-commons by commons-app.

the class ReviewActivity method setUpMediaDetailFragment.

/**
 * set up the media detail fragment when click on the review image
 */
private void setUpMediaDetailFragment() {
    if (mediaDetailContainer.getVisibility() == View.GONE && media != null) {
        mediaDetailContainer.setVisibility(View.VISIBLE);
        reviewContainer.setVisibility(View.INVISIBLE);
        FragmentManager fragmentManager = getSupportFragmentManager();
        mediaDetailFragment = new MediaDetailFragment();
        Bundle bundle = new Bundle();
        bundle.putParcelable("media", media);
        mediaDetailFragment.setArguments(bundle);
        fragmentManager.beginTransaction().add(R.id.mediaDetailContainer, mediaDetailFragment).addToBackStack("MediaDetail").commit();
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) Bundle(android.os.Bundle) MediaDetailFragment(fr.free.nrw.commons.media.MediaDetailFragment)

Example 2 with MediaDetailFragment

use of fr.free.nrw.commons.media.MediaDetailFragment in project apps-android-commons by commons-app.

the class ReviewActivity method setUpMediaDetailOnOrientation.

/**
 * set up media detail fragment after orientation change
 */
private void setUpMediaDetailOnOrientation() {
    Fragment mediaDetailFragment = getSupportFragmentManager().findFragmentById(R.id.mediaDetailContainer);
    if (mediaDetailFragment != null) {
        mediaDetailContainer.setVisibility(View.VISIBLE);
        reviewContainer.setVisibility(View.INVISIBLE);
        getSupportFragmentManager().beginTransaction().replace(R.id.mediaDetailContainer, mediaDetailFragment).commit();
    }
}
Also used : MediaDetailFragment(fr.free.nrw.commons.media.MediaDetailFragment) Fragment(androidx.fragment.app.Fragment)

Aggregations

MediaDetailFragment (fr.free.nrw.commons.media.MediaDetailFragment)2 Bundle (android.os.Bundle)1 Fragment (androidx.fragment.app.Fragment)1 FragmentManager (androidx.fragment.app.FragmentManager)1