B4A Library [B4X] [XUI] AS Settings

Introducing a new library that allows you to create your own settings page with minimal code. This library comes equipped with automatic saving and loading features, making it incredibly easy to manage your settings. It supports booleans, free text, numbers, comboboxes, action buttons and more, giving you a wide range of options to customize your settings page. With this library, you can quickly and easily create a professional-looking settings page for your application or app without having to worry about complicated coding.

I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal or with a coffee. :)

The library is still in a beta phase, things can still change and there are still bugs that need to be fixed.

0rd1h6TCbjutla3ADFpfnlNKLNLonsrapOqePHBJZJ9A3UGOd8.png
FTZzgV4CZDcESNrYZIq5EviLuJFH2gGZ8o09ODFHc5Fe4IrWdZ.png

It uses conditional symbols in order to avoid adding dependencies when a feature is not required.

Feature
Tutorial
Comments
Boolean
1707943894885.png
Action
1707944593392.png
ActionClean
1707945094272.png
Text
1707945883946.png
ComboBox
AS_SettingsComboBoxExample.gif
SelectionList
(58) mage.png
SegmentedTab
68Gwy24byC6t25EmoUFMaYjmLsEYswKie0vfOyuZOTV6f7d8za.jpeg
PlusMinus
v0BTloye7NooRlNQ2mttxAJNMxCj91k9VvdTs8NrvBMGG3gj2b.jpeg
DatePicker
1691938825906.png
TimePicker
1691938910255.png
DescriptionItem
1707947177351.png

Examples:
B4X:
    AS_Settings1.MainPage.AddGroup("Basic","Basic Settings")
 
    AS_Settings1.MainPage.AddDescriptionItem("","Show sync help: when enabled, you'll see an explanation alert every time you tap 'Sync' on the Today tab.")
 
    'Boolean
    AS_Settings1.MainPage.AddProperty_Boolean("Basic","PropertyName_1","Overview in the morning","Your goals for today: Goal1, Goal2, Goal3",Null,True)
    AS_Settings1.MainPage.AddProperty_Boolean("Basic","PropertyName_2","Boolean Property False","Description Long Long Long Long Long Long Long Long Long Long Long Long Long Long Test Text",Null,False)

    AS_Settings1.MainPage.AddProperty_Boolean("Basic","PropertyName_3","Boolean Property True with a long text","",Null,True)
    'Action Button
    AS_Settings1.MainPage.AddProperty_Action("Basic","PropertyName_4","Action Property","",Null,"English")
    AS_Settings1.MainPage.AddProperty_Action("Basic","PropertyName_5","Icon","",AS_Settings1.FontToBitmap(Chr(0xF179),False,30,xui.Color_White),"English, German, Italian, Spanish, Swedish")
    AS_Settings1.MainPage.AddProperty_ActionClean("Basic","PropertyName_6","Delete Account","",AS_Settings1.FontToBitmap(Chr(0xE92B),True,34,xui.Color_White))
    AS_Settings1.MainPage.AddProperty_Action("Basic","PropertyName_7","Pro Feature","",Null,"Pro")
 
    AS_Settings1.MainPage.AddGroup("Advanced","Advanced Settings")
 
    'Numeric Example
    AS_Settings1.MainPage.AddProperty_Text("Advanced","PropertyName_8","Text Example","",Null,"Test",100dip,AS_Settings1.InputType_Text)
    AS_Settings1.MainPage.AddProperty_Text("Advanced","PropertyName_9","Numeric Example","",Null,24,60dip,AS_Settings1.InputType_Numeric)
    AS_Settings1.MainPage.AddProperty_Text("Advanced","PropertyName_10","Decimal Example","",Null,24.24,100dip,AS_Settings1.InputType_Decimal)
    'ComboBox
    AS_Settings1.MainPage.AddProperty_ComboBox("Advanced","PropertyName_11","ComboBox Example","",Null,1,Array("Option 1","Option 2","Option 3","Option 4"))
 
    AS_Settings1.MainPage.BottomText = "Alexander Stolte" & CRLF & "V1.0.2"
 
    AS_Settings1.MainPage.Create
 
 
    'Second Page
    SettingPage2.Initialize(AS_Settings1,"Page #2")
 
    SettingPage2.AddGroup("Page2","Page 2 Settings")
    SettingPage2.AddProperty_Boolean("Page2","PropertyName_1","Overview in the morning","Your goals for today: Goal1, Goal2, Goal3",Null,True)
    SettingPage2.AddProperty_Boolean("Page2","PropertyName_2","Overview in the morning","Your goals for today: Goal1, Goal2, Goal3",Null,True)
    SettingPage2.AddProperty_Boolean("Page2","PropertyName_30","Overview in the morning","Your goals for today: Goal1, Goal2, Goal3",Null,True)
    SettingPage2.AddProperty_Boolean("Page2","PropertyName_31","Overview in the morning","Your goals for today: Goal1, Goal2, Goal3",Null,True)
    SettingPage2.AddProperty_Boolean("Page2","PropertyName_32","Overview in the morning","Your goals for today: Goal1, Goal2, Goal3",Null,True)
    SettingPage2.AddProperty_Boolean("Page2","PropertyName_33","Overview in the morning","Your goals for today: Goal1, Goal2, Goal3",Null,True)
    SettingPage2.AddProperty_Boolean("Page2","PropertyName_34","Overview in the morning","Your goals for today: Goal1, Goal2, Goal3",Null,True)
