introduced build flavor to build w/o emoji compat
This commit is contained in:
parent
4b3de32a4e
commit
9cc22ce992
|
@ -10,7 +10,7 @@ android:
|
|||
licenses:
|
||||
- '.+'
|
||||
script:
|
||||
- ./gradlew assembleFreeRelease
|
||||
- ./gradlew assembleFreeSystemRelease
|
||||
|
||||
before_install:
|
||||
- yes | sdkmanager "platforms;android-27"
|
||||
|
|
|
@ -368,7 +368,7 @@ Make sure to have ANDROID_HOME point to your Android SDK. Use the Android SDK Ma
|
|||
|
||||
git clone https://github.com/siacs/Conversations.git
|
||||
cd Conversations
|
||||
./gradlew assembleFreeDebug
|
||||
./gradlew assembleFreeSystemDebug
|
||||
|
||||
There are two build flavors available. *free* and *playstore*. Unless you know what you are doing you only need *free*.
|
||||
|
||||
|
|
17
build.gradle
17
build.gradle
|
@ -6,7 +6,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.2'
|
||||
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,8 @@ repositories {
|
|||
|
||||
configurations {
|
||||
playstoreImplementation
|
||||
freeImplementation
|
||||
compatImplementation
|
||||
freeCompatImplementation
|
||||
}
|
||||
|
||||
ext {
|
||||
|
@ -39,10 +40,10 @@ dependencies {
|
|||
implementation "com.android.support:support-v13:$supportLibVersion"
|
||||
implementation "com.android.support:appcompat-v7:$supportLibVersion"
|
||||
implementation "com.android.support:cardview-v7:$supportLibVersion"
|
||||
implementation "com.android.support:support-emoji-appcompat:$supportLibVersion"
|
||||
compatImplementation "com.android.support:support-emoji-appcompat:$supportLibVersion"
|
||||
implementation "com.android.support:support-emoji:$supportLibVersion"
|
||||
implementation "com.android.support:design:$supportLibVersion"
|
||||
freeImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
|
||||
freeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
|
||||
implementation 'org.bouncycastle:bcmail-jdk15on:1.58'
|
||||
implementation 'com.google.zxing:core:3.3.0'
|
||||
implementation 'de.measite.minidns:minidns-hla:0.2.4'
|
||||
|
@ -89,7 +90,7 @@ android {
|
|||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
flavorDimensions("distribution")
|
||||
flavorDimensions("distribution", "emoji")
|
||||
|
||||
productFlavors {
|
||||
playstore {
|
||||
|
@ -98,6 +99,12 @@ android {
|
|||
free {
|
||||
dimension "distribution"
|
||||
}
|
||||
system {
|
||||
dimension "emoji"
|
||||
}
|
||||
compat {
|
||||
dimension "emoji"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package eu.siacs.conversations.ui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.text.emoji.widget.EmojiAppCompatEditText;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public abstract class AbstractEditMessage extends EmojiAppCompatEditText {
|
||||
|
||||
public AbstractEditMessage(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AbstractEditMessage(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package eu.siacs.conversations.ui.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.support.text.emoji.EmojiCompat;
|
||||
import android.support.text.emoji.FontRequestEmojiCompatConfig;
|
||||
import android.support.text.emoji.bundled.BundledEmojiCompatConfig;
|
||||
import android.support.v4.provider.FontRequest;
|
||||
import android.util.Log;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
|
||||
public class EmojiService {
|
||||
|
||||
private final Context context;
|
||||
|
||||
public EmojiService(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
BundledEmojiCompatConfig config = new BundledEmojiCompatConfig(context);
|
||||
config.setReplaceAll(true);
|
||||
EmojiCompat.init(config);
|
||||
}
|
||||
|
||||
}
|
|
@ -41,7 +41,6 @@ import android.content.Intent;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.IdRes;
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package eu.siacs.conversations.ui.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
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();
|
||||
//On recent Androids we assume to have the latest emojis
|
||||
//there are some annoying bugs with emoji compat that make it a safer choice not to use it when possible
|
||||
// a) when using the ondemand emoji font (play store) flags don’t work
|
||||
// b) the text preview has annoying glitches when the cut of text contains emojis (the emoji will be half visible)
|
||||
config.setReplaceAll(Build.VERSION.SDK_INT < Build.VERSION_CODES.O);
|
||||
EmojiCompat.init(config);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package eu.siacs.conversations.ui.widget;
|
|||
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.text.emoji.widget.EmojiAppCompatEditText;
|
||||
import android.support.v13.view.inputmethod.EditorInfoCompat;
|
||||
import android.support.v13.view.inputmethod.InputConnectionCompat;
|
||||
import android.support.v13.view.inputmethod.InputContentInfoCompat;
|
||||
|
@ -23,7 +22,7 @@ import android.view.inputmethod.InputConnection;
|
|||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
|
||||
public class EditMessage extends EmojiAppCompatEditText {
|
||||
public class EditMessage extends AbstractEditMessage {
|
||||
|
||||
private static final InputFilter SPAN_FILTER = (source, start, end, dest, dstart, dend) -> source instanceof Spanned ? source.toString() : source;
|
||||
protected Handler mTypingHandler = new Handler();
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package eu.siacs.conversations.ui.service;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
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 {
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
private final Context context;
|
||||
|
||||
public EmojiService(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
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);
|
||||
//On recent Androids we assume to have the latest emojis
|
||||
//there are some annoying bugs with emoji compat that make it a safer choice not to use it when possible
|
||||
// a) when using the ondemand emoji font (play store) flags don’t work
|
||||
// b) the text preview has annoying glitches when the cut of text contains emojis (the emoji will be half visible)
|
||||
fontRequestEmojiCompatConfig.setReplaceAll(Build.VERSION.SDK_INT < Build.VERSION_CODES.O);
|
||||
EmojiCompat.init(fontRequestEmojiCompatConfig);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package eu.siacs.conversations.ui.service;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class EmojiService {
|
||||
|
||||
public EmojiService(Context context) {
|
||||
//nop
|
||||
}
|
||||
|
||||
public void init() {
|
||||
//nop
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package eu.siacs.conversations.ui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.AppCompatEditText;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public abstract class AbstractEditMessage extends AppCompatEditText {
|
||||
|
||||
public AbstractEditMessage(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AbstractEditMessage(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Daniel Gultsch All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package eu.siacs.conversations.utils;
|
||||
|
||||
import android.support.text.emoji.EmojiCompat;
|
||||
|
||||
public class EmojiWrapper {
|
||||
|
||||
public static CharSequence transform(CharSequence input) {
|
||||
try {
|
||||
if (EmojiCompat.get().getLoadState() == EmojiCompat.LOAD_STATE_SUCCEEDED) {
|
||||
return EmojiCompat.get().process(input);
|
||||
} else {
|
||||
return input;
|
||||
}
|
||||
} catch (IllegalStateException e) {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue