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

Fixes #2782 Fix private browsing tray button state #3535

Merged
merged 1 commit into from
Jun 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ public void detachFromWindow() {
mViewModel.getIsBookmarksVisible().removeObserver(mIsBookmarksVisible);
mViewModel.getIsHistoryVisible().removeObserver(mIsHistoryVisible);
mViewModel.getIsDownloadsVisible().removeObserver(mIsDownloadsVisible);
mViewModel.getIsPrivateSession().removeObserver(mIsPrivateSession);
mViewModel = null;
}

Expand All @@ -418,6 +419,7 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
mViewModel.getIsBookmarksVisible().observe((VRBrowserActivity)getContext(), mIsBookmarksVisible);
mViewModel.getIsHistoryVisible().observe((VRBrowserActivity)getContext(), mIsHistoryVisible);
mViewModel.getIsDownloadsVisible().observe((VRBrowserActivity)getContext(), mIsDownloadsVisible);
mViewModel.getIsPrivateSession().observe((VRBrowserActivity)getContext(), mIsPrivateSession);

mBinding.setViewmodel(mViewModel);

Expand Down Expand Up @@ -460,6 +462,17 @@ public void attachToWindow(@NonNull WindowWidget aWindow) {
}
};

private Observer<ObservableBoolean> mIsPrivateSession = aBoolean -> {
if (mBinding.privateButton.isHovered()) {
return;
}
if (aBoolean.get()) {
animateViewPadding(mBinding.privateButton, mMaxPadding, mMinPadding, ICON_ANIMATION_DURATION);
} else {
animateViewPadding(mBinding.privateButton, mMinPadding, mMaxPadding, ICON_ANIMATION_DURATION);
}
};

public void toggleSettingsDialog() {
toggleSettingsDialog(SettingsView.SettingViewType.MAIN);
}
Expand Down