fix media picking not working (#4989)
regression from https://github.com/tuskyapp/Tusky/pull/4978 I'm sure this `BottomSheetCallback` business had a reason, but it works fine without on all the devices I tried it with 🤷
This commit is contained in:
parent
2278aa4f08
commit
271514f2ce
1 changed files with 6 additions and 18 deletions
|
|
@ -996,24 +996,12 @@ class ComposeActivity :
|
|||
}
|
||||
|
||||
private fun onMediaPick() {
|
||||
addMediaBehavior.addBottomSheetCallback(
|
||||
object : BottomSheetCallback() {
|
||||
override fun onStateChanged(bottomSheet: View, newState: Int) {
|
||||
// Wait until bottom sheet is not collapsed and show next screen after
|
||||
if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
addMediaBehavior.removeBottomSheetCallback(this)
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||
pickMediaFilePermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
} else {
|
||||
pickMediaFileLauncher.launch(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSlide(bottomSheet: View, slideOffset: Float) {}
|
||||
}
|
||||
)
|
||||
addMediaBehavior.state = BottomSheetBehavior.STATE_HIDDEN
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||
pickMediaFilePermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
} else {
|
||||
pickMediaFileLauncher.launch(true)
|
||||
}
|
||||
addMediaBehavior.setState(BottomSheetBehavior.STATE_HIDDEN)
|
||||
}
|
||||
|
||||
private fun openPollDialog() = lifecycleScope.launch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue