Android Question B4XPreferencesDialog leave animation off

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Experimenting with the B4XPreferencesDialog b4xlib and would like to turn off the animation when the dialog shows.
Is there a way to do this without altering any library source code?

RBS
 

William Lancee

Well-Known Member
Licensed User
Longtime User
FYI. It works for me in the test below: 'test 1' animates, 'test 2' doesn't

B4X:
    dia.Initialize(Root)
    dia.OverlayColor = xui.color_transparent
    'dia.VisibleAnimationDuration = 2000            'test 1
    dia.VisibleAnimationDuration = 0            'test 2

Edit: Wait - I am testing in B4J, let me switch to B4A
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
FYI. It works for me in the test below: 'test 1' animates, 'test 2' doesn't

B4X:
    dia.Initialize(Root)
    dia.OverlayColor = xui.color_transparent
    'dia.VisibleAnimationDuration = 2000            'test 1
    dia.VisibleAnimationDuration = 0            'test 2

Edit: Wait - I am testing in B4J, let me switch to B4A
Ok, thanks. Maybe I did a different animation property. Will have a look
in a bit and get it fixed.

RBS
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private dia As B4XDialog
End Sub

Public Sub Initialize
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    dia.Initialize(Root)
    dia.BlurBackground = False
    dia.OverlayColor = xui.color_transparent
    dia.VisibleAnimationDuration = 0
End Sub

Private Sub Button1_Click
    dia.Show("help", "Yes", "No", "Cancel")
End Sub
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private dia As B4XDialog
End Sub

Public Sub Initialize
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
   
    dia.Initialize(Root)
    dia.BlurBackground = False
    dia.OverlayColor = xui.color_transparent
    dia.VisibleAnimationDuration = 0
End Sub

Private Sub Button1_Click
    dia.Show("help", "Yes", "No", "Cancel")
End Sub
I added this code to my project, but it doesn't get rid of the animation.
Actually VisibleAnimationDuration = 0 is already added to the code in PreferencesDialog:

B4X:
Public Sub Initialize (Parent As B4XView, Title As Object, Width As Int, Height As Int)
    
    vParent = Parent
    Dialog.Initialize(Parent)
    Dialog.VisibleAnimationDuration = 0
    mTitle = Title
    mBase = xui.CreatePanel("mBase")
    mBase.SetLayoutAnimated(0, 0, 0, Width, Height)
    mBase.LoadLayout("ListTemplate")
    mBase.SetColorAndBorder(xui.Color_Transparent, 0, 0, 0)
    CustomListView1.sv.SetColorAndBorder(xui.Color_Transparent, 0, 0, 0)
    CustomListView1.PressedColor = xui.Color_Transparent
    PrefItems.Initialize
    SearchTemplate.Initialize
    DateTemplate.Initialize
    LongTextTemplate.Initialize
    LongTextTemplate.CustomListView1.PressedColor = 0
    Dialog.OverlayColor = xui.Color_Transparent
    #if B4J
    Dim sv As ScrollPane = CustomListView1.sv
    sv.StyleClasses.Add("b4xdialog")
    sv.InnerNode.StyleClasses.Add("b4xdialog")
    #end if
    setTheme(THEME_LIGHT)
    
    'this is to disable the default keyboard
    NativeMe.InitializeContext
    
End Sub

RBS
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
I added this code to my project, but it doesn't get rid of the animation.
Actually VisibleAnimationDuration = 0 is already added to the code in PreferencesDialog:

B4X:
Public Sub Initialize (Parent As B4XView, Title As Object, Width As Int, Height As Int)
   
    vParent = Parent
    Dialog.Initialize(Parent)
    Dialog.VisibleAnimationDuration = 0
    mTitle = Title
    mBase = xui.CreatePanel("mBase")
    mBase.SetLayoutAnimated(0, 0, 0, Width, Height)
    mBase.LoadLayout("ListTemplate")
    mBase.SetColorAndBorder(xui.Color_Transparent, 0, 0, 0)
    CustomListView1.sv.SetColorAndBorder(xui.Color_Transparent, 0, 0, 0)
    CustomListView1.PressedColor = xui.Color_Transparent
    PrefItems.Initialize
    SearchTemplate.Initialize
    DateTemplate.Initialize
    LongTextTemplate.Initialize
    LongTextTemplate.CustomListView1.PressedColor = 0
    Dialog.OverlayColor = xui.Color_Transparent
    #if B4J
    Dim sv As ScrollPane = CustomListView1.sv
    sv.StyleClasses.Add("b4xdialog")
    sv.InnerNode.StyleClasses.Add("b4xdialog")
    #end if
    setTheme(THEME_LIGHT)
   
    'this is to disable the default keyboard
    NativeMe.InitializeContext
   
End Sub

RBS
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Figured out now what is causing these animations.
In my project for now I am only using text fields (B4XFloatTextField in the XUI Views library) and switches (B4XSwitch in the XUI Views library).
These 2 XUI Views components have animations by default.
For now I turned these of by altering the code of these library components:

For the B4XSwitch:

B4X:
Public Sub setValue(b As Boolean)
    If b = mValue Then Return
    SetValueImpl(b, True) 'set value immediate, so changed from False to True
End Sub

For the B4XFloatTextField in Sub Class_Globals:

B4X:
Public AnimationDuration As Int '= 200

Ideally I would alter these 2 variables with code in the main project, rather than altering the source code, but not seen an easy way yet to do that.

RBS
 
Upvote 0
Top