summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout-land/launcher.xml2
-rw-r--r--res/layout-port/launcher.xml2
-rw-r--r--res/layout-sw720dp/launcher.xml2
-rw-r--r--res/layout/apps_customize_pane.xml13
-rw-r--r--res/values/attrs.xml2
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedView.java60
6 files changed, 61 insertions, 20 deletions
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index 91fdf45e2..d84ffaa85 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -52,7 +52,7 @@
android:layout_marginRight="@dimen/button_bar_height"
android:layout_gravity="right" />
<include
- android:id="@+id/paged_view_indicator"
+ android:id="@+id/paged_view_indicator_horizontal"
layout="@layout/scroll_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index c1afe11c7..bee7716fc 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -45,7 +45,7 @@
android:layout_marginBottom="@dimen/button_bar_height"
android:layout_gravity="bottom" />
<include
- android:id="@+id/paged_view_indicator"
+ android:id="@+id/paged_view_indicator_horizontal"
layout="@layout/scroll_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/res/layout-sw720dp/launcher.xml b/res/layout-sw720dp/launcher.xml
index 0e7f5fa49..963116231 100644
--- a/res/layout-sw720dp/launcher.xml
+++ b/res/layout-sw720dp/launcher.xml
@@ -53,7 +53,7 @@
android:layout_marginBottom="@dimen/button_bar_height_plus_padding"
android:layout_gravity="bottom|center_horizontal" />
<include
- android:id="@+id/paged_view_indicator"
+ android:id="@+id/paged_view_indicator_horizontal"
layout="@layout/scroll_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index a833611fc..27534082b 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -78,11 +78,20 @@
android:visibility="gone" />
<include
- android:id="@+id/paged_view_indicator"
+ android:id="@+id/paged_view_indicator_horizontal"
layout="@layout/scroll_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
+ android:layout_gravity="bottom"
+ android:visibility="gone" />
+
+ <include
+ android:id="@+id/paged_view_indicator_vertical"
+ layout="@layout/scroll_indicator"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right"
+ android:visibility="gone" />
</FrameLayout>
</LinearLayout>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index f8fbf21d1..ffe202f3b 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -106,7 +106,9 @@
<attr name="pageSpacing" format="dimension" />
<!-- The padding for the scroll indicator area -->
<attr name="scrollIndicatorPaddingLeft" format="dimension" />
+ <attr name="scrollIndicatorPaddingTop" format="dimension" />
<attr name="scrollIndicatorPaddingRight" format="dimension" />
+ <attr name="scrollIndicatorPaddingBottom" format="dimension" />
</declare-styleable>
<!-- AppsCustomizePagedView specific attributes. These attributes are used to
diff --git a/src/com/cyanogenmod/trebuchet/PagedView.java b/src/com/cyanogenmod/trebuchet/PagedView.java
index 1db5fc1e4..390b7e4aa 100644
--- a/src/com/cyanogenmod/trebuchet/PagedView.java
+++ b/src/com/cyanogenmod/trebuchet/PagedView.java
@@ -189,7 +189,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
private ValueAnimator mScrollIndicatorAnimator;
private View mScrollIndicator;
private int mScrollIndicatorPaddingLeft;
+ private int mScrollIndicatorPaddingTop;
private int mScrollIndicatorPaddingRight;
+ private int mScrollIndicatorPaddingBottom;
private boolean mHasScrollIndicator = true;
private boolean mShouldShowScrollIndicator = false;
private boolean mShouldShowScrollIndicatorImmediately = false;
@@ -234,8 +236,12 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
R.styleable.PagedView_pageLayoutHeightGap, 0);
mScrollIndicatorPaddingLeft =
a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingLeft, 0);
+ mScrollIndicatorPaddingTop =
+ a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingTop, 0);
mScrollIndicatorPaddingRight =
a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingRight, 0);
+ mScrollIndicatorPaddingBottom =
+ a.getDimensionPixelSize(R.styleable.PagedView_scrollIndicatorPaddingBottom, 0);
a.recycle();
setHapticFeedbackEnabled(false);
@@ -1973,7 +1979,11 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (mHasScrollIndicator && mScrollIndicator == null) {
ViewGroup parent = (ViewGroup) getParent();
if (parent != null) {
- mScrollIndicator = (View) (parent.findViewById(R.id.paged_view_indicator));
+ if (!mVertical) {
+ mScrollIndicator = (View) parent.findViewById(R.id.paged_view_indicator_horizontal);
+ } else {
+ mScrollIndicator = (View) parent.findViewById(R.id.paged_view_indicator_vertical);
+ }
mHasScrollIndicator = mScrollIndicator != null;
if (mHasScrollIndicator) {
mScrollIndicator.setVisibility(View.VISIBLE);
@@ -2113,23 +2123,43 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
int pageSize = !mVertical ? getMeasuredWidth() : getMeasuredHeight();
int lastChildIndex = Math.max(0, getChildCount() - 1);
int maxScroll = getChildOffset(lastChildIndex) - getRelativeChildOffset(lastChildIndex);
- int trackWidth = getMeasuredWidth() - mScrollIndicatorPaddingLeft - mScrollIndicatorPaddingRight;
- int indicatorWidth = mScrollIndicator.getMeasuredWidth() -
- mScrollIndicator.getPaddingLeft() - mScrollIndicator.getPaddingRight();
-
- float offset = Math.max(0f, Math.min(1f, (float) (!mVertical ? getScrollX() : getScrollY()) / maxScroll));
- int indicatorSpace = trackWidth / numPages;
- int indicatorPos = (int) (offset * (trackWidth - indicatorSpace)) + mScrollIndicatorPaddingLeft;
- if (hasElasticScrollIndicator()) {
- if (mScrollIndicator.getMeasuredWidth() != indicatorSpace) {
- mScrollIndicator.getLayoutParams().width = indicatorSpace;
- mScrollIndicator.requestLayout();
+ if (!mVertical) {
+ int trackWidth = pageSize - mScrollIndicatorPaddingLeft - mScrollIndicatorPaddingRight;
+ int indicatorWidth = mScrollIndicator.getMeasuredWidth() -
+ mScrollIndicator.getPaddingLeft() - mScrollIndicator.getPaddingRight();
+
+ float offset = Math.max(0f, Math.min(1f, (float) getScrollX() / maxScroll));
+ int indicatorSpace = trackWidth / numPages;
+ int indicatorPos = (int) (offset * (trackWidth - indicatorSpace)) + mScrollIndicatorPaddingLeft;
+ if (hasElasticScrollIndicator()) {
+ if (mScrollIndicator.getMeasuredWidth() != indicatorSpace) {
+ mScrollIndicator.getLayoutParams().width = indicatorSpace;
+ mScrollIndicator.requestLayout();
+ }
+ } else {
+ int indicatorCenterOffset = indicatorSpace / 2 - indicatorWidth / 2;
+ indicatorPos += indicatorCenterOffset;
}
+ mScrollIndicator.setTranslationX(indicatorPos);
} else {
- int indicatorCenterOffset = indicatorSpace / 2 - indicatorWidth / 2;
- indicatorPos += indicatorCenterOffset;
+ int trackHeight = pageSize - mScrollIndicatorPaddingTop - mScrollIndicatorPaddingBottom;
+ int indicatorHeight = mScrollIndicator.getMeasuredHeight() -
+ mScrollIndicator.getPaddingTop() - mScrollIndicator.getPaddingBottom();
+
+ float offset = Math.max(0f, Math.min(1f, (float) getScrollY() / maxScroll));
+ int indicatorSpace = trackHeight / numPages;
+ int indicatorPos = (int) (offset * (trackHeight - indicatorSpace)) + mScrollIndicatorPaddingTop;
+ if (hasElasticScrollIndicator()) {
+ if (mScrollIndicator.getMeasuredHeight() != indicatorSpace) {
+ mScrollIndicator.getLayoutParams().height = indicatorSpace;
+ mScrollIndicator.requestLayout();
+ }
+ } else {
+ int indicatorCenterOffset = indicatorSpace / 2 - indicatorHeight / 2;
+ indicatorPos += indicatorCenterOffset;
+ }
+ mScrollIndicator.setTranslationY(indicatorPos);
}
- mScrollIndicator.setTranslationX(indicatorPos);
}
public void showScrollIndicatorTrack() {