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

Commit de0591a0 authored by Winson's avatar Winson Committed by Winson Chung
Browse files

Updating the header bar item visibility with the task view frame.

- In freeform mode, we hide the buttons depending on the available width
  of the task view
- Also fixes the rounded corners on the task views as the frame changes
- Tweaking the freeform workspace background

Change-Id: Iec9352acb5cb3ce95c09ff6d1026a9900717d3e6
parent bb410951
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <corners android:topLeftRadius="@dimen/recents_task_view_rounded_corners_radius"
             android:topRightRadius="@dimen/recents_task_view_rounded_corners_radius"/>
    <solid android:color="#00000000" />
</shape>
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@
    <color name="recents_task_view_lock_to_app_button_background_color">#ffe6e6e6</color>
    <!-- The lock to task button foreground color. -->
    <color name="recents_task_view_lock_to_app_button_color">#ff666666</color>
    <!-- The background color for the freeform workspace. -->
    <color name="recents_freeform_workspace_bg_color">#66000000</color>

    <color name="keyguard_affordance">#ffffffff</color>

+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ public class FreeformWorkspaceLayoutAlgorithm {
            final Rect taskRect = stackLayout.mTaskRect;
            final RectF ffRect = mTaskRectMap.get(task.key);

            transformOut.scale = 0.95f;
            transformOut.scale = 1f;
            transformOut.alpha = 1f;
            transformOut.translationZ = stackLayout.mMaxTranslationZ;
            if (task.thumbnail != null) {
+13 −8
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@ import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.util.IntProperty;
import android.util.Log;
@@ -95,15 +95,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
    private static final float SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD = 0.3f;
    private static final float HIDE_HISTORY_BUTTON_SCROLL_THRESHOLD = 0.3f;

    public static final Property<ColorDrawable, Integer> COLOR_DRAWABLE_ALPHA =
            new IntProperty<ColorDrawable>("colorDrawableAlpha") {
    public static final Property<Drawable, Integer> DRAWABLE_ALPHA =
            new IntProperty<Drawable>("drawableAlpha") {
                @Override
                public void setValue(ColorDrawable object, int alpha) {
                public void setValue(Drawable object, int alpha) {
                    object.setAlpha(alpha);
                }

                @Override
                public Integer get(ColorDrawable object) {
                public Integer get(Drawable object) {
                    return object.getAlpha();
                }
            };
@@ -119,7 +119,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
    TaskStackViewScroller mStackScroller;
    TaskStackViewTouchHandler mTouchHandler;
    TaskStackViewCallbacks mCb;
    ColorDrawable mFreeformWorkspaceBackground;
    GradientDrawable mFreeformWorkspaceBackground;
    ObjectAnimator mFreeformWorkspaceBackgroundAnimator;
    ViewPool<TaskView, Task> mViewPool;
    ArrayList<TaskViewTransform> mCurrentTaskTransforms = new ArrayList<>();
@@ -176,6 +176,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal

    public TaskStackView(Context context, TaskStack stack) {
        super(context);
        SystemServicesProxy ssp = Recents.getSystemServices();
        Resources res = context.getResources();

        // Set the stack first
@@ -207,8 +208,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        });
        setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);

        mFreeformWorkspaceBackground = new ColorDrawable(0x33000000);
        mFreeformWorkspaceBackground = (GradientDrawable) getContext().getDrawable(
                R.drawable.recents_freeform_workspace_bg);
        mFreeformWorkspaceBackground.setCallback(this);
        if (ssp.hasFreeformWorkspaceSupport()) {
            setBackgroundColor(getContext().getColor(R.color.recents_freeform_workspace_bg_color));
        }
    }

    /** Sets the callbacks */
@@ -1588,7 +1593,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal

        Utilities.cancelAnimationWithoutCallbacks(mFreeformWorkspaceBackgroundAnimator);
        mFreeformWorkspaceBackgroundAnimator = ObjectAnimator.ofInt(mFreeformWorkspaceBackground,
                COLOR_DRAWABLE_ALPHA, mFreeformWorkspaceBackground.getAlpha(), targetAlpha);
                DRAWABLE_ALPHA, mFreeformWorkspaceBackground.getAlpha(), targetAlpha);
        mFreeformWorkspaceBackgroundAnimator.setDuration(duration);
        mFreeformWorkspaceBackgroundAnimator.setInterpolator(interpolator);
        mFreeformWorkspaceBackgroundAnimator.start();
+7 −0
Original line number Diff line number Diff line
@@ -178,6 +178,13 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
        mActionButtonTranslationZ = mActionButtonView.getTranslationZ();
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        mHeaderView.onTaskViewSizeChanged(w, h);
        mThumbnailView.onTaskViewSizeChanged(w, h);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
Loading