From 4050fafa0a0af2d7a6414c90783263c9220f7c1f Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Thu, 18 Jan 2024 00:45:36 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[ADD/#155]=20MyTodo=20Empty=EB=B7=B0=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=EB=86=92=EC=9D=B4=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/todo/mytodo/MyTodoFragment.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/presentation/src/main/java/com/going/presentation/todo/mytodo/MyTodoFragment.kt b/presentation/src/main/java/com/going/presentation/todo/mytodo/MyTodoFragment.kt index 6385d65f..87647b73 100644 --- a/presentation/src/main/java/com/going/presentation/todo/mytodo/MyTodoFragment.kt +++ b/presentation/src/main/java/com/going/presentation/todo/mytodo/MyTodoFragment.kt @@ -8,6 +8,7 @@ import android.text.SpannableStringBuilder import android.text.Spanned import android.text.style.ForegroundColorSpan import android.view.View +import android.view.ViewTreeObserver import androidx.core.content.ContextCompat import androidx.fragment.app.activityViewModels import androidx.lifecycle.flowWithLifecycle @@ -57,6 +58,7 @@ class MyTodoFragment() : BaseFragment(R.layout.fragment_m setViewPagerDebounce() setTodoCountText() setToolbarColor() + initEmptyViewHeight() setEmptyViewHeight() observeMyTripInfoState() observeTotalUncompletedTodoCount() @@ -171,6 +173,21 @@ class MyTodoFragment() : BaseFragment(R.layout.fragment_m } } + private fun initEmptyViewHeight() { + binding.appbarMyTodo.viewTreeObserver.addOnGlobalLayoutListener(object : + ViewTreeObserver.OnGlobalLayoutListener { + override fun onGlobalLayout() { + binding.appbarMyTodo.viewTreeObserver.removeOnGlobalLayoutListener(this) + val displayHeight = activity?.getWindowHeight() ?: return + val toolbarHeight = binding.toolbarMyTodo.height + val appBarHeight = binding.appbarMyTodo.totalScrollRange + binding.vpMyTodo.layoutParams = (binding.vpMyTodo.layoutParams).also { + it.height = displayHeight - toolbarHeight - appBarHeight - 300 + } + } + }) + } + private fun setEmptyViewHeight() { binding.appbarMyTodo.addOnOffsetChangedListener { appBarLayout, verticalOffset -> val displayHeight = activity?.getWindowHeight() ?: return@addOnOffsetChangedListener From c27152db7b12e006705c644f0108e48bfa7addf0 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Thu, 18 Jan 2024 00:52:27 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[FIX/#155]=20OurTodo=20=EC=97=AC=ED=96=89?= =?UTF-8?q?=EB=A9=A4=EB=B2=84=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../todo/ourtodo/OurTodoFriendAdapter.kt | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFriendAdapter.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFriendAdapter.kt index 67a7aee3..b97e9605 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFriendAdapter.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFriendAdapter.kt @@ -2,12 +2,13 @@ package com.going.presentation.todo.ourtodo import android.view.LayoutInflater import android.view.ViewGroup -import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView import com.going.domain.entity.response.TripParticipantModel import com.going.presentation.databinding.ItemTodoFriendsBinding -import com.going.ui.extension.ItemDiffCallback -class OurTodoFriendAdapter : ListAdapter(diffUtil) { +class OurTodoFriendAdapter : RecyclerView.Adapter() { + + private var itemList = mutableListOf() override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): OurTodoFriendViewHolder { val binding: ItemTodoFriendsBinding = @@ -16,13 +17,14 @@ class OurTodoFriendAdapter : ListAdapter( - onItemsTheSame = { old, new -> old.participantId == new.participantId }, - onContentsTheSame = { old, new -> old == new }, - ) + override fun getItemCount(): Int = itemList.size + + fun submitList(newItems: List) { + this.itemList.clear() + this.itemList.addAll(newItems) + notifyDataSetChanged() } } \ No newline at end of file From 72927e96304a9b6eb6b4c2946e105e0193019db4 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Thu, 18 Jan 2024 02:56:58 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[FiX/#155]=20Empty=20=EB=B7=B0=20TodoFragme?= =?UTF-8?q?nt=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../todo/mytodo/MyTodoFragment.kt | 9 ++++- .../mytodo/todolist/MyTodoCompleteFragment.kt | 2 +- .../todolist/MyTodoUncompleteFragment.kt | 2 +- .../src/main/res/layout/fragment_my_todo.xml | 33 +++++++++++++++++ .../res/layout/fragment_my_todo_complete.xml | 37 ------------------- .../layout/fragment_my_todo_uncomplete.xml | 36 ------------------ 6 files changed, 42 insertions(+), 77 deletions(-) diff --git a/presentation/src/main/java/com/going/presentation/todo/mytodo/MyTodoFragment.kt b/presentation/src/main/java/com/going/presentation/todo/mytodo/MyTodoFragment.kt index 87647b73..6764274e 100644 --- a/presentation/src/main/java/com/going/presentation/todo/mytodo/MyTodoFragment.kt +++ b/presentation/src/main/java/com/going/presentation/todo/mytodo/MyTodoFragment.kt @@ -10,6 +10,7 @@ import android.text.style.ForegroundColorSpan import android.view.View import android.view.ViewTreeObserver import androidx.core.content.ContextCompat +import androidx.core.view.isVisible import androidx.fragment.app.activityViewModels import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope @@ -181,7 +182,7 @@ class MyTodoFragment() : BaseFragment(R.layout.fragment_m val displayHeight = activity?.getWindowHeight() ?: return val toolbarHeight = binding.toolbarMyTodo.height val appBarHeight = binding.appbarMyTodo.totalScrollRange - binding.vpMyTodo.layoutParams = (binding.vpMyTodo.layoutParams).also { + binding.layoutMyTodoEmpty.layoutParams = (binding.layoutMyTodoEmpty.layoutParams).also { it.height = displayHeight - toolbarHeight - appBarHeight - 300 } } @@ -193,12 +194,16 @@ class MyTodoFragment() : BaseFragment(R.layout.fragment_m val displayHeight = activity?.getWindowHeight() ?: return@addOnOffsetChangedListener val toolbarHeight = binding.toolbarMyTodo.height val appBarHeight = appBarLayout.totalScrollRange + verticalOffset - binding.vpMyTodo.layoutParams = (binding.vpMyTodo.layoutParams).also { + binding.layoutMyTodoEmpty.layoutParams = (binding.layoutMyTodoEmpty.layoutParams).also { it.height = displayHeight - toolbarHeight - appBarHeight - 300 } } } + fun showEmptyView(show: Boolean) { + binding.layoutMyTodoEmpty.isVisible = show + } + private fun observeMyTripInfoState() { viewModel.myTripInfoState.flowWithLifecycle(lifecycle).onEach { state -> when (state) { diff --git a/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoCompleteFragment.kt b/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoCompleteFragment.kt index 3ade99f8..c696d2ea 100644 --- a/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoCompleteFragment.kt +++ b/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoCompleteFragment.kt @@ -104,7 +104,7 @@ class MyTodoCompleteFragment() : private fun setLayoutEmpty(isEmpty: Boolean) { binding.rvMyTodoComplete.isVisible = !isEmpty - binding.layoutMyTodoCompleteEmpty.isVisible = isEmpty + (requireParentFragment() as MyTodoFragment).showEmptyView(isEmpty) } private fun observeTodoRedoState() { diff --git a/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoUncompleteFragment.kt b/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoUncompleteFragment.kt index ea328ae4..b4251ced 100644 --- a/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoUncompleteFragment.kt +++ b/presentation/src/main/java/com/going/presentation/todo/mytodo/todolist/MyTodoUncompleteFragment.kt @@ -104,7 +104,7 @@ class MyTodoUncompleteFragment() : private fun setLayoutEmpty(isEmpty: Boolean) { binding.rvMyTodoUncomplete.isVisible = !isEmpty - binding.layoutMyTodoUncompleteEmpty.isVisible = isEmpty + (requireParentFragment() as MyTodoFragment).showEmptyView(isEmpty) } private fun observeTodoFinishState() { diff --git a/presentation/src/main/res/layout/fragment_my_todo.xml b/presentation/src/main/res/layout/fragment_my_todo.xml index a7a383c0..dfd1379a 100644 --- a/presentation/src/main/res/layout/fragment_my_todo.xml +++ b/presentation/src/main/res/layout/fragment_my_todo.xml @@ -143,6 +143,39 @@ android:layout_height="wrap_content" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + + + + + + + + - - - - - - - - \ No newline at end of file diff --git a/presentation/src/main/res/layout/fragment_my_todo_uncomplete.xml b/presentation/src/main/res/layout/fragment_my_todo_uncomplete.xml index c6bc5967..d5c655c1 100644 --- a/presentation/src/main/res/layout/fragment_my_todo_uncomplete.xml +++ b/presentation/src/main/res/layout/fragment_my_todo_uncomplete.xml @@ -18,7 +18,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginHorizontal="23dp" - android:nestedScrollingEnabled="true" android:orientation="vertical" android:overScrollMode="never" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" @@ -27,41 +26,6 @@ app:layout_constraintTop_toTopOf="parent" tools:listitem="@layout/item_my_todo" /> - - - - - - - - \ No newline at end of file From 899300b33a616945dbc630d69802c3b477aa2f79 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Thu, 18 Jan 2024 03:06:27 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[FEAT/#155]=20MyTodo=20Empty=20=EC=83=81?= =?UTF-8?q?=EB=8B=A8=EC=97=90=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- presentation/src/main/res/layout/fragment_my_todo.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/presentation/src/main/res/layout/fragment_my_todo.xml b/presentation/src/main/res/layout/fragment_my_todo.xml index dfd1379a..47d3a292 100644 --- a/presentation/src/main/res/layout/fragment_my_todo.xml +++ b/presentation/src/main/res/layout/fragment_my_todo.xml @@ -145,10 +145,10 @@ + android:layout_height="wrap_content" + android:visibility="gone" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> Date: Thu, 18 Jan 2024 03:17:05 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[FEAT/#155]=20OurTodo=20Empty=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20parent=EC=97=90=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../todo/ourtodo/OurTodoFragment.kt | 7 +++- .../todolist/OurTodoCompleteFragment.kt | 3 +- .../todolist/OurTodoUncompleteFragment.kt | 2 +- .../src/main/res/layout/fragment_our_todo.xml | 33 +++++++++++++++++ .../res/layout/fragment_our_todo_complete.xml | 36 ------------------- .../layout/fragment_our_todo_uncomplete.xml | 36 ------------------- 6 files changed, 42 insertions(+), 75 deletions(-) diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFragment.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFragment.kt index e069b36d..e82edf0c 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFragment.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/OurTodoFragment.kt @@ -9,6 +9,7 @@ import android.text.Spanned import android.text.style.ForegroundColorSpan import android.view.View import androidx.core.content.ContextCompat +import androidx.core.view.isVisible import androidx.fragment.app.activityViewModels import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope @@ -213,12 +214,16 @@ class OurTodoFragment() : BaseFragment(R.layout.fragment val displayHeight = activity?.getWindowHeight() ?: return@addOnOffsetChangedListener val toolbarHeight = binding.toolbarOurTodo.height val appBarHeight = appBarLayout.totalScrollRange + verticalOffset - binding.vpOurTodo.layoutParams = (binding.vpOurTodo.layoutParams).also { + binding.layoutOurTodoEmpty.layoutParams = (binding.layoutOurTodoEmpty.layoutParams).also { it.height = displayHeight - toolbarHeight - appBarHeight - 300 } } } + fun showEmptyView(show: Boolean) { + binding.layoutOurTodoEmpty.isVisible = show + } + private fun observeOurTripInfoState() { viewModel.ourTripInfoState.flowWithLifecycle(lifecycle).onEach { state -> when (state) { diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoCompleteFragment.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoCompleteFragment.kt index abd4dab1..e62e3371 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoCompleteFragment.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoCompleteFragment.kt @@ -15,6 +15,7 @@ import com.going.presentation.todo.ourtodo.OurTodoViewModel.Companion.COMPLETE import com.going.presentation.todo.ourtodo.OurTodoViewModel.Companion.OUR_TODO import com.going.presentation.todo.detail.PublicDetailActivity import com.going.presentation.todo.detail.PublicDetailActivity.Companion.EXTRA_TODO_ID +import com.going.presentation.todo.mytodo.MyTodoFragment import com.going.presentation.todo.ourtodo.OurTodoFragment import com.going.ui.base.BaseFragment import com.going.ui.extension.UiState @@ -90,7 +91,7 @@ class OurTodoCompleteFragment() : private fun setLayoutEmpty(isEmpty: Boolean) { binding.rvOurTodoComplete.isVisible = !isEmpty - binding.layoutOurTodoCompleteEmpty.isVisible = isEmpty + (requireParentFragment() as OurTodoFragment).showEmptyView(isEmpty) } override fun onDestroyView() { diff --git a/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoUncompleteFragment.kt b/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoUncompleteFragment.kt index fbe310f3..b2d58ab0 100644 --- a/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoUncompleteFragment.kt +++ b/presentation/src/main/java/com/going/presentation/todo/ourtodo/todolist/OurTodoUncompleteFragment.kt @@ -90,7 +90,7 @@ class OurTodoUncompleteFragment() : private fun setLayoutEmpty(isEmpty: Boolean) { binding.rvOurTodoUncomplete.isVisible = !isEmpty - binding.layoutOurTodoUncompleteEmpty.isVisible = isEmpty + (requireParentFragment() as OurTodoFragment).showEmptyView(isEmpty) } override fun onDestroyView() { diff --git a/presentation/src/main/res/layout/fragment_our_todo.xml b/presentation/src/main/res/layout/fragment_our_todo.xml index b654f977..ed3828a3 100644 --- a/presentation/src/main/res/layout/fragment_our_todo.xml +++ b/presentation/src/main/res/layout/fragment_our_todo.xml @@ -332,6 +332,39 @@ android:layout_height="wrap_content" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + + + + + + + + - - - - - - - - \ No newline at end of file diff --git a/presentation/src/main/res/layout/fragment_our_todo_uncomplete.xml b/presentation/src/main/res/layout/fragment_our_todo_uncomplete.xml index b05bd602..ab11c35b 100644 --- a/presentation/src/main/res/layout/fragment_our_todo_uncomplete.xml +++ b/presentation/src/main/res/layout/fragment_our_todo_uncomplete.xml @@ -27,42 +27,6 @@ app:layout_constraintTop_toTopOf="parent" tools:listitem="@layout/item_our_todo" /> - - - - - - - - \ No newline at end of file From 1309ee840fd42aa71b21d049f3261c65b8d44efa Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Thu, 18 Jan 2024 03:22:17 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[CHORE/#155]=20version=20code=207=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/kotlin/Constants.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Constants.kt b/buildSrc/src/main/kotlin/Constants.kt index c6955d43..d07d9e2f 100644 --- a/buildSrc/src/main/kotlin/Constants.kt +++ b/buildSrc/src/main/kotlin/Constants.kt @@ -3,6 +3,6 @@ object Constants { const val compileSdk = 34 const val minSdk = 28 const val targetSdk = 34 - const val versionCode = 6 + const val versionCode = 7 const val versionName = "1.0" }