Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98aafbea authored by Andreas Miko's avatar Andreas Miko
Browse files

Add summaryText to bundle header guts

Test: Updated screenshot test
Bug: 409748420
Flag: com.android.systemui.notification_bundle_ui
Change-Id: I47b8b9093e8a2e6146616e5eda1e1e998b0d13cb
parent 460b5fee
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ private fun ContentScope.BundleHeaderContent(
                    .element(NotificationRowPrimitives.Elements.NotificationIconBackground),
        )
        Text(
            text = stringResource(viewModel.titleTextResId),
            text = stringResource(viewModel.titleText),
            style = MaterialTheme.typography.titleMediumEmphasized,
            color = MaterialTheme.colorScheme.primary,
            overflow = TextOverflow.Ellipsis,
+4 −8
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ private fun View.initOnBackPressureDispatcherOwner(lifecycle: Lifecycle) {
fun BundleHeaderGuts(viewModel: BundleHeaderGutsViewModel, modifier: Modifier = Modifier) {
    Column(modifier.padding(horizontal = 16.dp)) {
        TopRow(viewModel)
        ContentRow()
        ContentRow(viewModel)
        BottomRow(viewModel)
    }
}
@@ -100,7 +100,7 @@ private fun TopRow(viewModel: BundleHeaderGutsViewModel, modifier: Modifier = Mo
    ) {
        BundleIcon(viewModel.bundleIcon, modifier = Modifier.padding(end = 16.dp))
        Text(
            text = stringResource(viewModel.titleTextResId),
            text = stringResource(viewModel.titleText),
            style = MaterialTheme.typography.titleMediumEmphasized,
            color = MaterialTheme.colorScheme.primary,
            overflow = TextOverflow.Ellipsis,
@@ -126,7 +126,7 @@ private fun TopRow(viewModel: BundleHeaderGutsViewModel, modifier: Modifier = Mo
}

@Composable
private fun ContentRow(modifier: Modifier = Modifier) {
private fun ContentRow(viewModel: BundleHeaderGutsViewModel, modifier: Modifier = Modifier) {
    Row(
        verticalAlignment = Alignment.CenterVertically,
        modifier =
@@ -149,11 +149,7 @@ private fun ContentRow(modifier: Modifier = Modifier) {
                maxLines = 1,
            )
            Text(
                // TODO(b/409748420): Implement string based on bundle type
                text =
                    stringResource(
                        com.android.systemui.res.R.string.notification_guts_social_summary
                    ),
                text = stringResource(viewModel.summaryText),
                style = MaterialTheme.typography.bodyMedium,
                color = MaterialTheme.colorScheme.onSecondaryContainer,
                overflow = TextOverflow.Ellipsis,
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) {
    override val bucket: Int = spec.bucket

    /** The model used by UI. */
    val bundleRepository = BundleRepository(spec.titleTextResId, spec.icon)
    val bundleRepository = BundleRepository(spec.titleText, spec.icon, spec.summaryText)

    // TODO(b/394483200): move NotificationEntry's implementation to PipelineEntry?
    val isSensitive: MutableStateFlow<Boolean> = MutableStateFlow(false)
+11 −5
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@ import com.android.systemui.statusbar.notification.stack.PriorityBucket

data class BundleSpec(
    val key: String,
    @StringRes val titleTextResId: Int,
    @StringRes val titleText: Int,
    @StringRes val summaryText: Int,
    @DrawableRes val icon: Int,
    @PriorityBucket val bucket: Int,
) {
@@ -36,28 +37,33 @@ data class BundleSpec(
        val PROMOTIONS =
            BundleSpec(
                key = NotificationChannel.PROMOTIONS_ID,
                titleTextResId = R.string.promotional_notification_channel_label,
                titleText = R.string.promotional_notification_channel_label,
                summaryText =
                    com.android.systemui.res.R.string.notification_guts_promotions_summary,
                icon = com.android.settingslib.R.drawable.ic_promotions,
                bucket = BUCKET_PROMO,
            )
        val SOCIAL_MEDIA =
            BundleSpec(
                key = NotificationChannel.SOCIAL_MEDIA_ID,
                titleTextResId = R.string.social_notification_channel_label,
                titleText = R.string.social_notification_channel_label,
                summaryText = com.android.systemui.res.R.string.notification_guts_social_summary,
                icon = com.android.settingslib.R.drawable.ic_social,
                bucket = BUCKET_SOCIAL,
            )
        val NEWS =
            BundleSpec(
                key = NotificationChannel.NEWS_ID,
                titleTextResId = R.string.news_notification_channel_label,
                titleText = R.string.news_notification_channel_label,
                summaryText = com.android.systemui.res.R.string.notification_guts_news_summary,
                icon = com.android.settingslib.R.drawable.ic_news,
                bucket = BUCKET_NEWS,
            )
        val RECOMMENDED =
            BundleSpec(
                key = NotificationChannel.RECS_ID,
                titleTextResId = R.string.recs_notification_channel_label,
                titleText = R.string.recs_notification_channel_label,
                summaryText = com.android.systemui.res.R.string.notification_guts_recs_summary,
                icon = com.android.settingslib.R.drawable.ic_recs,
                bucket = BUCKET_RECS,
            )
+2 −1
Original line number Diff line number Diff line
@@ -44,8 +44,9 @@ class BundleHeaderGutsContent(context: Context) : GutsContent {
        val repository = (row.entryAdapter as BundleEntryAdapter).entry.bundleRepository
        val viewModel =
            BundleHeaderGutsViewModel(
                titleTextResId = repository.titleTextResId,
                titleText = repository.titleText,
                bundleIcon = repository.bundleIcon,
                summaryText = repository.summaryText,
                onSettingsClicked = onSettingsClicked,
                onDoneClicked = onDoneClicked,
                onDismissClicked = onDismissClicked,
Loading