Skip to content

Commit e137d3a

Browse files
ericli3690david-allison
authored andcommitted
fix: make PermissionsBottomSheet always be expanded
Implements David's suggested fix for making the PermissionsBottomSheet never be in the "peek" state, so that it always shows up in full on tablet-sized screens. Co-authored-by: David Allison <62114487+david-allison@users.noreply.github.com>
1 parent 2529cac commit e137d3a

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

AnkiDroid/src/main/java/com/ichi2/anki/ui/windows/permissions/PermissionsBottomSheet.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ import androidx.core.os.BundleCompat
2626
import androidx.core.os.bundleOf
2727
import androidx.fragment.app.FragmentManager
2828
import androidx.fragment.app.commit
29+
import com.google.android.material.bottomsheet.BottomSheetBehavior
2930
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
3031
import com.ichi2.anki.PermissionSet
3132
import com.ichi2.anki.R
3233
import com.ichi2.anki.databinding.PermissionsBottomSheetBinding
34+
import com.ichi2.anki.utils.ext.behavior
3335
import dev.androidbroadcast.vbpd.viewBinding
3436

3537
/**
@@ -56,6 +58,11 @@ class PermissionsBottomSheet : BottomSheetDialogFragment() {
5658
) {
5759
super.onViewCreated(view, savedInstanceState)
5860

61+
this.behavior.apply {
62+
state = BottomSheetBehavior.STATE_EXPANDED
63+
skipCollapsed = true
64+
}
65+
5966
binding.closeButton.setOnClickListener { dismiss() }
6067
childFragmentManager.setFragmentResultListener(DISMISS_RESULT_REQUEST_KEY, this) { _, _ ->
6168
dismiss()
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2026 David Allison <davidallisongithub@gmail.com>
3+
*
4+
* This program is free software; you can redistribute it and/or modify it under
5+
* the terms of the GNU General Public License as published by the Free Software
6+
* Foundation; either version 3 of the License, or (at your option) any later
7+
* version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
10+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11+
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with
14+
* this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
package com.ichi2.anki.utils.ext
18+
19+
import com.google.android.material.bottomsheet.BottomSheetBehavior
20+
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
21+
22+
val BottomSheetDialogFragment.behavior
23+
get() =
24+
BottomSheetBehavior
25+
.from(
26+
requireDialog()
27+
.findViewById(com.google.android.material.R.id.design_bottom_sheet)!!,
28+
)

0 commit comments

Comments
 (0)