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

Commit 7aa77009 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

Create asyncImpl of setData for Messaging and Conversation Layouts

This CL introduces no op background work asyncImpl of setData remotable method. This unblocks us to use PrecomputedTexts in Messaging and Conversation Layouts.

Bug: 289250881
Test: Manual. Check if Messaging and Conversation Style notifs are rendered properly.
Change-Id: Iccdfb53ee09bcb7e3da65e07ddc9ead835c12e1c
parent 7755ba0a
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -383,7 +383,11 @@ public class ConversationLayout extends FrameLayout
        updateContentEndPaddings();
    }

    @RemotableViewMethod
    /**
     * Set conversation data
     * @param extras Bundle contains conversation data
     */
    @RemotableViewMethod(asyncImpl = "setDataAsync")
    public void setData(Bundle extras) {
        Parcelable[] messages = extras.getParcelableArray(Notification.EXTRA_MESSAGES);
        List<Notification.MessagingStyle.Message> newMessages
@@ -409,6 +413,18 @@ public class ConversationLayout extends FrameLayout
        setUnreadCount(unreadCount);
    }

    /**
     * RemotableViewMethod's asyncImpl of {@link #setData(Bundle)}.
     * This should be called on a background thread, and returns a Runnable which is then must be
     * called on the main thread to complete the operation and set text.
     * @param extras Bundle contains conversation data
     * @hide
     */
    @NonNull
    public Runnable setDataAsync(Bundle extras) {
        return () -> setData(extras);
    }

    @Override
    public void setImageResolver(ImageResolver resolver) {
        mImageResolver = resolver;
+17 −1
Original line number Diff line number Diff line
@@ -156,7 +156,11 @@ public class MessagingLayout extends FrameLayout
        mConversationTitle = conversationTitle;
    }

    @RemotableViewMethod
    /**
     * Set Messaging data
     * @param extras Bundle contains messaging data
     */
    @RemotableViewMethod(asyncImpl = "setDataAsync")
    public void setData(Bundle extras) {
        Parcelable[] messages = extras.getParcelableArray(Notification.EXTRA_MESSAGES);
        List<Notification.MessagingStyle.Message> newMessages
@@ -173,6 +177,18 @@ public class MessagingLayout extends FrameLayout
        bind(newMessages, newHistoricMessages, showSpinner);
    }

    /**
     * RemotableViewMethod's asyncImpl of {@link #setData(Bundle)}.
     * This should be called on a background thread, and returns a Runnable which is then must be
     * called on the main thread to complete the operation and set text.
     * @param extras Bundle contains messaging data
     * @hide
     */
    @NonNull
    public Runnable setDataAsync(Bundle extras) {
        return () -> setData(extras);
    }

    @Override
    public void setImageResolver(ImageResolver resolver) {
        mImageResolver = resolver;