RSSmartWidgets - Host widgets in app

XverhelstX

Well-Known Member
Licensed User
Longtime User
Hi,

RSSmartWidgets is used in my AirWidgets app.
It lets your app hosts widgets as views so you can use it in your application (launcher, widget selection, etc)
For an example see here: https://play.google.com/store/apps/details?id=com.rootsoft.airwidgetslite

Documentation:
RSSmartWidgets
Author:
XverhelstX
Version: 1
  • RSSmartWidgets
    Methods:
    • AddView (Panel As PanelWrapper, hostView As AppWidgetHostView, left As Int, top As Int)
      Adds a view to the given panel.
      view:
      hostView:
    • AppWidget (appWidgetId As Int, info As AppWidgetProviderInfo)
    • CreateSmartWidget (appWidgetId As Int) As AppWidgetHostView
      Creates a smart widget.
    • CreateSmartWidget2 (widgetPackage As String) As AppWidgetHostView
      Creates a smart widget.
    • Initialize (EventName As String, HostId As Int)
      Initializes the Smart Widgets.
      EventName:
      HostId: The hostId is a number of your choosing that should be internally
      unique to your app (that is, you don't need to worry about collisions
      with other apps on the system). It's designed for cases where you
      want two unique AppWidgetHosts inside of the same application, so the
      system can optimize and only send updates to actively listening hosts.
    • RemoveWidget (hostView As AppWidgetHostView)
      Remove view from the layout and host.
    • SelectWidget
      Let user pick a widget from the list of installed AppWidgets
    • StartListening
      Start listening to pending intents from the widgets.
    • StopListening
      Stops listening to pending intents from the widgets.
    • getAppWidgetInfo (appWidgetId As Int) As AppWidgetProviderInfo
      Get the available info about the AppWidget.
      Returns A appWidgetId. If the appWidgetId has not been bound to a provider yet, or you don't have access to that appWidgetId, null is returned.
    Properties:
    • AppToStart As String
    • AppWidgetId As Int [read only]
      Gets the app widgets id.
    • HostId As Int
      Gets or sets the host id.
    • HostView As AppWidgetHostView [read only]
    • InstalledProviders As List [read only]
      Return a list of the AppWidget providers that are currently installed.
    • OnLongClickListener As AppWidgetHostView [write only]
    • RunningAppPackageNames As List [read only]
  • RSWidgetHostView
    Methods:
    • BringToFront
    • Initialize (EventName As String)
      Initializes this widget host view.
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    Properties:
    • AppWidgetId As Int [read only]
      Gets this view app widget id.
    • AppWidgetInfo As AppWidgetProviderInfo [read only]
      Gets the app widget provider info.
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
  • RSWidgetProviderInfo
    Methods:
    • Initialize (EventName As String)
      Initializes this Widget Provider Info.
    • IsInitialized As Boolean
    Properties:
    • AutoAdvanceViewId As Int [read only]
      The view id of the AppWidget subview which should be auto-advanced by the widget's host.
    • Icon As Int [read only]
      The icon to display for this AppWidget in the AppWidget picker. If not supplied in the xml, the application icon will be used.
    • InitialKeyguardLayout As Int [read only]
      The resource id of the initial layout for this AppWidget when it is displayed on keyguard.
    • InitialLayout As Int [read only]
      The resource id of the initial layout for this AppWidget. This should be displayed until the RemoteViews for the AppWidget is available.
    • Label As String [read only]
      The label to display to the user in the AppWidget picker. If not supplied in the xml, the application label will be used.
    • MinHeight As Int [read only]
      The default height of the widget when added to a host, in dp.
      The widget will get at least this height, and will often be given more, depending on the host.
    • MinResizeHeight As Int [read only]
      Minimum height (in dp) which the widget can be resized to.
      This field has no effect if it is greater than minHeight or if vertical resizing isn't enabled (see resizeMode).
    • MinResizeWidth As Int [read only]
      Minimum width (in dp) which the widget can be resized to.
      This field has no effect if it is greater than minWidth or if horizontal resizing isn't enabled (see resizeMode).
    • MinWidth As Int [read only]
      The default height of the widget when added to a host, in dp.
      The widget will get at least this width, and will often be given more, depending on the host.
    • PackageName As String [read only]
      The packagename of the widget.
    • PreviewImage As Int [read only]
      A preview of what the AppWidget will look like after it's configured.
      If not supplied, the AppWidget's icon will be used.
    • ResizeMode As Int [read only]
      The rules by which a widget can be resized.
    • UpdatePeriodMillis As Int [read only]
      How often, in milliseconds, that this AppWidget wants to be updated.
      The AppWidget manager may place a limit on how often a AppWidget is updated.
    • WidgetCategory As Int [read only]
      Determines whether this widget can be displayed on the home screen, the keyguard, or both.
      A widget which is displayed on both needs to ensure that it follows the design guidelines for both widget classes.
      This can be achieved by querying the AppWidget options in its widget provider's update method.


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

    'Declaration of libraries
    Dim SmartWidgets As RSSmartWidgets

