B4A Library Android UI components 2024 - TUMMO UI

This is a collection of specialized tools for Android that programmers often use in the deployment of Android projects. While not a cross-platform tool, it will make B4A proficient members more convenient in creating professional and easily maintainable apps, saving a lot of time.
Below, I will provide a summary of the main functions of the TummoHelper toolkit - Release 1.62:

(1) ViewHelper:
This tool serves as a bridge between resources and views, receiving resource IDs from the ResourceHelper class and connecting to views.
(2) ResourcesHelper: This class manages resources in a very easy way. Programmers can easily load any resources into views.
(3) RadialGradientHelper: A gradient color utility for Android. Besides helping to quickly and easily create gradient colors, the tool also integrates some available color templates for programmers to choose from.
(4) LayoutHelper: The LayoutHelper tool helps you load layouts into view groups like Panel, Activity, in a very convenient way.
(5) ColorsHelper: A tool that helps manage and convert various color types.
(6) AnimationHelper: Helps quickly create easy animations, which can be applied to almost any type of view.
-----------------------------------
Source code: https://github.com/tummosoft/TummoUI

1. Example: Animation loading...

AnimationHelper:
Dim radius As Float
    Dim centerX As Float
    Dim centerY As Float
    Private xImageView1 As xImageView
 
    Dim anim As AnimationHelper
    anim.initialize("anim")

********
Sub SetAnimal(ball As Label)
    radius = 100dip
    centerX = (100dip + ball.Width) / 2.0
    centerY = (100dip + ball.Height) / 2.0
End Sub

Private Sub Button1_Click
    Dim target As Float = 0
    Dim theend As Float = 360
    SetAnimal(ball1)
    anim.startAccelerateDecelerateInterpolator(ball1,"anim", 1000, "rotation", target, theend)
 
End Sub

Sub anim_onAnimationUpdate(angle As Float)
    Log("rolate:" & angle)
    If ((angle > 160) And (angle < 180)) Then
        Dim target As Float = 0
        Dim theend As Float = 360
        SetAnimal(ball2)
        anim.startAccelerateDecelerateInterpolator(ball2,"anim2", 1000, "rotation", target, theend)
    End If
End Sub

Sub anim2_onAnimationUpdate(angle As Float)
 
    If ((angle > 160) And (angle < 180)) Then
        Dim target As Float = 0
        Dim theend As Float = 360
        SetAnimal(ball3)
        anim.startAccelerateDecelerateInterpolator(ball3,"anim3", 1000, "rotation", target, theend)
    End If
End Sub

Sub anim3_onAnimationUpdate(angle As Float)
 
    If ((angle > 160) And (angle < 180)) Then
        Dim target As Float = 0
        Dim theend As Float = 360
        SetAnimal(ball1)
        anim.startAccelerateDecelerateInterpolator(ball1,"anim", 1000, "rotation", target, theend)
    End If
 
End Sub


ezgif-5-510b1fddb7.gif
 

Attachments

  • Animation_xample1.zip
    4.2 KB · Views: 181
  • Android_Library.zip
    101.9 KB · Views: 202
  • constraintlayout-solver-2.0.4.jar
    225.7 KB · Views: 129
  • constraintlayout-2.1.4.aar.zip
    465.5 KB · Views: 146
  • Library_1.67.zip
    195.8 KB · Views: 1
Last edited:

tummosoft

Active Member
Licensed User
Longtime User
Updated: 2024/12/04
Source: https://github.com/tummosoft/TummoUI
--------
* Layout Animation

video2.gif


Layout Animation:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private Button1 As Button
    Private Button2 As Button
    Private layoutAni As AnimationHelper
    Private index As Int = 0
    Dim linear_layout As xLinearLayout
    Private top As Int = 0
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
 
    linear_layout.initialize("linear", linear_layout.ROW_HORIZONTAL, linear_layout.COLUMN_TOP, linear_layout.GRAVITY_CENTER, 100%x, 100%y - 60dip)
 
    Activity.AddView(linear_layout, 0,0, 100%x, 100%y- 60dip)
    layoutAni.initialize("layoutAni")
    layoutAni.LayoutAnimator_initialize(linear_layout)
    layoutAni.LayoutAnimatorIn(layoutAni.CreateObjectAnimator(Null, "rotationY", Array As Float (0.0f,360.0f,0.0f)), "APPEARING") 'APPEARING, CHANGE_APPEARING, CHANGE_DISAPPEARING, CHANGING, DISAPPEARING
    layoutAni.LayoutAnimatorOut(layoutAni.CreateObjectAnimator(Null, "rotation", Array As Float (0.0f,0.0f,90.0f)), "DISAPPEARING") 'APPEARING, CHANGE_APPEARING, CHANGE_DISAPPEARING, CHANGING, DISAPPEARING
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    Dim btn1 As Button
    btn1.Initialize("")
    btn1.Text = "Item " & index
    index = index + 1
    linear_layout.AddView(btn1, 0, top, 0, 0, 120dip, 40dip)
    top = top + 40dip
