Clean visual style: move to Light, add Material support, change Drawables (progress, icons).
This code alters the visual style moving the APP to a Light theme.
Parents of the theme are either Theme.Holo.Light or Theme.Material.Light
depending on which API we start the APK from. Needs SDK 21 to build.
Other than the visual changes, this commit changes:
- name of the APP to 'Browser'
- animations and sequencing of the Tab switcher in {nav/anim}_screen
- removal of the warning icon from the Exit dialog
- change of the favicon appearance (removal of the double border)
Vast amount of unused resources are removed from the APK. Just XHDPI
drawables have been synthesized for now, and the Primary color was
used for the icons and is accessible in R.color.Primary.
Change-Id: If75cc051c5d4015383e96066cdb6507484e625d8
diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java
index 64243e3..0962449 100644
--- a/src/com/android/browser/NavScreen.java
+++ b/src/com/android/browser/NavScreen.java
@@ -27,20 +27,14 @@
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
-import android.widget.FrameLayout;
import android.widget.ImageButton;
-import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import android.widget.RelativeLayout;
-import android.widget.TextView;
-import com.android.browser.R;
-import com.android.browser.NavTabScroller.OnLayoutListener;
import com.android.browser.NavTabScroller.OnRemoveListener;
import com.android.browser.TabControl.OnThumbnailUpdatedListener;
-import com.android.browser.UI.ComboViews;
import java.util.HashMap;
@@ -50,19 +44,12 @@
UiController mUiController;
PhoneUi mUi;
- Tab mTab;
Activity mActivity;
- ImageButton mRefresh;
- ImageButton mForward;
- ImageButton mBookmarks;
+ View mToolbarLayout;
ImageButton mMore;
ImageButton mNewTab;
- FrameLayout mHolder;
-
- TextView mTitle;
- ImageView mFavicon;
- ImageButton mCloseTab;
+ ImageButton mNewIncognitoTab;
NavTabScroller mScroller;
TabAdapter mAdapter;
@@ -94,10 +81,6 @@
return mUiController.onOptionsItemSelected(item);
}
- protected float getToolbarHeight() {
- return mActivity.getResources().getDimension(R.dimen.toolbar_height);
- }
-
@Override
protected void onConfigurationChanged(Configuration newconfig) {
if (newconfig.orientation != mOrientation) {
@@ -119,10 +102,11 @@
LayoutInflater.from(getContext()).inflate(R.layout.nav_screen, this);
setContentDescription(getContext().getResources().getString(
R.string.accessibility_transition_navscreen));
- mBookmarks = (ImageButton) findViewById(R.id.bookmarks);
+ mToolbarLayout = findViewById(R.id.nav_toolbar_animate);
+ mNewIncognitoTab = (ImageButton) findViewById(R.id.newincognitotab);
mNewTab = (ImageButton) findViewById(R.id.newtab);
mMore = (ImageButton) findViewById(R.id.more);
- mBookmarks.setOnClickListener(this);
+ mNewIncognitoTab.setOnClickListener(this);
mNewTab.setOnClickListener(this);
mMore.setOnClickListener(this);
mScroller = (NavTabScroller) findViewById(R.id.scroller);
@@ -148,10 +132,10 @@
@Override
public void onClick(View v) {
- if (mBookmarks == v) {
- mUiController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
- } else if (mNewTab == v) {
+ if (mNewTab == v) {
openNewTab();
+ } else if (mNewIncognitoTab == v) {
+ openNewIncognitoTab();
} else if (mMore == v) {
showMenu();
}
@@ -168,6 +152,18 @@
}
}
+ private void openNewIncognitoTab() {
+ final Tab tab = mUiController.openIncognitoTab();
+ if (tab != null) {
+ mUiController.setBlockEvents(true);
+ final int tix = mUi.mTabControl.getTabPosition(tab);
+ switchToTab(tab);
+ mUi.hideNavScreen(tix, true);
+ mScroller.handleDataChanged(tix);
+ mUiController.setBlockEvents(false);
+ }
+ }
+
private void openNewTab() {
// need to call openTab explicitely with setactive false
final Tab tab = mUiController.openTab(BrowserSettings.getInstance().getHomePage(),