ReactButton

Additional

Language
Java
Version
1.0.5 (May 18, 2018)
Created
Feb 3, 2018
Updated
May 18, 2018
Owner
Amr Hesham (AmrDeveloper)
Contributor
Amr Hesham (AmrDeveloper)
1
Activity
Badge
Generate
Download
Source code

Announcement

ReactButton

Android Library By Java to Create ReactButton with 6 Emoji Face

Description :

Add ReactButton To Your Current Project :

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:app:1.0.5'

Default Case :

Text = Like 
Emoji is black Hand
If User Click on Button it Text Will still like but emoji will be blue hand
and if user click long on button it will show dialog to choose one emoji from 6 emojis

How To Initializing ReactButton :

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

Set Emoji Type on Button :

   reactButton.setCurrentEmojiType(String emojiType);
   
   Types : 
   ReactButton.DEFAULT
   ReactButton.LIKE
   ReactButton.LOVE
   ReactButton.SMILE
   ReactButton.WOW
   ReactButton.SAD
   ReactButton.ANGRY

To Get Current Emoji On Button :

String currentEmoji = reactButton.getCurrentEmojiType();

switch(currentEmoji)
{
   case ReactButton.LIKE:
       //Text Is Like , Emoji Is Blue Hand
       break;
       
   case ReactButton.LOVE:
       //Text Is Like , Emoji Is Red Heart
       break;
       
   case ReactButton.SMILE:
        //Text Is Smile , Emoji Is Smile Hand
       break;
       
   case ReactButton.WOW:
       //Text Is Wow , Emoji Is Wow Face
       break;
       
   case ReactButton.SAD:
       //Text Is Sad , Emoji Is Dark Hand
       break;
       
   case ReactButton.ANGRY:
       //Text Is Angry , Emoji Is Angry Face
       break; 
       
   default:
       //Text Is Like , Emoji Is Dark Hand
       break;
}

Set On Click Listener :

reactButton.setReactClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              //Your Code
          }
 });

Set on Long Click Listener :

 reactButton.setReactDismissListener(new View.OnLongClickListener() {
           @Override
           public boolean onLongClick(View view) {
               //Your Code
               return false;
           }
 });

Change Emoji layout background color :

 reactButton.setDialogBackgroundColor(int color);