More details in notifications
This commit is contained in:
parent
fe4d500264
commit
0aff4b210f
|
@ -30,7 +30,10 @@ import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.Spanned;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
@ -71,6 +74,8 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.activities.AccountReportActivity;
|
import app.fedilab.android.activities.AccountReportActivity;
|
||||||
|
@ -750,7 +755,27 @@ public class NotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.
|
||||||
|
|
||||||
|
|
||||||
holder.notification_delete.setOnClickListener(v -> displayConfirmationNotificationDialog(notification));
|
holder.notification_delete.setOnClickListener(v -> displayConfirmationNotificationDialog(notification));
|
||||||
holder.notification_account_username.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
|
if( notification.getAccount() != null) {
|
||||||
|
SpannableString wordtoSpan = new SpannableString("@" + notification.getAccount().getAcct());
|
||||||
|
Pattern hashAcct = Pattern.compile("(@" + notification.getAccount().getAcct() + ")");
|
||||||
|
|
||||||
|
int theme_text_header_2_line = prefs.getInt("theme_text_header_2_line", -1);
|
||||||
|
if (theme_text_header_2_line == -1) {
|
||||||
|
theme_text_header_2_line = ThemeHelper.getAttColor(context, R.attr.textHeader);
|
||||||
|
}
|
||||||
|
Matcher matcherAcct = hashAcct.matcher(wordtoSpan);
|
||||||
|
while (matcherAcct.find()) {
|
||||||
|
int matchStart = matcherAcct.start(1);
|
||||||
|
int matchEnd = matcherAcct.end();
|
||||||
|
if (wordtoSpan.length() >= matchEnd && matchStart < matchEnd) {
|
||||||
|
wordtoSpan.setSpan(new ForegroundColorSpan(theme_text_header_2_line), matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
holder.notification_account_username.setText(wordtoSpan);
|
||||||
|
}
|
||||||
|
|
||||||
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
final View attached = holder.status_more;
|
final View attached = holder.status_more;
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/notification_account_username"
|
android:id="@+id/notification_account_username"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
Loading…
Reference in New Issue