Skip to content

Commit 7d83aa2

Browse files
author
Thomas Horta
committed
Remove shouldShow from ReaderAnnouncementCard
1 parent b37f1bf commit 7d83aa2

File tree

3 files changed

+30
-45
lines changed

3 files changed

+30
-45
lines changed

WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderAnnouncementCardView.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class ReaderAnnouncementCardView @JvmOverloads constructor(
2323
override fun Content() {
2424
AppTheme {
2525
ReaderAnnouncementCard(
26-
shouldShow = true,
2726
items = items.value,
2827
onAnnouncementCardDoneClick = { onDoneClickListener.value?.onDoneClick() }
2928
)

WordPress/src/main/java/org/wordpress/android/ui/reader/views/compose/ReaderAnnouncementCard.kt

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ package org.wordpress.android.ui.reader.views.compose
33
import android.content.res.Configuration
44
import androidx.annotation.DrawableRes
55
import androidx.annotation.StringRes
6-
import androidx.compose.animation.AnimatedVisibility
7-
import androidx.compose.animation.expandIn
8-
import androidx.compose.animation.shrinkOut
96
import androidx.compose.foundation.isSystemInDarkTheme
107
import androidx.compose.foundation.layout.Arrangement
118
import androidx.compose.foundation.layout.Box
@@ -35,57 +32,48 @@ import org.wordpress.android.ui.compose.unit.Margin
3532

3633
@Composable
3734
fun ReaderAnnouncementCard(
38-
shouldShow: Boolean,
3935
items: List<ReaderAnnouncementCardItemData>,
4036
onAnnouncementCardDoneClick: () -> Unit,
4137
) {
4238
val primaryColor = if (isSystemInDarkTheme()) AppColor.White else AppColor.Black
4339
val secondaryColor = if (isSystemInDarkTheme()) AppColor.Black else AppColor.White
44-
AnimatedVisibility(
45-
visible = shouldShow,
46-
enter = expandIn(),
47-
exit = shrinkOut(
48-
shrinkTowards = Alignment.TopCenter,
49-
),
40+
Column(
41+
modifier = Modifier
42+
.fillMaxWidth()
43+
.padding(Margin.ExtraLarge.value),
44+
verticalArrangement = Arrangement.spacedBy(Margin.ExtraLarge.value),
5045
) {
46+
// Title
47+
Text(
48+
text = stringResource(R.string.reader_announcement_card_title),
49+
style = MaterialTheme.typography.labelLarge,
50+
color = primaryColor,
51+
)
52+
// Items
5153
Column(
5254
modifier = Modifier
53-
.fillMaxWidth()
54-
.padding(Margin.ExtraLarge.value),
55-
verticalArrangement = Arrangement.spacedBy(Margin.ExtraLarge.value),
55+
.fillMaxWidth(),
56+
verticalArrangement = Arrangement.spacedBy(Margin.ExtraLarge.value)
57+
) {
58+
items.forEach {
59+
ReaderAnnouncementCardItem(it)
60+
}
61+
}
62+
// Done button
63+
Button(
64+
modifier = Modifier
65+
.fillMaxWidth(),
66+
onClick = { onAnnouncementCardDoneClick() },
67+
elevation = ButtonDefaults.elevation(0.dp),
68+
colors = ButtonDefaults.buttonColors(
69+
backgroundColor = primaryColor,
70+
),
5671
) {
57-
// Title
5872
Text(
59-
text = stringResource(R.string.reader_announcement_card_title),
73+
text = stringResource(id = R.string.reader_btn_done),
74+
color = secondaryColor,
6075
style = MaterialTheme.typography.labelLarge,
61-
color = primaryColor,
6276
)
63-
// Items
64-
Column(
65-
modifier = Modifier
66-
.fillMaxWidth(),
67-
verticalArrangement = Arrangement.spacedBy(Margin.ExtraLarge.value)
68-
) {
69-
items.forEach {
70-
ReaderAnnouncementCardItem(it)
71-
}
72-
}
73-
// Done button
74-
Button(
75-
modifier = Modifier
76-
.fillMaxWidth(),
77-
onClick = { onAnnouncementCardDoneClick() },
78-
elevation = ButtonDefaults.elevation(0.dp),
79-
colors = ButtonDefaults.buttonColors(
80-
backgroundColor = primaryColor,
81-
),
82-
) {
83-
Text(
84-
text = stringResource(id = R.string.reader_btn_done),
85-
color = secondaryColor,
86-
style = MaterialTheme.typography.labelLarge,
87-
)
88-
}
8977
}
9078
}
9179
}
@@ -158,7 +146,6 @@ fun ReaderTagsFeedPostListItemPreview() {
158146
.fillMaxWidth()
159147
) {
160148
ReaderAnnouncementCard(
161-
shouldShow = false,
162149
items = listOf(
163150
ReaderAnnouncementCardItemData(
164151
iconRes = R.drawable.ic_wifi_off_24px,

WordPress/src/main/java/org/wordpress/android/ui/reader/views/compose/tagsfeed/ReaderTagsFeed.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ private fun Loaded(uiState: UiState.Loaded) {
111111
uiState.announcementItem?.let { announcementItem ->
112112
item(key = "reader-announcement-card") {
113113
ReaderAnnouncementCard(
114-
shouldShow = true,
115114
items = announcementItem.items,
116115
onAnnouncementCardDoneClick = announcementItem.onDoneClicked,
117116
)

0 commit comments

Comments
 (0)