Skip to content

Commit 151adf1

Browse files
iorgamgabrielgiorga-jpg
authored andcommitted
Bug 1973829 - Replace the TextButtons in Bookmarks to use our reusable component r=android-reviewers,calu,007
Differential Revision: https://phabricator.services.mozilla.com/D261950
1 parent f34a3e4 commit 151adf1

File tree

1 file changed

+22
-34
lines changed

1 file changed

+22
-34
lines changed

mobile/android/fenix/app/src/main/java/org/mozilla/fenix/bookmarks/BookmarksScreen.kt

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,17 @@ import androidx.compose.foundation.lazy.itemsIndexed
3636
import androidx.compose.foundation.selection.toggleable
3737
import androidx.compose.foundation.shape.RoundedCornerShape
3838
import androidx.compose.material3.AlertDialog
39-
import androidx.compose.material3.ButtonDefaults
4039
import androidx.compose.material3.CircularProgressIndicator
4140
import androidx.compose.material3.ExperimentalMaterial3Api
4241
import androidx.compose.material3.Icon
4342
import androidx.compose.material3.IconButton
43+
import androidx.compose.material3.MaterialTheme
4444
import androidx.compose.material3.Scaffold
4545
import androidx.compose.material3.SnackbarDuration
4646
import androidx.compose.material3.SnackbarHost
4747
import androidx.compose.material3.SnackbarHostState
4848
import androidx.compose.material3.SnackbarResult
4949
import androidx.compose.material3.Text
50-
import androidx.compose.material3.TextButton
5150
import androidx.compose.material3.TopAppBar
5251
import androidx.compose.material3.TopAppBarDefaults
5352
import androidx.compose.runtime.Composable
@@ -92,6 +91,8 @@ import mozilla.components.browser.state.search.SearchEngine
9291
import mozilla.components.compose.base.Divider
9392
import mozilla.components.compose.base.annotation.FlexibleWindowLightDarkPreview
9493
import mozilla.components.compose.base.button.FloatingActionButton
94+
import mozilla.components.compose.base.button.PrimaryButton
95+
import mozilla.components.compose.base.button.TextButton
9596
import mozilla.components.compose.base.textfield.TextField
9697
import mozilla.components.compose.base.textfield.TextFieldColors
9798
import mozilla.components.compose.base.theme.AcornTheme
@@ -744,21 +745,17 @@ private fun WarnDialog(
744745
onDismissRequest = { store.dispatch(OpenTabsConfirmationDialogAction.CancelTapped) },
745746
confirmButton = {
746747
TextButton(
748+
text = stringResource(R.string.open_all_warning_confirm),
747749
onClick = { store.dispatch(OpenTabsConfirmationDialogAction.ConfirmTapped) },
748-
) {
749-
Text(
750-
text = stringResource(R.string.open_all_warning_confirm),
751-
)
752-
}
750+
upperCaseText = false,
751+
)
753752
},
754753
dismissButton = {
755754
TextButton(
755+
text = stringResource(R.string.open_all_warning_cancel),
756756
onClick = { store.dispatch(OpenTabsConfirmationDialogAction.CancelTapped) },
757-
) {
758-
Text(
759-
text = stringResource(R.string.open_all_warning_cancel),
760-
)
761-
}
757+
upperCaseText = false,
758+
)
762759
},
763760
)
764761
}
@@ -778,21 +775,15 @@ private fun AlertDialogDeletionWarning(
778775
onDismissRequest = onCancelTapped,
779776
confirmButton = {
780777
TextButton(
778+
text = stringResource(R.string.bookmark_menu_delete_button),
781779
onClick = onDeleteTapped,
782-
) {
783-
Text(
784-
text = stringResource(R.string.bookmark_menu_delete_button).uppercase(),
785-
)
786-
}
780+
)
787781
},
788782
dismissButton = {
789783
TextButton(
784+
text = stringResource(R.string.bookmark_delete_negative),
790785
onClick = onCancelTapped,
791-
) {
792-
Text(
793-
text = stringResource(R.string.bookmark_delete_negative).uppercase(),
794-
)
795-
}
786+
)
796787
},
797788
)
798789
}
@@ -983,21 +974,18 @@ private fun EmptyList(
983974
textAlign = TextAlign.Center,
984975
)
985976
if (state is EmptyListState.NotAuthenticated) {
986-
TextButton(
977+
PrimaryButton(
978+
text = stringResource(R.string.bookmark_empty_list_guest_cta),
987979
onClick = { dispatcher(SignIntoSyncClicked) },
988-
colors = ButtonDefaults.buttonColors(containerColor = FirefoxTheme.colors.actionPrimary),
989-
shape = RoundedCornerShape(4.dp),
980+
textColor = MaterialTheme.colorScheme.onPrimary,
990981
modifier = Modifier
991982
.heightIn(36.dp)
992-
.fillMaxWidth(),
993-
) {
994-
Text(
995-
text = stringResource(R.string.bookmark_empty_list_guest_cta),
996-
color = FirefoxTheme.colors.textOnColorPrimary,
997-
style = FirefoxTheme.typography.button,
998-
textAlign = TextAlign.Center,
999-
)
1000-
}
983+
.fillMaxWidth()
984+
.background(
985+
color = MaterialTheme.colorScheme.primary,
986+
shape = RoundedCornerShape(4.dp),
987+
),
988+
)
1001989
}
1002990
}
1003991
}

0 commit comments

Comments
 (0)