summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-mdpi/tab_nr.pngbin0 -> 336 bytes
-rw-r--r--res/layout/qc_tabs_view.xml39
-rw-r--r--res/values/dimensions.xml1
-rw-r--r--src/com/android/browser/PieControl.java30
4 files changed, 65 insertions, 5 deletions
diff --git a/res/drawable-mdpi/tab_nr.png b/res/drawable-mdpi/tab_nr.png
new file mode 100644
index 0000000..93e7598
--- /dev/null
+++ b/res/drawable-mdpi/tab_nr.png
Binary files differ
diff --git a/res/layout/qc_tabs_view.xml b/res/layout/qc_tabs_view.xml
new file mode 100644
index 0000000..accae68
--- /dev/null
+++ b/res/layout/qc_tabs_view.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="0dip"
+ >
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_width="48dip"
+ android:layout_height="48dip"
+ />
+ <TextView android:id="@+id/label"
+ android:layout_height="24dip"
+ android:layout_width="24dip"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentBottom="true"
+ android:gravity="center_horizontal|center_vertical"
+ android:typeface="sans"
+ android:textSize="12sp"
+ android:textStyle="bold"
+ android:textColor="#ffffff"
+ android:background="@drawable/tab_nr"
+ />
+</RelativeLayout>
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index 14c0c04..e92828e 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -36,6 +36,7 @@
<dimen name="qc_tab_title_height">30dip</dimen>
<dimen name="qc_thumb_width">240dip</dimen>
<dimen name="qc_thumb_height">160dip</dimen>
+ <dimen name="qc_item_size">48dip</dimen>
<dimen name="bookmark_widget_thumb_size">32dip</dimen>
<dimen name="bookmark_widget_favicon_size">26dip</dimen>
<!-- For the most visited page -->
diff --git a/src/com/android/browser/PieControl.java b/src/com/android/browser/PieControl.java
index 5e95684..ed3e960 100644
--- a/src/com/android/browser/PieControl.java
+++ b/src/com/android/browser/PieControl.java
@@ -65,11 +65,14 @@ public class PieControl implements OnClickListener, PieMenu.PieController {
private MenuAdapter mMenuAdapter;
private PieItem mShowTabs;
private TabAdapter mTabAdapter;
+ private TextView mTabsCount;
+ private int mItemSize;
public PieControl(Activity activity, UiController controller, XLargeUi ui) {
mActivity = activity;
mUiController = controller;
mUi = ui;
+ mItemSize = (int) activity.getResources().getDimension(R.dimen.qc_item_size);
}
protected void attachToContainer(FrameLayout container) {
@@ -85,7 +88,8 @@ public class PieControl implements OnClickListener, PieMenu.PieController {
mForward = makeItem(R.drawable.ic_forward_holo_dark, 2);
mNewTab = makeItem(R.drawable.ic_new_window_holo_dark, 2);
mClose = makeItem(R.drawable.ic_close_window_holo_dark, 2);
- mShowTabs = makeItem(R.drawable.ic_windows_holo_dark, 2);
+ View tabs = makeTabsView();
+ mShowTabs = new PieItem(tabs, 2);
mOptions = makeItem(
com.android.internal.R.drawable.ic_menu_moreoverflow_normal_holo_dark,
2);
@@ -152,12 +156,26 @@ public class PieControl implements OnClickListener, PieMenu.PieController {
container.removeView(mPie);
}
+ private View makeTabsView() {
+ View v = mActivity.getLayoutInflater().inflate(R.layout.qc_tabs_view, null);
+ mTabsCount = (TextView) v.findViewById(R.id.label);
+ mTabsCount.setText("1");
+ ImageView image = (ImageView) v.findViewById(R.id.icon);
+ image.setImageResource(R.drawable.ic_windows_holo_dark);
+ image.setScaleType(ScaleType.CENTER);
+ LayoutParams lp = new LayoutParams(mItemSize, mItemSize);
+ v.setLayoutParams(lp);
+ v.setBackgroundResource(R.drawable.qc_item_selector);
+ return v;
+ }
+
private PieItem makeItem(int image, int l) {
ImageView view = new ImageView(mActivity);
view.setImageResource(image);
- view.setMinimumWidth(48);
- view.setMinimumHeight(48);
- LayoutParams lp = new LayoutParams(48, 48);
+ view.setMinimumWidth(mItemSize);
+ view.setMinimumHeight(mItemSize);
+ view.setScaleType(ScaleType.CENTER);
+ LayoutParams lp = new LayoutParams(mItemSize,mItemSize);
view.setLayoutParams(lp);
view.setBackgroundResource(R.drawable.qc_item_selector);
return new PieItem(view, l);
@@ -204,7 +222,9 @@ public class PieControl implements OnClickListener, PieMenu.PieController {
@Override
public boolean onOpen() {
- return false;
+ int n = mUiController.getTabControl().getTabCount();
+ mTabsCount.setText(Integer.toString(n));
+ return true;
}
private static class TabAdapter extends BaseAdapter implements OnCurrentListener {