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.intentresolver.ui
18 
19 import android.content.res.Resources
20 import com.android.intentresolver.R
21 import com.android.intentresolver.data.repository.DevicePolicyResources
22 import com.android.intentresolver.inject.ApplicationOwned
23 import com.android.intentresolver.shared.model.Profile
24 import javax.inject.Inject
25 
26 class ProfilePagerResources
27 @Inject
28 constructor(
29     @ApplicationOwned private val resources: Resources,
30     private val devicePolicyResources: DevicePolicyResources
31 ) {
<lambda>null32     private val privateTabLabel by lazy { resources.getString(R.string.resolver_private_tab) }
33 
<lambda>null34     private val privateTabAccessibilityLabel by lazy {
35         resources.getString(R.string.resolver_private_tab_accessibility)
36     }
37 
profileTabLabelnull38     fun profileTabLabel(profile: Profile.Type): String {
39         return when (profile) {
40             Profile.Type.PERSONAL -> devicePolicyResources.personalTabLabel
41             Profile.Type.WORK -> devicePolicyResources.workTabLabel
42             Profile.Type.PRIVATE -> privateTabLabel
43         }
44     }
45 
profileTabAccessibilityLabelnull46     fun profileTabAccessibilityLabel(type: Profile.Type): String {
47         return when (type) {
48             Profile.Type.PERSONAL -> devicePolicyResources.personalTabAccessibilityLabel
49             Profile.Type.WORK -> devicePolicyResources.workTabAccessibilityLabel
50             Profile.Type.PRIVATE -> privateTabAccessibilityLabel
51         }
52     }
53 
noAppsMessagenull54     fun noAppsMessage(type: Profile.Type): String {
55         return when (type) {
56             Profile.Type.PERSONAL -> devicePolicyResources.noPersonalApps
57             Profile.Type.WORK -> devicePolicyResources.noWorkApps
58             Profile.Type.PRIVATE -> resources.getString(R.string.resolver_no_private_apps_available)
59         }
60     }
61 }
62