From 520800ded0f636fe4cd214ae74e10e98e7c9a94e Mon Sep 17 00:00:00 2001 From: JRoberts <8711996+jr-simplex@users.noreply.github.com> Date: Sat, 24 Sep 2022 19:59:35 +0400 Subject: [PATCH] android: disable new chat buttons and notifications settings when chat is stopped (#1116) --- .../chat/simplex/app/views/chatlist/ChatListView.kt | 12 +++++++++--- .../simplex/app/views/usersettings/SettingsView.kt | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chatlist/ChatListView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chatlist/ChatListView.kt index b95da7d89f..0b8d2f7d45 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chatlist/ChatListView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chatlist/ChatListView.kt @@ -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) { diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt index e560d42d77..9384e69306 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt @@ -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()