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

Commit 571bf812 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Create asyncImpl of setData for Messaging and Conversation Layouts" into udc-qpr-dev

parents b1618ade 7aa77009
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;