Add ability to close all tabs except current tab
This commit is contained in:
parent
941f54d615
commit
f1467a9a96
@ -834,19 +834,23 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
|
||||
android.R.layout.simple_dropdown_item_1line);
|
||||
adapter.add(this.getString(R.string.close_tab));
|
||||
android.R.layout.simple_list_item_1);
|
||||
adapter.add(this.getString(R.string.close_all_tabs));
|
||||
adapter.add(this.getString(R.string.close_other_tabs));
|
||||
adapter.add(this.getString(R.string.close_tab));
|
||||
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
switch (which) {
|
||||
case 0:
|
||||
deleteTab(position);
|
||||
closeBrowser();
|
||||
break;
|
||||
case 1:
|
||||
closeBrowser();
|
||||
mPresenter.closeAllOtherTabs();
|
||||
break;
|
||||
case 2:
|
||||
deleteTab(position);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -77,6 +77,18 @@ public class BrowserPresenter {
|
||||
mCurrentTab = newTab;
|
||||
}
|
||||
|
||||
public void closeAllOtherTabs() {
|
||||
|
||||
while (mTabsModel.last() != mTabsModel.indexOfCurrentTab()) {
|
||||
deleteTab(mTabsModel.last());
|
||||
}
|
||||
|
||||
while (0 != mTabsModel.indexOfCurrentTab()) {
|
||||
deleteTab(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void deleteTab(int position) {
|
||||
final LightningView tabToDelete = mTabsModel.getTabAtPosition(position);
|
||||
|
||||
|
@ -193,6 +193,7 @@
|
||||
<string name="settings_about_explain">Details about version, author and license.</string>
|
||||
<string name="close_tab">Close tab</string>
|
||||
<string name="close_all_tabs">Close all tabs</string>
|
||||
<string name="close_other_tabs">Close other tabs</string>
|
||||
<string name="third_party">Block 3rd Party Cookies</string>
|
||||
<string name="color_mode">Enable Color Mode</string>
|
||||
<string name="reading_mode">Reader Mode</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user