Get and Set Properties at every place in your app:
'You can call this anywhere in your app without initializing the view first
AS_Properties.GetProperty("PropertyName_1")
AS_Properties.GetPropertyDefault("PropertyName_1",True)
AS_Properties.PutProperty("PropertyName_1",True)
B4j: jXUI,jSQL,xCustomListView,XUI Views
B4a: XUi,SQL,xCustomListView,XUI Views
B4i: iXUI,iSQL,xCustomListView,XUI Views
AS_Settings
Author: Alexander Stolte
Version: 1.00
  • ASSettings_CustomDrawProperty
    • Fields:
      • Group As ASSettings_Group
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Property As ASSettings_Property
      • PropertySettingViews As ASSettings_PropertySettingViews
      • PropertyViews As ASSettings_PropertyViews
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASSettings_Group
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Key As String
      • Name As String
      • Properties As List
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASSettings_Property
    • Fields:
      • DisplayName As String
      • Group As ASSettings_Group
      • Icon As B4XBitmap
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • isLast As Boolean
      • ItemList As List
      • PropertyName As String
      • Value As Object
      • ValueType As String
      • ValueTypeTextProperties As ASSettings_ValueTypeTextProperties
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASSettings_PropertySettingViews
    • Fields:
      • ActionButtonArrowLabel As B4XView
      • ActionValueLabel As B4XView
      • BackgroundPanel As B4XView
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASSettings_PropertyViews
    • Fields:
      • BackgroundPanel As B4XView
      • IconImageView As B4XView
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • NameLabel As B4XView
      • RootBackgroundPanel As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASSettings_ValueTypeTextProperties
    • Fields:
      • Color As Int
      • CornerRadius As Float
      • Height As Float
      • InputType As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextColor As Int
      • Width As Float
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_Properties
    • Functions:
      • GetProperty (PropertyName As String) As Object
      • GetPropertyDefault (PropertyName As String, DefaultValue As Object) As Object
        Gets a property value, if no value has been stored by this property yet, the default value is returned
      • Initialize As String
      • process_globals
      • PutProperty (PropertyName As String, Value As Object) As String
  • AS_Settings
    • Events:
      • ActionClicked (Property As ASSettings_Property)
      • CustomDrawProperty (CustomDrawProperty As ASSettings_CustomDrawProperty)
      • ValueChanged (Property As ASSettings_Property, Value As Object)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • AddGroup (Key As String, Name As String) As String
      • AddProperty_Action (GroupKey As String, PropertyName As String, DisplayName As String, Icon As B4XBitmap, DefaultValue As Object) As String
      • AddProperty_ActionClean (GroupKey As String, PropertyName As String, DisplayName As String, Icon As B4XBitmap) As String
      • AddProperty_Boolean (GroupKey As String, PropertyName As String, DisplayName As String, Icon As B4XBitmap, DefaultValue As Boolean) As String
        <code>AS_Settings1.AddProperty_Boolean("General","PropertyName_1","Boolean Property True",Null,True)</code>
      • AddProperty_ComboBox (GroupKey As String, PropertyName As String, DisplayName As String, Icon As B4XBitmap, DefaultValue As String, ItemList As List) As String
      • AddProperty_Text (GroupKey As String, PropertyName As String, DisplayName As String, Icon As B4XBitmap, DefaultValue As Object, Width As Float, InputType As String) As String
      • Base_Resize (Width As Double, Height As Double) As String
      • Class_Globals As String
      • Create
      • CreateASSettings_CustomDrawProperty (Group As ASSettings_Group, Property As ASSettings_Property, PropertyViews As ASSettings_PropertyViews, PropertySettingViews As ASSettings_PropertySettingViews) As ASSettings_CustomDrawProperty
      • CreateASSettings_Group (Key As String, Name As String, Properties As List) As ASSettings_Group
      • CreateASSettings_Property (PropertyName As String, DisplayName As String, Icon As B4XBitmap, ValueType As String, Value As Object, ItemList As List, ValueTypeTextProperties As ASSettings_ValueTypeTextProperties) As ASSettings_Property
      • CreateASSettings_PropertySettingViews (BackgroundPanel As B4XView, ActionButtonArrowLabel As B4XView, ActionValueLabel As B4XView) As ASSettings_PropertySettingViews
      • CreateASSettings_PropertyViews (RootBackgroundPanel As B4XView, BackgroundPanel As B4XView, IconImageView As B4XView, NameLabel As B4XView) As ASSettings_PropertyViews
      • CreateASSettings_ValueTypeTextProperties (Width As Float, Height As Float, xFont As B4XFont, TextColor As Int, Color As Int, InputType As String, CornerRadius As Float) As ASSettings_ValueTypeTextProperties
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • FontToBitmap (text As String, IsMaterialIcons As Boolean, FontSize As Float, color As Int) As B4XBitmap
      • getBackgroundColor As Int
      • getCornerRadius As Int
      • getGroupHeight As Float
      • getGroupNameBackgroundColor As Int
      • getHapticFeedback As Boolean
      • getInputType_Decimal As String
      • getInputType_Numeric As String
      • getInputType_Text As String
      • getPadding As Float
      • getPropertyColor As Int
      • getPropertyHeight As Float
      • getPropertySeperator As Boolean
      • getPropertySeperatorColor As Int
      • getSaveMode As String
        <code>AS_Settings1.SaveMode = AS_Settings1.SaveMode_Automatic</code>
      • getSaveMode_Automatic As String
      • getSaveMode_Manual As String
      • getSwitchFalseColor As Int
      • getSwitchThumbColor As Int
      • getSwitchTrueColor As Int
      • getValueType_Action As String
        Displays an arrow, the user can click on it and can be redirected to another page
      • getValueType_ActionClean As String
        Same as Action, but without an arrow and description
      • getValueType_Boolean As String
        Switch or Checkbox
      • getValueType_ComboBox As String
        Mit hoch Runter Icon
      • getValueType_Custom As String
      • getValueType_Text As String
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Refresh As String
      • setBackgroundColor (Color As Int) As String
        Background Color of the view
      • setCornerRadius (Radius As Int) As String
        The corner radius of a group
      • setGroupHeight (Height As Float) As String
        Height of a group name
      • setGroupNameBackgroundColor (Color As Int) As String
        The Background Color of the group name
      • setHapticFeedback (Enabled As Boolean) As String
        Haptic feedback of the switches and click actions
      • setPadding (Padding As Float) As String
        The Padding Left and Right
        Default value: 10dip
      • setPropertyColor (Color As Int) As String
        Background Color of a property
      • setPropertySeperator (Show As Boolean) As String
        If true a seperator is shown under a property
      • setPropertySeperatorColor (Color As Int) As String
        Color of the seperator
      • setSaveMode (Mode As String) As String
      • setSwitchFalseColor (Color As Int) As String
      • setSwitchThumbColor (Color As Int) As String
      • setSwitchTrueColor (Color As Int) As String
    • Properties:
      • BackgroundColor As Int
        Background Color of the view
      • CornerRadius As Int
        The corner radius of a group
      • GroupHeight As Float
        Height of a group name
      • GroupNameBackgroundColor As Int
        The Background Color of the group name
      • HapticFeedback As Boolean
        Haptic feedback of the switches and click actions
      • InputType_Decimal As String [read only]
      • InputType_Numeric As String [read only]
      • InputType_Text As String [read only]
      • Padding As Float
        The Padding Left and Right
        Default value: 10dip
      • PropertyColor As Int
        Background Color of a property
      • PropertyHeight As Float [read only]
      • PropertySeperator As Boolean
        If true a seperator is shown under a property
      • PropertySeperatorColor As Int
        Color of the seperator
      • SaveMode As String
        <code>AS_Settings1.SaveMode = AS_Settings1.SaveMode_Automatic</code>
      • SaveMode_Automatic As String [read only]
      • SaveMode_Manual As String [read only]
      • SwitchFalseColor As Int
      • SwitchThumbColor As Int
      • SwitchTrueColor As Int
      • ValueType_Action As String [read only]
        Displays an arrow, the user can click on it and can be redirected to another page
      • ValueType_ActionClean As String [read only]
        Same as Action, but without an arrow and description
      • ValueType_Boolean As String [read only]
        Switch or Checkbox
      • ValueType_ComboBox As String [read only]
        Mit hoch Runter Icon
      • ValueType_Custom As String [read only]
      • ValueType_Text As String [read only]