End Sub

Sub CreateSmartWidget(id As Int)
    SmartWidgets.Initialize("SmartWidgets", id)
    SmartWidgets.SelectWidget
End Sub

' ! --------------- ! WIDGET EVENTS ! --------------- ! '

'After a widgets has been selected, this gets called.
Sub SmartWidgets_WidgetCreated (HostId As Int, HostView As Object, WidgetId As Int, WidgetInfo As Object)
   

End Sub

Sub SmartWidgets_BackPressed (WidgetId As Int)
    Log("Back pressed")

End Sub

You should call startlistening to start listening for updates on the given hostview, and stoplistening to stop.
Always remove your hostview when stopping or closing your application.

There are methods in it that you shouldn't use or doesn't have any purpose, because that is suited to my app.



Kind regards,
Tomas
 

Attachments

  • RSSmartWidgets.zip
    11.7 KB · Views: 626

supriono

Member
Licensed User
Longtime User
do y
Hi,

RSSmartWidgets is used in my AirWidgets app.
It lets your app hosts widgets as views so you can use it in your application (launcher, widget selection, etc)
For an example see here: https://play.google.com/store/apps/details?id=com.rootsoft.airwidgetslite

Documentation:
RSSmartWidgets
Author:
XverhelstX
Version: 1
  • RSSmartWidgets
    Methods:
    • AddView (Panel As PanelWrapper, hostView As AppWidgetHostView, left As Int, top As Int)
      Adds a view to the given panel.
      view:
      hostView:
    • AppWidget (appWidgetId As Int, info As AppWidgetProviderInfo)
    • CreateSmartWidget (appWidgetId As Int) As AppWidgetHostView
      Creates a smart widget.
    • CreateSmartWidget2 (widgetPackage As String) As AppWidgetHostView
      Creates a smart widget.
    • Initialize (EventName As String, HostId As Int)
      Initializes the Smart Widgets.
      EventName:
      HostId: The hostId is a number of your choosing that should be internally
      unique to your app (that is, you don't need to worry about collisions
      with other apps on the system). It's designed for cases where you
      want two unique AppWidgetHosts inside of the same application, so the
      system can optimize and only send updates to actively listening hosts.
    • RemoveWidget (hostView As AppWidgetHostView)
      Remove view from the layout and host.
    • SelectWidget
      Let user pick a widget from the list of installed AppWidgets
    • StartListening
      Start listening to pending intents from the widgets.
    • StopListening
      Stops listening to pending intents from the widgets.
    • getAppWidgetInfo (appWidgetId As Int) As AppWidgetProviderInfo
      Get the available info about the AppWidget.
      Returns A appWidgetId. If the appWidgetId has not been bound to a provider yet, or you don't have access to that appWidgetId, null is returned.
    Properties:
    • AppToStart As String
    • AppWidgetId As Int [read only]
      Gets the app widgets id.
    • HostId As Int
      Gets or sets the host id.
    • HostView As AppWidgetHostView [read only]
    • InstalledProviders As List [read only]
      Return a list of the AppWidget providers that are currently installed.
    • OnLongClickListener As AppWidgetHostView [write only]
    • RunningAppPackageNames As List [read only]
  • RSWidgetHostView
    Methods:
    • BringToFront
    • Initialize (EventName As String)
      Initializes this widget host view.
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    Properties:
    • AppWidgetId As Int [read only]
      Gets this view app widget id.
    • AppWidgetInfo As AppWidgetProviderInfo [read only]
      Gets the app widget provider info.
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
  • RSWidgetProviderInfo
    Methods:
    • Initialize (EventName As String)
      Initializes this Widget Provider Info.
    • IsInitialized As Boolean
    Properties:
    • AutoAdvanceViewId As Int [read only]
      The view id of the AppWidget subview which should be auto-advanced by the widget's host.
    • Icon As Int [read only]
      The icon to display for this AppWidget in the AppWidget picker. If not supplied in the xml, the application icon will be used.
    • InitialKeyguardLayout As Int [read only]
      The resource id of the initial layout for this AppWidget when it is displayed on keyguard.
    • InitialLayout As Int [read only]
      The resource id of the initial layout for this AppWidget. This should be displayed until the RemoteViews for the AppWidget is available.
    • Label As String [read only]
      The label to display to the user in the AppWidget picker. If not supplied in the xml, the application label will be used.
    • MinHeight As Int [read only]
      The default height of the widget when added to a host, in dp.
      The widget will get at least this height, and will often be given more, depending on the host.
    • MinResizeHeight As Int [read only]
      Minimum height (in dp) which the widget can be resized to.
      This field has no effect if it is greater than minHeight or if vertical resizing isn't enabled (see resizeMode).
    • MinResizeWidth As Int [read only]
      Minimum width (in dp) which the widget can be resized to.
      This field has no effect if it is greater than minWidth or if horizontal resizing isn't enabled (see resizeMode).
    • MinWidth As Int [read only]
      The default height of the widget when added to a host, in dp.
      The widget will get at least this width, and will often be given more, depending on the host.
    • PackageName As String [read only]
      The packagename of the widget.
    • PreviewImage As Int [read only]
      A preview of what the AppWidget will look like after it's configured.
      If not supplied, the AppWidget's icon will be used.
    • ResizeMode As Int [read only]
      The rules by which a widget can be resized.
    • UpdatePeriodMillis As Int [read only]
      How often, in milliseconds, that this AppWidget wants to be updated.
      The AppWidget manager may place a limit on how often a AppWidget is updated.
    • WidgetCategory As Int [read only]
      Determines whether this widget can be displayed on the home screen, the keyguard, or both.
      A widget which is displayed on both needs to ensure that it follows the design guidelines for both widget classes.
      This can be achieved by querying the AppWidget options in its widget provider's update method.


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

    'Declaration of libraries
    Dim SmartWidgets As RSSmartWidgets

