本文整理汇总了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);
}
}
示例2: SampleHeaderViewOnScrollChangedListener
import ru.noties.ccf.CCFAnimator; //导入依赖的package包/类
public SampleHeaderViewOnScrollChangedListener(SampleHeaderView view) {
mView = view;
mCCFAnimator = CCFAnimator.rgb(view.getExpandedColor(), view.getCollapsedColor());
}
示例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));
}
});
}