Skip to content

Commit

Permalink
Polish content backup list items
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandarIlic committed Nov 20, 2024
1 parent 345ae98 commit dcede03
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package net.primal.android.premium.manage.content
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand Down Expand Up @@ -127,18 +129,21 @@ fun PremiumContentBackupScreen(
state.contentTypes.forEachIndexed { index, item ->
val isLastItem = index == state.contentTypes.size - 1

Column(
modifier = Modifier.background(
color = AppTheme.extraColorScheme.surfaceVariantAlt1,
shape = if (isLastItem) {
AppTheme.shapes.large.copy(
topEnd = CornerSize(0.dp),
topStart = CornerSize(0.dp),
)
} else {
RectangleShape
},
),
Box(
modifier = Modifier
.height(56.dp)
.background(
color = AppTheme.extraColorScheme.surfaceVariantAlt1,
shape = if (isLastItem) {
AppTheme.shapes.large.copy(
topEnd = CornerSize(0.dp),
topStart = CornerSize(0.dp),
)
} else {
RectangleShape
},
),
contentAlignment = Alignment.BottomCenter,
) {
ContentListItem(
count = item.count,
Expand Down Expand Up @@ -184,6 +189,7 @@ private fun ContentListItem(
val numberFormat = NumberFormat.getNumberInstance()

ManagePremiumTableRow(
modifier = Modifier.fillMaxHeight(),
firstColumnWeight = CountWeight,
firstColumn = {
if (count != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class PremiumContentBackupViewModel @Inject constructor(
if (index != -1) {
this[index] = this[index].copy(broadcasting = true, progress = 0.01f)
}
}
},
)
}
} catch (error: WssException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ interface BroadcastApi {

suspend fun cancelContentRebroadcast(userId: String)

suspend fun getContentRebroadcastStatus(userId: String) : BroadcastingStatus
suspend fun getContentRebroadcastStatus(userId: String): BroadcastingStatus
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import net.primal.android.theme.AppTheme

@Composable
fun ManagePremiumTableRow(
modifier: Modifier,
firstColumn: @Composable () -> Unit,
firstColumnWeight: Float,
firstColumnContentAlignment: Alignment = Alignment.TopStart,
Expand All @@ -31,9 +32,10 @@ fun ManagePremiumTableRow(
thirdColumnContentAlignment: Alignment = Alignment.TopStart,
) {
Row(
modifier = Modifier
modifier = modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Box(
modifier = Modifier.weight(firstColumnWeight),
Expand Down

0 comments on commit dcede03

Please sign in to comment.