Search in sources :

Example 1 with ViewPagerAdapter

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

the class CategoryDetailsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_category_details);
    ButterKnife.bind(this);
    supportFragmentManager = getSupportFragmentManager();
    viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(viewPagerAdapter);
    viewPager.setOffscreenPageLimit(2);
    tabLayout.setupWithViewPager(viewPager);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTabs();
    setPageTitle();
}
Also used : ViewPagerAdapter(fr.free.nrw.commons.ViewPagerAdapter)

Example 2 with ViewPagerAdapter

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

the class ProfileActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);
    ButterKnife.bind(this);
    setTitle(sessionManager.getUserName());
    userName = getIntent().getStringExtra(KEY_USERNAME);
    shouldShowContributions = getIntent().getBooleanExtra(KEY_SHOULD_SHOW_CONTRIBUTIONS, false);
    supportFragmentManager = getSupportFragmentManager();
    viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(viewPagerAdapter);
    tabLayout.setupWithViewPager(viewPager);
    setTabs();
}
Also used : ViewPagerAdapter(fr.free.nrw.commons.ViewPagerAdapter)

Example 3 with ViewPagerAdapter

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

the class ExploreFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_explore, container, false);
    ButterKnife.bind(this, view);
    viewPagerAdapter = new ViewPagerAdapter(getChildFragmentManager());
    viewPager.setAdapter(viewPagerAdapter);
    viewPager.setId(R.id.viewPager);
    tabLayout.setupWithViewPager(viewPager);
    setTabs();
    setHasOptionsMenu(true);
    return view;
}
Also used : ViewPagerAdapter(fr.free.nrw.commons.ViewPagerAdapter) BindView(butterknife.BindView) View(android.view.View)

Example 4 with ViewPagerAdapter

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

the class WikidataItemDetailsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_wikidata_item_details);
    ButterKnife.bind(this);
    compositeDisposable = new CompositeDisposable();
    supportFragmentManager = getSupportFragmentManager();
    viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(viewPagerAdapter);
    viewPager.setOffscreenPageLimit(2);
    tabLayout.setupWithViewPager(viewPager);
    final DepictedItem depictedItem = getIntent().getParcelableExtra(WikidataConstants.BOOKMARKS_ITEMS);
    wikidataItem = depictedItem;
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTabs();
    setPageTitle();
}
Also used : ViewPagerAdapter(fr.free.nrw.commons.ViewPagerAdapter) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) DepictedItem(fr.free.nrw.commons.upload.structure.depictions.DepictedItem)

Example 5 with ViewPagerAdapter

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

the class SearchActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    ButterKnife.bind(this);
    setTitle(getString(R.string.title_activity_search));
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(v -> onBackPressed());
    supportFragmentManager = getSupportFragmentManager();
    setSearchHistoryFragment();
    viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(viewPagerAdapter);
    // Because we want all the fragments to be alive
    viewPager.setOffscreenPageLimit(2);
    tabLayout.setupWithViewPager(viewPager);
    setTabs();
    searchView.setQueryHint(getString(R.string.search_commons));
    searchView.onActionViewExpanded();
    searchView.clearFocus();
}
Also used : ViewPagerAdapter(fr.free.nrw.commons.ViewPagerAdapter)

Aggregations

ViewPagerAdapter (fr.free.nrw.commons.ViewPagerAdapter)5 View (android.view.View)1 BindView (butterknife.BindView)1 DepictedItem (fr.free.nrw.commons.upload.structure.depictions.DepictedItem)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1