Java Code Examples for ru.noties.ccf.CCFAnimator

The following examples show how to use ru.noties.ccf.CCFAnimator. These examples are extracted from open source projects. 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 Project: ColorCrossFade   Source File:    License: Apache License 2.0 6 votes vote down vote up
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);

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

Example 2
public SampleHeaderViewOnScrollChangedListener(SampleHeaderView view) {
    mView = view;
    mCCFAnimator = CCFAnimator.rgb(view.getExpandedColor(), view.getCollapsedColor());
Example 3
Source Project: Scrollable   Source File:    License: Apache License 2.0 4 votes vote down vote up
public void onCreate(Bundle sis) {


    final ScrollableLayout scrollableLayout = findView(;
    final RecyclerView headerRecyclerView = findView(;
    final RecyclerView contentRecyclerView = findView(;
    final View header = findViewById(;

    final ViewTypesAdapter<String> adapter = ViewTypesAdapter.builder(String.class)
            .register(String.class, new ViewTypeItem())

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



    scrollableLayout.setCanScrollVerticallyDelegate(new CanScrollVerticallyDelegate() {
        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)

        public void onScrollChanged(int y, int oldY, int maxY) {
            final float ratio = (float) y / maxY;