Clean visual style, part II: extend bright style, convert icons, more touch-ups.

This commit removes the remaining white icons from the previous style,
which was a mix of 'holo dark' (i.e. light) icons and other un-fitting
icons. It's all replaced with theme-colored icons.

The primary color itself had been altered a bit towards green (#18aba1).
Other than the icon replacements, this commit changes:
 - tab switcher: fix cosmetic bug in the title bar in <= xhdpi devices
 - tab switcher: better incognito presentation
 - settings: enable back (<-) arrow
 - settings: bold color in the activity (on L and up)
 - settings: rationalized launching
 - better spacings on the mobile title bar
 - better padding on history items
 - add proportional padding (1em) to the incognito page
 - the incognito tab bar gets a bit darker
 - ['Ingnito Page', 'New Incognito Tab'] -> 'Private Browsing'
 - 'Page info' -> 'Page information' (no abbrevs when user facing :)

Vast amount of unused resources are removed from the APK.

Change-Id: I4add15fc686495ce27f63e26c2c56c14fa3d6603
diff --git a/src/com/android/browser/AddBookmarkFolder.java b/src/com/android/browser/AddBookmarkFolder.java
index c6dc653..b468da2 100644
--- a/src/com/android/browser/AddBookmarkFolder.java
+++ b/src/com/android/browser/AddBookmarkFolder.java
@@ -640,7 +640,7 @@
         mCrumbs = (BreadCrumbView) findViewById(R.id.crumbs);
         mCrumbs.setUseBackButton(true);
         mCrumbs.setController(this);
-        mHeaderIcon = getResources().getDrawable(R.drawable.ic_folder_holo_dark);
+        mHeaderIcon = getResources().getDrawable(R.drawable.ic_deco_folder_normal);
         mCrumbHolder = findViewById(R.id.crumb_holder);
         mCrumbs.setMaxVisible(MAX_CRUMBS_SHOWN);
 
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java
index 0ae1032..9d757d4 100644
--- a/src/com/android/browser/AddBookmarkPage.java
+++ b/src/com/android/browser/AddBookmarkPage.java
@@ -702,7 +702,7 @@
         mCrumbs = (BreadCrumbView) findViewById(R.id.crumbs);
         mCrumbs.setUseBackButton(true);
         mCrumbs.setController(this);
-        mHeaderIcon = getResources().getDrawable(R.drawable.ic_folder_holo_dark);
+        mHeaderIcon = getResources().getDrawable(R.drawable.ic_deco_folder_normal);
         mCrumbHolder = findViewById(R.id.crumb_holder);
         mCrumbs.setMaxVisible(MAX_CRUMBS_SHOWN);
 
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 8e1e62c..92c5d46 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -164,7 +164,7 @@
 
     protected Drawable getGenericFavicon() {
         if (mGenericFavicon == null) {
-            mGenericFavicon = mActivity.getResources().getDrawable(R.drawable.app_web_browser_sm);
+            mGenericFavicon = mActivity.getResources().getDrawable(R.drawable.ic_deco_favicon_normal);
         }
         return mGenericFavicon;
     }
diff --git a/src/com/android/browser/BookmarkItem.java b/src/com/android/browser/BookmarkItem.java
index b41ee00..eccc438 100644
--- a/src/com/android/browser/BookmarkItem.java
+++ b/src/com/android/browser/BookmarkItem.java
@@ -93,7 +93,7 @@
         if (b != null) {
             mImageView.setImageBitmap(b);
         } else {
-            mImageView.setImageResource(R.drawable.app_web_browser_sm);
+            mImageView.setImageResource(R.drawable.ic_deco_favicon_normal);
         }
     }
 
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 4b9f48c..8569550 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -276,7 +276,10 @@
             Log.v(LOGTAG, "BrowserActivity.onDestroy: this=" + this);
         }
         super.onDestroy();
