Norway


Library By Java to Create ReactButton with 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

compile 'com.github.AmrDeveloper:ReactButton:1.0.2'

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);

To Get Current Emoji On Button :

String currentEmoji = reactButton.getCurrentEmojiType();

switch(currentEmoji)
{
   case "Like":
       //Text Is Like , Emoji Is Blue Hand
       break;
       
   case "Love":
       //Text Is Like , Emoji Is Red Heart
       break;
       
   case "Smile":
        //Text Is Smile , Emoji Is Smile Hand
       break;
       
   case "Wow":
       //Text Is Wow , Emoji Is Wow Face
       break;
       
   case "Sad":
       //Text Is Sad , Emoji Is  Hand
       break;
       
   case "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;
           }
 });



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here