Hi everyone,
I'm using NotificationBuilder library for my radio app. (Thank you very much to the developer @barx ).
This is my Custom Layout File
definitions
And this is my function in service which created by me
Everything works normally.
When I press the "Play / Pause" button, the radio immediately stops or continues, but the button icon changes in 2 seconds
After I see "Waiting", I start counting.
Could you help me please?
I'm using NotificationBuilder library for my radio app. (Thank you very much to the developer @barx ).
This is my Custom Layout File
B4X:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="130dp"
android:background="#ffffff">
<ImageView
android:id="@+id/stream_img"
android:layout_width="80dp"
android:layout_height="80dp"
android:contentDescription="Logo"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
<TextView
android:id="@+id/stream_title"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textSize="18dp"
android:gravity="center_vertical"
android:layout_marginLeft="90dp"
android:textColor="#000000" />
<TextView
android:id="@+id/stream_info"
android:layout_width="match_parent"
android:layout_height="30dp"
android:textSize="12dp"
android:gravity="top"
android:layout_marginLeft="90dp"
android:layout_marginTop="50dp"
android:textColor="#000000" />
<ImageView
android:id="@+id/stream_prev"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"
/>
<ImageView
android:id="@+id/stream_playpause"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/stream_prev"
android:layout_marginLeft="5dp"
/>
<ImageView
android:id="@+id/stream_next"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/stream_playpause"
android:layout_marginLeft="5dp"
/>
<ImageView
android:id="@+id/stream_quit"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="5dp"
/>
</RelativeLayout>
definitions
B4X:
Public mps As MediaPlayerStream
Public nb As NotificationBuilder
Public ncl As NotificationCustomLayout
And this is my function in service which created by me
B4X:
Dim playpause As String
If mps.IsPlaying Then
playpause="pause"
Else
playpause="play"
End If
If ncl.IsInitialized=False Then
ncl.Initialize("rc")
Dim PM As PackageManager
Dim bDrw As BitmapDrawable=PM.GetApplicationIcon(Application.PackageName)
ncl.SetImage("stream_img",bDrw.Bitmap)
ncl.SetImage("stream_prev",LoadBitmap(File.DirAssets,"prev.png"))
ncl.SetImage("stream_next",LoadBitmap(File.DirAssets,"next.png"))
ncl.SetImage("stream_quit",LoadBitmap(File.DirAssets,"stop.png"))
ncl.setEnableClickEvent("stream_prev",Me,"prev")
ncl.setEnableClickEvent("stream_next",Me,"next")
ncl.setEnableClickEvent("stream_quit",quitStream,"quit")
End If
ncl.SetTextField("stream_title",M.Get("name"))
ncl.SetTextField("stream_info","...")
ncl.SetImage("stream_playpause",LoadBitmap(File.DirAssets,playpause&".png"))
ncl.setEnableClickEvent("stream_playpause",Me,playpause)
If nb.IsInitialized=False Then
nb.Initialize(1)
nb.AutoCancel=True
nb.DefaultSound=False
nb.DefaultVibrate=False
nb.LocalOnly=True
nb.OnGoingEvent=True
nb.setActivity(RadyolarSayfasi)
nb.ShowTime=False
nb.SmallIcon = "icon"
End If
nb.BigCustomLayout=ncl.BuildLayout
nb.Notify(1)
Log("Waiting")
Everything works normally.
When I press the "Play / Pause" button, the radio immediately stops or continues, but the button icon changes in 2 seconds
After I see "Waiting", I start counting.
Could you help me please?