~singpolyma/cheogram-android

42b4528d034ccad9c9eda5e6b2bbd6b636507548 — Daniel Gultsch 7 years ago c69c358
use emoji compat
M build.gradle => build.gradle +5 -2
@@ 21,10 21,11 @@ repositories {

configurations {
    playstoreCompile
    freeCompile
}

ext {
    supportLibVersion = '25.4.0'
    supportLibVersion = '26.1.0'
}

dependencies {


@@ 34,6 35,8 @@ dependencies {
    compile 'com.soundcloud.android:android-crop:1.0.1@aar'
    compile "com.android.support:support-v13:$supportLibVersion"
    compile "com.android.support:appcompat-v7:$supportLibVersion"
    compile "com.android.support:support-emoji:$supportLibVersion"
    freeCompile "com.android.support:support-emoji-bundled:$supportLibVersion"
    compile 'org.bouncycastle:bcprov-jdk15on:1.52'
    compile 'org.bouncycastle:bcmail-jdk15on:1.52'
    compile 'org.jitsi:org.otr4j:0.22'


@@ 59,7 62,7 @@ ext {
}

android {
    compileSdkVersion 25
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {

A src/free/java/eu/siacs/conversations/ui/service/EmojiService.java => src/free/java/eu/siacs/conversations/ui/service/EmojiService.java +17 -0
@@ 0,0 1,17 @@
package eu.siacs.conversations.ui.service;

import android.content.Context;
import android.support.text.emoji.EmojiCompat;
import android.support.text.emoji.bundled.BundledEmojiCompatConfig;

public class EmojiService extends AbstractEmojiService {

	public EmojiService(Context context) {
		super(context);
	}

	@Override
	protected EmojiCompat.Config buildConfig() {
		return new BundledEmojiCompatConfig(context);
	}
}
\ No newline at end of file

M src/main/java/eu/siacs/conversations/ui/ConversationActivity.java => src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +2 -0
@@ 62,6 62,7 @@ import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate;
import eu.siacs.conversations.services.XmppConnectionService.OnRosterUpdate;
import eu.siacs.conversations.ui.adapter.ConversationAdapter;
import eu.siacs.conversations.ui.service.EmojiService;
import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;


@@ 178,6 179,7 @@ public class ConversationActivity extends XmppActivity
	@Override
	protected void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		new EmojiService(this).init();
		if (savedInstanceState != null) {
			mOpenConversation = savedInstanceState.getString(STATE_OPEN_CONVERSATION, null);
			mPanelOpen = savedInstanceState.getBoolean(STATE_PANEL_OPEN, true);

M src/main/java/eu/siacs/conversations/ui/ConversationFragment.java => src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +1 -0
@@ 70,6 70,7 @@ import eu.siacs.conversations.ui.XmppActivity.OnValueEdited;
import eu.siacs.conversations.ui.adapter.MessageAdapter;
import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureClicked;
import eu.siacs.conversations.ui.adapter.MessageAdapter.OnContactPictureLongClicked;
import eu.siacs.conversations.ui.widget.EditMessage;
import eu.siacs.conversations.ui.widget.ListSelectionManager;
import eu.siacs.conversations.utils.NickValidityChecker;
import eu.siacs.conversations.utils.UIHelper;

A src/main/java/eu/siacs/conversations/ui/service/AbstractEmojiService.java => src/main/java/eu/siacs/conversations/ui/service/AbstractEmojiService.java +21 -0
@@ 0,0 1,21 @@
package eu.siacs.conversations.ui.service;

import android.content.Context;
import android.support.text.emoji.EmojiCompat;

public abstract class AbstractEmojiService {

	protected final Context context;

	public AbstractEmojiService(Context context) {
		this.context = context;
	}

	protected abstract EmojiCompat.Config buildConfig();

	public void init() {
		final EmojiCompat.Config config = buildConfig();
		config.setReplaceAll(true);
		EmojiCompat.init(config);
	}
}

M src/main/java/eu/siacs/conversations/ui/widget/CopyTextView.java => src/main/java/eu/siacs/conversations/ui/widget/CopyTextView.java +2 -2
@@ 5,10 5,10 @@ import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Build;
import android.support.text.emoji.widget.EmojiTextView;
import android.util.AttributeSet;
import android.widget.TextView;

public class CopyTextView extends TextView {
public class CopyTextView extends EmojiTextView {

	public CopyTextView(Context context) {
		super(context);

R src/main/java/eu/siacs/conversations/ui/EditMessage.java => src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java +3 -3
@@ 1,5 1,6 @@
package eu.siacs.conversations.ui;
package eu.siacs.conversations.ui.widget;

import android.support.text.emoji.widget.EmojiEditText;
import android.support.v13.view.inputmethod.EditorInfoCompat;
import android.support.v13.view.inputmethod.InputConnectionCompat;
import android.support.v13.view.inputmethod.InputContentInfoCompat;


@@ 15,11 16,10 @@ import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.EditText;

import eu.siacs.conversations.Config;

public class EditMessage extends EditText {
public class EditMessage extends EmojiEditText {

	public interface OnCommitContentListener {
		boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts, String[] mimeTypes);

M src/main/res/layout/conversation_list_row.xml => src/main/res/layout/conversation_list_row.xml +2 -2
@@ 37,7 37,7 @@
                android:layout_toRightOf="@+id/conversation_image"
                android:paddingLeft="8dp">

                <TextView
                <android.support.text.emoji.widget.EmojiTextView
                    android:id="@+id/conversation_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"


@@ 79,7 79,7 @@
                                  android:layout_alignWithParentIfMissing="true"
                                  android:layout_toLeftOf="@+id/notification_status"
                                  android:id="@+id/txt_img_wrapper">
                        <TextView
                        <android.support.text.emoji.widget.EmojiTextView
                            android:id="@+id/conversation_lastmsg"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"

M src/main/res/layout/fragment_conversation.xml => src/main/res/layout/fragment_conversation.xml +2 -2
@@ 29,7 29,7 @@
        android:layout_alignParentLeft="true"
        android:background="?attr/color_background_primary" >

        <eu.siacs.conversations.ui.EditMessage
        <eu.siacs.conversations.ui.widget.EditMessage
            android:id="@+id/textinput"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"


@@ 48,7 48,7 @@
            android:textColor="?attr/color_text_primary" >

            <requestFocus />
        </eu.siacs.conversations.ui.EditMessage>
        </eu.siacs.conversations.ui.widget.EditMessage>

        <ImageButton
            android:id="@+id/textSendButton"

A src/playstore/java/eu/siacs/conversations/ui/service/EmojiService.java => src/playstore/java/eu/siacs/conversations/ui/service/EmojiService.java +45 -0
@@ 0,0 1,45 @@
package eu.siacs.conversations.ui.service;

import android.content.Context;
import android.support.text.emoji.EmojiCompat;
import android.support.text.emoji.FontRequestEmojiCompatConfig;
import android.support.v4.provider.FontRequest;
import android.util.Log;

import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;

public class EmojiService extends AbstractEmojiService {


	private final EmojiCompat.InitCallback initCallback = new EmojiCompat.InitCallback() {
		@Override
		public void onInitialized() {
			super.onInitialized();
			Log.d(Config.LOGTAG,"EmojiService succeeded in loading fonts");

		}

		@Override
		public void onFailed(Throwable throwable) {
			super.onFailed(throwable);
			Log.d(Config.LOGTAG,"EmojiService failed to load fonts",throwable);
		}
	};

	public EmojiService(Context context) {
		super(context);
	}

	@Override
	protected EmojiCompat.Config buildConfig() {
		final FontRequest fontRequest = new FontRequest(
				"com.google.android.gms.fonts",
				"com.google.android.gms",
				"Noto Color Emoji Compat",
				R.array.font_certs);
		FontRequestEmojiCompatConfig fontRequestEmojiCompatConfig = new FontRequestEmojiCompatConfig(context, fontRequest);
		fontRequestEmojiCompatConfig.registerInitCallback(initCallback);
		return fontRequestEmojiCompatConfig;
	}
}
\ No newline at end of file

A src/playstore/res/values/font_certs.xml => src/playstore/res/values/font_certs.xml +6 -0
@@ 0,0 1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="font_certs">
        <item>MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQ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