Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipControllerCommon.kt +5 −2 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ abstract class MediaTttChipControllerCommon<T : ChipInfoCommon>( internal val logger: MediaTttLogger, internal val windowManager: WindowManager, private val viewUtil: ViewUtil, @Main private val mainExecutor: DelayableExecutor, @Main internal val mainExecutor: DelayableExecutor, private val accessibilityManager: AccessibilityManager, private val configurationController: ConfigurationController, private val powerManager: PowerManager, Loading Loading @@ -205,13 +205,15 @@ abstract class MediaTttChipControllerCommon<T : ChipInfoCommon>( * * @param appPackageName the package name of the app playing the media. Will be used to fetch * the app icon and app name if overrides aren't provided. * * @return the content description of the icon. */ internal fun setIcon( currentChipView: ViewGroup, appPackageName: String?, appIconDrawableOverride: Drawable? = null, appNameOverride: CharSequence? = null, ) { ): CharSequence { val appIconView = currentChipView.requireViewById<CachingIconView>(R.id.app_icon) val iconInfo = getIconInfo(appPackageName) Loading @@ -224,6 +226,7 @@ abstract class MediaTttChipControllerCommon<T : ChipInfoCommon>( appIconView.contentDescription = appNameOverride ?: iconInfo.iconName appIconView.setImageDrawable(appIconDrawableOverride ?: iconInfo.icon) return appIconView.contentDescription.toString() } /** Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttChipControllerSender.kt +18 −6 Original line number Diff line number Diff line Loading @@ -122,13 +122,12 @@ class MediaTttChipControllerSender @Inject constructor( val chipState = newChipInfo.state // App icon setIcon(currentChipView, newChipInfo.routeInfo.packageName) val iconName = setIcon(currentChipView, newChipInfo.routeInfo.packageName) // Text val otherDeviceName = newChipInfo.routeInfo.name.toString() currentChipView.requireViewById<TextView>(R.id.text).apply { text = chipState.getChipTextString(context, otherDeviceName) } val chipText = chipState.getChipTextString(context, otherDeviceName) currentChipView.requireViewById<TextView>(R.id.text).text = chipText // Loading currentChipView.requireViewById<View>(R.id.loading).visibility = Loading @@ -145,17 +144,29 @@ class MediaTttChipControllerSender @Inject constructor( // Failure currentChipView.requireViewById<View>(R.id.failure_icon).visibility = chipState.isTransferFailure.visibleIfTrue() // For accessibility currentChipView.requireViewById<ViewGroup>( R.id.media_ttt_sender_chip_inner ).contentDescription = "$iconName $chipText" } override fun animateChipIn(chipView: ViewGroup) { val chipInnerView = chipView.requireViewById<ViewGroup>(R.id.media_ttt_sender_chip_inner) ViewHierarchyAnimator.animateAddition( chipView.requireViewById<ViewGroup>(R.id.media_ttt_sender_chip_inner), chipInnerView, ViewHierarchyAnimator.Hotspot.TOP, Interpolators.EMPHASIZED_DECELERATE, duration = 500L, duration = ANIMATION_DURATION, includeMargins = true, includeFadeIn = true, ) // We can only request focus once the animation finishes. mainExecutor.executeDelayed( { chipInnerView.requestAccessibilityFocus() }, ANIMATION_DURATION ) } override fun removeChip(removalReason: String) { Loading Loading @@ -186,3 +197,4 @@ data class ChipSenderInfo( } const val SENDER_TAG = "MediaTapToTransferSender" private const val ANIMATION_DURATION = 500L Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/common/MediaTttChipControllerCommon.kt +5 −2 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ abstract class MediaTttChipControllerCommon<T : ChipInfoCommon>( internal val logger: MediaTttLogger, internal val windowManager: WindowManager, private val viewUtil: ViewUtil, @Main private val mainExecutor: DelayableExecutor, @Main internal val mainExecutor: DelayableExecutor, private val accessibilityManager: AccessibilityManager, private val configurationController: ConfigurationController, private val powerManager: PowerManager, Loading Loading @@ -205,13 +205,15 @@ abstract class MediaTttChipControllerCommon<T : ChipInfoCommon>( * * @param appPackageName the package name of the app playing the media. Will be used to fetch * the app icon and app name if overrides aren't provided. * * @return the content description of the icon. */ internal fun setIcon( currentChipView: ViewGroup, appPackageName: String?, appIconDrawableOverride: Drawable? = null, appNameOverride: CharSequence? = null, ) { ): CharSequence { val appIconView = currentChipView.requireViewById<CachingIconView>(R.id.app_icon) val iconInfo = getIconInfo(appPackageName) Loading @@ -224,6 +226,7 @@ abstract class MediaTttChipControllerCommon<T : ChipInfoCommon>( appIconView.contentDescription = appNameOverride ?: iconInfo.iconName appIconView.setImageDrawable(appIconDrawableOverride ?: iconInfo.icon) return appIconView.contentDescription.toString() } /** Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttChipControllerSender.kt +18 −6 Original line number Diff line number Diff line Loading @@ -122,13 +122,12 @@ class MediaTttChipControllerSender @Inject constructor( val chipState = newChipInfo.state // App icon setIcon(currentChipView, newChipInfo.routeInfo.packageName) val iconName = setIcon(currentChipView, newChipInfo.routeInfo.packageName) // Text val otherDeviceName = newChipInfo.routeInfo.name.toString() currentChipView.requireViewById<TextView>(R.id.text).apply { text = chipState.getChipTextString(context, otherDeviceName) } val chipText = chipState.getChipTextString(context, otherDeviceName) currentChipView.requireViewById<TextView>(R.id.text).text = chipText // Loading currentChipView.requireViewById<View>(R.id.loading).visibility = Loading @@ -145,17 +144,29 @@ class MediaTttChipControllerSender @Inject constructor( // Failure currentChipView.requireViewById<View>(R.id.failure_icon).visibility = chipState.isTransferFailure.visibleIfTrue() // For accessibility currentChipView.requireViewById<ViewGroup>( R.id.media_ttt_sender_chip_inner ).contentDescription = "$iconName $chipText" } override fun animateChipIn(chipView: ViewGroup) { val chipInnerView = chipView.requireViewById<ViewGroup>(R.id.media_ttt_sender_chip_inner) ViewHierarchyAnimator.animateAddition( chipView.requireViewById<ViewGroup>(R.id.media_ttt_sender_chip_inner), chipInnerView, ViewHierarchyAnimator.Hotspot.TOP, Interpolators.EMPHASIZED_DECELERATE, duration = 500L, duration = ANIMATION_DURATION, includeMargins = true, includeFadeIn = true, ) // We can only request focus once the animation finishes. mainExecutor.executeDelayed( { chipInnerView.requestAccessibilityFocus() }, ANIMATION_DURATION ) } override fun removeChip(removalReason: String) { Loading Loading @@ -186,3 +197,4 @@ data class ChipSenderInfo( } const val SENDER_TAG = "MediaTapToTransferSender" private const val ANIMATION_DURATION = 500L