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/BaseUi.java b/src/com/android/browser/BaseUi.java
index a04f5e0..9dbfe24 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -63,7 +63,7 @@
*/
public abstract class BaseUi implements UI {
- private static final String LOGTAG = "BaseUi";
+ protected static final boolean ENABLE_BORDER_AROUND_FAVICON = false;
protected static final FrameLayout.LayoutParams COVER_SCREEN_PARAMS =
new FrameLayout.LayoutParams(
@@ -117,9 +117,10 @@
mActivity = browser;
mUiController = controller;
mTabControl = controller.getTabControl();
- Resources res = mActivity.getResources();
mInputManager = (InputMethodManager)
browser.getSystemService(Activity.INPUT_METHOD_SERVICE);
+ // This assumes that the top-level root of our layout has the 'android.R.id.content' id
+ // it's used in place of setContentView because we're attaching a <merge> here.
FrameLayout frameLayout = (FrameLayout) mActivity.getWindow()
.getDecorView().findViewById(android.R.id.content);
LayoutInflater.from(mActivity)
@@ -856,19 +857,22 @@
}
public Drawable getFaviconDrawable(Bitmap icon) {
- Drawable[] array = new Drawable[3];
- array[0] = new PaintDrawable(Color.BLACK);
- PaintDrawable p = new PaintDrawable(Color.WHITE);
- array[1] = p;
- if (icon == null) {
- array[2] = getGenericFavicon();
- } else {
- array[2] = new BitmapDrawable(icon);
+ if (ENABLE_BORDER_AROUND_FAVICON) {
+ Drawable[] array = new Drawable[3];
+ array[0] = new PaintDrawable(Color.BLACK);
+ PaintDrawable p = new PaintDrawable(Color.WHITE);
+ array[1] = p;
+ if (icon == null) {
+ array[2] = getGenericFavicon();
+ } else {
+ array[2] = new BitmapDrawable(mActivity.getResources(), icon);
+ }
+ LayerDrawable d = new LayerDrawable(array);
+ d.setLayerInset(1, 1, 1, 1, 1);
+ d.setLayerInset(2, 2, 2, 2, 2);
+ return d;
}
- LayerDrawable d = new LayerDrawable(array);
- d.setLayerInset(1, 1, 1, 1, 1);
- d.setLayerInset(2, 2, 2, 2, 2);
- return d;
+ return icon == null ? getGenericFavicon() : new BitmapDrawable(mActivity.getResources(), icon);
}
public boolean isLoading() {
@@ -897,6 +901,14 @@
mHandler.sendMessageDelayed(msg, duration);
}
+ protected void setMenuItemVisibility(Menu menu, int id,
+ boolean visibility) {
+ MenuItem item = menu.findItem(id);
+ if (item != null) {
+ item.setVisible(visibility);
+ }
+ }
+
protected Handler mHandler = new Handler() {
@Override