<commit_before>package im.actor;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;

import im.actor.core.entity.Peer;
import im.actor.core.entity.content.AbsContent;
import im.actor.core.entity.content.ContentConverter;
import im.actor.core.entity.content.JsonContent;
import im.actor.core.entity.content.internal.AbsContentContainer;
import im.actor.core.entity.content.internal.ContentRemoteContainer;
import im.actor.runtime.json.JSONException;
import im.actor.sdk.ActorSDK;
import im.actor.sdk.ActorSDKApplication;
import im.actor.sdk.ActorStyle;
import im.actor.sdk.BaseActorSDKDelegate;
import im.actor.sdk.controllers.conversation.messages.BaseCustomHolder;
import im.actor.sdk.controllers.conversation.messages.MessageHolder;
import im.actor.sdk.controllers.conversation.messages.MessagesAdapter;
import im.actor.sdk.controllers.conversation.messages.MessagesFragment;
import im.actor.sdk.controllers.fragment.settings.ActorSettingsCategory;
import im.actor.sdk.controllers.fragment.settings.ActorSettingsField;
import im.actor.sdk.controllers.fragment.settings.BaseActorChatActivity;
import im.actor.sdk.controllers.fragment.settings.BaseActorSettingsActivity;
import im.actor.sdk.controllers.fragment.settings.BaseActorSettingsFragment;
import im.actor.sdk.intents.ActorIntent;
import im.actor.sdk.intents.ActorIntentFragmentActivity;

import static im.actor.sdk.util.ActorSDKMessenger.messenger;

public class Application extends ActorSDKApplication {

    @Override
    public void onConfigureActorSDK() {
        ActorSDK.sharedActor().setDelegate(new ActorSDKDelegate());
        ActorSDK.sharedActor().setPushId(209133700967L);

//        ArrayList<String> endpoints = new ArrayList<String>();
//        endpoints.add("foo");
//        ActorSDK.sharedActor().setEndpoints(endpoints);

        ActorStyle style = ActorSDK.sharedActor().style;
        style.setMainColor(Color.parseColor("#529a88"));
        AbsContent.registerConverter(new ContentConverter() {
            @Override
            public AbsContent convert(AbsContentContainer container) {
                return JsonContent.convert(container, Custom.class);
            }

            @Override
            public Class destinationType() {
                return Custom.class;
            }
        });
        AbsContent.registerConverter(new ContentConverter() {
            @Override
            public AbsContent convert(AbsContentContainer container) {
                return JsonContent.convert(container, CustomTwo.class);
            }

            @Override
            public Class destinationType() {
                return CustomTwo.class;
            }
        });
    }

    public static class Custom extends JsonContent {

        public String getText() {
            return getSimpleStringData();
        }

        @Override
        public String getDataType() {
            return "customJson";
        }

        @Override
        public String getContentDescriptionEn() {
            return "custom json msg";
        }

        @Override
        public String getContentDescriptionRu() {
            return " бла бла бла";
        }
    }

    public static class CustomTwo extends JsonContent {

        public String getText() {
            return getSimpleStringData();
        }

        @Override
        public String getDataType() {
            return "customTwoJson";
        }

        @Override
        public String getContentDescriptionEn() {
            return "custom json msg";
        }

        @Override
        public String getContentDescriptionRu() {
            return " бла бла бла";
        }
    }



    private class ActorSDKDelegate extends BaseActorSDKDelegate {

