app/src/main/java/fr/free/nrw/commons/category/CategoryImagesActivity.java
@Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        if (mediaDetails == null || !mediaDetails.isVisible()) {
            // set isFeaturedImage true for featured images, to include author field on media detail
            mediaDetails = new MediaDetailPagerFragment(false, true);
            FragmentManager supportFragmentManager = getSupportFragmentManager();
            supportFragmentManager
                    .beginTransaction()
                    .hide(supportFragmentManager.getFragments().get(supportFragmentManager.getBackStackEntryCount()))
                    .add(R.id.fragmentContainer, mediaDetails)
                    .addToBackStack(null)
                    .commit();
            // Reason for using hide, add instead of replace is to maintain scroll position after
            // coming back to the search activity. See https://github.com/commons-app/apps-android-commons/issues/1631
            // https://stackoverflow.com/questions/11353075/how-can-i-maintain-fragment-state-when-added-to-the-back-stack/19022550#19022550            supportFragmentManager.executePendingTransactions();
        }
        mediaDetails.showImage(i);
        forceInitBackButton();
    }
/**
     * This method is called onClick of media inside category details (CategoryImageListFragment).
     */
This method is called onClick of media inside category details (CategoryImageListFragment).
This method is called onClick of media inside category details ( CategoryImageListFragment ) .
@Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        if (mediaDetails == null || !mediaDetails.isVisible()) {
            mediaDetails = new MediaDetailPagerFragment(false, true);
            FragmentManager supportFragmentManager = getSupportFragmentManager();
            supportFragmentManager
                    .beginTransaction()
                    .hide(supportFragmentManager.getFragments().get(supportFragmentManager.getBackStackEntryCount()))
                    .add(R.id.fragmentContainer, mediaDetails)
                    .addToBackStack(null)
                    .commit();
        }
        mediaDetails.showImage(i);
        forceInitBackButton();
    }
@ Override public void onItemClick ( AdapterView < ? > adapterView , View view , int i , long l ) { if ( mediaDetails == null || ! mediaDetails . isVisible ( ) ) { mediaDetails = new MediaDetailPagerFragment ( false , true ) ; FragmentManager supportFragmentManager = getSupportFragmentManager ( ) ; supportFragmentManager . beginTransaction ( ) . hide ( supportFragmentManager . getFragments ( ) . get ( supportFragmentManager . getBackStackEntryCount ( ) ) ) . add ( R . id . fragmentContainer , mediaDetails ) . addToBackStack ( null ) . commit ( ) ; } mediaDetails . showImage ( i ) ; forceInitBackButton ( ) ; }
This method is called onClick of media inside category details (CategoryImageListFragment).
This method is called onClick of media inside category details ( CategoryImageListFragment ) .
// set isFeaturedImage true for featured images, to include author field on media detail // Reason for using hide, add instead of replace is to maintain scroll position after // coming back to the search activity. See https://github.com/commons-app/apps-android-commons/issues/1631 // https://stackoverflow.com/questions/11353075/how-can-i-maintain-fragment-state-when-added-to-the-back-stack/19022550#19022550            supportFragmentManager.executePendingTransactions();