summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
author Mark Renouf <mrenouf@google.com> 2024-02-01 15:52:01 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-02-01 15:52:01 +0000
commit117e476abe53e5514806f4c86e750a8d7de38269 (patch)
tree9bfc954f02375713ff0617f332a527413a2ca3e1 /java/src
parent0ccdb68644e8e531c67cfc73a56dd9c95352829f (diff)
parent068c7147bd553869fca073fee25f62809c82fb3d (diff)
Merge "Adds ProfilePagerResources" into main
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/intentresolver/v2/ui/ProfilePagerResources.kt53
1 files changed, 53 insertions, 0 deletions
diff --git a/java/src/com/android/intentresolver/v2/ui/ProfilePagerResources.kt b/java/src/com/android/intentresolver/v2/ui/ProfilePagerResources.kt
new file mode 100644
index 00000000..0d31b23e
--- /dev/null
+++ b/java/src/com/android/intentresolver/v2/ui/ProfilePagerResources.kt
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.intentresolver.v2.ui
+
+import android.content.res.Resources
+import com.android.intentresolver.inject.ApplicationOwned
+import com.android.intentresolver.v2.data.repository.DevicePolicyResources
+import com.android.intentresolver.v2.domain.model.Profile
+import javax.inject.Inject
+import com.android.intentresolver.R
+
+class ProfilePagerResources
+@Inject
+constructor(
+ @ApplicationOwned private val resources: Resources,
+ private val devicePolicyResources: DevicePolicyResources
+) {
+ private val privateTabLabel by lazy { resources.getString(R.string.resolver_private_tab) }
+
+ private val privateTabAccessibilityLabel by lazy {
+ resources.getString(R.string.resolver_private_tab_accessibility)
+ }
+
+ fun profileTabLabel(profile: Profile.Type): String {
+ return when (profile) {
+ Profile.Type.PERSONAL -> devicePolicyResources.personalTabLabel
+ Profile.Type.WORK -> devicePolicyResources.workTabLabel
+ Profile.Type.PRIVATE -> privateTabLabel
+ }
+ }
+
+ fun profileTabAccessibilityLabel(type: Profile.Type): String {
+ return when (type) {
+ Profile.Type.PERSONAL -> devicePolicyResources.personalTabAccessibilityLabel
+ Profile.Type.WORK -> devicePolicyResources.workTabAccessibilityLabel
+ Profile.Type.PRIVATE -> privateTabAccessibilityLabel
+ }
+ }
+} \ No newline at end of file