1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.internal.widget;
18 
19 import android.annotation.Nullable;
20 import android.app.Person;
21 
22 import java.util.List;
23 
24 /**
25  * @hide
26  */
27 final class MessagingData {
28     private final Person mUser;
29     private final boolean mShowSpinner;
30     private final List<MessagingMessage> mHistoricMessagingMessages;
31     private final List<MessagingMessage> mNewMessagingMessages;
32     private final List<List<MessagingMessage>> mGroups;
33     private final List<Person> mSenders;
34     private final int mUnreadCount;
35 
36     private ConversationHeaderData mConversationHeaderData;
37 
MessagingData(Person user, boolean showSpinner, List<MessagingMessage> historicMessagingMessages, List<MessagingMessage> newMessagingMessages, List<List<MessagingMessage>> groups, List<Person> senders)38     MessagingData(Person user, boolean showSpinner,
39             List<MessagingMessage> historicMessagingMessages,
40             List<MessagingMessage> newMessagingMessages, List<List<MessagingMessage>> groups,
41             List<Person> senders) {
42         this(user, showSpinner, /* unreadCount= */0,
43                 historicMessagingMessages, newMessagingMessages,
44                 groups,
45                 senders, null);
46     }
47 
MessagingData(Person user, boolean showSpinner, int unreadCount, List<MessagingMessage> historicMessagingMessages, List<MessagingMessage> newMessagingMessages, List<List<MessagingMessage>> groups, List<Person> senders, @Nullable ConversationHeaderData conversationHeaderData)48     MessagingData(Person user, boolean showSpinner,
49             int unreadCount,
50             List<MessagingMessage> historicMessagingMessages,
51             List<MessagingMessage> newMessagingMessages,
52             List<List<MessagingMessage>> groups,
53             List<Person> senders,
54             @Nullable ConversationHeaderData conversationHeaderData) {
55         mUser = user;
56         mShowSpinner = showSpinner;
57         mUnreadCount = unreadCount;
58         mHistoricMessagingMessages = historicMessagingMessages;
59         mNewMessagingMessages = newMessagingMessages;
60         mGroups = groups;
61         mSenders = senders;
62         mConversationHeaderData = conversationHeaderData;
63     }
64 
getUser()65     public Person getUser() {
66         return mUser;
67     }
68 
getShowSpinner()69     public boolean getShowSpinner() {
70         return mShowSpinner;
71     }
72 
getHistoricMessagingMessages()73     public List<MessagingMessage> getHistoricMessagingMessages() {
74         return mHistoricMessagingMessages;
75     }
76 
getNewMessagingMessages()77     public List<MessagingMessage> getNewMessagingMessages() {
78         return mNewMessagingMessages;
79     }
80 
getUnreadCount()81     public int getUnreadCount() {
82         return mUnreadCount;
83     }
84 
getSenders()85     public List<Person> getSenders() {
86         return mSenders;
87     }
88 
getGroups()89     public List<List<MessagingMessage>> getGroups() {
90         return mGroups;
91     }
92 
93     @Nullable
getConversationHeaderData()94     public ConversationHeaderData getConversationHeaderData() {
95         return mConversationHeaderData;
96     }
97 }
98