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

Commit

Permalink
Fixes #2725 Do not show the share button for private session in the t…
Browse files Browse the repository at this point in the history
…abs view (#2732)

* Do not show the share button for private session in the tabs view

* Only avoid sharing if is the private home
  • Loading branch information
keianhzo committed Feb 6, 2020
1 parent d579d88 commit 083b65c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class TabView extends RelativeLayout implements GeckoSession.ContentDeleg
protected boolean mPressed;
protected CompletableFuture<Bitmap> mBitmapFuture;
protected boolean mUsingPlaceholder;
private boolean mIsPrivateMode;
private static final int ICON_ANIMATION_DURATION = 100;

public interface Delegate {
Expand Down Expand Up @@ -215,6 +216,10 @@ public void setActive(boolean aActive) {
}
}

public void setPrivate(boolean privateMode) {
mIsPrivateMode = privateMode;
}

@Override
public void setSelected(boolean selected) {
super.setSelected(selected);
Expand Down Expand Up @@ -250,7 +255,7 @@ private void updateState() {
boolean selected = isSelected();

mCloseButton.setVisibility(interacted && !selected && !mSelecting ? View.VISIBLE : View.GONE);
mSendTabButton.setVisibility(interacted && !selected && !mSelecting ? View.VISIBLE : View.GONE);
mSendTabButton.setVisibility(interacted && !selected && !mSelecting && !mIsPrivateMode ? View.VISIBLE : View.GONE);
mTitle.setVisibility(interacted && !selected ? View.VISIBLE : View.GONE);
mTabOverlay.setPressed(mPressed);
if (mSelecting) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.mozilla.vrbrowser.ui.widgets.dialogs.SendTabDialogWidget;
import org.mozilla.vrbrowser.ui.widgets.dialogs.UIDialog;
import org.mozilla.vrbrowser.utils.BitmapCache;
import org.mozilla.vrbrowser.utils.UrlUtils;

import java.util.ArrayList;

Expand Down Expand Up @@ -234,6 +235,9 @@ public void onBindViewHolder(MyViewHolder holder, int position) {
holder.tabView.setSelecting(mSelecting);
holder.tabView.setSelected(mSelectedTabs.contains(holder.tabView.getSession()));
holder.tabView.setActive(SessionStore.get().getActiveSession() == holder.tabView.getSession());
if (holder.tabView.getSession() != null) {
holder.tabView.setPrivate(UrlUtils.isPrivateAboutPage(getContext(), holder.tabView.getSession().getCurrentUri()));
}
holder.tabView.setDelegate(new TabView.Delegate() {
@Override
public void onClose(TabView aSender) {
Expand Down

0 comments on commit 083b65c

Please sign in to comment.