use of com.alexvasilkov.gestures.commons.DepthPageTransformer 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);
}
});
}
use of com.alexvasilkov.gestures.commons.DepthPageTransformer in project GestureViews by alexvasilkov.
the class BaseComplexListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.complex_list_screen);
final RecyclerView list = findViewById(R.id.complex_list);
pager = findViewById(R.id.complex_pager);
pagerBackground = findViewById(R.id.complex_pager_background);
final List<ListItem> items = createItems();
// Setting up recycler view
list.setLayoutManager(new LinearLayoutManager(this));
list.setAdapter(new ListAdapter(items, this::onImageClick));
// Setting up pager view
pagerAdapter = new PagerAdapter(pager, getSettingsController());
pager.setAdapter(pagerAdapter);
pager.setPageTransformer(true, new DepthPageTransformer());
// Setting up animator
animator = createAnimator(list, pager);
animator.addPositionUpdateListener(this::applyImageAnimationState);
}
use of com.alexvasilkov.gestures.commons.DepthPageTransformer in project GestureViews by alexvasilkov.
the class DemoActivity method initPager.
/**
* Initializing pager and fullscreen mode.
*/
private void initPager() {
// Setting up pager adapter
pagerAdapter = new PhotoPagerAdapter(views.pager, getSettingsController());
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());
// Setting up pager toolbar
views.pagerToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
views.pagerToolbar.setNavigationOnClickListener(view -> onBackPressed());
// Enabling immersive mode by clicking on full screen image
pagerAdapter.setImageClickListener(() -> {
if (!listAnimator.isLeaving()) {
// Toggle immersive mode
showSystemUi(!isSystemUiShown());
}
});
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(visibility -> views.pagerToolbar.animate().alpha(isSystemUiShown() ? 1f : 0f));
}
Aggregations