mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-14 21:15:37 +00:00
android: floating button for creating a new chat (#1102)
* Floating button for creating a new chat - also fixed two-line preview in a chat list * Button color in light theme * update button color, remove elevation Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
06c79cc2bc
commit
2b53406ccf
+1
-1
@@ -462,7 +462,7 @@ fun ChatListNavLinkLayout(
|
||||
showMenu: MutableState<Boolean>,
|
||||
stopped: Boolean
|
||||
) {
|
||||
var modifier = Modifier.fillMaxWidth().height(88.dp)
|
||||
var modifier = Modifier.fillMaxWidth().heightIn(min = 88.dp)
|
||||
if (!stopped) modifier = modifier.combinedClickable(onClick = click, onLongClick = { showMenu.value = true })
|
||||
Surface(modifier) {
|
||||
Row(
|
||||
|
||||
@@ -84,6 +84,22 @@ fun ChatListView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit, stopped:
|
||||
drawerContent = { SettingsView(chatModel, setPerformLA) },
|
||||
sheetPeekHeight = 0.dp,
|
||||
sheetContent = { NewChatSheet(chatModel, scaffoldCtrl) },
|
||||
floatingActionButton = {
|
||||
FloatingActionButton(
|
||||
onClick = { if (!scaffoldCtrl.expanded.value) scaffoldCtrl.expand() else scaffoldCtrl.collapse() },
|
||||
Modifier.padding(bottom = 90.dp),
|
||||
elevation = FloatingActionButtonDefaults.elevation(
|
||||
defaultElevation = 0.dp,
|
||||
pressedElevation = 0.dp,
|
||||
hoveredElevation = 0.dp,
|
||||
focusedElevation = 0.dp,
|
||||
),
|
||||
backgroundColor = MaterialTheme.colors.primary,
|
||||
contentColor = Color.White
|
||||
) {
|
||||
Icon(Icons.Default.Edit, stringResource(R.string.add_contact_or_create_group))
|
||||
}
|
||||
},
|
||||
sheetShape = RoundedCornerShape(topStart = 18.dp, topEnd = 18.dp),
|
||||
) {
|
||||
Box {
|
||||
@@ -113,29 +129,29 @@ fun ChatListView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit, stopped:
|
||||
@Composable
|
||||
private fun OnboardingButtons(scaffoldCtrl: ScaffoldController) {
|
||||
Box {
|
||||
Column(Modifier.fillMaxSize().padding(6.dp), horizontalAlignment = Alignment.End) {
|
||||
Column(Modifier.fillMaxSize().padding(6.dp), horizontalAlignment = Alignment.End, verticalArrangement = Arrangement.Bottom) {
|
||||
val uriHandler = LocalUriHandler.current
|
||||
ConnectButton(generalGetString(R.string.chat_with_developers)) {
|
||||
uriHandler.openUri(simplexTeamUri)
|
||||
}
|
||||
Spacer(Modifier.height(10.dp))
|
||||
ConnectButton(generalGetString(R.string.tap_to_start_new_chat)) {
|
||||
scaffoldCtrl.toggleSheet()
|
||||
}
|
||||
val color = MaterialTheme.colors.primary
|
||||
Canvas(modifier = Modifier.width(30.dp).height(10.dp), onDraw = {
|
||||
Canvas(modifier = Modifier.width(46.dp).height(10.dp), onDraw = {
|
||||
val trianglePath = Path().apply {
|
||||
moveTo(8.dp.toPx(), 0f)
|
||||
lineTo(16.dp.toPx(), 10.dp.toPx())
|
||||
lineTo(0f, 10.dp.toPx())
|
||||
lineTo(8.dp.toPx(), 0f)
|
||||
moveTo(0.dp.toPx(), 0f)
|
||||
lineTo(16.dp.toPx(), 0.dp.toPx())
|
||||
lineTo(8.dp.toPx(), 10.dp.toPx())
|
||||
lineTo(0.dp.toPx(), 0.dp.toPx())
|
||||
}
|
||||
drawPath(
|
||||
color = color,
|
||||
path = trianglePath
|
||||
)
|
||||
})
|
||||
|
||||
ConnectButton(generalGetString(R.string.tap_to_start_new_chat)) {
|
||||
scaffoldCtrl.toggleSheet()
|
||||
}
|
||||
Spacer(Modifier.height(10.dp))
|
||||
val uriHandler = LocalUriHandler.current
|
||||
ConnectButton(generalGetString(R.string.chat_with_developers)) {
|
||||
uriHandler.openUri(simplexTeamUri)
|
||||
}
|
||||
Spacer(Modifier.height(80.dp))
|
||||
}
|
||||
Text(stringResource(R.string.you_have_no_chats), Modifier.align(Alignment.Center), color = HighOrLowlight)
|
||||
}
|
||||
@@ -169,17 +185,7 @@ fun ChatListToolbar(chatModel: ChatModel, scaffoldCtrl: ScaffoldController, stop
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!stopped) {
|
||||
barButtons.add {
|
||||
IconButton(onClick = { scaffoldCtrl.toggleSheet() }) {
|
||||
Icon(
|
||||
Icons.Outlined.Edit,
|
||||
stringResource(R.string.add_contact),
|
||||
tint = MaterialTheme.colors.primary,
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (stopped) {
|
||||
barButtons.add {
|
||||
IconButton(onClick = {
|
||||
AlertManager.shared.showAlertMsg(
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
<string name="group_preview_join_as">вступить как %s</string>
|
||||
<string name="group_connection_pending">соединяется…</string>
|
||||
<string name="tap_to_start_new_chat">Нажмите, чтобы начать чат</string>
|
||||
<string name="chat_with_developers">или соединитесь с разработчиками</string>
|
||||
<string name="chat_with_developers">Соединиться с разработчиками</string>
|
||||
<string name="you_have_no_chats">У вас нет чатов</string>
|
||||
|
||||
<!-- ComposeView.kt, helpers -->
|
||||
@@ -465,7 +465,6 @@
|
||||
<string name="scan_contact_s_qr_code">Сосканировать QR код контакта</string>
|
||||
<string name="in_person_or_via_a_video_call__the_most_secure_way_to_connect">При встрече или в видеозвонке – самый безопасный способ установить соединение</string>
|
||||
<string name="or">или</string>
|
||||
<string name="connect_with_the_developers">Соединиться с разработчиками</string>
|
||||
<string name="to_ask_any_questions_and_to_receive_simplex_chat_updates">Чтобы задать вопросы и получать уведомления о <xliff:g id="appNameFull">SimpleX Chat</xliff:g>.</string>
|
||||
|
||||
<!-- Call -->
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
<string name="group_preview_join_as">join as %s</string>
|
||||
<string name="group_connection_pending">connecting…</string>
|
||||
<string name="tap_to_start_new_chat">Tap to start a new chat</string>
|
||||
<string name="chat_with_developers">or chat with the developers</string>
|
||||
<string name="chat_with_developers">Сhat with the developers</string>
|
||||
<string name="you_have_no_chats">You have no chats</string>
|
||||
|
||||
<!-- ComposeView.kt, helpers -->
|
||||
@@ -465,7 +465,6 @@
|
||||
<string name="scan_contact_s_qr_code">Scan contact\'s QR code</string>
|
||||
<string name="in_person_or_via_a_video_call__the_most_secure_way_to_connect">In person or via a video call – the most secure way to connect.</string>
|
||||
<string name="or">or</string>
|
||||
<string name="connect_with_the_developers">Connect with the developers</string>
|
||||
<string name="to_ask_any_questions_and_to_receive_simplex_chat_updates">To ask any questions and to receive <xliff:g id="appNameFull">SimpleX Chat</xliff:g> updates.</string>
|
||||
|
||||
<!-- Call -->
|
||||
|
||||
Reference in New Issue
Block a user