@@ -146,11 +146,8 @@ class MapFragment : Fragment(), MapHandler {
146
146
}
147
147
148
148
private fun initBottomSheetBehavior () {
149
- val displaySize = requireContext().getScreenSize()
150
- val displayHeight = displaySize.height
151
-
152
149
binding.layoutHomeBottomSheet.maxHeight = (630 * resources.displayMetrics.density).toInt()
153
- binding.homeBottomSheet.layoutStateExpanded.root.visibility = View . INVISIBLE
150
+ binding.homeBottomSheet.layoutStateExpanded.layoutBottomSheetHomeStateExpanded.alpha = 0F
154
151
155
152
val behavior = BottomSheetBehavior .from(binding.layoutHomeBottomSheet)
156
153
@@ -159,24 +156,12 @@ class MapFragment : Fragment(), MapHandler {
159
156
}
160
157
161
158
behavior.addBottomSheetCallback(object : BottomSheetBehavior .BottomSheetCallback () {
162
- override fun onStateChanged (bottomSheet : View , newState : Int ) {
163
- when (newState) {
164
- BottomSheetBehavior .STATE_EXPANDED -> {
165
- binding.homeBottomSheet.layoutStateExpanded.root.visibility = View .VISIBLE
166
- binding.homeBottomSheet.textViewAlarmState.visibility = View .INVISIBLE
167
- }
168
- BottomSheetBehavior .STATE_COLLAPSED -> {
169
- binding.homeBottomSheet.layoutStateExpanded.root.visibility = View .INVISIBLE
170
- binding.homeBottomSheet.textViewAlarmState.visibility = View .VISIBLE
171
- }
172
- BottomSheetBehavior .STATE_HALF_EXPANDED -> Unit
173
- BottomSheetBehavior .STATE_DRAGGING -> Unit
174
- BottomSheetBehavior .STATE_SETTLING -> Unit
175
- BottomSheetBehavior .STATE_HIDDEN -> Unit
176
- }
177
- }
159
+ override fun onStateChanged (bottomSheet : View , newState : Int ) = Unit
178
160
179
- override fun onSlide (bottomSheet : View , slideOffset : Float ) = Unit
161
+ override fun onSlide (bottomSheet : View , slideOffset : Float ) {
162
+ binding.homeBottomSheet.layoutStateExpanded.layoutBottomSheetHomeStateExpanded.alpha = slideOffset
163
+ binding.homeBottomSheet.textViewAlarmState.alpha = 1 - slideOffset
164
+ }
180
165
})
181
166
}
182
167
0 commit comments