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

Commit ac09efc0 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge "[Chipbar] Update ChipbarCoordinator to have a generic API to display...

Merge "[Chipbar] Update ChipbarCoordinator to have a generic API to display chipbars." into tm-qpr-dev
parents 7cfc0476 4fb68a96
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -832,7 +832,6 @@
-packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/WalletControllerImplTest.kt
-packages/SystemUI/tests/src/com/android/systemui/statusbar/window/StatusBarWindowStateControllerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/temporarydisplay/TemporaryViewDisplayControllerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/temporarydisplay/chipbar/ChipbarCoordinatorTest.kt
-packages/SystemUI/tests/src/com/android/systemui/unfold/FoldStateLoggingProviderTest.kt
-packages/SystemUI/tests/src/com/android/systemui/unfold/UnfoldLatencyTrackerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/unfold/UnfoldTransitionWallpaperControllerTest.kt
+6 −6
Original line number Diff line number Diff line
@@ -19,12 +19,12 @@
<com.android.systemui.temporarydisplay.chipbar.ChipbarRootView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:id="@+id/media_ttt_sender_chip"
    android:id="@+id/chipbar_root_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/media_ttt_sender_chip_inner"
        android:id="@+id/chipbar_inner"
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
@@ -39,7 +39,7 @@
        >

        <com.android.internal.widget.CachingIconView
            android:id="@+id/app_icon"
            android:id="@+id/start_icon"
            android:layout_width="@dimen/media_ttt_app_icon_size"
            android:layout_height="@dimen/media_ttt_app_icon_size"
            android:layout_marginEnd="12dp"
@@ -69,7 +69,7 @@
            />

        <ImageView
            android:id="@+id/failure_icon"
            android:id="@+id/error"
            android:layout_width="@dimen/media_ttt_status_icon_size"
            android:layout_height="@dimen/media_ttt_status_icon_size"
            android:layout_marginStart="@dimen/media_ttt_last_item_start_margin"
@@ -78,11 +78,11 @@
            android:alpha="0.0"
            />

        <!-- TODO(b/245610654): Re-name all the media-specific dimens to chipbar dimens instead. -->
        <TextView
            android:id="@+id/undo"
            android:id="@+id/end_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/media_transfer_undo"
            android:textColor="?androidprv:attr/textColorOnAccent"
            android:layout_marginStart="@dimen/media_ttt_last_item_start_margin"
            android:textSize="@dimen/media_ttt_text_size"
+17 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.common.shared.model

import android.annotation.StringRes
import android.content.Context

/**
 * Models a content description, that can either be already [loaded][ContentDescription.Loaded] or
@@ -30,4 +31,20 @@ sealed class ContentDescription {
    data class Resource(
        @StringRes val res: Int,
    ) : ContentDescription()

    companion object {
        /**
         * Returns the loaded content description string, or null if we don't have one.
         *
         * Prefer [com.android.systemui.common.ui.binder.ContentDescriptionViewBinder.bind] over
         * this method. This should only be used for testing or concatenation purposes.
         */
        fun ContentDescription?.loadContentDescription(context: Context): String? {
            return when (this) {
                null -> null
                is Loaded -> this.description
                is Resource -> context.getString(this.res)
            }
        }
    }
}
+17 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
package com.android.systemui.common.shared.model

import android.annotation.StringRes
import android.content.Context

/**
 * Models a text, that can either be already [loaded][Text.Loaded] or be a [reference]
@@ -31,4 +32,20 @@ sealed class Text {
    data class Resource(
        @StringRes val res: Int,
    ) : Text()

    companion object {
        /**
         * Returns the loaded test string, or null if we don't have one.
         *
         * Prefer [com.android.systemui.common.ui.binder.TextViewBinder.bind] over this method. This
         * should only be used for testing or concatenation purposes.
         */
        fun Text?.loadText(context: Context): String? {
            return when (this) {
                null -> null
                is Loaded -> this.text
                is Resource -> context.getString(this.res)
            }
        }
    }
}
+19 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import com.android.settingslib.Utils
import com.android.systemui.R
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon

/** Utility methods for media tap-to-transfer. */
class MediaTttUtils {
@@ -30,6 +32,23 @@ class MediaTttUtils {
        const val WINDOW_TITLE = "Media Transfer Chip View"
        const val WAKE_REASON = "MEDIA_TRANSFER_ACTIVATED"

        /**
         * Returns the information needed to display the icon in [Icon] form.
         *
         * See [getIconInfoFromPackageName].
         */
        fun getIconFromPackageName(
            context: Context,
            appPackageName: String?,
            logger: MediaTttLogger,
        ): Icon {
            val iconInfo = getIconInfoFromPackageName(context, appPackageName, logger)
            return Icon.Loaded(
                iconInfo.drawable,
                ContentDescription.Loaded(iconInfo.contentDescription)
            )
        }

        /**
         * Returns the information needed to display the icon.
         *
Loading