Skip to content

Commit 0682e2d

Browse files
committed
add title and text to notifications to be shown in grouped view
1 parent 3ea407d commit 0682e2d

5 files changed

Lines changed: 13 additions & 0 deletions

File tree

features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/activity/manager/NotificationActivityManager.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class NotificationActivityManager @Inject constructor(
6666
)
6767

6868
return NotificationCompat.Builder(context, NOTIFICATIONS_CHANNEL_ID)
69+
.setContentTitle(params.title)
70+
.setContentText(params.subtitle)
6971
.setSmallIcon(R.drawable.ic_notification)
7072
.setContentIntent(contentIntent)
7173
.setCustomContentView(notificationLayout)

features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/goalTime/manager/NotificationGoalTimeManager.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class NotificationGoalTimeManager @Inject constructor(
8787
)
8888

8989
return NotificationCompat.Builder(context, NOTIFICATIONS_CHANNEL_ID)
90+
.setContentTitle(params.text)
91+
.setContentText(params.description)
9092
.setSmallIcon(R.drawable.ic_notification)
9193
.setContentIntent(contentIntent)
9294
.setCustomContentView(notificationLayout)

features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/inactivity/manager/NotificationInactivityManager.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class NotificationInactivityManager @Inject constructor(
6666
)
6767

6868
return NotificationCompat.Builder(context, NOTIFICATIONS_CHANNEL_ID)
69+
.setContentTitle(params.title)
70+
.setContentText(params.subtitle)
6971
.setSmallIcon(R.drawable.ic_notification)
7072
.setContentIntent(contentIntent)
7173
.setCustomContentView(notificationLayout)

features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/pomodoro/manager/NotificationPomodoroManager.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class NotificationPomodoroManager @Inject constructor(
6666
)
6767

6868
return NotificationCompat.Builder(context, NOTIFICATIONS_CHANNEL_ID)
69+
.setContentTitle(params.title)
70+
.setContentText(params.subtitle)
6971
.setSmallIcon(R.drawable.ic_notification)
7072
.setContentIntent(contentIntent)
7173
.setCustomContentView(notificationLayout)

features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/recordType/manager/NotificationTypeManager.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ class NotificationTypeManager @Inject constructor(
7373
recordTypeId = params.id,
7474
)
7575

76+
// TODO add manual notification grouping by adding setGroup() to all,
77+
// and showing separate notification with setGroupSummary(),
78+
// also can add setSortKey() which is breaking auto group now.
7679
val builder = NotificationCompat.Builder(context, NOTIFICATIONS_CHANNEL_ID)
80+
.setContentTitle(params.text)
81+
.setContentText(params.timeStarted)
7782
.setSmallIcon(R.drawable.ic_notification)
7883
.setContentIntent(contentIntent)
7984
.setOngoing(true)

0 commit comments

Comments
 (0)