Avoid the initial vertical position of BottomSheetDialogs being capped.
This commit is contained in:
parent
0dbbe0e5d2
commit
1389ddbfc0
@ -143,7 +143,6 @@ class BottomSheetColorPicker(
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.loader.isVisible = false
|
||||
binding.listContainer.addView(listBinding.root)
|
||||
this@BottomSheetColorPicker.behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
binding.listContainer.isVisible = true
|
||||
|
||||
val idx = colors.toList().indexOf(getSelected?.invoke())
|
||||
@ -152,6 +151,10 @@ class BottomSheetColorPicker(
|
||||
})
|
||||
|
||||
setContentView(binding.root)
|
||||
behavior.run {
|
||||
skipCollapsed = true
|
||||
state = BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
super.show()
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,10 @@ open class BottomSheetMenu<T>(context: Context, private val header: String? = nu
|
||||
}
|
||||
}
|
||||
setContentView(binding.root)
|
||||
behavior.run {
|
||||
skipCollapsed = true
|
||||
state = com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
super.show()
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,6 @@ class BottomSheetPicker<T>(
|
||||
withContext(Dispatchers.Main) {
|
||||
binding.loader.isVisible = false
|
||||
binding.listContainer.addView(listBinding.root)
|
||||
this@BottomSheetPicker.behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||
binding.listContainer.isVisible = true
|
||||
|
||||
val idx = items.toList().indexOfFirst { it.value == getSelected?.invoke() }
|
||||
@ -95,6 +94,10 @@ class BottomSheetPicker<T>(
|
||||
})
|
||||
|
||||
setContentView(binding.root)
|
||||
behavior.run {
|
||||
skipCollapsed = true
|
||||
state = BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
super.show()
|
||||
}
|
||||
|
||||
|
@ -61,5 +61,9 @@ class BottomSheetWeatherProviderSettings(context: Context, callback: () -> Unit)
|
||||
}
|
||||
|
||||
setContentView(binding.root)
|
||||
behavior.run {
|
||||
skipCollapsed = true
|
||||
state = com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
}
|
||||
}
|
@ -26,5 +26,9 @@ class CustomNotesDialog(context: Context, callback: (() -> Unit)?) : BottomSheet
|
||||
binding.notes.requestFocus()
|
||||
|
||||
setContentView(binding.root)
|
||||
behavior.run {
|
||||
skipCollapsed = true
|
||||
state = com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
}
|
||||
}
|
@ -217,6 +217,10 @@ class GlanceSettingsDialog(val context: Activity, val provider: Constants.Glance
|
||||
}
|
||||
|
||||
setContentView(binding.root)
|
||||
behavior.run {
|
||||
skipCollapsed = true
|
||||
state = com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
super.show()
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,10 @@ class IconPackSelector(context: Context, private val header: String? = null) : B
|
||||
binding.menu.addView(itemBinding.root)
|
||||
}
|
||||
setContentView(binding.root)
|
||||
behavior.run {
|
||||
skipCollapsed = true
|
||||
state = com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
super.show()
|
||||
}
|
||||
}
|
@ -57,6 +57,10 @@ class MaterialBottomSheetDialog(
|
||||
}
|
||||
|
||||
setContentView(binding.root)
|
||||
behavior.run {
|
||||
skipCollapsed = true
|
||||
state = com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED
|
||||
}
|
||||
super.show()
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ import com.chibatching.kotpref.bulk
|
||||
import com.google.android.material.transition.MaterialSharedAxis
|
||||
import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.components.BottomSheetColorPicker
|
||||
import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
|
||||
import com.tommasoberlose.anotherwidget.components.BottomSheetPicker
|
||||
import com.tommasoberlose.anotherwidget.databinding.FragmentTabClockBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Constants
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
@ -144,16 +144,15 @@ class ClockFragment : Fragment() {
|
||||
private fun setupListener() {
|
||||
|
||||
binding.actionClockTextSize.setOnClickListener {
|
||||
val dialog = BottomSheetMenu<Float>(
|
||||
BottomSheetPicker(
|
||||
requireContext(),
|
||||
header = getString(R.string.settings_clock_text_size_title)
|
||||
).setSelectedValue(Preferences.clockTextSize)
|
||||
(46 downTo 12).filter { it % 2 == 0 }.forEach {
|
||||
dialog.addItem("${it}sp", it.toFloat())
|
||||
}
|
||||
dialog.addOnSelectItemListener { value ->
|
||||
Preferences.clockTextSize = value
|
||||
}.show()
|
||||
items = (46 downTo 12).map { BottomSheetPicker.MenuItem("${it}sp", it.toFloat()) },
|
||||
getSelected = { Preferences.clockTextSize },
|
||||
header = getString(R.string.settings_clock_text_size_title),
|
||||
onItemSelected = {value ->
|
||||
if (value != null) Preferences.clockTextSize = value
|
||||
}
|
||||
).show()
|
||||
}
|
||||
|
||||
binding.actionAltTimezoneClock.setOnClickListener {
|
||||
|
Loading…
x
Reference in New Issue
Block a user