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

Commit 17dfec71 authored by Jim Miller's avatar Jim Miller
Browse files

Fix 4689527: Fix positioning bug with RecentHorizontalScrollView, minor tweaks.

This fixes a bug where RecentsHorizontalScrollView wasn't scrolling to the most
recent app.

Contains some minor tweaks to the layout so that it doesn't overlap the notification
bad as well as starting alpha fades while draging items sooner.

Change-Id: I94df309673f316c55b2f44aff60fd3aee746b6de
parent b7440a14
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -29,21 +29,17 @@
        android:background="@drawable/status_bar_recents_background"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:paddingBottom="@*android:dimen/status_bar_height"
        android:clipToPadding="false"
        android:clipChildren="false">
        android:layout_alignParentBottom="true">

        <LinearLayout android:id="@+id/recents_glow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="0dp"
            android:layout_gravity="bottom"
            android:orientation="horizontal"
            android:clipToPadding="false"
            android:clipChildren="false"
            >
            <com.android.systemui.recent.RecentsVerticalScrollView android:id="@+id/recents_container"
            android:layout_marginTop="@*android:dimen/status_bar_height">
            <com.android.systemui.recent.RecentsVerticalScrollView
                android:id="@+id/recents_container"
                android:layout_width="@dimen/status_bar_recents_width"
                android:layout_height="wrap_content"
                android:layout_marginRight="0dp"
@@ -51,7 +47,7 @@
                android:stackFromBottom="true"
                android:fadingEdge="vertical"
                android:scrollbars="none"
                android:fadingEdgeLength="20dip"
                android:fadingEdgeLength="@*android:dimen/status_bar_height"
                android:listSelector="@drawable/recents_thumbnail_bg_selector"
                android:layout_gravity="bottom|left"
                android:clipToPadding="false"
+2 −1
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@ package com.android.systemui.recent;

public class Constants {
    static final int MAX_ESCAPE_ANIMATION_DURATION = 500; // in ms
    static final float FADE_CONSTANT = 0.5f; // unitless
    static final int SNAP_BACK_DURATION = 250; // in ms
    static final int ESCAPE_VELOCITY = 100; // speed of item required to "curate" it in dp/s
    public static float ALPHA_FADE_START = 0.8f; // fraction of thumbnail width where fade starts
    static final float ALPHA_FADE_END = 0.5f; // fraction of thumbnail width beyond which alpha->0
}
+6 −6
Original line number Diff line number Diff line
@@ -118,12 +118,12 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
    }

    private float getAlphaForOffset(View view, float thumbHeight) {
        final float fadeHeight = Constants.FADE_CONSTANT * thumbHeight;
        final float fadeHeight = Constants.ALPHA_FADE_END * thumbHeight;
        float result = 1.0f;
        if (view.getY() >= thumbHeight) {
            result = 1.0f - (view.getY() - thumbHeight) / fadeHeight;
        } else if (view.getY() < 0.0f) {
            result = 1.0f + (thumbHeight + view.getY()) / fadeHeight;
        if (view.getY() >= thumbHeight * Constants.ALPHA_FADE_START) {
            result = 1.0f - (view.getY() - thumbHeight * Constants.ALPHA_FADE_START) / fadeHeight;
        } else if (view.getY() < thumbHeight * (1.0f - Constants.ALPHA_FADE_START)) {
            result = 1.0f + (thumbHeight * Constants.ALPHA_FADE_START + view.getY()) / fadeHeight;
        }
        if (DEBUG) Log.v(TAG, "FADE AMOUNT: " + result);
        return result;
@@ -269,7 +269,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
        // This has to happen post-layout, so run it "in the future"
        post(new Runnable() {
            public void run() {
                scrollTo(0, mLastScrollPosition);
                scrollTo(mLastScrollPosition, 0);
            }
        });
    }
+5 −5
Original line number Diff line number Diff line
@@ -118,12 +118,12 @@ public class RecentsVerticalScrollView extends ScrollView
    }

    private float getAlphaForOffset(View view, float thumbWidth) {
        final float fadeWidth = Constants.FADE_CONSTANT * thumbWidth;
        final float fadeWidth = Constants.ALPHA_FADE_END * thumbWidth;
        float result = 1.0f;
        if (view.getX() >= thumbWidth) {
            result = 1.0f - (view.getX() - thumbWidth) / fadeWidth;
        } else if (view.getX() < 0.0f) {
            result = 1.0f + (thumbWidth + view.getX()) / fadeWidth;
        if (view.getX() >= thumbWidth*Constants.ALPHA_FADE_START) {
            result = 1.0f - (view.getX() - thumbWidth*Constants.ALPHA_FADE_START) / fadeWidth;
        } else if (view.getX() < thumbWidth* (1.0f - Constants.ALPHA_FADE_START)) {
            result = 1.0f + (thumbWidth*Constants.ALPHA_FADE_START + view.getX()) / fadeWidth;
        }
        if (DEBUG) Log.v(TAG, "FADE AMOUNT: " + result);
        return result;
+6 −6
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ public class PhoneStatusBar extends StatusBar {
        mDateView.setVisibility(View.INVISIBLE);

        // Recents Panel
        initializeRecentsPanel();
        updateRecentsPanel();

        // receive broadcasts
        IntentFilter filter = new IntentFilter();
@@ -338,7 +338,7 @@ public class PhoneStatusBar extends StatusBar {
        return lp;
    }

    protected void initializeRecentsPanel() {
    protected void updateRecentsPanel() {
        // Recents Panel
        boolean visible = false;
        if (mRecentsPanel != null) {
@@ -656,7 +656,7 @@ public class PhoneStatusBar extends StatusBar {

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        initializeRecentsPanel();
        updateRecentsPanel();
    }