Skip to content

Commit

Permalink
Browser: Resurface incognito button
Browse files Browse the repository at this point in the history
The current method of entering incognito mode is too discreet, and
there is no way of knowing how to enter it (long press new tab FAB).

Resurface the incognito button in the tab navigation screen.

Furthermore, on tablets, there is no way to enter incognito mode
AFAIK (or it is ridiculously difficult to find).

On tablets, add an entry to the overflow menu for creating new
incognito tabs.

Change-Id: I1c81d2addd16c11480d978aebf07336307ec694f
  • Loading branch information
zwliew committed Jan 6, 2016
1 parent d2bc708 commit b152ea3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
1 change: 0 additions & 1 deletion res/layout-land/nav_screen.xml
Expand Up @@ -49,7 +49,6 @@
style="@style/BrowserButton"
android:gravity="center_vertical"
android:contentDescription="@string/accessibility_button_newincognitotab"
android:visibility="gone"
android:src="@drawable/ic_incognito" />
<ImageButton
android:id="@+id/newtab"
Expand Down
1 change: 0 additions & 1 deletion res/layout/nav_screen.xml
Expand Up @@ -41,7 +41,6 @@
style="@style/BrowserButton"
android:gravity="center_vertical"
android:contentDescription="@string/accessibility_button_newincognitotab"
android:visibility="gone"
android:src="@drawable/ic_incognito" />
<ImageButton
android:id="@+id/newtab"
Expand Down
5 changes: 5 additions & 0 deletions res/menu/browser.xml
Expand Up @@ -31,6 +31,11 @@
android:icon="@drawable/ic_new_window"
android:showAsAction="never"
android:alphabeticShortcut="n" />
<item
android:id="@+id/new_incognito_tab_menu_id"
android:title="@string/new_incognito_tab"
android:icon="@drawable/ic_new_window_incognito"
android:showAsAction="never" />
<item
android:id="@+id/bookmarks_menu_id"
android:title="@string/bookmarks"
Expand Down
4 changes: 4 additions & 0 deletions src/com/android/browser/Controller.java
Expand Up @@ -1617,6 +1617,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
openTabToHomePage();
break;

case R.id.new_incognito_tab_menu_id:
openIncognitoTab();
break;

case R.id.close_other_tabs_id:
closeOtherTabs();
break;
Expand Down
12 changes: 8 additions & 4 deletions src/com/android/browser/PhoneUi.java
Expand Up @@ -184,10 +184,14 @@ public void updateMenuState(Tab tab, Menu menu) {
if (info != null) {
info.setVisible(false);
}
MenuItem newtab = menu.findItem(R.id.new_tab_menu_id);
if (newtab != null && !mUseQuickControls) {
newtab.setVisible(false);
}
MenuItem newTab = menu.findItem(R.id.new_tab_menu_id);
if (newTab != null && !mUseQuickControls) {
newTab.setVisible(false);
}
MenuItem newIncognitoTab = menu.findItem(R.id.new_incognito_tab_menu_id);
if (newIncognitoTab != null && !mUseQuickControls) {
newIncognitoTab.setVisible(false);
}
MenuItem closeOthers = menu.findItem(R.id.close_other_tabs_id);
if (closeOthers != null) {
boolean isLastTab = true;
Expand Down

0 comments on commit b152ea3

Please sign in to comment.