Automatically expand menu for top app bar

pull/1737/head
Alex Baker 2 years ago
parent a79b7f276a
commit 4bda63b43d

@ -31,6 +31,7 @@ import org.tasks.extensions.Context.openUri
import org.tasks.filters.FilterProvider import org.tasks.filters.FilterProvider
import org.tasks.filters.NavigationDrawerAction import org.tasks.filters.NavigationDrawerAction
import org.tasks.intents.TaskIntents import org.tasks.intents.TaskIntents
import org.tasks.preferences.Preferences
import javax.inject.Inject import javax.inject.Inject
@AndroidEntryPoint @AndroidEntryPoint
@ -41,6 +42,7 @@ class NavigationDrawerFragment : BottomSheetDialogFragment() {
@Inject lateinit var adapter: NavigationDrawerAdapter @Inject lateinit var adapter: NavigationDrawerAdapter
@Inject lateinit var filterProvider: FilterProvider @Inject lateinit var filterProvider: FilterProvider
@Inject lateinit var taskDao: TaskDao @Inject lateinit var taskDao: TaskDao
@Inject lateinit var preferences: Preferences
override fun getTheme() = R.style.CustomBottomSheetDialog override fun getTheme() = R.style.CustomBottomSheetDialog
@ -62,7 +64,9 @@ class NavigationDrawerFragment : BottomSheetDialogFragment() {
val bottomSheet = dialog.findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet) val bottomSheet = dialog.findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
val behavior = BottomSheetBehavior.from(bottomSheet!!) val behavior = BottomSheetBehavior.from(bottomSheet!!)
behavior.skipCollapsed = true behavior.skipCollapsed = true
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { if (preferences.isTopAppBar) {
behavior.state = BottomSheetBehavior.STATE_EXPANDED
} else if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED behavior.state = BottomSheetBehavior.STATE_HALF_EXPANDED
} }
} }

Loading…
Cancel
Save