        @Override
        public ActorIntent getChatIntent() {
            return new BaseActorChatActivity() {
                @Override
                public MessagesFragment getChatFragment(Peer peer) {
                    return new MessagesFragment(peer) {
                        @Override
                        public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//                            messenger().sendCustomJsonMessage(getPeer(), JsonContent.create(Custom.class, System.currentTimeMillis()+"One"));
//                            messenger().sendCustomJsonMessage(getPeer(), JsonContent.create(CustomTwo.class, System.currentTimeMillis()+"Two"));
//                            messenger().sendCustomJsonMessage(getPeer(), JsonContent.create(CustomTwo.class, System.currentTimeMillis()+"Two"));<commit_msg>chore(android): add example app custom msgs translations<commit_after>package im.actor;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;

import im.actor.core.entity.Peer;
import im.actor.core.entity.content.AbsContent;
import im.actor.core.entity.content.ContentConverter;
import im.actor.core.entity.content.JsonContent;
import im.actor.core.entity.content.internal.AbsContentContainer;
import im.actor.core.entity.content.internal.ContentRemoteContainer;
import im.actor.runtime.json.JSONException;
import im.actor.sdk.ActorSDK;
import im.actor.sdk.ActorSDKApplication;
import im.actor.sdk.ActorStyle;
import im.actor.sdk.BaseActorSDKDelegate;
import im.actor.sdk.controllers.conversation.messages.BaseCustomHolder;
import im.actor.sdk.controllers.conversation.messages.MessageHolder;
import im.actor.sdk.controllers.conversation.messages.MessagesAdapter;
import im.actor.sdk.controllers.conversation.messages.MessagesFragment;
import im.actor.sdk.controllers.fragment.settings.ActorSettingsCategory;
import im.actor.sdk.controllers.fragment.settings.ActorSettingsField;
import im.actor.sdk.controllers.fragment.settings.BaseActorChatActivity;
import im.actor.sdk.controllers.fragment.settings.BaseActorSettingsActivity;
import im.actor.sdk.controllers.fragment.settings.BaseActorSettingsFragment;
import im.actor.sdk.intents.ActorIntent;
import im.actor.sdk.intents.ActorIntentFragmentActivity;

import static im.actor.sdk.util.ActorSDKMessenger.messenger;

public class Application extends ActorSDKApplication {

    @Override
    public void onConfigureActorSDK() {
        ActorSDK.sharedActor().setDelegate(new ActorSDKDelegate());
        ActorSDK.sharedActor().setPushId(209133700967L);

//        ArrayList<String> endpoints = new ArrayList<String>();
//        endpoints.add("foo");
//        ActorSDK.sharedActor().setEndpoints(endpoints);

        ActorStyle style = ActorSDK.sharedActor().style;
        style.setMainColor(Color.parseColor("#529a88"));
        AbsContent.registerConverter(new ContentConverter() {
            @Override
            public AbsContent convert(AbsContentContainer container) {
                return JsonContent.convert(container, Custom.class);
            }

            @Override
            public Class destinationType() {
                return Custom.class;
            }
        });
        AbsContent.registerConverter(new ContentConverter() {
            @Override
            public AbsContent convert(AbsContentContainer container) {
                return JsonContent.convert(container, CustomTwo.class);
            }

            @Override
            public Class destinationType() {
                return CustomTwo.class;
            }
        });
    }

    public static class Custom extends JsonContent {

        public String getText() {
            return getSimpleStringData();
        }

        @Override
        public String getDataType() {
            return "customJson";
        }

        @Override
        public String getContentDescriptionEn() {
            return "custom json msg";
        }

        @Override
        public String getContentDescriptionRu() {
            return " бла бла бла";
        }

        @Override
        public String getContentDescriptionPtPT() {
            return null;
        }

        @Override
        public String getContentDescriptionPtBR() {
            return null;
        }

        @Override
        public String getContentDescriptionAr() {
            return null;
        }

        @Override
        public String getContentDescriptionCn() {
            return null;
        }

        @Override
        public String getContentDescriptionEs() {
            return null;
        }
    }

    public static class CustomTwo extends JsonContent {

        public String getText() {
            return getSimpleStringData();
        }

        @Override
        public String getDataType() {
            return "customTwoJson";
        }

        @Override
        public String getContentDescriptionEn() {
            return "custom json msg";
        }

        @Override
        public String getContentDescriptionRu() {
            return " бла бла бла";
        }

        @Override
        public String getContentDescriptionPtPT() {
            return null;
        }

        @Override
        public String getContentDescriptionPtBR() {
            return null;
        }

        @Override
        public String getContentDescriptionAr() {
            return null;
        }

        @Override
        public String getContentDescriptionCn() {
            return null;
        }

        @Override
        public String getContentDescriptionEs() {
            return null;
        }
    }



    private class ActorSDKDelegate extends BaseActorSDKDelegate {

        @Override
        public ActorIntent getChatIntent() {
            return new BaseActorChatActivity() {
                @Override
                public MessagesFragment getChatFragment(Peer peer) {
                    return new MessagesFragment(peer) {
                        @Override
                        public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//                            messenger().sendCustomJsonMessage(getPeer(), JsonContent.create(Custom.class, System.currentTimeMillis()+"One"));
//                            messenger().sendCustomJsonMessage(getPeer(), JsonContent.create(CustomTwo.class, System.currentTimeMillis()+"Two"));
//                            messenger().sendCustomJsonMessage(getPeer(), JsonContent.create(CustomTwo.class, System.currentTimeMillis()+"Two"));
{'fraction_non_alphanumeric': 0.08806630875011774, 'fraction_numerical': 0.0032024112272770085, 'mean_word_length': 2.531094113734619, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6205535', 'n_tokens_mistral': 2685, 'n_tokens_neox': 2543, 'n_words': 511}