From 11825b0bc7bc28d3acec069a41d9a57c64141b7d Mon Sep 17 00:00:00 2001 From: Maryam Dehaini Date: Tue, 17 Sep 2024 13:56:06 -0700 Subject: [PATCH] Change "Open by default" setting page selection to radio buttons Selection to open page in app or browser needs to be displayed via radio buttons as discussed here: http://b/346622495#comment14 Bug: 359262490 Test: Open links in app and browser Flag: EXEMPT small UI change Change-Id: Ib23084bcc7f899b97b59019775584807e5b70d7e --- res/values/strings.xml | 4 +- res/xml/installed_app_launch_settings.xml | 12 +++- .../intentpicker/AppLaunchSettings.java | 57 ++++++++++++------- 3 files changed, 48 insertions(+), 25 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 887491d5a7b..89c4540b9f1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -9734,8 +9734,10 @@ Open by default Open supported links + In the app + In your browser - Allow web links to open in this app + Choose how to open web links for this app Links to open in this app diff --git a/res/xml/installed_app_launch_settings.xml b/res/xml/installed_app_launch_settings.xml index 2268d5c9d98..ffd73bc78c8 100644 --- a/res/xml/installed_app_launch_settings.xml +++ b/res/xml/installed_app_launch_settings.xml @@ -19,9 +19,15 @@ xmlns:settings="http://schemas.android.com/apk/res-auto" android:title="@string/launch_by_default"> - + + + + + 0); } + private void setOpenByDefaultPreference(boolean openInApp) { + if (mOpenInBrowserSelector == null || mOpenInAppSelector == null) return; + mOpenInAppSelector.setChecked(openInApp); + mOpenInBrowserSelector.setChecked(!openInApp); + } + private void showVerifiedLinksDialog() { final int linksNo = getLinksNumber(DOMAIN_STATE_VERIFIED); if (linksNo == 0) { @@ -360,9 +372,12 @@ public class AppLaunchSettings extends AppInfoBase implements } private void disabledPreference() { - mMainSwitchPreference.updateStatus(false); - mMainSwitchPreference.setSelectable(false); - mMainSwitchPreference.setEnabled(false); + if (mOpenInAppSelector == null ||mOpenInBrowserSelector == null) return; + setOpenByDefaultPreference(false /* openInApp */); + mOpenInAppSelector.setSelectable(false); + mOpenInAppSelector.setEnabled(false); + mOpenInBrowserSelector.setSelectable(false); + mOpenInBrowserSelector.setEnabled(false); mMainPreferenceCategory.setVisible(false); }