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.systemui.statusbar.notification.row.ui.viewmodel 18 19 import android.annotation.ColorInt 20 import android.graphics.drawable.Drawable 21 22 /** 23 * ViewModel for SingleLine Notification View. 24 * 25 * @property titleText the text of notification view title 26 * @property contentText the text of view content 27 * @property conversationData the data that is needed specifically for conversation single-line 28 * views. Null conversationData shows that the notification is not conversation. Legacy 29 * MessagingStyle Notifications doesn't have this member. 30 */ 31 data class SingleLineViewModel( 32 var titleText: CharSequence?, 33 var contentText: CharSequence?, 34 var conversationData: ConversationData?, 35 ) { isConversationnull36 fun isConversation(): Boolean { 37 return conversationData != null 38 } 39 } 40 41 /** 42 * @property conversationSenderName the name of sender to show in the single-line view. Only group 43 * conversation single-line views show the sender name. 44 * @property avatar the avatar to show for the conversation 45 */ 46 data class ConversationData( 47 val conversationSenderName: CharSequence?, 48 val avatar: ConversationAvatar, 49 ) 50 51 /** 52 * An avatar to show for a single-line conversation notification, it can be either a single icon or 53 * a face pile. 54 */ 55 sealed class ConversationAvatar 56 57 data class SingleIcon(val iconDrawable: Drawable?) : ConversationAvatar() 58 59 /** 60 * A kind of avatar to show for a group conversation notification view. It consists of two avatars 61 * of the last two senders. 62 */ 63 data class FacePile( 64 val topIconDrawable: Drawable?, 65 val bottomIconDrawable: Drawable?, 66 @ColorInt val bottomBackgroundColor: Int 67 ) : ConversationAvatar() 68