Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a79f7c1 authored by Robert Burns's avatar Robert Burns Committed by Steve Kondik
Browse files

Added the overscrolling bounce/weight as a preference

Change-Id: I544bc4216304d059b84e96fcafbbf849d6737324
parent dc55b05d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2353,6 +2353,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.
+20 −2
Original line number Diff line number Diff line
@@ -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();
    }

    /**
@@ -1293,6 +1295,22 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        return mListPadding.right;
    }

    /**
     * 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
@@ -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;
        }