-
Notifications
You must be signed in to change notification settings - Fork 130
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
Update the maximum character count for the order badge #13825
base: trunk
Are you sure you want to change the base?
Conversation
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -76,7 +76,7 @@ class MainBottomNavigationView @JvmOverloads constructor( | |||
ordersBadge = getOrCreateBadge(R.id.orders) | |||
ordersBadge.isVisible = false | |||
ordersBadge.backgroundColor = ContextCompat.getColor(context, R.color.color_primary) | |||
ordersBadge.maxCharacterCount = 3 // this includes the plus sign | |||
ordersBadge.maxCharacterCount = 4 // this includes the plus sign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detekt is complaining because this is a magic number. Consider using a constant
Patch:
Index: WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainBottomNavigationView.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainBottomNavigationView.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainBottomNavigationView.kt
--- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainBottomNavigationView.kt (revision ef5228c65ce77c421ce87a32256de86660484d2d)
+++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainBottomNavigationView.kt (date 1742665694598)
@@ -76,7 +76,7 @@
ordersBadge = getOrCreateBadge(R.id.orders)
ordersBadge.isVisible = false
ordersBadge.backgroundColor = ContextCompat.getColor(context, R.color.color_primary)
- ordersBadge.maxCharacterCount = 4 // this includes the plus sign
+ ordersBadge.maxCharacterCount = MAX_CHARACTERS_IN_BADGE // this includes the plus sign
moreMenuBadge = getOrCreateBadge(R.id.moreMenu)
moreMenuBadge.isVisible = false
@@ -156,4 +156,8 @@
private fun NavDestination.matchDestination(@IdRes destId: Int): Boolean =
hierarchy.any { it.id == destId }
+
+ companion object {
+ const val MAX_CHARACTERS_IN_BADGE = 4
+ }
}
Closes: #13783
Description
This PR increases the maximum character count for the order badge from 3 to 4. Previously, counts above 99 were displayed as
99+
. Now, counts above 999 will be displayed as999+
.Steps to reproduce
The easiest method to reproduce is updating the code. You can update the count in
ordersBadge.number = count
in theMainBottomNavigationView line#129
The tests that have been performed
Images/gif
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: