summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-12-09 23:02:11 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-12-09 23:02:11 -0800
commitaed6c3157613131f1ba57516850ef0a0467029b4 (patch)
tree7f9527fe3820a6a2406825b7f5372aec1f63f95b
parentfaa27f932e15c673106f984cbbeef23c079bcc81 (diff)
parent20232d0f7ce2220df72dd78bed052f6b4a643f10 (diff)
downloadframeworks_base-aed6c3157613131f1ba57516850ef0a0467029b4.zip
frameworks_base-aed6c3157613131f1ba57516850ef0a0467029b4.tar.gz
frameworks_base-aed6c3157613131f1ba57516850ef0a0467029b4.tar.bz2
Merge "Holo scrollbars and related tweaks."
-rw-r--r--api/current.xml103
-rw-r--r--core/java/android/view/View.java92
-rw-r--r--core/java/android/widget/AbsListView.java78
-rw-r--r--core/java/android/widget/FastScroller.java242
-rw-r--r--core/res/res/drawable-hdpi/btn_cab_done_default_holo.9.pngbin2468 -> 2247 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_cab_done_focused_holo.9.pngbin2815 -> 2660 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_cab_done_pressed_holo.9.pngbin1558 -> 1561 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.pngbin517 -> 512 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.pngbin517 -> 508 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.pngbin346 -> 331 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.pngbin346 -> 336 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.pngbin505 -> 496 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.pngbin505 -> 490 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.pngbin330 -> 331 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.pngbin330 -> 330 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.pngbin475 -> 472 bytes
-rw-r--r--core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.pngbin475 -> 472 bytes
-rw-r--r--core/res/res/drawable-hdpi/divider_strong_holo.9.pngbin0 -> 122 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_label_left_holo_dark.9.pngbin0 -> 806 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_label_left_holo_light.9.pngbin0 -> 831 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_label_right_holo_dark.9.pngbin0 -> 780 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_label_right_holo_light.9.pngbin0 -> 861 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_thumb_default_holo.pngbin0 -> 831 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_thumb_pressed_holo.pngbin0 -> 1197 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_track_default_holo_dark.9.pngbin0 -> 132 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_track_default_holo_light.9.pngbin0 -> 132 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_track_pressed_holo_dark.9.pngbin0 -> 221 bytes
-rw-r--r--core/res/res/drawable-hdpi/fastscroll_track_pressed_holo_light.9.pngbin0 -> 221 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_ab_back_holo_dark.pngbin518 -> 518 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_ab_back_holo_light.pngbin524 -> 524 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_cab_close_holo.pngbin965 -> 961 bytes
-rw-r--r--core/res/res/drawable-hdpi/scrollbar_handle_holo_dark.9.pngbin0 -> 267 bytes
-rw-r--r--core/res/res/drawable-hdpi/scrollbar_handle_holo_light.9.pngbin0 -> 267 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_cab_done_default_holo.9.pngbin1377 -> 1347 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_cab_done_focused_holo.9.pngbin1186 -> 1594 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_cab_done_pressed_holo.9.pngbin985 -> 1008 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.pngbin386 -> 356 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.pngbin386 -> 361 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.pngbin281 -> 257 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.pngbin281 -> 261 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.pngbin385 -> 355 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.pngbin385 -> 355 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.pngbin278 -> 252 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.pngbin278 -> 248 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.pngbin386 -> 355 bytes
-rw-r--r--core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.pngbin386 -> 355 bytes
-rw-r--r--core/res/res/drawable-mdpi/divider_strong_holo.9.pngbin0 -> 122 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_label_left_holo_dark.9.pngbin0 -> 609 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_label_left_holo_light.9.pngbin0 -> 640 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_label_right_holo_dark.9.pngbin0 -> 579 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_label_right_holo_light.9.pngbin0 -> 625 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_thumb_default_holo.pngbin0 -> 681 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_thumb_pressed_holo.pngbin0 -> 870 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_track_default_holo_dark.9.pngbin0 -> 126 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_track_default_holo_light.9.pngbin0 -> 126 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_track_pressed_holo_dark.9.pngbin0 -> 187 bytes
-rw-r--r--core/res/res/drawable-mdpi/fastscroll_track_pressed_holo_light.9.pngbin0 -> 187 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_ab_back_holo_dark.pngbin483 -> 483 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_ab_back_holo_light.pngbin488 -> 488 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_cab_close_holo.pngbin721 -> 720 bytes
-rw-r--r--core/res/res/drawable-mdpi/scrollbar_handle_holo_dark.9.pngbin0 -> 205 bytes
-rw-r--r--core/res/res/drawable-mdpi/scrollbar_handle_holo_light.9.pngbin0 -> 205 bytes
-rw-r--r--core/res/res/drawable/fastscroll_thumb_holo.xml20
-rw-r--r--core/res/res/drawable/fastscroll_track_holo_dark.xml20
-rw-r--r--core/res/res/drawable/fastscroll_track_holo_light.xml20
-rwxr-xr-xcore/res/res/values/attrs.xml28
-rw-r--r--core/res/res/values/public.xml2
-rw-r--r--core/res/res/values/themes.xml25
68 files changed, 589 insertions, 41 deletions
diff --git a/api/current.xml b/api/current.xml
index 249f584..7372835 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -4189,6 +4189,17 @@
visibility="public"
>
</field>
+<field name="fastScrollAlwaysVisible"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843588"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="fastScrollEnabled"
type="int"
transient="false"
@@ -10371,6 +10382,17 @@
visibility="public"
>
</field>
+<field name="verticalScrollbarPosition"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843587"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="verticalSpacing"
type="int"
transient="false"
@@ -206780,6 +206802,17 @@
visibility="public"
>
</method>
+<method name="getVerticalScrollbarPosition"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getVerticalScrollbarWidth"
return="int"
abstract="false"
@@ -209227,6 +209260,19 @@
<parameter name="verticalScrollBarEnabled" type="boolean">
</parameter>
</method>
+<method name="setVerticalScrollbarPosition"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="position" type="int">
+</parameter>
+</method>
<method name="setVisibility"
return="void"
abstract="false"
@@ -210016,6 +210062,39 @@
visibility="public"
>
</field>
+<field name="SCROLLBAR_POSITION_DEFAULT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SCROLLBAR_POSITION_LEFT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SCROLLBAR_POSITION_RIGHT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="SELECTED_STATE_SET"
type="int[]"
transient="false"
@@ -228926,6 +229005,17 @@
visibility="public"
>
</method>
+<method name="isFastScrollAlwaysVisible"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="isFastScrollEnabled"
return="boolean"
abstract="false"
@@ -229213,6 +229303,19 @@
<parameter name="onTop" type="boolean">
</parameter>
</method>
+<method name="setFastScrollAlwaysVisible"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="alwaysShow" type="boolean">
+</parameter>
+</method>
<method name="setFastScrollEnabled"
return="void"
abstract="false"
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index da12d46..d27e99d 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -1967,6 +1967,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
int mUserPaddingBottom;
/**
+ * Cache the paddingLeft set by the user to append to the scrollbar's size.
+ */
+ @ViewDebug.ExportedProperty(category = "padding")
+ int mUserPaddingLeft;
+
+ /**
* @hide
*/
int mOldWidthMeasureSpec = Integer.MIN_VALUE;
@@ -2117,6 +2123,26 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
boolean mCanAcceptDrop;
/**
+ * Position of the vertical scroll bar.
+ */
+ private int mVerticalScrollbarPosition;
+
+ /**
+ * Position the scroll bar at the default position as determined by the system.
+ */
+ public static final int SCROLLBAR_POSITION_DEFAULT = 0;
+
+ /**
+ * Position the scroll bar along the left edge.
+ */
+ public static final int SCROLLBAR_POSITION_LEFT = 1;
+
+ /**
+ * Position the scroll bar along the right edge.
+ */
+ public static final int SCROLLBAR_POSITION_RIGHT = 2;
+
+ /**
* Simple constructor to use when creating a view from code.
*
* @param context The Context the view is running in, through which it can
@@ -2448,6 +2474,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
case R.styleable.View_overScrollMode:
overScrollMode = a.getInt(attr, OVER_SCROLL_IF_CONTENT_SCROLLS);
break;
+ case R.styleable.View_verticalScrollbarPosition:
+ mVerticalScrollbarPosition = a.getInt(attr, SCROLLBAR_POSITION_DEFAULT);
+ break;
}
}
@@ -2708,6 +2737,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
}
/**
+ * Set the position of the vertical scroll bar. Should be one of
+ * {@link #SCROLLBAR_POSITION_DEFAULT}, {@link #SCROLLBAR_POSITION_LEFT} or
+ * {@link #SCROLLBAR_POSITION_RIGHT}.
+ *
+ * @param position Where the vertical scroll bar should be positioned.
+ */
+ public void setVerticalScrollbarPosition(int position) {
+ if (mVerticalScrollbarPosition != position) {
+ mVerticalScrollbarPosition = position;
+ computeOpaqueFlags();
+ recomputePadding();
+ }
+ }
+
+ /**
+ * @return The position where the vertical scroll bar will show, if applicable.
+ * @see #setVerticalScrollbarPosition(int)
+ */
+ public int getVerticalScrollbarPosition() {
+ return mVerticalScrollbarPosition;
+ }
+
+ /**
* Register a callback to be invoked when focus of this view changed.
*
* @param l The callback that will run.
@@ -6542,7 +6594,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
(mAlpha >= 1.0f - ViewConfiguration.ALPHA_THRESHOLD);
}
- private void computeOpaqueFlags() {
+ /**
+ * @hide
+ */
+ protected void computeOpaqueFlags() {
// Opaque if:
// - Has a background
// - Background is opaque
@@ -6929,8 +6984,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
}
}
- private void recomputePadding() {
- setPadding(mPaddingLeft, mPaddingTop, mUserPaddingRight, mUserPaddingBottom);
+ /**
+ * @hide
+ */
+ protected void recomputePadding() {
+ setPadding(mUserPaddingLeft, mPaddingTop, mUserPaddingRight, mUserPaddingBottom);
}
/**
@@ -7213,8 +7271,16 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
scrollBar.setParameters(computeVerticalScrollRange(),
computeVerticalScrollOffset(),
computeVerticalScrollExtent(), true);
- // TODO: Deal with RTL languages to position scrollbar on left
- left = scrollX + width - size - (mUserPaddingRight & inside);
+ switch (mVerticalScrollbarPosition) {
+ default:
+ case SCROLLBAR_POSITION_DEFAULT:
+ case SCROLLBAR_POSITION_RIGHT:
+ left = scrollX + width - size - (mUserPaddingRight & inside);
+ break;
+ case SCROLLBAR_POSITION_LEFT:
+ left = scrollX + (mUserPaddingLeft & inside);
+ break;
+ }
top = scrollY + (mPaddingTop & inside);
right = left + size;
bottom = scrollY + height - (mUserPaddingBottom & inside);
@@ -9003,6 +9069,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
public void setPadding(int left, int top, int right, int bottom) {
boolean changed = false;
+ mUserPaddingLeft = left;
mUserPaddingRight = right;
mUserPaddingBottom = bottom;
@@ -9010,12 +9077,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
// Common case is there are no scroll bars.
if ((viewFlags & (SCROLLBARS_VERTICAL|SCROLLBARS_HORIZONTAL)) != 0) {
- // TODO: Deal with RTL languages to adjust left padding instead of right.
if ((viewFlags & SCROLLBARS_VERTICAL) != 0) {
- right += (viewFlags & SCROLLBARS_INSET_MASK) == 0
+ // TODO Determine what to do with SCROLLBAR_POSITION_DEFAULT based on RTL settings.
+ final int offset = (viewFlags & SCROLLBARS_INSET_MASK) == 0
? 0 : getVerticalScrollbarWidth();
+ switch (mVerticalScrollbarPosition) {
+ case SCROLLBAR_POSITION_DEFAULT:
+ case SCROLLBAR_POSITION_RIGHT:
+ right += offset;
+ break;
+ case SCROLLBAR_POSITION_LEFT:
+ left += offset;
+ break;
+ }
}
- if ((viewFlags & SCROLLBARS_HORIZONTAL) == 0) {
+ if ((viewFlags & SCROLLBARS_HORIZONTAL) != 0) {
bottom += (viewFlags & SCROLLBARS_INSET_MASK) == 0
? 0 : getHorizontalScrollbarHeight();
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 135ace6..e0043fa 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -744,6 +744,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
setChoiceMode(a.getInt(R.styleable.AbsListView_choiceMode, CHOICE_MODE_NONE));
+ setFastScrollAlwaysVisible(
+ a.getBoolean(R.styleable.AbsListView_fastScrollAlwaysVisible, false));
a.recycle();
}
@@ -1129,6 +1131,49 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
/**
+ * Set whether or not the fast scroller should always be shown in place of the
+ * standard scrollbars. Fast scrollers shown in this way will not fade out and will
+ * be a permanent fixture within the list. Best combined with an inset scroll bar style
+ * that will ensure enough padding. This will enable fast scrolling if it is not
+ * already enabled.
+ *
+ * @param alwaysShow true if the fast scroller should always be displayed.
+ * @see #setScrollBarStyle(int)
+ * @see #setFastScrollEnabled(boolean)
+ */
+ public void setFastScrollAlwaysVisible(boolean alwaysShow) {
+ if (alwaysShow && !mFastScrollEnabled) {
+ setFastScrollEnabled(true);
+ }
+
+ if (mFastScroller != null) {
+ mFastScroller.setAlwaysShow(alwaysShow);
+ }
+
+ computeOpaqueFlags();
+ recomputePadding();
+ }
+
+ /**
+ * Returns true if the fast scroller is set to always show on this view rather than
+ * fade out when not in use.
+ *
+ * @return true if the fast scroller will always show.
+ * @see #setFastScrollAlwaysVisible(boolean)
+ */
+ public boolean isFastScrollAlwaysVisible() {
+ return mFastScrollEnabled && mFastScroller.isAlwaysShowEnabled();
+ }
+
+ @Override
+ public int getVerticalScrollbarWidth() {
+ if (isEnabled()) {
+ return Math.max(super.getVerticalScrollbarWidth(), mFastScroller.getWidth());
+ }
+ return super.getVerticalScrollbarWidth();
+ }
+
+ /**
* Returns the current state of the fast scroll feature.
* @see #setFastScrollEnabled(boolean)
* @return true if fast scroll is enabled, false otherwise
@@ -1138,6 +1183,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
return mFastScrollEnabled;
}
+ @Override
+ public void setVerticalScrollbarPosition(int position) {
+ super.setVerticalScrollbarPosition(position);
+ if (mFastScroller != null) {
+ mFastScroller.setScrollbarPosition(position);
+ }
+ }
+
/**
* If fast scroll is visible, then don't draw the vertical scrollbar.
* @hide
@@ -1969,6 +2022,31 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
@Override
+ protected boolean isPaddingOffsetRequired() {
+ return (mGroupFlags & CLIP_TO_PADDING_MASK) != CLIP_TO_PADDING_MASK;
+ }
+
+ @Override
+ protected int getLeftPaddingOffset() {
+ return (mGroupFlags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK ? 0 : -mPaddingLeft;
+ }
+
+ @Override
+ protected int getTopPaddingOffset() {
+ return (mGroupFlags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK ? 0 : -mPaddingTop;
+ }
+
+ @Override
+ protected int getRightPaddingOffset() {
+ return (mGroupFlags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK ? 0 : mPaddingRight;
+ }
+
+ @Override
+ protected int getBottomPaddingOffset() {
+ return (mGroupFlags & CLIP_TO_PADDING_MASK) == CLIP_TO_PADDING_MASK ? 0 : mPaddingBottom;
+ }
+
+ @Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
if (getChildCount() > 0) {
mDataChanged = true;
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java
index aa68a74..f824ff4 100644
--- a/core/java/android/widget/FastScroller.java
+++ b/core/java/android/widget/FastScroller.java
@@ -22,12 +22,14 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
+import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.NinePatchDrawable;
import android.os.Handler;
import android.os.SystemClock;
-import android.util.TypedValue;
import android.view.MotionEvent;
+import android.view.View;
import android.widget.AbsListView.OnScrollListener;
/**
@@ -47,9 +49,38 @@ class FastScroller {
private static final int STATE_DRAGGING = 3;
// Scroll thumb fading out due to inactivity timeout
private static final int STATE_EXIT = 4;
+
+ private static final int[] PRESSED_STATES = new int[] {
+ android.R.attr.state_pressed
+ };
+
+ private static final int[] DEFAULT_STATES = new int[0];
+
+ private static final int[] ATTRS = new int[] {
+ android.R.attr.textColorPrimary,
+ com.android.internal.R.attr.fastScrollThumbDrawable,
+ com.android.internal.R.attr.fastScrollTrackDrawable,
+ com.android.internal.R.attr.fastScrollPreviewBackgroundLeft,
+ com.android.internal.R.attr.fastScrollPreviewBackgroundRight,
+ com.android.internal.R.attr.fastScrollOverlayPosition
+ };
+
+ private static final int PRIMARY_TEXT_COLOR = 0;
+ private static final int THUMB_DRAWABLE = 1;
+ private static final int TRACK_DRAWABLE = 2;
+ private static final int PREVIEW_BACKGROUND_LEFT = 3;
+ private static final int PREVIEW_BACKGROUND_RIGHT = 4;
+ private static final int OVERLAY_POSITION = 5;
+
+ private static final int OVERLAY_FLOATING = 0;
+ private static final int OVERLAY_AT_THUMB = 1;
private Drawable mThumbDrawable;
private Drawable mOverlayDrawable;
+ private Drawable mTrackDrawable;
+
+ private Drawable mOverlayDrawableLeft;
+ private Drawable mOverlayDrawableRight;
private int mThumbH;
private int mThumbW;
@@ -80,11 +111,64 @@ class FastScroller {
private boolean mChangedBounds;
+ private int mPosition;
+
+ private boolean mAlwaysShow;
+
+ private int mOverlayPosition;
+
+ private static final int FADE_TIMEOUT = 1500;
+
+ private final Rect mTmpRect = new Rect();
+
public FastScroller(Context context, AbsListView listView) {
mList = listView;
init(context);
}
+ public void setAlwaysShow(boolean alwaysShow) {
+ mAlwaysShow = alwaysShow;
+ if (alwaysShow) {
+ mHandler.removeCallbacks(mScrollFade);
+ setState(STATE_VISIBLE);
+ } else if (mState == STATE_VISIBLE) {
+ mHandler.postDelayed(mScrollFade, FADE_TIMEOUT);
+ }
+ }
+
+ public boolean isAlwaysShowEnabled() {
+ return mAlwaysShow;
+ }
+
+ private void refreshDrawableState() {
+ int[] state = mState == STATE_DRAGGING ? PRESSED_STATES : DEFAULT_STATES;
+
+ if (mThumbDrawable != null && mThumbDrawable.isStateful()) {
+ mThumbDrawable.setState(state);
+ }
+ if (mTrackDrawable != null && mTrackDrawable.isStateful()) {
+ mTrackDrawable.setState(state);
+ }
+ }
+
+ public void setScrollbarPosition(int position) {
+ mPosition = position;
+ switch (position) {
+ default:
+ case View.SCROLLBAR_POSITION_DEFAULT:
+ case View.SCROLLBAR_POSITION_RIGHT:
+ mOverlayDrawable = mOverlayDrawableRight;
+ break;
+ case View.SCROLLBAR_POSITION_LEFT:
+ mOverlayDrawable = mOverlayDrawableLeft;
+ break;
+ }
+ }
+
+ public int getWidth() {
+ return mThumbW;
+ }
+
public void setState(int state) {
switch (state) {
case STATE_NONE:
@@ -105,6 +189,7 @@ class FastScroller {
break;
}
mState = state;
+ refreshDrawableState();
}
public int getState() {
@@ -114,27 +199,42 @@ class FastScroller {
private void resetThumbPos() {
final int viewWidth = mList.getWidth();
// Bounds are always top right. Y coordinate get's translated during draw
- mThumbDrawable.setBounds(viewWidth - mThumbW, 0, viewWidth, mThumbH);
+ switch (mPosition) {
+ case View.SCROLLBAR_POSITION_DEFAULT:
+ case View.SCROLLBAR_POSITION_RIGHT:
+ mThumbDrawable.setBounds(viewWidth - mThumbW, 0, viewWidth, mThumbH);
+ break;
+ case View.SCROLLBAR_POSITION_LEFT:
+ mThumbDrawable.setBounds(0, 0, mThumbW, mThumbH);
+ break;
+ }
mThumbDrawable.setAlpha(ScrollFade.ALPHA_MAX);
}
private void useThumbDrawable(Context context, Drawable drawable) {
mThumbDrawable = drawable;
- mThumbW = context.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.fastscroll_thumb_width);
- mThumbH = context.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.fastscroll_thumb_height);
+ if (drawable instanceof NinePatchDrawable) {
+ mThumbW = context.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.fastscroll_thumb_width);
+ mThumbH = context.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.fastscroll_thumb_height);
+ } else {
+ mThumbW = drawable.getIntrinsicWidth();
+ mThumbH = drawable.getIntrinsicHeight();
+ }
mChangedBounds = true;
}
private void init(Context context) {
// Get both the scrollbar states drawables
final Resources res = context.getResources();
- useThumbDrawable(context, res.getDrawable(
- com.android.internal.R.drawable.scrollbar_handle_accelerated_anim2));
+ TypedArray ta = context.getTheme().obtainStyledAttributes(ATTRS);
+ useThumbDrawable(context, ta.getDrawable(ta.getIndex(THUMB_DRAWABLE)));
+ mTrackDrawable = ta.getDrawable(ta.getIndex(TRACK_DRAWABLE));
- mOverlayDrawable = res.getDrawable(
- com.android.internal.R.drawable.menu_submenu_background);
+ mOverlayDrawableLeft = ta.getDrawable(ta.getIndex(PREVIEW_BACKGROUND_LEFT));
+ mOverlayDrawableRight = ta.getDrawable(ta.getIndex(PREVIEW_BACKGROUND_RIGHT));
+ mOverlayPosition = ta.getInt(ta.getIndex(OVERLAY_POSITION), OVERLAY_FLOATING);
mScrollCompleted = true;
@@ -148,9 +248,8 @@ class FastScroller {
mPaint.setAntiAlias(true);
mPaint.setTextAlign(Paint.Align.CENTER);
mPaint.setTextSize(mOverlaySize / 2);
- TypedArray ta = context.getTheme().obtainStyledAttributes(new int[] {
- android.R.attr.textColorPrimary });
- ColorStateList textColor = ta.getColorStateList(ta.getIndex(0));
+
+ ColorStateList textColor = ta.getColorStateList(ta.getIndex(PRIMARY_TEXT_COLOR));
int textColorNormal = textColor.getDefaultColor();
mPaint.setColor(textColorNormal);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
@@ -161,6 +260,11 @@ class FastScroller {
}
mState = STATE_NONE;
+ refreshDrawableState();
+
+ ta.recycle();
+
+ setScrollbarPosition(mList.getVerticalScrollbarPosition());
}
void stop() {
@@ -188,23 +292,73 @@ class FastScroller {
if (alpha < ScrollFade.ALPHA_MAX / 2) {
mThumbDrawable.setAlpha(alpha * 2);
}
- int left = viewWidth - (mThumbW * alpha) / ScrollFade.ALPHA_MAX;
- mThumbDrawable.setBounds(left, 0, viewWidth, mThumbH);
+ int left = 0;
+ switch (mPosition) {
+ case View.SCROLLBAR_POSITION_DEFAULT:
+ case View.SCROLLBAR_POSITION_RIGHT:
+ left = viewWidth - (mThumbW * alpha) / ScrollFade.ALPHA_MAX;
+ break;
+ case View.SCROLLBAR_POSITION_LEFT:
+ left = -mThumbW + (mThumbW * alpha) / ScrollFade.ALPHA_MAX;
+ break;
+ }
+ mThumbDrawable.setBounds(left, 0, left + mThumbW, mThumbH);
mChangedBounds = true;
}
+ if (mTrackDrawable != null) {
+ final int left = mThumbDrawable.getBounds().left;
+ final int trackWidth = mTrackDrawable.getIntrinsicWidth();
+ final int trackLeft = (left + mThumbW) / 2 - trackWidth / 2;
+ mTrackDrawable.setBounds(trackLeft, 0, trackLeft + trackWidth, mList.getHeight());
+ mTrackDrawable.draw(canvas);
+ }
+
canvas.translate(0, y);
mThumbDrawable.draw(canvas);
canvas.translate(0, -y);
// If user is dragging the scroll bar, draw the alphabet overlay
if (mState == STATE_DRAGGING && mDrawOverlay) {
+ if (mOverlayPosition == OVERLAY_AT_THUMB) {
+ int left = 0;
+ switch (mPosition) {
+ default:
+ case View.SCROLLBAR_POSITION_DEFAULT:
+ case View.SCROLLBAR_POSITION_RIGHT:
+ left = Math.max(0,
+ mThumbDrawable.getBounds().left - mThumbW - mOverlaySize);
+ break;
+ case View.SCROLLBAR_POSITION_LEFT:
+ left = Math.min(mThumbDrawable.getBounds().right + mThumbW,
+ mList.getWidth() - mOverlaySize);
+ break;
+ }
+
+ int top = Math.max(0,
+ Math.min(y + (mThumbH - mOverlaySize) / 2, mList.getHeight() - mOverlaySize));
+
+ final RectF pos = mOverlayPos;
+ pos.left = left;
+ pos.right = pos.left + mOverlaySize;
+ pos.top = top;
+ pos.bottom = pos.top + mOverlaySize;
+ if (mOverlayDrawable != null) {
+ mOverlayDrawable.setBounds((int) pos.left, (int) pos.top,
+ (int) pos.right, (int) pos.bottom);
+ }
+ }
mOverlayDrawable.draw(canvas);
final Paint paint = mPaint;
float descent = paint.descent();
final RectF rectF = mOverlayPos;
- canvas.drawText(mSectionText, (int) (rectF.left + rectF.right) / 2,
- (int) (rectF.bottom + rectF.top) / 2 + mOverlaySize / 4 - descent, paint);
+ final Rect tmpRect = mTmpRect;
+ mOverlayDrawable.getPadding(tmpRect);
+ final int hOff = (tmpRect.right - tmpRect.left) / 2;
+ final int vOff = (tmpRect.bottom - tmpRect.top) / 2;
+ canvas.drawText(mSectionText, (int) (rectF.left + rectF.right) / 2 - hOff,
+ (int) (rectF.bottom + rectF.top) / 2 + mOverlaySize / 4 - descent - vOff,
+ paint);
} else if (mState == STATE_EXIT) {
if (alpha == 0) { // Done with exit
setState(STATE_NONE);
@@ -216,16 +370,27 @@ class FastScroller {
void onSizeChanged(int w, int h, int oldw, int oldh) {
if (mThumbDrawable != null) {
- mThumbDrawable.setBounds(w - mThumbW, 0, w, mThumbH);
+ switch (mPosition) {
+ default:
+ case View.SCROLLBAR_POSITION_DEFAULT:
+ case View.SCROLLBAR_POSITION_RIGHT:
+ mThumbDrawable.setBounds(w - mThumbW, 0, w, mThumbH);
+ break;
+ case View.SCROLLBAR_POSITION_LEFT:
+ mThumbDrawable.setBounds(0, 0, mThumbW, mThumbH);
+ break;
+ }
}
- final RectF pos = mOverlayPos;
- pos.left = (w - mOverlaySize) / 2;
- pos.right = pos.left + mOverlaySize;
- pos.top = h / 10; // 10% from top
- pos.bottom = pos.top + mOverlaySize;
- if (mOverlayDrawable != null) {
- mOverlayDrawable.setBounds((int) pos.left, (int) pos.top,
- (int) pos.right, (int) pos.bottom);
+ if (mOverlayPosition == OVERLAY_FLOATING) {
+ final RectF pos = mOverlayPos;
+ pos.left = (w - mOverlaySize) / 2;
+ pos.right = pos.left + mOverlaySize;
+ pos.top = h / 10; // 10% from top
+ pos.bottom = pos.top + mOverlaySize;
+ if (mOverlayDrawable != null) {
+ mOverlayDrawable.setBounds((int) pos.left, (int) pos.top,
+ (int) pos.right, (int) pos.bottom);
+ }
}
}
@@ -257,7 +422,9 @@ class FastScroller {
mVisibleItem = firstVisibleItem;
if (mState != STATE_DRAGGING) {
setState(STATE_VISIBLE);
- mHandler.postDelayed(mScrollFade, 1500);
+ if (!mAlwaysShow) {
+ mHandler.postDelayed(mScrollFade, FADE_TIMEOUT);
+ }
}
}
@@ -454,7 +621,11 @@ class FastScroller {
setState(STATE_VISIBLE);
final Handler handler = mHandler;
handler.removeCallbacks(mScrollFade);
- handler.postDelayed(mScrollFade, 1000);
+ if (!mAlwaysShow) {
+ handler.postDelayed(mScrollFade, 1000);
+ }
+
+ mList.invalidate();
return true;
}
} else if (action == MotionEvent.ACTION_MOVE) {
@@ -482,7 +653,20 @@ class FastScroller {
}
boolean isPointInside(float x, float y) {
- return x > mList.getWidth() - mThumbW && y >= mThumbY && y <= mThumbY + mThumbH;
+ boolean inTrack = false;
+ switch (mPosition) {
+ default:
+ case View.SCROLLBAR_POSITION_DEFAULT:
+ case View.SCROLLBAR_POSITION_RIGHT:
+ inTrack = x > mList.getWidth() - mThumbW;
+ break;
+ case View.SCROLLBAR_POSITION_LEFT:
+ inTrack = x < mThumbW;
+ break;
+ }
+
+ // Allow taps in the track to start moving.
+ return inTrack && (mTrackDrawable != null || y >= mThumbY && y <= mThumbY + mThumbH);
}
public class ScrollFade implements Runnable {
diff --git a/core/res/res/drawable-hdpi/btn_cab_done_default_holo.9.png b/core/res/res/drawable-hdpi/btn_cab_done_default_holo.9.png
index 76fd173..c66716f 100644
--- a/core/res/res/drawable-hdpi/btn_cab_done_default_holo.9.png
+++ b/core/res/res/drawable-hdpi/btn_cab_done_default_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_cab_done_focused_holo.9.png b/core/res/res/drawable-hdpi/btn_cab_done_focused_holo.9.png
index 43552d6..0f1d9a0 100644
--- a/core/res/res/drawable-hdpi/btn_cab_done_focused_holo.9.png
+++ b/core/res/res/drawable-hdpi/btn_cab_done_focused_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_cab_done_pressed_holo.9.png b/core/res/res/drawable-hdpi/btn_cab_done_pressed_holo.9.png
index 39ce7a2..391227e 100644
--- a/core/res/res/drawable-hdpi/btn_cab_done_pressed_holo.9.png
+++ b/core/res/res/drawable-hdpi/btn_cab_done_pressed_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png
index ea8b169..8695c2c 100644
--- a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png
index ea8b169..ea187fb 100644
--- a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png
index f3a73cc..e54105d 100644
--- a/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png
index f3a73cc..0f1fa81 100644
--- a/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png
index 802865c..14e7608 100644
--- a/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png
index 802865c..e65dcea 100644
--- a/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png
index c9d61f8..3e83236 100644
--- a/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png
index c9d61f8..aa4b7ea 100644
--- a/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png
index 9fb72fe..f1eb741 100644
--- a/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png
index 9fb72fe..f1eb741 100644
--- a/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/divider_strong_holo.9.png b/core/res/res/drawable-hdpi/divider_strong_holo.9.png
new file mode 100644
index 0000000..0758593
--- /dev/null
+++ b/core/res/res/drawable-hdpi/divider_strong_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_label_left_holo_dark.9.png b/core/res/res/drawable-hdpi/fastscroll_label_left_holo_dark.9.png
new file mode 100644
index 0000000..3eb81a1
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_label_left_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_label_left_holo_light.9.png b/core/res/res/drawable-hdpi/fastscroll_label_left_holo_light.9.png
new file mode 100644
index 0000000..cc14a63
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_label_left_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_label_right_holo_dark.9.png b/core/res/res/drawable-hdpi/fastscroll_label_right_holo_dark.9.png
new file mode 100644
index 0000000..c59f135
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_label_right_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_label_right_holo_light.9.png b/core/res/res/drawable-hdpi/fastscroll_label_right_holo_light.9.png
new file mode 100644
index 0000000..054707d
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_label_right_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_thumb_default_holo.png b/core/res/res/drawable-hdpi/fastscroll_thumb_default_holo.png
new file mode 100644
index 0000000..bc960ab
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_thumb_default_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_thumb_pressed_holo.png b/core/res/res/drawable-hdpi/fastscroll_thumb_pressed_holo.png
new file mode 100644
index 0000000..f850e9e
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_thumb_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_track_default_holo_dark.9.png b/core/res/res/drawable-hdpi/fastscroll_track_default_holo_dark.9.png
new file mode 100644
index 0000000..9e10a29
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_track_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_track_default_holo_light.9.png b/core/res/res/drawable-hdpi/fastscroll_track_default_holo_light.9.png
new file mode 100644
index 0000000..9e10a29
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_track_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_track_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/fastscroll_track_pressed_holo_dark.9.png
new file mode 100644
index 0000000..be260dd
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_track_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/fastscroll_track_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/fastscroll_track_pressed_holo_light.9.png
new file mode 100644
index 0000000..be260dd
--- /dev/null
+++ b/core/res/res/drawable-hdpi/fastscroll_track_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png
index f71e628..52fccf8 100644
--- a/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png
+++ b/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png
index 9ba60cc..0354599 100644
--- a/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png
+++ b/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_cab_close_holo.png b/core/res/res/drawable-hdpi/ic_cab_close_holo.png
index 4ab4dd5..0dcd54c 100644
--- a/core/res/res/drawable-hdpi/ic_cab_close_holo.png
+++ b/core/res/res/drawable-hdpi/ic_cab_close_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrollbar_handle_holo_dark.9.png b/core/res/res/drawable-hdpi/scrollbar_handle_holo_dark.9.png
new file mode 100644
index 0000000..575edee
--- /dev/null
+++ b/core/res/res/drawable-hdpi/scrollbar_handle_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrollbar_handle_holo_light.9.png b/core/res/res/drawable-hdpi/scrollbar_handle_holo_light.9.png
new file mode 100644
index 0000000..575edee
--- /dev/null
+++ b/core/res/res/drawable-hdpi/scrollbar_handle_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_cab_done_default_holo.9.png b/core/res/res/drawable-mdpi/btn_cab_done_default_holo.9.png
index af5d130..3a113ee 100644
--- a/core/res/res/drawable-mdpi/btn_cab_done_default_holo.9.png
+++ b/core/res/res/drawable-mdpi/btn_cab_done_default_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_cab_done_focused_holo.9.png b/core/res/res/drawable-mdpi/btn_cab_done_focused_holo.9.png
index e49943e..8496965 100644
--- a/core/res/res/drawable-mdpi/btn_cab_done_focused_holo.9.png
+++ b/core/res/res/drawable-mdpi/btn_cab_done_focused_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_cab_done_pressed_holo.9.png b/core/res/res/drawable-mdpi/btn_cab_done_pressed_holo.9.png
index b83b4ec..dc70c6a 100644
--- a/core/res/res/drawable-mdpi/btn_cab_done_pressed_holo.9.png
+++ b/core/res/res/drawable-mdpi/btn_cab_done_pressed_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png
index c7c35af..537ac1a 100644
--- a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png
index c7c35af..947715c 100644
--- a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png
index 6a571ad..8e34d33 100644
--- a/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png
index 6a571ad..8262a03 100644
--- a/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png
index a6f4112..8cca841 100644
--- a/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png
index a6f4112..5032ed1 100644
--- a/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png
index 9a8174b..d608e44 100644
--- a/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png
index 9a8174b..6ab589d 100644
--- a/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png
index 7477443..40957ee 100644
--- a/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png
index 7477443..40957ee 100644
--- a/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/divider_strong_holo.9.png b/core/res/res/drawable-mdpi/divider_strong_holo.9.png
new file mode 100644
index 0000000..0758593
--- /dev/null
+++ b/core/res/res/drawable-mdpi/divider_strong_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_label_left_holo_dark.9.png b/core/res/res/drawable-mdpi/fastscroll_label_left_holo_dark.9.png
new file mode 100644
index 0000000..0dce616
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_label_left_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_label_left_holo_light.9.png b/core/res/res/drawable-mdpi/fastscroll_label_left_holo_light.9.png
new file mode 100644
index 0000000..e1028cc
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_label_left_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_label_right_holo_dark.9.png b/core/res/res/drawable-mdpi/fastscroll_label_right_holo_dark.9.png
new file mode 100644
index 0000000..b6b68ea
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_label_right_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_label_right_holo_light.9.png b/core/res/res/drawable-mdpi/fastscroll_label_right_holo_light.9.png
new file mode 100644
index 0000000..5087013
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_label_right_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_thumb_default_holo.png b/core/res/res/drawable-mdpi/fastscroll_thumb_default_holo.png
new file mode 100644
index 0000000..bfb55bd
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_thumb_default_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_thumb_pressed_holo.png b/core/res/res/drawable-mdpi/fastscroll_thumb_pressed_holo.png
new file mode 100644
index 0000000..89d9b01
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_thumb_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_track_default_holo_dark.9.png b/core/res/res/drawable-mdpi/fastscroll_track_default_holo_dark.9.png
new file mode 100644
index 0000000..cf8c4bb
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_track_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_track_default_holo_light.9.png b/core/res/res/drawable-mdpi/fastscroll_track_default_holo_light.9.png
new file mode 100644
index 0000000..cf8c4bb
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_track_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_track_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/fastscroll_track_pressed_holo_dark.9.png
new file mode 100644
index 0000000..fef2168
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_track_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/fastscroll_track_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/fastscroll_track_pressed_holo_light.9.png
new file mode 100644
index 0000000..fef2168
--- /dev/null
+++ b/core/res/res/drawable-mdpi/fastscroll_track_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png
index 938f502..959b4e4 100644
--- a/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png
+++ b/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png
index 3c14ec2..41333b8 100644
--- a/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png
+++ b/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_cab_close_holo.png b/core/res/res/drawable-mdpi/ic_cab_close_holo.png
index ec63097..135577e 100644
--- a/core/res/res/drawable-mdpi/ic_cab_close_holo.png
+++ b/core/res/res/drawable-mdpi/ic_cab_close_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrollbar_handle_holo_dark.9.png b/core/res/res/drawable-mdpi/scrollbar_handle_holo_dark.9.png
new file mode 100644
index 0000000..e039c4b
--- /dev/null
+++ b/core/res/res/drawable-mdpi/scrollbar_handle_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrollbar_handle_holo_light.9.png b/core/res/res/drawable-mdpi/scrollbar_handle_holo_light.9.png
new file mode 100644
index 0000000..e039c4b
--- /dev/null
+++ b/core/res/res/drawable-mdpi/scrollbar_handle_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable/fastscroll_thumb_holo.xml b/core/res/res/drawable/fastscroll_thumb_holo.xml
new file mode 100644
index 0000000..9d4a787
--- /dev/null
+++ b/core/res/res/drawable/fastscroll_thumb_holo.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true" android:drawable="@drawable/fastscroll_thumb_pressed_holo" />
+ <item android:drawable="@drawable/fastscroll_thumb_default_holo" />
+</selector>
diff --git a/core/res/res/drawable/fastscroll_track_holo_dark.xml b/core/res/res/drawable/fastscroll_track_holo_dark.xml
new file mode 100644
index 0000000..4798a0d
--- /dev/null
+++ b/core/res/res/drawable/fastscroll_track_holo_dark.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true" android:drawable="@drawable/fastscroll_track_pressed_holo_dark" />
+ <item android:drawable="@drawable/fastscroll_track_default_holo_dark" />
+</selector>
diff --git a/core/res/res/drawable/fastscroll_track_holo_light.xml b/core/res/res/drawable/fastscroll_track_holo_light.xml
new file mode 100644
index 0000000..120e652
--- /dev/null
+++ b/core/res/res/drawable/fastscroll_track_holo_light.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true" android:drawable="@drawable/fastscroll_track_pressed_holo_light" />
+ <item android:drawable="@drawable/fastscroll_track_default_holo_light" />
+</selector>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 6309256..f399578 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -519,6 +519,21 @@
<!-- @hide DayPickerDayView style-->
<attr name="dayPickerWeekDayViewStyle" format="reference" />
+ <!-- Fast scroller styles -->
+ <!-- @hide -->
+ <attr name="fastScrollThumbDrawable" format="reference" />
+ <!-- @hide -->
+ <attr name="fastScrollPreviewBackgroundRight" format="reference" />
+ <!-- @hide -->
+ <attr name="fastScrollPreviewBackgroundLeft" format="reference" />
+ <!-- @hide -->
+ <attr name="fastScrollTrackDrawable" format="reference" />
+ <!-- @hide -->
+ <attr name="fastScrollOverlayPosition">
+ <enum name="floating" value="0" />
+ <enum name="atThumb" value="1" />
+ </attr>
+
<!-- =================== -->
<!-- Action bar styles -->
<!-- =================== -->
@@ -1735,6 +1750,15 @@
<!-- scale of the view in the y direction. -->
<attr name="scaleY" format="float" />
+ <!-- Determines which side the vertical scroll bar should be placed on. -->
+ <attr name="verticalScrollbarPosition">
+ <!-- Place the scroll bar wherever the system default determines. -->
+ <enum name="defaultPosition" value="0" />
+ <!-- Place the scroll bar on the left. -->
+ <enum name="left" value="1" />
+ <!-- Place the scroll bar on the right. -->
+ <enum name="right" value="2" />
+ </attr>
</declare-styleable>
<!-- Attributes that can be used with a {@link android.view.ViewGroup} or any
@@ -2004,6 +2028,10 @@
<!-- The list allows multiple choices in a custom selection mode. -->
<enum name="multipleChoiceModal" value="3" />
</attr>
+
+ <!-- When set to true, the list will always show the fast scroll interface.
+ This setting implies fastScrollEnabled. -->
+ <attr name="fastScrollAlwaysVisible" format="boolean" />
</declare-styleable>
<declare-styleable name="AbsSpinner">
<!-- Reference to an array resource that will populate the Spinner. For static content,
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 95ffac2..1f9cb6d 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1401,6 +1401,8 @@
<public type="attr" name="staticWallpaperPreview" />
<public type="attr" name="allowParallelSyncs" />
<public type="attr" name="isAlwaysSyncable" />
+ <public type="attr" name="verticalScrollbarPosition" />
+ <public type="attr" name="fastScrollAlwaysVisible" />
<public type="anim" name="animator_fade_in" />
<public type="anim" name="animator_fade_out" />
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 94e8f96..4d30a68 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -286,6 +286,11 @@
<!-- DayPickerWeekDayView style-->
<item name="dayPickerWeekDayViewStyle">@style/TextAppearance.Small.DayPickerWeekDayView</item>
+ <item name="fastScrollThumbDrawable">@android:drawable/scrollbar_handle_accelerated_anim2</item>
+ <item name="fastScrollPreviewBackgroundRight">@android:drawable/menu_submenu_background</item>
+ <item name="fastScrollPreviewBackgroundLeft">@android:drawable/menu_submenu_background</item>
+ <item name="fastScrollOverlayPosition">floating</item>
+
</style>
<!-- Variant of the default (dark) theme with no title bar -->
@@ -812,8 +817,8 @@
<item name="scrollbarFadeDuration">250</item>
<item name="scrollbarDefaultDelayBeforeFade">300</item>
<item name="scrollbarSize">10dip</item>
- <item name="scrollbarThumbHorizontal">@android:drawable/scrollbar_handle_horizontal</item>
- <item name="scrollbarThumbVertical">@android:drawable/scrollbar_handle_vertical</item>
+ <item name="scrollbarThumbHorizontal">@android:drawable/scrollbar_handle_holo_dark</item>
+ <item name="scrollbarThumbVertical">@android:drawable/scrollbar_handle_holo_dark</item>
<item name="scrollbarTrackHorizontal">@null</item>
<item name="scrollbarTrackVertical">@null</item>
@@ -929,6 +934,12 @@
<!-- DayPickerWeekDayView style-->
<item name="dayPickerWeekDayViewStyle">@style/TextAppearance.Holo.DayPickerWeekDayView</item>
+ <item name="fastScrollThumbDrawable">@android:drawable/fastscroll_thumb_holo</item>
+ <item name="fastScrollPreviewBackgroundLeft">@android:drawable/fastscroll_label_left_holo_dark</item>
+ <item name="fastScrollPreviewBackgroundRight">@android:drawable/fastscroll_label_right_holo_dark</item>
+ <item name="fastScrollTrackDrawable">@android:drawable/fastscroll_track_holo_dark</item>
+ <item name="fastScrollOverlayPosition">atThumb</item>
+
</style>
<!-- New Honeycomb holographic theme. Light version. The widgets in the
@@ -1066,8 +1077,8 @@
<item name="scrollbarFadeDuration">250</item>
<item name="scrollbarDefaultDelayBeforeFade">300</item>
<item name="scrollbarSize">10dip</item>
- <item name="scrollbarThumbHorizontal">@android:drawable/scrollbar_handle_horizontal</item>
- <item name="scrollbarThumbVertical">@android:drawable/scrollbar_handle_vertical</item>
+ <item name="scrollbarThumbHorizontal">@android:drawable/scrollbar_handle_holo_light</item>
+ <item name="scrollbarThumbVertical">@android:drawable/scrollbar_handle_holo_light</item>
<item name="scrollbarTrackHorizontal">@null</item>
<item name="scrollbarTrackVertical">@null</item>
@@ -1180,6 +1191,12 @@
<!-- DayPickerWeekDayView style-->
<item name="dayPickerWeekDayViewStyle">@style/TextAppearance.Holo.Light.DayPickerWeekDayView</item>
+ <item name="fastScrollThumbDrawable">@android:drawable/fastscroll_thumb_holo</item>
+ <item name="fastScrollPreviewBackgroundLeft">@android:drawable/fastscroll_label_left_holo_light</item>
+ <item name="fastScrollPreviewBackgroundRight">@android:drawable/fastscroll_label_right_holo_light</item>
+ <item name="fastScrollTrackDrawable">@android:drawable/fastscroll_track_holo_light</item>
+ <item name="fastScrollOverlayPosition">atThumb</item>
+
</style>
<!-- Development legacy name; if you're using this, switch. -->