mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 03:32:15 -05:00
Merge pull request #2468 from morgenroth/feature/Android-auto-support
Fix: Add messages to Notifications for Android Auto on Android M and older
This commit is contained in:
commit
7ba81177c6
@ -20,6 +20,7 @@ import android.text.SpannableString;
|
|||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.Pair;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -433,8 +434,6 @@ public class NotificationService {
|
|||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
String sender = message.getStatus() == Message.STATUS_RECEIVED ? UIHelper.getMessageDisplayName(message) : null;
|
String sender = message.getStatus() == Message.STATUS_RECEIVED ? UIHelper.getMessageDisplayName(message) : null;
|
||||||
messagingStyle.addMessage(UIHelper.getMessagePreview(mXmppConnectionService,message).first, message.getTimeSent(), sender);
|
messagingStyle.addMessage(UIHelper.getMessagePreview(mXmppConnectionService,message).first, message.getTimeSent(), sender);
|
||||||
uBuilder.addMessage(UIHelper.getMessagePreview(mXmppConnectionService,message).first);
|
|
||||||
uBuilder.setLatestTimestamp(message.getTimeSent());
|
|
||||||
}
|
}
|
||||||
builder.setStyle(messagingStyle);
|
builder.setStyle(messagingStyle);
|
||||||
} else {
|
} else {
|
||||||
@ -462,6 +461,15 @@ public class NotificationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** message preview for Android Auto **/
|
||||||
|
for (Message message : messages) {
|
||||||
|
Pair<String,Boolean> preview = UIHelper.getMessagePreview(mXmppConnectionService, message);
|
||||||
|
// only show user written text
|
||||||
|
if (preview.second == false) {
|
||||||
|
uBuilder.addMessage(preview.first);
|
||||||
|
uBuilder.setLatestTimestamp(message.getTimeSent());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Message getImage(final Iterable<Message> messages) {
|
private Message getImage(final Iterable<Message> messages) {
|
||||||
|
Loading…
Reference in New Issue
Block a user