2121import android .util .ArrayMap ;
2222import android .util .Log ;
2323import android .util .LongSparseArray ;
24+ import android .util .Pair ;
2425
2526import com .oasisfeng .nevo .decorators .wechat .ConversationManager .Conversation ;
2627import com .oasisfeng .nevo .sdk .MutableNotification ;
@@ -88,8 +89,7 @@ class MessagingBuilder {
8889 return null ;
8990 }
9091
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 );
9393 int count = 0 , num_lines_with_colon = 0 ;
9494 final String redundant_prefix = title .toString () + SENDER_MESSAGE_SEPARATOR ;
9595 for (final StatusBarNotification each : archive ) {
@@ -112,11 +112,11 @@ class MessagingBuilder {
112112 if (trimmed_text .toString ().startsWith (redundant_prefix )) // Remove redundant prefix
113113 trimmed_text = trimmed_text .subSequence (redundant_prefix .length (), trimmed_text .length ());
114114 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 ) );
116116 } else {
117117 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 ++;
120120 }
121121 }
122122 n .number = count ;
@@ -127,8 +127,10 @@ class MessagingBuilder {
127127
128128 final MessagingStyle messaging = new MessagingStyle (mUserSelf );
129129 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+ }
132134 return messaging ;
133135 }
134136
0 commit comments