From b458af303396dd996fc224b1c362173c2515882b Mon Sep 17 00:00:00 2001 From: Nahyun Kim Date: Sat, 8 Feb 2025 12:15:39 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix:=20=EC=9D=BC=EC=A0=95=20?= =?UTF-8?q?=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EC=83=81?= =?UTF-8?q?=EB=8B=A8=20=ED=9C=B4=EC=A7=80=ED=86=B5=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=85=B8=EC=B6=9C=EC=97=AC=EB=B6=80=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 카테고리 설정 화면에서는 휴지통 버튼 숨기기 - 일정 화면에서는 생성/편집 모드에 따라 노출 여부 결정하기 Related to: #346 --- .../home/schedule/PersonalScheduleViewModel.kt | 8 ++++++++ .../ui/home/schedule/ScheduleActivity.kt | 8 ++------ .../home/schedule/ScheduleDialogBasicFragment.kt | 1 + .../schedule/ScheduleDialogCategoryFragment.kt | 1 + app/src/main/res/layout/activity_schedule.xml | 16 ++++++++++++---- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/PersonalScheduleViewModel.kt b/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/PersonalScheduleViewModel.kt index 8eba26d0..552245cf 100644 --- a/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/PersonalScheduleViewModel.kt +++ b/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/PersonalScheduleViewModel.kt @@ -63,6 +63,10 @@ class PersonalScheduleViewModel @Inject constructor( private val _isDailyScheduleEmptyPair = MutableLiveData>() var isDailyScheduleEmptyPair: LiveData> = _isDailyScheduleEmptyPair + // 다이얼로그 상단 휴지통 버튼 노출 여부 + private val _isShowTopDeleteBtn = MutableLiveData() + var isShowTopDeleteBtn: LiveData = _isShowTopDeleteBtn + init { getCategories() // 최초 카테고리 목록 조회 } @@ -301,6 +305,10 @@ class PersonalScheduleViewModel @Inject constructor( return null } + fun setDeleteBtnVisibility(isVisible: Boolean) { + _isShowTopDeleteBtn.value = isVisible + } + fun isInvalidDate(): Boolean { // 시작일 > 종료일 return schedule.value!!.period.startDate > schedule.value!!.period.endDate diff --git a/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/ScheduleActivity.kt b/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/ScheduleActivity.kt index 03cd57c9..3b560669 100644 --- a/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/ScheduleActivity.kt +++ b/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/ScheduleActivity.kt @@ -30,15 +30,13 @@ import org.joda.time.LocalDateTime @AndroidEntryPoint class ScheduleActivity : BaseActivity(R.layout.activity_schedule), ConfirmDialogInterface { - private val navController: NavController by lazy { - val navHostFragment = supportFragmentManager.findFragmentById(R.id.schedule_nav_host) as NavHostFragment - navHostFragment.navController - } private val viewModel : PersonalScheduleViewModel by viewModels() override fun setup() { var schedule : Schedule? = null + binding.viewModel = this@ScheduleActivity.viewModel + // intent가 넘어왔는지 확인 intent.getStringExtra("schedule")?.let { scheduleJson -> // GsonBuilder에 커스텀 TypeAdapter 등록 @@ -52,10 +50,8 @@ class ScheduleActivity : BaseActivity(R.layout.activity val nowDay = intent.getLongExtra("nowDay", 0) if (schedule != null) { // 생성 모드 - binding.scheduleDeleteBtn.visibility = View.VISIBLE viewModel.setSchedule(schedule) } else { // 편집 모드 - binding.scheduleDeleteBtn.visibility = View.GONE viewModel.setSchedule( Schedule( period = SchedulePeriod( diff --git a/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/ScheduleDialogBasicFragment.kt b/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/ScheduleDialogBasicFragment.kt index 215a4366..526d0d17 100644 --- a/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/ScheduleDialogBasicFragment.kt +++ b/app/src/main/java/com/mongmong/namo/presentation/ui/home/schedule/ScheduleDialogBasicFragment.kt @@ -68,6 +68,7 @@ class ScheduleDialogBasicFragment : BaseFragment + + + + + + app:cardUseCompatPadding="true" + app:layout_constraintBottom_toTopOf="@id/schedule_container_layout" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent">