diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-05-11 14:37:09 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-05-11 14:47:24 +0300 |
| commit | aec7443a54a8292a62055fd2a72e71f4b8010ed3 (patch) | |
| tree | b9bf7ddc0f48d0e7529ad2a6c94e3093704ff38f | |
| parent | 2c02677fa59f3c02ea091b643f8d97349e536fe2 (diff) | |
fix detail FAB not being hidden if disabled, also fix malfunctioning (if
fab is disabled) detail view scroll behaviour
| -rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java | 24 | ||||
| -rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/util/DetailActivityScrollingViewBehavior.java | 38 |
2 files changed, 33 insertions, 29 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java index c9da82da..ecde9d51 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java @@ -119,17 +119,21 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList FloatingActionButton fab = findViewById(R.id.detail_fab); - if (fab != null && m_prefs.getBoolean("enable_article_fab", true)) { - fab.show(); - - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (m_activeArticle != null) { - openUri(Uri.parse(m_activeArticle.link)); + if (fab != null) { + if (m_prefs.getBoolean("enable_article_fab", true)) { + fab.show(); + + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (m_activeArticle != null) { + openUri(Uri.parse(m_activeArticle.link)); + } } - } - }); + }); + } else { + fab.hide(); + } } if (savedInstanceState == null) { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/DetailActivityScrollingViewBehavior.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/DetailActivityScrollingViewBehavior.java index 27682b13..1d7b15df 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/util/DetailActivityScrollingViewBehavior.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/util/DetailActivityScrollingViewBehavior.java @@ -48,26 +48,26 @@ public class DetailActivityScrollingViewBehavior extends AppBarLayout.ScrollingV @NonNull int[] consumed, int type) { super.onNestedPreScroll(coordinatorLayout, child, target, dx, dy, consumed, type); - if (m_prefs.getBoolean("enable_article_fab", true)) { - if (dy > 0) { - // User scrolled down -> hide the FAB - List<View> dependencies = coordinatorLayout.getDependencies(child); - for (View view : dependencies) { - if (view instanceof FloatingActionButton) { - ((FloatingActionButton) view).hide(); - } else if (view instanceof BottomAppBar) { - ((BottomAppBar) view).performHide(); - } + boolean enableFab = m_prefs.getBoolean("enable_article_fab", true); + + if (dy > 0) { + // User scrolled down -> hide the FAB + List<View> dependencies = coordinatorLayout.getDependencies(child); + for (View view : dependencies) { + if (view instanceof FloatingActionButton) { + ((FloatingActionButton) view).hide(); + } else if (view instanceof BottomAppBar) { + ((BottomAppBar) view).performHide(); } - } else if (dy < 0) { - // User scrolled up -> show the FAB - List<View> dependencies = coordinatorLayout.getDependencies(child); - for (View view : dependencies) { - if (view instanceof FloatingActionButton) { - ((FloatingActionButton) view).show(); - } else if (view instanceof BottomAppBar) { - ((BottomAppBar) view).performShow(); - } + } + } else if (dy < 0) { + // User scrolled up -> show the FAB + List<View> dependencies = coordinatorLayout.getDependencies(child); + for (View view : dependencies) { + if (enableFab && view instanceof FloatingActionButton) { + ((FloatingActionButton) view).show(); + } else if (view instanceof BottomAppBar) { + ((BottomAppBar) view).performShow(); } } } |