From 66b2eb595e8920ce0e82b67ed368e5915c172efe Mon Sep 17 00:00:00 2001 From: Ham BeomJoon <37996727+HamBeomJoon@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:26:18 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20=EB=92=A4=EB=A1=9C?= =?UTF-8?q?=EA=B0=80=EA=B8=B0=20=EC=88=98=EC=A0=95=20(#104)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [fix] 뒤로가기 수정 * [fix] 날짜선택 -> home 화면 뒤로가기 수정 * [fix] 일기 보기 - 날짜선택 페이지 주말 색 변경 --- .../nabi/views/diary/add/AddDiaryFragment.kt | 12 +- .../views/diary/add/EmotionLoadingDialog.kt | 2 +- .../views/diary/detail/DetailDiaryFragment.kt | 6 +- .../views/diary/view/SelectDiaryFragment.kt | 10 +- .../diary/view/SelectDiaryMonthFragment.kt | 2 +- .../main/res/layout/fragment_select_diary.xml | 206 +++++++++--------- 6 files changed, 131 insertions(+), 107 deletions(-) diff --git a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/add/AddDiaryFragment.kt b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/add/AddDiaryFragment.kt index efacafa..95749c8 100644 --- a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/add/AddDiaryFragment.kt +++ b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/add/AddDiaryFragment.kt @@ -117,6 +117,8 @@ class AddDiaryFragment( } } else { requireActivity().supportFragmentManager.popBackStack() +// if (isEdit){ requireActivity().supportFragmentManager.popBackStack() } +// else {(requireActivity() as MainActivity).replaceFragment(AddDiarySelectDateFragment(), false) } } } @@ -185,9 +187,13 @@ class AddDiaryFragment( is UiState.Success -> { currentDiaryId = it.data.diaryId LoggerUtils.d("일기 수정 성공") - (requireActivity() as MainActivity).replaceFragment( - EmotionLoadingDialog(isEdit, currentDiaryId!!), - false +// (requireActivity() as MainActivity).replaceFragment( +// EmotionLoadingDialog(isEdit, currentDiaryId!!), +// false +// ) + + EmotionLoadingDialog(isEdit, currentDiaryId!!).show( + requireActivity().supportFragmentManager, "emotion loading" ) } } diff --git a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/add/EmotionLoadingDialog.kt b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/add/EmotionLoadingDialog.kt index ccb14c5..6140db2 100644 --- a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/add/EmotionLoadingDialog.kt +++ b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/add/EmotionLoadingDialog.kt @@ -76,8 +76,8 @@ class EmotionLoadingDialog(private val isEdit: Boolean, private val diaryId: Int DetailDiaryFragment(diaryId, "EmotionLoadingDialog"), false ) - dismiss() } + dismiss() } } } diff --git a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/detail/DetailDiaryFragment.kt b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/detail/DetailDiaryFragment.kt index d4268e5..8f3527c 100644 --- a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/detail/DetailDiaryFragment.kt +++ b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/detail/DetailDiaryFragment.kt @@ -161,6 +161,7 @@ class DetailDiaryFragment( private fun popBackStack() { val bundle = Bundle() + LoggerUtils.d(entryPoint.toString()) when (entryPoint) { "SelectDiaryMonthFragment" -> { @@ -171,7 +172,10 @@ class DetailDiaryFragment( (requireActivity() as MainActivity).replaceFragment(SelectDiaryFragment().apply { arguments = bundle }, false) } "EmotionLoadingDialog" -> { - (requireActivity() as MainActivity).replaceFragment(SelectDiaryFragment(), false) + bundle.apply { + putString("date", binding.tvDiaryDate.text.toString()) + } + (requireActivity() as MainActivity).replaceFragment(SelectDiaryFragment().apply { arguments = bundle }, false) } "SearchDiaryFragment" -> { (requireActivity() as MainActivity).replaceFragment(SearchDiaryFragment(), false) diff --git a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/view/SelectDiaryFragment.kt b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/view/SelectDiaryFragment.kt index 04cfd1e..edaa87d 100644 --- a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/view/SelectDiaryFragment.kt +++ b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/view/SelectDiaryFragment.kt @@ -3,15 +3,19 @@ package com.nabi.nabi.views.diary.view import android.app.AlertDialog import android.view.LayoutInflater import androidx.core.content.res.ResourcesCompat +import androidx.fragment.app.activityViewModels import androidx.viewpager2.widget.ViewPager2 import com.nabi.nabi.R import com.nabi.nabi.base.BaseFragment import com.nabi.nabi.databinding.DialogNonDayDatePickerBinding import com.nabi.nabi.databinding.FragmentSelectDiaryBinding import com.nabi.nabi.extension.dialogResize +import com.nabi.nabi.utils.LoggerUtils import com.nabi.nabi.views.MainActivity +import com.nabi.nabi.views.diary.add.SharedDateViewModel import com.nabi.nabi.views.diary.search.SearchDiaryFragment import com.nabi.nabi.views.diary.statistics.DiaryStatisticsFragment +import com.nabi.nabi.views.home.HomeFragment import com.skydoves.balloon.ArrowPositionRules import com.skydoves.balloon.Balloon import com.skydoves.balloon.BalloonAnimation @@ -27,6 +31,8 @@ import java.util.Locale @AndroidEntryPoint class SelectDiaryFragment : BaseFragment(R.layout.fragment_select_diary) { + private val sharedViewModel: SharedDateViewModel by activityViewModels() + private lateinit var calendarAdapter: SelectDiaryMonthCalendarStateAdapter private val minYear = 1950 @@ -114,7 +120,9 @@ class SelectDiaryFragment : } binding.ibBack.setOnClickListener { - requireActivity().supportFragmentManager.popBackStack() + sharedViewModel.clearData() +// requireActivity().supportFragmentManager.popBackStack() + (requireActivity() as MainActivity).replaceFragment(HomeFragment(),false) } binding.ibPreviousMonth.setOnClickListener { diff --git a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/view/SelectDiaryMonthFragment.kt b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/view/SelectDiaryMonthFragment.kt index f4abae1..f949028 100644 --- a/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/view/SelectDiaryMonthFragment.kt +++ b/Nabi/presentation/src/main/java/com/nabi/nabi/views/diary/view/SelectDiaryMonthFragment.kt @@ -44,7 +44,7 @@ class SelectDiaryMonthFragment: BaseFragment(R. setRvItemClickListener(object : OnRvItemClickListener { override fun onClick(item: Int) { viewModel.isUpdateFlag = true - (requireActivity() as MainActivity).replaceFragment(DetailDiaryFragment(item, "SelectDiaryMonthFragment"), true) + (requireActivity() as MainActivity).replaceFragment(DetailDiaryFragment(item, "SelectDiaryMonthFragment"), false) } }) } diff --git a/Nabi/presentation/src/main/res/layout/fragment_select_diary.xml b/Nabi/presentation/src/main/res/layout/fragment_select_diary.xml index 969ba4e..bc15aca 100644 --- a/Nabi/presentation/src/main/res/layout/fragment_select_diary.xml +++ b/Nabi/presentation/src/main/res/layout/fragment_select_diary.xml @@ -1,7 +1,7 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> @@ -21,143 +21,149 @@ android:id="@+id/tb_select_diary" android:layout_width="match_parent" android:layout_height="wrap_content" - app:layout_constraintTop_toTopOf="parent" - android:contentInsetStart="0dp"> + android:contentInsetStart="0dp" + app:layout_constraintTop_toTopOf="parent"> + android:src="@drawable/ic_arrow" /> + android:textColor="@color/black" /> + android:contentDescription="@null" + android:src="@drawable/ic_search" /> + app:layout_constraintEnd_toStartOf="@id/tv_current_month" + app:layout_constraintHorizontal_chainStyle="packed" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@id/tv_current_month" /> + app:layout_constraintTop_toBottomOf="@id/tb_select_diary" + tools:text="July 2024" /> + app:layout_constraintStart_toEndOf="@id/tv_current_month" + app:layout_constraintTop_toTopOf="@id/tv_current_month" /> + android:gravity="center" + android:orientation="horizontal" + app:layout_constraintBottom_toTopOf="@id/vp_calendar_month" + app:layout_constraintTop_toBottomOf="@id/tv_current_month"> + android:textColor="@color/red" /> + + android:textColor="@color/gray2" /> + + android:textColor="@color/gray2" /> + + android:textColor="@color/gray2" /> + + android:textColor="@color/gray2" /> + + android:textColor="@color/gray2" /> + + android:textColor="@color/skyblue" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/vp_calendar_month" /> + app:layout_constraintEnd_toStartOf="@id/iv_emotion_happiness" + app:layout_constraintHorizontal_chainStyle="spread_inside" + + app:layout_constraintStart_toStartOf="@id/divider" + app:layout_constraintTop_toBottomOf="@id/divider" /> + app:layout_constraintStart_toEndOf="@id/iv_emotion_anger" + app:layout_constraintTop_toTopOf="@id/iv_emotion_anger" /> + app:layout_constraintStart_toEndOf="@id/iv_emotion_happiness" + app:layout_constraintTop_toTopOf="@id/iv_emotion_anger" /> + app:layout_constraintStart_toEndOf="@id/iv_emotion_boredom" + app:layout_constraintTop_toTopOf="@id/iv_emotion_anger" /> + app:layout_constraintStart_toEndOf="@id/iv_emotion_sadness" + app:layout_constraintTop_toTopOf="@id/iv_emotion_anger" /> + android:contentDescription="@null" + android:src="@drawable/illus_statistics_cat" + app:layout_constraintDimensionRatio="1:0.59375" + + app:layout_constraintTop_toBottomOf="@id/iv_emotion_anger" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/iv_illus_statistics_cat" />