summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Wei Liew <zhaoweiliew@gmail.com>2016-01-05 13:51:02 +0800
committerZhao Wei Liew <zhaoweiliew@gmail.com>2016-01-06 04:50:12 -0800
commitb152ea3ea0d16e3034f81b84f0bd900cd2b66b13 (patch)
tree973cae0a32ef792d25b43b8159f5aa4e09c8d7ff
parentd2bc7087d1e2474124b286ed9047792a0cadce76 (diff)
downloadpackages_apps_Browser-b152ea3ea0d16e3034f81b84f0bd900cd2b66b13.tar.gz
packages_apps_Browser-b152ea3ea0d16e3034f81b84f0bd900cd2b66b13.tar.bz2
packages_apps_Browser-b152ea3ea0d16e3034f81b84f0bd900cd2b66b13.zip
Browser: Resurface incognito button
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
-rw-r--r--res/layout-land/nav_screen.xml1
-rw-r--r--res/layout/nav_screen.xml1
-rw-r--r--res/menu/browser.xml5
-rw-r--r--src/com/android/browser/Controller.java4
-rw-r--r--src/com/android/browser/PhoneUi.java12
5 files changed, 17 insertions, 6 deletions
diff --git a/res/layout-land/nav_screen.xml b/res/layout-land/nav_screen.xml
index 409157320..ac70ab2bd 100644
--- a/res/layout-land/nav_screen.xml
+++ b/res/layout-land/nav_screen.xml
@@ -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"
diff --git a/res/layout/nav_screen.xml b/res/layout/nav_screen.xml
index d028ea122..f29647853 100644
--- a/res/layout/nav_screen.xml
+++ b/res/layout/nav_screen.xml
@@ -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"
diff --git a/res/menu/browser.xml b/res/menu/browser.xml
index afd95657b..a0a18bc99 100644
--- a/res/menu/browser.xml
+++ b/res/menu/browser.xml
@@ -32,6 +32,11 @@
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"
android:icon="@drawable/ic_bookmarks"
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index f00698673..3382e3651 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1617,6 +1617,10 @@ public class Controller
openTabToHomePage();
break;
+ case R.id.new_incognito_tab_menu_id:
+ openIncognitoTab();
+ break;
+
case R.id.close_other_tabs_id:
closeOtherTabs();
break;
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index 6707134f7..d71d9ec84 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -184,10 +184,14 @@ public class PhoneUi extends BaseUi {
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;