-        mEngineInitializer.onActivityDestroy();
+        // mEngineInitializer can be null if onCreate is not called before onDestroy
+        // it happens when starting the activity with an intent while the screen is locked.
+        if (mEngineInitializer != null)
+            mEngineInitializer.onActivityDestroy();
         mController.onDestroy();
         mController = NullController.INSTANCE;
     }
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index 7abe07b..3fea1ed 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -321,7 +321,7 @@
         if (isFolder) {
             item.setUrl(null);
             Bitmap bitmap =
-                BitmapFactory.decodeResource(getResources(), R.drawable.ic_folder_holo_dark);
+                BitmapFactory.decodeResource(getResources(), R.drawable.ic_deco_folder_normal);
             item.setFavicon(bitmap);
             new LookupBookmarkCount(getActivity(), item)
                     .execute(cursor.getLong(BookmarksLoader.COLUMN_INDEX_ID));
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index 3765452..8f31ef9 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -17,18 +17,40 @@
 package com.android.browser;
 
 import android.app.Activity;
+import android.content.Intent;
 import android.os.Bundle;
+import android.preference.PreferenceActivity;
 
 import com.android.browser.preferences.GeneralPreferencesFragment;
 
 public class BrowserPreferencesPage extends Activity {
 
-    public static final String CURRENT_PAGE = "currentPage";
+    public static void startPreferencesForResult(Activity callerActivity, String url, int requestCode) {
+        final Intent intent = new Intent(callerActivity, BrowserPreferencesPage.class);
+        intent.putExtra(GeneralPreferencesFragment.EXTRA_CURRENT_PAGE, url);
+        callerActivity.startActivityForResult(intent, requestCode);
+    }
+
+    public static void startPreferenceFragmentForResult(Activity callerActivity, String fragmentName, int requestCode) {
+        final Intent intent = new Intent(callerActivity, BrowserPreferencesPage.class);
+        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, fragmentName);
+        callerActivity.startActivityForResult(intent, requestCode);
+    }
+
 
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
+        Intent intent = getIntent();
+        if (intent != null) {
+            String action = intent.getAction();
+            // check if this page was invoked by 'App Data Usage' on the global data monitor
+            if ("android.intent.action.MANAGE_NETWORK_USAGE".equals(action)) {
+                // TODO: switch to the Network fragment here?
+            }
+        }
+
         getFragmentManager().beginTransaction().replace(android.R.id.content,
                 new GeneralPreferencesFragment()).commit();
     }
diff --git a/src/com/android/browser/ComboViewActivity.java b/src/com/android/browser/ComboViewActivity.java
index 4026bdd..5ce20fc 100644
--- a/src/com/android/browser/ComboViewActivity.java
+++ b/src/com/android/browser/ComboViewActivity.java
@@ -28,7 +28,6 @@
 import android.view.Menu;
 import android.view.MenuItem;
 
-import com.android.browser.R;
 import com.android.browser.UI.ComboViews;
 
 import java.util.ArrayList;
@@ -143,9 +142,7 @@
             return true;
         } else if (item.getItemId() == R.id.preferences_menu_id) {
             String url = getIntent().getStringExtra(EXTRA_CURRENT_URL);
-            Intent intent = new Intent(this, BrowserPreferencesPage.class);
-            intent.putExtra(BrowserPreferencesPage.CURRENT_PAGE, url);
-            startActivityForResult(intent, Controller.PREFERENCES_PAGE);
+            BrowserPreferencesPage.startPreferencesForResult(this, url, Controller.PREFERENCES_PAGE);
             return true;
         }
         return super.onOptionsItemSelected(item);
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 77f4032..62dff92 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -2236,10 +2236,7 @@
 
     @Override
     public void openPreferences() {
-        Intent intent = new Intent(mActivity, BrowserPreferencesPage.class);
-        intent.putExtra(BrowserPreferencesPage.CURRENT_PAGE,
-                getCurrentTopWebView().getUrl());
-        mActivity.startActivityForResult(intent, PREFERENCES_PAGE);
+        BrowserPreferencesPage.startPreferencesForResult(mActivity, getCurrentTopWebView().getUrl(), PREFERENCES_PAGE);
     }
 
     @Override
@@ -3373,11 +3370,9 @@
         // Open the settings activity at the AutoFill profile fragment so that
         // the user can create a new profile. When they return, we will dispatch
         // the message so that we can autofill the form using their new profile.
-        Intent intent = new Intent(mActivity, BrowserPreferencesPage.class);
-        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
-                AutoFillSettingsFragment.class.getName());
         mAutoFillSetupMessage = message;
-        mActivity.startActivityForResult(intent, AUTOFILL_SETUP);
+        BrowserPreferencesPage.startPreferenceFragmentForResult(mActivity,
+                AutoFillSettingsFragment.class.getName(), AUTOFILL_SETUP);
     }
 
     @Override
