Bug? iTopNotification cutted out [Library]

Mike1970

Well-Known Member
Licensed User
Longtime User
This library is deprecated. It is trivial to show an animated panel and it doesn't justify the complexity that is added when referencing swift frameworks.
Is there a new alternative ? Like WhatsApp messages notification when arrives with the app open
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
As I wrote, there is nothing special about this library. Very simple to create this effect with a panel:
B4X:
Sub ShowNotification (Parent As B4XView, Msg As String)
   Dim p As B4XView = xui.CreatePanel("pnlNotification")
   p.Color = 0xFFD0D0D0
   Dim Height As Int = 80dip
   Parent.AddView(p, 0, -Height, Parent.Width, Height)
   Dim lbl As Label
   lbl.Initialize("")
   Dim xlbl As B4XView = lbl
   xlbl.Text = Msg
   xlbl.TextSize = 20
   xlbl.TextColor = xui.Color_Black
   xlbl.SetTextAlignment("CENTER", "CENTER")
   p.AddView(xlbl, 0, 0, p.Width, p.Height)
   p.SetLayoutAnimated(200, 0, 0, p.Width, p.Height)
   Sleep(3000)
   p.SetLayoutAnimated(200, 0, -p.Height, p.Width, p.Height)
   p.SetVisibleAnimated(200, False)
   Sleep(500)
   p.RemoveViewFromParent
End Sub

Sub pnlNotification_Click
   Dim p As B4XView = Sender
   p.SetLayoutAnimated(300, 0, -p.Height, p.Width, p.Height)
End Sub
 

Mike1970

Well-Known Member
Licensed User
Longtime User
Maybe I can write a class. Let's see.
Thanks Erel!
 

Mike1970

Well-Known Member
Licensed User
Longtime User

If I put this in a Class it gives me this error on:

B4X:
dim p as b4xview = xui.createpanel("pnl")

Error occurred on line: 12 (ForegroundNotification)
Target is null. Method called: CreatePanel::
Stack Trace: (
CoreFoundation 046F17DF-03A8-3D03-99F5-BD4CFF8123C4 + 1256132
libobjc.A.dylib objc_exception_throw + 60
CoreFoundation 046F17DF-03A8-3D03-99F5-BD4CFF8123C4 + 140028
ForegroundNotification Example 0x00000001008906a0 +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 192
ForegroundNotification Example 0x00000001009128fc -[B4IShell runMethod:] + 448
ForegroundNotification Example 0x000000010091140c -[B4IShell raiseEventImpl:method:args::] + 1648
ForegroundNotification Example 0x0000000100914d4c -[B4IShellBI raiseEvent:eventarams:] + 1580
ForegroundNotification Example 0x000000010088fe40 __33-[B4I raiseUIEvent:eventarams:]_block_invoke + 60
libdispatch.dylib D174E751-B542-3A69-A593-7AA69CF30F23 + 7036
libdispatch.dylib D174E751-B542-3A69-A593-7AA69CF30F23 + 12248
libdispatch.dylib _dispatch_main_queue_callback_4CF + 968
CoreFoundation 046F17DF-03A8-3D03-99F5-BD4CFF8123C4 + 712204
CoreFoundation 046F17DF-03A8-3D03-99F5-BD4CFF8123C4 + 691048
CoreFoundation CFRunLoopRunSpecific + 480
GraphicsServices GSEventRunModal + 108
UIKitCore UIApplicationMain + 1940
ForegroundNotification Example 0x0000000100803058 main + 124
libdyld.dylib 2DE87B30-2CB1-30C2-9C0E-4BB9022D71E8 + 3608
)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…