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 cb3a3c96e5..12aecc9f0a 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 @@ -67,6 +67,7 @@ public class WindowViewModel extends AndroidViewModel { private MediatorLiveData navigationBarUrl; private MutableLiveData isWebXRUsed; private MutableLiveData isWebXRBlocked; + private MediatorLiveData isContentFeed; public WindowViewModel(Application application) { super(application); @@ -158,6 +159,9 @@ public WindowViewModel(Application application) { isWebXRUsed = new MutableLiveData<>(new ObservableBoolean(false)); isWebXRBlocked = new MutableLiveData<>(new ObservableBoolean(false)); + + isContentFeed = new MediatorLiveData<>(); + isContentFeed.addSource(url, mIsContentFeedObserver); } private Observer mIsTopBarVisibleObserver = new Observer() { @@ -285,6 +289,16 @@ public void onChanged(Spannable aUrl) { } }; + private Observer mIsContentFeedObserver = new Observer() { + @Override + public void onChanged(Spannable o) { + String current = url.getValue().toString(); + String feed = getApplication().getString(R.string.homepage_url); + isContentFeed.postValue(new ObservableBoolean( + UrlUtils.getHost(current).equalsIgnoreCase(UrlUtils.getHost(feed)))); + } + }; + public void refresh() { url.postValue(url.getValue()); hint.postValue(getHintValue()); @@ -663,4 +677,9 @@ public MutableLiveData getIsPopUpAvailable() { public void setIsPopUpAvailable(boolean isPopUpAvailable) { this.isPopUpAvailable.postValue(new ObservableBoolean(isPopUpAvailable)); } + + @NonNull + public MutableLiveData getIsContentFeed() { + return isContentFeed; + } } diff --git a/app/src/main/res/layout/navigation_url.xml b/app/src/main/res/layout/navigation_url.xml index 7f0457e5b6..2fc7ca1fe5 100644 --- a/app/src/main/res/layout/navigation_url.xml +++ b/app/src/main/res/layout/navigation_url.xml @@ -108,7 +108,7 @@ app:privateMode="@{viewmodel.isPrivateSession}" android:tint="@color/fog" android:tooltipText="@{viewmodel.isWebXRBlocked ? @string/webxr_blocked_tooltip : @string/webxr_allowed_tooltip}" - app:visibleGone="@{viewmodel.isWebXRUsed}" /> + app:visibleGone="@{viewmodel.isWebXRUsed && !viewmodel.isContentFeed}" />