diff --git a/src/com/android/browser/NavTabView.java b/src/com/android/browser/NavTabView.java
index 3bcd7a2..49bd080 100644
--- a/src/com/android/browser/NavTabView.java
+++ b/src/com/android/browser/NavTabView.java
@@ -58,7 +58,7 @@
 
     private void init() {
         LayoutInflater.from(getContext()).inflate(R.layout.nav_tab_view, this);
-        mContent = (ViewGroup) findViewById(R.id.main);
+        mContent = (ViewGroup) findViewById(R.id.nav_tab);
         mClose = (ImageView) findViewById(R.id.closetab);
         mTitle = (TextView) findViewById(R.id.title);
         mTitleBar = findViewById(R.id.titlebar);
@@ -89,9 +89,12 @@
             mTitle.setText(txt);
         }
         if (mTab.isSnapshot()) {
-            setTitleIcon(R.drawable.ic_history_holo_dark);
+            setTitleIcon(R.drawable.ic_suggest_history_normal);
         } else if (mTab.isPrivateBrowsingEnabled()) {
-            setTitleIcon(R.drawable.ic_incognito_holo_dark);
+            mContent.setBackgroundResource(R.drawable.nav_tab_title_incognito);
+            mTitle.setTextColor(getResources().getColor(R.color.white));
+            mClose.setImageResource(R.drawable.ic_action_close_inverted);
+            setTitleIcon(R.drawable.ic_deco_incognito_normal);
         } else {
             setTitleIcon(0);
         }
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index f528e8f..e73f218 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -244,7 +244,11 @@
     @Override
     public void onTabDataChanged(Tab tab) {
         super.onTabDataChanged(tab);
-        mIncognitoIcon.setVisibility(tab.isPrivateBrowsingEnabled()
-                ? View.VISIBLE : View.GONE);
+        boolean isPrivate = tab.isPrivateBrowsingEnabled();
+        mIncognitoIcon.setVisibility(isPrivate ? View.VISIBLE : View.GONE);
+        // change the background to a darker tone to reflect the 'incognito' state
+        setBackgroundColor(getResources().getColor(isPrivate ?
+                R.color.NavigationBarBackgroundIncognito : R.color.NavigationBarBackground));
+
     }
 }
diff --git a/src/com/android/browser/SnapshotBar.java b/src/com/android/browser/SnapshotBar.java
index 9446b29..d17a3ac 100644
--- a/src/com/android/browser/SnapshotBar.java
+++ b/src/com/android/browser/SnapshotBar.java
@@ -226,8 +226,8 @@
     }
 
     public void setFavicon(Bitmap icon) {
-        if (mFavicon == null) return;
-        mFavicon.setImageDrawable(mTitleBar.getUi().getFaviconDrawable(icon));
+        if (mFavicon != null)
+            mFavicon.setImageDrawable(mTitleBar.getUi().getFaviconDrawable(icon));
     }
 
     public boolean isAnimating() {
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 9964413..4e68c11 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -210,7 +210,7 @@
     private static synchronized Bitmap getDefaultFavicon(Context context) {
         if (sDefaultFavicon == null) {
             sDefaultFavicon = BitmapFactory.decodeResource(
-                    context.getResources(), R.drawable.app_web_browser_sm);
+                    context.getResources(), R.drawable.ic_deco_favicon_normal);
         }
         return sDefaultFavicon;
     }