Changelog
  • 1.00
    • Release
  • 1.01 (read more)
    • AS_Settings
      • BugFixes
      • Add AddProperty_SegmentedTab - You can now add the AS_SegmentedTab
      • Add AddProperty_PlusMinus - You can now add the AS_PlusMinus
      • Add get ValueTypeTextProperties - Change the appearance of the text edits
      • Breaking Change - Add Description Property to all AddProperty_ functions
        • You can now display a short descripton to your properties
      • Add Designer Property ShowMadeWithLove - Shows the Made with Love in B4X Badge at the end of the list
        • Default: False
      • Add Designer Property MadeWithLoveTextColor - Text Color of the Made with Love Badge
        • Default: White
      • Add Designer Property BottomText - a custom text on the end of the list
        • Default: ""
      • Add Designer Property BottomTextTextColor
        • Default: White
    • AS_Properties
      • Add RemoveProperty - Removes a property from the db
      • Add ClearProperties - Clears all properties from the db
  • 1.02 (read more)
    • AS_Properties
      • Breaking change - For the intern database i'm now using the KeyValueStore lib.
        • This means that all settings are reset by the update
      • ClearProperties renamed to DeleteAllProperties
      • Add get KeyValueStore
    • AS_Settings
      • BugFixes in Property_SegmentedTab
        • AS_SegmentedTab V1.18+ needed
      • Add AddProperty_Chooser - looks like an AddProperty_Text, but is a label with click event
      • Add Event ChooserTextFieldClicked - Is triggered when you click on an AddProperty_Chooser
      • Add AddProperty_Custom - Is a CustomDrawProperty field, the CustomDrawProperty event is triggered, there you can add your own layout
      • Add Event CustomDrawProperty - You can now add your custom property layout
      • Add CustomDrawProperty_Add - You can add any view with this function and It is automatically added to the layout, you don't have to worry about where to put it
      • Add CustomDrawProperty_AddChooser - A chooser view is created
      • Add CustomDrawProperty_AddText - A simple text item
  • 1.03
    • AS_Settings
      • Add ResetGroups - Removes the groups, so that you can fill the view with new groups, without the groups that were previously visible
  • 1.04
    • AS_Settings
      • Description BugFixes
  • 1.05
    • AS_Settings (read more)
      • B4J Focused TextField at start bugfix
      • Add SetProperty_Boolean - Sets the value of a property as if the user had clicked the switch
        • The _ValueChanged event is triggered
      • Add GetProperty - Gets the property object
  • 2.00 (read more)
    • AS_Settings
      • Add AddSpaceItem
      • Add AddDescriptionItem
      • Add multi page support
      • Events should be added again, as all type names have changed
  • 2.01 (read more)
    • AS_SettingsPage
      • Add AddProperty_SelectionList - You can create single choice or multiple choice options
        • MultiSelect - If true more than one item can selected. If false only one item is selected if you click, it deselect the previous item
        • CanDeselectAll - If false, then the last item cannot be deselected, it need min one selected
    • AS_Settings
      • Add Designer Property SelectionItemSelectionColor - Color of the selection indicator
        • Default: White
      • Add Type AS_Settings_Property_SelectionList
      • Add Type AS_Settings_SelectionListItem
      • Add CreateSelectionListItem - Needed to build the items
  • 2.02
    • AS_SettingsPage
      • Added seperators to the SelectionList property
      • The ValueChanged event works now with the SelectionList Property
      • The .Refresh function is now smooth
      • BugFixes on the PropertyName height and Description height
  • 2.03 (read more)
    • AS_Settings
      • BugFixes and Improvemets
      • Add CreateList - Creates an list with just one line of code
      • Add Designer Property PropertyTextColor
      • Add set Theme
      • Add get Theme_Dark
      • Add get Theme_Light
      • Add Designer Property ThemeChangeTransition
        • Default: Fade
  • 2.04
    • AS_SettingsPage
      • if you now specify your own width for the property AddProperty_Text, you can now use more space
      • BugFixes
  • 2.05
    • AS_SettingsPage
      • SelectionList is now using more space
      • Add Property Custom
      • Add Event CustomDrawCustomProperty
    • AS_Settings
      • Add Event GroupHeaderClicked
