21
21
import android .util .ArrayMap ;
22
22
import android .util .Log ;
23
23
import android .util .LongSparseArray ;
24
+ import android .util .Pair ;
24
25
25
26
import com .oasisfeng .nevo .decorators .wechat .ConversationManager .Conversation ;
26
27
import com .oasisfeng .nevo .sdk .MutableNotification ;
@@ -88,8 +89,7 @@ class MessagingBuilder {
88
89
return null ;
89
90
}
90
91
91
- final LongSparseArray <CharSequence > lines = new LongSparseArray <>(MAX_NUM_HISTORICAL_LINES );
92
- CharSequence text ;
92
+ final LongSparseArray <Pair <CharSequence /* text */ , CharSequence /* ticker */ >> lines = new LongSparseArray <>(MAX_NUM_HISTORICAL_LINES );
93
93
int count = 0 , num_lines_with_colon = 0 ;
94
94
final String redundant_prefix = title .toString () + SENDER_MESSAGE_SEPARATOR ;
95
95
for (final StatusBarNotification each : archive ) {
@@ -112,11 +112,11 @@ class MessagingBuilder {
112
112
if (trimmed_text .toString ().startsWith (redundant_prefix )) // Remove redundant prefix
113
113
trimmed_text = trimmed_text .subSequence (redundant_prefix .length (), trimmed_text .length ());
114
114
else if (trimmed_text .toString ().indexOf (SENDER_MESSAGE_SEPARATOR ) > 0 ) num_lines_with_colon ++;
115
- lines .put (notification .when , trimmed_text );
115
+ lines .put (notification .when , new Pair <>( trimmed_text , notification . tickerText ) );
116
116
} else {
117
117
count = 1 ;
118
- lines .put (notification .when , text = its_text );
119
- if (text .toString ().indexOf (SENDER_MESSAGE_SEPARATOR ) > 0 ) num_lines_with_colon ++;
118
+ lines .put (notification .when , new Pair <>( its_text , n . tickerText ) );
119
+ if (its_text .toString ().indexOf (SENDER_MESSAGE_SEPARATOR ) > 0 ) num_lines_with_colon ++;
120
120
}
121
121
}
122
122
n .number = count ;
@@ -127,8 +127,10 @@ class MessagingBuilder {
127
127
128
128
final MessagingStyle messaging = new MessagingStyle (mUserSelf );
129
129
final boolean sender_inline = num_lines_with_colon == lines .size ();
130
- for (int i = 0 , size = lines .size (); i < size ; i ++) // All lines have colon in text
131
- messaging .addMessage (buildMessage (conversation , lines .keyAt (i ), n .tickerText , lines .valueAt (i ), sender_inline ? null : title .toString ()));
130
+ for (int i = 0 , size = lines .size (); i < size ; i ++) { // All lines have colon in text
131
+ final Pair <CharSequence , CharSequence > line = lines .valueAt (i );
132
+ messaging .addMessage (buildMessage (conversation , lines .keyAt (i ), line .second , line .first , sender_inline ? null : title .toString ()));
133
+ }
132
134
return messaging ;
133
135
}
134
136
0 commit comments