razir / progressbutton Goto Github PK
View Code? Open in Web Editor NEWAndroid Progress Button
Android Progress Button
Would be really great to databing textRes, Color and progressState to button right into some LiveData form in VIewModel. Can I set those values in xml?
Type mismatch
Required TextView
Found AppCompatImageButton
Hi Razir!
I believe there is a need for software visualisation tools to support the understanding of software systems. Many software visualisation tools, both open source and commercial, have been created for many languages, but no software visualisation tool has been created for the language Kotlin.
I have now however created one for my Bachelor thesis. I have used my application to visualise your project, and it shows the complexity of the project. The idea is the bigger the class or function, the more complex it is.
If you could answer a few question for me, that would be very helpful!
Your help would really be appreciated.
Best,
Ayanle.
Hello,
First of all, thank you for your great job here it is a great library,
I have noticed that when the app is RTL the padding start and padding end of the drawable are misplaced and there is no spacing between the drawable and the text, can you please support RTL.
Thanks and Regards.
subject. I haven't found method for that
The idea is to have a "submit" image, a progress animation (already provided by your lib) and a "finish" image. Does your lib allow us to have an image instead of "submit text"?
Using your sample I cannot:
buttonProgressMixed.showDrawable(ContextCompat.getDrawable(this, R.drawable.ic_chevron_right_black_24dp)!!)
buttonProgressMixed.setOnClickListener {
showMixed(buttonProgressMixed)
}
private fun showMixed(button: Button) {
val animatedDrawable = ContextCompat.getDrawable(this, R.drawable.animated_check)!!
val drawableSize = resources.getDimensionPixelSize(R.dimen.doneSize)
animatedDrawable.setBounds(0, 0, drawableSize, drawableSize)
button.showProgress {
progressColor = Color.WHITE
gravity = DrawableButton.GRAVITY_CENTER
}
button.isEnabled = false
Handler().postDelayed({
button.isEnabled = true
button.showDrawable(animatedDrawable) { gravity = DrawableButton.GRAVITY_CENTER }
}, 3000)
}
It shows the loading animation, the finish animation, but not the "star/idle" drawable. Why?
Hello.
Do I still need to call bindProgressButton
if I'm using databining? See the snippet below.
val binding = FragmentSignInBinding.bind(view)
binding.viewModel = viewModel
binding.lifecycleOwner = this
binding.signIn.attachTextChangeAnimator()
binding.signIn.showProgress { ... }
.....
I can't find the View after adding to Gradle. What is the name I should be looking for? can't find ProgressButton
When created reference of button to some method, progress loader is not working
Is there any way I can change the progress drawable from resource?
I have imported the library in my android project written in java.
But i couldn't use
bindProgressButton(myButton);
is it possible to use this library in java?
I'm using this library as per the code you've provided in the README. Here's how I'm using it..
LoginFragment....
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
bindProgressButton(btnLogin)
btnLogin.attachTextChangeAnimator()
btnLogin.setOnClickListener {
btnLogin.showProgress {
buttonTextRes = R.string.signing_user_in
progressColor = Color.WHITE
}
api.performLogin(username, password)...
// Async call which runs a handler OnComplete in which I'm calling btnLogin.hideProgress(R.string.action_sign_in)
}
...
...
}
However the loading bar freezes. Why do you think this is happened? Am I doing it wrong? Also, I noticed that the text became uppercase which is pretty much bad! Here's a recording:
https://youtu.be/FTSd1FnSRP4
Output from LeakCanary:
┬───
│ GC Root: Input or output parameters in native code
│
├─ okio.AsyncTimeout class
│ Leaking: NO (PathClassLoader↓ is not leaking and a class is never leaking)
│ ↓ static AsyncTimeout.$class$classLoader
├─ dalvik.system.PathClassLoader instance
│ Leaking: NO (ProgressButtonHolderKt↓ is not leaking and A ClassLoader is never leaking)
│ ↓ PathClassLoader.runtimeInternalObjects
├─ java.lang.Object[] array
│ Leaking: NO (ProgressButtonHolderKt↓ is not leaking)
│ ↓ Object[].[454]
├─ com.github.razir.progressbutton.ProgressButtonHolderKt class
│ Leaking: NO (a class is never leaking)
│ ↓ static ProgressButtonHolderKt.activeViews
│ ~~~~~~~~~~~
├─ java.util.WeakHashMap instance
│ Leaking: UNKNOWN
│ ↓ WeakHashMap.table
│ ~~~~~
├─ java.util.WeakHashMap$Entry[] array
│ Leaking: UNKNOWN
│ ↓ WeakHashMap$Entry[].[1]
│ ~~~
├─ java.util.WeakHashMap$Entry instance
│ Leaking: UNKNOWN
│ ↓ WeakHashMap$Entry.value
│ ~~~~~
├─ com.github.razir.progressbutton.DrawableViewData instance
│ Leaking: UNKNOWN
│ ↓ DrawableViewData.callback
│ ~~~~~~~~
├─ com.github.razir.progressbutton.DrawableButtonExtensionsKt$setupDrawableCallback$callback$1 instance
│ Leaking: UNKNOWN
│ Anonymous class implementing android.graphics.drawable.Drawable$Callback
│ ↓ DrawableButtonExtensionsKt$setupDrawableCallback$callback$1.$textView
│ ~~~~~~~~~
├─ com.google.android.material.button.MaterialButton instance
│ Leaking: YES (View.mContext references a destroyed activity)
│ mContext instance of ...MyActivity with mDestroyed = true
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mID = R.id.submitMaterialButton
│ View.mWindowAttachCount = 1
│ ↓ MaterialButton.mContext
╰→ ...MyActivity instance
Leaking: YES (ObjectWatcher was watching this because ...MyActivity received Activity#onDestroy() callback and Activity#mDestroyed is true)
key = 5a2c63ce-96e2-49a1-b85e-8ac67750641c
watchDurationMillis = 5175
retainedDurationMillis = 172METADATA
Build.VERSION.SDK_INT: 29
Build.MANUFACTURER: Google
LeakCanary version: 2.2
App process name: ...
Analysis duration: 12134 ms
Any clue?
I want to use this library in my custom button that used in whole in my app.
but for avoiding memory leak, I must use provided bindProgressButton
extension.
but in custom views we don't have lifecycleOwner! and should implement LifecycleObserver in our custom view and then dispose progressButton resources.
Unfortunately provided api for disposing is defective.
button text is not showing after change visibility to GONE and back to VISIBLE
Hello,
I want to use this lib but unable to understand how can I use it in layout.xml file.
And I m using Java for development so can you please help us with how we can implement it with java.
Thanks
With textAllCaps = true the progressCircle not working in api 22
<style name="DefaultButtonStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">16sp</item>
<item name="cornerRadius">30dp</item>
<item name="layout_constrainedWidth">true</item>
<item name="layout_constrainedHeight">true</item>
<item name="layout_constraintWidth_min">@dimen/defaultBtnWidth</item>
<item name="layout_constraintHeight_min">55dp</item>
</style>
Could you migrate the lib to use androidx instead of support.android which is no longer maintained
Hi! Today JFrog (which owns Bintray/JCenter) announced that they're sunsetting Bintray/JCenter - the last day to access these repositories will be May 2021. https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
I know a lot of tooling goes into artifact upload to a repository, so I wanted to throw a signal flare up now so nobody is caught by surprise on May 1.
Hi,
I like your library, looks amazing. Is it available in jCenter/MavenCentral or is it only on JitPack?
Cheers
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.