voghdev / progressbuttonview Goto Github PK
View Code? Open in Web Editor NEWSimple CustomView that shows a Button with a ProgressBar
License: Apache License 2.0
Simple CustomView that shows a Button with a ProgressBar
License: Apache License 2.0
We need to do:
progressButtonView.setBackgroundTintMode(SRC_IN);
progressButtonView.setBackgroundTintList(colorStateList);
Expose these two methods, or create a public method called tintBackground
that calls these two with a resolved color and/or a colorResId (tintBackgroundWithColorResId
). Example calls:
progressButtonView.tintBackground(ContextCompat.getColor(ctx, R.color.red));
progressButtonView.tintBackgroundWithColorResId(R.color.red);
When there is a backgroundDrawable defined, it overwrites background color resource.
A good solution could be to remove the default background resource.
Or to make the parameter optional in the style
method
Don't know if it was removed already. If not, remove it
Add two setTypeface methods to ProgressButtonView:
public void setTypeface(Typeface tf) {
button.setTypeface(tf);
}
public void setTypeface(Typeface tf, int style) {
button.setTypeface(tf, int style);
}
Add examples of projects using this lib in README.md
file. There are plenty of them.
In my app, the spin color is white and the background is white too, we need to change the color of the spin.
users may forget to add the progressBarTintMode
attribute when they try to tint the ProgressBar
. Maybe a default value like "SRC_ATOP"
would make lib usage more intuitive
Rename R.string.send
from strings.xml, and attrs like FullScreen
, Element
, FullW
, to avoid possible clashes with another libraries in android projects.
Assign better-scoped names like ProgressButtonView_send
or PBV_send
Update the README to add Kotlin code examples of each code snippet aswell
ProgressButtonView
inherits from FrameLayout
, and inside its creation method, it inflates another FrameLayout
.
The result is
<FrameLayout>
<FrameLayout>
use the <merge>
tag to improve performance using only one FrameLayout
Espresso tests had to be disabled. It Would be good to make them work again.
Possible solutions / example repos:
this one seems to work
Link with doc and examples
Sample project that seems to work too
Button width and height inside the ProgressButtonView may vary. Specially width. Allow the user to override it.
To update UI in UIThread, novoda-espresso-support branch
See this thread
maybe just viewrule.callOnUIThread(...)
Component needs override setEnabled and call to children's setEnabled too.
For example, in ViewWithBackgroundColorTest
, 1) succeeds but since it takes a while when 2) is executed, the view still has the progressButtonView_tint_mode
text.
1) onView(withText(R.string.progressButtonView_tint_mode)).perform(click());
2) onView(withText(R.string.progressButtonView_visibility_response)).check(matches(isDisplayed()));
Simply waiting is enough to make the tests pass.
Call recycle() to keep the thing efficient
Maybe there should be a ProgressButtonView
subclass that overrides getLayoutId()
with a new layout containing its own RelativeLayout
root. That should fit some cases like FrameLayout
s or ConstraintLayout
s
one of our apps demand this feature
Text appears with AllCaps
mode always on.
Please expose some methods to disable text capitalizations, and display lowercase text
As long as this is a library, it should not define very common strings like @string/send
.
Maybe a customized name like progressButtonView_send
or even hardcode the Send
message
setBackgroundColor works fine but setText doesn't
Sample code
public void showOrderCompleted(Order order) {
int color = ContextCompat.getColor(this, R.color.red);
btnComplete.setBackgroundColor(color);
btnComplete.setText(R.string.delivered);
}
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.