From 678e7bd943782862b0760a8b79e71ed4d6266911 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Mon, 30 Mar 2020 19:38:56 +0200 Subject: [PATCH] Fix WebXR quick permission regression. Unify permission message. (#3070) --- .../vrbrowser/ui/widgets/NavigationBarWidget.java | 2 +- .../ui/widgets/dialogs/QuickPermissionWidget.java | 15 +++++++++++---- .../main/res/layout/quick_permission_dialog.xml | 8 ++++---- app/src/main/res/values/non_L10n.xml | 1 + app/src/main/res/values/strings.xml | 2 +- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java index cf4b81c34..770a03ea9 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java @@ -961,7 +961,7 @@ public void onPopUpButtonClicked() { public void onWebXRButtonClicked() { toggleQuickPermission(mBinding.navigationBarNavigation.urlBar.getWebxRButton(), SitePermission.SITE_PERMISSION_WEBXR, - !mViewModel.getIsWebXRBlocked().getValue().get()); + mViewModel.getIsWebXRBlocked().getValue().get()); } @Override diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/QuickPermissionWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/QuickPermissionWidget.java index 0bc72d15d..922584c8c 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/QuickPermissionWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/QuickPermissionWidget.java @@ -35,7 +35,7 @@ public QuickPermissionWidget(Context aContext) { private void initialize() { LayoutInflater inflater = LayoutInflater.from(getContext()); mBinding = DataBindingUtil.inflate(inflater, R.layout.quick_permission_dialog, this, true); - mBinding.setBlocked(false); + mBinding.setBlockButtonVisible(false); mBinding.allowButton.setOnClickListener(v -> { if (mDelegate != null) { mDelegate.onAllow(); @@ -52,20 +52,27 @@ private void initialize() { public void setData(String uri, int aCategory, boolean aBlocked) { mCategory = aCategory; mDomain = uri; - mBinding.setBlocked(aBlocked); + mBinding.setBlockButtonVisible(aBlocked); updateUI(); } public void updateUI() { switch (mCategory) { case SitePermission.SITE_PERMISSION_WEBXR: { - mBinding.message.setText(getResources().getString(R.string.webxr_block_dialog_message, mDomain)); + mBinding.message.setText( + getResources().getString(R.string.webxr_permission_dialog_message, + mBinding.getBlockButtonVisible() ? + getResources().getString(R.string.off).toUpperCase() : + getResources().getString(R.string.on).toUpperCase(), + getResources().getString(R.string.sumo_webxr_url))); + mBinding.allowButton.setText(R.string.permission_allow); + mBinding.blockButton.setText(R.string.pop_up_site_switch_block); break; } case SitePermission.SITE_PERMISSION_TRACKING: { mBinding.message.setText( getResources().getString(R.string.tracking_dialog_message, - mBinding.getBlocked() ? + mBinding.getBlockButtonVisible() ? getResources().getString(R.string.on).toUpperCase() : getResources().getString(R.string.off).toUpperCase(), getResources().getString(R.string.sumo_etp_url))); diff --git a/app/src/main/res/layout/quick_permission_dialog.xml b/app/src/main/res/layout/quick_permission_dialog.xml index fa44da631..c79b857ad 100644 --- a/app/src/main/res/layout/quick_permission_dialog.xml +++ b/app/src/main/res/layout/quick_permission_dialog.xml @@ -4,7 +4,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> @@ -50,7 +50,7 @@ android:text="@string/pop_up_site_switch_allow" android:textColor="@drawable/dialog_button_text_color" android:textStyle="bold" - visibleGone="@{blocked}"/> + visibleGone="@{blockButtonVisible}"/>