Material Button With Progress Bar
app:p_style with values "circleBar" , "progressBar" [default - circleBar]
Use this for defining style of your progresbar
-
app:p_progressBGColor [default - button background color]
-
app:p_arrowVisible [default - true]
Use this for defining style of your material button
-
app:p_text [default - ""]
-
app:p_textColor
-
app:p_bgColor [Background color]
-
app:p_backgroundTint [Background color]
-
app:p_textSize
-
app:p_elevation
-
app:p_icon [Set icon drawable]
-
app:p_iconSize [Set icon size]
-
app:p_iconPadding
-
app:p_iconGravity [ value "start","textStart","end","textEnd"]
-
app:p_iconTint [change icon color]
-
app:p_strokeColor
-
app:p_rippleColor
-
app:p_strokeWidth
-
app:p_cornerRadius
-
app:p_fontFamily [Font Name in String i.e app:p_fontFamily="brandon_reg_it" ]
-
app:p_layoutDirection [Value ltr,rtl ]
-
app:p_capsText [default - false]
xmlns:app="http://schemas.android.com/apk/res-auto"
<com.chand.progressbutton.ProgressButton android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:p_backgroundTint="@color/colorAccent"
app:p_text="@string/label"
app:p_progressBGColor="@color/colorSecondary"
app:p_progressColor="@color/colorPrimaryVariant"
app:p_arrowVisible="false"
app:p_bgColor="@color/colorSecondary"
app:p_textColor="@color/white"
app:p_cornerRadius="3dp"
app:p_fontFamily="brandon_reg_it"
app:p_style="progressBar"
app:p_strokeWidth="3dp"
app:p_strokeColor="@color/colorSecondary"
app:p_rippleColor="@color/colorPrimaryVariant"
app:p_layoutDirection="ltr"
app:p_textSize="14sp"
android:id="@+id/pb6"/>
ProgressButton button1 = (ProgressButton) findViewById(R.id.pb6);
//OnClick
pb.setOnClickListener {
Toast.makeText(this,"Click",Toast.LENGTH_SHORT).show()
}
//Animation start and stop
pb.setOnAnimationListener(object: ProgressButton.AnimationListener{
override fun startAnimationListener() {
}
override fun endAnimationListener() {
}
} )
//Start Animation
pb.startAnimation()
//End Animation
pb.endAnimation()
Step 1: Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven {
url 'https://jitpack.io'
}
}
}
Step 2. Add the dependency
implementation 'com.github.chandreshandroid:MaterialProgressButton:1.7'
Copyright 2019
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.