End Sub

Sub CreateSmartWidget(id As Int)
    SmartWidgets.Initialize("SmartWidgets", id)
    SmartWidgets.SelectWidget
End Sub

' ! --------------- ! WIDGET EVENTS ! --------------- ! '

'After a widgets has been selected, this gets called.
Sub SmartWidgets_WidgetCreated (HostId As Int, HostView As Object, WidgetId As Int, WidgetInfo As Object)
  

End Sub

Sub SmartWidgets_BackPressed (WidgetId As Int)
    Log("Back pressed")

End Sub

You should call startlistening to start listening for updates on the given hostview, and stoplistening to stop.
Always remove your hostview when stopping or closing your application.

There are methods in it that you shouldn't use or doesn't have any purpose, because that is suited to my app.



Kind regards,
Tomas

do you have sample code how to use this library..thanks
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Does this host a single widget? Can we make it so it doesn't need a panel, that we can just get the BMP/canvas?
Will calling Background obtain that?
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm trying to use SmartWidgets.CreateSmartWidget(AppWidgetId) to restore a saved Widget, but after initialization SmartWidgets.AppWidgetId turns to 0... Not sure what to do.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I also can't get the longclick handling to work. Can we please see your example code?
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I got widget restoring working! (I hope)

Here's all my code

B4X:
sub Process_Globals
	Dim MyHostID As Int = PUT_A_RANDOM_BIG_NUMBER_HERE 'for widgets
	Type HostedWidget(SmartWidgets As RSSmartWidgets, Dest As Panel, HostView As RSWidgetHostView, ID As Int)
