For #24252 - Rename destructive attribute to textWarning

This commit is contained in:
Gabriel Luong 2022-03-13 00:39:00 -05:00 committed by mergify[bot]
parent a59d319eb0
commit a6c8f8b313
17 changed files with 26 additions and 23 deletions

View File

@ -45,7 +45,7 @@ class SwipeToDeleteCallback(
) {
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
val icon = AppCompatResources.getDrawable(recyclerView.context, R.drawable.ic_delete)
icon?.setTint(recyclerView.context.getColorFromAttr(R.attr.destructive))
icon?.setTint(recyclerView.context.getColorFromAttr(R.attr.textWarning))
val backgroundDrawable = when {
viewHolder is TabInCollectionViewHolder && viewHolder.isLastItem -> {

View File

@ -146,7 +146,7 @@ class CollectionItemMenu(
SimpleBrowserMenuItem(
context.getString(R.string.collection_delete),
textColorResource = ThemeManager.resolveAttribute(R.attr.destructive, context)
textColorResource = ThemeManager.resolveAttribute(R.attr.textWarning, context)
) {
onItemTapped.invoke(Item.DeleteCollection)
}

View File

@ -187,7 +187,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
menu.findItem(R.id.delete_bookmarks_multi_select).title =
SpannableString(getString(R.string.bookmark_menu_delete_button)).apply {
setTextColor(requireContext(), R.attr.destructive)
setTextColor(requireContext(), R.attr.textWarning)
}
}
}

View File

@ -80,7 +80,7 @@ class BookmarkItemMenu(
},
TextMenuCandidate(
text = context.getString(R.string.bookmark_menu_delete_button),
textStyle = TextStyle(color = context.getColorFromAttr(R.attr.destructive))
textStyle = TextStyle(color = context.getColorFromAttr(R.attr.textWarning))
) {
onItemTapped.invoke(Item.Delete)
}

View File

@ -162,7 +162,7 @@ class DownloadFragment : LibraryPageFragment<DownloadItem>(), UserInteractionHan
menu.findItem(R.id.delete_downloads_multi_select)?.title =
SpannableString(getString(R.string.download_delete_item_1)).apply {
setTextColor(requireContext(), R.attr.destructive)
setTextColor(requireContext(), R.attr.textWarning)
}
}

View File

@ -34,7 +34,7 @@ class DownloadItemMenu(
TextMenuCandidate(
text = context.getString(R.string.history_delete_item),
textStyle = TextStyle(
color = context.getColorFromAttr(R.attr.destructive)
color = context.getColorFromAttr(R.attr.textWarning)
)
) {
onItemTapped.invoke(Item.Delete)

View File

@ -177,7 +177,7 @@ class HistoryFragment : LibraryPageFragment<History>(), UserInteractionHandler {
menu.findItem(R.id.share_history_multi_select)?.isVisible = true
menu.findItem(R.id.delete_history_multi_select)?.title =
SpannableString(getString(R.string.bookmark_menu_delete_button)).apply {
setTextColor(requireContext(), R.attr.destructive)
setTextColor(requireContext(), R.attr.textWarning)
}
} else {
inflater.inflate(R.menu.history_menu, menu)

View File

@ -109,7 +109,7 @@ class HistoryMetadataGroupFragment :
menu.findItem(R.id.delete_history_multi_select)?.let { deleteItem ->
deleteItem.title = SpannableString(deleteItem.title).apply {
setTextColor(requireContext(), R.attr.destructive)
setTextColor(requireContext(), R.attr.textWarning)
}
}
} else {

View File

@ -56,7 +56,7 @@ class RecentlyClosedFragment : LibraryPageFragment<RecoverableTab>(), UserIntera
inflater.inflate(R.menu.history_select_multi, menu)
menu.findItem(R.id.delete_history_multi_select)?.let { deleteItem ->
deleteItem.title = SpannableString(deleteItem.title)
.apply { setTextColor(requireContext(), R.attr.destructive) }
.apply { setTextColor(requireContext(), R.attr.textWarning) }
}
} else {
inflater.inflate(R.menu.library_menu, menu)

View File

@ -62,12 +62,12 @@ class CreditCardEditorView(
binding.cardNumberLayout.setErrorTextColor(
ColorStateList.valueOf(
binding.root.context.getColorFromAttr(R.attr.destructive)
binding.root.context.getColorFromAttr(R.attr.textWarning)
)
)
binding.nameOnCardLayout.setErrorTextColor(
ColorStateList.valueOf(
binding.root.context.getColorFromAttr(R.attr.destructive)
binding.root.context.getColorFromAttr(R.attr.textWarning)
)
)
@ -128,7 +128,7 @@ class CreditCardEditorView(
binding.cardNumberLayout.error =
binding.root.context.getString(R.string.credit_cards_number_validation_error_message)
binding.cardNumberTitle.setTextColor(binding.root.context.getColorFromAttr(R.attr.destructive))
binding.cardNumberTitle.setTextColor(binding.root.context.getColorFromAttr(R.attr.textWarning))
}
if (binding.nameOnCardInput.text.toString().isNotBlank()) {
@ -139,7 +139,7 @@ class CreditCardEditorView(
binding.nameOnCardLayout.error =
binding.root.context.getString(R.string.credit_cards_name_on_card_validation_error_message)
binding.nameOnCardTitle.setTextColor(binding.root.context.getColorFromAttr(R.attr.destructive))
binding.nameOnCardTitle.setTextColor(binding.root.context.getColorFromAttr(R.attr.textWarning))
}
return isValid

View File

@ -40,7 +40,7 @@ class SearchEngineMenu(
items.add(
SimpleBrowserMenuItem(
context.getString(R.string.search_engine_delete),
textColorResource = ThemeManager.resolveAttribute(R.attr.destructive, context)
textColorResource = ThemeManager.resolveAttribute(R.attr.textWarning, context)
) {
onItemTapped.invoke(Item.Delete)
}

View File

@ -85,7 +85,7 @@ class TouchCallback(
val icon = recyclerView.context.getDrawableWithTint(
R.drawable.ic_delete,
recyclerView.context.getColorFromAttr(R.attr.destructive)
recyclerView.context.getColorFromAttr(R.attr.textWarning)
)!!
val background = AppCompatResources.getDrawable(
recyclerView.context,

View File

@ -11,6 +11,6 @@
android:background="?attr/layer1"
android:clickable="true"
android:focusable="true"
app:findInPageNoMatchesTextColor="?attr/destructive"
app:findInPageNoMatchesTextColor="?attr/textWarning"
app:findInPageButtonsTint="?attr/textPrimary"
app:findInPageResultCountTextColor="?attr/textPrimary" />

View File

@ -27,6 +27,8 @@
<attr name="textSecondary" format="reference" />
<!-- Disabled text -->
<attr name="textDisabled" format="reference" />
<!-- Warning text -->
<attr name="textWarning" format="reference"/>
<!-- Small heading, Text link -->
<attr name="textAccent" format="reference" />
<!-- Action Primary text -->
@ -53,7 +55,6 @@
<attr name="snackbar" format="reference" />
<attr name="neutral" format="reference" />
<attr name="neutralFaded" format="reference" />
<attr name="destructive" format="reference"/>
<attr name="preferenceSectionHeader" format="reference"/>
<!-- Color used in DefaultToolbarMenu for buttons placed at the end of menu items -->

View File

@ -55,6 +55,8 @@
<item name="textSecondary">@color/fx_mobile_text_color_secondary</item>
<!-- Disabled text -->
<item name="textDisabled">@color/fx_mobile_text_color_disabled</item>
<!-- Warning text -->
<item name="textWarning">@color/fx_mobile_text_color_warning</item>
<!-- Small heading, Text link -->
<item name="textAccent">@color/fx_mobile_text_color_accent</item>
<!-- Action Primary text -->
@ -88,7 +90,6 @@
<item name="accentHighContrast">@color/accent_high_contrast_normal_theme</item>
<item name="neutral">@color/neutral_normal_theme</item>
<item name="neutralFaded">@color/neutral_faded_normal_theme</item>
<item name="destructive">@color/fx_mobile_text_color_warning</item>
<item name="accentUsedOnDarkBackground">@color/fx_mobile_text_color_accent</item>
<item name="toolbarStartGradient">@color/fx_mobile_layer_color_1</item>
<item name="toolbarCenterGradient">@color/fx_mobile_layer_color_1</item>
@ -250,6 +251,8 @@
<item name="textSecondary">@color/fx_mobile_private_text_color_secondary</item>
<!-- Disabled text -->
<item name="textDisabled">@color/fx_mobile_private_text_color_disabled</item>
<!-- Warning text -->
<item name="textWarning">@color/fx_mobile_private_text_color_warning</item>
<!-- Small heading, Text link -->
<item name="textAccent">@color/fx_mobile_private_text_color_accent</item>
<!-- Action Primary text -->
@ -281,7 +284,6 @@
<item name="accentHighContrast">@color/accent_high_contrast_private_theme</item>
<item name="neutral">@color/neutral_private_theme</item>
<item name="neutralFaded">@color/neutral_faded_private_theme</item>
<item name="destructive">@color/fx_mobile_private_text_color_warning</item>
<item name="accentUsedOnDarkBackground">@color/accent_high_contrast_private_theme</item>
<item name="toolbarStartGradient">@color/fx_mobile_private_layer_color_4_start</item>
<item name="toolbarCenterGradient">@color/fx_mobile_private_layer_color_4_center</item>

View File

@ -38,7 +38,7 @@ class BookmarkItemMenuTest {
val deleteItem = menu.menuItems(BookmarkNodeType.SEPARATOR).last()
assertEquals("Delete", deleteItem.text)
assertEquals(
TextStyle(color = context.getColorFromAttr(R.attr.destructive)),
TextStyle(color = context.getColorFromAttr(R.attr.textWarning)),
deleteItem.textStyle
)

View File

@ -167,7 +167,7 @@ class CreditCardEditorViewTest {
assertNotNull(fragmentCreditCardEditorBinding.cardNumberLayout.error)
assertEquals(
fragmentCreditCardEditorBinding.cardNumberLayout.errorCurrentTextColors,
fragmentCreditCardEditorBinding.root.context.getColorFromAttr(R.attr.destructive)
fragmentCreditCardEditorBinding.root.context.getColorFromAttr(R.attr.textWarning)
)
verify(exactly = 0) {
@ -192,7 +192,7 @@ class CreditCardEditorViewTest {
assertNotNull(fragmentCreditCardEditorBinding.cardNumberLayout.error)
assertEquals(
fragmentCreditCardEditorBinding.cardNumberLayout.errorCurrentTextColors,
fragmentCreditCardEditorBinding.root.context.getColorFromAttr(R.attr.destructive)
fragmentCreditCardEditorBinding.root.context.getColorFromAttr(R.attr.textWarning)
)
verify(exactly = 0) {
@ -234,7 +234,7 @@ class CreditCardEditorViewTest {
assertNotNull(fragmentCreditCardEditorBinding.nameOnCardLayout.error)
assertEquals(
fragmentCreditCardEditorBinding.nameOnCardLayout.errorCurrentTextColors,
fragmentCreditCardEditorBinding.root.context.getColorFromAttr(R.attr.destructive)
fragmentCreditCardEditorBinding.root.context.getColorFromAttr(R.attr.textWarning)
)
verify(exactly = 0) {