mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove jemoji, it adds +13MB
This commit is contained in:
@@ -166,7 +166,6 @@ dependencies {
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
|
||||
implementation 'androidx.work:work-runtime:2.9.1'
|
||||
implementation "androidx.emoji2:emoji2-emojipicker:1.5.0"
|
||||
implementation "net.fellbaum:jemoji:1.5.2"
|
||||
implementation 'com.google.guava:guava:31.1-android'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-core:2.19.1' // plays video and audio
|
||||
implementation 'com.google.android.exoplayer:exoplayer-ui:2.19.1'
|
||||
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
package org.thoughtcrime.securesms.components.emoji;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
import net.fellbaum.jemoji.Emoji;
|
||||
import net.fellbaum.jemoji.EmojiManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AutoScaledEmojiTextView extends AppCompatTextView {
|
||||
|
||||
private float originalFontSize;
|
||||
|
||||
public AutoScaledEmojiTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AutoScaledEmojiTextView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public AutoScaledEmojiTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.textSize});
|
||||
originalFontSize = typedArray.getDimensionPixelSize(0, 0);
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(@Nullable CharSequence text, BufferType type) {
|
||||
float scale = getTextScale(text);
|
||||
super.setTextSize(TypedValue.COMPLEX_UNIT_PX, originalFontSize * scale);
|
||||
super.setText(text, type);
|
||||
}
|
||||
|
||||
private float getTextScale(CharSequence text) {
|
||||
if (text.length() > 16) {
|
||||
return 1;
|
||||
}
|
||||
List<Emoji> emojis = EmojiManager.extractEmojisInOrder(text.toString());
|
||||
int emojiCount = emojis.size();
|
||||
if (emojiCount <= 8) {
|
||||
int charCount = text.length();
|
||||
for (Emoji emoji : emojis) {
|
||||
charCount -= emoji.getEmoji().length();
|
||||
}
|
||||
if (charCount == 0) { // only emojis in text
|
||||
float scale = 1.25f;
|
||||
if (emojiCount <= 6) scale += 0.25f;
|
||||
if (emojiCount <= 4) scale += 0.25f;
|
||||
if (emojiCount <= 2) scale += 0.25f;
|
||||
return scale;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -163,7 +163,7 @@
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.AutoScaledEmojiTextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/conversation_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.AutoScaledEmojiTextView
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/conversation_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user