• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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.systemui.controls
18 
19 import android.content.ComponentName
20 import android.graphics.drawable.Icon
21 import android.service.controls.Control
22 import android.service.controls.DeviceTypes
23 
24 interface ControlInterface {
25     val favorite: Boolean
26     val component: ComponentName
27     val controlId: String
28     val title: CharSequence
29     val subtitle: CharSequence
30     val removed: Boolean
31         get() = false
32     val customIcon: Icon?
33     @DeviceTypes.DeviceType val deviceType: Int
34 }
35 
36 data class ControlStatus(
37     val control: Control,
38     override val component: ComponentName,
39     override var favorite: Boolean,
40     override val removed: Boolean = false
41 ) : ControlInterface {
42     override val controlId: String
43         get() = control.controlId
44 
45     override val title: CharSequence
46         get() = control.title
47 
48     override val subtitle: CharSequence
49         get() = control.subtitle
50 
51     override val customIcon: Icon?
52         get() = control.customIcon
53 
54     @DeviceTypes.DeviceType override val deviceType: Int
55         get() = control.deviceType
56 }
57