Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Do not show WebXR icon in the content feed
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Mar 23, 2020
1 parent e318b30 commit 696c878
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class WindowViewModel extends AndroidViewModel {
private MediatorLiveData<String> navigationBarUrl;
private MutableLiveData<ObservableBoolean> isWebXRUsed;
private MutableLiveData<ObservableBoolean> isWebXRBlocked;
private MediatorLiveData<ObservableBoolean> isContentFeed;

public WindowViewModel(Application application) {
super(application);
Expand Down Expand Up @@ -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<ObservableBoolean> mIsTopBarVisibleObserver = new Observer<ObservableBoolean>() {
Expand Down Expand Up @@ -285,6 +289,16 @@ public void onChanged(Spannable aUrl) {
}
};

private Observer<Spannable> mIsContentFeedObserver = new Observer<Spannable>() {
@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());
Expand Down Expand Up @@ -663,4 +677,9 @@ public MutableLiveData<ObservableBoolean> getIsPopUpAvailable() {
public void setIsPopUpAvailable(boolean isPopUpAvailable) {
this.isPopUpAvailable.postValue(new ObservableBoolean(isPopUpAvailable));
}

@NonNull
public MutableLiveData<ObservableBoolean> getIsContentFeed() {
return isContentFeed;
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/layout/navigation_url.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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 &amp;&amp; !viewmodel.isContentFeed}" />

<View
android:layout_width="15dp"
Expand Down

0 comments on commit 696c878

Please sign in to comment.