B4A Library NotificationBadge - dont get confused with the android Notifications...

This is a wrap for this Github project.


sample.gif



NotificationBadge
Author:
DonManfred (wrapper)
Version: 1
NotificationBadge
Fields:

  • ba As anywheresoftware.b4a.BA
Methods:
  • DesignerCreateView (base As anywheresoftware.b4a.objects.PanelWrapper, lw As anywheresoftware.b4a.objects.LabelWrapper, props As anywheresoftware.b4a.objects.collections.Map) As void
  • show (text As java.lang.String) As void
  • IsInitialized As boolean
  • Initialize (ba As anywheresoftware.b4a.BA, EventName As java.lang.String) As void
  • BringToFront As void
  • SetLayout (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
  • SendToBack As void
  • SetVisibleAnimated (arg0 As int, arg1 As boolean) As void
  • RemoveView As void
  • Invalidate3 (arg0 As int, arg1 As int, arg2 As int, arg3 As int) As void
  • clear As void
  • Invalidate2 (arg0 As android.graphics.Rect) As void
  • SetColorAnimated (arg0 As int, arg1 As int, arg2 As int) As void
  • SetBackgroundImage (arg0 As android.graphics.Bitmap) As void
  • Invalidate As void
  • SetLayoutAnimated (arg0 As int, arg1 As int, arg2 As int, arg3 As int, arg4 As int) As void
  • RequestFocus As boolean
Properties:
  • Left As int
  • Background As android.graphics.drawable.Drawable
  • AnimationEnabled As boolean
  • Parent As java.lang.Object [read only]
  • Color As int [write only]
  • TextSize As float [write only]
  • Enabled As boolean
  • Text As java.lang.String [write only]
  • BadgeBackgroundDrawable As android.graphics.drawable.Drawable [write only]
  • BadgeBackgroundResource As java.lang.String [write only]
  • MaxTextLength As int [write only]
  • Number As int [write only]
  • Top As int
  • Visible As boolean
  • Padding As int[]
  • Height As int
  • TextColor As int
  • Tag As java.lang.Object
  • Width As int
 

Attachments

  • NotificationBadgeV1.0.zip
    10 KB · Views: 549
  • res.NotificationBadge.zip
    2.5 KB · Views: 515
Last edited:

DonManfred

Expert
Licensed User
Longtime User
I wish i can do but i really dont know how to do it.
Open the designer, place the CUSTOMVIEW over a normal view.
in your app load the layout and then call objectname.Text = "25"

Maybe you should go over the beginners guide again.

It is decribed how to create a layout or how to add a customview to the layout.
 

ykucuk

Well-Known Member
Licensed User
Longtime User
Open the designer, place the CUSTOMVIEW over a normal view.
in your app load the layout and then call objectname.Text = "25"

Maybe you should go over the beginners guide again.

It is decribed how to create a layout or how to add a customview to the layout.
Thank you.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Don i have this message:

** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 32)
Activity.LoadLayout("1")
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at b4a.example.main._activity_create(main.java:371)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at b4a.example.main.afterFirstLayout(main.java:102)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 14 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:2558)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:4364)
at android.content.res.Resources.getLayout(Resources.java:2372)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at com.nex3z.notificationbadge.NotificationBadge.<init>(NotificationBadge.java:43)
at de.donmanfred.NotificationBadgeWrapper._initialize(NotificationBadgeWrapper.java:77)
... 17 more

Maybe you forget Resource ( android.content.res.Resources$NotFoundException: Resource ID #0x0 )
Thank you
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Don the FontAwesome dont work.

upload_2017-1-5_13-59-22.png


As you see in movie #11 in Notification your right also if i insert Propery TypeFace FontAwesome this dont work.
Can you add this property ?
So will be fantastic and more that wrapper.
Thank anyway for this beatiful library :D
 

Zolivem

New Member
Licensed User
Longtime User
Hi,
I implemented this notifcation badge in an app (the badge is displayed on a menu button as the example you provided), it works well on few devices (samsung galaxy S4, samsung galaxy tab 2 for instance) but on few other devices (ex OnePlus One),the badge is displayed under the menu button. I tried to use BringToFront method but it didn't fix the problem (in this case, the badge disappeared).
Do you know from what the pb could comming from ?
 
Top