java类android.support.v4.view.ViewPager.PageTransformer的实例源码

ViewPagerCompat.java 文件源码 项目:android-project-gallery 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Set a {@link 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><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
 */
// Compat Here...
public void setPageTransformer(boolean reverseDrawingOrder, 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();
    }
}
ViewPagerCompat.java 文件源码 项目:android-project-wo2b 阅读 35 收藏 0 点赞 0 评论 0
/**
 * Set a {@link 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><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
 */
// Compat Here...
public void setPageTransformer(boolean reverseDrawingOrder, 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();
    }
}
PhotoViewPager.java 文件源码 项目:FMTech 阅读 23 收藏 0 点赞 0 评论 0
private void initialize()
{
  setPageTransformer$382b7817(new ViewPager.PageTransformer()
  {
    public final void transformPage(View paramAnonymousView, float paramAnonymousFloat)
    {
      if ((paramAnonymousFloat < 0.0F) || (paramAnonymousFloat >= 1.0F))
      {
        paramAnonymousView.setTranslationX(0.0F);
        paramAnonymousView.setAlpha(1.0F);
        paramAnonymousView.setScaleX(1.0F);
        paramAnonymousView.setScaleY(1.0F);
        return;
      }
      paramAnonymousView.setTranslationX(-paramAnonymousFloat * paramAnonymousView.getWidth());
      paramAnonymousView.setAlpha(Math.max(0.0F, 1.0F - paramAnonymousFloat));
      float f = Math.max(0.0F, 1.0F - 0.3F * paramAnonymousFloat);
      paramAnonymousView.setScaleX(f);
      paramAnonymousView.setScaleY(f);
    }
  });
}
ViewPagerCompat.java 文件源码 项目:android-auto-scroll-viewpager 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Set a {@link 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><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
 */
// Compat Here...
public void setPageTransformer(boolean reverseDrawingOrder, 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();
    }
}
HomeFragment.java 文件源码 项目:TYT 阅读 31 收藏 0 点赞 0 评论 0
public void initConvenientBanner() {
    showView(mConvenientBanner);

    //  mConvenientBanner.setManualPageable(false); // 设置不能手动影响,其实就是不能手动滑动,不能按住暂停滚动

    ArrayList<Integer> localImages = new ArrayList<>();
    for (int position = 0; position < 4; position++)
        localImages.add(getResId("ic_banner_" + position, R.mipmap.class));

    mConvenientBanner.setPages(new CBViewHolderCreator<LocalImageHolderView>() {
        @Override
        public LocalImageHolderView createHolder() {
            return new LocalImageHolderView();
        }
    }, localImages)
            // 设置两个点图片作为翻页指示器,不设置则没有指示器,可以根据自己需求自行配合自己的指示器,不需要圆点指示器可以不设
            .setPageIndicator(new int[]{R.mipmap.ic_page_indicator, R.mipmap.ic_page_indicator_focused});
    // .setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.ALIGN_PARENT_RIGHT) // 设置指示器的位置,可左可右,目前居中
    //  .setOnPageChangeListener(this)// 监听翻页事件
    // .setOnItemClickListener(this) // 监听图片的点击事件

    try {
        // 设置翻页动画
        PageTransformer pageTransformer = TRANSFORM_CLASSES.get(CURRENT_TRANSFORMER).clazz.newInstance();
        mConvenientBanner.getViewPager().setPageTransformer(true, pageTransformer);
        // 这个3D特效需要调整滑动速度
        if (pageTransformer.toString().equals("StackTransformer")) {
            mConvenientBanner.setScrollDuration(1200);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}
VerticalViewPager.java 文件源码 项目:core-ui 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Sets a {@link 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 behavior.
 *
 * <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.
 *
 * @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, 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();
    }
}
VerticalViewPager.java 文件源码 项目:FolioReader-Android 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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, 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();
    }
}
VerticalViewPager.java 文件源码 项目:Vertical-ViewPager 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Set a {@link 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><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, 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();
    }
}
HomeFragment.java 文件源码 项目:TYT 阅读 30 收藏 0 点赞 0 评论 0
public TransformerItem(Class<? extends PageTransformer> clazz) {
    this.clazz = clazz;
    title = clazz.getSimpleName();
}
MainActivity.java 文件源码 项目:android-viewpager-transformers 阅读 22 收藏 0 点赞 0 评论 0
public TransformerItem(Class<? extends PageTransformer> clazz) {
    this.clazz = clazz;
    title = clazz.getSimpleName();
}
MainActivity.java 文件源码 项目:ViewPagerTransforms 阅读 23 收藏 0 点赞 0 评论 0
public TransformerItem(Class<? extends PageTransformer> clazz) {
    this.clazz = clazz;
    title = clazz.getSimpleName();
}
ViewPagerTransformerActivity.java 文件源码 项目:UltimateAndroid 阅读 24 收藏 0 点赞 0 评论 0
public TransformerItem(Class<? extends PageTransformer> clazz) {
    this.clazz = clazz;
    title = clazz.getSimpleName();
}
ViewPagerTransformerActivity.java 文件源码 项目:UltimateAndroid 阅读 23 收藏 0 点赞 0 评论 0
public TransformerItem(Class<? extends PageTransformer> clazz) {
    this.clazz = clazz;
    title = clazz.getSimpleName();
}
ConvenientBanner.java 文件源码 项目:GeekZone 阅读 31 收藏 0 点赞 0 评论 0
/**
 * 自定义翻页动画效果
 *
 * @param transformer
 * @return
 */
public ConvenientBanner setPageTransformer(PageTransformer transformer) {
    viewPager.setPageTransformer(true, transformer);
    return this;
}
ConvenientBanner.java 文件源码 项目:Mybilibili 阅读 22 收藏 0 点赞 0 评论 0
/**
 * 自定义翻页动画效果
 *
 * @param transformer
 * @return
 */
public ConvenientBanner setPageTransformer(PageTransformer transformer) {
    viewPager.setPageTransformer(true, transformer);
    return this;
}
ConvenientBanner.java 文件源码 项目:AndroidBase 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 自定义翻页动画效果
 *
 * @param transformer
 * @return
 */
public ConvenientBanner setPageTransformer(PageTransformer transformer) {
    viewPager.setPageTransformer(true, transformer);
    return this;
}


问题


面经


文章

微信
公众号

扫码关注公众号