StandOut 3.0
Changes
After a couple of weeks of development and testing, I finally pulled off StandOut 3.0.
The previous versions of StandOut were written in a "hacky" way where we used the application context to pass the ba instance to the StandOut service. This had some major drawbacks and bugs that were unable to be fixed. Now we are using a "legit" way (in the same way the DayDream library was written) where we declare a static instance of the service in the library which we interact with.
What is StandOut?
StandOut is an easy-to-use library that anyone can use to create their own floating apps.
Features
Now there are some great advantages and features in the new version of StandOut 3.0!
- Provide your own view.
- Very easy to integrate
- Window decorators (titlebar, minimize/close buttons, border, resize handle)
- Windows are moveable and resizable. You can bring-to-front, minimize, and close
- Minimized windows can be restored (the example APK demos this using the notification panel)
- Multiple windows!
- Communication between windows!
- Create your own animation (Hide, close, show, ...)
- Your own theme style
- DropDown Items
- Tons more events
- Flag system to enable/disable window features
- Much easier to use
The library StandOut Service calls method in your B4A Service where you can initialize, change, adapt your window, and pass it back to the native service. The service configures your window and displays it to the user.
Integrate StandOut in your application
An example project is attached in the sample folder which demonstrates the basic functionality of StandOut.
You can also find the sample apk in this thread's attachments.
Here is some basic code which shows how it can easily be integrated in your app:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
'Declaration of constants
Public StandOut As RSStandOut
'Declaration of variabels
Private mWindow As RSStandOutWindow
Private mConstants As RSStandOutConstants
Private mFlags As RSStandOutFlags
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
mWindow.Initialize("Window")
StandOut.Show(mWindow.UniqueId)
End Sub
Sub Service_Destroy
End Sub
' ! --------------- ! - VIEW EVENTS - ! --------------- !
Sub btnSend_Click
'checks if the window is shown or hidden
'Sends data from Window 0 to Window 1, with RequestCode 5 and Bundle: null
If mWindow.isExistingId(1) Then
StandOut.SendData(1, 5, Null, 0)
End If
End Sub
B4X:
' ! --------------- ! - EVENTS - ! --------------- !
'Do NOT call the events below from your app.
'The methods below are called from the library and returns info back to the library.
Sub Window_Initialize (Id As Int, Window As RSStandOutWindow) As RSStandOutLayoutParams
Dim params As RSStandOutLayoutParams
params.Initialize4(Id, 400, 300, mConstants.AUTO_POSITION, mConstants.AUTO_POSITION, 100, 100)
Return params
End Sub
'Final clean up that needs to be done.
'Called after all windows have been closed.
Sub Window_Destroy
StopService(Me)
End Sub
'Create a panel and add it to the frame.
Sub Window_CreateAndAttachView (Id As Int, Frame As RSFrameLayout) As Panel
Dim Content As Panel
Content.Initialize("Content")
Frame.AddView(Content, 400, 300)
Dim btn As Button
btn.Initialize("btnSend")
btn.Text = "Send"
Content.AddView(btn, 0dip, 0dip, Frame.Width, 48dip)
Return Content
End Sub
'Returns the name of the Window.
Sub Window_AppName As String
Return "RSStandOut Example"
End Sub
'Returns the icon of the window.
Sub Window_AppIcon As String
Return "icon"
End Sub
'Return a list of flags
Sub Window_Flags (Id As Int) As List
Dim flags As List
flags.Initialize
flags.Add(mFlags.FLAG_DECORATION_SYSTEM)
flags.Add(mFlags.FLAG_BODY_MOVE_ENABLE)
flags.Add(mFlags.FLAG_WINDOW_HIDE_ENABLE)
flags.Add(mFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP)
flags.Add(mFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE)
flags.Add(mFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE)
Return flags
End Sub
Sub Window_PersistentNotificationTitle(Id As Int) As String
Return "RSStandOut Example Running"
End Sub
Sub Window_PersistentNotificationMessage(Id As Int) As String
Return "Click to add a new RSStandOut example"
End Sub
Sub Window_PersistentNotificationIntent(Id As Int) As Intent
Return StandOut.getShowIntent(mWindow.UniqueId)
End Sub
Sub Window_HiddenIcon As String
Return "icon"
End Sub
Sub Window_HiddenNotificationTitle(Id As Int) As String
Return "RSStandOut Example Hidden"
End Sub
Sub Window_HiddenNotificationMessage(Id As Int) As String
Return "Click to restore #" & Id
End Sub
Sub Window_HiddenNotificationIntent(Id As Int) As Intent
Return StandOut.getShowIntent(Id)
End Sub
'Data = bundle (Use JavaObject)
Sub Window_ReceiveData (Id As Int, RequestCode As Int, Data As Object, FromId As Int)
ToastMessageShow("Data received from id: " & FromId & " with RequestCode: " & RequestCode, False)
End Sub
Sub Window_ShowAnimation (Id As Int) As String
If (mWindow.isExistingId(Id)) Then
'restore
Return "slide_in_left"
Else
'show
Return "fade_in"
End If
'Return ""
End Sub
Sub Window_HideAnimation (Id As Int) As String
Return "slide_out_right"
End Sub
Sub Window_CloseAnimation (Id As Int) As String
Return "fade_out"
End Sub
Sub Window_DropDownItems (Id As Int) As List
Dim l As List
l.Initialize
Dim item(2) As RSStandOutDropDownItem
item(0).Initialize("Item", "ic_menu_help", "About", "About")
item(1).Initialize("Item", "ic_menu_preferences", "Settings", "Settings")
l.Add(item(0))
l.Add(item(1))
Return l
End Sub
Sub Window_ThemeStyle As String
Return ""
End Sub
Not to forget
- Did you forgot to add the applicationcontext? (See the manifest editor)
- Did you copy your res folder from the SO example project?
- Did you make all files in the res folder read-only?
- To do
Payment
There were some communication issues in the past where people bought StandOut but communicated through my old mail (which was still in my B4A profile) and didn't receive SO, but this has been sorted out. Please do not contact me at: [email protected]!
Below are the payment details:
Payment can only be made with PayPal.
After transaction has been made, we will send the library files within 24h after purchase.
If you didn't receive the files within 24h, please contact us at [email protected]
The price of StandOut is 25 EUR.
Payment can be made to the following PayPal Address: [email protected]
Previous buyers
Previous buyers of StandOut 1.0 and StandOut 2.0 are eligable for a free update.
We will send the new StandOut library to you as soon as possible.
If you haven't received the StandOut within 3 days from today (4/10/14), please contact us at [email protected]
Questions
Questions and feedback can be given in this thread. I've subscribed myself to this thread so I can see the notifications and i'll try to be responsive as possible. I'm mainly focusing on my studies at the moment, but I'll do my best to reply on time.
Kind regards,
Tomas
Attachments
Last edited: