Search in sources :

Example 6 with MainActivity

use of fr.free.nrw.commons.contributions.MainActivity in project apps-android-commons by commons-app.

the class ExploreFragment method setTabs.

/**
 * Sets the titles in the tabLayout and fragments in the viewPager
 */
public void setTabs() {
    List<Fragment> fragmentList = new ArrayList<>();
    List<String> titleList = new ArrayList<>();
    Bundle featuredArguments = new Bundle();
    featuredArguments.putString("categoryName", FEATURED_IMAGES_CATEGORY);
    Bundle mobileArguments = new Bundle();
    mobileArguments.putString("categoryName", MOBILE_UPLOADS_CATEGORY);
    featuredRootFragment = new ExploreListRootFragment(featuredArguments);
    mobileRootFragment = new ExploreListRootFragment(mobileArguments);
    fragmentList.add(featuredRootFragment);
    titleList.add(getString(R.string.explore_tab_title_featured).toUpperCase());
    fragmentList.add(mobileRootFragment);
    titleList.add(getString(R.string.explore_tab_title_mobile).toUpperCase());
    ((MainActivity) getActivity()).showTabs();
    ((BaseActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
    viewPagerAdapter.setTabData(fragmentList, titleList);
    viewPagerAdapter.notifyDataSetChanged();
}
Also used : Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) MainActivity(fr.free.nrw.commons.contributions.MainActivity) Fragment(androidx.fragment.app.Fragment) CommonsDaggerSupportFragment(fr.free.nrw.commons.di.CommonsDaggerSupportFragment)

Aggregations

MainActivity (fr.free.nrw.commons.contributions.MainActivity)6 View (android.view.View)4 BindView (butterknife.BindView)3 SuppressLint (android.annotation.SuppressLint)1 Dialog (android.app.Dialog)1 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 EditText (android.widget.EditText)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 Nullable (androidx.annotation.Nullable)1 ActionBar (androidx.appcompat.app.ActionBar)1 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)1 Fragment (androidx.fragment.app.Fragment)1 BookmarkPicturesFragment (fr.free.nrw.commons.bookmarks.pictures.BookmarkPicturesFragment)1