Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final AppBarLayout mAppBarLayout = (AppBarLayout) findViewById(R.id.appBar);
- mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
- boolean isShow = false;
- int scrollRange = -1;
- @Override
- public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
- if (scrollRange == -1) {
- scrollRange = appBarLayout.getTotalScrollRange();
- }
- if (scrollRange + verticalOffset == 0) {
- isShow = true;
- //showOption(R.id.action_info);
- mTitle.setVisibility(View.VISIBLE);
- if (fontpackfeature.equals("2")) {
- Objects.requireNonNull(getSupportActionBar()).setIcon(R.mipmap.wingsgold);
- } else if (fontpackfeature.equals("3")) {
- Objects.requireNonNull(getSupportActionBar()).setIcon(R.mipmap.wingswine);
- } else if (fontpackfeature.equals("4")) {
- Objects.requireNonNull(getSupportActionBar()).setIcon(R.mipmap.wingsonline);
- } else {
- Objects.requireNonNull(getSupportActionBar()).setIcon(R.mipmap.wingsicon);
- }
- } else if (isShow) {
- isShow = false;
- //hideOption(R.id.action_info);
- mTitle.setVisibility(View.GONE);
- Objects.requireNonNull(getSupportActionBar()).setIcon(R.drawable.transparentpng);
- mAppBarLayout.setExpanded(true, true);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement