Search in sources :

Example 1 with ParentDepictionsFragment

use of fr.free.nrw.commons.explore.depictions.parent.ParentDepictionsFragment in project apps-android-commons by commons-app.

the class WikidataItemDetailsActivity method setTabs.

/**
 * This activity contains 3 tabs and a viewpager. This method is used to set the titles of tab,
 * Set the fragments according to the tab selected in the viewPager.
 */
private void setTabs() {
    List<Fragment> fragmentList = new ArrayList<>();
    List<String> titleList = new ArrayList<>();
    depictionImagesListFragment = new DepictedImagesFragment();
    ChildDepictionsFragment childDepictionsFragment = new ChildDepictionsFragment();
    ParentDepictionsFragment parentDepictionsFragment = new ParentDepictionsFragment();
    wikidataItemName = getIntent().getStringExtra("wikidataItemName");
    String entityId = getIntent().getStringExtra("entityId");
    if (getIntent() != null && wikidataItemName != null) {
        Bundle arguments = new Bundle();
        arguments.putString("wikidataItemName", wikidataItemName);
        arguments.putString("entityId", entityId);
        depictionImagesListFragment.setArguments(arguments);
        parentDepictionsFragment.setArguments(arguments);
        childDepictionsFragment.setArguments(arguments);
    }
    fragmentList.add(depictionImagesListFragment);
    titleList.add(getResources().getString(R.string.title_for_media));
    fragmentList.add(childDepictionsFragment);
    titleList.add(getResources().getString(R.string.title_for_child_classes));
    fragmentList.add(parentDepictionsFragment);
    titleList.add(getResources().getString(R.string.title_for_parent_classes));
    viewPagerAdapter.setTabData(fragmentList, titleList);
    viewPager.setOffscreenPageLimit(2);
    viewPagerAdapter.notifyDataSetChanged();
}
Also used : ParentDepictionsFragment(fr.free.nrw.commons.explore.depictions.parent.ParentDepictionsFragment) DepictedImagesFragment(fr.free.nrw.commons.explore.depictions.media.DepictedImagesFragment) Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) ChildDepictionsFragment(fr.free.nrw.commons.explore.depictions.child.ChildDepictionsFragment) DepictedImagesFragment(fr.free.nrw.commons.explore.depictions.media.DepictedImagesFragment) Fragment(androidx.fragment.app.Fragment) MediaDetailPagerFragment(fr.free.nrw.commons.media.MediaDetailPagerFragment) ParentDepictionsFragment(fr.free.nrw.commons.explore.depictions.parent.ParentDepictionsFragment) ChildDepictionsFragment(fr.free.nrw.commons.explore.depictions.child.ChildDepictionsFragment)

Aggregations

Bundle (android.os.Bundle)1 Fragment (androidx.fragment.app.Fragment)1 ChildDepictionsFragment (fr.free.nrw.commons.explore.depictions.child.ChildDepictionsFragment)1 DepictedImagesFragment (fr.free.nrw.commons.explore.depictions.media.DepictedImagesFragment)1 ParentDepictionsFragment (fr.free.nrw.commons.explore.depictions.parent.ParentDepictionsFragment)1 MediaDetailPagerFragment (fr.free.nrw.commons.media.MediaDetailPagerFragment)1 ArrayList (java.util.ArrayList)1