Jul 29, 2022 Replies: 13 I took the original Badger code from @Erel and modified it to create a new view. I spend a lot of time in creating views, some views i need by my self, but some views not and to create a high quality view cost a lot of time. If you want to support me, then you can do it here by Paypal or with a coffee. TextAnimation_Slide TextAnimation_Growth TextAnimation_FadeIn B4X: Dim BadgeProperties As AS_Badges_BadgeProperties = AS_Badges1.BadgeProperties BadgeProperties.BackgroundColor = xui.Color_Red BadgeProperties.Orientation = AS_Badges1.Orientation_TopLeft AS_Badges1.SetBadge2(xlbl_Label,8,BadgeProperties) ASBadges Author: Alexander Stolte Version: 1.01 AS_Badges Functions: Class_Globals As String CreateAS_Badges_BadgeProperties (BackgroundColor As Int, TextColor As Int, xFont As B4XFont, Orientation As String) As AS_Badges_BadgeProperties GetBadgeCounter (view As B4XView) As Int Gets the Count of the badge on this view getBadgeProperties As AS_Badges_BadgeProperties getFadeInDuration As Long Default: 250 getOrientation_BottomLeft As String getOrientation_BottomRight As String getOrientation_TopLeft As String getOrientation_TopRight As String getRadius As Float getTextAnimation As String getTextAnimation_FadeIn As String getTextAnimation_Growth As String getTextAnimation_Slide As String getTextDuration As Long Default: 250 Initialize As String IsInitialized As Boolean Tests whether the object has been initialized. SetBadge (View As B4XView, Badge As Int) As String SetBadge2 (View As B4XView, Badge As Int, Properties As AS_Badges_BadgeProperties) As String setBadgeProperties (Properties As AS_Badges_BadgeProperties) As String setFadeInDuration (Duration As Long) As String setRadius (Radius As Float) As String setTextAnimation (AnimationName As String) As String setTextDuration (Duration As Long) As String Properties: BadgeProperties As AS_Badges_BadgeProperties FadeInDuration As Long Default: 250 Orientation_BottomLeft As String [read only] Orientation_BottomRight As String [read only] Orientation_TopLeft As String [read only] Orientation_TopRight As String [read only] Radius As Float TextAnimation As String TextAnimation_FadeIn As String [read only] TextAnimation_Growth As String [read only] TextAnimation_Slide As String [read only] TextDuration As Long Default: 250 AS_Badges_BadgeProperties Fields: BackgroundColor As Int IsInitialized As Boolean Tests whether the object has been initialized. Orientation As String TextColor As Int xFont As B4XFont Functions: Initialize Initializes the fields to their default value. Changelog 1.00 Release 1.01 (read more) B4J BugFix - The text animation now no longer slips outside the badge Add get and set TextAnimation - Various text change animations Default: TextAnimation_Slide TextAnimation_Slide - The old text slides out to the right TextAnimation_Growth - The font grows animated TextAnimation_FadeIn - The alpha of the new text is increased animatedly 1.02 (read more) Breaking Change - Initialize needs now a CallBack and a EventName Add Event Click 1.03 (read more) BugFixes Add set AutoRemove - Removes the badge if the value is 0 Default: True 1.04 Property descriptions added Add get and set xGap and yGap - This allows you to change the position of the badge. e.g. position it further to the left or higher up so that it matches the design. Default: 0 Github: github.com/StolteX/AS_Badges Have Fun Attachments AS Badges Example.zip AS Badges Example.zip 10 KB · Views: 802 AS_Badges.b4xlib AS_Badges.b4xlib 3.1 KB · Views: 534 Last edited: Jan 29, 2025 Click to expand...
I took the original Badger code from @Erel and modified it to create a new view. I spend a lot of time in creating views, some views i need by my self, but some views not and to create a high quality view cost a lot of time. If you want to support me, then you can do it here by Paypal or with a coffee. TextAnimation_Slide TextAnimation_Growth TextAnimation_FadeIn B4X: Dim BadgeProperties As AS_Badges_BadgeProperties = AS_Badges1.BadgeProperties BadgeProperties.BackgroundColor = xui.Color_Red BadgeProperties.Orientation = AS_Badges1.Orientation_TopLeft AS_Badges1.SetBadge2(xlbl_Label,8,BadgeProperties) ASBadges Author: Alexander Stolte Version: 1.01 AS_Badges Functions: Class_Globals As String CreateAS_Badges_BadgeProperties (BackgroundColor As Int, TextColor As Int, xFont As B4XFont, Orientation As String) As AS_Badges_BadgeProperties GetBadgeCounter (view As B4XView) As Int Gets the Count of the badge on this view getBadgeProperties As AS_Badges_BadgeProperties getFadeInDuration As Long Default: 250 getOrientation_BottomLeft As String getOrientation_BottomRight As String getOrientation_TopLeft As String getOrientation_TopRight As String getRadius As Float getTextAnimation As String getTextAnimation_FadeIn As String getTextAnimation_Growth As String getTextAnimation_Slide As String getTextDuration As Long Default: 250 Initialize As String IsInitialized As Boolean Tests whether the object has been initialized. SetBadge (View As B4XView, Badge As Int) As String SetBadge2 (View As B4XView, Badge As Int, Properties As AS_Badges_BadgeProperties) As String setBadgeProperties (Properties As AS_Badges_BadgeProperties) As String setFadeInDuration (Duration As Long) As String setRadius (Radius As Float) As String setTextAnimation (AnimationName As String) As String setTextDuration (Duration As Long) As String Properties: BadgeProperties As AS_Badges_BadgeProperties FadeInDuration As Long Default: 250 Orientation_BottomLeft As String [read only] Orientation_BottomRight As String [read only] Orientation_TopLeft As String [read only] Orientation_TopRight As String [read only] Radius As Float TextAnimation As String TextAnimation_FadeIn As String [read only] TextAnimation_Growth As String [read only] TextAnimation_Slide As String [read only] TextDuration As Long Default: 250 AS_Badges_BadgeProperties Fields: BackgroundColor As Int IsInitialized As Boolean Tests whether the object has been initialized. Orientation As String TextColor As Int xFont As B4XFont Functions: Initialize Initializes the fields to their default value. Changelog 1.00 Release 1.01 (read more) B4J BugFix - The text animation now no longer slips outside the badge Add get and set TextAnimation - Various text change animations Default: TextAnimation_Slide TextAnimation_Slide - The old text slides out to the right TextAnimation_Growth - The font grows animated TextAnimation_FadeIn - The alpha of the new text is increased animatedly 1.02 (read more) Breaking Change - Initialize needs now a CallBack and a EventName Add Event Click 1.03 (read more) BugFixes Add set AutoRemove - Removes the badge if the value is 0 Default: True 1.04 Property descriptions added Add get and set xGap and yGap - This allows you to change the position of the badge. e.g. position it further to the left or higher up so that it matches the design. Default: 0 Github: github.com/StolteX/AS_Badges Have Fun
Rubsanpe Active Member Licensed User Longtime User Jul 29, 2022 #3 You really do a fantastic job. Donation sent for your great work. Rubén
Alexander Stolte Expert Licensed User Longtime User Jul 30, 2022 #5 Update 1.01 B4J BugFix - The text animation now no longer slips outside the badge Add get and set TextAnimation - Various text change animations Default: TextAnimation_Slide TextAnimation_Slide - The old text slides out to the right TextAnimation_Growth - The font grows animated TextAnimation_FadeIn - The alpha of the new text is increased animatedly TextAnimation_Slide TextAnimation_Growth TextAnimation_FadeIn
Update 1.01 B4J BugFix - The text animation now no longer slips outside the badge Add get and set TextAnimation - Various text change animations Default: TextAnimation_Slide TextAnimation_Slide - The old text slides out to the right TextAnimation_Growth - The font grows animated TextAnimation_FadeIn - The alpha of the new text is increased animatedly TextAnimation_Slide TextAnimation_Growth TextAnimation_FadeIn
Alexander Stolte Expert Licensed User Longtime User Aug 3, 2022 #6 Update 1.02 Breaking Change - Initialize needs now a CallBack and a EventName Add Event Click Initialize needs now a CallBack and a EventName B4X: AS_Badges1.Initialize(Me,"Badges1") Click Event You can do something like this B4X: Private Sub Badges1_Click (Parent As B4XView) AS_Badges1.SetBadge(Parent,AS_Badges1.GetBadgeCounter(Parent) +1) End Sub
Update 1.02 Breaking Change - Initialize needs now a CallBack and a EventName Add Event Click Initialize needs now a CallBack and a EventName B4X: AS_Badges1.Initialize(Me,"Badges1") Click Event You can do something like this B4X: Private Sub Badges1_Click (Parent As B4XView) AS_Badges1.SetBadge(Parent,AS_Badges1.GetBadgeCounter(Parent) +1) End Sub
jbaillie2461 Member Oct 31, 2022 #7 Quick Question how do you hide the Badget when the click de selects something from the cart
jbaillie2461 Member Oct 31, 2022 #8 badget is 1 know user take item out of cart and want to set it to zero cant do
mcqueccu Expert Licensed User Longtime User Oct 31, 2022 #10 jbaillie2461 said: Or hide the badge Click to expand... Start a new Thread and form your question well
jbaillie2461 said: Or hide the badge Click to expand... Start a new Thread and form your question well
Alexander Stolte Expert Licensed User Longtime User Oct 31, 2022 #11 jbaillie2461 said: Quick Question how do you hide the Badget when the click de selects something from the cart Click to expand... Set the value to 0 if you need more help, please start a new thread with more infos.
jbaillie2461 said: Quick Question how do you hide the Badget when the click de selects something from the cart Click to expand... Set the value to 0 if you need more help, please start a new thread with more infos.
jbaillie2461 Member Oct 31, 2022 #12 I found the issue I was re intilizing the badge each time instead of setting it thank for the reply lovely compnent
I found the issue I was re intilizing the badge each time instead of setting it thank for the reply lovely compnent
Alexander Stolte Expert Licensed User Longtime User Oct 11, 2023 #13 Update 1.03 BugFixes Add set AutoRemove - Removes the badge if the value is 0 Default: True B4X: AS_Badges1.AutoRemove = False AS_Badges1.SetBadge(xlbl_Label,0)
Update 1.03 BugFixes Add set AutoRemove - Removes the badge if the value is 0 Default: True B4X: AS_Badges1.AutoRemove = False AS_Badges1.SetBadge(xlbl_Label,0)
Alexander Stolte Expert Licensed User Longtime User May 6, 2024 #14 Update 1.04 Property descriptions added Add get and set xGap and yGap - This allows you to change the position of the badge. e.g. position it further to the left or higher up so that it matches the design. Default: 0
Update 1.04 Property descriptions added Add get and set xGap and yGap - This allows you to change the position of the badge. e.g. position it further to the left or higher up so that it matches the design. Default: 0