Making sure the new convo screen is scrollable

This commit is contained in:
ThomasSession 2024-06-13 17:08:37 +10:00
parent f721c73a15
commit 0dce7b781c

View File

@ -9,11 +9,16 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.material.primarySurface import androidx.compose.material.primarySurface
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.rememberNestedScrollInteropConnection
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
@ -48,14 +53,39 @@ class NewConversationHomeFragment : Fragment() {
@Composable @Composable
fun NewConversationScreen() { fun NewConversationScreen() {
Column(modifier = Modifier.background(MaterialTheme.colors.primarySurface)) { Column(modifier = Modifier.background(MaterialTheme.colors.primarySurface)) {
AppBar(stringResource(R.string.dialog_new_conversation_title), onClose = { delegate.onDialogClosePressed() }) AppBar(
ItemButton(textId = R.string.messageNew, icon = R.drawable.ic_message) { delegate.onNewMessageSelected() } stringResource(R.string.dialog_new_conversation_title),
onClose = { delegate.onDialogClosePressed() })
// this component is scrollable from here, but is inside a bottom sheet
// so we need to cater for nested scrollingÒ
Surface(
// this component is scrollable
modifier = Modifier.nestedScroll(rememberNestedScrollInteropConnection())
) {
Column(
modifier = Modifier.verticalScroll(rememberScrollState())
) {
ItemButton(
textId = R.string.messageNew,
icon = R.drawable.ic_message
) { delegate.onNewMessageSelected() }
Divider(startIndent = LocalDimensions.current.dividerIndent) Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(textId = R.string.activity_create_group_title, icon = R.drawable.ic_group) { delegate.onCreateGroupSelected() } ItemButton(
textId = R.string.activity_create_group_title,
icon = R.drawable.ic_group
) { delegate.onCreateGroupSelected() }
Divider(startIndent = LocalDimensions.current.dividerIndent) Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(textId = R.string.dialog_join_community_title, icon = R.drawable.ic_globe) { delegate.onJoinCommunitySelected() } ItemButton(
textId = R.string.dialog_join_community_title,
icon = R.drawable.ic_globe
) { delegate.onJoinCommunitySelected() }
Divider(startIndent = LocalDimensions.current.dividerIndent) Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(textId = R.string.activity_settings_invite_button_title, icon = R.drawable.ic_invite_friend, contentDescription = R.string.AccessibilityId_invite_friend_button) { delegate.onInviteFriend() } ItemButton(
textId = R.string.activity_settings_invite_button_title,
icon = R.drawable.ic_invite_friend,
contentDescription = R.string.AccessibilityId_invite_friend_button
) { delegate.onInviteFriend() }
Column( Column(
modifier = Modifier modifier = Modifier
.padding(horizontal = LocalDimensions.current.marginMedium) .padding(horizontal = LocalDimensions.current.marginMedium)
@ -72,7 +102,12 @@ class NewConversationHomeFragment : Fragment() {
style = MaterialTheme.typography.small style = MaterialTheme.typography.small
) )
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall)) Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall))
QrImage(string = TextSecurePreferences.getLocalNumber(requireContext())!!, Modifier.contentDescription(R.string.AccessibilityId_qr_code)) QrImage(
string = TextSecurePreferences.getLocalNumber(requireContext())!!,
Modifier.contentDescription(R.string.AccessibilityId_qr_code)
)
}
}
} }
} }
} }