Skip to content

Commit a6e8086

Browse files
committed
refactor: MapFragment 리팩토링
1 parent 721d41f commit a6e8086

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

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

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class MapFragment : Fragment(), MapHandler {
5353
initTMap()
5454
initBottomSheetBehavior()
5555
initBottomSheetView()
56-
listenButtonClick()
5756
}
5857

5958
override fun alertTMapReady() {
@@ -116,7 +115,6 @@ class MapFragment : Fragment(), MapHandler {
116115
)
117116
)
118117
}
119-
120118
}
121119

122120
private fun initNavigateAction() {
@@ -170,9 +168,12 @@ class MapFragment : Fragment(), MapHandler {
170168
private fun initBottomSheetView() {
171169
binding.homeBottomSheet.layoutStateExpanded.viewAlarm.setOnClickListener {
172170
val behavior = BottomSheetBehavior.from(binding.layoutHomeBottomSheet)
171+
val intent = Intent(requireContext(), SoundService::class.java)
173172

174-
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
175173
alarmViewModel.deleteAlarm()
174+
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
175+
requireContext().stopService(intent)
176+
SoundService.normalExit = true
176177
}
177178
}
178179

@@ -243,40 +244,25 @@ class MapFragment : Fragment(), MapHandler {
243244
}
244245
}
245246

246-
private fun listenButtonClick() {
247-
binding.homeBottomSheet.layoutStateExpanded.buttonAlarmTurnOff.setOnClickListener {
248-
val behavior = BottomSheetBehavior.from(binding.layoutHomeBottomSheet)
249-
250-
behavior.state = BottomSheetBehavior.STATE_COLLAPSED
251-
alarmViewModel.deleteAlarm()
252-
turnOffSoundService()
253-
}
254-
}
255-
256-
private fun turnOffSoundService() {
257-
val intent = Intent(requireContext(), SoundService::class.java)
258-
259-
requireContext().stopService(intent)
260-
SoundService.normalExit = true
261-
}
262-
263247
override fun onResume() {
264248
super.onResume()
265249

266250
requireActivity().intent.extras?.getInt("ALARM_MAP_CODE")?.let {
267251
if (it == ALARM_MAP_CODE) {
268-
showBottomSheet()
252+
openBottomSheet()
269253
}
270254
}
271255
}
272256

273-
private fun showBottomSheet() {
257+
private fun openBottomSheet() {
274258
val behavior = BottomSheetBehavior.from(binding.layoutHomeBottomSheet)
275259

276260
behavior.state = BottomSheetBehavior.STATE_EXPANDED
261+
/*
277262
binding.homeBottomSheet.layoutStateExpanded.root.visibility = View.VISIBLE
278263
binding.homeBottomSheet.textViewAlarmState.visibility = View.GONE
279264
binding.homeBottomSheet.homeBottomSheetDragHandle.visibility = View.GONE
265+
*/
280266
}
281267

282268
override fun onDestroyView() {

presentation/src/main/java/com/stop/ui/mission/MissionFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class MissionFragment : Fragment(), MissionHandler {
108108
fun clickMissionOver() {
109109
Snackbar.make(requireActivity().findViewById(R.id.constraint_layout_container), "미션을 취소했습니다", Snackbar.LENGTH_SHORT).show()
110110
missionViewModel.isMissionOver.value = true
111-
// findNavController().navigate(R.id.action_missionFragment_to_mapFragment)
111+
findNavController().navigate(R.id.action_missionFragment_to_mapFragment)
112112
}
113113

114114
override fun alertTMapReady() {

0 commit comments

Comments
 (0)