End Sub

Private Sub Button2_Click
    index = index - 1
    linear_layout.RemoveViewAt(index)
 
End Sub

Private Sub startTransition(view As Object)
 
End Sub

Private Sub endTransition(view As Object)
 
End Sub
 

Attachments

  • layout_animation.zip
    3.9 KB · Views: 26
  • Library_1.64.zip
    168.2 KB · Views: 24
Last edited:

tummosoft

Active Member
Licensed User
Longtime User
* AnimationHelper:
----------------------------
video1.gif


AnimationHelper:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    Dim ani As AnimationHelper
    Private Label1 As Label
    Private CheckBox1 As CheckBox
    Private CheckBox2 As CheckBox
    Private CheckBox5 As CheckBox
    Private CheckBox6 As CheckBox
    Private CheckBox3 As CheckBox
    Private CheckBox4 As CheckBox
    Private CheckBox7 As CheckBox
    Private CheckBox8 As CheckBox
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    ani.initialize("ani")
    ani.ValueAnimatorOfInt(Array As Int(150,400))
    ani.ValueAnimatorMethod = "Linear"
 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    ani.ValueAnimatorOfInt_Start(0,0,500)
End Sub

Sub ani_OnAnimationUpdate(value As Float)
    Label1.Top = value
End Sub

Sub ani_onAnimationStart()
    Log("onAnimationStart")
End Sub

Sub ani_onAnimationEnd()
    Log("onAnimationEnd")
End Sub

Sub ani_onAnimationRepeat()
 
End Sub

Sub ani_onAnimationCancel()
 
End Sub

Private Sub checkani_CheckedChange(Checked As Boolean)
    Dim check As CheckBox = Sender
    ani.ValueAnimatorMethod = check.Text
 
End Sub
 

Attachments

  • animation.zip
    4.1 KB · Views: 28
  • Library_1.64.zip
    168.2 KB · Views: 28
Last edited:

tummosoft

Active Member
Licensed User
Longtime User
* AnimationHelper:
----------------------------
New method: AnimationDrawable

video3.gif


