Hi,
This new library is based on my experience of end users requirements for Windows app or even Android app about UI modifications.
Even if your UI is quite beautifull, there is always one (or more) end user asking to change the shape of your layout
This new library allow end users to change by themselves the position of each view in your layout while running live the apk.
Enclosed, you will find the .jar and .xml to put into your additional library folder, and also a test project.
Just bellow, a video to show how it works (read the video until the end) followed by requirements to use the library.
In this test, to enter in modification mode, I've set the event on Activity_LongClick.
To save modifications, it's also on Activity_LongClick.
Of course, you can handle fonctionnalities with all others events you want.
NB: this library has no pretension and works with very simple layout only.

EDIT#1:
Library has been updated to V1.01 in first post:
- Avoid crash on recursive Views (debug mode will generate huge log of error but no impact on apk. I'm trying to solve it ASAP)
- populate different colors in modification mode according to views types
EDIT#2:
Library has been updated to V1.02 in first post:
- Huge log of error solved.
Requirements:
(Based on one Activity module you want to populate)
- in your Starter class, add a reference to RuntimePermissions (as shown in test file)
- Add the library "CustomLayout" into your project
- Add in your Sub Global:
- Add In your Sub Activity_Create:
- Add the following sub into your activity code:
This new library is based on my experience of end users requirements for Windows app or even Android app about UI modifications.
Even if your UI is quite beautifull, there is always one (or more) end user asking to change the shape of your layout
This new library allow end users to change by themselves the position of each view in your layout while running live the apk.
Enclosed, you will find the .jar and .xml to put into your additional library folder, and also a test project.
Just bellow, a video to show how it works (read the video until the end) followed by requirements to use the library.
In this test, to enter in modification mode, I've set the event on Activity_LongClick.
To save modifications, it's also on Activity_LongClick.
Of course, you can handle fonctionnalities with all others events you want.
NB: this library has no pretension and works with very simple layout only.

EDIT#1:
Library has been updated to V1.01 in first post:
- Avoid crash on recursive Views (debug mode will generate huge log of error but no impact on apk. I'm trying to solve it ASAP)
- populate different colors in modification mode according to views types
EDIT#2:
Library has been updated to V1.02 in first post:
- Huge log of error solved.
Requirements:
(Based on one Activity module you want to populate)
- in your Starter class, add a reference to RuntimePermissions (as shown in test file)
- Add the library "CustomLayout" into your project
- Add in your Sub Global:
B4X:
Sub Globals
Dim Cust As CustomLayout
Dim mbase As Panel
Dim Flag As Boolean
Dim LayoutName As String
Dim ActivityName As String
Dim FileDir As String
End Sub
- Add In your Sub Activity_Create:
B4X:
Sub Activity_Create(FirstTime As Boolean)
LayoutName = "...your layout name..." 'LayoutName will be used in some others places
Activity.LoadLayout(LayoutName)
Init
End Sub
- Add the following sub into your activity code:
B4X:
Sub Init
FileDir = Starter.SharedFolder
'Initialize views
'set the tag for all views
'if you already set a tag for a view, you will find it under map.get("Owner") in your view tag
ActivityName = Me
Cust.Initialize(Me,"Custo")
Cust.Name(ActivityName,LayoutName,FileDir)
mbase.Initialize("mbase")
Flag = False
'set all existing views
For Each V As View In Activity.GetAllViewsRecursive
Cust.InitLst(v)
Next
LayoutRedraw
End Sub
Private Sub activity_LongClick
If Flag = True Then
mbaseLongClick
Else
Dim Choice As Int = Msgbox2("What would you like to do ?","Settings","Set default values","Quit","Change layout",Null)
Select Case Choice
Case -1 'set default
Cust.RAZ
Activity.RemoveAllViews
Activity.LoadLayout(LayoutName)
Init
Flag = False
Case -2 'change layout
Activity.RemoveAllViews
mbase = Cust.Init(100%x,100%y)
Activity.AddView(mbase,0,0,mbase.Width,mbase.Height)
Flag = True
Case Else
Flag = False
End Select
End If
End Sub
Private Sub LayoutRedraw
If File.Exists(FileDir, ActivityName & "_" & LayoutName & "_Custo" & ".map") = True Then
Cust.Name(ActivityName,LayoutName,FileDir)
'Apply new settings
For Each V As View In Activity.GetAllViewsRecursive
v = Cust.Draw(v)
Next
End If
Flag = False
End Sub
Sub mbaseLongClick
Cust.Save
For Each v As View In Activity.GetAllViewsRecursive
v.RemoveView
Next
Activity.LoadLayout(LayoutName)
LayoutRedraw
Flag = False
End Sub
Attachments
Last edited: