Skip to content

Commit 8638d01

Browse files
committed
feat: homeBottomSheet 투명도 애니메이션 적용
1 parent 2742561 commit 8638d01

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

presentation/src/main/java/com/stop/ui/map/MapFragment.kt

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,8 @@ class MapFragment : Fragment(), MapHandler {
146146
}
147147

148148
private fun initBottomSheetBehavior() {
149-
val displaySize = requireContext().getScreenSize()
150-
val displayHeight = displaySize.height
151-
152149
binding.layoutHomeBottomSheet.maxHeight = (630 * resources.displayMetrics.density).toInt()
153-
binding.homeBottomSheet.layoutStateExpanded.root.visibility = View.INVISIBLE
150+
binding.homeBottomSheet.layoutStateExpanded.layoutBottomSheetHomeStateExpanded.alpha = 0F
154151

155152
val behavior = BottomSheetBehavior.from(binding.layoutHomeBottomSheet)
156153

@@ -159,24 +156,12 @@ class MapFragment : Fragment(), MapHandler {
159156
}
160157

161158
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
178160

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+
}
180165
})
181166
}
182167

presentation/src/main/res/layout/bottom_sheet_home_state_expanded.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
</data>
1717

1818
<androidx.constraintlayout.widget.ConstraintLayout
19+
android:id="@+id/layout_bottom_sheet_home_state_expanded"
1920
android:layout_width="match_parent"
2021
android:layout_height="wrap_content"
2122
tools:context=".ui.alarmstart.AlarmStartFragment"

presentation/src/main/res/layout/home_bottom_sheet.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
android:textSize="15sp"
4242
app:layout_constraintEnd_toEndOf="parent"
4343
app:layout_constraintStart_toStartOf="parent"
44-
android:visibility="visible"
4544
app:layout_constraintTop_toBottomOf="@id/home_bottom_sheet_drag_handle"
4645
tools:text="현재 등록된 막차 알림이 없습니다." />
4746

@@ -50,7 +49,6 @@
5049
layout="@layout/bottom_sheet_home_state_expanded"
5150
android:layout_width="match_parent"
5251
android:layout_height="0dp"
53-
android:visibility="visible"
5452
android:layout_marginTop="25dp"
5553
app:layout_constraintTop_toBottomOf="@id/home_bottom_sheet_drag_handle"
5654
app:layout_constraintBottom_toBottomOf="parent"

0 commit comments

Comments
 (0)