display messages that only contain emoji slightly larger
This commit is contained in:
parent
e11277c70f
commit
82c5924434
|
@ -41,6 +41,9 @@ dependencies {
|
||||||
compile 'com.makeramen:roundedimageview:2.2.0'
|
compile 'com.makeramen:roundedimageview:2.2.0'
|
||||||
compile "com.wefika:flowlayout:0.4.1"
|
compile "com.wefika:flowlayout:0.4.1"
|
||||||
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
|
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
|
||||||
|
compile ('com.vdurmont:emoji-java:3.3.0') {
|
||||||
|
exclude group: 'org.json', module: 'json'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import android.content.ContentValues;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
|
|
||||||
|
import com.vdurmont.emoji.EmojiManager;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
@ -500,8 +502,8 @@ public class Message extends AbstractEntity {
|
||||||
!this.treatAsDownloadable() &&
|
!this.treatAsDownloadable() &&
|
||||||
!message.getBody().startsWith(ME_COMMAND) &&
|
!message.getBody().startsWith(ME_COMMAND) &&
|
||||||
!this.getBody().startsWith(ME_COMMAND) &&
|
!this.getBody().startsWith(ME_COMMAND) &&
|
||||||
!this.bodyIsHeart() &&
|
!this.bodyIsOnlyEmojis() &&
|
||||||
!message.bodyIsHeart() &&
|
!message.bodyIsOnlyEmojis() &&
|
||||||
((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) &&
|
((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) &&
|
||||||
UIHelper.sameDay(message.getTimeSent(),this.getTimeSent())
|
UIHelper.sameDay(message.getTimeSent(),this.getTimeSent())
|
||||||
);
|
);
|
||||||
|
@ -666,8 +668,8 @@ public class Message extends AbstractEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean bodyIsHeart() {
|
public boolean bodyIsOnlyEmojis() {
|
||||||
return body != null && UIHelper.HEARTS.contains(body.trim());
|
return EmojiManager.isOnlyEmojis(body.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileParams getFileParams() {
|
public FileParams getFileParams() {
|
||||||
|
|
|
@ -36,6 +36,8 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.vdurmont.emoji.EmojiManager;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -321,7 +323,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
||||||
viewHolder.messageBody.setTextIsSelectable(false);
|
viewHolder.messageBody.setTextIsSelectable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayHeartMessage(final ViewHolder viewHolder, final String body) {
|
private void displayEmojiMessage(final ViewHolder viewHolder, final String body) {
|
||||||
if (viewHolder.download_button != null) {
|
if (viewHolder.download_button != null) {
|
||||||
viewHolder.download_button.setVisibility(View.GONE);
|
viewHolder.download_button.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -329,8 +331,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
||||||
viewHolder.messageBody.setVisibility(View.VISIBLE);
|
viewHolder.messageBody.setVisibility(View.VISIBLE);
|
||||||
viewHolder.messageBody.setIncludeFontPadding(false);
|
viewHolder.messageBody.setIncludeFontPadding(false);
|
||||||
Spannable span = new SpannableString(body);
|
Spannable span = new SpannableString(body);
|
||||||
span.setSpan(new RelativeSizeSpan(4.0f), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
float size = EmojiManager.isEmoji(body) ? 3.0f : 2.0f;
|
||||||
span.setSpan(new ForegroundColorSpan(activity.getWarningTextColor()), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
span.setSpan(new RelativeSizeSpan(size), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
viewHolder.messageBody.setText(span);
|
viewHolder.messageBody.setText(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,8 +792,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
||||||
} else {
|
} else {
|
||||||
if (GeoHelper.isGeoUri(message.getBody())) {
|
if (GeoHelper.isGeoUri(message.getBody())) {
|
||||||
displayLocationMessage(viewHolder,message);
|
displayLocationMessage(viewHolder,message);
|
||||||
} else if (message.bodyIsHeart()) {
|
} else if (message.bodyIsOnlyEmojis()) {
|
||||||
displayHeartMessage(viewHolder, message.getBody().trim());
|
displayEmojiMessage(viewHolder, message.getBody().trim());
|
||||||
} else if (message.treatAsDownloadable()) {
|
} else if (message.treatAsDownloadable()) {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(message.getBody());
|
URL url = new URL(message.getBody());
|
||||||
|
|
|
@ -28,12 +28,6 @@ import eu.siacs.conversations.xmpp.jid.Jid;
|
||||||
|
|
||||||
public class UIHelper {
|
public class UIHelper {
|
||||||
|
|
||||||
private static String BLACK_HEART_SUIT = "\u2665";
|
|
||||||
private static String HEAVY_BLACK_HEART_SUIT = "\u2764";
|
|
||||||
private static String WHITE_HEART_SUIT = "\u2661";
|
|
||||||
|
|
||||||
public static final List<String> HEARTS = Arrays.asList(BLACK_HEART_SUIT,HEAVY_BLACK_HEART_SUIT,WHITE_HEART_SUIT);
|
|
||||||
|
|
||||||
private static final List<String> LOCATION_QUESTIONS = Arrays.asList(
|
private static final List<String> LOCATION_QUESTIONS = Arrays.asList(
|
||||||
"where are you", //en
|
"where are you", //en
|
||||||
"where are you now", //en
|
"where are you now", //en
|
||||||
|
|
|
@ -336,6 +336,7 @@
|
||||||
\n\nhttps://github.com/WhisperSystems/libaxolotl-java\n(GPLv3)
|
\n\nhttps://github.com/WhisperSystems/libaxolotl-java\n(GPLv3)
|
||||||
\n\nhttps://github.com/vinc3m1/RoundedImageView\n(Apache License, Version 2.0)
|
\n\nhttps://github.com/vinc3m1/RoundedImageView\n(Apache License, Version 2.0)
|
||||||
\n\nhttps://github.com/jdamcd/android-crop\n(Apache License, Version 2.0)
|
\n\nhttps://github.com/jdamcd/android-crop\n(Apache License, Version 2.0)
|
||||||
|
\n\nhttps://github.com/vdurmont/emoji-java\n(The MIT License)
|
||||||
</string>
|
</string>
|
||||||
<string name="title_pref_quiet_hours">Quiet Hours</string>
|
<string name="title_pref_quiet_hours">Quiet Hours</string>
|
||||||
<string name="title_pref_quiet_hours_start_time">Start time</string>
|
<string name="title_pref_quiet_hours_start_time">Start time</string>
|
||||||
|
|
Loading…
Reference in a new issue