Java Code Examples for androidx.viewpager.widget.ViewPager#PageTransformer

The following examples show how to use androidx.viewpager.widget.ViewPager#PageTransformer . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VerticalViewPager.java    From DKVideoPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * Set a {@link ViewPager.PageTransformer} that will be called for each attached page whenever
 * the scroll position is changed. This allows the application to apply custom property
 * transformations to each page, overriding the default sliding look and feel.
 * <p/>
 * <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist.
 * As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p>
 *
 * @param reverseDrawingOrder true if the supplied PageTransformer requires page views
 *                            to be drawn from last to first instead of first to last.
 * @param transformer         PageTransformer that will modify each page's animation properties
 */
public void setPageTransformer(boolean reverseDrawingOrder, ViewPager.PageTransformer transformer) {
    if (Build.VERSION.SDK_INT >= 11) {
        final boolean hasTransformer = transformer != null;
        final boolean needsPopulate = hasTransformer != (mPageTransformer != null);
        mPageTransformer = transformer;
        setChildrenDrawingOrderEnabledCompat(hasTransformer);
        if (hasTransformer) {
            mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD;
        } else {
            mDrawingOrder = DRAW_ORDER_DEFAULT;
        }
        if (needsPopulate) populate();
    }
}
 
Example 2
Source File: AnimationUtils.java    From leafpicrevived with GNU General Public License v3.0 4 votes vote down vote up
public static ViewPager.PageTransformer getPageTransformer(ViewPager.PageTransformer pageTransformer) {
    if (Prefs.animationsEnabled()) {
        return pageTransformer;
    }
    return null;
}
 
Example 3
Source File: ViewPagerHolder.java    From BaldPhone with Apache License 2.0 4 votes vote down vote up
public void setPageTransformer(boolean reverseDrawingOrder,
                               @Nullable ViewPager.PageTransformer transformer) {
    viewPager.setPageTransformer(reverseDrawingOrder, transformer);
}
 
Example 4
Source File: ItemTransformerWrapper.java    From OmegaRecyclerView with MIT License 4 votes vote down vote up
public ItemTransformerWrapper(ViewPager.PageTransformer pageTransformer) {
    mPageTransformer = pageTransformer;
}
 
Example 5
Source File: OmegaPagerRecyclerView.java    From OmegaRecyclerView with MIT License 4 votes vote down vote up
public void setItemTransformer(ViewPager.PageTransformer transformer) {
    setItemTransformer(new ItemTransformerWrapper(transformer));
}
 
Example 6
Source File: EmojiPopup.java    From Emoji with Apache License 2.0 4 votes vote down vote up
@CheckResult public Builder setPageTransformer(@Nullable final ViewPager.PageTransformer transformer) {
  pageTransformer = transformer;
  return this;
}
 
Example 7
Source File: IntroActivity.java    From material-intro with MIT License 4 votes vote down vote up
public void setPageTransformer(boolean reverseDrawingOrder, ViewPager.PageTransformer transformer) {
    miPager.setPageTransformer(reverseDrawingOrder, transformer);
}
 
Example 8
Source File: BaseBanner.java    From BaseProject with Apache License 2.0 4 votes vote down vote up
/** 设置页面切换动画 */
public I setTransformerClass(Class<? extends ViewPager.PageTransformer> transformerClass) {
    this.mTransformerClass = transformerClass;
    return self();
}
 
Example 9
Source File: AppIntro.java    From shortyz with GNU General Public License v3.0 4 votes vote down vote up
public void setCustomTransformer(@Nullable ViewPager.PageTransformer transformer) {
    pager.setPageTransformer(true, transformer);
}