Skip to content
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 @@ -390,6 +390,14 @@ public ArrayList<Session> getSortedSessions(boolean aPrivateMode) {
return result;
}

public ArrayList<Session> getInactiveSessions(boolean aPrivateMode) {
ArrayList<Session> sessions = getSortedSessions(aPrivateMode);

sessions.removeIf(session -> session.isActive() || session.isWebExtensionSession());

return sessions;
}

public void setPermissionDelegate(PermissionDelegate delegate) {
mPermissionDelegate = delegate;
}
Expand Down
13 changes: 13 additions & 0 deletions app/src/common/shared/com/igalia/wolvic/ui/widgets/TabsWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class TabsWidget extends UIDialog {
protected UITextButton mCloseTabsButton;
protected UITextButton mBookmarkTabsButton;
protected UITextButton mCloseTabsAllButton;
protected UITextButton mCloseOtherTabsButton;
protected UITextButton mSelectAllButton;
protected UITextButton mUnselectTabs;
protected LinearLayout mTabsSelectModeView;
Expand Down Expand Up @@ -133,6 +134,16 @@ public void updateUI() {
onDismiss();
});

mCloseOtherTabsButton = findViewById(R.id.tabsCloseOthersButton);
mCloseOtherTabsButton.setOnClickListener(v -> {
if (mTabDelegate != null) {
mTabDelegate.onTabsClose(SessionStore.get().getInactiveSessions(mPrivateMode));
}

refreshTabs();
updateSelectionMode();
});

mSelectAllButton = findViewById(R.id.tabsSelectAllButton);
mSelectAllButton.setOnClickListener(v -> {
mSelectedTabs = new ArrayList<>(mAdapter.mTabs);
Expand Down Expand Up @@ -356,12 +367,14 @@ private void updateSelectionMode() {
mBookmarkTabsButton.setVisibility(View.VISIBLE);
mUnselectTabs.setVisibility(View.VISIBLE);
mCloseTabsAllButton.setVisibility(View.GONE);
mCloseOtherTabsButton.setVisibility(View.GONE);
mSelectAllButton.setVisibility(View.GONE);
} else {
mCloseTabsButton.setVisibility(View.GONE);
mBookmarkTabsButton.setVisibility(View.GONE);
mUnselectTabs.setVisibility(View.GONE);
mCloseTabsAllButton.setVisibility(View.VISIBLE);
mCloseOtherTabsButton.setVisibility(SessionStore.get().getInactiveSessions(mPrivateMode).isEmpty() ? View.GONE : View.VISIBLE);
mSelectAllButton.setVisibility(View.VISIBLE);
}

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/layout/tabs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
android:visibility="gone"
android:text="@string/tabs_bookmark_selected" />

<com.igalia.wolvic.ui.views.UITextButton
android:id="@+id/tabsCloseOthersButton"
style="@style/tabsButton"
android:text="@string/tabs_close_others" />

<com.igalia.wolvic.ui.views.UITextButton
android:id="@+id/tabsCloseAllButton"
style="@style/tabsButton"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,10 @@ the Select` button. When clicked it closes all the previously selected tabs -->
the Select` button. When clicked it bookmarks all the previously selected tabs -->
<string name="tabs_bookmark_selected">Bookmark tabs</string>

<!-- This string is displayed in a button on the header of the tabs dialog.
When clicked it closes the tabs that are not currently displayed in any window -->
<string name="tabs_close_others">Close other tabs</string>

<!-- This string is displayed in a button on the header of the tabs dialog.
When clicked it closes all the available tabs -->
<string name="tabs_close_all">Close all</string>
Expand Down
Loading