Android Question [Solved]How to reset AMProgessButton?

Theera

Well-Known Member
Licensed User
Longtime User
Hi all,
After I have donwloaded for studying AMProgressButton Library and tested the attached his project. I need to know that how to use command to reset AMProgressButton again.
(After it is pressed button continue finished,it isn't reset for preparing pressed again) I need to apply for my project.(I think it should has the command)
 

Theera

Well-Known Member
Licensed User
Longtime User
B4X:
timer1.enabled = false
AMProgressButton1.SetProgress(0)
My words is meaning that the presently,we can press the button only once time. After it show status "finished"(Show a little of time shortly) I would like to set restart the button show "start" again for a new pressing.(like reload app)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
My words is meaning that the presently,we can press the button only once time. After it show status "finished"(Show a little of time shortly) I would like to set restart the button show "start" again for a new pressing.(like reload app)
In the example project, you also need to zero out the variables c1, c2, c3.

(Rather, the corners are not done well)
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
I have redo B4A-Bridge from Aeric's one. I have replace AMProgressButton instead of B4XView's progress. After installation is finished. I need AMProgressButton comes back show Start Status,but I can't found how to do. (I learn coding from the experts'codes ) please to see my project,perhaps I can't expain in English well for understanding.
 

Attachments

  • TheeraB4A-Bridge.zip
    36.8 KB · Views: 38
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
B4X:
Public Sub UpdateFileProgress

   
    If Service1.currentAPKTotal = 100 Then
        AMProgressButton1.Enabled=False
        'AMProgressButton1.NormalText="การติดตั้งตั้งเสร็จสมบูรณ์"
        AMProgressButton1.Enabled=True
        AMProgressButton1.SetProgress(0)
        Service1.currentAPKTotal = 0 '<--------------------------Add this
        ProgressValue  = 0

       
    Else
        AMProgressButton1.Enabled=True
        ProgressValue=Round(Service1.currentAPKWritten  / Service1.currentAPKTotal * 100)
        AMProgressButton1.SetProgress(ProgressValue)
        AMProgressButton1.ProgressText=ProgressValue&" %"
    End If
   


End Sub
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
I think my problem is there is not Activity.UnloadLayout("layout1") in order to using Activity.LoadLayout("layout1") again.
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
My problem can be solved. Thank you all of you

B4X:
Sub Activity_Resume
    UpdateIp
    UpdateStatus
    'AnotherProgressBar1.Visible = AnotherProgressBar1.Visible
  
    UpdateFileProgress
  
    If File.ExternalWritable = False Then
        btnWirelessStart.Enabled = False
        MsgboxAsync("ไม่มีการ์ดหน่วยความจำ โปรดแน่ใจว่าอุปกรณ์มีการเชื่อมต่อถูกต้อง", "")
    Else If phone.SdkVersion >= 26 And CanRequestPackageInstalls = False Then
        MsgboxAsync("โปรดอนุญาต B4A-Bridge สามารถติดตั้งแอพอื่นได้ ", "")
      
        Wait For Msgbox_Result(Result As Int)
        Dim in As Intent
        in.Initialize("android.settings.MANAGE_UNKNOWN_APP_SOURCES", "package:" & Application.PackageName)
        StartActivity(in)
    Else If phone.SdkVersion < 26 And CheckNonMarketAppsEnabled = False Then
        MsgboxAsync("โปรดอนุญาตให้มีการติดตั้งแอพนอกจาก Play Store โดยเลือก" & CRLF & "Under Settings - Security - Unknown sources" _
             & CRLF & "Or Settings - Applications - Unknown sources", "")
      
           
    Else
        If phone.SdkVersion >= 29 And DrawOverRequested = False Then
            DrawOverRequested = True
            Wait For (GetDrawOverPermission) Complete (Success As Boolean)
        End If
        btnWirelessStart.Enabled = True
        If firstTimeEnabledAutomaticatlly = False Then
            firstTimeEnabledAutomaticatlly = True
            btnWirelessStart_Click
        End If
    End If
    UpdateThemeColors
  
    'this is required in B4A only. It resumes the animation after the activity was paused.
    ScrlblVersion.Text = ScrlblVersion.Text
  
    mPhoneWakeState.KeepAlive(True)
    Activity.RemoveAllViews   '<====Addition code
    Activity_Create(False)        '<====Addition code
    btnWirelessStart_Click       '<====Addition code
End Sub
 
Upvote 0
Top