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

Commit bc5d6238 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Widgets tray should preserve scroll position during screen rotation

> This used to work, but when I got rid of preloading which was
handled by linear manager to increase scrolling speed, the save
and restore instance that was being handled by the linear layout
manager created using Launcher context also went away. Hence,
bringing back custom LinearLayoutManager.

Change-Id: Ibccdf80533a5ace06cc6c6932b257c223cbac0ff
parent 9345ebfc
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -1961,9 +1961,6 @@ public class Launcher extends Activity
            outState.putInt(RUNTIME_STATE_PENDING_ADD_WIDGET_ID, mPendingAddWidgetId);
        }

        // Save the current widgets tray?
        // TODO(hyunyoungs)

        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onSaveInstanceState(outState);
        }
+3 −1
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.support.v7.widget.LinearLayoutManager;
import android.util.AttributeSet;
import android.view.View;
import com.android.launcher3.BaseRecyclerView;
import com.android.launcher3.R;
import com.android.launcher3.model.PackageItemInfo;
import com.android.launcher3.model.WidgetsModel;

@@ -58,6 +57,9 @@ public class WidgetsRecyclerView extends BaseRecyclerView {
    protected void onFinishInflate() {
        super.onFinishInflate();
        addOnItemTouchListener(this);
        // create a layout manager with Launcher's context so that scroll position
        // can be preserved during screen rotation.
        setLayoutManager(new LinearLayoutManager(getContext()));
    }

    public int getFastScrollerTrackColor(int defaultTrackColor) {