long mentions

This commit is contained in:
tom79 2019-08-31 15:14:20 +02:00
parent 243f9c31ee
commit a12e090ce9
2 changed files with 21 additions and 5 deletions

View File

@ -229,6 +229,7 @@ import static app.fedilab.android.activities.BaseMainActivity.mutedAccount;
import static app.fedilab.android.activities.BaseMainActivity.regex_home;
import static app.fedilab.android.activities.BaseMainActivity.regex_local;
import static app.fedilab.android.activities.BaseMainActivity.regex_public;
import static app.fedilab.android.helper.Helper.NotifType.MENTION;
import static app.fedilab.android.sqlite.StatusCacheDAO.ARCHIVE_CACHE;
import static app.fedilab.android.sqlite.StatusCacheDAO.BOOKMARK_CACHE;
import static com.koushikdutta.async.util.StreamUtility.copyStream;
@ -1131,8 +1132,11 @@ public class Helper {
.setSmallIcon(R.drawable.fedilab_notification_icon)
.setTicker(message)
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setGroup(account.getAcct()+"@"+account.getInstance())
.setAutoCancel(true);
if (notifType == MENTION) {
notificationBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message));
}
notificationBuilder.setGroup(account.getAcct()+"@"+account.getInstance())
.setContentIntent(pIntent)
.setContentText(message);
int ledColour = Color.BLUE;

View File

@ -34,6 +34,8 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.text.Html;
import android.text.SpannableString;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -76,6 +78,8 @@ import app.fedilab.android.sqlite.Sqlite;
import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import static androidx.core.text.HtmlCompat.FROM_HTML_MODE_LEGACY;
/**
* Created by Thomas on 29/11/2017.
@ -315,10 +319,18 @@ public class LiveNotificationService extends Service implements NetworkStateRece
else
message = String.format("@%s %s", notification.getAccount().getAcct(), getString(R.string.notif_mention));
if( notification.getStatus() != null) {
if( notification.getStatus().getSpoiler_text() != null) {
message += "\n" + notification.getStatus().getSpoiler_text();
if( notification.getStatus().getSpoiler_text() != null && notification.getStatus().getSpoiler_text().length() > 0 ) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getSpoiler_text(), FROM_HTML_MODE_LEGACY));
else
//noinspection deprecation
message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getSpoiler_text()));
}else{
message += "\n" + notification.getStatus().getContent();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getContent(), FROM_HTML_MODE_LEGACY));
else
//noinspection deprecation
message = "\n" + new SpannableString(Html.fromHtml(notification.getStatus().getContent()));
}
}
} else {