Android Open Source - StikkyHeader Header Animator






From Project

Back to project page StikkyHeader.

License

The source code is released under:

Apache License

If you think the Android project StikkyHeader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package it.carlom.stikkyheader.core;
//from   www  . j  a v a  2 s  .co m

import android.view.View;
import android.widget.ListView;

public abstract class HeaderAnimator {

    private View mHeader;
    private ListView mListView;
    private int mMinHeightHeader;
    private int mHeightHeader;
    private int mMaxTranslation;

    public abstract void onScroll(final int scrolledY,final View header);

    /**
     * Called by the {@link it.carlom.stikkyheader.core.StikkyHeader} to set the {@link HeaderAnimator} up
     *
     * @param header
     * @param listView
     */
    void setupAnimator(final View header, final ListView listView, final int minHeightHeader, final int heightHeader, final int maxTranslation) {
        this.mHeader = header;
        this.mListView = listView;
        this.mMinHeightHeader = minHeightHeader;
        this.mHeightHeader = heightHeader;
        this.mMaxTranslation = maxTranslation;

        onAnimatorAttached();
        onAnimatorReady();
    }

    /**
     * Called after that the animator is attached to the header
     */
    protected abstract void onAnimatorAttached();

    /**
     * Called after that the animator is attached and ready
     */
    protected abstract void onAnimatorReady();

    public View getHeader() {
        return mHeader;
    }

    public ListView getListView() {
        return mListView;
    }

    public int getMinHeightHeader() {
        return mMinHeightHeader;
    }

    public int getHeightHeader() {
        return mHeightHeader;
    }

    public int getMaxTranslation() {
        return mMaxTranslation;
    }

    public static float clamp(float value, float min, float max) {
        return Math.max(min, Math.min(value, max));
    }
}




Java Source Code List

it.carlom.stickyheader.example.MainActivity.java
it.carlom.stickyheader.example.animator.IO2014HeaderAnimator.java
it.carlom.stickyheader.example.animator.IconActionBarAnimator.java
it.carlom.stickyheader.example.fragment.ActionBarImageFragment.java
it.carlom.stickyheader.example.fragment.FadeOutInterpolatedFragment.java
it.carlom.stickyheader.example.fragment.IO2014HeaderFragment.java
it.carlom.stickyheader.example.fragment.MainFragment.java
it.carlom.stickyheader.example.fragment.ParallaxStikkyFragment.java
it.carlom.stickyheader.example.fragment.SimpleStikkyFragment.java
it.carlom.stikkyheader.core.HeaderAnimator.java
it.carlom.stikkyheader.core.StikkyHeaderBuilder.java
it.carlom.stikkyheader.core.StikkyHeader.java
it.carlom.stikkyheader.core.animator.AnimatorBuilder.java
it.carlom.stikkyheader.core.animator.BaseStickyHeaderAnimator.java
it.carlom.stikkyheader.core.animator.HeaderStikkyAnimator.java