Add RoomListConfig to be able to hide menu items. And hide them #2062.
This commit is contained in:
parent
93e43084e1
commit
0c99a457e4
4 changed files with 71 additions and 38 deletions
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2023 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.element.android.appconfig
|
||||
|
||||
object RoomListConfig {
|
||||
const val showInviteMenuItem = false
|
||||
const val showReportProblemMenuItem = false
|
||||
|
||||
const val hasDropdownMenu = showInviteMenuItem || showReportProblemMenuItem
|
||||
}
|
||||
|
||||
1
changelog.d/2062.misc
Normal file
1
changelog.d/2062.misc
Normal file
|
|
@ -0,0 +1 @@
|
|||
Hide room list dropdown menu.
|
||||
|
|
@ -38,6 +38,7 @@ anvil {
|
|||
dependencies {
|
||||
implementation(projects.anvilannotations)
|
||||
anvil(projects.anvilcodegen)
|
||||
implementation(projects.appconfig)
|
||||
implementation(projects.libraries.core)
|
||||
implementation(projects.libraries.androidutils)
|
||||
implementation(projects.libraries.architecture)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.unit.DpOffset
|
||||
import androidx.compose.ui.unit.DpSize
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.appconfig.RoomListConfig
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||
import io.element.android.features.roomlist.impl.R
|
||||
|
|
@ -128,8 +129,6 @@ private fun DefaultRoomListTopBar(
|
|||
onMenuActionClicked: (RoomListMenuAction) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
var showMenu by remember { mutableStateOf(false) }
|
||||
|
||||
// We need this to manually clip the top app bar in preview mode
|
||||
val previewAppBarHeight = if (LocalInspectionMode.current) {
|
||||
112.dp.roundToPx()
|
||||
|
|
@ -222,6 +221,8 @@ private fun DefaultRoomListTopBar(
|
|||
contentDescription = stringResource(CommonStrings.action_search),
|
||||
)
|
||||
}
|
||||
if (RoomListConfig.hasDropdownMenu) {
|
||||
var showMenu by remember { mutableStateOf(false) }
|
||||
IconButton(
|
||||
onClick = { showMenu = !showMenu }
|
||||
) {
|
||||
|
|
@ -234,6 +235,7 @@ private fun DefaultRoomListTopBar(
|
|||
expanded = showMenu,
|
||||
onDismissRequest = { showMenu = false }
|
||||
) {
|
||||
if (RoomListConfig.showInviteMenuItem) {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
showMenu = false
|
||||
|
|
@ -248,6 +250,8 @@ private fun DefaultRoomListTopBar(
|
|||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
if (RoomListConfig.showReportProblemMenuItem) {
|
||||
DropdownMenuItem(
|
||||
onClick = {
|
||||
showMenu = false
|
||||
|
|
@ -263,6 +267,8 @@ private fun DefaultRoomListTopBar(
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollBehavior = scrollBehavior,
|
||||
windowInsets = WindowInsets(0.dp),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue