All Projects → JMaroz → Roundbutton

JMaroz / Roundbutton

Licence: mit
Android Button with corner, morph and animations

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Roundbutton

Pmsuperbutton
🔥 PMSuperButton is a powerful UIButton coming from the countryside, but with super powers! 😎
Stars: ✭ 653 (+1574.36%)
Mutual labels:  button
Aiflatswitch
Nicely animated flat design switch alternative to UISwitch
Stars: ✭ 904 (+2217.95%)
Mutual labels:  button
Hhcustomcorner
Awesome library to customize corners of UIView and UIButton. Now you can customize each corner differently
Stars: ✭ 36 (-7.69%)
Mutual labels:  button
Amazon Dash
Hack your Amazon Dash to run what you want.
Stars: ✭ 703 (+1702.56%)
Mutual labels:  button
Vue Js Toggle Button
🍥 Vue.js 2 toggle / switch button - simple, pretty, customizable
Stars: ✭ 836 (+2043.59%)
Mutual labels:  button
Ppnumberbutton
iOS中一款高度可定制性商品计数按钮(京东/淘宝/饿了么/美团外卖/百度外卖样式)
Stars: ✭ 845 (+2066.67%)
Mutual labels:  button
Holdingbutton
Button which is visible while user holds it. Main use case is controlling audio recording state (like in Telegram, Viber, VK).
Stars: ✭ 595 (+1425.64%)
Mutual labels:  button
Ftpopovermenu
FTPopOverMenu is a pop over menu for iOS which is maybe the easiest one to use. Supports both portrait and landscape. It can show from any UIView, any UIBarButtonItem and any CGRect.
Stars: ✭ 988 (+2433.33%)
Mutual labels:  button
Neopixel Realistic Flickering Candle With Changing Color Palette
Arduino code for creating a realistic candle flicker using 8-neopixels, and the FastLED Library. This code is a modified version of the Fire2012 with Color Palette example that comes with FastLED and utilizes a button to cycle through different color palettes in real time.
Stars: ✭ 19 (-51.28%)
Mutual labels:  button
Fillingbutton
🔥Replace typical onLongClickListener with this library!
Stars: ✭ 31 (-20.51%)
Mutual labels:  button
React Native Button
A React Native button component customizable via props
Stars: ✭ 719 (+1743.59%)
Mutual labels:  button
Github Buttons
Unofficial github:buttons.
Stars: ✭ 821 (+2005.13%)
Mutual labels:  button
Flutterplayground
Playground app for Flutter
Stars: ✭ 859 (+2102.56%)
Mutual labels:  button
Progressbutton
Android Progress Button
Stars: ✭ 662 (+1597.44%)
Mutual labels:  button
Aws Iot Button
Stars: ✭ 37 (-5.13%)
Mutual labels:  button
Front End Daily Challenges
As of October 2020, 170+ works have been accomplished, challenge yourself each day!
Stars: ✭ 598 (+1433.33%)
Mutual labels:  button
Eager Image Loader
The eager-loading for image files on the web page that loads the files according to your plan. This differs from the lazy-loading, for example, this can be used to avoid that the user waits for the loading.
Stars: ✭ 22 (-43.59%)
Mutual labels:  button
Flutter Neumorphic
A complete, ready to use, Neumorphic ui kit for Flutter, 🕶️ dark mode compatible
Stars: ✭ 988 (+2433.33%)
Mutual labels:  button
React Native Really Awesome Button
React Native button component. Awesome Button is a 3D at 60fps, progress enabled, social ready, extendable, production ready component that renders an awesome animated set of UI buttons. 📱
Stars: ✭ 988 (+2433.33%)
Mutual labels:  button
React Awesome Button
React button component. Awesome button is a 3D UI, progress, social and share enabled, animated at 60fps, light weight, performant, production ready react UI button component. 🖥️ 📱
Stars: ✭ 943 (+2317.95%)
Mutual labels:  button

RoundButton

Android Button with corner, morph and animations

gif

Contents

Installation

Download

compile 'com.marozzi.roundbutton:round-button:1.0.7'

How to use

Add to layout

