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.customization.picker.clock.data.repository
18 
19 import androidx.annotation.ColorInt
20 import androidx.annotation.IntRange
21 import com.android.customization.picker.clock.shared.ClockSize
22 import com.android.customization.picker.clock.shared.model.ClockMetadataModel
23 import kotlinx.coroutines.flow.Flow
24 
25 /**
26  * Repository for accessing application clock settings, as well as selecting and configuring custom
27  * clocks.
28  */
29 interface ClockPickerRepository {
30     val allClocks: Flow<List<ClockMetadataModel>>
31 
32     val selectedClock: Flow<ClockMetadataModel>
33 
34     val selectedClockSize: Flow<ClockSize>
35 
setSelectedClocknull36     suspend fun setSelectedClock(clockId: String)
37 
38     /**
39      * Set clock color to the settings.
40      *
41      * @param selectedColor selected color in the color option list.
42      * @param colorToneProgress color tone from 0 to 100 to apply to the selected color
43      * @param seedColor the actual clock color after blending the selected color and color tone
44      */
45     suspend fun setClockColor(
46         selectedColorId: String?,
47         @IntRange(from = 0, to = 100) colorToneProgress: Int,
48         @ColorInt seedColor: Int?,
49     )
50 
51     suspend fun setClockSize(size: ClockSize)
52 }
53