summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/res/values/strings.xml6
-rw-r--r--java/src/com/android/intentresolver/v2/ui/ProfilePagerResources.kt53
2 files changed, 58 insertions, 1 deletions
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 0c772573..f98f5cd1 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -250,16 +250,20 @@
<!-- Prompt for the USB device resolver dialog with warning text for USB device dialogs. [CHAR LIMIT=200] -->
<string name="usb_device_resolve_prompt_warn">This app has not been granted record permission but could capture audio through this USB device.</string>
- <!-- ResolverActivity - profile tabs -->
+ <!-- ChooserActivity + ResolverActivity - profile tabs -->
<!-- Label of a tab on a screen. A user can tap this tap to switch to the 'Personal' view (that shows their personal content) if they have a work profile on their device. [CHAR LIMIT=NONE] -->
<string name="resolver_personal_tab">Personal</string>
<!-- Label of a tab on a screen. A user can tap this tab to switch to the 'Work' view (that shows their work content) if they have a work profile on their device. [CHAR LIMIT=NONE] -->
<string name="resolver_work_tab">Work</string>
+ <!-- Label of a tab on a screen. A user can tap this tab to switch to the 'Private' view (that shows their Private Space content) if they have private space configured on their device. [CHAR LIMIT=NONE] -->
+ <string name="resolver_private_tab">Private</string>
<!-- Accessibility label for the personal tab button. [CHAR LIMIT=NONE] -->
<string name="resolver_personal_tab_accessibility">Personal view</string>
<!-- Accessibility label for the work tab button. [CHAR LIMIT=NONE] -->
<string name="resolver_work_tab_accessibility">Work view</string>
+ <!-- Accessibility label for the private tab button. [CHAR LIMIT=NONE] -->
+ <string name="resolver_private_tab_accessibility">Private view</string>
<!-- Title of a screen. This text lets the user know that their IT admin doesn't allow them to share this content across profiles. [CHAR LIMIT=NONE] -->
<string name="resolver_cross_profile_blocked">Blocked by your IT admin</string>
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