diff --git a/core/design-system/src/main/java/com/msg/design_system/component/modifier/clickableSingle/MultipleEventsCutter.kt b/core/design-system/src/main/java/com/msg/design_system/component/modifier/clickableSingle/MultipleEventsCutter.kt new file mode 100644 index 00000000..b3eac79d --- /dev/null +++ b/core/design-system/src/main/java/com/msg/design_system/component/modifier/clickableSingle/MultipleEventsCutter.kt @@ -0,0 +1,21 @@ +package com.msg.design_system.component.modifier.clickableSingle + +internal interface MultipleEventsCutter { + fun processEvent(event: () -> Unit) + + companion object +} + +internal fun MultipleEventsCutter.Companion.get(): MultipleEventsCutter = MultipleEventsCutterImpl() + +private class MultipleEventsCutterImpl : MultipleEventsCutter { + private var lastEventTimeMs: Long = 0 + + override fun processEvent(event: () -> Unit) { + val now = System.currentTimeMillis() + if (now - lastEventTimeMs >= 400L) { + event.invoke() + lastEventTimeMs = now + } + } +} \ No newline at end of file diff --git a/core/design-system/src/main/java/com/msg/design_system/component/modifier/clickableSingle/clickableSingle.kt b/core/design-system/src/main/java/com/msg/design_system/component/modifier/clickableSingle/clickableSingle.kt new file mode 100644 index 00000000..c7cd6913 --- /dev/null +++ b/core/design-system/src/main/java/com/msg/design_system/component/modifier/clickableSingle/clickableSingle.kt @@ -0,0 +1,24 @@ +package com.msg.design_system.component.modifier.clickableSingle + +import android.annotation.SuppressLint +import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.runtime.Stable +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier +import androidx.compose.ui.composed + +@SuppressLint("ModifierFactoryUnreferencedReceiver") +@Stable +fun Modifier.clickableSingle( + enabled: Boolean = true, + onClick: () -> Unit, +) = composed { + val multipleEventsCutter = remember { MultipleEventsCutter.get() } + Modifier.clickable( + enabled = enabled, + onClick = { multipleEventsCutter.processEvent { onClick() } }, + indication = null, + interactionSource = remember { MutableInteractionSource() } + ) +} \ No newline at end of file diff --git a/core/design-system/src/main/java/com/msg/design_system/component/modifier/padding/padding.kt b/core/design-system/src/main/java/com/msg/design_system/component/modifier/padding/padding.kt new file mode 100644 index 00000000..77985da6 --- /dev/null +++ b/core/design-system/src/main/java/com/msg/design_system/component/modifier/padding/padding.kt @@ -0,0 +1,19 @@ +package com.msg.design_system.component.modifier.padding + +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Stable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp + +@Stable +fun Modifier.paddingHorizontal( + top: Dp = 0.dp, + horizontal: Dp = 0.dp, + bottom: Dp = 0.dp +): Modifier = this then Modifier + .padding(horizontal = horizontal) + .padding( + top = top, + bottom = bottom + ) \ No newline at end of file diff --git a/feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt b/feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt index cec27676..12d83507 100644 --- a/feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt +++ b/feature/certification/src/main/java/com/msg/certification/AddCertificationScreen.kt @@ -26,6 +26,7 @@ import com.msg.certification.component.AddAcquisitionDateSection import com.msg.certification.component.AddCertificationSection import com.msg.certification.viewmodel.CertificationViewModel import com.msg.design_system.component.button.BitgoeulButton +import com.msg.design_system.component.modifier.padding.paddingHorizontal import com.msg.design_system.component.topbar.DetailSettingTopBar import com.msg.design_system.theme.BitgoeulAndroidTheme import com.msg.ui.DevicePreviews @@ -82,11 +83,10 @@ internal fun AddCertificationScreen( Column( modifier = modifier .fillMaxSize() - .padding( + .paddingHorizontal( top = 24.dp, bottom = 14.dp, - start = 28.dp, - end = 28.dp + horizontal = 28.dp ), verticalArrangement = Arrangement.spacedBy(24.dp) ) { diff --git a/feature/lecture/src/main/java/com/msg/lecture/component/LectureList.kt b/feature/lecture/src/main/java/com/msg/lecture/component/LectureList.kt index aad400c5..2e3eedaf 100644 --- a/feature/lecture/src/main/java/com/msg/lecture/component/LectureList.kt +++ b/feature/lecture/src/main/java/com/msg/lecture/component/LectureList.kt @@ -63,7 +63,7 @@ internal fun LectureTakingStudentList( data: List?, onChangeCompleteState: (isComplete: Boolean, studentId: UUID) -> Unit, ) { - BitgoeulAndroidTheme { colors, typography -> + BitgoeulAndroidTheme { _, _ -> LazyColumn( modifier = modifier .padding(vertical = 24.dp)