Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] HistoryDetail 내역 보기 & 수정 구현 #57

Merged
merged 10 commits into from
Feb 6, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package ac.dnd.bookkeeping.android.presentation.common.util.expansion

import android.graphics.BlurMaskFilter
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

fun Modifier.customOuterShadow(
color: Color,
offsetX: Dp = 0.dp,
offsetY: Dp = 0.dp,
blurRadius: Float,
) = then(
drawBehind {
drawIntoCanvas { canvas ->
val paint = Paint()
val frameworkPaint = paint.asFrameworkPaint()
if (blurRadius != 0f) {
frameworkPaint.maskFilter = (BlurMaskFilter(blurRadius, BlurMaskFilter.Blur.NORMAL))
}
frameworkPaint.color = color.toArgb()

val leftPixel = offsetX.toPx()
val topPixel = offsetY.toPx()
val rightPixel = size.width + topPixel
val bottomPixel = size.height + leftPixel

canvas.drawRect(
left = leftPixel,
top = topPixel,
right = rightPixel,
bottom = bottomPixel,
paint = paint,
)
}
}
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package ac.dnd.bookkeeping.android.presentation.common.view

import ac.dnd.bookkeeping.android.presentation.common.theme.Gray000
import ac.dnd.bookkeeping.android.presentation.common.util.expansion.customOuterShadow
import ac.dnd.bookkeeping.android.presentation.common.view.confirm.ConfirmButton
import ac.dnd.bookkeeping.android.presentation.common.view.confirm.ConfirmButtonProperties
import ac.dnd.bookkeeping.android.presentation.common.view.confirm.ConfirmButtonSize
import ac.dnd.bookkeeping.android.presentation.common.view.confirm.ConfirmButtonType
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -20,6 +23,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -33,30 +37,40 @@ fun BottomSheetScreen(
properties: BottomSheetDialogProperties = BottomSheetDialogProperties(),
content: @Composable () -> Unit
) {

BottomSheetDialog(
onDismissRequest = onDismissRequest,
properties = properties
properties = properties,
) {
Surface(
color = Gray000,
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight(),
color = Color.White,
shape = RoundedCornerShape(
topStart = 12.dp,
topEnd = 12.dp
)
.clip(
RoundedCornerShape(
topStart = 12.dp,
topEnd = 12.dp
)
)
.padding(top = 0.68.dp)
.padding(horizontal = 0.68.dp)
.customOuterShadow(
color = Color(0x4D888888),
offsetX = 0.68.dp,
offsetY = 0.68.dp,
blurRadius = 6.8f
)
.wrapContentHeight()
) {
content()
}
}
}

@Preview
@Preview(apiLevel = 33)
@Composable
fun BottomSheetScreenPreview1() {
var isShowing by remember { mutableStateOf(true) }

if (isShowing) {
BottomSheetScreen(
onDismissRequest = { isShowing = false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ac.dnd.bookkeeping.android.presentation.common.theme.Primary4
import ac.dnd.bookkeeping.android.presentation.common.theme.Shapes
import ac.dnd.bookkeeping.android.presentation.common.theme.Space12
import ac.dnd.bookkeeping.android.presentation.common.theme.Space16
import ac.dnd.bookkeeping.android.presentation.common.theme.Space40
import ac.dnd.bookkeeping.android.presentation.common.theme.Space48
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand All @@ -25,6 +26,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

Expand Down Expand Up @@ -61,7 +63,10 @@ fun FieldSelectComponent(
color = Gray800,
fontWeight = FontWeight.Normal
),
modifier = Modifier.align(Alignment.CenterStart)
modifier = Modifier
.align(Alignment.CenterStart)
.padding(end = Space40),
overflow = TextOverflow.Ellipsis
)

Image(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
package ac.dnd.bookkeeping.android.presentation.common.view.textfield

import ac.dnd.bookkeeping.android.presentation.R
import ac.dnd.bookkeeping.android.presentation.common.theme.Body1
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray500
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray700
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray800
import ac.dnd.bookkeeping.android.presentation.common.theme.Headline3
import ac.dnd.bookkeeping.android.presentation.common.theme.Negative
import ac.dnd.bookkeeping.android.presentation.common.theme.Primary3
import ac.dnd.bookkeeping.android.presentation.common.util.expansion.NumberCommaTransformation
import ac.dnd.bookkeeping.android.presentation.common.view.component.FieldSubject
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Divider
Expand All @@ -35,12 +28,10 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
Expand All @@ -59,10 +50,11 @@ fun TypingPriceField(
hintText: String = "지출하신 금액을 입력해주세요",
isError: Boolean = false,
isEnabled: Boolean = true,
isAddFiledEnabled: Boolean = true,
innerPadding: PaddingValues = PaddingValues(0.dp),
textFieldHeight: Dp = 35.dp,
keyboardOptions: KeyboardOptions = KeyboardOptions(keyboardType = KeyboardType.NumberPassword),
textFormat : VisualTransformation = NumberCommaTransformation(),
textFormat: VisualTransformation = NumberCommaTransformation(),
fieldSubjectContent: (@Composable () -> Unit) = { FieldSubject("금액") },
leadingIconContent: (@Composable () -> Unit)? = null,
trailingIconContent: (@Composable () -> Unit)? = null,
Expand Down Expand Up @@ -140,21 +132,24 @@ fun TypingPriceField(
contentPadding = innerPadding
)
}
Spacer(modifier = Modifier.height(12.dp))
Divider(
modifier = Modifier
.fillMaxWidth()
.height(1.dp),
color = currentColorState.value
)
Spacer(modifier = Modifier.height(6.dp))
PriceChipComponent(
scope = scope,
onClickChip = { addPrice ->
val newText = addPriceFormat(addPrice)
onValueChange(newText)
}
)
errorMessageContent()
if (isAddFiledEnabled || isTextFieldFocused) {
Spacer(modifier = Modifier.height(6.dp))
PriceChipComponent(
scope = scope,
onClickChip = { addPrice ->
val newText = addPriceFormat(addPrice)
onValueChange(newText)
}
)
errorMessageContent()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ac.dnd.bookkeeping.android.presentation.model.history

enum class HistoryRegistrationEventType(
enum class HistoryEventType(
val id: Long,
val eventName: String
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ac.dnd.bookkeeping.android.presentation.model.history

enum class HistoryRegistrationTagType(
enum class HistoryTagType(
val id: Long,
val tagName: String
) {
Expand All @@ -20,5 +20,13 @@ enum class HistoryRegistrationTagType(
it.tagName
}
}

fun getTagIdList(nameList: List<String>): List<Long> {
return entries.filter {
it.tagName in nameList
}.map {
it.id
}
}
}
}
Loading
Loading