Skip to content

Commit

Permalink
Merge pull request #70 from Infomaniak/use-stringResource-over-getString
Browse files Browse the repository at this point in the history
Use stringResource instead of accessing getString through a context manually
  • Loading branch information
LunarX authored Sep 20, 2024
2 parents 762612d + b696172 commit 83c1b3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
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

0 comments on commit 83c1b3f

Please sign in to comment.