From 18270f0c904f232dda657d9bdf4fec4b26cd82a7 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Wed, 29 Apr 2020 19:07:43 +0200 Subject: [PATCH] Fixes #3281 Fixes #3282 Only show URL buttons for http/https uris (#3287) * Only show URL buttons for http/https uris * Also hide URL bar icons if in library --- .../vrbrowser/ui/viewmodel/WindowViewModel.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/viewmodel/WindowViewModel.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/viewmodel/WindowViewModel.java index 9ac9ba354..992cfbde8 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/viewmodel/WindowViewModel.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/viewmodel/WindowViewModel.java @@ -6,6 +6,7 @@ import android.text.SpannableString; import android.text.style.ForegroundColorSpan; import android.util.TypedValue; +import android.webkit.URLUtil; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -316,8 +317,8 @@ public void onChanged(Spannable aUrl) { !isFocused.getValue().get() && !isLibraryVisible.getValue().get() && !UrlUtils.isContentFeed(getApplication(), aUrl.toString()) && - !UrlUtils.isFileUri(aUrl.toString()) && !UrlUtils.isPrivateAboutPage(getApplication(), aUrl.toString()) && + (URLUtil.isHttpUrl(aUrl.toString()) || URLUtil.isHttpsUrl(aUrl.toString())) && ( (SettingsStore.getInstance(getApplication()).getTrackingProtectionLevel() != ContentBlocking.EtpLevel.NONE) || isPopUpAvailable.getValue().get() || @@ -332,8 +333,9 @@ public void onChanged(Spannable aUrl) { @Override public void onChanged(ObservableBoolean o) { isUrlBarIconsVisible.postValue(new ObservableBoolean( - isLoading.getValue().get() || - isInsecureVisible.getValue().get() + !isLibraryVisible.getValue().get() && + (isLoading.getValue().get() || + isInsecureVisible.getValue().get()) )); } }; @@ -389,10 +391,6 @@ public void setUrl(@Nullable Spannable url) { String aURL = url.toString(); - if (isLibraryVisible.getValue().get()) { - return; - } - int index = -1; try { aURL = URLDecoder.decode(aURL, "UTF-8");