End Sub
sub Globals
	Dim HostedWidgets As List
end sub

' ! --------------- ! WIDGET EVENTS ! --------------- ! '
'https://www.b4x.com/android/forum/threads/getting-started-with-a-homescreen-launcher.34068/#post-302486
'https://www.b4x.com/android/forum/threads/rssmartwidgets-host-widgets-in-app.32807/

Sub SmartWidgets_LoadWidgets(Load As Boolean) 
	Dim temp As Int, tempWidget As HostedWidget, LCARSwidget As Widget, WidgetID As Int 
	If Load Then
		If ListSize(HostedWidgets)=0 Then
			HostedWidgets.Initialize
			For temp = 0 To LCARS.Widgets.Size -1 
				LCARSwidget = LCARS.Widgets.Get(temp)
				If LCARSwidget.ID>-1 Then'isReal
					SmartWidgets_MakeRealWidget2(LCARSwidget.ID, "", LCARSwidget.Width,LCARSwidget.Height)
				End If
			Next
		End If
	Else
		'insert code to save the widget ID number to your settings file
	End If
End Sub
Sub SmartWidgets_MakeRealWidget As Int 
	SmartWidgets_LoadWidgets(True)
	Dim tempWidget As HostedWidget 
	tempWidget.Initialize
	tempWidget.SmartWidgets.Initialize("SmartWidgets", MyHostID)
	HostedWidgets.Add(tempWidget)
    tempWidget.SmartWidgets.SelectWidget
	Return HostedWidgets.Size - 1
End Sub
Sub SmartWidgets_MakeRealWidget2(AppWidgetId As Int, PackageName As String, Width As Int, Height As Int)
	Dim tempWidget As HostedWidget, Info As RSWidgetProviderInfo, LCARSWidgetID As Int = LCARS.FindWidgetID(AppWidgetId)


'	Dim tempWidget As HostedWidget 
'	tempWidget.Initialize
'	tempWidget.SmartWidgets.Initialize("SmartWidgets", MyHostID)
'	tempWidget.SmartWidgets.AppToStart = AppWidgetId
'	tempWidget.SmartWidgets.getAppWidgetInfo(AppWidgetId)
'	
'	
'	
'
'	tempWidget.HostView.Initialize("widginform")
'	tempWidget.HostView = tempWidget.SmartWidgets.HostView
'	
'	If PackageName.Length=0 Then
'		tempWidget.SmartWidgets.CreateSmartWidget(AppWidgetId)
'	Else
'		tempWidget.SmartWidgets.CreateSmartWidget2(PackageName)
'	End If
'	
'	tempWidget.Dest.Initialize("WidgetPanel")
'	Activity.AddView(tempWidget.Dest, 0,0, Width, Height)
'	tempWidget.Dest.Visible=False
'	tempWidget.HostView = tempWidget.SmartWidgets.HostView
'	tempWidget.SmartWidgets.AddView(tempWidget.Dest, tempWidget.HostView, 0, 0)
'	tempWidget.HostView.SendToBack 
'	tempWidget.SmartWidgets.StartListening
'	
'	
'	HostedWidgets.Add(tempWidget)
'	Log("AppWidgetId: " & tempWidget.SmartWidgets.AppWidgetId)
'	Return
	
	
	
	tempWidget.Initialize 
	tempWidget.SmartWidgets.Initialize("SmartWidgets", MyHostID)
	tempWidget.SmartWidgets.AppToStart = AppWidgetId
	tempWidget.SmartWidgets.getAppWidgetInfo(AppWidgetId)
	tempWidget.SmartWidgets.HostID = MyHostID 
	tempWidget.HostView.Initialize("SmartWidgets")
	Info=tempWidget.SmartWidgets.getAppWidgetInfo(AppWidgetId)
	
	If PackageName.Length=0 Then
		tempWidget.SmartWidgets.CreateSmartWidget(AppWidgetId)
		tempWidget.SmartWidgets.AppWidget(AppWidgetId, Info)
	Else
		tempWidget.SmartWidgets.CreateSmartWidget2(PackageName)
	End If
	'LCARS.ChangeWidgetID(AppWidgetId, tempWidget.SmartWidgets.AppWidgetId)
	tempWidget.HostView = tempWidget.SmartWidgets.HostView
	
	tempWidget.Dest.Initialize("SmartWidgets")
	
	
	If Width= 0 Then Width = Info.MinWidth
	If Height=0 Then Height= Info.MinHeight
	'Log("Widget made: (" & AppWidgetId & ") " & Info)
	Activity.AddView(tempWidget.Dest, 0,0, Width, Height)
	tempWidget.SmartWidgets.OnLongClickListener =  tempWidget.HostView
	tempWidget.SmartWidgets.AddView(tempWidget.Dest, tempWidget.HostView, 0, 0)
	tempWidget.HostView.BringToFront
	tempWidget.SmartWidgets.StartListening
	tempWidget.Dest.SendToBack 
	tempWidget.Dest.Visible = False
	tempWidget.Dest.Enabled = True
	tempWidget.ID=AppWidgetId
	
	Log("AppWidgetId: " & tempWidget.SmartWidgets.AppWidgetId)
	HostedWidgets.Add(tempWidget)
	SmartWidgets_SyncWidgets(True)
