Skip to content

Commit

Permalink
chore: ktlint format
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkoro committed Jun 7, 2024
1 parent dba0493 commit 70dcb67
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ fun FieldsContent(
Text(text = stringResource(id = R.string.login_subject))
},
keyboardOptions =
KeyboardOptions.Default.copy(
imeAction = ImeAction.Next,
keyboardType = KeyboardType.Text,
),
KeyboardOptions.Default.copy(
imeAction = ImeAction.Next,
keyboardType = KeyboardType.Text,
),
modifier = Modifier.fillMaxWidth(),
singleLine = true,
)
Expand All @@ -97,10 +97,10 @@ fun FieldsContent(
Text(text = stringResource(id = R.string.login_password))
},
keyboardOptions =
KeyboardOptions.Default.copy(
imeAction = ImeAction.Done,
keyboardType = KeyboardType.Password,
),
KeyboardOptions.Default.copy(
imeAction = ImeAction.Done,
keyboardType = KeyboardType.Password,
),
visualTransformation = PasswordVisualTransformation(),
modifier = Modifier.fillMaxWidth(),
singleLine = true,
Expand All @@ -115,8 +115,8 @@ fun FieldsContent(
Button(
enabled = networkStatus == NetworkStatus.Available,
modifier =
Modifier
.size(width = contentWidth.halfStandard, height = contentHeight.standard),
Modifier
.size(width = contentWidth.halfStandard, height = contentHeight.standard),
shape = RoundedCornerShape(shape.medium),
onClick = {
scope.launch(Dispatchers.IO) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ fun LoginButton(
val continueButtonColors =
ButtonDefaults.buttonColors(
containerColor =
if (isError) {
MaterialTheme.colorScheme.error
} else {
MaterialTheme.colorScheme.primary
},
if (isError) {
MaterialTheme.colorScheme.error
} else {
MaterialTheme.colorScheme.primary
},
contentColor =
if (isError) {
MaterialTheme.colorScheme.onError
} else {
MaterialTheme.colorScheme.onPrimary
},
if (isError) {
MaterialTheme.colorScheme.onError
} else {
MaterialTheme.colorScheme.onPrimary
},
)

Row(
Expand All @@ -70,9 +70,9 @@ fun LoginButton(
onClick = { onExit() },
enabled = isLoginButtonEnable(),
modifier =
modifier
.width(contentWidth.halfStandard)
.height(contentHeight.loginButton),
modifier
.width(contentWidth.halfStandard)
.height(contentHeight.loginButton),
shape = RoundedCornerShape(topStart = shape.medium, bottomStart = shape.medium),
) {
Row(
Expand All @@ -89,18 +89,18 @@ fun LoginButton(
}
Divider(
modifier =
Modifier
.height(contentHeight.loginButton)
.width(1.dp),
Modifier
.height(contentHeight.loginButton)
.width(1.dp),
)
Button(
onClick = { onSubmit() },
enabled = isLoginButtonEnable(),
colors = continueButtonColors,
modifier =
modifier
.width(contentWidth.halfStandard)
.height(contentHeight.loginButton),
modifier
.width(contentWidth.halfStandard)
.height(contentHeight.loginButton),
shape = RoundedCornerShape(topEnd = shape.medium, bottomEnd = shape.medium),
) {
Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,47 @@ fun OrderBottomBar(
val scope = rememberCoroutineScope()

val animatedYOffset by animateDpAsState(
targetValue = if (isScrollingInProgress) {
offset.bottomBar
} else {
offset.none
},
targetValue =
if (isScrollingInProgress) {
offset.bottomBar
} else {
offset.none
},
label = "AnimatedYOffset",
)
val animatedBottomBarHeight by animateDpAsState(
targetValue = if (isScrollingInProgress) {
contentHeight.none
} else {
contentHeight.bottomBar
},
targetValue =
if (isScrollingInProgress) {
contentHeight.none
} else {
contentHeight.bottomBar
},
label = "AnimatedBottomBarHeight",
)
val animatedBottomBarButtonHeight by animateDpAsState(
targetValue = if (isScrollingInProgress) {
contentHeight.none
} else {
contentHeight.halfStandard
},
targetValue =
if (isScrollingInProgress) {
contentHeight.none
} else {
contentHeight.halfStandard
},
label = "AnimatedBottomBarButtonHeight",
)

Column(
modifier =
modifier
.fillMaxWidth()
.height(animatedBottomBarHeight)
.offset(y = animatedYOffset),
modifier
.fillMaxWidth()
.height(animatedBottomBarHeight)
.offset(y = animatedYOffset),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Button(
modifier =
Modifier
.width(contentWidth.orderItem)
.height(animatedBottomBarButtonHeight),
Modifier
.width(contentWidth.orderItem)
.height(animatedBottomBarButtonHeight),
onClick = { scope.launch(Dispatchers.Main) { onAddNewOrderShowSnackbar() } },
shape = RoundedCornerShape(shape.medium),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,27 @@ fun OrderTopBar(

Row(
modifier =
modifier
.fillMaxWidth()
.height(contentHeight.topBar)
.background(MaterialTheme.colorScheme.background),
modifier
.fillMaxWidth()
.height(contentHeight.topBar)
.background(MaterialTheme.colorScheme.background),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Box(modifier = Modifier.size(contentHeight.topBar)) {
Box(
modifier =
Modifier
.padding(8.dp)
.fillMaxSize()
.clip(CircleShape)
.background(MaterialTheme.colorScheme.background)
.border(
width = 2.dp,
shape = CircleShape,
color = MaterialTheme.colorScheme.onPrimaryContainer,
)
.clickable { onNavigateToProfileScreen() },
Modifier
.padding(8.dp)
.fillMaxSize()
.clip(CircleShape)
.background(MaterialTheme.colorScheme.background)
.border(
width = 2.dp,
shape = CircleShape,
color = MaterialTheme.colorScheme.onPrimaryContainer,
)
.clickable { onNavigateToProfileScreen() },
contentAlignment = Alignment.Center,
content = {
if (!userName.isNullOrEmpty()) {
Expand All @@ -90,14 +90,14 @@ fun OrderTopBar(
}
Row(
modifier =
Modifier
.fillMaxHeight()
.fillMaxWidth(.8F)
.clickable {
scope.launch(Dispatchers.Main) {
onFilterOrdersShowSnackbar()
}
},
Modifier
.fillMaxHeight()
.fillMaxWidth(.8F)
.clickable {
scope.launch(Dispatchers.Main) {
onFilterOrdersShowSnackbar()
}
},
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
) {
Expand All @@ -109,19 +109,20 @@ fun OrderTopBar(
)
}
Box(
modifier = Modifier
.size(contentHeight.topBar)
.clickable {
scope.launch(Dispatchers.Main) {
onSortOrdersShowSnackbar()
}
},
modifier =
Modifier
.size(contentHeight.topBar)
.clickable {
scope.launch(Dispatchers.Main) {
onSortOrdersShowSnackbar()
}
},
) {
Box(
modifier =
Modifier
.padding(5.dp)
.fillMaxSize(),
Modifier
.padding(5.dp)
.fillMaxSize(),
contentAlignment = Alignment.Center,
) {
Icon(
Expand All @@ -142,7 +143,7 @@ private fun OrderTopBarPrev() {
onFilterOrdersShowSnackbar = { SnackbarResult.ActionPerformed },
onNavigateToProfileScreen = {},
networkStatus = NetworkStatus.Available,
userName = "Peter"
userName = "Peter",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ fun OrderItem(
val selected = { selectedOrderRecordId == order.recordId }
val animatedHeight by animateDpAsState(
targetValue =
if (selected()) {
if (allowedToUpdateOrderStatus(profile)) {
contentHeight.orderItemExpanded
if (selected()) {
if (allowedToUpdateOrderStatus(profile)) {
contentHeight.orderItemExpanded
} else {
contentHeight.orderItemExpandedWithoutActionButton
}
} else {
contentHeight.orderItemExpandedWithoutActionButton
}
} else {
contentHeight.orderItemNotExpanded
},
contentHeight.orderItemNotExpanded
},
label = "AnimatedHeightOfOrderItem",
animationSpec = tween(300),
)
Expand All @@ -83,26 +83,26 @@ fun OrderItem(
Spacer(modifier = Modifier.height(contentHeight.medium))
Column(
modifier =
Modifier
.width(contentWidth.orderItem)
.height(animatedHeight)
.clip(RoundedCornerShape(shape.medium))
.background(MaterialTheme.colorScheme.primaryContainer)
.clickable {
if (selected()) {
onSelectOrder(null)
} else {
onSelectOrder(order.recordId)
}
},
Modifier
.width(contentWidth.orderItem)
.height(animatedHeight)
.clip(RoundedCornerShape(shape.medium))
.background(MaterialTheme.colorScheme.primaryContainer)
.clickable {
if (selected()) {
onSelectOrder(null)
} else {
onSelectOrder(order.recordId)
}
},
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceBetween,
) {
Column(
modifier =
Modifier
.fillMaxWidth()
.wrapContentHeight(),
Modifier
.fillMaxWidth()
.wrapContentHeight(),
verticalArrangement = Arrangement.Top,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ fun OrderItemContent(
Pair(stringResource(id = R.string.order_quantity), order.quantity.toString()),
)


Column(verticalArrangement = Arrangement.Top) {
Row(
modifier = Modifier.fillMaxWidth(),
Expand All @@ -54,7 +53,7 @@ fun OrderItemContent(
OrderItemDateAndTitleRow(
orderDate = order.date,
orderTitle = order.title,
orderStatus = order.status
orderStatus = order.status,
)
OrderItemKeyboardArrowIconRow(selected = selected)
}
Expand All @@ -63,9 +62,10 @@ fun OrderItemContent(
LazyColumn(modifier = Modifier.fillMaxWidth()) {
items(orderInfo) { pair ->
Row(
modifier = Modifier
.height(contentHeight.orderItemField)
.clickable {},
modifier =
Modifier
.height(contentHeight.orderItemField)
.clickable {},
verticalAlignment = Alignment.CenterVertically,
) {
Spacer(modifier = Modifier.width(contentWidth.large))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ fun OrderItemDateAndTitleRow(
}
}

private fun dateFromMillis(dateInMillis: Long, inFormat: String = "dd.MM.yyyy hh:mm:ss"): String {
private fun dateFromMillis(
dateInMillis: Long,
inFormat: String = "dd.MM.yyyy hh:mm:ss",
): String {
return DateFormat
.format(inFormat, dateInMillis)
.toString()
}
}
Loading

0 comments on commit 70dcb67

Please sign in to comment.