AXMemojiView

AXMemojiView is a new page for AXEmojiView which shows memoji just like stickers.

100551778-2a3d2480-3298-11eb-915d-a0b7ab9ef763

100551817-6f615680-3298-11eb-8f56-c5e8e6adc23c

100551853-a172b880-3298-11eb-87a0-7bcbc0bc7687

Installation

You have to work with AXEmojiView first!

AXEmojiView

AXMemojiView is available in the JCenter, so you just need to add it as a dependency (Module gradle)

Gradle

implementation 'com.aghajari.memojiview:AXMemojiView:1.0.0'
implementation 'com.aghajari.emojiview:AXEmojiView:1.2.4'

Maven

<dependency>
  <groupId>com.aghajari.memojiview</groupId>
  <artifactId>AXMemojiView</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

Usage

you just need to install AXMemojiView after installing EmojiView. there is two option to do that, using your own MemojiProvider or read a json file as the MemojiProvider.

AXMemojiManager.install(this, MemojiProvider);

and now you can add AXMemojiView to your AXEmojiPager as a page
or just show AXMemojiView in a EmojiPopupLayout

AXMemojiView memojiView = new AXMemojiView(context);
emojiPager.addPage(memojiView, icon);

Customization

Customize theme with AXMemojiTheme.

AXMemojiManager.getMemojiViewTheme().setSelectedColor(0xffFF4081);
AXMemojiManager.getMemojiViewTheme().setCategoryColor(Color.WHITE);
AXMemojiManager.getMemojiViewTheme().setAlwaysShowDivider(true);
AXMemojiManager.getMemojiViewTheme().setBackgroundColor(Color.LTGRAY);
...

MemojiProvider

I'm using "+1500 memoji Pack" as the default MemojiProvider.

but you can use your own provider or improve this one.

the json format of the MemojiProvider will be like this :

{
 "CategoryName": {
  "CharacterName": [
   {
    "images": [
     {
      "name": "memoji_1_1.png",
      "skin": "white"
     },
     {
      "name": "memoji_1_2.png",
      "skin": "black"
     }
    ],
    "emoji": "😄",
    "posture": "Happy"
   }
  ]
 }
}

+1500 memoji Pack

Moein Rabti : +1500 memoji Pack includes 28 characters in white and black skin color and 29 different poses.

100552501-d5e87380-329c-11eb-8c7c-2df005d8c6be

assets/Memoji

MemojiLoader

Since the size of the memoji files is very large, it is better to upload them to the your server and load them with glide by using MemojiLoader :

new MemojiLoader() {
           @Override
           public void onLoadMemoji(AppCompatImageView view, Memoji memoji) {

               // Load memojis from server
               /**String serverURL = "https://..../Memoji/";
               String url = serverURL + memoji.getCategory()+"/"+memoji.getCharacter()+"/"+memoji.getImage();
               Glide.with(view)
                .load(url)
                .into(view);*/

               // Load memojis from assets
               Glide.with(view)
                       .load(Uri.parse("file:///android_asset/Memoji/"+memoji.getCategory()+"/"+memoji.getCharacter()+"/"+memoji.getImage()))
                       .into(view);
           }

           @Override
           public void onLoadMemojiCategory(AppCompatImageView view, Memoji memoji, boolean selected) {
               onLoadMemoji(view,memoji);
           }
       };

you can also load the MemojiProvider as a json and download it from your server, in this way you can add new memoji packs to your app when ever you want.

Author

  • Amir Hossein Aghajari

GitHub