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 /** 32 * Whether the option should be rendered as large. If `false`, the option should be rendered 33 * smaller. 34 */ 35 val isLarge: Flow<Boolean>, 36 /** Whether the progress indicator should be visible. */ 37 val isProgressIndicatorVisible: Flow<Boolean>, 38 /** Whether the selection border should be visible. */ 39 val isSelectionBorderVisible: Flow<Boolean>, 40 /** Whether the selection icon should be visible. */ 41 val isSelectionIconVisible: Flow<Boolean>, 42 /** 43 * A function to invoke when the option is clicked by the user. If `null`, the option is not 44 * clickable. 45 */ 46 val onSelected: Flow<(() -> Unit)?>, 47 ) 48