android: disable new chat buttons and notifications settings when chat is stopped (#1116)

This commit is contained in:
JRoberts
2022-09-24 19:59:35 +04:00
committed by GitHub
parent 47a6a81854
commit 520800ded0
2 changed files with 10 additions and 4 deletions

View File

@@ -86,7 +86,11 @@ fun ChatListView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit, stopped:
sheetContent = { NewChatSheet(chatModel, scaffoldCtrl) },
floatingActionButton = {
FloatingActionButton(
onClick = { if (!scaffoldCtrl.expanded.value) scaffoldCtrl.expand() else scaffoldCtrl.collapse() },
onClick = {
if (!stopped) {
if (!scaffoldCtrl.expanded.value) scaffoldCtrl.expand() else scaffoldCtrl.collapse()
}
},
Modifier.padding(bottom = 90.dp),
elevation = FloatingActionButtonDefaults.elevation(
defaultElevation = 0.dp,
@@ -94,7 +98,7 @@ fun ChatListView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit, stopped:
hoveredElevation = 0.dp,
focusedElevation = 0.dp,
),
backgroundColor = MaterialTheme.colors.primary,
backgroundColor = if (!stopped) MaterialTheme.colors.primary else HighOrLowlight,
contentColor = Color.White
) {
Icon(Icons.Default.Edit, stringResource(R.string.add_contact_or_create_group))
@@ -111,7 +115,9 @@ fun ChatListView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit, stopped:
if (chatModel.chats.isNotEmpty()) {
ChatList(chatModel, search = searchInList)
} else {
OnboardingButtons(scaffoldCtrl)
if (!stopped) {
OnboardingButtons(scaffoldCtrl)
}
}
}
if (scaffoldCtrl.expanded.value) {

View File

@@ -122,7 +122,7 @@ fun SettingsLayout(
SectionSpacer()
SectionView(stringResource(R.string.settings_section_title_settings)) {
SettingsActionItem(Icons.Outlined.Bolt, stringResource(R.string.notifications), showSettingsModal { NotificationsSettingsView(it, showCustomModal) })
SettingsActionItem(Icons.Outlined.Bolt, stringResource(R.string.notifications), showSettingsModal { NotificationsSettingsView(it, showCustomModal) }, disabled = stopped)
SectionDivider()
SettingsActionItem(Icons.Outlined.Videocam, stringResource(R.string.settings_audio_video_calls), showSettingsModal { CallSettingsView(it, showModal) }, disabled = stopped)
SectionDivider()