Have Fun :)
 

Attachments

  • AS Settings Example.zip
    179 KB · Views: 126
  • AS_Settings.b4xlib
    21.3 KB · Views: 31
Last edited:

Mashiane

Expert
Licensed User
Longtime User
make this reusable to display different properties depending on choices
Can I please clarify..

For example, assuming that you have these properties...

1695830360346.png


I'd like to use the same settings component but clear and replace these with some other options. The clearing will remove all the displayed settings and I am able to add others

As an example, my "AS Settings" component is named propbag. So I want to reuse it on button click like.

B4X:
Sub PageSettings
    AS_Properties.DeleteAllProperties
    propbag.AddGroup("Basic","Basic Settings")
    propbag.AddProperty_Text("Basic", "pagename", "Page Name", "", Null, "Page 1", 100dip, propbag.InputType_Text)
    propbag.AddProperty_Boolean("Basic","PropertyName_1","Boolean Property True","Description Test Text",Null,True)
End Sub

This will display a text box with boolean only.

B4X:
Sub ComponentSettings
    AS_Properties.DeleteAllProperties
    propbag.AddGroup("Basic","Basic Settings")
    propbag.AddProperty_Text("Basic", "componentname", "Component Name", "" , Null, "Test", 100dip, propbag.InputType_Text)
