Skip to content

โœ…โœ๏ธ๐Ÿ“Œ Badge TextView for Android to draw numbers on a TextView which is customizable and scalable. Displays numbers either as circle or rounded rectangle depending on badge count and selected threshold to transform from circle to rounded rectangle.

Notifications You must be signed in to change notification settings

SmartToolFactory/BadgeTextView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Badge TextView

Badge TextView for Android that like the draws number on a badge which can be customizable and scalable by almost retaining it's same shape. It displays numbers either as circle or rounded rectangle depending on badge count and selected threshold to transform from circle to rounded rectangle

Default Debug Increment

Customizable features

  • Set threshold badge_circle_threshold to change shape from circle to rounded shape. For better results select between 1 and 2

  • Set maximum number badge_max_number. After this number it's displayed with +. For instance if you set maximum number to 99, after 99 it looks as 99+

  • Set radius ratio badge_round_corner_ratio for rounded rectangle, it's .5f by default change it to any number between 1 and 0

Shadow

  • Set shadow by setting badge_shadow_radius to any number greater than 0
  • Change shadow color with badge_shadow_color
  • Change shadow x and/or y offset with badge_shadow_offset_x, badge_shadow_offset_y

Border

  • Set border by setting badge_border_width to any number greater than 0
  • Set border color with badge_border_color

If you wish to change drawable area at top and right of the view verticalSpaceAroundText = (textHeight * .12f + 6 + paddingVertical).toInt() as you wish

To change horizontal area set horizontalSpaceAroundText = ((textHeight * .24f) + 8 + paddingHorizontal).toInt() any function in onMeasure

TODOs:

  • Add Compose style Scope and Modifier to set properties using these interfaces
  • Add pin mode to display smaller circle with no text as WhatsApp status notification.

About

โœ…โœ๏ธ๐Ÿ“Œ Badge TextView for Android to draw numbers on a TextView which is customizable and scalable. Displays numbers either as circle or rounded rectangle depending on badge count and selected threshold to transform from circle to rounded rectangle.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages