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 
18 package com.android.wallpaper.picker.customization.ui.viewmodel
19 
20 import android.graphics.Bitmap
21 import kotlinx.coroutines.flow.Flow
22 
23 /** Models the UI state for an option in the wallpaper quick switcher. */
24 data class WallpaperQuickSwitchOptionViewModel(
25     /** The ID of the wallpaper this option is associated with. */
26     val wallpaperId: String,
27     /** A placeholder color to show in the option while we load the preview thumbnail. */
28     val placeholderColor: Int,
29     /** A function to invoke to get the preview thumbnail for the option. */
30     val thumbnail: suspend () -> Bitmap?,
31     /** The title of the wallpaper or wallpaper category */
32     val title: String?,
33     /**
34      * Whether the option should be rendered as large. If `false`, the option should be rendered
35      * smaller.
36      */
37     val isLarge: Flow<Boolean>,
38     /** Whether the selection border should be visible. */
39     val isSelectionIndicatorVisible: Flow<Boolean>,
40     /**
41      * A function to invoke when the option is clicked by the user. If `null`, the option is not
42      * clickable.
43      */
44     val onSelected: Flow<(() -> Unit)?>,
45 )
46