End Sub

I hope you understand, can I do that with this?
 

Alexander Stolte

Expert
Licensed User
Longtime User
I hope you understand
No I do not.
You need to call AS_Settings1.Create if you want to build the list new.
This property clears the customlistview and builds the view new with the properties you add with e.g. propbag.AddProperty_Boolean.

For further questions it would be useful to make a separate thread. Here no one will find an answer if he uses the search.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.03
    • AS_Settings
      • Add ResetGroups - Removes the groups, so that you can fill the view with new groups, without the groups that were previously visible
Example
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.05
    • AS_Settings
      • B4J Focused TextField at start bugfix
      • Add SetProperty_Boolean - Sets the value of a property as if the user had clicked the switch
        • The _ValueChanged event is triggered
      • Add GetProperty - Gets the property object
SetProperty_Boolean
In the following example, PropertyName_2 and PropertyName_3 are set to the same value as PropertyName_1. e.g. PropertyName_2 and PropertyName_3 are dependent on PropertyName_1, if PropertyName_1 = False then the other 2 should also be False.
B4X:
Private Sub AS_Settings1_ValueChanged(Property As ASSettings_Property, Value As Object)
    Select Property.PropertyName
        Case "PropertyName_1"
            AS_Settings1.SetProperty_Boolean("PropertyName_2",Value)
            AS_Settings1.SetProperty_Boolean("PropertyName_3",Value)
        Case Else
            Log("PropertyName: " & Property.PropertyName & " Value: " & Value)
    End Select
