ManuelPeinado / FadingActionBar

Android library implementing a fading effect for the action bar, similar to the one found in the Play Music app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to show toolbar when ScrollState to the top?

opened this issue · comments

When I Scroll UP, toolbar is hide. When I Scroll DOWN, it shows toolbar . But when I Scroll DOWN, I want to show toolbar (ScrollState to the top). It have ScrollState.STOP. I thinks to check condition. `implements ObservableScrollViewCallbacks`

toolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
scrollView = (ObservableScrollView) findViewById(R.id.scroll);
scrollView.setScrollViewCallbacks(this);

@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {

}

@Override
public void onDownMotionEvent() {

}

@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (ab == null) {
        return;
    }
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}