Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

collapsingtoolbarlayout collapse listener

public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener {

    public enum State {
        EXPANDED,
        COLLAPSED,
        IDLE
    }

    private State mCurrentState = State.IDLE;

    @Override
    public final void onOffsetChanged(AppBarLayout appBarLayout, int i) {
        if (i == 0) {
            if (mCurrentState != State.EXPANDED) {
                onStateChanged(appBarLayout, State.EXPANDED);
            }
            mCurrentState = State.EXPANDED;
        } else if (Math.abs(i) >= appBarLayout.getTotalScrollRange()) {
            if (mCurrentState != State.COLLAPSED) {
                onStateChanged(appBarLayout, State.COLLAPSED);
            }
            mCurrentState = State.COLLAPSED;
        } else {
            if (mCurrentState != State.IDLE) {
                onStateChanged(appBarLayout, State.IDLE);
            }
            mCurrentState = State.IDLE;
        }
    }

    public abstract void onStateChanged(AppBarLayout appBarLayout, State state);
}
Comment

PREVIOUS NEXT
Code Example
Java :: equals() method in java algorithm 
Java :: v2ray 
Java :: leetcode egg drop 
Java :: comvertir a java 
Java :: java initialize dynamic array of boolean 
Java :: java notnull returns null 
Java :: how to read returned arraylist from another class method 
Java :: java this keyword 
Java :: stream get double value from map 
Java :: how to add data json jaca 
Java :: Caused by: java.lang.IllegalStateException: stream has already been operated upon or closed 
Java :: ResultSet rs = ps.executeQuery() 
Java :: labelled for loop in java 
Java :: io fole scanner object syntax 
Java :: java fill two dimensional array stream 
Java :: intellij evaluate expression 
Java :: print map in java log 
Java :: for loop in firebase snapshot in java 
Java :: java sin-1 
Java :: java get end of date 
Java :: crazy error 
Java :: ways to add properties to Bean Spring 
Java :: como codificar pilas en java creeper 
Java :: expiry time of otp android 
Java :: spring media part max size 
Java :: compiling and running program in terminal 
Java :: reverse integer 
Java :: ternary search in java 
Java :: why is write replacing my text java 
Java :: java mockito print called methods 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =