From a3e89719b10635dee227c979cb9b18a30305c825 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 4 Apr 2020 22:11:23 +0200 Subject: [PATCH] use the BigTextStyle notification style at received SMS --- .../simplemobiletools/smsmessenger/receivers/SmsReceiver.kt | 5 +++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsReceiver.kt index 1f76e22d..c3651aa0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsReceiver.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/receivers/SmsReceiver.kt @@ -8,6 +8,7 @@ import android.app.PendingIntent import android.content.BroadcastReceiver import android.content.Context import android.content.Intent +import android.graphics.BitmapFactory import android.media.AudioAttributes import android.media.AudioManager import android.media.RingtoneManager @@ -64,6 +65,7 @@ class SmsReceiver : BroadcastReceiver() { setBypassDnd(false) enableLights(true) setSound(soundUri, audioAttributes) + enableVibration(true) notificationManager.createNotificationChannel(this) } } @@ -75,11 +77,14 @@ class SmsReceiver : BroadcastReceiver() { } val pendingIntent = PendingIntent.getActivity(context, threadID, intent, PendingIntent.FLAG_UPDATE_CURRENT) + val summaryText = context.getString(R.string.new_message) val builder = NotificationCompat.Builder(context, channelId) .setContentTitle(address) .setContentText(body) .setSmallIcon(R.drawable.ic_launcher_foreground) + .setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.ic_launcher_foreground)) + .setStyle(NotificationCompat.BigTextStyle().setSummaryText(summaryText).bigText(body)) .setContentIntent(pendingIntent) .setPriority(NotificationCompat.PRIORITY_MAX) .setDefaults(Notification.DEFAULT_LIGHTS) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index feb3f5ef..a1e9db18 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,4 +6,5 @@ Received SMS + New message