diff --git a/src/com/android/browser/addbookmark/FolderSpinnerAdapter.java b/src/com/android/browser/addbookmark/FolderSpinnerAdapter.java
index f86c9c6..c7d24f7 100644
--- a/src/com/android/browser/addbookmark/FolderSpinnerAdapter.java
+++ b/src/com/android/browser/addbookmark/FolderSpinnerAdapter.java
@@ -69,17 +69,17 @@
         switch (position) {
             case HOME_SCREEN:
                 labelResource = R.string.add_to_homescreen_menu_option;
-                drawableResource = R.drawable.ic_home_holo_dark;
+                drawableResource = R.drawable.ic_deco_home_normal;
                 break;
             case ROOT_FOLDER:
                 labelResource = R.string.add_to_bookmarks_menu_option;
-                drawableResource = R.drawable.ic_bookmarks_holo_dark;
+                drawableResource = R.drawable.ic_deco_bookmarks_normal;
                 break;
             case RECENT_FOLDER:
                 // Fall through and use the same icon resource
             case OTHER_FOLDER:
                 labelResource = R.string.add_to_other_folder_menu_option;
-                drawableResource = R.drawable.ic_folder_holo_dark;
+                drawableResource = R.drawable.ic_deco_folder_normal;
                 break;
             default:
                 labelResource = 0;
diff --git a/src/com/android/browser/preferences/GeneralPreferencesFragment.java b/src/com/android/browser/preferences/GeneralPreferencesFragment.java
index f280766..6937ac5 100644
--- a/src/com/android/browser/preferences/GeneralPreferencesFragment.java
+++ b/src/com/android/browser/preferences/GeneralPreferencesFragment.java
@@ -42,7 +42,6 @@
 import android.widget.TextView.OnEditorActionListener;
 
 import com.android.browser.AutoFillSettingsFragment;
-import com.android.browser.BrowserPreferencesPage;
 import com.android.browser.BrowserSettings;
 import com.android.browser.PreferenceKeys;
 import com.android.browser.R;
@@ -54,6 +53,8 @@
 
     static final String TAG = "PersonalPreferencesFragment";
 
+    public static final String EXTRA_CURRENT_PAGE = "currentPage";
+
     static final String BLANK_URL = "about:blank";
     static final String CURRENT = "current";
     static final String BLANK = "blank";
@@ -75,8 +76,7 @@
         Resources res = getActivity().getResources();
         mChoices = res.getStringArray(R.array.pref_homepage_choices);
         mValues = res.getStringArray(R.array.pref_homepage_values);
-        mCurrentPage = getActivity().getIntent()
-                .getStringExtra(BrowserPreferencesPage.CURRENT_PAGE);
+        mCurrentPage = getActivity().getIntent().getStringExtra(EXTRA_CURRENT_PAGE);
 
         // Load the XML preferences file
         addPreferencesFromResource(R.xml.general_preferences);
diff --git a/src/com/android/browser/preferences/WebsiteSettingsFragment.java b/src/com/android/browser/preferences/WebsiteSettingsFragment.java
index 49bd98e..601305e 100644
--- a/src/com/android/browser/preferences/WebsiteSettingsFragment.java
+++ b/src/com/android/browser/preferences/WebsiteSettingsFragment.java
@@ -223,7 +223,7 @@
             mResource = rsc;
             mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             mDefaultIcon = BitmapFactory.decodeResource(getResources(),
-                    R.drawable.app_web_browser_sm);
+                    R.drawable.ic_deco_favicon_normal);
             mUsageEmptyIcon = BitmapFactory.decodeResource(getResources(),
                     R.drawable.ic_list_data_off);
             mUsageLowIcon = BitmapFactory.decodeResource(getResources(),
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java
index e2e22c9..ece565b 100644
--- a/src/com/android/browser/provider/BrowserProvider2.java
+++ b/src/com/android/browser/provider/BrowserProvider2.java
@@ -130,8 +130,8 @@
             qualifyColumn(TABLE_HISTORY, History.URL),
             bookmarkOrHistoryColumn(Combined.TITLE),
             bookmarkOrHistoryLiteral(Combined.URL,
-                    Integer.toString(R.drawable.ic_bookmark_off_holo_dark),
-                    Integer.toString(R.drawable.ic_history_holo_dark)),
+                    Integer.toString(R.drawable.ic_action_bookmark_normal),
+                    Integer.toString(R.drawable.ic_suggest_history_normal)),
             qualifyColumn(TABLE_HISTORY, History.DATE_LAST_VISITED)};
 
     private static final String SUGGEST_SELECTION =
diff --git a/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java b/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
index 6c80695..c818191 100644
--- a/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
+++ b/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
@@ -266,7 +266,7 @@
                         R.drawable.thumb_bookmark_widget_folder_holo);
                 }
                 views.setImageViewResource(R.id.favicon,
-                    R.drawable.ic_bookmark_widget_bookmark_holo_dark);
+                    R.drawable.ic_deco_bookmarks_normal);
                 // SWE_TODO : Fix Me
                 //views.setDrawableParameters(R.id.thumb, true, 0, -1, null, -1);
             } else {
@@ -292,7 +292,7 @@
                     views.setImageViewBitmap(R.id.favicon, favicon);
                 } else {
                     views.setImageViewResource(R.id.favicon,
-                            R.drawable.app_web_browser_sm);
+                            R.drawable.ic_deco_favicon_normal);
                 }
             }
             Intent fillin;