diff options
author | 2024-05-06 22:03:12 +0000 | |
---|---|---|
committer | 2024-05-06 22:03:12 +0000 | |
commit | 8411484c2abda6f703720b0a5392d54afbf0309c (patch) | |
tree | bd4c6750bd4d6dba03fa3ff55957a197f9fb8b0d | |
parent | 4572002e7cfb2d4790e4721d7a2a6a110d1977e3 (diff) | |
parent | 5169d7fc17e0b99efd75624f164911facc8aef9f (diff) |
Merge "Create app_permission version of allow limited access string" into main
3 files changed, 38 insertions, 36 deletions
diff --git a/PermissionController/res/layout/app_permission.xml b/PermissionController/res/layout/app_permission.xml index 1d0b7dc0c..f286269ad 100644 --- a/PermissionController/res/layout/app_permission.xml +++ b/PermissionController/res/layout/app_permission.xml @@ -106,24 +106,24 @@ style="@style/AppPermissionRadioButton" /> <RelativeLayout - android:id="@+id/radio_select_layout" + android:id="@+id/radio_allow_limited_layout" android:orientation="horizontal" android:layout_width="match_parent" android:layout_marginTop="16dp" android:layout_height="wrap_content"> <RadioButton - android:id="@+id/select_radio_button" - android:text="@string/grant_dialog_button_allow_limited_access" + android:id="@+id/allow_limited_radio_button" + android:text="@string/app_permission_button_allow_limited_access" android:layout_alignParentStart="true" style="@style/AppPermissionRadioButton" android:layout_marginTop="0dp" /> <View - android:id="@+id/edit_photos_divider" + android:id="@+id/select_photos_divider" android:layout_width="1dp" android:layout_height="match_parent" - android:layout_toStartOf="@id/edit_selected_button" + android:layout_toStartOf="@id/select_photos_button" android:layout_alignParentTop="true" android:layout_alignBottom="@+id/select_radio_button" android:layout_marginStart="16dp" @@ -131,7 +131,7 @@ android:theme="@style/PreferenceDivider"/> <ImageButton - android:id="@+id/edit_selected_button" + android:id="@+id/select_photos_button" android:layout_width="48dp" android:layout_height="48dp" android:layout_alignParentEnd="true" diff --git a/PermissionController/res/values/strings.xml b/PermissionController/res/values/strings.xml index c61b1bc6b..d5429b49d 100644 --- a/PermissionController/res/values/strings.xml +++ b/PermissionController/res/values/strings.xml @@ -75,7 +75,6 @@ <!-- Title for the dialog button to allow limited access. [CHAR LIMIT=60] --> <string name="grant_dialog_button_allow_limited_access">Allow limited access</string> - <!-- TODO: b/310657469 add app_permission version of this string --> <!-- Title for the dialog button to allow access to select photos to be shared. [CHAR LIMIT=60] --> <string name="grant_dialog_button_allow_selected_photos">Select photos and videos</string> @@ -582,30 +581,33 @@ <!-- Summary for an app's use of a permission without duration [CHAR LIMIT=none] --> <string name="app_permission_usage_summary_no_duration">Access: <xliff:g id="num" example="2">%1$s</xliff:g> times. Last used <xliff:g id="time" example="2 hours">%2$s</xliff:g> ago.</string> - <!-- Title for the dialog button to allow a permission grant when you cannot only allow in the foreground. [CHAR LIMIT=60] --> + <!-- Title for the settings radio button to allow a permission grant when you cannot only allow in the foreground. [CHAR LIMIT=60] --> <string name="app_permission_button_allow">Allow</string> - <!-- Title for the dialog button to allow a storage permission grant for all files [CHAR LIMIT=60] --> + <!-- Title for the settings radio button to allow a storage permission grant for all files [CHAR LIMIT=60] --> <string name="app_permission_button_allow_all_files">Allow management of all files</string> - <!-- Title for the dialog button to allow a storage permission grant for media files only [CHAR LIMIT=60] --> + <!-- Title for the settings radio button to allow a storage permission grant for media files only [CHAR LIMIT=60] --> <string name="app_permission_button_allow_media_only">Allow access to media only</string> - <!-- Title for the dialog button to allow a permission grant when you can also only allow in the foreground. [CHAR LIMIT=60] --> + <!-- Title for the settings radio button to allow a permission grant when you can also only allow in the foreground. [CHAR LIMIT=60] --> <string name="app_permission_button_allow_always">Allow all the time</string> - <!-- Title for the dialog button to allow a permission grant only when the app is in the foreground. [CHAR LIMIT=60] --> + <!-- Title for the settings radio button to allow a permission grant only when the app is in the foreground. [CHAR LIMIT=60] --> <string name="app_permission_button_allow_foreground">Allow only while using the app</string> - <!-- Title for the dialog button to allow the user to always allow access to all resources guarded by a permission. [CHAR LIMIT=60] --> + <!-- Title for the settings radio button to allow the user to always allow access to all resources guarded by a permission. [CHAR LIMIT=60] --> <string name="app_permission_button_always_allow_all">Always allow all</string> - <!-- Title for the dialog button to require an app to ask for a permission next time they need it. [CHAR LIMIT=60] --> + <!-- Title for the settings radio button to require an app to ask for a permission next time they need it. [CHAR LIMIT=60] --> <string name="app_permission_button_ask">Ask every time</string> - <!-- Title for the dialog button to deny with prejudice a permission grant. [CHAR LIMIT=60] --> + <!-- Title for the settings radio button to deny with prejudice a permission grant. [CHAR LIMIT=60] --> <string name="app_permission_button_deny">Don\u2019t allow</string> + <!-- Title for the settings radio button to allow limited access. [CHAR LIMIT=60] --> + <string name="app_permission_button_allow_limited_access">Allow limited access</string> + <!-- Content description for precise location image. [CHAR LIMIT=50] --> <string name="precise_image_description">Precise location</string> diff --git a/PermissionController/src/com/android/permissioncontroller/permission/ui/handheld/AppPermissionFragment.java b/PermissionController/src/com/android/permissioncontroller/permission/ui/handheld/AppPermissionFragment.java index 32f0c677c..765bd5456 100644 --- a/PermissionController/src/com/android/permissioncontroller/permission/ui/handheld/AppPermissionFragment.java +++ b/PermissionController/src/com/android/permissioncontroller/permission/ui/handheld/AppPermissionFragment.java @@ -119,12 +119,12 @@ public class AppPermissionFragment extends SettingsWithLargeHeader private @NonNull RadioButton mAllowForegroundButton; private @NonNull RadioButton mAskOneTimeButton; private @NonNull RadioButton mAskButton; - private @NonNull RadioButton mSelectPhotosButton; + private @NonNull RadioButton mAllowLimitedButton; private @NonNull RadioButton mDenyButton; private @NonNull RadioButton mDenyForegroundButton; - private @NonNull ImageView mEditPhotosButton; - private @NonNull View mSelectPhotosLayout; - private @NonNull View mEditPhotosDivider; + private @NonNull ImageView mSelectPhotosButton; + private @NonNull View mAllowLimitedPhotosLayout; + private @NonNull View mSelectPhotosDivider; private @NonNull View mLocationAccuracy; private @NonNull Switch mLocationAccuracySwitch; private @NonNull View mDivider; @@ -280,7 +280,7 @@ public class AppPermissionFragment extends SettingsWithLargeHeader mAllowForegroundButton = root.requireViewById(R.id.allow_foreground_only_radio_button); mAskOneTimeButton = root.requireViewById(R.id.ask_one_time_radio_button); mAskButton = root.requireViewById(R.id.ask_radio_button); - mSelectPhotosButton = root.requireViewById(R.id.select_radio_button); + mAllowLimitedButton = root.requireViewById(R.id.allow_limited_radio_button); mDenyButton = root.requireViewById(R.id.deny_radio_button); mDenyForegroundButton = root.requireViewById(R.id.deny_foreground_radio_button); @@ -289,9 +289,9 @@ public class AppPermissionFragment extends SettingsWithLargeHeader mPermissionDetails = root.requireViewById(R.id.permission_details); mLocationAccuracy = root.requireViewById(R.id.location_accuracy); mLocationAccuracySwitch = root.requireViewById(R.id.location_accuracy_switch); - mSelectPhotosLayout = root.requireViewById(R.id.radio_select_layout); - mEditPhotosButton = root.requireViewById(R.id.edit_selected_button); - mEditPhotosDivider = root.requireViewById(R.id.edit_photos_divider); + mAllowLimitedPhotosLayout = root.requireViewById(R.id.radio_allow_limited_layout); + mSelectPhotosButton = root.requireViewById(R.id.select_photos_button); + mSelectPhotosDivider = root.requireViewById(R.id.select_photos_divider); mNestedScrollView = root.requireViewById(R.id.nested_scroll_view); if (mViewModel.getButtonStateLiveData().getValue() != null) { @@ -305,9 +305,9 @@ public class AppPermissionFragment extends SettingsWithLargeHeader mDenyButton.setVisibility(View.GONE); mDenyForegroundButton.setVisibility(View.GONE); mLocationAccuracy.setVisibility(View.GONE); - mSelectPhotosLayout.setVisibility(View.GONE); - mEditPhotosDivider.setAlpha(0f); - mEditPhotosButton.setAlpha(0f); + mAllowLimitedPhotosLayout.setVisibility(View.GONE); + mSelectPhotosDivider.setAlpha(0f); + mSelectPhotosButton.setAlpha(0f); } if (mViewModel.getFullStorageStateLiveData().isInitialized() && mIsStorageGroup) { @@ -435,13 +435,13 @@ public class AppPermissionFragment extends SettingsWithLargeHeader APP_PERMISSION_FRAGMENT_ACTION_REPORTED__BUTTON_PRESSED__ASK_EVERY_TIME); setResult(DENIED); }); - mSelectPhotosButton.setOnClickListener((v) -> { + mAllowLimitedButton.setOnClickListener((v) -> { int buttonPressed = APP_PERMISSION_FRAGMENT_ACTION_REPORTED__BUTTON_PRESSED__PHOTOS_SELECTED; mViewModel.requestChange(false, this, this, ChangeRequest.PHOTOS_SELECTED, buttonPressed); }); - mEditPhotosButton.setOnClickListener((v) -> { + mSelectPhotosButton.setOnClickListener((v) -> { ButtonState selectState = states.get(ButtonType.SELECT_PHOTOS); if (selectState != null && selectState.isChecked() && !mPhotoPickerTriggered) { mPhotoPickerTriggered = true; @@ -485,8 +485,8 @@ public class AppPermissionFragment extends SettingsWithLargeHeader setButtonState(mAskButton, states.get(ButtonType.ASK)); setButtonState(mDenyButton, states.get(ButtonType.DENY)); setButtonState(mDenyForegroundButton, states.get(ButtonType.DENY_FOREGROUND)); - setButtonState(mSelectPhotosButton, states.get(ButtonType.SELECT_PHOTOS)); - if (mSelectPhotosButton.getVisibility() == View.VISIBLE) { + setButtonState(mAllowLimitedButton, states.get(ButtonType.SELECT_PHOTOS)); + if (mAllowLimitedButton.getVisibility() == View.VISIBLE) { mAllowButton.setText(R.string.app_permission_button_always_allow_all); } else { mAllowButton.setText(R.string.app_permission_button_allow); @@ -533,18 +533,18 @@ public class AppPermissionFragment extends SettingsWithLargeHeader button.jumpDrawablesToCurrentState(); } - if (button == mSelectPhotosButton) { - mSelectPhotosLayout.setVisibility(visible); + if (button == mAllowLimitedButton) { + mAllowLimitedPhotosLayout.setVisibility(visible); float endOpacity = state.isChecked() ? 1f : 0f; // On initial load, do not show the fade in/out animation if (mIsInitialLoad) { - mEditPhotosDivider.setAlpha(endOpacity); - mEditPhotosButton.setAlpha(endOpacity); + mSelectPhotosDivider.setAlpha(endOpacity); + mSelectPhotosButton.setAlpha(endOpacity); return; } - mEditPhotosButton.animate().alpha(endOpacity) + mSelectPhotosButton.animate().alpha(endOpacity) .setDuration(EDIT_PHOTOS_BUTTON_ANIMATION_LENGTH_MS); - mEditPhotosDivider.animate().alpha(endOpacity) + mSelectPhotosDivider.animate().alpha(endOpacity) .setDuration(EDIT_PHOTOS_BUTTON_ANIMATION_LENGTH_MS); } } |