Android Question Want animation of preference dialog

AnandGupta

Expert
Licensed User
Longtime User
I want to animate show the preference dialog, i.e. the preference dialog to open by scrolling down from top and closes by scrolling up to top.
How ?
 
Solution
Something like this:

B4X:
    Dim PrefDlg As PreferencesDialog
  
    Dim Left, EndTop, Width, Height As Int
    Width = 150dip
    Left = (Root.Width - Width) / 2
    PrefDlg.Initialize(Root, "Title", Width, Height)
    Dim Data As Map = CreateMap()
    Dim PDE As ResumableSub = PrefDlg.ShowDialog(Data, "OK", "CANCEL")
    Height = PrefDlg.Dialog.Base.Height
  
    PrefDlg.Dialog.Base.Visible = True
    EndTop = (Root.Height - Height) / 2
    PrefDlg.mBase.As(Panel).Elevation = 100dip
    PrefDlg.Dialog.Base.SetLayoutAnimated(0, Left, -Height, Width, Height)
    PrefDlg.Dialog.Base.SetLayoutAnimated(500, Left, EndTop, Width, Height)
    Wait For (PDE) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then

    End If...

LucaMs

Expert
Licensed User
Longtime User
Something like this:

B4X:
    Dim PrefDlg As PreferencesDialog
  
    Dim Left, EndTop, Width, Height As Int
    Width = 150dip
    Left = (Root.Width - Width) / 2
    PrefDlg.Initialize(Root, "Title", Width, Height)
    Dim Data As Map = CreateMap()
    Dim PDE As ResumableSub = PrefDlg.ShowDialog(Data, "OK", "CANCEL")
    Height = PrefDlg.Dialog.Base.Height
  
    PrefDlg.Dialog.Base.Visible = True
    EndTop = (Root.Height - Height) / 2
    PrefDlg.mBase.As(Panel).Elevation = 100dip
    PrefDlg.Dialog.Base.SetLayoutAnimated(0, Left, -Height, Width, Height)
    PrefDlg.Dialog.Base.SetLayoutAnimated(500, Left, EndTop, Width, Height)
    Wait For (PDE) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then

    End If

I have yet to find out why the dialog is not superimposed on the layout but I am busy with Milan-Fiorentina, now 😄

P.S.: The goalkeeper gave the ball to the Milan striker in the 82nd minute. 1-0. 😭😭😭
 
Last edited:
Upvote 1
Solution

AnandGupta

Expert
Licensed User
Longtime User
Eureka !
Added the below code and it scrolls down 👍
B4X:
    Dim Height As Long = prefDialog.Dialog.Base.Height
    Dim Left As Long = prefDialog.Dialog.Base.Left
    Dim Width As Long = prefDialog.Dialog.Base.Width
    prefDialog.Dialog.Base.SetLayoutAnimated(0, Left, -Height, Width, Height)
    prefDialog.Dialog.Base.SetLayoutAnimated(500, Left, 20dip, Width, Height)
 
Upvote 0
Top