当前位置: 首页>>代码示例>>Java>>正文


Java CCFAnimator类代码示例

本文整理汇总了Java中ru.noties.ccf.CCFAnimator的典型用法代码示例。如果您正苦于以下问题:Java CCFAnimator类的具体用法?Java CCFAnimator怎么用?Java CCFAnimator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CCFAnimator类属于ru.noties.ccf包,在下文中一共展示了CCFAnimator类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: animator

import ru.noties.ccf.CCFAnimator; //导入依赖的package包/类
private CCFAnimator animator() {

        final int fromColor = mPendingAnimationConfig.fromColor;
        final int toColor = mPendingAnimationConfig.toColor;

        switch (mType) {

            case HSV:
                return CCFAnimator.hsv(fromColor, toColor);

            case HSV_WITH_ALPHA:
                final int fromAlpha = Color.alpha(fromColor);
                final int toAlpha = Color.alpha(toColor);
                return CCFAnimator.hsv(fromColor, toColor, fromAlpha, toAlpha);

            case RGB:
                return CCFAnimator.rgb(fromColor, toColor);

            case ARGB:
                return CCFAnimator.argb(fromColor, toColor);

            default:
                throw new IllegalStateException("Unknown CCFType: " + mType);
        }

    }
 
开发者ID:noties,项目名称:ColorCrossFade,代码行数:27,代码来源:MainActivity.java

示例2: SampleHeaderViewOnScrollChangedListener

import ru.noties.ccf.CCFAnimator; //导入依赖的package包/类
public SampleHeaderViewOnScrollChangedListener(SampleHeaderView view) {
    mView = view;
    mCCFAnimator = CCFAnimator.rgb(view.getExpandedColor(), view.getCollapsedColor());
}
 
开发者ID:noties,项目名称:Scrollable,代码行数:5,代码来源:SampleHeaderViewOnScrollChangedListener.java

示例3: onCreate

import ru.noties.ccf.CCFAnimator; //导入依赖的package包/类
@Override
public void onCreate(Bundle sis) {
    super.onCreate(sis);

    setContentView(R.layout.activity_scroll_header);

    final ScrollableLayout scrollableLayout = findView(R.id.scrollable_layout);
    final RecyclerView headerRecyclerView = findView(R.id.recycler_view_header);
    final RecyclerView contentRecyclerView = findView(R.id.recycler_view);
    final View header = findViewById(R.id.header);

    final ViewTypesAdapter<String> adapter = ViewTypesAdapter.builder(String.class)
            .register(String.class, new ViewTypeItem())
            .build(this);
    adapter.setItems(ItemsGenerator.generate(100));

    headerRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    contentRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    headerRecyclerView.setAdapter(adapter);
    contentRecyclerView.setAdapter(adapter);

    scrollableLayout.setFriction(.035F);
    scrollableLayout.setDraggableView(header);

    scrollableLayout.setCanScrollVerticallyDelegate(new CanScrollVerticallyDelegate() {
        @Override
        public boolean canScrollVertically(int direction) {
            return contentRecyclerView.canScrollVertically(direction);
        }
    });

    scrollableLayout.addOnScrollChangedListener(new OnScrollChangedListener() {

        final CCFAnimator mCCFAnimator = CCFAnimator.rgb(
                ContextCompat.getColor(ScrollHeaderActivity.this, R.color.md_teal_300),
                ContextCompat.getColor(ScrollHeaderActivity.this, R.color.md_teal_500)
        );

        @Override
        public void onScrollChanged(int y, int oldY, int maxY) {
            final float ratio = (float) y / maxY;
            headerRecyclerView.setBackgroundColor(mCCFAnimator.getColor(ratio));
        }
    });
}
 
开发者ID:noties,项目名称:Scrollable,代码行数:47,代码来源:ScrollHeaderActivity.java


注:本文中的ru.noties.ccf.CCFAnimator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。