Skip to content

Commit

Permalink
add tag highlight on type notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Razeeman committed Jan 25, 2025
1 parent 4ccc935 commit c571c25
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ object Base {
const val namespace = "com.example.util.simpletimetracker"

// Raise by 2 to account for wear version code.
const val versionCode = 87
const val versionCode = 89
const val versionName = "1.47"
const val minSDK = 21
const val currentSDK = 34
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.util.simpletimetracker.feature_notification.activitySwitch.interactor

import androidx.core.text.buildSpannedString
import com.example.util.simpletimetracker.core.interactor.FilterGoalsByDayOfWeekInteractor
import com.example.util.simpletimetracker.core.interactor.GetCurrentRecordsDurationInteractor
import com.example.util.simpletimetracker.core.mapper.ColorMapper
Expand Down Expand Up @@ -132,7 +133,7 @@ class NotificationActivitySwitchInteractorImpl @Inject constructor(
val hint: String
val icon: RecordTypeIcon?
val color: Int?
val title: String
val title: CharSequence
val subtitle: String
val untrackedTimeStarted: Long?
val prevRecordDuration: Long?
Expand All @@ -146,7 +147,11 @@ class NotificationActivitySwitchInteractorImpl @Inject constructor(
recordType = prevRecordType,
recordTags = recordTags.filter { it.id in prevRecord.tagIds },
)
title = "$namePrefix - $fullName"
title = buildSpannedString {
append(namePrefix)
append(" - ")
append(fullName)
}
subtitle = timeMapper.formatTime(
time = prevRecord.timeEnded,
useMilitaryTime = prefsInteractor.getUseMilitaryTimeFormat(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.example.util.simpletimetracker.feature_views.viewData.RecordTypeIcon
data class NotificationActivitySwitchParams(
val icon: RecordTypeIcon,
val color: Int,
val title: String,
val title: CharSequence,
val subtitle: String,
val untrackedStartedTimeStamp: Long?,
val prevRecordDuration: Long?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.example.util.simpletimetracker.feature_notification.core

import androidx.core.text.bold
import androidx.core.text.buildSpannedString
import com.example.util.simpletimetracker.domain.extension.getFullName
import com.example.util.simpletimetracker.domain.recordTag.model.RecordTag
import com.example.util.simpletimetracker.domain.recordType.model.RecordType
Expand All @@ -10,13 +12,15 @@ class NotificationCommonMapper @Inject constructor() {
fun getNotificationText(
recordType: RecordType,
recordTags: List<RecordTag>,
): String {
): CharSequence {
val tag = recordTags.getFullName()

return if (tag.isEmpty()) {
recordType.name
} else {
"${recordType.name} - $tag"
return buildSpannedString {
bold { append(recordType.name) }
if (tag.isNotEmpty()) {
append(" - ")
append(tag)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data class NotificationTypeParams(
val id: Long,
val icon: RecordTypeIcon,
val color: Int,
val text: String,
val text: CharSequence,
val timeStarted: String,
val startedTimeStamp: Long,
val totalDuration: Long?,
Expand Down

0 comments on commit c571c25

Please sign in to comment.