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.height
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.Surface
import androidx.compose.material.Text
import androidx.compose.material.primarySurface
import androidx.compose.runtime.Composable
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.fragment.app.Fragment
import dagger.hilt.android.AndroidEntryPoint
@ -48,31 +53,61 @@ class NewConversationHomeFragment : Fragment() {
@Composable
fun NewConversationScreen() {
Column(modifier = Modifier.background(MaterialTheme.colors.primarySurface)) {
AppBar(stringResource(R.string.dialog_new_conversation_title), onClose = { delegate.onDialogClosePressed() })
ItemButton(textId = R.string.messageNew, icon = R.drawable.ic_message) { delegate.onNewMessageSelected() }
Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(textId = R.string.activity_create_group_title, icon = R.drawable.ic_group) { delegate.onCreateGroupSelected() }
Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(textId = R.string.dialog_join_community_title, icon = R.drawable.ic_globe) { delegate.onJoinCommunitySelected() }
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() }
Column(
modifier = Modifier
.padding(horizontal = LocalDimensions.current.marginMedium)
.padding(top = LocalDimensions.current.itemSpacingMedium)
AppBar(
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())
) {
Text(
text = stringResource(R.string.accountIdYours),
style = MaterialTheme.typography.xl
)
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny))
Text(
text = stringResource(R.string.qrYoursDescription),
color = LocalColors.current.textSecondary,
style = MaterialTheme.typography.small
)
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall))
QrImage(string = TextSecurePreferences.getLocalNumber(requireContext())!!, Modifier.contentDescription(R.string.AccessibilityId_qr_code))
Column(
modifier = Modifier.verticalScroll(rememberScrollState())
) {
ItemButton(
textId = R.string.messageNew,
icon = R.drawable.ic_message
) { delegate.onNewMessageSelected() }
Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(
textId = R.string.activity_create_group_title,
icon = R.drawable.ic_group
) { delegate.onCreateGroupSelected() }
Divider(startIndent = LocalDimensions.current.dividerIndent)
ItemButton(
textId = R.string.dialog_join_community_title,
icon = R.drawable.ic_globe
) { delegate.onJoinCommunitySelected() }
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() }
Column(
modifier = Modifier
.padding(horizontal = LocalDimensions.current.marginMedium)
.padding(top = LocalDimensions.current.itemSpacingMedium)
) {
Text(
text = stringResource(R.string.accountIdYours),
style = MaterialTheme.typography.xl
)
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingTiny))
Text(
text = stringResource(R.string.qrYoursDescription),
color = LocalColors.current.textSecondary,
style = MaterialTheme.typography.small
)
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacingSmall))
QrImage(
string = TextSecurePreferences.getLocalNumber(requireContext())!!,
Modifier.contentDescription(R.string.AccessibilityId_qr_code)
)
}
}
}
}
}