Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1.  
  2. final AppBarLayout mAppBarLayout = (AppBarLayout) findViewById(R.id.appBar);
  3. mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
  4. boolean isShow = false;
  5. int scrollRange = -1;
  6.  
  7. @Override
  8. public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
  9. if (scrollRange == -1) {
  10. scrollRange = appBarLayout.getTotalScrollRange();
  11. }
  12. if (scrollRange + verticalOffset == 0) {
  13. isShow = true;
  14. //showOption(R.id.action_info);
  15. mTitle.setVisibility(View.VISIBLE);
  16. if (fontpackfeature.equals("2")) {
  17. Objects.requireNonNull(getSupportActionBar()).setIcon(R.mipmap.wingsgold);
  18. } else if (fontpackfeature.equals("3")) {
  19. Objects.requireNonNull(getSupportActionBar()).setIcon(R.mipmap.wingswine);
  20. } else if (fontpackfeature.equals("4")) {
  21. Objects.requireNonNull(getSupportActionBar()).setIcon(R.mipmap.wingsonline);
  22. } else {
  23. Objects.requireNonNull(getSupportActionBar()).setIcon(R.mipmap.wingsicon);
  24. }
  25. } else if (isShow) {
  26. isShow = false;
  27. //hideOption(R.id.action_info);
  28. mTitle.setVisibility(View.GONE);
  29. Objects.requireNonNull(getSupportActionBar()).setIcon(R.drawable.transparentpng);
  30. mAppBarLayout.setExpanded(true, true);
  31. }
  32. }
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement