Code Monkey home page Code Monkey logo

transformabledrawablebutton's Introduction

TransformableDrawableButton

Android Arsenal

This library is a extension of the android's buttons. Using this extension you can add a switchable buttons with a common draws defined, and cool animations when you switch between them.

Do you need more explanation?

Round buttons Example.

Drawable on a side of button.

You can try the demo app on google play.

https://play.google.com/store/apps/details?id=com.fmsirvent.transformabledrawablebutton.app

Show me the code

Gradle dependencies:

compile 'com.fmsirvent:transformabledrawablebutton:1.1.1'

Code in layout:

<!-- add on top parent layout: xmlns:tdb="http://schemas.android.com/apk/res-auto" -->

<com.fmsirvent.transformabledrawablebutton.TransformableButton
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_gravity="center"
    android:layout_margin="30dp"
    tdb:unCheckDraw="plus"
    tdb:checkDraw="x"
    tdb:strokeColor="@android:color/holo_red_dark"
    tdb:backgroundColor="@android:color/black"/>

Creating widget programmatic way:

TransformableButton transformableButton = new TransformableButton(this, TransformableButton.Draw.MINUS, TransformableButton.Draw.PLUS, Color.BLACK, Color.GRAY, TransformableButton.PositionDraw.BACKGROUND);

Proguard:

-dontwarn com.fmsirvent.transformabledrawablebutton.**

Attributes

  • unCheckDraw : Values "plus", "minus", "x", "arrow_down", "arrow_left", "arrow_up", "arrow_right", "check", "arrow_down", "arrow_left", "arrow_up", "arrow_right", "menu". Default value "plus"
  • checkDraw : Values "plus", "minus", "x", "arrow_down", "arrow_left", "arrow_up", "arrow_right", "check", "arrow_down", "arrow_left", "arrow_up", "arrow_right", "menu". Default value "minus"
  • strokeColor : Color value. Default value dark gray.
  • backgroundColor : Color value. Default value white.
  • drawablePosition : Values "background", "left", "top", "right", "bottom". Default value "background".

Functions

  • Constructor TransformableButton(Context context, Draw unCheckDraw, Draw checkDraw, int strokeColor, int backgroundColor, PositionDraw positionDraw) unCheckDraw: Draw on uncheck status. Use Enum TransformableButton.Draw. Example: TransformableButton.Draw.PLUS strokeColor: Draw on check status. Use Enum TransformableButton.Draw. Example: TransformableButton.Draw.MINUS backgroundColor: Color of circle background. Example Color.RED positionDraw: Color of lines. Example Color.RED
  • setOnCheckedChangeListener void setOnCheckedChangeListener(OnCheckedChangeListener onCheckedChangeListener) onCheckedChangeListener: Listener of status changes, use TransformableButton.OnCheckedChangeListener.
  • isChecked Boolean isChecked() Check the status button. return: status of button (check = true, uncheck = false).
  • setChecked void setChecked(boolean checked, boolean animated) Changes the status button. checked: Status to set (check = true, uncheck = false) animated: Show animation of change. (true show animation)

Author

Francisco M Sirvent [email protected] Linkedin: https://es.linkedin.com/in/fmsirvent/

Based on HamburgerMenuDrawable, by: Thibault Guégan, [email protected] Linkedin: https://www.linkedin.com/profile/view?id=93515047

License

TransformableDrawableButton is available under the MIT license. See the LICENSE file for more info.

transformabledrawablebutton's People

Contributors

narfss avatar tibolte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

transformabledrawablebutton's Issues

Recyclerview issue

issue with notify data set change giving error

java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling androidx.recyclerview.widget.RecyclerView

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.