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

Commit 12858a6e authored by Winson's avatar Winson
Browse files

Minor tweaks to layout and visuals.

- Constructing max dim paths to be dependent on focused range
- Reducing highlight on tasks
- Making header/icons smaller

Change-Id: Ia7cf8b996428012e9619a640e178b4b42e094d68
parent 66474134
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -26,13 +26,16 @@
        android:layout_width="@dimen/recents_task_view_header_icon_width"
        android:layout_height="@dimen/recents_task_view_header_icon_height"
        android:layout_gravity="center_vertical|start"
        android:padding="9dp" />
        android:paddingTop="8dp"
        android:paddingBottom="8dp"
        android:paddingStart="12dp"
        android:paddingEnd="16dp" />
    <TextView
        android:id="@+id/title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical|start"
        android:layout_marginStart="64dp"
        android:layout_marginStart="56dp"
        android:layout_marginEnd="112dp"
        android:textSize="16sp"
        android:textColor="#ffffffff"
@@ -48,7 +51,7 @@
        android:layout_height="@dimen/recents_task_view_header_button_height"
        android:layout_marginEnd="@dimen/recents_task_view_header_button_width"
        android:layout_gravity="center_vertical|end"
        android:padding="15dp"
        android:padding="13dp"
        android:src="@drawable/star"
        android:background="?android:selectableItemBackground"
        android:alpha="0"
@@ -58,7 +61,7 @@
        android:layout_width="@dimen/recents_task_view_header_button_width"
        android:layout_height="@dimen/recents_task_view_header_button_height"
        android:layout_gravity="center_vertical|end"
        android:padding="15dp"
        android:padding="13dp"
        android:src="@drawable/recents_dismiss_light"
        android:background="?android:selectableItemBackground"
        android:alpha="0"
+6 −3
Original line number Diff line number Diff line
@@ -23,13 +23,16 @@
        android:layout_width="@dimen/recents_task_view_header_icon_width"
        android:layout_height="@dimen/recents_task_view_header_icon_height"
        android:layout_gravity="center_vertical|start"
        android:padding="9dp" />
        android:paddingTop="8dp"
        android:paddingBottom="8dp"
        android:paddingStart="12dp"
        android:paddingEnd="16dp" />
    <TextView
        android:id="@+id/app_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical|start"
        android:layout_marginStart="64dp"
        android:layout_marginStart="56dp"
        android:layout_marginEnd="112dp"
        android:textSize="16sp"
        android:textColor="#ffffffff"
@@ -44,7 +47,7 @@
        android:layout_width="@dimen/recents_task_view_header_button_width"
        android:layout_height="@dimen/recents_task_bar_height"
        android:layout_gravity="center_vertical|end"
        android:padding="15dp"
        android:padding="13dp"
        android:background="?android:selectableItemBackground"
        android:src="@drawable/recents_info_light" />
</FrameLayout>
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@
    <dimen name="glowpadview_inner_radius">15dip</dimen>

    <!-- The size of the icon in the recents task view header. -->
    <dimen name="recents_task_view_header_icon_width">64dp</dimen>
    <dimen name="recents_task_view_header_icon_width">56dp</dimen>
    <dimen name="recents_task_view_header_icon_height">@dimen/recents_task_bar_height</dimen>

    <!-- The size of a button in the recents task view header. -->
@@ -263,7 +263,7 @@
    <dimen name="recents_task_view_affiliate_group_enter_offset">32dp</dimen>

    <!-- The height of a task view bar. -->
    <dimen name="recents_task_bar_height">56dp</dimen>
    <dimen name="recents_task_bar_height">50dp</dimen>

    <!-- The height of the search bar space. -->
    <dimen name="recents_search_bar_space_height">64dp</dimen>
