aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java30
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java22
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java22
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java8
-rw-r--r--src/main/java/de/pixart/messenger/utils/CharSequenceUtils.java86
-rw-r--r--src/main/java/de/pixart/messenger/utils/StylingHelper.java41
-rw-r--r--src/main/java/de/pixart/messenger/utils/UIHelper.java27
9 files changed, 217 insertions, 27 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index fe167b904..62461c0c0 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -552,10 +552,10 @@ public class NotificationService {
}
/** message preview for Android Auto **/
for (Message message : messages) {
- Pair<String, Boolean> preview = UIHelper.getMessagePreview(mXmppConnectionService, message);
+ Pair<CharSequence, Boolean> preview = UIHelper.getMessagePreview(mXmppConnectionService, message);
// only show user written text
if (!preview.second) {
- uBuilder.addMessage(preview.first);
+ uBuilder.addMessage(preview.first.toString());
uBuilder.setLatestTimestamp(message.getTimeSent());
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index a7163af5d..ebe02fe4b 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -146,6 +146,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
public static final String STATE_CONVERSATION_UUID = ConversationFragment.class.getName() + ".uuid";
public static final String STATE_SCROLL_POSITION = ConversationFragment.class.getName() + ".scroll_position";
public static final String STATE_PHOTO_URI = ConversationFragment.class.getName() + ".take_photo_uri";
+ public static final String STATE_VIDEO_URI = ConversationFragment.class.getName() + ".take_video_uri";
private static final String STATE_LAST_MESSAGE_UUID = "state_last_message_uuid";
@@ -157,6 +158,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
private final PendingItem<String> pendingConversationsUuid = new PendingItem<>();
private final PendingItem<Bundle> pendingExtras = new PendingItem<>();
private final PendingItem<Uri> pendingTakePhotoUri = new PendingItem<>();
+ private final PendingItem<Uri> pendingTakeVideoUri = new PendingItem<>();
private final PendingItem<ScrollState> pendingScrollState = new PendingItem<>();
private final PendingItem<String> pendingLastMessageUuid = new PendingItem<>();
private final PendingItem<Message> pendingMessage = new PendingItem<>();
@@ -1001,6 +1003,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
private void handlePositiveActivityResult(int requestCode, final Intent data) {
+ final String type = data == null ? null : data.getType();
switch (requestCode) {
case REQUEST_TRUST_KEYS_TEXT:
final String body = binding.textinput.getText().toString();
@@ -1028,16 +1031,18 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
break;
case ATTACHMENT_CHOICE_TAKE_FROM_CAMERA:
final Uri takePhotoUri = pendingTakePhotoUri.pop();
+ final Uri takeVideoUri = pendingTakeVideoUri.pop();
if (takePhotoUri != null) {
attachPhotoToConversation(conversation, takePhotoUri);
+ } else if (takeVideoUri != null) {
+ attachFileToConversation(conversation, takeVideoUri, type);
} else {
- Log.d(Config.LOGTAG, "lost take photo uri. unable to to attach");
+ Log.d(Config.LOGTAG, "lost take uri. unable to to attach");
}
break;
case ATTACHMENT_CHOICE_CHOOSE_FILE:
case ATTACHMENT_CHOICE_RECORD_VOICE:
final List<Uri> fileUris = AttachmentTool.extractUriFromIntent(data);
- final String type = data == null ? null : data.getType();
final PresenceSelector.OnPresenceSelected callback = () -> {
for (Iterator<Uri> i = fileUris.iterator(); i.hasNext(); i.remove()) {
Log.d(Config.LOGTAG, "ConversationsActivity.onActivityResult() - attaching file to conversations. CHOOSE_FILE/RECORD_VOICE");
@@ -1525,6 +1530,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (!hasPermissions(attachmentChoice, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA)) {
return;
}
+ } else if (attachmentChoice == ATTACHMENT_CHOICE_LOCATION) {
+ if (!hasPermissions(attachmentChoice, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION)) {
+ return;
+ }
} else if (attachmentChoice != ATTACHMENT_CHOICE_LOCATION) {
if (!hasPermissions(attachmentChoice, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
return;
@@ -1720,6 +1729,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
});
builder.setPositiveButton(getString(R.string.action_take_video),
(dialog, which) -> {
+ final Uri uri = activity.xmppConnectionService.getFileBackend().getTakeVideoUri();
+ pendingTakeVideoUri.push(uri);
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setAction(MediaStore.ACTION_VIDEO_CAPTURE);
@@ -1955,9 +1967,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (conversation != null) {
outState.putString(STATE_CONVERSATION_UUID, conversation.getUuid());
outState.putString(STATE_LAST_MESSAGE_UUID, lastMessageUuid);
- final Uri uri = pendingTakePhotoUri.peek();
- if (uri != null) {
- outState.putString(STATE_PHOTO_URI, uri.toString());
+ final Uri PhotoUri = pendingTakePhotoUri.peek();
+ final Uri VideoUri = pendingTakeVideoUri.peek();
+ if (PhotoUri != null) {
+ outState.putString(STATE_PHOTO_URI, PhotoUri.toString());
+ }
+ if (VideoUri != null) {
+ outState.putString(STATE_VIDEO_URI, VideoUri.toString());
}
final ScrollState scrollState = getScrollPosition();
if (scrollState != null) {
@@ -1981,6 +1997,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (takePhotoUri != null) {
pendingTakePhotoUri.push(Uri.parse(takePhotoUri));
}
+ String takeVideoUri = savedInstanceState.getString(STATE_VIDEO_URI);
+ if (takeVideoUri != null) {
+ pendingTakeVideoUri.push(Uri.parse(takeVideoUri));
+ }
pendingScrollState.push(savedInstanceState.getParcelable(STATE_SCROLL_POSITION));
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index 98f3939b9..ec8bc78d4 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -150,6 +150,28 @@ public class SettingsActivity extends XmppActivity implements
automaticMessageDeletionList.setEntryValues(entryValues);
}
+ boolean removeVoice = !getApplicationContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE);
+ boolean removeLocation = !getApplicationContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)
+ && !getApplicationContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_NETWORK);
+
+ ListPreference quickAction = (ListPreference) mSettingsFragment.findPreference("quick_action");
+ if (quickAction != null && (removeLocation || removeVoice)) {
+ ArrayList<CharSequence> entries = new ArrayList<>(Arrays.asList(quickAction.getEntries()));
+ ArrayList<CharSequence> entryValues = new ArrayList<>(Arrays.asList(quickAction.getEntryValues()));
+ int index = entryValues.indexOf("location");
+ if (index > 0 && removeLocation) {
+ entries.remove(index);
+ entryValues.remove(index);
+ }
+ index = entryValues.indexOf("voice");
+ if (index > 0 && removeVoice) {
+ entries.remove(index);
+ entryValues.remove(index);
+ }
+ quickAction.setEntries(entries.toArray(new CharSequence[entries.size()]));
+ quickAction.setEntryValues(entryValues.toArray(new CharSequence[entryValues.size()]));
+ }
+
final Preference removeCertsPreference = mSettingsFragment.findPreference("remove_trusted_certificates");
if (removeCertsPreference != null) {
removeCertsPreference.setOnPreferenceClickListener(preference -> {
diff --git a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
index be2c98de5..b3ff43d3d 100644
--- a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
@@ -13,6 +13,7 @@ import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.text.TextUtils;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -25,6 +26,7 @@ import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Locale;
+import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.services.EmojiService;
import de.pixart.messenger.utils.MenuDoubleTabUtil;
@@ -80,16 +82,20 @@ public class ShowLocationActivity extends XmppActivity {
this.location = new Location("");
this.location.setLatitude(latitude);
this.location.setLongitude(longitude);
+ Log.d(Config.LOGTAG, "Location: lat: " + latitude + " long: " + longitude);
+ markAndCenterOnLocation(this.location);
+ fab = findViewById(R.id.fab);
+ fab.setOnClickListener(v -> {
+ navigate(this.location);
+ });
}
- markAndCenterOnLocation(location);
-
- fab = findViewById(R.id.fab);
- fab.setOnClickListener(v -> {
- navigate(location);
- });
}
private void markAndCenterOnLocation(final Location location) {
+ if (location == null) {
+ Log.d(Config.LOGTAG, "No location given");
+ return;
+ }
double longitude = location.getLongitude();
double latitude = location.getLatitude();
if (latitude != 0 && longitude != 0) {
@@ -182,6 +188,10 @@ public class ShowLocationActivity extends XmppActivity {
}
private void navigate (Location location) {
+ if (location == null) {
+ Log.d(Config.LOGTAG, "No location given");
+ return;
+ }
double longitude = location.getLongitude();
double latitude = location.getLatitude();
try {
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
index c35e13328..abb84a51a 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
@@ -172,9 +172,9 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte
viewHolder.lastMessageIcon.setVisibility(View.GONE);
showPreviewText = true;
}
- final Pair<String, Boolean> preview = UIHelper.getMessagePreview(activity, message);
+ final Pair<CharSequence, Boolean> preview = UIHelper.getMessagePreview(activity, message, viewHolder.lastMessage.getCurrentTextColor());
if (showPreviewText) {
- viewHolder.lastMessage.setText(EmojiWrapper.transform(preview.first));
+ viewHolder.lastMessage.setText(EmojiWrapper.transform(UIHelper.shorten(preview.first)));
} else {
viewHolder.lastMessageIcon.setContentDescription(preview.first);
}
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 2e602102e..24fd2213d 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -324,14 +324,14 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} else {
isResendable = false;
viewHolder.resend_button.setVisibility(View.VISIBLE);
+ viewHolder.resend_button.setText(R.string.send_again);
+ viewHolder.resend_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_resend_grey600_48dp, 0, 0, 0);
+ viewHolder.resend_button.setOnClickListener(v -> mConversationFragment.resendMessage(message));
}
} else {
isResendable = false;
viewHolder.resend_button.setVisibility(View.GONE);
}
- viewHolder.resend_button.setText(R.string.send_again);
- viewHolder.resend_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_resend_grey600_48dp, 0, 0, 0);
- viewHolder.resend_button.setOnClickListener(v -> mConversationFragment.resendMessage(message));
} else {
if (darkBackground) {
viewHolder.time.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Caption_OnDark);
@@ -394,7 +394,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
}
- private void displayInfoMessage(ViewHolder viewHolder, String text, boolean darkBackground) {
+ private void displayInfoMessage(ViewHolder viewHolder, CharSequence text, boolean darkBackground) {
viewHolder.download_button.setVisibility(View.GONE);
viewHolder.audioPlayer.setVisibility(View.GONE);
viewHolder.image.setVisibility(View.GONE);
diff --git a/src/main/java/de/pixart/messenger/utils/CharSequenceUtils.java b/src/main/java/de/pixart/messenger/utils/CharSequenceUtils.java
new file mode 100644
index 000000000..7a9d2f1fb
--- /dev/null
+++ b/src/main/java/de/pixart/messenger/utils/CharSequenceUtils.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2018, 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 de.pixart.messenger.utils;
+
+import android.text.Spannable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CharSequenceUtils {
+
+ private static int getStartIndex(CharSequence input) {
+ int length = input.length();
+ int index = 0;
+ while (Character.isWhitespace(input.charAt(index))) {
+ ++index;
+ if (index >= length) {
+ break;
+ }
+ }
+ return index;
+ }
+
+ private static int getEndIndex(CharSequence input) {
+ int index = input.length() - 1;
+ while (Character.isWhitespace(input.charAt(index))) {
+ --index;
+ if (index < 0) {
+ break;
+ }
+ }
+ return index;
+ }
+
+ public static CharSequence trim(CharSequence input) {
+ int begin = getStartIndex(input);
+ int end = getEndIndex(input);
+ if (begin > end) {
+ return "";
+ } else {
+ return StylingHelper.subSequence(input, begin, end + 1);
+ }
+ }
+
+ public static List<CharSequence> split(Spannable charSequence, char c) {
+ List<CharSequence> out = new ArrayList<>();
+ int begin = 0;
+ for (int i = 0; i < charSequence.length(); ++i) {
+ if (charSequence.charAt(i) == c) {
+ out.add(StylingHelper.subSequence(charSequence, begin, i));
+ begin = ++i;
+ }
+ }
+ if (begin < charSequence.length()) {
+ out.add(StylingHelper.subSequence(charSequence, begin, charSequence.length()));
+ }
+ return out;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/utils/StylingHelper.java b/src/main/java/de/pixart/messenger/utils/StylingHelper.java
index 9db7b2b47..4412d935b 100644
--- a/src/main/java/de/pixart/messenger/utils/StylingHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/StylingHelper.java
@@ -36,6 +36,7 @@ import android.support.annotation.ColorInt;
import android.support.v4.content.ContextCompat;
import android.text.Editable;
import android.text.ParcelableSpan;
+import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextWatcher;
@@ -132,6 +133,44 @@ public class StylingHelper {
}
+ static CharSequence subSequence(CharSequence charSequence, int start, int end) {
+ if (start == 0 && charSequence.length() + 1 == end) {
+ return charSequence;
+ }
+ if (charSequence instanceof Spannable) {
+ Spannable spannable = (Spannable) charSequence;
+ Spannable sub = (Spannable) spannable.subSequence(start, end);
+ for (Class<? extends ParcelableSpan> clazz : SPAN_CLASSES) {
+ ParcelableSpan[] spannables = spannable.getSpans(start, end, clazz);
+ for (ParcelableSpan parcelableSpan : spannables) {
+ int beginSpan = spannable.getSpanStart(parcelableSpan);
+ int endSpan = spannable.getSpanEnd(parcelableSpan);
+ if (beginSpan >= start && endSpan <= end) {
+ continue;
+ }
+ sub.setSpan(clone(parcelableSpan), Math.max(beginSpan - start, 0), Math.min(sub.length() - 1, endSpan), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
+ }
+ return sub;
+ } else {
+ return charSequence.subSequence(start, end);
+ }
+ }
+
+ private static ParcelableSpan clone(ParcelableSpan span) {
+ if (span instanceof ForegroundColorSpan) {
+ return new ForegroundColorSpan(((ForegroundColorSpan) span).getForegroundColor());
+ } else if (span instanceof TypefaceSpan) {
+ return new TypefaceSpan(((TypefaceSpan) span).getFamily());
+ } else if (span instanceof StyleSpan) {
+ return new StyleSpan(((StyleSpan) span).getStyle());
+ } else if (span instanceof StrikethroughSpan) {
+ return new StrikethroughSpan();
+ } else {
+ throw new AssertionError("Unknown Span");
+ }
+ }
+
public static boolean isDarkText(TextView textView) {
int argb = textView.getCurrentTextColor();
return Color.red(argb) + Color.green(argb) + Color.blue(argb) == 0;
@@ -163,7 +202,7 @@ public class StylingHelper {
private static
@ColorInt
int transformColor(@ColorInt int c) {
- return Color.argb(Math.round(Color.alpha(c) * 0.6f), Color.red(c), Color.green(c), Color.blue(c));
+ return Color.argb(Math.round(Color.alpha(c) * 0.45f), Color.red(c), Color.green(c), Color.blue(c));
}
private static int indexOfIgnoreCase(final String haystack, final String needle, final int start) {
diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java
index e167e8c84..e03f84189 100644
--- a/src/main/java/de/pixart/messenger/utils/UIHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java
@@ -1,6 +1,8 @@
package de.pixart.messenger.utils;
import android.content.Context;
+import android.support.annotation.ColorInt;
+import android.text.SpannableStringBuilder;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
import android.util.Pair;
@@ -239,7 +241,11 @@ public class UIHelper {
}
}
- public static Pair<String, Boolean> getMessagePreview(final Context context, final Message message) {
+ public static Pair<CharSequence, Boolean> getMessagePreview(final Context context, final Message message) {
+ return getMessagePreview(context, message, 0);
+ }
+
+ public static Pair<CharSequence, Boolean> getMessagePreview(final Context context, final Message message, @ColorInt int textColor) {
final Transferable d = message.getTransferable();
if (d != null) {
switch (d.getStatus()) {
@@ -289,14 +295,17 @@ public class UIHelper {
return new Pair<>(context.getString(R.string.x_file_offered_for_download,
getFileDescriptionString(context, message)), true);
} else {
- String[] lines = body.split("\n");
- StringBuilder builder = new StringBuilder();
- for(String l : lines) {
+ SpannableStringBuilder styledBody = new SpannableStringBuilder(body);
+ if (textColor != 0) {
+ StylingHelper.format(styledBody, 0, styledBody.length() - 1, textColor);
+ }
+ SpannableStringBuilder builder = new SpannableStringBuilder();
+ for (CharSequence l : CharSequenceUtils.split(styledBody, '\n')) {
if (l.length() > 0) {
char first = l.charAt(0);
if ((first != '>' || !isPositionFollowedByQuoteableCharacter(l,0)) && first != '\u00bb') {
- String line = l.trim();
- if (line.isEmpty()) {
+ CharSequence line = CharSequenceUtils.trim(l);
+ if (line.length() == 0) {
continue;
}
char last = line.charAt(line.length()-1);
@@ -313,11 +322,15 @@ public class UIHelper {
if (builder.length() == 0) {
builder.append(body.trim());
}
- return new Pair<>(builder.length() > 256 ? builder.substring(0,256) : builder.toString(), false);
+ return new Pair<>(builder, false);
}
}
}
+ public static CharSequence shorten(CharSequence input) {
+ return input.length() > 256 ? StylingHelper.subSequence(input, 0, 256) : input;
+ }
+
public static boolean isPositionFollowedByQuoteableCharacter(CharSequence body, int pos) {
return !isPositionFollowedByNumber(body, pos)
&& !isPositionFollowedByEmoticon(body, pos)