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

Commit 6e74eecb authored by Brian Attwell's avatar Brian Attwell Committed by Android Git Automerger
Browse files

am 8bd49e40: Merge "Don\'t save scroll position inside nested scroller" into lmp-dev

* commit '8bd49e40':
  Don't save scroll position inside nested scroller
parents 2cc1ba71 8bd49e40
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
package com.android.contacts.widget;

import android.content.Context;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;
@@ -9,7 +10,7 @@ import android.widget.ScrollView;
 * A {@link ScrollView} that doesn't respond or intercept touch events.
 *
 * This is used in combination with {@link com.android.contacts.widget.MultiShrinkScroller} so
 * that MultiShrinkScroller can handle all scrolling.
 * that MultiShrinkScroller can handle all scrolling & saving.
 */
public class TouchlessScrollView extends ScrollView {

@@ -25,6 +26,17 @@ public class TouchlessScrollView extends ScrollView {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected Parcelable onSaveInstanceState() {
        // Do not save the current scroll position. Always store scrollY=0 and delegate
        // responsibility of saving state to the MultiShrinkScroller.
        final int scrollY = getScrollY();
        setScrollY(0);
        final Parcelable returnValue = super.onSaveInstanceState();
        setScrollY(scrollY);
        return returnValue;
    }

    /**
     * {@inheritDoc}
     */