+45 −27
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Path;
import android.graphics.Rect;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.SparseArray;
import android.util.SparseIntArray;
@@ -101,34 +100,13 @@ class Range {
 */
public class TaskStackLayoutAlgorithm {

    // The scale factor to apply to the user movement in the stack to unfocus it
    private static final float UNFOCUS_MULTIPLIER = 0.8f;

    // The distribution of view bounds alpha
    // XXX: This is a hack because you can currently set the max alpha to be > 1f
    public static final float OUTLINE_ALPHA_MIN_VALUE = 0f;
    public static final float OUTLINE_ALPHA_MAX_VALUE = 2f;

    // The distribution of dim to apply to tasks in the stack
    private static final float DIM_MAX_VALUE = 0.35f;
    private static final Path UNFOCUSED_DIM_PATH = new Path();
    private static final Path FOCUSED_DIM_PATH = new Path();
    static {
        // The unfocused dim interpolator peaks to 1 at 0.5 (the focused task), then slowly drops
        // back to 0.5 at the front of the stack
        UNFOCUSED_DIM_PATH.moveTo(0f, 0f);
        UNFOCUSED_DIM_PATH.cubicTo(0f, 0.1f, 0.4f, 0.8f, 0.5f, 1f);
        UNFOCUSED_DIM_PATH.cubicTo(0.6f, 1f, 0.9f, 0.6f, 1f, 0.5f);
        // The focused dim interpolator peaks to 1 at 0.5 (the focused task), then drops back to 0
        // at the front of the stack
        FOCUSED_DIM_PATH.moveTo(0f, 0f);
        FOCUSED_DIM_PATH.cubicTo(0.1f, 0f, 0.4f, 1f, 0.5f, 1f);
        FOCUSED_DIM_PATH.cubicTo(0.6f, 1f, 0.9f, 0f, 1f, 0f);
    }
    private static final FreePathInterpolator UNFOCUSED_DIM_INTERPOLATOR =
            new FreePathInterpolator(UNFOCUSED_DIM_PATH);
    private static final FreePathInterpolator FOCUSED_DIM_INTERPOLATOR =
            new FreePathInterpolator(FOCUSED_DIM_PATH);
    // The maximum dim on the tasks
    private static final float MAX_DIM = 0.25f;

    // The various focus states
    public static final int STATE_FOCUSED = 1;
@@ -264,6 +242,13 @@ public class TaskStackLayoutAlgorithm {
    private FreePathInterpolator mUnfocusedCurveInterpolator;
    private FreePathInterpolator mFocusedCurveInterpolator;

    // The paths defining the distribution of the dim to apply to tasks in the stack when focused
    // and unfocused
    private Path mUnfocusedDimCurve;
    private Path mFocusedDimCurve;
    private FreePathInterpolator mUnfocusedDimCurveInterpolator;
    private FreePathInterpolator mFocusedDimCurveInterpolator;

    // The state of the stack focus (0..1), which controls the transition of the stack from the
    // focused to non-focused state
    @ViewDebug.ExportedProperty(category="recents")
@@ -401,6 +386,11 @@ public class TaskStackLayoutAlgorithm {
        mUnfocusedCurveInterpolator = new FreePathInterpolator(mUnfocusedCurve);
        mFocusedCurve = constructFocusedCurve();
        mFocusedCurveInterpolator = new FreePathInterpolator(mFocusedCurve);
        mUnfocusedDimCurve = constructUnfocusedDimCurve();
        mUnfocusedDimCurveInterpolator = new FreePathInterpolator(mUnfocusedDimCurve);
        mFocusedDimCurve = constructFocusedDimCurve();
        mFocusedDimCurveInterpolator = new FreePathInterpolator(mFocusedDimCurve);

        updateFrontBackTransforms();
    }

@@ -733,16 +723,16 @@ public class TaskStackLayoutAlgorithm {
                    unfocusedRangeX)) * mStackRect.height());
            int focusedY = (int) ((1f - mFocusedCurveInterpolator.getInterpolation(
                    focusedRangeX)) * mStackRect.height());
            float unfocusedDim = 1f - UNFOCUSED_DIM_INTERPOLATOR.getInterpolation(
            float unfocusedDim = mUnfocusedDimCurveInterpolator.getInterpolation(
                    boundedScrollUnfocusedRangeX);
            float focusedDim = 1f - FOCUSED_DIM_INTERPOLATOR.getInterpolation(
            float focusedDim = mFocusedDimCurveInterpolator.getInterpolation(
                    boundedScrollFocusedRangeX);

            y = (mStackRect.top - mTaskRect.top) +
                    (int) Utilities.mapRange(focusState, unfocusedY, focusedY);
            z = Utilities.mapRange(Utilities.clamp01(boundedScrollUnfocusedRangeX),
                    mMinTranslationZ, mMaxTranslationZ);
            dimAlpha = DIM_MAX_VALUE * Utilities.mapRange(focusState, unfocusedDim, focusedDim);
            dimAlpha = Utilities.mapRange(focusState, unfocusedDim, focusedDim);
            viewOutlineAlpha = Utilities.mapRange(Utilities.clamp01(boundedScrollUnfocusedRangeX),
                    OUTLINE_ALPHA_MIN_VALUE, OUTLINE_ALPHA_MAX_VALUE);
        }
@@ -839,6 +829,34 @@ public class TaskStackLayoutAlgorithm {
        return p;
    }

    /**
     * Creates a new path for the focused dim curve.
     */
    private Path constructFocusedDimCurve() {
        Path p = new Path();
        // The focused dim interpolator starts at max dim, reduces to zero at 0.5 (the focused
        // task), then goes back to max dim at the next task
        p.moveTo(0f, MAX_DIM);
        p.lineTo(0.5f, 0f);
        p.lineTo(0.5f + (0.5f / mFocusedRange.relativeMax), MAX_DIM);
        p.lineTo(1f, MAX_DIM);
        return p;
    }

    /**
     * Creates a new path for the unfocused dim curve.
     */
    private Path constructUnfocusedDimCurve() {
        Path p = new Path();
        // The unfocused dim interpolator starts at max dim, reduces to zero at 0.5 (the focused
        // task), then goes back to max dim towards the front of the stack
        p.moveTo(0f, MAX_DIM);
        p.cubicTo(0f, 0.1f, 0.4f, 0f, 0.5f, 0f);
        p.cubicTo(0.6f, 0f, 0.9f, MAX_DIM - 0.1f, 1f, MAX_DIM / 2f);
        return p;
    }


    /**
     * Updates the current transforms that would put a TaskView at the front and back of the stack.
     */
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
public class TaskViewHeader extends FrameLayout
        implements View.OnClickListener, View.OnLongClickListener {

    private static final float HIGHLIGHT_LIGHTNESS_INCREMENT = 0.125f;
    private static final float HIGHLIGHT_LIGHTNESS_INCREMENT = 0.075f;
    private static final float OVERLAY_LIGHTNESS_INCREMENT = -0.0625f;
    private static final int OVERLAY_REVEAL_DURATION = 250;
    private static final long FOCUS_INDICATOR_INTERVAL_MS = 30;
Loading