Giter VIP home page Giter VIP logo

snetts / reactbutton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amrdeveloper/reactbutton

0.0 0.0 0.0 1.54 MB

Android Library to make it easy to add ReactButton feature in your app with Multi Reactions like Facebook or Linkedin, you can add many reactions as you want, you can also split them into a number of columns, and also customize the colours and text for each reaction

License: MIT License

Java 100.00%

reactbutton's Introduction

ReactButton

Codacy Badge CodeFactor Build Min API Stars Forks License Maven Central

Android Library to make it easy to add ReactButton feature in your app with Multi Reactions like Facebook or Linkedin ...etc, you can add many reactions as you want, you can also split them into number of columns, and also customize the colors and text for each reactions

Note

From version 2.0.0 and above the library will release without default icons to reduce the size and if you want the facebook reactions you can copy them from the example app here

Demo ๐Ÿ˜„

Documentation:

Add ReactButton To Your Current Project:

From Maven Central

implementation 'io.github.amrdeveloper:reactbutton:2.1.0'
Or Add ReactButton from Jitpack.io

Add it in your root build.gradle at the end of repositories

allprojects {
    repositories {
         maven { url 'https://jitpack.io' }
    }
}

Add the dependency

implementation 'com.github.AmrDeveloper:ReactButton:2.1.0'

How To Initializing ReactButton:

ReactButton reactButton = findViewById(R.id.buttonId);

Set your Reactions:

reactButton.setReactions(Reaction... reaction);

Add new Reactions to the reactions list:

reactButton.addReactions(Reaction... reaction);

Set Current Reaction:

reactButton.setCurrentReaction(Reaction reaction);

Get Current Reaction:

Reaction currentReaction = reactButton.getCurrentReaction();

Set Default Reaction:

reactButton.setDefaultReaction(Reaction reaction);

Get Default Reaction:

Reaction currentReaction = reactButton.getDefaultReaction();

Change Reaction dialog default Style:

reactButton.setReactDialogShape(int styleID);

Change the reactions dialog default gravity, make sure you have disabled the dynamic position

reactButton.setReactionDialogGravity(newGravity);

Enable/Disable the reactions dialog dynamic position

reactButton.enableDialogDynamicPosition(isEnabled);

Change the number of reactions in the Columns, the default value is all reactions size

reactButton.setDialogColumnsNumber(n);

Set the dim amount for the reactions dialog from 0 for no dim to 1 for full dim, the default value is 0

reactButton.setDimAmount(dim);

Change tooltip background shape

reactButton.setReactionTooltipShape(R.drawable.shape);

Change tooltip text color

reactButton.setReactionTooltipTextColor(Color.BLACK);

Change offset between the reaction icon and the tooltip text

reactButton.setTooltipOffsetFromReaction(100);

Enable or Disable the Reaction tooltip feature

reactButton.setEnableReactionTooltip(true);

Set setOnReactionChangeListener:

reactButton.setOnReactionChangeListener(new ReactButton.OnReactionChangeListener() {
    @Override
    public void onReactionChange(Reaction reaction) {
        // Code that will execute when the reaction changed
    }
});

Set OnReactionDialogStateListener:

reactButton.setOnReactionDialogStateListener(new ReactButton.OnReactionDialogStateListener() {
    @Override
    public void onDialogOpened() {
        // Code that will execute when the reaction dialog is opened
    }

    @Override
    public void onDialogDismiss() {
        // Code that will execute after the reaction dialog is dismissed
    }
});

Check if current Reaction is Default Reaction:

boolean isDefault = reactButton.isDefaultReaction();
For full example please check the example app here

reactbutton's People

Contributors

amrdeveloper avatar andreassuvorov avatar codacy-badger avatar

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.