Skip to content

Commit

Permalink
fix: license item not expanding for long text
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara committed Jul 25, 2023
1 parent 82ec5af commit 6e23668
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package com.wire.android.ui.common
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -46,15 +47,15 @@ fun RowItemTemplate(
leadingIcon()
Column(
modifier = Modifier
.weight(1f)
// .weight(1f)
.padding(start = dimensions().spacing8x)
) {
title()
subtitle()
}
Box(
modifier = Modifier
.wrapContentWidth()
.wrapContentSize()
.padding(horizontal = dimensions().spacing8x)
) {
actions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package com.wire.android.ui.home.conversationslist.common
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -48,7 +49,7 @@ fun RowItem(
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = modifier
.height(MaterialTheme.wireDimensions.conversationItemRowHeight)
.defaultMinSize(minHeight = MaterialTheme.wireDimensions.conversationItemRowHeight)
.fillMaxWidth()
.clickable(clickable)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@ package com.wire.android.ui.home.settings.about.licenses
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.mikepenz.aboutlibraries.entity.Library
import com.mikepenz.aboutlibraries.ui.compose.util.author
import com.wire.android.model.Clickable
import com.wire.android.ui.common.RowItemTemplate
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.EMPTY

@Composable
fun WireLibraries(
Expand Down Expand Up @@ -68,7 +71,7 @@ inline fun LazyListScope.libraryItems(
items(libraries) { library ->
LibraryItem(
library.name,
library.author
library.owner
) {
onLibraryClick.invoke(library)
}
Expand All @@ -82,21 +85,45 @@ fun LibraryItem(
onClick: () -> Unit,
) {
RowItemTemplate(
modifier = Modifier
.wrapContentHeight()
.padding(start = dimensions().spacing8x),
title = {
androidx.compose.material3.Text(
Text(
style = MaterialTheme.wireTypography.title02,
color = MaterialTheme.wireColorScheme.onBackground,
text = libName,
modifier = Modifier.padding(start = dimensions().spacing8x)
)

androidx.compose.material3.Text(
},
subtitle = {
Text(
modifier = Modifier.wrapContentHeight(),
style = MaterialTheme.wireTypography.body01,
color = MaterialTheme.wireColorScheme.secondaryText,
text = libAuthor,
modifier = Modifier.padding(start = dimensions().spacing8x)
text = libAuthor
)
},
clickable = Clickable(enabled = true, onClick = onClick)
)
}

val Library.owner: String
get() = organization?.name ?: developers.takeIf { it.isNotEmpty() }?.map { it.name }?.joinToString(", ") ?: String.EMPTY

@Preview
@Composable
fun LibraryItemPreview() {
LibraryItem(
libName = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." +
" Mauris et dui a erat tempus convallis id nec nunc." +
" Cras vehicula quis massa non sagittis.",
libAuthor = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." +
" Mauris et dui a erat tempus convallis id nec nunc." +
" Cras vehicula quis massa non sagittis." +
" Mauris convallis arcu non tellus facilisis ullamcorper." +
" Morbi massa turpis, vulputate sit amet urna eget, scelerisque efficitur neque." +
" Nam rutrum, ante eu aliquam elementum, urna neque fermentum leo, vel commodo lectus purus et nulla." +
" In laoreet sem viverra orci pulvinar ultricies. Fusce porta ultrices ipsum eget convallis." +
" Pellentesque ac elementum nibh, scelerisque pharetra orci. Proin fermentum, purus non egestas feugiat, nibh justo imperdiet risus, non scelerisque velit felis eu nisl. "
) {}
}

0 comments on commit 6e23668

Please sign in to comment.