End Sub
AS_Settings SetProperty_Boolean Example.gif

GetProperty
The object property has a new variable called "view". It contains the view with which the user interacts. e.g. for a boolean it is the B4XSwitch, for a text it is the TextField.

In the following example, I deactivate PropertyName_2 and PropertyName_3 whenever PropertyName_1 is not True.
B4X:
Private Sub AS_Settings1_ValueChanged(Property As ASSettings_Property, Value As Object)
    Select Property.PropertyName
        Case "PropertyName_1"
            AS_Settings1.GetProperty("PropertyName_2").View.As(B4XSwitch).Enabled = Value
            AS_Settings1.GetProperty("PropertyName_3").View.As(B4XSwitch).Enabled = Value
        Case Else
            Log("PropertyName: " & Property.PropertyName & " Value: " & Value)
    End Select
End Sub
AS_Settings GetProperty Example.gif


I have opened 2 new example threads so that the whole thing is not forgotten:
 
Last edited:

AnandGupta

Expert
Licensed User
Longtime User
In the following example, PropertyName_2 and PropertyName_3 are set to the same value as PropertyName_1. e.g. PropertyName_2 and PropertyName_3 are dependent on PropertyName_1, if PropertyName_1 = False then the other 2 should also be False.
This is what many many members were asking for in Preference Dialog. Now all of them will thank you for fulfilling there wish.
 

Alexander Stolte

Expert
Licensed User
Longtime User
The next version is a huge update, with a complete rewrite of the most logic and handling.

One of the new features is paging, you can create as many pages as you want, to show sub, sub, sub settings and options.
You can get a small insight in the following video. In the video you can see a 2nd new feature.


The backend has not been touched, all your saved settings are untouched.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.00
    • AS_Settings
      • Add AddSpaceItem
      • Add AddDescriptionItem
      • Add multi page support
      • Events should be added again, as all type names have changed
AddDescriptionItem

(56) mage.png

AddSpaceItem
Is a space item without content, you can set a custom height
Multi page support
Multipage support is a important feature, it allows you to outsource settings to a second page.
As there are too many different designs for headers, I opted for the bottom sheet version.

Breaking changes
The complete library has been rewritten, most commands need a .MainPage in front of them. Just have a look at the example projects, they are all up to date.
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.01
    • AS_SettingsPage
      • Add AddProperty_SelectionList - You can create single choice or multiple choice options
        • MultiSelect - If true more than one item can selected. If false only one item is selected if you click, it deselect the previous item
        • CanDeselectAll - If false, then the last item cannot be deselected, it need min one selected
    • AS_Settings
      • Add Designer Property SelectionItemSelectionColor - Color of the selection indicator
        • Default: White
      • Add Type AS_Settings_Property_SelectionList
      • Add Type AS_Settings_SelectionListItem
      • Add CreateSelectionListItem - Needed to build the items
AddProperty_SelectionList
(57) mage.png
(58) mage.png

New tutorial:
 

lordjuergen

Member
Licensed User
Longtime User
How can I change the PropertyColor as the "PropertyColor" changes the background color. The property textcolor is always white and I don't find the way to change this.
 

Alexander Stolte

Expert
Licensed User
Longtime User
There are an option - as the ASScheduler_Theme - to change the theme to a light mode?
Currently not yet. I've put it on the to-do list

The property textcolor is always white and I don't find the way to change this.
B4X:
AS_Settings1.PropertyProperties.TextColor = xui.Color_Red
A few color things are still hardcoded, but should be fixed when I have finished the function to switch from dark to light
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.02
    • AS_SettingsPage
      • Added seperators to the SelectionList property
      • The ValueChanged event works now with the SelectionList Property
      • The .Refresh function is now smooth
      • BugFixes on the PropertyName height and Description height
 

Sergio Haurat

Active Member
Licensed User
Longtime User
Hello @Alexander Stolte, I am trying to integrate this library into my project and I am encountering the following problem:

My code:
B4X:
Sub Class_Globals
  Private appSettings As AS_Settings
