diff options
-rw-r--r-- | core/java/android/provider/Settings.java | 6 | ||||
-rw-r--r-- | core/java/android/widget/AbsListView.java | 22 |
2 files changed, 26 insertions, 2 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 3582981..8614862 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2354,6 +2354,12 @@ public final class Settings { public static final String ALLOW_OVERSCROLL = "allow_overscroll"; /** + * Sets the overscroller weight (edge bounce effect on lists) + * @hide + */ + public static final String OVERSCROLL_WEIGHT = "overscroll_weight"; + + /** * Settings to backup. This is here so that it's in the same place as the settings * keys and easy to update. * @hide diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 6e224e5..29d3be3 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -51,6 +51,8 @@ import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnectionWrapper; import android.view.inputmethod.InputMethodManager; +import android.provider.Settings; + import java.util.ArrayList; import java.util.List; @@ -1172,7 +1174,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te layoutChildren(); mInLayout = false; - mOverscrollMax = (b - t) / OVERSCROLL_LIMIT_DIVISOR; + mOverscrollMax = (b - t) / getOverscrollWeight(); } /** @@ -1294,6 +1296,22 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } /** + * Returns the overscroll weight for this view + * + * @return This view's overscroll weight. + */ + public int getOverscrollWeight() { + int weight = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.OVERSCROLL_WEIGHT, 0); + + if (weight == 0) { + return OVERSCROLL_LIMIT_DIVISOR; + } else { + return weight; + } + } + + /** * Get a view and have it show the data associated with the specified * position. This is called when we have already discovered that the view is * not available for reuse in the recycle bin. The only choices left are @@ -2407,7 +2425,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te final int childCount = getChildCount(); if (childCount > 0) { return Math.min(mOverscrollMax, - getChildAt(childCount - 1).getBottom() / OVERSCROLL_LIMIT_DIVISOR); + getChildAt(childCount - 1).getBottom() / getOverscrollWeight()); } else { return mOverscrollMax; } |