Skip to content

Commit 38ba0b8

Browse files
committed
feat : 알람 등록후 화면 이동 로직 추가
1 parent 06db43a commit 38ba0b8

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

presentation/src/main/java/com/stop/ui/alarmsetting/AlarmSettingFragment.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package com.stop.ui.alarmsetting
33
import android.os.Bundle
44
import android.transition.AutoTransition
55
import android.transition.TransitionManager
6-
import android.util.Log
76
import android.view.LayoutInflater
87
import android.view.View
98
import android.view.ViewGroup
109
import androidx.fragment.app.Fragment
1110
import androidx.fragment.app.viewModels
11+
import androidx.navigation.findNavController
1212
import com.stop.R
1313
import com.stop.databinding.FragmentAlarmSettingBinding
1414
import dagger.hilt.android.AndroidEntryPoint
@@ -38,16 +38,13 @@ class AlarmSettingFragment : Fragment() {
3838
initView()
3939
setButtonListener()
4040
setToggleListener()
41-
alarmSettingViewModel.getAlarm()
42-
alarmSettingViewModel.alarmUseCaseItem.observe(viewLifecycleOwner) {
43-
Log.e("ABC", it.toString())
44-
}
4541
}
4642

4743
private fun initBinding() {
4844
binding.apply {
4945
lifecycleOwner = viewLifecycleOwner
5046
viewModel = alarmSettingViewModel
47+
fragment = this@AlarmSettingFragment
5148
}
5249
}
5350

@@ -116,6 +113,11 @@ class AlarmSettingFragment : Fragment() {
116113
}
117114
}
118115

116+
fun setAlarmRegisterListener() {
117+
alarmSettingViewModel.saveAlarm()
118+
binding.root.findNavController().navigate(R.id.action_alarmSetting_to_mapFragment)
119+
}
120+
119121
override fun onDestroyView() {
120122
_binding = null
121123
super.onDestroyView()

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
name="viewModel"
1010
type="com.stop.ui.alarmsetting.AlarmSettingViewModel" />
1111

12+
<variable
13+
name="fragment"
14+
type="com.stop.ui.alarmsetting.AlarmSettingFragment" />
15+
1216
</data>
1317

1418
<androidx.constraintlayout.widget.ConstraintLayout
@@ -248,7 +252,7 @@
248252
android:layout_marginBottom="24dp"
249253
android:background="@drawable/background_gray_d9_8"
250254
android:gravity="center"
251-
android:onClick="@{() -> viewModel.saveAlarm()}"
255+
android:onClick="@{() -> fragment.setAlarmRegisterListener()}"
252256
android:paddingVertical="8dp"
253257
android:text="@string/register_alarm_text"
254258
android:textColor="@color/black"

presentation/src/main/res/navigation/nav_graph.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@
4646
android:id="@+id/alarmSetting"
4747
android:name="com.stop.ui.alarmsetting.AlarmSettingFragment"
4848
android:label="fragment_alarm_setting"
49-
tools:layout="@layout/fragment_alarm_setting" />
49+
tools:layout="@layout/fragment_alarm_setting" >
50+
<action
51+
android:id="@+id/action_alarmSetting_to_mapFragment"
52+
app:destination="@id/mapFragment" />
53+
</fragment>
5054
<fragment
5155
android:id="@+id/bookMarkFragment"
5256
android:name="com.stop.ui.bookmark.BookMarkFragment"

0 commit comments

Comments
 (0)