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 package com.android.customization.picker.clock.ui.view
17 
18 import android.view.View
19 import androidx.annotation.ColorInt
20 import androidx.lifecycle.LifecycleOwner
21 import com.android.systemui.plugins.clocks.ClockController
22 
23 interface ClockViewFactory {
24 
getControllernull25     fun getController(clockId: String): ClockController
26 
27     /**
28      * Reset the large view to its initial state when getting the view. This is because some view
29      * configs, e.g. animation state, might change during the reuse of the clock view in the app.
30      */
31     fun getLargeView(clockId: String): View
32 
33     /**
34      * Reset the small view to its initial state when getting the view. This is because some view
35      * configs, e.g. translation X, might change during the reuse of the clock view in the app.
36      */
37     fun getSmallView(clockId: String): View
38 
39     /** Enables or disables the reactive swipe interaction */
40     fun setReactiveTouchInteractionEnabled(clockId: String, enable: Boolean)
41 
42     fun updateColorForAllClocks(@ColorInt seedColor: Int?)
43 
44     fun updateColor(clockId: String, @ColorInt seedColor: Int?)
45 
46     fun updateRegionDarkness()
47 
48     fun updateTimeFormat(clockId: String)
49 
50     fun registerTimeTicker(owner: LifecycleOwner)
51 
52     fun onDestroy()
53 
54     fun unregisterTimeTicker(owner: LifecycleOwner)
55 }
56