From c69b4028d27ba04b62393769a78297d068d6d657 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Wed, 13 Mar 2019 09:28:57 -0400 Subject: [PATCH] Visual changes in OngoingPrivacyChip * Changed padding and sizes * Removed text Test: manual Fixes: 128354898 Change-Id: Iadd14f43caed562f9490d20ea96b496dc6e98df3 --- .../res/layout/ongoing_privacy_chip.xml | 23 ++--------- packages/SystemUI/res/values/dimens.xml | 9 +---- packages/SystemUI/res/values/strings.xml | 14 ------- .../systemui/privacy/OngoingPrivacyChip.kt | 40 +++---------------- .../systemui/privacy/PrivacyDialogBuilder.kt | 9 +---- 5 files changed, 12 insertions(+), 83 deletions(-) diff --git a/packages/SystemUI/res/layout/ongoing_privacy_chip.xml b/packages/SystemUI/res/layout/ongoing_privacy_chip.xml index f64a64e619a00..b16e06207ca36 100644 --- a/packages/SystemUI/res/layout/ongoing_privacy_chip.xml +++ b/packages/SystemUI/res/layout/ongoing_privacy_chip.xml @@ -28,7 +28,7 @@ android:orientation="horizontal" android:focusable="true"> - - - - + \ No newline at end of file diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index c83cb59fa7927..8da972b114cbf 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -999,10 +999,8 @@ 0dp 32dp - - 8dp - 0dp + 8dp 8dp @@ -1013,10 +1011,7 @@ @*android:dimen/status_bar_icon_size 16dp - - 12sp - - 8dp + 8dp diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 16222f7ebd8d1..fea8c5be83fc9 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -2318,26 +2318,12 @@ app for debugging. Will not be seen by users. [CHAR LIMIT=20] --> Dump SysUI Heap - - - %d app - %d apps - %d apps - - %1$s is using your %2$s. Applications are using your %s. - - - %1$d application is using your %2$s. - %1$d applications are using your %2$s. - %1$d applications are using your %2$s. - - Got it diff --git a/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt b/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt index 15dc43f041f49..23742c0953bb5 100644 --- a/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt +++ b/packages/SystemUI/src/com/android/systemui/privacy/OngoingPrivacyChip.kt @@ -17,9 +17,9 @@ package com.android.systemui.privacy import android.content.Context import android.util.AttributeSet import android.view.ViewGroup +import android.widget.FrameLayout import android.widget.ImageView import android.widget.LinearLayout -import android.widget.TextView import com.android.systemui.Dependency import com.android.systemui.R import com.android.systemui.statusbar.policy.KeyguardMonitor @@ -42,9 +42,8 @@ class OngoingPrivacyChip @JvmOverloads constructor( private val sidePadding = context.resources.getDimensionPixelSize(R.dimen.ongoing_appops_chip_side_padding) private val backgroundDrawable = context.getDrawable(R.drawable.privacy_chip_bg) - private lateinit var text: TextView private lateinit var iconsContainer: LinearLayout - private lateinit var back: LinearLayout + private lateinit var back: FrameLayout var expanded = false set(value) { if (value != field) { @@ -66,14 +65,14 @@ class OngoingPrivacyChip @JvmOverloads constructor( super.onFinishInflate() back = findViewById(R.id.background) - text = findViewById(R.id.text_container) iconsContainer = findViewById(R.id.icons_container) } // Should only be called if the builder icons or app changed private fun updateView() { back.background = if (expanded) backgroundDrawable else null - back.setPaddingRelative(0, 0, if (expanded) sidePadding else 0, 0) + val padding = if (expanded) sidePadding else 0 + back.setPaddingRelative(padding, 0, padding, 0) fun setIcons(dialogBuilder: PrivacyDialogBuilder, iconsContainer: ViewGroup) { iconsContainer.removeAllViews() dialogBuilder.generateIcons().forEachIndexed { i, it -> @@ -95,44 +94,17 @@ class OngoingPrivacyChip @JvmOverloads constructor( if (!privacyList.isEmpty()) { generateContentDescription() setIcons(builder, iconsContainer) - setApplicationText() } else { - text.visibility = GONE iconsContainer.removeAllViews() } requestLayout() } - private fun setApplicationText() { - text.visibility = if (builder.types.size == 1 && expanded) VISIBLE else GONE - if (builder.types.size == 1 && expanded) { - if (builder.app != null && !amISecure()) { - text.setText(builder.app?.applicationName) - } else { - text.text = context.resources.getQuantityString( - R.plurals.ongoing_privacy_chip_multiple_apps, - builder.appsAndTypes.size, builder.appsAndTypes.size) - } - } - } - private fun amISecure() = keyguardMonitor.isShowing && keyguardMonitor.isSecure private fun generateContentDescription() { val typesText = builder.joinTypes() - if (builder.types.size > 1) { - contentDescription = context.getString( - R.string.ongoing_privacy_chip_content_multiple_apps, typesText) - } else { - if (builder.app != null && !amISecure()) { - contentDescription = - context.getString(R.string.ongoing_privacy_chip_content_single_app, - builder.app?.applicationName, typesText) - } else { - contentDescription = context.resources.getQuantityString( - R.plurals.ongoing_privacy_chip_content_multiple_apps_single_op, - builder.appsAndTypes.size, builder.appsAndTypes.size, typesText) - } - } + contentDescription = context.getString( + R.string.ongoing_privacy_chip_content_multiple_apps, typesText) } } \ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogBuilder.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogBuilder.kt index bbea6b277e909..59b3c3464a69d 100644 --- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogBuilder.kt +++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyDialogBuilder.kt @@ -22,7 +22,6 @@ class PrivacyDialogBuilder(private val context: Context, itemsList: List>> val types: List - val app: PrivacyApplication? private val separator = context.getString(R.string.ongoing_privacy_dialog_separator) private val lastSeparator = context.getString(R.string.ongoing_privacy_dialog_last_separator) @@ -32,8 +31,6 @@ class PrivacyDialogBuilder(private val context: Context, itemsList: List): List { @@ -58,11 +55,7 @@ class PrivacyDialogBuilder(private val context: Context, itemsList: List