Ir.XamarinDev.Android.ProgressButton
1.0.0.1
dotnet add package Ir.XamarinDev.Android.ProgressButton --version 1.0.0.1
NuGet\Install-Package Ir.XamarinDev.Android.ProgressButton -Version 1.0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ir.XamarinDev.Android.ProgressButton" Version="1.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ir.XamarinDev.Android.ProgressButton --version 1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ir.XamarinDev.Android.ProgressButton, 1.0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ir.XamarinDev.Android.ProgressButton as a Cake Addin
#addin nuget:?package=Ir.XamarinDev.Android.ProgressButton&version=1.0.0.1
// Install Ir.XamarinDev.Android.ProgressButton as a Cake Tool
#tool nuget:?package=Ir.XamarinDev.Android.ProgressButton&version=1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Progress Button for Xamarin.Android - Ported from this library
Article on ProAndroidDev.com explaining how it works (in kotlin): here
Add progress animation to any button by adding a few lines of code without layout changes
Main features:
- No layout changes required
- Few lines of code to add
- Easily configurable
- Customizable
- Built in fade animations
NuGet package
Install-Package Ir.XamarinDev.Android.ProgressButton
How to use
Basic example
protected override void OnCreate(Bundle savedInstanceState) {
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.activity_main);
var myButton = FindViewById<MaterialButton>(Resource.Id.myButton);
// bind your button to activity lifecycle
this.BindProgressButton(myButton);
// (Optional) Enable fade in/out animations
myButton.AttachTextChangeAnimator();
// Show progress with "Loading" text
myButton.ShowProgress((progressParams) => {
progressParams.ButtonTextRes = Resource.String.loading;
progressParams.ProgressColor = Color.White;
});
// Hide progress and show "Submit" text instead
myButton.HideProgress(Resource.String.submit);
}
Showing AnimatedDrawable
var animatedDrawable = ContextCompat.GetDrawable(this, Resource.Drawable.animated_check);
// Defined bounds are required for your drawable
animatedDrawable.Bounds = new Rect(0, 0, 40, 40);
button.ShowDrawable(animatedDrawable, (drawableParams) => {
buttonTextRes = Resource.String.saved;
});
Detailed doc: here
Avoiding memory leaks
To avoid memory leaks you always need to bind your button to a LifecycleOwner (usually Activity, or Fragment):
[ILifecycleOwner].BindProgressButton(button);
Author
XamarinDev
Credits
Anton Hadutski - GitHub
Product | Versions Compatible and additional computed target framework versions. |
---|---|
MonoAndroid | monoandroid90 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
MonoAndroid 9.0
- Xamarin.AndroidX.AppCompat (>= 1.2.0.5)
- Xamarin.AndroidX.SwipeRefreshLayout (>= 1.1.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0.1 | 641 | 1/22/2022 |
Initial Release