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 com.android.systemui.plugins.clocks.ClockAxisStyle 24 import com.android.systemui.plugins.clocks.ClockId 25 import kotlinx.coroutines.flow.Flow 26 27 /** 28 * Repository for accessing application clock settings, as well as selecting and configuring custom 29 * clocks. 30 */ 31 interface ClockPickerRepository { 32 val allClocks: Flow<List<ClockMetadataModel>> 33 34 val selectedClock: Flow<ClockMetadataModel> 35 36 val selectedClockSize: Flow<ClockSize> 37 setSelectedClocknull38 suspend fun setSelectedClock(clockId: String) 39 40 /** 41 * Set clock color to the settings. 42 * 43 * @param selectedColor selected color in the color option list. 44 * @param colorToneProgress color tone from 0 to 100 to apply to the selected color 45 * @param seedColor the actual clock color after blending the selected color and color tone 46 */ 47 suspend fun setClockColor( 48 selectedColorId: String?, 49 @IntRange(from = 0, to = 100) colorToneProgress: Int, 50 @ColorInt seedColor: Int?, 51 ) 52 53 suspend fun setClockSize(size: ClockSize) 54 55 suspend fun setClockAxisStyle(axisStyle: ClockAxisStyle) 56 57 fun isReactiveToTone(clockId: ClockId): Boolean? 58 } 59