-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[feat] #182 link category change
- Loading branch information
Showing
29 changed files
with
659 additions
and
116 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
core/designsystem/src/main/java/designsystem/components/bottomsheet/BottomSheetType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package designsystem.components.bottomsheet | ||
|
||
enum class BottomSheetType { | ||
LINK, | ||
CLIP, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rc/main/java/org/sopt/timer/model/Clip.kt → ...rc/main/java/org/sopt/model/timer/Clip.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package org.sopt.timer.model | ||
package org.sopt.model.timer | ||
|
||
import org.sopt.model.category.Category | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
data-remote/link/src/main/java/org/sopt/remote/link/request/RequestPatchCategoryDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.sopt.remote.link.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class RequestPatchCategoryDto( | ||
@SerialName("toastId") | ||
val toastId: Long, | ||
@SerialName("categoryId") | ||
val categoryId: Long, | ||
) |
10 changes: 10 additions & 0 deletions
10
data-remote/link/src/main/java/org/sopt/remote/link/response/ResponsePatchCategoryDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.sopt.remote.link.response | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ResponsePatchCategoryDto( | ||
@SerialName("categoryId") | ||
val categoryId: Long, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
domain/link/src/main/java/org/sopt/domain/link/usecase/PatchLinkCategoryUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.sopt.domain.link.usecase | ||
|
||
import org.sopt.domain.link.repository.LinkRepository | ||
import javax.inject.Inject | ||
|
||
class PatchLinkCategoryUseCase @Inject constructor( | ||
private val linkRepository: LinkRepository, | ||
) { | ||
suspend operator fun invoke(param: Param): Result<Long> = linkRepository.patchToastCategory( | ||
toastId = param.toastId, | ||
categoryId = param.categoryId, | ||
) | ||
|
||
data class Param( | ||
val toastId: Long, | ||
val categoryId: Long, | ||
) | ||
} |
48 changes: 38 additions & 10 deletions
48
feature/clip/src/main/java/org/sopt/clip/DeleteLinkBottomSheetFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
feature/clip/src/main/java/org/sopt/clip/clipchange/ClipChangeAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.sopt.clip.clipchange | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.core.content.ContextCompat | ||
import androidx.recyclerview.widget.ListAdapter | ||
import org.sopt.clip.databinding.ItemClipChangeBinding | ||
import org.sopt.model.timer.Clip | ||
import org.sopt.ui.view.ItemDiffCallback | ||
|
||
class ClipChangeAdapter( | ||
private val onClick: (Clip, Int) -> Unit, | ||
private val context: Context, | ||
) : ListAdapter<Clip, ClipChangeViewHolder>(DiffUtil) { | ||
var selectedPosition = -1 | ||
override fun onBindViewHolder(holder: ClipChangeViewHolder, position: Int) { | ||
holder.onBind(getItem(position), position) { clip, position -> | ||
selectItemByPosition(position, clip) | ||
onClick(clip, position) | ||
} | ||
|
||
if (position == 0) { | ||
val disMissClickColor = ContextCompat.getColor(context, org.sopt.mainfeature.R.color.neutrals400) | ||
holder.binding.ivItemClipChange.setColorFilter(disMissClickColor) | ||
holder.binding.tvItemClipChangeName.setTextColor(disMissClickColor) | ||
holder.binding.tvItemClipChangeCount.setTextColor(disMissClickColor) | ||
holder.binding.root.isEnabled = false | ||
} | ||
} | ||
|
||
private fun selectItemByPosition(position: Int, clip: Clip) { | ||
if (selectedPosition != position) { | ||
if (selectedPosition != -1) { | ||
getItem(selectedPosition).isSelected = false | ||
notifyItemChanged(selectedPosition) | ||
} | ||
clip.isSelected = true | ||
selectedPosition = position | ||
} else { | ||
clip.isSelected = !clip.isSelected | ||
if (!clip.isSelected) { | ||
selectedPosition = -1 | ||
} | ||
} | ||
notifyItemChanged(position) | ||
} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ClipChangeViewHolder { | ||
return ClipChangeViewHolder( | ||
ItemClipChangeBinding.inflate(LayoutInflater.from(parent.context), parent, false), | ||
context, | ||
) | ||
} | ||
|
||
companion object { | ||
private val DiffUtil = ItemDiffCallback<Clip>( | ||
onItemsTheSame = { old, new -> old.id == new.id }, | ||
onContentsTheSame = { old, new -> old == new }, | ||
) | ||
} | ||
} |
Oops, something went wrong.