End Sub
Sub SmartWidgets_ChangeListeningState(Listening As Boolean)
	Dim temp As Int, tempWidget As HostedWidget
	If HostedWidgets.IsInitialized Then
		For temp = 0 To HostedWidgets.Size-1
			tempWidget = HostedWidgets.Get(temp)
			If tempWidget.Dest.IsInitialized Then
				If Listening Then 
					tempWidget.SmartWidgets.StartListening 
					If tempWidget.Dest.Visible Then tempWidget.Dest.SendToBack 
				Else
					tempWidget.SmartWidgets.StopListening 
				End If
			End If
		Next
		If Listening Then SmartWidgets_SyncWidgets(True) Else SmartWidgets_LoadWidgets(False)
	Else
		SmartWidgets_LoadWidgets(True)
	End If
End Sub
Sub SmartWidgets_GetUnchoosenWidget As Int
	Dim temp As Int, tempWidget As HostedWidget
	If HostedWidgets.IsInitialized Then
		For temp = 0 To HostedWidgets.Size-1
			tempWidget = HostedWidgets.Get(temp)
			If Not(tempWidget.Dest.IsInitialized) Then Return temp
		Next
	End If
	Return SmartWidgets_MakeRealWidget
End Sub

'After a widgets has been selected, this gets called.
Sub SmartWidgets_WidgetCreated (HostID As Int, HostView As Object, WidgetId As Int, WidgetInfo As Object)
	Dim tempWidget As HostedWidget = HostedWidgets.Get(SmartWidgets_GetUnchoosenWidget), Info As RSWidgetProviderInfo = WidgetInfo
	If MyHostID = HostID Then
		tempWidget.HostView.Initialize("SmartWidgets")
		tempWidget.HostView = tempWidget.SmartWidgets.HostView
		tempWidget.ID = WidgetId
		tempWidget.Dest.Initialize("SmartWidgets")
		Activity.AddView(tempWidget.Dest, 0,0, Info.MinWidth, Info.MinHeight)
		tempWidget.Dest.Visible=False
		tempWidget.SmartWidgets.OnLongClickListener = tempWidget.HostView
		tempWidget.SmartWidgets.AddView(tempWidget.Dest, tempWidget.HostView, 0, 0)
		tempWidget.HostView.SendToBack 
		tempWidget.SmartWidgets.StartListening
		
		If Not(LCARS.AutoMakeWidget(2,1, WidgetId)) Then MSGBOX1("THERE ISNT ENOUGH ROOM ON THIS PAGE", "ERROR")
		SmartWidgets_SyncWidgets(True)
	End If
	HideList(True)
End Sub

Sub SmartWidgets_FindWidgetID(WidgetId As Int) As Int
    Dim temp As Int, tempWidget As HostedWidget
    If HostedWidgets.IsInitialized Then
        For temp = 0 To HostedWidgets.Size-1
            tempWidget = HostedWidgets.Get(temp)
            If tempWidget.ID=WidgetId Then Return temp
        Next
    End If
    Return -1
