[Chargeable] RSStandOut 3.0 - Floating Apps

MarcoRome

Expert
Licensed User
Longtime User
Hi ...another question :)

i see this your code:

B4X:
'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" ' HERE ----------------------------------> If i want change this ???
    Content.AddView(btn, 0dip, 0dip, Frame.Width, 48dip)
    Return Content
End Sub

The question is .... can i change

B4X:
btn.Text = "Send"

in dynamic mode ??
Example the user click top button "Send" in Float Window and this change Text in "OK, Done"

Thank you very much
 
Last edited:

Quaki

Member
Licensed User
Longtime User
Thanks Tomas
So I have answer on 1 and 3 question but second question is still open is it possible to display data recived from serial port (using serial lib) under floating window made with your lib ?
Best regards
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
Hi ...another question :)

i see this your code:

B4X:
'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" ' HERE ----------------------------------> If i want change this ???
    Content.AddView(btn, 0dip, 0dip, Frame.Width, 48dip)
    Return Content
End Sub

The question is .... can i change

B4X:
btn.Text = "Send"

in dynamic mode ??
Example the user click top button "Send" in Float Window and this change Text in "OK, Done"

Thank you very much

Hi

yes you should be able to do that.
You can use mWindow.ContentPanel to get the panel of that window.
Then you can get the view that you want through id, tag, etc.
and then you can work with the view.

B4X:
'Clicking on this button on the second window (window with id:1) will change the text to "ok, done"
'Make sure you do btn.Tag = "btnSend" in the CreateAndAttachView event
Sub btnSend_Click
    'checks if the window is shown or hidden
    If mWindow.isExistingId(1) Then
        StandOut.SendData(1, 5, Null, 0)
        If getViewByTag("btnSend") <> Null Then
            Dim btnSend As Button
            btnSend = getViewByTag("btnSend")
            btnSend.Text = "ok, done"
        End If
    End If

End Sub

Sub getViewByTag(Tag As String) As View
    For Each v As View In mWindow.ContentPanel.GetAllViewsRecursive
        If v.Tag = Tag Then
            Return v
        End If
    Next
    Return Null
End Sub

Tomas
 
Last edited:

XverhelstX

Well-Known Member
Licensed User
Longtime User
Thanks Tomas
So I have answer on 1 and 3 question but second question is still open is it possible to display data recived from serial port (using serial lib) under floating window made with your lib ?
Best regards

if the Serial Port library can be used in a service, then yes, you can display data from the serial port in StandOut

Tomas

Edit:
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Hi

yes you should be able to do that.
You can use mWindow.ContentPanel to get the panel of that window.
Then you can get the view that you want through id, tag, etc.
and then you can work with the view.

Tomas

mmhh... sorry Thomas is possibile a little example about change

B4X:
btn.Text = "Send"

Thank you very much for your patient
 

pfillion

Member
Licensed User
Longtime User
Hi,

I would like to allow a window to be moved but only horizontally. How can I reset it's Y position to 0 ?

I looked into the Window_Move event and can set the position using the params.Initialize3(...) (as RSStandOutLayoutParams) and Window.UpdateViewLayout(Id,params) but I would need to retrieve the actual x and y coordinates for the current Window in the parent activity (not where I touch within the window) to set it back while resetting Y to 0.

How can I get the X and Y position of the main window that contains all the views?

Thanks.
 
Last edited:

pfillion

Member
Licensed User
Longtime User
I found out how to do it. Here is the code if anyone ever try to do the same.

B4X:
Sub Window_Move (Id As Int, Window As RSStandOutWindow, pView As View, MotionEvent As Object)

    'Get window position
    Dim win As JavaObject = Window
    Dim layout As JavaObject = win.RunMethod("getLayoutParams", Null)
    Dim x As Int = layout.GetField ("x")
    Dim y As Int = layout.GetField ("y")
    Dim h As Int = layout.GetField ("height")
    Dim w As Int = layout.GetField ("width")
    Log( x & " " & y & " " & h & " " & w )
   
    'Reset the y position to make it slide horizontally
    Dim params As RSStandOutLayoutParams
    params.Initialize3(Id, w, h, x, 0)
    Window.UpdateViewLayout(Id,params)

End Sub

It would be nice to have the getLayoutParams implemented in the library to prevent the need to import JavaObject in the app.

Excellent library Thomas
 

pfillion

Member
Licensed User
Longtime User
Is there a way to create the service in my app without creating a persistent notification ?

I'm trying to create a sliding window for a Wear Watch device and it works fine. The problem is that it creates a notification that stays on permanently and causes the Wear Watch to display this notification without any way for the user to dismiss it. It's really not viable.

I would only need to be able to create the service as sticky instead of permanent with a notification...
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
Is there a way to create the service in my app without creating a persistent notification ?

I'm trying to create a sliding window for a Wear Watch device and it works fine. The problem is that it creates a notification that stays on permanently and causes the Wear Watch to display this notification without any way for the user to dismiss it. It's really not viable.

I would only need to be able to create the service as sticky instead of permanent with a notification...

Unfortunately, you need to show a persistent notification in order to keep the service alive. It's an Android feature.
However i think you could use a transparant icon for your problem.
I'll add the getLayoutParams to my list of updates.

Kind regards,
Tomas
 

pfillion

Member
Licensed User
Longtime User
A persistent notification should not be needed if I create a windows that is always on the screen. It is supposed to be needed if you hide your app to the background to simulate that it has a foreground window. Can you create a method to instantiate it without a notification ? and I'll see if It gets killed.. or is it hidden in a library you encapsulate ?

Like for example I want to create a white window that show when I slide from the side. The window is always on just out of view, that mean that even if it's now run as a foreground service, it will stay on. No ?

A transparent icon will still show a notification on the watch.

Thanks for the addition of getLayoutParams.

Pierre
 

btbb

Member
Licensed User
Longtime User
I wonder if it is possible to animate the windows? I see that there is a parameter called
SetLayoutAnimated.

Mattias.
 

pfillion

Member
Licensed User
Longtime User
Whats the point to test this, if the Android OS was designed to KILL the app in this case, just read the android documentation.



out of view = background app
Allways "foreground" app = Never use any other apps on the device

All I can tell you is that apps like Wear Mini Launcher do not show a notification or they handle it in their app. The launcher is an partially hidden window that is shown then you drag the edge of the screen. The window is transparent and not fully hidden, just partially. So it's not completely out of view and it does not get killed by the system.

I don't need the library to generate a persistent notification as soon as the window is created. I want to manage it when the window is hidden by the user. I know that background app gets killed, I want to manage the persistent notification by myself. It can also allow me to have only one notification for my app not one for the hidden windows and a custom one for my app for the user to interact with it.
 

pfillion

Member
Licensed User
Longtime User
It's not a regular launcher. It is a floating app running on a smart watch. Smart watch do not have launchers. They created a floating app to act as a sliding windows that show app to launch.
 

itgirl

Active Member
Licensed User
Longtime User
can we still buy this Lib or not ? !! since the Developer is not around anymore !!
 
Top