/ProgressButtonView

Simple CustomView that shows a Button with a ProgressBar

Primary LanguageJavaApache License 2.0Apache-2.0

ProgressButtonView

Build Status GitHub license

Simple CustomView that shows a Button with a ProgressBar

Installation

Add this line in your app/build.gradle

compile 'es.voghdev.progressbuttonview:ProgressButtonView:0.8.3'

Screenshot

Usage

You can add ProgressButtonView to your XML layouts

<es.voghdev.progressbuttonview.ProgressButtonView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        app:hideButtonWhileLoading="true"
        app:text="@string/hello" />

You can also create it programatically

ProgressButtonView progressButtonView = new ProgressButtonView(context);

Then turn the widget into loading mode, or switch it back to a normal button with:

progressButtonView.showLoading();
progressButtonView.hideLoading();

There are many attributes that you can set to customize its behaviour

app:text="@string/hello"
app:textSize="20sp"
app:textColor="#ff0000"
app:hideButtonWhileLoading="true"
app:backgroundColorResource="@color/my_favorite_background_color"

The full list can be found in the attrs.xml styleable

Screenshot

Experimental

You can find isolation UI Tests for ProgressButtonView in this experimental branch. It uses novoda's espresso-support library. More info can be found in this blogpost

Apps using this lib

Many production apps are actually using this widget. Feel free to add yours by submitting a PR

Developed By

Follow me on Twitter Find me on Linkedin

License

Copyright 2016 Olmo Gallegos Hernández

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Contributing

For noobs (like me some months ago)

fork the project into your GitHub account
now clone your GitHub repo for this project
implement your changes
commit your changes, push them into your repo
review your code and send me a pull request if you consider it

For not-so-noobs

Please make sure that your changes pass both checkstyle and UI tests before submitting them

./gradlew checkstyle

./gradlew test

And with your Android device connected

./gradlew connectedCheck