diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 024e43cfbc077..c3920de398b46 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3957,6 +3957,13 @@ + + + + + + + diff --git a/packages/SettingsLib/src/com/android/settingslib/notification/ConversationIconFactory.java b/packages/SettingsLib/src/com/android/settingslib/notification/ConversationIconFactory.java index d5f1ece5f83f6..549bc8a455cf4 100644 --- a/packages/SettingsLib/src/com/android/settingslib/notification/ConversationIconFactory.java +++ b/packages/SettingsLib/src/com/android/settingslib/notification/ConversationIconFactory.java @@ -86,7 +86,7 @@ public class ConversationIconFactory extends BaseIconFactory { /** * Returns the conversation info drawable */ - private Drawable getBaseIconDrawable(ShortcutInfo shortcutInfo) { + public Drawable getBaseIconDrawable(ShortcutInfo shortcutInfo) { return mLauncherApps.getShortcutIconDrawable(shortcutInfo, mFillResIconDpi); } @@ -94,7 +94,7 @@ public class ConversationIconFactory extends BaseIconFactory { * Get the {@link Drawable} that represents the app icon, badged with the work profile icon * if appropriate. */ - private Drawable getAppBadge(String packageName, int userId) { + public Drawable getAppBadge(String packageName, int userId) { Drawable badge = null; try { final ApplicationInfo appInfo = mPackageManager.getApplicationInfoAsUser( diff --git a/packages/SystemUI/res/layout/priority_onboarding_half_shell.xml b/packages/SystemUI/res/layout/priority_onboarding_half_shell.xml index bf2eac3c8ff3c..3f0e514a9af22 100644 --- a/packages/SystemUI/res/layout/priority_onboarding_half_shell.xml +++ b/packages/SystemUI/res/layout/priority_onboarding_half_shell.xml @@ -38,11 +38,61 @@ android:background="@drawable/rounded_bg_full" > + + + + android:layout_width="@*android:dimen/conversation_avatar_size" + android:layout_height="@*android:dimen/conversation_avatar_size" + android:scaleType="centerCrop" + android:importantForAccessibility="no" + /> + + + + + + + (R.id.conversation_icon)?.setImageDrawable(icon) + findViewById(R.id.icon)?.setImageDrawable(badge) + val mImportanceRingView = findViewById(R.id.conversation_icon_badge_ring) + val conversationIconBadgeBg = findViewById(R.id.conversation_icon_badge_bg) + + val ring: GradientDrawable = mImportanceRingView.drawable as GradientDrawable + ring.mutate() + val bg = conversationIconBadgeBg.drawable as GradientDrawable + bg.mutate() + val ringColor = context.getResources() + .getColor(com.android.internal.R.color.conversation_important_highlight) + val standardThickness = context.resources.getDimensionPixelSize( + com.android.internal.R.dimen.importance_ring_stroke_width) + val largeThickness = context.resources.getDimensionPixelSize( + com.android.internal.R.dimen.importance_ring_anim_max_stroke_width) + val standardSize = context.resources.getDimensionPixelSize( + com.android.internal.R.dimen.importance_ring_size) + val baseSize = standardSize - standardThickness * 2 + val largeSize = baseSize + largeThickness * 2 + val bgSize = context.resources.getDimensionPixelSize( + com.android.internal.R.dimen.conversation_icon_size_badged) + + val animatorUpdateListener: ValueAnimator.AnimatorUpdateListener + = ValueAnimator.AnimatorUpdateListener { animation -> + val strokeWidth = animation.animatedValue as Int + ring.setStroke(strokeWidth, ringColor) + val newSize = baseSize + strokeWidth * 2 + ring.setSize(newSize, newSize) + mImportanceRingView.invalidate() + } + + val growAnimation: ValueAnimator = ValueAnimator.ofInt(0, largeThickness) + growAnimation.interpolator = LINEAR_OUT_SLOW_IN + growAnimation.duration = IMPORTANCE_ANIM_GROW_DURATION + growAnimation.addUpdateListener(animatorUpdateListener) + + val shrinkAnimation: ValueAnimator + = ValueAnimator.ofInt(largeThickness, standardThickness) + shrinkAnimation.duration = IMPORTANCE_ANIM_SHRINK_DURATION + shrinkAnimation.startDelay = IMPORTANCE_ANIM_SHRINK_DELAY + shrinkAnimation.interpolator = OVERSHOOT + shrinkAnimation.addUpdateListener(animatorUpdateListener) + shrinkAnimation.addListener(object : AnimatorListenerAdapter() { + override fun onAnimationStart(animation: Animator?) { + // Shrink the badge bg so that it doesn't peek behind the animation + bg.setSize(baseSize, baseSize); + conversationIconBadgeBg.invalidate(); + } + + override fun onAnimationEnd(animation: Animator?) { + // Reset bg back to normal size + bg.setSize(bgSize, bgSize); + conversationIconBadgeBg.invalidate(); + + } + }) + + val anims = AnimatorSet() + anims.startDelay = IMPORTANCE_ANIM_DELAY + anims.playSequentially(growAnimation, shrinkAnimation) val gapWidth = dialog.context.getResources().getDimensionPixelSize( R.dimen.conversation_onboarding_bullet_gap_width) @@ -180,6 +260,7 @@ class PriorityOnboardingDialogController @Inject constructor( height = WRAP_CONTENT } } + anims.start() } }