update and refresh icons to Material Symbols;
update MaterialDialog style
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
package dev.meloda.fast.convos.presentation
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.core.os.bundleOf
|
||||
import dev.meloda.fast.convos.model.ConvoDialog
|
||||
import dev.meloda.fast.convos.model.ConvosScreenState
|
||||
import dev.meloda.fast.ui.components.MaterialDialog
|
||||
|
||||
import dev.meloda.fast.ui.R
|
||||
import dev.meloda.fast.ui.components.MaterialDialog
|
||||
|
||||
@Composable
|
||||
fun HandleDialogs(
|
||||
@@ -27,7 +29,8 @@ fun HandleDialogs(
|
||||
title = stringResource(id = R.string.confirm_archive_convo),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = R.string.action_archive),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
cancelText = stringResource(id = R.string.cancel),
|
||||
icon = ImageVector.vectorResource(R.drawable.ic_archive_fill_round_24)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -37,17 +40,23 @@ fun HandleDialogs(
|
||||
title = stringResource(id = R.string.confirm_unarchive_convo),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = R.string.action_unarchive),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
cancelText = stringResource(id = R.string.cancel),
|
||||
icon = ImageVector.vectorResource(R.drawable.ic_unarchive_fill_round_24)
|
||||
)
|
||||
}
|
||||
|
||||
is ConvoDialog.ConvoDelete -> {
|
||||
val errorColor = MaterialTheme.colorScheme.error
|
||||
|
||||
MaterialDialog(
|
||||
onDismissRequest = { onDismissed(dialog) },
|
||||
icon = ImageVector.vectorResource(R.drawable.ic_delete_fill_round_24),
|
||||
iconTint = errorColor,
|
||||
title = stringResource(id = R.string.confirm_delete_convo),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = R.string.action_delete),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
confirmContainerColor = errorColor,
|
||||
cancelText = stringResource(id = R.string.cancel),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -57,7 +66,8 @@ fun HandleDialogs(
|
||||
title = stringResource(id = R.string.confirm_pin_convo),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = R.string.action_pin),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
cancelText = stringResource(id = R.string.cancel),
|
||||
icon = ImageVector.vectorResource(R.drawable.ic_keep_fill_round_24)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -67,7 +77,8 @@ fun HandleDialogs(
|
||||
title = stringResource(id = R.string.confirm_unpin_convo),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = R.string.action_unpin),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
cancelText = stringResource(id = R.string.cancel),
|
||||
icon = ImageVector.vectorResource(R.drawable.ic_keep_off_fill_round_24)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
@@ -19,12 +20,13 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.ElevatedAssistChip
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.surfaceColorAtElevation
|
||||
@@ -45,6 +47,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import coil.compose.AsyncImage
|
||||
import dev.meloda.fast.ui.R
|
||||
import dev.meloda.fast.ui.basic.ContentAlpha
|
||||
import dev.meloda.fast.ui.basic.LocalContentAlpha
|
||||
import dev.meloda.fast.ui.components.DotsFlashing
|
||||
@@ -53,7 +56,6 @@ import dev.meloda.fast.ui.model.vk.UiConvo
|
||||
import dev.meloda.fast.ui.util.getImage
|
||||
import dev.meloda.fast.ui.util.getResourcePainter
|
||||
import dev.meloda.fast.ui.util.getString
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
val BirthdayColor = Color(0xffb00b69)
|
||||
|
||||
@@ -127,7 +129,7 @@ fun ConvoItem(
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.size(32.dp),
|
||||
painter = painterResource(id = R.drawable.ic_round_bookmark_border_24),
|
||||
painter = painterResource(id = R.drawable.ic_bookmark_round_24),
|
||||
contentDescription = "Favorites icon",
|
||||
tint = MaterialTheme.colorScheme.onPrimary
|
||||
)
|
||||
@@ -150,7 +152,7 @@ fun ConvoItem(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.clip(CircleShape),
|
||||
placeholder = painterResource(id = R.drawable.ic_account_circle_cut)
|
||||
placeholder = painterResource(id = R.drawable.ic_account_circle_fill_round_24)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -166,7 +168,7 @@ fun ConvoItem(
|
||||
modifier = Modifier
|
||||
.height(14.dp)
|
||||
.align(Alignment.Center),
|
||||
painter = painterResource(id = R.drawable.ic_round_push_pin_24),
|
||||
painter = painterResource(id = R.drawable.ic_keep_fill_round_24),
|
||||
contentDescription = "Pin icon",
|
||||
tint = Color.White
|
||||
)
|
||||
@@ -222,7 +224,7 @@ fun ConvoItem(
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.size(10.dp),
|
||||
painter = painterResource(id = R.drawable.round_cake_24),
|
||||
painter = painterResource(id = R.drawable.ic_cake_fill_round_24),
|
||||
contentDescription = "Birthday icon",
|
||||
tint = Color.White
|
||||
)
|
||||
@@ -363,11 +365,18 @@ fun ConvoItem(
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
|
||||
LazyRow(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 10.dp)
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
overscrollEffect = null,
|
||||
) {
|
||||
items(convo.options.toList()) { option ->
|
||||
itemsIndexed(
|
||||
items = convo.options.toList(),
|
||||
key = { _, option -> option.hashCode() }
|
||||
) { index, option ->
|
||||
if (index == 0) {
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
}
|
||||
|
||||
ElevatedAssistChip(
|
||||
onClick = { onOptionClicked(convo, option) },
|
||||
leadingIcon = {
|
||||
@@ -375,7 +384,10 @@ fun ConvoItem(
|
||||
Icon(
|
||||
painter = painter,
|
||||
contentDescription = "Chip icon",
|
||||
modifier = Modifier.size(16.dp)
|
||||
modifier = Modifier.size(16.dp),
|
||||
tint = if (option is ConvoOption.Delete) {
|
||||
MaterialTheme.colorScheme.error
|
||||
} else LocalContentColor.current
|
||||
)
|
||||
}
|
||||
},
|
||||
@@ -383,7 +395,10 @@ fun ConvoItem(
|
||||
Text(text = option.title.getString().orEmpty())
|
||||
}
|
||||
)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
|
||||
if (index == convo.options.lastIndex) {
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ fun ConvosList(
|
||||
colors = IconButtonDefaults.filledIconButtonColors()
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.round_keyboard_arrow_up_24px),
|
||||
painter = painterResource(R.drawable.ic_keyboard_arrow_up_round_24),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ fun ConvosRoute(
|
||||
onConvoItemLongClicked = viewModel::onConvoItemLongClick,
|
||||
onOptionClicked = viewModel::onOptionClicked,
|
||||
onPaginationConditionsMet = viewModel::onPaginationConditionsMet,
|
||||
onRefreshDropdownItemClicked = viewModel::onRefresh,
|
||||
onRefresh = viewModel::onRefresh,
|
||||
onCreateChatButtonClicked = viewModel::onCreateChatButtonClicked,
|
||||
onArchiveActionClicked = { onNavigateToArchive?.invoke() },
|
||||
|
||||
@@ -92,7 +92,6 @@ fun ConvosScreen(
|
||||
onConvoItemLongClicked: (convo: UiConvo) -> Unit = {},
|
||||
onOptionClicked: (UiConvo, ConvoOption) -> Unit = { _, _ -> },
|
||||
onPaginationConditionsMet: () -> Unit = {},
|
||||
onRefreshDropdownItemClicked: () -> Unit = {},
|
||||
onRefresh: () -> Unit = {},
|
||||
onCreateChatButtonClicked: () -> Unit = {},
|
||||
onArchiveActionClicked: () -> Unit = {},
|
||||
@@ -194,7 +193,7 @@ fun ConvosScreen(
|
||||
if (screenState.isArchive) {
|
||||
IconButton(onClick = onBack) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.round_arrow_back_24px),
|
||||
painter = painterResource(R.drawable.ic_arrow_back_round_24),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
@@ -216,7 +215,7 @@ fun ConvosScreen(
|
||||
dropDownItems += {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
onRefreshDropdownItemClicked()
|
||||
onRefresh()
|
||||
dropDownMenuExpanded = false
|
||||
},
|
||||
text = {
|
||||
@@ -224,7 +223,7 @@ fun ConvosScreen(
|
||||
},
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.round_refresh_24px),
|
||||
painter = painterResource(R.drawable.ic_refresh_round_24),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
@@ -235,7 +234,7 @@ fun ConvosScreen(
|
||||
if (dropDownItems.isNotEmpty()) {
|
||||
IconButton(onClick = { dropDownMenuExpanded = true }) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.round_more_vert_24px),
|
||||
painter = painterResource(R.drawable.ic_more_vert_round_24),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
@@ -292,7 +291,7 @@ fun ConvosScreen(
|
||||
}
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.round_create_24),
|
||||
painter = painterResource(id = R.drawable.ic_edit_round_24),
|
||||
contentDescription = "Add chat button"
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user