Material Design Team
285fa9de30
Automated g4 rollback of changelist 422930284
...
PiperOrigin-RevId: 422949121
2022-01-20 10:24:30 -05:00
Material Design Team
c52b95d4d5
Automated g4 rollback of changelist 420096508
...
PiperOrigin-RevId: 422930284
2022-01-19 19:34:23 -05:00
conradchen
a74675177f
[Badge] Internal change
...
PiperOrigin-RevId: 420376250
2022-01-12 11:20:32 -05:00
conradchen
bbbeacd64e
[Badge] Refactor Badge state managing logic
...
This CL fixes a couple of badge state related issues. First, it prevents the badges created before restoring instance states from being overwritten by the old instance states. Second, it makes badges reload their default style settings everytime when its being recreated so if the environment has been changed, the default values will reflect the environment change.
This CL also fixes that several attributes were not correctly saved/restored or their default values were not correctly loaded.
Resolves https://github.com/material-components/material-components-android/issues/2032
PiperOrigin-RevId: 420096508
2022-01-06 15:51:50 -05:00
conradchen
b8f2dd53e0
[Badge] Support different locale on badges
...
Resolves https://github.com/material-components/material-components-android/issues/2465
PiperOrigin-RevId: 413738198
2021-12-06 19:32:16 +00:00
Material Design Team
a487c89185
Internal change
...
PiperOrigin-RevId: 412135443
2021-11-29 17:35:39 +00:00
conradchen
5973920cff
[Badge] Update badge position after clearing numbers
...
Resolves https://github.com/material-components/material-components-android/issues/2123
PiperOrigin-RevId: 381337622
2021-06-28 13:03:50 -07:00
hunterstich
b3b12f9051
Automated g4 rollback of changelist 372931550
...
PiperOrigin-RevId: 375483052
2021-05-24 17:11:44 -07:00
conradchen
7adfd93d80
[TooltipDrawable] Adding android:textColor support
...
PiperOrigin-RevId: 374887222
2021-05-20 14:03:30 -07:00
Material Design Team
915336b36c
Automated g4 rollback of changelist 372538097
...
PiperOrigin-RevId: 372931550
2021-05-11 12:55:35 -04:00
hunterstich
bd4914dd8b
[Badge] Support differing offsets for badges with/without text, support badge width and padding in styles.
...
PiperOrigin-RevId: 372538097
2021-05-07 12:25:52 -04:00
connieshi
948738e618
[Badge][Toolbar] Fix badge offset bug when attached and detached from a menu item on a toolbar.
...
Added switch to toggle show/hide edit menu item and added button to increment badge number.
Moved logic to add badgedrawable to onCreateOptionsMenu so that a new badgedrawable is NOT added every time onPrepareOptionsMenu is called (e.g. opening the overflow menu)
Resolves https://github.com/material-components/material-components-android/issues/2129
PiperOrigin-RevId: 365033209
2021-03-25 11:28:18 -04:00
DHM47
492e50f873
[Badge] Updated getBadgeText to return a string representation of the number formatted using system Locale.
...
Resolves https://github.com/material-components/material-components-android/issues/1859
Resolves https://github.com/material-components/material-components-android/pull/1860
GIT_ORIGIN_REV_ID=53544cc548c041c7337a257474abdbb4025cb6f3
PiperOrigin-RevId: 341656773
2020-11-10 15:17:10 -05:00
connieshi
bcb148681b
[Badge] Save and restore visibility on config change.
...
Resolves https://github.com/material-components/material-components-android/issues/1779
PiperOrigin-RevId: 337889750
2020-10-19 11:44:23 -07:00
connieshi
9487c33b8a
Automated g4 rollback of changelist 336347365
...
PiperOrigin-RevId: 336978123
2020-10-15 13:23:56 -07:00
Material Design Team
0f717f8cce
Automated g4 rollback of changelist 336306885
...
PiperOrigin-RevId: 336347365
2020-10-15 13:01:02 -07:00
connieshi
5e35d14c18
[Badge] Update badge to support being anchored to any view in pre 18.
...
In <API18, BadgeDrawable will dynamically 1) wrap the anchor in a FrameLayout and 2) replace the anchor with the FrameLayout in the anchor' view hierarchy. BadgeDrawable will set itself as foreground on the FrameLayout.
If the user does not want BadgeDrawable to manipulate its view hierarchy, the user can pass in an instance of FrameLayout `customBadgeParent` in #attachBadgeDrawable instead.
Labeled BadgeUtils as experimental and removed the RestrictedTo(Scope.Library) annotation.
Updated TopAppBar main demo to show a badge on a toolbar menu item.
PiperOrigin-RevId: 336306885
2020-10-15 12:31:14 -07:00
marianomartin
555356b03f
Internal cleanup
...
PiperOrigin-RevId: 318134343
2020-06-26 14:06:52 -04:00
connieshi
470998c3dd
Change string annotation from @StringRes to @PluralRes for parameter passed to. #setContentDescriptionQuantityStringsResource
...
PiperOrigin-RevId: 314122165
2020-06-01 17:03:28 -04:00
connieshi
eb65ce5b94
Update badge content description to match badge text displayed (when badge number exceeds max badge number).
...
Currently, when badge number exceeds max badge number, badge will display max badge number++ e.g. badge number == 1000, badge displays 999+ but content descriptions say "1000 new notifications".
This cl changes the content description to be "999 and more new notifications"
PiperOrigin-RevId: 309219315
2020-05-01 14:40:16 -04:00
connieshi
facc94d1a0
Fix javadoc issues in BadgeDrawable
...
PiperOrigin-RevId: 300421740
2020-03-13 10:54:24 -04:00
Chaoyang0201
632675e1a8
[BadgeDrawable] add horizontal and vertical offset to control position
...
Resolves https://github.com/material-components/material-components-android/pull/638
Resolves https://github.com/material-components/material-components-android/issues/630
Co-authored-by: wcshi <connieshi@google.com>
GIT_ORIGIN_REV_ID=511c955a11e05fdc0848c74938c4c194da22826e
PiperOrigin-RevId: 275522709
2019-11-01 13:28:23 -07:00
ldjesper
294f12498d
Rename setCornerRadius to setAllCornerSizes
...
PiperOrigin-RevId: 272959729
2019-10-04 20:08:43 -04:00
connieshi
d4d0e7f5e9
Update badge gravity enum values to use Gravity values. Add unit test.
...
PiperOrigin-RevId: 268485092
2019-09-12 14:09:30 -04:00
marianomartin
215a839598
Internal cleanup
...
PiperOrigin-RevId: 267504117
2019-09-12 13:48:16 -04:00
marianomartin
0d4515cb46
Internal cleanup
...
PiperOrigin-RevId: 265971745
2019-08-29 14:59:20 -04:00
connieshi
31d0c08300
Update BadgeDrawble's center coordinate calculation to alleviate anchor content being overlapped by badge content.
...
Also limit on 1 character to be displayed in a round badge, 2+ characters will now be displayed in a pill shaped badge.
PiperOrigin-RevId: 264904269
2019-08-29 10:19:37 -04:00
cketcham
530f3678d6
Add @NonNull and @Nullable annotations
...
PiperOrigin-RevId: 264744296
2019-08-26 11:18:29 -04:00
connieshi
e1248f8771
Update BadgeDrawable's documentation to include information about badge's gravity mode.
...
PiperOrigin-RevId: 259775790
2019-07-24 15:11:50 -04:00
connieshi
0558a36c9a
Add support for configuring badge gravity.
...
PiperOrigin-RevId: 259223232
2019-07-22 12:22:00 -04:00
marianomartin
a648bac7b2
Merge DrawableUtils classes
...
PiperOrigin-RevId: 257022779
2019-07-09 12:56:12 -04:00
marianomartin
164bf0fabd
Internal cleanup
...
PiperOrigin-RevId: 255609320
2019-07-03 14:02:53 -04:00
connieshi
ccc48904e5
Add BadgeDrawable constructor that takes a xml resource.
...
PiperOrigin-RevId: 252709395
2019-06-18 13:15:07 -04:00
connieshi
b09336ef45
Reduce scope of a few BadgeDrawable methods.
...
PiperOrigin-RevId: 252399017
2019-06-18 11:49:54 -04:00
connieshi
4207eec335
Update BadgeDrawable to hold a weak reference to the user specified context.
...
PiperOrigin-RevId: 251697368
2019-06-10 08:58:40 -07:00
connieshi
63fed94c90
s/clearBadgeNumber/clearNumber
...
PiperOrigin-RevId: 251693601
2019-06-10 08:57:49 -07:00
connieshi
6aab297f53
Remove context parameter from BadgeDrawable#getContentDescription(Context)
...
PiperOrigin-RevId: 251492075
2019-06-10 08:55:30 -07:00
connieshi
c7d21aec95
Convenience wrapper method for Drawable#setVisible(boolean, boolean) with the second parameter hardcoded to false.
...
PiperOrigin-RevId: 249981625
2019-05-29 15:43:19 -04:00
connieshi
ddc56c800d
Add convenience method to check if VERSION.SDK_INT < VERSION_CODES.JELLY_BEAN_MR2 in BadgeUtils.
...
PiperOrigin-RevId: 249855393
2019-05-24 14:28:16 -04:00
connieshi
ebaccf5a85
Add support for badgeStyle, a theme level style attribute for customizing the appearance of badges.
...
PiperOrigin-RevId: 249338990
2019-05-24 14:16:22 -04:00
connieshi
488f4873bb
Add note about BadgeDrawable being under development and not supporting the full range of customization expected of a Material Android component. (e.g. themed attributes)
...
PiperOrigin-RevId: 246891342
2019-05-06 19:27:34 -04:00
connieshi
71f0a71cc9
s/StringRes/PluralsRes
...
Add null check before trying to use the PluralsRes containing savedState.contentDescriptionQuantityStrings
PiperOrigin-RevId: 246203433
2019-05-03 10:55:18 -04:00
connieshi
7a4ecb0392
Update TextDrawableHelper's constructor to take a delegate.
...
Update ChipDrawable and BadgeDrwable to pass a delegate when they instantiate TextDrawbleHelper.
PiperOrigin-RevId: 245469285
2019-04-29 15:56:31 -07:00
connieshi
3ad423e6b9
Update BottomNavigationItemView to include BadgeDrawable's content description.
...
Add setter for numberless and numbered badge content descriptions.
PiperOrigin-RevId: 244910418
2019-04-29 15:28:30 -07:00
connieshi
9d73854a97
Add SavedState for BadgeDrawable.
...
PiperOrigin-RevId: 244672502
2019-04-29 15:20:48 -07:00
connieshi
9d488d9208
Begin integrating BadgeDrawable into BottomNavigationView.
...
TODO:
- update javadocs to provide guidance on how to interact with BottomNavigation + Badging.
- Save badge states.
- Support displaying badges when bottom navigation item doesn't show an icon.
PiperOrigin-RevId: 244197244
2019-04-19 21:51:25 -04:00
connieshi
fd9d884acb
Update BadgeDrawable to have public scope.
...
Update #getNumber to return non-negative integers.
Replace internal references to getNumber() with 'number' field when comparing to ICON_BADGE_NUMBER.
PiperOrigin-RevId: 243633143
2019-04-19 16:28:30 -04:00
connieshi
29f132bcd3
Remove unused methods for getting a badge's default background and text color.
...
PiperOrigin-RevId: 243615474
2019-04-19 16:26:59 -04:00
connieshi
ac1b2a0a26
Add javadoc for BadgeDrawable.
...
PiperOrigin-RevId: 243312323
2019-04-19 15:58:20 -04:00
connieshi
94dbf74f08
Add a convenience method to create an instance of BadgeDrawable with default values.
...
PiperOrigin-RevId: 243272352
2019-04-19 15:56:48 -04:00