Poll history : use localazy strings

This commit is contained in:
ganfra 2023-12-12 14:36:07 +01:00
parent 7307e0fb13
commit a2c5cdf483
9 changed files with 81 additions and 66 deletions

View file

@ -38,10 +38,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.features.poll.api.pollcontent.PollContentView
import io.element.android.features.poll.impl.R
import io.element.android.features.poll.impl.history.model.PollHistoryFilter
import io.element.android.features.poll.impl.history.model.PollHistoryItem
import io.element.android.libraries.designsystem.components.button.BackButton
@ -55,6 +57,7 @@ import io.element.android.libraries.designsystem.theme.components.Surface
import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.designsystem.theme.components.TopAppBar
import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.ui.strings.CommonStrings
import kotlinx.collections.immutable.ImmutableList
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
@ -84,7 +87,7 @@ fun PollHistoryView(
TopAppBar(
title = {
Text(
text = "Polls", // TODO Polls: Localazy
text = stringResource(R.string.screen_polls_history_title),
style = ElementTheme.typography.aliasScreenTitle,
)
},
@ -149,7 +152,7 @@ private fun PollHistoryFilterButtons(
count = PollHistoryFilter.entries.size,
selected = activeFilter == filter,
onClick = { onFilterSelected(filter) },
text = filter.name
text = stringResource(filter.stringResource),
)
}
}
@ -184,7 +187,7 @@ private fun PollHistoryList(
if (hasMoreToLoad) {
item {
Button(
text = "Load more",
text = stringResource(CommonStrings.action_load_more),
showProgress = isLoading,
onClick = onLoadMore,
modifier = Modifier.padding(vertical = 24.dp),

View file

@ -16,7 +16,9 @@
package io.element.android.features.poll.impl.history.model
enum class PollHistoryFilter {
ONGOING,
PAST,
import io.element.android.features.poll.impl.R
enum class PollHistoryFilter(val stringResource: Int) {
ONGOING(R.string.screen_polls_history_filter_ongoing),
PAST(R.string.screen_polls_history_filter_past),
}

View file

@ -11,4 +11,9 @@
<string name="screen_edit_poll_delete_confirmation">"Are you sure you want to delete this poll?"</string>
<string name="screen_edit_poll_delete_confirmation_title">"Delete Poll"</string>
<string name="screen_edit_poll_title">"Edit poll"</string>
<string name="screen_polls_history_empty_ongoing">"Can\'t find any ongoing polls."</string>
<string name="screen_polls_history_empty_past">"Can\'t find any past polls."</string>
<string name="screen_polls_history_filter_ongoing">"Ongoing"</string>
<string name="screen_polls_history_filter_past">"Past"</string>
<string name="screen_polls_history_title">"Polls"</string>
</resources>