1 /*
2  * Copyright (C) 2024 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.qs.pipeline.data.repository
18 
19 import android.content.res.Resources
20 import com.android.systemui.dagger.SysUISingleton
21 import com.android.systemui.dagger.qualifiers.Main
22 import com.android.systemui.res.R
23 import javax.inject.Inject
24 
25 /**
26  * Provides the minimum number of tiles required in QS. The default number of tiles should be at
27  * least this many.
28  */
29 interface MinimumTilesRepository {
30     val minNumberOfTiles: Int
31 }
32 
33 /**
34  * Minimum number of tiles using the corresponding resource. The value will be read once upon
35  * creation, as it's not expected to change.
36  */
37 @SysUISingleton
38 class MinimumTilesResourceRepository @Inject constructor(@Main resources: Resources) :
39     MinimumTilesRepository {
40     override val minNumberOfTiles: Int =
41         resources.getInteger(R.integer.quick_settings_min_num_tiles)
42 }
43 
44 /** Provides a fixed minimum number of tiles. */
45 class MinimumTilesFixedRepository(override val minNumberOfTiles: Int = 0) : MinimumTilesRepository
46