mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 14:21:16 +00:00
Use expandable notification for new device/folder (fixes #614).
This commit is contained in:
parent
788af35c00
commit
d29b675a1e
1 changed files with 6 additions and 3 deletions
|
@ -182,18 +182,21 @@ public class EventProcessor implements SyncthingService.OnWebGuiAvailableListene
|
|||
}
|
||||
}
|
||||
|
||||
private void notify(String title, PendingIntent pi) {
|
||||
private void notify(String text, PendingIntent pi) {
|
||||
NotificationManager nm = (NotificationManager)
|
||||
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
Notification n = new NotificationCompat.Builder(mContext)
|
||||
.setContentTitle(title)
|
||||
.setContentTitle(mContext.getString(R.string.app_name))
|
||||
.setContentText(text)
|
||||
.setStyle(new NotificationCompat.BigTextStyle()
|
||||
.bigText(text))
|
||||
.setContentIntent(pi)
|
||||
.setSmallIcon(R.drawable.ic_stat_notify)
|
||||
.setAutoCancel(true)
|
||||
.build();
|
||||
// HACK: Use a random, deterministic ID between 1000 and 2000 to avoid duplicate
|
||||
// notifications.
|
||||
int notificationId = 1000 + title.hashCode() % 1000;
|
||||
int notificationId = 1000 + text.hashCode() % 1000;
|
||||
nm.notify(notificationId, n);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue