1 /* 2 * Copyright (C) 2019 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.people 18 19 import android.graphics.drawable.Drawable 20 21 /** 22 * `ViewModel` for PeopleHub view. 23 * 24 * @param people ViewModels for individual people in PeopleHub, in order that they should be 25 * displayed 26 * @param isVisible Whether or not the whole PeopleHub UI is visible 27 **/ 28 data class PeopleHubViewModel(val people: Sequence<PersonViewModel>, val isVisible: Boolean) 29 30 /** `ViewModel` for a single "Person' in PeopleHub. */ 31 data class PersonViewModel( 32 val name: CharSequence, 33 val icon: Drawable, 34 val onClick: () -> Unit 35 ) 36 37 /** 38 * `Model` for PeopleHub. 39 * 40 * @param people Models for individual people in PeopleHub, in order that they should be displayed 41 **/ 42 data class PeopleHubModel(val people: Collection<PersonModel>) 43 44 /** `Model` for a single "Person" in PeopleHub. */ 45 data class PersonModel( 46 val key: PersonKey, 47 val userId: Int, 48 // TODO: these should live in the ViewModel 49 val name: CharSequence, 50 val avatar: Drawable, 51 val clickRunnable: Runnable 52 ) 53 54 /** Unique identifier for a Person in PeopleHub. */ 55 typealias PersonKey = String