summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-09-27 13:37:28 -0700
committerMichael Kolb <kolby@google.com>2011-10-04 11:17:30 -0700
commit716773853705e67fe5d5afbf9c3b917ff8a5e298 (patch)
treef5d9d060a055d2ad231026dc19cd4ba1d2d63a80
parent81260dfcd9150173416598bdd3d44190a00e6c95 (diff)
downloadpackages_apps_browser-716773853705e67fe5d5afbf9c3b917ff8a5e298.zip
packages_apps_browser-716773853705e67fe5d5afbf9c3b917ff8a5e298.tar.gz
packages_apps_browser-716773853705e67fe5d5afbf9c3b917ff8a5e298.tar.bz2
Fix QuickControls
Bug: 5115647 Removed back from QC options Added menu to QC options Removed background on phone Changed colors to match ICS scheme Change-Id: I32c8cc0c4714e50e9eca28e6aa069be8d0fe9da8
-rw-r--r--res/drawable-hdpi/tab_nr.pngbin438 -> 0 bytes
-rw-r--r--res/drawable-mdpi/tab_nr.pngbin178 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/tab_nr.pngbin1217 -> 0 bytes
-rw-r--r--res/drawable/tab_nr.xml24
-rw-r--r--res/values/colors.xml5
-rw-r--r--src/com/android/browser/PieControlPhone.java48
-rw-r--r--src/com/android/browser/PieControlXLarge.java7
-rw-r--r--src/com/android/browser/view/PieMenu.java28
8 files changed, 84 insertions, 28 deletions
diff --git a/res/drawable-hdpi/tab_nr.png b/res/drawable-hdpi/tab_nr.png
deleted file mode 100644
index 3305362..0000000
--- a/res/drawable-hdpi/tab_nr.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/tab_nr.png b/res/drawable-mdpi/tab_nr.png
deleted file mode 100644
index 890ec7c..0000000
--- a/res/drawable-mdpi/tab_nr.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/tab_nr.png b/res/drawable-xhdpi/tab_nr.png
deleted file mode 100644
index abc2937..0000000
--- a/res/drawable-xhdpi/tab_nr.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/tab_nr.xml b/res/drawable/tab_nr.xml
new file mode 100644
index 0000000..4862294
--- /dev/null
+++ b/res/drawable/tab_nr.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Used by browserbarbutton to show a clear background for the non pressed
+ state -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval">
+ <solid android:color="@color/qc_tab_nr"/>
+ <padding android:left="2dp" android:top="2dp"
+ android:right="2dp" android:bottom="2dp" />
+</shape>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 4ab971f..78f4883 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -32,8 +32,9 @@
<color name="tabFaviconBackground">#FF555555</color>
<color name="tabFocusHighlight">#FF99CC00</color>
<color name="qcMenuBackground">#C0000000</color>
- <color name="qc_normal">#C02447B2</color>
- <color name="qc_selected">#D0102052</color>
+ <color name="qc_normal">#E02A96BC</color>
+ <color name="qc_selected">#F01A5B73</color>
+ <color name="qc_tab_nr">#F033B5E5</color>
<color name="tabViewTitleBackground">#D0000000</color>
<color name="navtab_bg">#80606060</color>
</resources>
diff --git a/src/com/android/browser/PieControlPhone.java b/src/com/android/browser/PieControlPhone.java
index 0b62cef..f12c49a 100644
--- a/src/com/android/browser/PieControlPhone.java
+++ b/src/com/android/browser/PieControlPhone.java
@@ -17,13 +17,12 @@
package com.android.browser;
import android.app.Activity;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
-import android.view.ViewGroup.LayoutParams;
-import android.webkit.WebView;
-import android.widget.ImageView;
-import android.widget.ImageView.ScaleType;
-import android.widget.TextView;
+import android.widget.PopupMenu;
+import android.widget.PopupMenu.OnMenuItemClickListener;
import com.android.browser.view.PieItem;
import com.android.browser.view.PieMenu.PieView.OnLayoutListener;
@@ -34,13 +33,15 @@ import java.util.List;
/**
* controller for Quick Controls pie menu
*/
-public class PieControlPhone extends PieControlBase implements OnClickListener {
+public class PieControlPhone extends PieControlBase implements OnClickListener,
+ OnMenuItemClickListener {
private PhoneUi mUi;
- private PieItem mBack;
private PieItem mUrl;
private PieItem mShowTabs;
+ private PieItem mOptions;
private TabAdapter mTabAdapter;
+ private PopupMenu mPopup;
public PieControlPhone(Activity activity, UiController controller, PhoneUi ui) {
super(activity, controller);
@@ -48,7 +49,6 @@ public class PieControlPhone extends PieControlBase implements OnClickListener {
}
protected void populateMenu() {
- mBack = makeItem(R.drawable.ic_back_holo_dark, 1);
mUrl = makeItem(R.drawable.ic_web_holo_dark, 1);
View tabs = makeTabsView();
mShowTabs = new PieItem(tabs, 1);
@@ -63,13 +63,31 @@ public class PieControlPhone extends PieControlBase implements OnClickListener {
stack.setOnCurrentListener(mTabAdapter);
stack.setAdapter(mTabAdapter);
mShowTabs.setPieView(stack);
+ mOptions = makeItem(com.android.internal.R.drawable.ic_menu_moreoverflow_normal_holo_dark,
+ 1);
+
// level 1
- mPie.addItem(mBack);
- mPie.addItem(mUrl);
mPie.addItem(mShowTabs);
- setClickListener(this, mBack, mUrl, mShowTabs);
+ mPie.addItem(mUrl);
+ mPie.addItem(mOptions);
+ setClickListener(this, mUrl, mShowTabs, mOptions);
+ mPopup = new PopupMenu(mActivity, mUi.getTitleBar());
+ Menu menu = mPopup.getMenu();
+ mPopup.getMenuInflater().inflate(R.menu.browser, menu);
+ mPopup.setOnMenuItemClickListener(this);
+ }
+
+ protected void showMenu() {
+ mUiController.updateMenuState(mUiController.getCurrentTab(), mPopup.getMenu());
+ mPopup.show();
}
+ @Override
+ public boolean onMenuItemClick(MenuItem item) {
+ return mUiController.onOptionsItemSelected(item);
+ }
+
+
private void buildTabs() {
final List<Tab> tabs = mUiController.getTabs();
mUi.getActiveTab().capture();
@@ -81,15 +99,13 @@ public class PieControlPhone extends PieControlBase implements OnClickListener {
@Override
public void onClick(View v) {
- Tab tab = mUiController.getTabControl().getCurrentTab();
- if (mBack.getView() == v) {
- tab.goBack();
- } else if (mUrl.getView() == v) {
+ if (mUrl.getView() == v) {
mUi.editUrl(false);
} else if (mShowTabs.getView() == v) {
mUi.showNavScreen();
+ } else if (mOptions.getView() == v) {
+ showMenu();
}
}
-
}
diff --git a/src/com/android/browser/PieControlXLarge.java b/src/com/android/browser/PieControlXLarge.java
index 95f586e..0072aea 100644
--- a/src/com/android/browser/PieControlXLarge.java
+++ b/src/com/android/browser/PieControlXLarge.java
@@ -27,6 +27,7 @@ import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.webkit.WebView;
import android.widget.BaseAdapter;
+import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.browser.view.PieItem;
@@ -61,6 +62,12 @@ public class PieControlXLarge extends PieControlBase implements OnClickListener
mUi = ui;
}
+ @Override
+ protected void attachToContainer(FrameLayout container) {
+ super.attachToContainer(container);
+ mPie.setUseBackground(true);
+ }
+
protected void populateMenu() {
mBack = makeItem(R.drawable.ic_back_holo_dark, 1);
mUrl = makeItem(R.drawable.ic_web_holo_dark, 1);
diff --git a/src/com/android/browser/view/PieMenu.java b/src/com/android/browser/view/PieMenu.java
index 99750f9..536ac92 100644
--- a/src/com/android/browser/view/PieMenu.java
+++ b/src/com/android/browser/view/PieMenu.java
@@ -89,6 +89,8 @@ public class PieMenu extends FrameLayout {
// touch handling
PieItem mCurrentItem;
+ private boolean mUseBackground;
+
/**
* @param context
* @param attrs
@@ -142,6 +144,10 @@ public class PieMenu extends FrameLayout {
mController = ctl;
}
+ public void setUseBackground(boolean useBackground) {
+ mUseBackground = useBackground;
+ }
+
public void addItem(PieItem item) {
// add the item to the pie itself
mItems.add(item);
@@ -245,18 +251,20 @@ public class PieMenu extends FrameLayout {
@Override
protected void onDraw(Canvas canvas) {
if (mOpen) {
- int w = mBackground.getIntrinsicWidth();
- int h = mBackground.getIntrinsicHeight();
- int left = mCenter.x - w;
- int top = mCenter.y - h / 2;
- mBackground.setBounds(left, top, left + w, top + h);
int state;
- state = canvas.save();
- if (onTheLeft()) {
- canvas.scale(-1, 1);
+ if (mUseBackground) {
+ int w = mBackground.getIntrinsicWidth();
+ int h = mBackground.getIntrinsicHeight();
+ int left = mCenter.x - w;
+ int top = mCenter.y - h / 2;
+ mBackground.setBounds(left, top, left + w, top + h);
+ state = canvas.save();
+ if (onTheLeft()) {
+ canvas.scale(-1, 1);
+ }
+ mBackground.draw(canvas);
+ canvas.restoreToCount(state);
}
- mBackground.draw(canvas);
- canvas.restoreToCount(state);
for (PieItem item : mItems) {
Paint p = item.isSelected() ? mSelectedPaint : mNormalPaint;
state = canvas.save();