summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/TabScrollView.java
diff options
context:
space:
mode:
authorMichael Kolb <kolby@google.com>2010-10-03 14:45:11 -0700
committerMichael Kolb <kolby@google.com>2010-10-03 14:53:01 -0700
commitc350376ec7b7baa830aefb98fd5c8db1bf89c61f (patch)
treeb3b6548926befadbe67a4165fd50ec4e2bb3c89f /src/com/android/browser/TabScrollView.java
parentcb2e46958a8cb39ef90f0436e31e7242b13ca6b3 (diff)
downloadandroid_packages_apps_Gello-c350376ec7b7baa830aefb98fd5c8db1bf89c61f.tar.gz
android_packages_apps_Gello-c350376ec7b7baa830aefb98fd5c8db1bf89c61f.tar.bz2
android_packages_apps_Gello-c350376ec7b7baa830aefb98fd5c8db1bf89c61f.zip
add tabbar scrolling indicators
part of making the tab bar scrolling more discoverable show arrow indicators when there is more content available off screen Change-Id: Id63be336e18bfbdabffa175a9f526a98ea49e5eb
Diffstat (limited to 'src/com/android/browser/TabScrollView.java')
-rw-r--r--src/com/android/browser/TabScrollView.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/browser/TabScrollView.java b/src/com/android/browser/TabScrollView.java
index fcd5a80b..dc21cb6b 100644
--- a/src/com/android/browser/TabScrollView.java
+++ b/src/com/android/browser/TabScrollView.java
@@ -17,6 +17,8 @@
package com.android.browser;
import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.HorizontalScrollView;
@@ -30,6 +32,8 @@ public class TabScrollView extends HorizontalScrollView {
private BrowserActivity mBrowserActivity;
private LinearLayout mContentView;
private int mSelected;
+ private Drawable mArrowLeft;
+ private Drawable mArrowRight;
/**
* @param context
@@ -67,6 +71,8 @@ public class TabScrollView extends HorizontalScrollView {
LayoutParams.MATCH_PARENT));
addView(mContentView);
mSelected = -1;
+ mArrowLeft = ctx.getResources().getDrawable(R.drawable.ic_arrow_left);
+ mArrowRight = ctx.getResources().getDrawable(R.drawable.ic_arrow_right);
}
@Override
@@ -135,4 +141,22 @@ 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);
+ }
+ }
+
}