B4A Library RichPath

It is a "partly" wrapper for this Github project. I am sure that by now you will know what to do with the attached files.
It uses inline Java code for the notification sound. The "shewness" of the clock is due to the original Java code that has been wrapped. Figure it out if you would like to do so - the Java code is attached. It is not in the wrapper...


1.png


Sample code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aRichPath
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\DemoRes
#AdditionalRes: ..\LibRes

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim t As Timer
    Dim nativeMe As JavaObject
  

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private rp1 As RichPath
    Private rp2 As RichPath
  
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
    nativeMe.InitializeContext
    t.Initialize("t", 7000)
  
    rp1.VectorDrawable = "ic_notifications"
    rp2.VectorDrawable = "ic_android"

End Sub

Sub Activity_Resume
    t.Enabled = True


End Sub

Sub Activity_Pause (UserClosed As Boolean)
  
    t.Enabled = False

End Sub

Sub t_tick
  
    rp1.animateNotification
    nativeMe.RunMethod("Ring", Null)
    rp2.animateAndroid

End Sub

#if Java

import android.net.Uri;
import android.media.RingtoneManager;
import android.media.Ringtone;


public void Ring() {
    Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    Ringtone r = RingtoneManager.getRingtone(BA.applicationContext, notification);
    r.play();
}

#End If

Lib files used/enabled:
Libs.png
 

Attachments

  • LibRes.zip
    565 bytes · Views: 264
  • TheJavaCode.zip
    24.8 KB · Views: 246
  • b4aRichPath.zip
    8 KB · Views: 258
  • b4aRichPathLibFiles.zip
    33.8 KB · Views: 272
  • DemoRes.zip
    119.8 KB · Views: 250
Last edited:
Top