End Sub

Private Sub B4XPage_Appear
  appSettings.MainPage.AddGroup("set_fed_club", mdlFunctions.loc.Localize("settings_short"))
  appSettings.MainPage.AddProperty_Action("set_fed_club", "set_fed", mdlFunctions.loc.Localize("fed_desc"), mdlFunctions.loc.Localize("fed"), Null, 0)
  appSettings.MainPage.AddProperty_Action("set_fed_club", "set_club", mdlFunctions.loc.Localize("club_desc"), mdlFunctions.loc.Localize("club"), Null, 0)
    
  appSettings.MainPage.AddGroup("set_adv", mdlFunctions.loc.Localize("set_advance"))
  appSettings.MainPage.AddProperty_Boolean("set_adv", "connectTo", "Boolean Value", "Boolean description", Null, True)

  appSettings.MainPage.BottomText = mdlFunctions.loc.Localize("settings_desc")
  appSettings.MainPage.Create
End Sub

The lines 7 and 8 with "AddProperty_Action" show me this "java.lang" :rolleyes:
1708889888621.png


Line 11 with AddProperty_Boolean, if I don't comment it, it stops the application and generates the following error

** Service (starter) Start **
** Activity (main) Create (first time) **
2400
2400
Device locale: es
Found 139 strings.
*** : B4XPage_Foreground
*** mainpage: B4XPage_Created
Found 139 strings.
*** mainpage: B4XPage_Appear
** Activity (main) Resume **
*** Receiver (firebasemessaging) Receive (first time) ***
TokenRefresh: *************
Error occurred on line: 57 (B4XSwitch)
java.lang.RuntimeException: Cannot parse: java.lang.Object@b645780 as boolean
at anywheresoftware.b4a.BA.parseBoolean(BA.java:640)
at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:710)
at ar.com.sysprofile.psahb.b4xswitch._designercreateview(b4xswitch.java:149)
at ar.com.sysprofile.psahb.as_settingspage._addinternproperty(as_settingspage.java:1518)
at ar.com.sysprofile.psahb.as_settingspage._xclv_main_visiblerangechanged(as_settingspage.java:3636)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:984)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loopOnce(Looper.java:238)
at android.os.Looper.loop(Looper.java:357)
at android.app.ActivityThread.main(ActivityThread.java:8118)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:957)
Error occurred on line: 57 (B4XSwitch)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:479)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:293)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA$2.run(BA.java:395)

The example app doesn't have this problem. I have reviewed the code many times and I cannot solve it. What do you suggest me ?
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 2.03
    • AS_Settings
      • BugFixes and Improvemets
      • Add CreateList - Creates an list with just one line of code
      • Add Designer Property PropertyTextColor
      • Add set Theme
      • Add get Theme_Dark
      • Add get Theme_Light
      • Add Designer Property ThemeChangeTransition
        • Default: Fade

Just one line of code to change the theme :)
B4X:
Private Sub Switch1_ValueChanged (Value As Boolean)
    If Value Then
        AS_Settings1.Theme = AS_Settings1.Theme_Dark
    Else
        AS_Settings1.Theme = AS_Settings1.Theme_Light
    End If
End Sub
 

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hey Alexander,
the example project works great. but as soon as i use it in my app in debug mode i get this error:


B4X:
B4A line: 41
isMainPage = Settings.Pages.NumberOfViews = 0
shell\src\de\dinotec\netplus\as_settingspage_subs_0.java:3125: error: cannot find symbol
__ref.setField ("_ismainpage" /*RemoteObject*/ ,BA.ObjectToBoolean(RemoteObject.solveBoolean("=",as_settingspage._settings.runClassMethod (de.dinotec.netplus.as_settings.class, "_getpages" /*RemoteObject*/ ).runMethod(true,"getNumberOfViews"),BA.numberCast(double.class, 0))));
                                                                                                                          ^
  symbol:   method runClassMethod(Class<as_settings>,String)
  location: variable _settings of type settings
1 error

It works in release mode.

currently i just instantiate it with
Private AS_Settings1 As AS_Settings
nothing else and it still crash while compiling.

any idea whats the cause of this?
 
Top