Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use stringResource instead of accessing getString through a context manually #70

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import com.infomaniak.swisstransfer.ui.theme.Dimens
import com.infomaniak.swisstransfer.ui.theme.Margin
Expand All @@ -38,9 +38,6 @@ fun EmptyState(
@StringRes description: Int,
modifier: Modifier = Modifier,
) {

val context = LocalContext.current

Column(
modifier = modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
Expand All @@ -49,13 +46,13 @@ fun EmptyState(
Image(imageVector = icon, contentDescription = null)

Text(
text = context.getString(title),
text = stringResource(title),
style = SwissTransferTheme.typography.specificMedium22,
modifier = Modifier.padding(PaddingValues(top = Margin.XLarge)),
)

Text(
text = context.getString(description),
text = stringResource(description),
textAlign = TextAlign.Center,
style = SwissTransferTheme.typography.bodyRegular,
color = SwissTransferTheme.colors.secondaryTextColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.constraintlayout.compose.ConstraintLayout
import com.infomaniak.swisstransfer.R
Expand All @@ -42,7 +43,7 @@ fun ReceivedEmptyFab() {
val (text, icon, fab) = createRefs()

Text(
text = LocalContext.current.getString(R.string.firstTransferDescription),
text = stringResource(R.string.firstTransferDescription),
style = SwissTransferTheme.typography.bodyRegular,
color = SwissTransferTheme.colors.secondaryTextColor,
modifier = Modifier
Expand Down
Loading