<com.marozzi.roundbutton.RoundButton
        android:id="@+id/bt"
        style="@style/TextStyle194"
        android:layout_width="88dp"
        android:layout_height="35dp"
        android:gravity="center"
        android:text="prenota"
        app:rb_animation_alpha="false"
        app:rb_animation_progress_color="@color/colorAccent"
        app:rb_animation_progress_padding="8dp"
        app:rb_animation_progress_width="2dp"
        app:rb_animation_progress_style="circle"
        app:rb_animation_corner_radius="20dp"
        app:rb_animation_duration="500"
        app:rb_background_color="@android:color/transparent"
        app:rb_success_resource="@drawable/ic_done_white_48dp"
        app:rb_background_color_pressed="@color/colorPrimary"
        app:rb_corner_color="@color/colorPrimary"
        app:rb_corner_color_pressed="@color/colorPrimary"
        app:rb_corner_radius="2dp"
        app:rb_corner_width="1dp"
        app:rb_text_color="@color/colorPrimary"
        app:rb_text_color_pressed="@android:color/white" />

Start the animation

To start the animation and the morphing of the button

    RoundButton btn = (RoundButton) findViewById(R.id.bt)

    btn.startAnimation();

Revert the animation

When you are done and you want to morph back the button

    btn.revertAnimation();

Show result animation

You can show a result of your task by calling

btn.etResultState(ResultState.SUCCESS | ResultState.FAILURE);

If the button is in the 'progress state' the button will show the result otherwise it will show after the morph phase is endend

Listener

You can set a listener for every action

bt.setButtonAnimationListener(new RoundButton.RoundButtonAnimationListener() {
            @Override
            public void onRevertMorphingEnd() {

            }

            @Override
            public void onApplyMorphingEnd() {

            }

            @Override
            public void onShowProgress() {

            }

            @Override
            public void onShowResultState() {

            }
        });

Bonus: use the builder to customize the button at runtime

   Random random = new Random();
   RoundButton.Builder builder = RoundButton.newRoundButtonBuilder()
           .withText("Bonus")
           .withBackgroundColor(Color.rgb(random.nextInt(255), random.nextInt(255), random.nextInt(255)))
           .withTextColor(Color.rgb(random.nextInt(255), random.nextInt(255), random.nextInt(255)))
           .withCornerColor(Color.rgb(random.nextInt(255), random.nextInt(255), random.nextInt(255)))
           .withCornerRadius(random.nextInt(20))
           .withCornerWidth(random.nextInt(20));
   bt.setCustomizations(builder);
   bt.revertAnimation();

Configure XML

Animations

  • rb_animation_duration: duration of the animations in millisecond
  • rb_animation_corner_radius: the radius of the botton corner
  • rb_animation_alpha: true to perfom the morphing with alpha animation, false otherwise
  • rb_animation_progress_width: the width of the progress circle when the animation_progress_style is circle
  • rb_animation_progress_color: the color of the progress indicator
  • rb_animation_progress_padding: the padding from the outer border of the progress indicator
  • rb_animation_progress_style: the style of the animation
    • circle progress indicator
    • dots progress indicator
    • custom progress indicator, used with a rb_animation_custom_resource
  • rb_animation_custom_resource: android resource (AnimatedVectorDrawable) used for a custom progress indicator
  • rb_animation_inner_resource: show a drawable when the animation_progress_style is circle
  • rb_animation_inner_resource_color: tint color for rb_animation_inner_resource

Results

  • rb_success_color: background color for the success state
  • rb_success_resource: image for the success state
  • rb_failure_color: background color for the failure state
  • rb_failure_resource: image for the failure state

Button

  • rb_corner_radius: radius of the button corner
  • rb_corner_width: width of the button corner
  • rb_corner_color: the color of the corner
  • rb_corner_color_pressed: the color when the button is pressed
  • rb_background_color: the color of the background
  • rb_background_color_pressed: the color of the background when the button is pressed
  • rb_text_color: the color of the text
  • rb_text_color_pressed: the color of the text when the button is pressed

Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues

Credits

This library was inspired by this repos:

License

MIT License

Copyright (c) 2017 JMaroz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].