Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
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 @@ -50,7 +50,7 @@ public class TabView extends RelativeLayout implements GeckoSession.ContentDeleg
protected boolean mPressed;
protected CompletableFuture<Bitmap> mBitmapFuture;
protected boolean mUsingPlaceholder;
private boolean mIsPrivateMode;
private boolean mSendTabEnabled;
private static final int ICON_ANIMATION_DURATION = 100;

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

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

public void reset() {
Expand Down Expand Up @@ -261,7 +261,7 @@ private void updateState() {
boolean selected = isSelected();

mCloseButton.setVisibility(interacted && !selected && !mSelecting ? View.VISIBLE : View.GONE);
mSendTabButton.setVisibility(interacted && !selected && !mSelecting && !mIsPrivateMode ? View.VISIBLE : View.GONE);
mSendTabButton.setVisibility(mSendTabEnabled && interacted && !selected && !mSelecting ? 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 @@ -17,6 +17,7 @@
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.URLUtil;
Comment thread
bluemarvin marked this conversation as resolved.
import android.widget.EditText;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -1155,7 +1156,12 @@ public void onSwitchMode() {
hideMenu();
}
});
mHamburgerMenu.setSendTabEnabled(!UrlUtils.isPrivateAboutPage(getContext(), mAttachedWindow.getSession().getCurrentUri()));
boolean isSendTabEnabled = false;
if (URLUtil.isHttpUrl(mAttachedWindow.getSession().getCurrentUri()) ||
URLUtil.isHttpsUrl(mAttachedWindow.getSession().getCurrentUri())) {
isSendTabEnabled = true;
}
mHamburgerMenu.setSendTabEnabled(isSendTabEnabled);
mHamburgerMenu.setUAMode(mAttachedWindow.getSession().getUaMode());
mHamburgerMenu.show(UIWidget.KEEP_FOCUS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.widget.LinearLayout;
import android.widget.TextView;

Expand Down Expand Up @@ -240,13 +241,17 @@ public void onBindViewHolder(MyViewHolder holder, int position) {
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()));
String uri = holder.tabView.getSession().getCurrentUri();
holder.tabView.setSendTabEnabled(URLUtil.isHttpUrl(uri) || URLUtil.isHttpsUrl(uri));
} else {
holder.tabView.setSendTabEnabled(false);
}
holder.tabView.setDelegate(new TabView.Delegate() {
@Override
public void onClose(TabView aSender) {
if (aSender.getSession() != null) {
holder.tabView.setPrivate(aSender.getSession().isPrivateMode());
String uri = aSender.getSession().getCurrentUri();
aSender.setSendTabEnabled(URLUtil.isHttpUrl(uri) || URLUtil.isHttpsUrl(uri));
}
if (mTabDelegate != null) {
ArrayList<Session> closed = new ArrayList<>();
Expand Down