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