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.systemui.recordissue
18 
19 import com.android.systemui.qs.QsEventLogger
20 import com.android.systemui.qs.pipeline.shared.TileSpec
21 import com.android.systemui.qs.tileimpl.QSTileImpl
22 import com.android.systemui.qs.tiles.RecordIssueTile
23 import com.android.systemui.qs.tiles.viewmodel.QSTileConfig
24 import com.android.systemui.qs.tiles.viewmodel.QSTileUIConfig
25 import com.android.systemui.res.R
26 import dagger.Binds
27 import dagger.Module
28 import dagger.Provides
29 import dagger.multibindings.IntoMap
30 import dagger.multibindings.StringKey
31 
32 @Module
33 interface RecordIssueModule {
34     /** Inject RecordIssueTile into tileMap in QSModule */
35     @Binds
36     @IntoMap
37     @StringKey(RecordIssueTile.TILE_SPEC)
bindRecordIssueTilenull38     fun bindRecordIssueTile(recordIssueTile: RecordIssueTile): QSTileImpl<*>
39 
40     companion object {
41 
42         const val RECORD_ISSUE_TILE_SPEC = "record_issue"
43 
44         @Provides
45         @IntoMap
46         @StringKey(RECORD_ISSUE_TILE_SPEC)
47         fun provideRecordIssueTileConfig(uiEventLogger: QsEventLogger): QSTileConfig =
48             QSTileConfig(
49                 tileSpec = TileSpec.create(RECORD_ISSUE_TILE_SPEC),
50                 uiConfig =
51                     QSTileUIConfig.Resource(
52                         iconRes = R.drawable.qs_record_issue_icon_off,
53                         labelRes = R.string.qs_record_issue_label
54                     ),
55                 instanceId = uiEventLogger.getNewInstanceId(),
56             )
57     }
58 }
59