Search in sources :

Example 1 with PhotoPagerAdapter

use of com.alexvasilkov.gestures.sample.adapters.PhotoPagerAdapter in project GestureViews by alexvasilkov.

the class Ex6AdvancedDemoActivity method initPager.

private void initPager() {
    // Setting up pager views
    pagerAdapter = new PhotoPagerAdapter(views.pager);
    pagerAdapter.setSetupListener(settingsMenu);
    pagerListener = new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            onPhotoInPagerSelected(position);
        }
    };
    views.pager.setAdapter(pagerAdapter);
    views.pager.addOnPageChangeListener(pagerListener);
    views.pager.setPageTransformer(true, new DepthPageTransformer());
    views.pagerToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    views.pagerToolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(@NonNull View view) {
            onBackPressed();
        }
    });
    onCreateOptionsMenuFullMode(views.pagerToolbar.getMenu());
    views.pagerToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            return onOptionsItemSelectedFullMode(item);
        }
    });
}
Also used : DepthPageTransformer(com.alexvasilkov.gestures.commons.DepthPageTransformer) PhotoPagerAdapter(com.alexvasilkov.gestures.sample.adapters.PhotoPagerAdapter) MenuItem(android.view.MenuItem) ViewPager(android.support.v4.view.ViewPager) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

ViewPager (android.support.v4.view.ViewPager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Toolbar (android.support.v7.widget.Toolbar)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 DepthPageTransformer (com.alexvasilkov.gestures.commons.DepthPageTransformer)1 PhotoPagerAdapter (com.alexvasilkov.gestures.sample.adapters.PhotoPagerAdapter)1