From aee564471ac54ac25bd70047ce0c374ddee1fd16 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Sun, 16 Jan 2022 12:36:37 -0600 Subject: [PATCH] Add option to disable collapsing app bars --- .../java/com/todoroo/astrid/activity/TaskListFragment.kt | 4 ++++ app/src/main/res/layout/fragment_task_list.xml | 1 - app/src/main/res/values/keys.xml | 1 + app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/preferences_look_and_feel.xml | 5 +++++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/todoroo/astrid/activity/TaskListFragment.kt b/app/src/main/java/com/todoroo/astrid/activity/TaskListFragment.kt index 42c802267..6ce2ca181 100644 --- a/app/src/main/java/com/todoroo/astrid/activity/TaskListFragment.kt +++ b/app/src/main/java/com/todoroo/astrid/activity/TaskListFragment.kt @@ -231,6 +231,10 @@ class TaskListFragment : Fragment(), OnRefreshListener, Toolbar.OnMenuItemClickL binding.toolbar.navigationIcon = null binding.bottomAppBar } + if (!preferences.getBoolean(R.string.p_app_bar_collapse, true)) { + binding.bottomAppBar.hideOnScroll = false + (binding.toolbar.layoutParams as AppBarLayout.LayoutParams).scrollFlags = 0 + } toolbar.setOnMenuItemClickListener(this) toolbar.setNavigationOnClickListener { callbacks.onNavigationIconClicked() } setupMenu(toolbar) diff --git a/app/src/main/res/layout/fragment_task_list.xml b/app/src/main/res/layout/fragment_task_list.xml index 6589bc210..a92c210c0 100644 --- a/app/src/main/res/layout/fragment_task_list.xml +++ b/app/src/main/res/layout/fragment_task_list.xml @@ -74,7 +74,6 @@ android:theme="?attr/overlay_theme" app:popupTheme="@style/popup_overlay" app:hideOnScroll="true" - app:layout_scrollFlags="scroll|enterAlways" app:navigationIcon="@drawable/ic_outline_menu_24px" /> picker_mode_time markdown app_bar_position + app_bar_collapse diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c95244e9a..d77ac67ab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -708,6 +708,7 @@ File %1$s contained %2$s.\n\n Enable Markdown in title and description Play completion sound App bar position + Collapse app bars Top Bottom Completed diff --git a/app/src/main/res/xml/preferences_look_and_feel.xml b/app/src/main/res/xml/preferences_look_and_feel.xml index 05bc41bfd..5242b8330 100644 --- a/app/src/main/res/xml/preferences_look_and_feel.xml +++ b/app/src/main/res/xml/preferences_look_and_feel.xml @@ -62,6 +62,11 @@ android:entryValues="@array/two_values" android:title="@string/app_bar_position" /> + +