summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2011-01-13 19:24:18 -0800
committerMichael Kolb <kolby@google.com>2011-01-14 11:16:53 -0800
commitf558f0d9372ecf4eeba86dd52bf67f38ff79c0b8 (patch)
tree37daa2049cf77c8e9f6ab9f6b973171b3b7a73e4
parentf18338a08c89467ef27e1fe3a9ac7130839b475d (diff)
downloadpackages_apps_browser-f558f0d9372ecf4eeba86dd52bf67f38ff79c0b8.zip
packages_apps_browser-f558f0d9372ecf4eeba86dd52bf67f38ff79c0b8.tar.gz
packages_apps_browser-f558f0d9372ecf4eeba86dd52bf67f38ff79c0b8.tar.bz2
change tabbar overflow handling
http://b/issue?id=3350118 remove arrows and fade scroll gap off to the left scroll under new tab button to right Change-Id: I1dcd45aadcce7881717f5af6bbdbc28bf21e7dc3
-rw-r--r--res/layout/tab_bar.xml4
-rw-r--r--res/values/dimensions.xml2
-rw-r--r--src/com/android/browser/TabBar.java12
-rw-r--r--src/com/android/browser/TabScrollView.java30
4 files changed, 6 insertions, 42 deletions
diff --git a/res/layout/tab_bar.xml b/res/layout/tab_bar.xml
index 0f636cd..d3683b1 100644
--- a/res/layout/tab_bar.xml
+++ b/res/layout/tab_bar.xml
@@ -16,10 +16,6 @@
android:layout_width="match_parent"
android:layout_height="56dip"
android:orientation="horizontal"
- android:paddingLeft="12dip"
- android:paddingTop="12dip"
- android:paddingRight="0dip"
- android:paddingBottom="0dip"
style="@style/ActionBarStyle"
>
<com.android.browser.TabScrollView
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index d50ce13..b78b461 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -38,4 +38,6 @@
<dimen name="mv_item_width">96dp</dimen>
<dimen name="mv_item_width_portrait">96dp</dimen>
<dimen name="mv_border_width">3dp</dimen>
+ <dimen name="tab_padding_top">12dp</dimen>
+ <dimen name="tab_first_padding_left">12dp</dimen>
</resources>
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index f1cdf2f..b872cad 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -111,15 +111,11 @@ public class TabBar extends LinearLayout
Resources resources = activity.getResources();
LayoutInflater factory = LayoutInflater.from(activity);
factory.inflate(R.layout.tab_bar, this);
- setPadding(12, 12, 0, 0);
+ setPadding(0, (int) res.getDimension(R.dimen.tab_padding_top), 0, 0);
mTabs = (TabScrollView) findViewById(R.id.tabs);
mNewTab = (ImageButton) findViewById(R.id.newtab);
mNewTab.setOnClickListener(this);
mGenericFavicon = res.getDrawable(R.drawable.app_web_browser_sm);
- setChildrenDrawingOrderEnabled(true);
-
- // TODO: Change enabled states based on whether you can go
- // back/forward. Probably should be done inside onPageStarted.
updateTabs(mUiController.getTabs());
@@ -277,12 +273,6 @@ public class TabBar extends LinearLayout
return tabview;
}
- @Override
- protected int getChildDrawingOrder(int count, int i) {
- // reverse
- return count - 1 - i;
- }
-
private static Bitmap getDrawableAsBitmap(Drawable drawable, int width, int height) {
Bitmap b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
diff --git a/src/com/android/browser/TabScrollView.java b/src/com/android/browser/TabScrollView.java
index f501e64..09dddee 100644
--- a/src/com/android/browser/TabScrollView.java
+++ b/src/com/android/browser/TabScrollView.java
@@ -16,15 +16,10 @@
package com.android.browser;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
-import android.view.animation.AccelerateInterpolator;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
@@ -36,8 +31,6 @@ public class TabScrollView extends HorizontalScrollView {
private Context mContext;
private LinearLayout mContentView;
private int mSelected;
- private Drawable mArrowLeft;
- private Drawable mArrowRight;
private int mAnimationDuration;
private int mTabOverlap;
@@ -79,10 +72,11 @@ public class TabScrollView extends HorizontalScrollView {
mContentView.setOrientation(LinearLayout.HORIZONTAL);
mContentView.setLayoutParams(
new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
+ mContentView.setPadding(
+ (int) ctx.getResources().getDimension(R.dimen.tab_first_padding_left),
+ 0, 0, 0);
addView(mContentView);
mSelected = -1;
- mArrowLeft = ctx.getResources().getDrawable(R.drawable.ic_arrow_left);
- mArrowRight = ctx.getResources().getDrawable(R.drawable.ic_arrow_right);
// prevent ProGuard from removing the property methods
setScroll(getScroll());
}
@@ -153,24 +147,6 @@ public class TabScrollView extends HorizontalScrollView {
}
}
- @Override
- protected void dispatchDraw(Canvas canvas) {
- super.dispatchDraw(canvas);
- int l = getScrollX();
- int r = l + getWidth();
- int dis = 8;
- if (l > 0) {
- int aw = mArrowLeft.getIntrinsicWidth();
- mArrowLeft.setBounds(l + dis, 0, l + dis + aw, getHeight());
- mArrowLeft.draw(canvas);
- }
- if (r < mContentView.getWidth()) {
- int aw = mArrowRight.getIntrinsicWidth();
- mArrowRight.setBounds(r - dis - aw, 0, r - dis, getHeight());
- mArrowRight.draw(canvas);
- }
- }
-
// TODO: These animations are broken and don't work correctly, removing for now
// as animateOut is actually causing issues
// private void animateIn(View tab) {