diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 93c484e6..4dfd2dfb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -10,7 +10,7 @@ android { defaultConfig { applicationId = "org.sopt.linkmind" - versionCode = 12 + versionCode = 13 versionName = "1.2.0" } viewBinding.enable = true diff --git a/feature/clip/src/main/java/org/sopt/clip/clipedit/ClipEditFragment.kt b/feature/clip/src/main/java/org/sopt/clip/clipedit/ClipEditFragment.kt index c56a2e1e..812f3d54 100644 --- a/feature/clip/src/main/java/org/sopt/clip/clipedit/ClipEditFragment.kt +++ b/feature/clip/src/main/java/org/sopt/clip/clipedit/ClipEditFragment.kt @@ -45,7 +45,7 @@ class ClipEditFragment : BindingFragment({ FragmentClip adapter = clipEditAdapter, recyclerView = binding.rvClipEdit, ) { categoryId, newIndex -> - if (categoryId != null) viewModel.updateCategoryEditPriorityState(categoryId, newIndex) + if (categoryId != null) viewModel.updateCategoryEditPriorityState(categoryId, newIndex - 1) } ItemTouchHelper(callback).attachToRecyclerView(binding.rvClipEdit) updateEditListView() @@ -58,9 +58,8 @@ class ClipEditFragment : BindingFragment({ FragmentClip viewModel.categoryState.flowWithLifecycle(viewLifeCycle).onEach { state -> when (state) { is UiState.Success -> { - val originalList = state.data ?: emptyList() - val newList = originalList.filter { it.categoryId?.toInt() != 0 } - clipEditAdapter.submitList(newList) + val clipList = state.data + clipEditAdapter.submitList(clipList) } else -> {} diff --git a/feature/clip/src/main/java/org/sopt/clip/clipedit/ItemTouchCallback.kt b/feature/clip/src/main/java/org/sopt/clip/clipedit/ItemTouchCallback.kt index b8958bac..6d1e80f5 100644 --- a/feature/clip/src/main/java/org/sopt/clip/clipedit/ItemTouchCallback.kt +++ b/feature/clip/src/main/java/org/sopt/clip/clipedit/ItemTouchCallback.kt @@ -13,8 +13,12 @@ class ItemTouchCallback( recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, ): Int { - val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN or ItemTouchHelper.START or ItemTouchHelper.END - return makeMovementFlags(dragFlags, 0) + return if (viewHolder.bindingAdapterPosition == 0) { + 0 + } else { + val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN or ItemTouchHelper.START or ItemTouchHelper.END + return makeMovementFlags(dragFlags, 0) + } } override fun onMove( @@ -24,6 +28,10 @@ class ItemTouchCallback( ): Boolean { val fromPosition = viewHolder.bindingAdapterPosition val toPosition = target.bindingAdapterPosition + + if (fromPosition == 0 || toPosition == 0) { + return false + } adapter.moveItem(fromPosition, toPosition) return true } diff --git a/feature/clip/src/main/res/layout/fragment_clip_edit.xml b/feature/clip/src/main/res/layout/fragment_clip_edit.xml index fedb1aba..fdfbe0f5 100644 --- a/feature/clip/src/main/res/layout/fragment_clip_edit.xml +++ b/feature/clip/src/main/res/layout/fragment_clip_edit.xml @@ -42,67 +42,25 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/iv_clip_edit_back" /> - - - - - - - - - - + - + app:layout_constraintBottom_toBottomOf="parent" /> diff --git a/feature/clip/src/main/res/layout/item_clip_edit_clip.xml b/feature/clip/src/main/res/layout/item_clip_edit_clip.xml index 5f4b5b4b..d5d8d09c 100644 --- a/feature/clip/src/main/res/layout/item_clip_edit_clip.xml +++ b/feature/clip/src/main/res/layout/item_clip_edit_clip.xml @@ -3,7 +3,9 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="12dp"> + android:layout_marginStart="10dp" + android:layout_marginBottom="12dp" + android:layout_marginEnd="20dp">