B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private ImageView1 As ImageView
    Dim aniHelp As AnimationHelper
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
   
    aniHelp.initialize("aniHelp")
    aniHelp.AnimationDrawable_initialize(False)
   
    Dim tuUtils As ResourcesHelper
    tuUtils.initialize
   
   
    Dim p1 As Int = tuUtils.getResourceId("h1","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p1), 80)
    Dim p2 As Int = tuUtils.getResourceId("h2","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p2), 80)
    Dim p3 As Int = tuUtils.getResourceId("h3","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p3), 80)
    Dim p4 As Int = tuUtils.getResourceId("h4","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p4), 80)
    Dim p5 As Int = tuUtils.getResourceId("h5","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p5), 80)
    Dim p6 As Int = tuUtils.getResourceId("h6","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p6), 80)
    Dim p7 As Int = tuUtils.getResourceId("h7","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p7), 80)
    Dim p8 As Int = tuUtils.getResourceId("h8","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p8), 80)
       
    ImageView1.Background = aniHelp.GetAnimationDrawable
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    aniHelp.AnimationDrawable_Start
End Sub
 

Attachments

  • res.zip
    170.3 KB · Views: 23
  • AnimationDrawable_example.zip
    3.8 KB · Views: 26
  • Library_1.64.zip
    168.2 KB · Views: 24
Last edited:

tummosoft

Active Member
Licensed User
Longtime User
* AnimationHelper:
----------------------------
New method: Animation from Resource ID

video5.gif


Scale:
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="700"
    android:fromXScale="0.0"
    android:fromYScale="0.0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toXScale="1.0"
    android:toYScale="1.0" />

AnimationHelper:
Sub Globals
    Private aniHelp As AnimationHelper
    Dim dialog As Panel
    Dim aniResourceID As Int
    Dim btn2 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    aniHelp.initialize("aniHelp")
    
    btn2.Initialize("btn2")
    btn2.Text = "Animation "
    
    Dim tuUtils As ResourcesHelper
    tuUtils.initialize
    dialog.Initialize("dialog")
    dialog.LoadLayout("layout_dialog")
    Activity.AddView(btn2, 5%x, 50%y, 300dip, 40dip)
    aniResourceID = tuUtils.getResourceId("ani","xml")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    aniHelp.AnimationFromResID(btn2, aniResourceID)
End Sub
 

Attachments

  • res.zip
    7.1 KB · Views: 22
  • AnimationFromResID.zip
    5.1 KB · Views: 23
  • Library_1.64.zip
    168.2 KB · Views: 26

tummosoft

Active Member
Licensed User
Longtime User
New class: CameraHelper
*************
Example: Card Flip Animation


video6.gif


CardFlipAnimation class:
Sub Class_Globals
    Private cameraView As CameraHelper
    Private centerX As Float
    Private centerY As Float
    Private isReversed As Boolean
    Dim anim As AnimationHelper
    Dim degrees As Float
    Dim matrix As xMatrix
End Sub

Public Sub Initialize(X As Float, Y As Float, Reversed As Boolean)
    cameraView.initialize("cameraView")
    centerX = X / 2.0f
    centerY = Y / 2.0f
  
    isReversed = Reversed
    anim.initialize("anim")     
End Sub

Public Sub GetAimation() As AnimationHelper
    Return anim
End Sub

Sub anim_applyTransformation(interpolatedTime As Float, t As xTransformation)
    degrees = 180 * interpolatedTime
    matrix = t.Matrix
  
    cameraView.save()
    If (isReversed) Then
        cameraView.rotateX(-degrees)
    Else
        cameraView.rotateY(degrees)
    End If
  
    cameraView.getMatrix(matrix)
    cameraView.restore()

    matrix.preTranslate(-centerX, -centerY)
    matrix.postTranslate(centerX, centerY)
  
    Log(degrees)
  
End Sub

Main Module:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    Private flipcard As CardFlipAnimation
    Private container As Panel 
    Dim containerView As xView
    Private cardBack As ImageView
    Private cardFront As ImageView
    Private isFrontVisible As Boolean = True
    Private backOfCard As xView
    Private frontOfCard As xView
    Private anim As AnimationHelper
    Private ImageView1 As ImageView
    Private ImageView2 As ImageView
    Private Panel1 As Panel
    Private flipcard2 As CardFlipAnimation
    Private backOfCard1 As xView
    Private frontOfCard1 As xView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
  
    flipcard.initialize(container.Width, container.Height, True)
      
          
    isFrontVisible = True
    backOfCard = cardBack
    frontOfCard = cardFront
  
    containerView = container
    anim.initialize("anim")
    anim.SetAnimationEvent("anim", flipcard.GetAimation, 300, True)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
  
End Sub


Private Sub container_Click
    containerView.startAnimation(flipcard.GetAimation)
End Sub

Sub anim_OnAnimationStart(view As Object)
  
End Sub

Sub anim_OnAnimationEnd(view As Object)
    If (isFrontVisible) Then
        frontOfCard.Visibility = "GONE"
        backOfCard.Visibility = "VISIBLE"
        isFrontVisible = False
    Else
        frontOfCard.Visibility = "VISIBLE"
        backOfCard.Visibility = "GONE"
        isFrontVisible = True
    End If
  
End Sub

Sub anim_OnAnimationRepeat(view As Object)
  
End Sub
 

Attachments

  • FlipCard_example.zip
    31.6 KB · Views: 17
  • Library_1.65.zip
    179 KB · Views: 10
Last edited:

tummosoft

Active Member
Licensed User
Longtime User
* AnimationHelper:
----------------------------
New method: AnimationSet

video6 (1).gif


AnimationSet:
Dim aniHelp2 As AnimationHelper
    aniHelp2.initialize(" aniHelp2")
    
    Dim latorIn As xInterpolator
    latorIn.initialize("Decelerate")
    Dim latorOut As xInterpolator
    latorOut.initialize("Accelerate")
    
    Dim fadeIn As xAnimation = aniHelp2.CreateAlphaAnimation(0.2, 1.0, 500, latorIn, False, -1, -1)
    Dim fadeout As xAnimation = aniHelp2.CreateAlphaAnimation(1, 0.2, 500, latorOut, False, -1, -1)
    
    aniHelp.AnimationSet_initialize()
    aniHelp.AnimationSet_addAnimation(fadeIn)
    aniHelp.AnimationSet_addAnimation(fadeout)
    aniHelp.AnimationSet_Start(pnlCall)
 

Attachments

  • Library_166.zip
    182.7 KB · Views: 12
  • AnimationSet_example.zip
    52.8 KB · Views: 13

tummosoft

Active Member
Licensed User
Longtime User
* AnimationHelper:
----------------------------
New method: Animator and AnimatorSet

video6 (2).gif


AnimatorSet:
Sub Process_Globals
    Private xui As XUI
End Sub

Sub Globals  
    Private btnBounceAnimator As Button
    Private aniHelper As AnimationHelper
    Private lblTarger As Label
    Private aniView As xView
    Dim BounceAnimator As xObjectAnimator
    Dim FlashAnimator As xObjectAnimator
       
    Private btnFlashAnimator As Button
    Private btnPulseAnimator As Button
    Private btnSlideInLeft As Button
    Private btnSlideInRight As Button
    Dim AlphaAnimator As xObjectAnimator
    Dim translationXAnimator As xObjectAnimator
    Dim translationYAnimator As xObjectAnimator
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    aniHelper.initialize("aniHelper")
    aniView = lblTarger
    BounceAnimator.initialize("Animator")
    BounceAnimator = aniHelper.CreateObjectAnimatorOfFloat(lblTarger, "translationY", Array As Float(0, 0, -30, 0, -15, 0, 0))
   
    FlashAnimator.initialize("Animator")
    FlashAnimator =  aniHelper.CreateObjectAnimatorOfFloat(lblTarger, "alpha", Array As Float(1, 0, 1, 0, 1))
   
    Dim latorIn As xInterpolator
    latorIn.initialize("Decelerate")
    Dim latorOut As xInterpolator
    latorOut.initialize("Accelerate")
   
   
    ' SlideInLeft
    AlphaAnimator = aniHelper.CreateObjectAnimatorOfFloat(lblTarger, "alpha", Array As Float(0, 1))
    translationXAnimator = aniHelper.CreateObjectAnimatorOfFloat(lblTarger, "translationX", Array As Float(-lblTarger.Width, 0))
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Animator_onAnimationStart(anmtr As xAnimator)
   
End Sub

Sub Animator_onAnimationEnd(anmtr As xAnimator)
   
End Sub

Sub Animator_onAnimationCancel(anmtr As xAnimator)
   
End Sub

Sub Animator_onAnimationRepeat(anmtr As xAnimator)
   
End Sub


Private Sub btnBounceAnimator_Click
    BounceAnimator.Start
End Sub

Private Sub btnFlashAnimator_Click
    FlashAnimator.Start
End Sub

Private Sub btnPulseAnimator_Click
   
End Sub

Private Sub btnSlideInLeft_Click
    aniHelper.AnimatorSet_initialize
    aniHelper.AnimatorSet_addAnimator(Array As Object(AlphaAnimator.ObjectAnimator, translationXAnimator.ObjectAnimator))  
    translationYAnimator= aniHelper.CreateObjectAnimatorOfFloat(lblTarger, "translationX", Array As Float(lblTarger.Width, 0))
    aniHelper.AnimatorSet_Start
End Sub

Private Sub btnSlideInRight_Click
    aniHelper.AnimatorSet_initialize
    aniHelper.AnimatorSet_addAnimator(Array As Object(AlphaAnimator.ObjectAnimator, translationYAnimator.ObjectAnimator))
    aniHelper.AnimatorSet_Start
   
End Sub
 

Attachments

  • Animation Examples.zip
    4.1 KB · Views: 13
  • Library_1.67.zip
    195.8 KB · Views: 1
Last edited:

Theera

Well-Known Member
Licensed User
Longtime User
* AnimationHelper:
----------------------------
New method: AnimationDrawable

View attachment 159221

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private ImageView1 As ImageView
    Dim aniHelp As AnimationHelper
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
 
    aniHelp.initialize("aniHelp")
    aniHelp.AnimationDrawable_initialize(False)
 
    Dim tuUtils As ResourcesHelper
    tuUtils.initialize
 
 
    Dim p1 As Int = tuUtils.getResourceId("h1","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p1), 80)
    Dim p2 As Int = tuUtils.getResourceId("h2","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p2), 80)
    Dim p3 As Int = tuUtils.getResourceId("h3","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p3), 80)
    Dim p4 As Int = tuUtils.getResourceId("h4","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p4), 80)
    Dim p5 As Int = tuUtils.getResourceId("h5","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p5), 80)
    Dim p6 As Int = tuUtils.getResourceId("h6","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p6), 80)
    Dim p7 As Int = tuUtils.getResourceId("h7","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p7), 80)
    Dim p8 As Int = tuUtils.getResourceId("h8","drawable")
    aniHelp.AnimationDrawable_addFrame(tuUtils.getDrawable(p8), 80)
   
    ImageView1.Background = aniHelp.GetAnimationDrawable
 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    aniHelp.AnimationDrawable_Start
End Sub

After I have download this example and test. I have problem about the res file. Please help me.
I've add #AdditionalRes: ..\myres already. (I have edited name res file to be myres because to protect my confused.

B4A Version: 13.00
Parsing code. (0.00s)
Java Version: 19
Building folders structure. (0.07s)
Compiling code. (0.03s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.02s)
(AndroidX SDK)
Compiling resources (0.18s)
Linking resources Error
error: resource style/Theme.AppCompat.Light.NoActionBar (aka b4a.example:style/Theme.AppCompat.Light.NoActionBar) not found.
..\myres\values\theme.xml:42: error: style attribute 'attr/colorPrimary (aka b4a.example:attr/colorPrimary)' not found.
..\myres\values\theme.xml:43: error: style attribute 'attr/colorPrimaryDark (aka b4a.example:attr/colorPrimaryDark)' not found.
..\myres\values\theme.xml:44: error: style attribute 'attr/colorAccent (aka b4a.example:attr/colorAccent)' not found.
..\myres\values\theme.xml:46: error: style attribute 'attr/windowNoTitle (aka b4a.example:attr/windowNoTitle)' not found.
..\myres\values\theme.xml:47: error: style attribute 'attr/windowActionBar (aka b4a.example:attr/windowActionBar)' not found.
error: resource style/Theme.AppCompat.Light.NoActionBar (aka b4a.example:style/Theme.AppCompat.Light.NoActionBar) not found.
..\myres\values-zh\theme.xml:42: error: style attribute 'attr/colorPrimary (aka b4a.example:attr/colorPrimary)' not found.
..\myres\values-zh\theme.xml:43: error: style attribute 'attr/colorPrimaryDark (aka b4a.example:attr/colorPrimaryDark)' not found.
..\myres\values-zh\theme.xml:44: error: style attribute 'attr/colorAccent (aka b4a.example:attr/colorAccent)' not found.
..\myres\values-zh\theme.xml:46: error: style attribute 'attr/windowNoTitle (aka b4a.example:attr/windowNoTitle)' not found.
..\myres\values-zh\theme.xml:47: error: style attribute 'attr/windowActionBar (aka b4a.example:attr/windowActionBar)' not found.
error: resource style/Theme.AppCompat.Dialog (aka b4a.example:style/Theme.AppCompat.Dialog) not found.
error: failed linking references.
 
Last edited:

tummosoft

Active Member
Licensed User
Longtime User
After I have download this example and test. I have problem about the res file. Please help me.
I've add #AdditionalRes: ..\myres already. (I have edited name res file to be myres because to protect my confused.

The reason for your problems are: I have attached all unnecessary files in the RES folder.
Then you need to delete all the subfolders of RES, leaving only the drawable folder.
 

Attachments

  • drawable.zip
    159.3 KB · Views: 11

Theera

Well-Known Member
Licensed User
Longtime User
* AnimationHelper:
----------------------------
New method: Animation from Resource ID

View attachment 159228

Scale:
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="700"
    android:fromXScale="0.0"
    android:fromYScale="0.0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toXScale="1.0"
    android:toYScale="1.0" />

AnimationHelper:
Sub Globals
    Private aniHelp As AnimationHelper
    Dim dialog As Panel
    Dim aniResourceID As Int
    Dim btn2 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    aniHelp.initialize("aniHelp")
    
    btn2.Initialize("btn2")
    btn2.Text = "Animation "
    
    Dim tuUtils As ResourcesHelper
    tuUtils.initialize
    dialog.Initialize("dialog")
    dialog.LoadLayout("layout_dialog")
    Activity.AddView(btn2, 5%x, 50%y, 300dip, 40dip)
    aniResourceID = tuUtils.getResourceId("ani","xml")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    aniHelp.AnimationFromResID(btn2, aniResourceID)
End Sub
Hi again, I have tested this example, it hasproblem about its res , too.
 
Top