|
1 | 1 | package fr.free.nrw.commons.notification;
|
2 | 2 |
|
3 |
| -import android.graphics.Color; |
4 |
| -import android.preference.PreferenceManager; |
5 | 3 | import android.text.Html;
|
6 |
| -import android.text.SpannableString; |
7 |
| -import android.text.Spanned; |
8 |
| -import android.text.TextPaint; |
9 |
| -import android.text.style.ClickableSpan; |
10 | 4 | import android.view.LayoutInflater;
|
11 | 5 | import android.view.View;
|
12 | 6 | import android.view.ViewGroup;
|
13 | 7 | import android.widget.ImageView;
|
14 | 8 | import android.widget.TextView;
|
15 | 9 |
|
16 |
| -import com.borjabravo.readmoretextview.ReadMoreTextView; |
17 | 10 | import com.pedrogomez.renderers.Renderer;
|
18 | 11 |
|
19 | 12 | import butterknife.BindView;
|
|
25 | 18 | */
|
26 | 19 |
|
27 | 20 | public class NotificationRenderer extends Renderer<Notification> {
|
28 |
| - @BindView(R.id.title) ReadMoreTextView title; |
| 21 | + @BindView(R.id.title) TextView title; |
29 | 22 | @BindView(R.id.time) TextView time;
|
30 | 23 | @BindView(R.id.icon) ImageView icon;
|
31 | 24 | private NotificationClicked listener;
|
@@ -65,32 +58,12 @@ public void render() {
|
65 | 58 | private void setTitle(String notificationText) {
|
66 | 59 | notificationText = notificationText.trim().replaceAll("(^\\s*)|(\\s*$)", "");
|
67 | 60 | notificationText = Html.fromHtml(notificationText).toString();
|
| 61 | + if(notificationText.length()>280){ |
| 62 | + notificationText = notificationText.substring(0,279); |
| 63 | + notificationText = notificationText.concat("..."); |
| 64 | + } |
68 | 65 | notificationText = notificationText.concat(" ");
|
69 |
| - |
70 |
| - SpannableString ss = new SpannableString(notificationText); |
71 |
| - ClickableSpan clickableSpan = new ClickableSpan() { |
72 |
| - @Override |
73 |
| - public void onClick(View view) { |
74 |
| - listener.notificationClicked(getContent()); |
75 |
| - } |
76 |
| - |
77 |
| - @Override |
78 |
| - public void updateDrawState(TextPaint ds) { |
79 |
| - super.updateDrawState(ds); |
80 |
| - ds.setUnderlineText(false); |
81 |
| - |
82 |
| - if(PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("theme", false)) { |
83 |
| - ds.setColor(Color.WHITE); |
84 |
| - } |
85 |
| - else { |
86 |
| - ds.setColor(Color.BLACK); |
87 |
| - } |
88 |
| - } |
89 |
| - }; |
90 |
| - |
91 |
| - // Attach a ClickableSpan to the range (start:0, end:notificationText.length()) of the String |
92 |
| - ss.setSpan(clickableSpan, 0, notificationText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); |
93 |
| - title.setText(ss, TextView.BufferType.SPANNABLE); |
| 66 | + title.setText(notificationText); |
94 | 67 | }
|
95 | 68 |
|
96 | 69 | public interface NotificationClicked{
|
|
0 commit comments