End Sub
Sub SmartWidgets_DeleteWidget(WidgetId As Int) As Boolean 
    Dim tempWidget As HostedWidget, Index As Int = SmartWidgets_FindWidgetID(WidgetId)
    If Index>-1 Then
        tempWidget = HostedWidgets.Get(Index)
        tempWidget.SmartWidgets.RemoveWidget(tempWidget.SmartWidgets.HostView)
        HostedWidgets.RemoveAt(Index)
        SmartWidgets_LoadWidgets(False)
        Return True
    End If
End Sub

Sub SmartWidgets_SyncWidgets(Visible As Boolean)
	Dim temp As Int, tempHostedWidget As HostedWidget, tempLCARSwidget As Widget ,temp2 As Int 
	If Not(HostedWidgets.IsInitialized) Then SmartWidgets_LoadWidgets(True)' Return
	For temp = 0 To HostedWidgets.Size-1' LCARS.Widgets.Size-1
		tempHostedWidget = HostedWidgets.Get(temp)
		'Log("Widget ID: " & tempHostedWidget.ID )
		temp2 = LCARS.FindWidgetID(tempHostedWidget.ID )
		If temp2=-1 Then
			SmartWidgets_DeleteWidget(tempHostedWidget.ID )
		Else
			tempLCARSwidget = LCARS.Widgets.get(temp2)
			tempHostedWidget.Dest.Visible = tempLCARSwidget.Visible
			If tempLCARSwidget.Visible Then
				tempHostedWidget.Dest.SendToBack 
				tempHostedWidget.dest.Left = tempLCARSwidget.X
				tempHostedWidget.dest.Top = tempLCARSwidget.Y
				If tempHostedWidget.dest.Width <> tempLCARSwidget.Width OR tempHostedWidget.dest.Height <> tempLCARSwidget.Height Then
					tempHostedWidget.dest.Width = tempLCARSwidget.Width
					tempHostedWidget.dest.Height = tempLCARSwidget.Height
				End If
			End If
		End If
	Next
End Sub
Sub SmartWidgets_LongClick
	Log("widget Long click")
End Sub

Sub ListSize(Items As List) As Int
	If Items.IsInitialized Then Return Items.Size
End Sub
 
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
Now that code handles loading of multiple widgets, and is integrated with my LCARS module, which you'll have to remove/replace but this will give you a head start that you didn't really have before.

You can really replace the Widget type with hosted widget. I just had a different widget system in place for my own app, that you won't need.

SmartWidgets_LoadWidgets - Saves/Loads Widgets, saving isn't complete because of the separate widget system I mentioned which saved already. This will be called automatically if you use SmartWidgets_ChangeListeningState properly
You'll have to add your own widget saving code to replace "'not needed" as my LCARS widget system saved already. You only need to save the widget ID number.

SmartWidgets_MakeRealWidget - Brings up the Android system dialog for making a widget
SmartWidgets_ChangeListeningState - call this on activity pause/resume events (listening: pause=false, resume=true)
SmartWidgets_SyncWidgets - This gets X/Y/Width/Height of the widgets from my LCARS engine, and moves the panels to those locations, and handles their visibility (my engine doesn't use panels, so I had to integrate the 2 methods)

Not done/need help on:
SmartWidgets_LongClick - It doesn't get called. Though I've never gotten longclick events in B4A :/

SmartWidgets_DeleteWidget - I assume this will work, haven't tested it yet as I need long click handling to do it
Obviously deletes a Widget using it's ID number

System API you won't need to use
SmartWidgets_MakeRealWidget2 - is how SmartWidgets_LoadWidgets recreates a widget from the ID number, you won't need to use it
SmartWidgets_GetUnchoosenWidget - A widget is created whenever SmartWidgets_MakeRealWidget is called, but if the user doesn't finish it, the widget will be left uncreated. This will select the uncreated one instead of making a new one

ID numbers must be above -1, so you can use anything below 0 on your own
 
Last edited:

davidt

Member
Licensed User
Longtime User
I also can't get the longclick handling to work. Can we please see your example code?

Has anybody using this library had any success with the implementation of the OnLongClickListener?

Thanks in advance.
 
Top