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

Commit ecf248f6 authored by Selim Cinek's avatar Selim Cinek
Browse files

Improved transitions for conversations

The conversation titles weren't transforming before and
fading in / out before as a result. Also the icon and
its background was animating which was leading to some
strange flickers.

Bug: 150905003
Test: add group message, observe normal transitions
Change-Id: I8fa3b0e4ba4beae2661025b8456222ead7f5faaa
parent cef53f36
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -69,12 +69,11 @@
                    android:layout_height="match_parent"
                    android:src="@drawable/conversation_badge_background"
                />
                <!-- Badge: 20x20, 48dp padding left + top -->
                <com.android.internal.widget.CachingIconView
                    android:id="@+id/icon"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:padding="4dp"
                    android:layout_margin="4dp"
                    android:layout_gravity="center"
                />
                <ImageView
+6 −4
Original line number Diff line number Diff line
@@ -45,12 +45,12 @@ class NotificationConversationTemplateViewWrapper constructor(
    private val conversationLayout: ConversationLayout = view as ConversationLayout

    private lateinit var conversationIcon: View
    private lateinit var conversationBadge: View
    private lateinit var conversationBadgeBg: View
    private lateinit var expandButton: View
    private lateinit var expandButtonContainer: View
    private lateinit var imageMessageContainer: ViewGroup
    private lateinit var messagingLinearLayout: MessagingLinearLayout
    private lateinit var conversationTitle: View
    private lateinit var importanceRing: View
    private lateinit var appName: View

@@ -59,7 +59,6 @@ class NotificationConversationTemplateViewWrapper constructor(
        imageMessageContainer = conversationLayout.imageMessageContainer
        with(conversationLayout) {
            conversationIcon = requireViewById(com.android.internal.R.id.conversation_icon)
            conversationBadge = requireViewById(com.android.internal.R.id.conversation_icon_badge)
            conversationBadgeBg =
                    requireViewById(com.android.internal.R.id.conversation_icon_badge_bg)
            expandButton = requireViewById(com.android.internal.R.id.expand_button)
@@ -67,6 +66,7 @@ class NotificationConversationTemplateViewWrapper constructor(
                    requireViewById(com.android.internal.R.id.expand_button_container)
            importanceRing = requireViewById(com.android.internal.R.id.conversation_icon_badge_ring)
            appName = requireViewById(com.android.internal.R.id.app_name_text)
            conversationTitle = requireViewById(com.android.internal.R.id.conversation_text)
        }
    }

@@ -81,7 +81,10 @@ class NotificationConversationTemplateViewWrapper constructor(
        // This also clears the existing types
        super.updateTransformedTypes()

        addTransformedViews(messagingLinearLayout, appName)
        addTransformedViews(
                messagingLinearLayout,
                appName,
                conversationTitle)

        // Let's ignore the image message container since that is transforming as part of the
        // messages already
@@ -113,7 +116,6 @@ class NotificationConversationTemplateViewWrapper constructor(

        addViewsTransformingToSimilar(
                conversationIcon,
                conversationBadge,
                conversationBadgeBg,
                expandButton,
                importanceRing
+1 −5
Original line number Diff line number Diff line
@@ -132,11 +132,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
        updateCropToPaddingForImageViews();
        Notification notification = row.getEntry().getSbn().getNotification();
        mIcon.setTag(ImageTransformState.ICON_TAG, notification.getSmallIcon());
        if (mWorkProfileImage != null) {
            // The work profile image is always the same lets just set the icon tag for it not to
            // animate
            mWorkProfileImage.setTag(ImageTransformState.ICON_TAG, notification.getSmallIcon());
        }

        // We need to reset all views that are no longer transforming in case a view was previously
        // transformed, but now we decided to transform its container instead.
@@ -183,6 +178,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
        mTransformationHelper.reset();
        mTransformationHelper.addTransformedView(TransformableView.TRANSFORMING_VIEW_ICON,
                mIcon);
        mTransformationHelper.addViewTransformingToSimilar(mWorkProfileImage);
        if (mIsLowPriority && mHeaderText != null) {
            mTransformationHelper.addTransformedView(TransformableView.TRANSFORMING_VIEW_TITLE,
                    mHeaderText);