Other B4A v13.7 targetSdkVersion = 36 + Edge to Edge

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm happy to release a new version of B4A.
The main improvements in this version are related to new requirements enforced with targetSdkVersion=36. Apps running on new devices now run in edge to edge mode (E2E). This means that the activity fills the whole screen and other elements, such as the system bars, are overlaid on top of it. The way to deal with this change is to add a "root" panel that is positioned in the content area and add any layout that shouldn't be covered by the non-app elements to this panel.
In B4XPages, each page is made of a panel and this panel is resized based on the content area, so no changes are needed.
For non-B4XPages projects, you can adapt the code from the default template:
B4X:
Sub Globals
    Private ime As IME
    Private root As B4XView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    ime.Initialize("ime")
    root = xui.CreatePanel("")
    Dim Content As Rect = ime.GetContentRect
    Activity.AddView(root, Content.Left, Content.Top, Content.Width, Content.Height)
    ime.UpdatePercentageReference(root.Width, root.Height)
    root.LoadLayout("Layout")
End Sub
Note that this code will also work properly on devices not running in E2E mode.

There is a new attribute named #EdgeToEdgeOldDevices. It enables E2E mode on older devices and is recommended for better compatibility.
Note that the IME library was updated with features related to this mode. The handling of keyboard height changes is implemented differently when running in E2E and I expect it to work better than the previous non-E2E implementation.

The enableOnBackInvokedCallback attribute is set to false by default: https://developer.android.com/guide/topics/manifest/activity-element#enableOnBackInvokedCallback.

The light and dark theme macros were updated. You can find the updated snippets inside libraries\Themes.jar. The now disabled enforcement of non-E2E was removed and windowLightStatusBar was added to the light theme.

Additional changes:

- Exception.StackTrace property.
- ThrowException keyword
- Bug fixes and other minor changes.

1785398330828-png.172670


B4X:
Root.Color = xui.Color_Gray
B4XPages.GetNativeParent(Me).Color = xui.Color_Magenta

Download link: https://www.b4x.com/b4a.html
 

Alessandro71

Well-Known Member
Licensed User
Longtime User
talking about migration strategy, if this version is used to compile an app that is not yet migrated to SDK 36 (i.e. it still target sdk 35 in the manifest and no code/manifest changes), will it produce the same binary as the previous B4A version?
so I can migrate apps one a time by changing manifest and #EdgeToEdgeOldDevices.
or should I install this B4A version in a different folder and use the old version if I need to update the non-migrated apps?
 
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
Yes, you can keep targetSdkVersion with a lower version. You will get the same result as before.
"The light and dark theme macros were updated. You can find the updated snippets inside libraries\Themes.jar. The now disabled enforcement of non-E2E was removed and windowLightStatusBar was added to the light theme."

this was the part that left me thinking...
 
Upvote 0

Cliff McKibbin

Member
Licensed User
Longtime User
The install and compiles of V13.7 all went well.
The Main page displayed correctly. However, all of my other pages display with the fields moved down about 3/4 inch.
Upon inspection, I realized that I did not explicitly set the 'top' of the fields on the 'mainpage'.
On all other pages, I have set the top similar to:

B4X:
private Sub b4xpage_created (root1 As B4XView)
    Root=root1
    Root.LoadLayout ("TS20")

    btActive.Top=Root.Top +10
    btSort.Top=btActive.top
    imvDetail.Top=btActive.top

In this example, I commented out the entries and that page now displays normal.

Is there a way around this issue short of removing the 'top' settings?

Thanks, Cliff
 
Upvote 0
Top