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

Commit 71204496 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make TaskMenuView corner radius follow TaskView." into sc-dev

parents c322510b 9f921098
Loading
Loading
Loading
Loading
+4 −22
Original line number Diff line number Diff line
@@ -14,25 +14,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:gravity="bottom">
        <!-- Shadow -->
        <shape>
            <gradient android:angle="270"
                android:endColor="@android:color/transparent"
                android:startColor="#26000000" />
            <size android:height="@dimen/task_card_menu_shadow_height" />
        </shape>
    </item>
    <item android:bottom="@dimen/task_card_menu_shadow_height">
        <!-- Background -->
        <shape>
            <corners
                android:topLeftRadius="?android:attr/dialogCornerRadius"
                android:topRightRadius="?android:attr/dialogCornerRadius"
                android:bottomLeftRadius="0dp"
                android:bottomRightRadius="0dp" />

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="?attr/popupColorPrimary" />
</shape>
    </item>
</layer-list>
+16 −2
Original line number Diff line number Diff line
@@ -23,12 +23,14 @@ import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Outline;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.LinearLayout;
import android.widget.TextView;

@@ -41,10 +43,10 @@ import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskUtils;
import com.android.quickstep.util.TaskCornerRadius;

/**
 * Contains options for a recent task when long-pressing its icon.
@@ -72,6 +74,7 @@ public class TaskMenuView extends AbstractFloatingView {

        mActivity = BaseDraggingActivity.fromContext(context);
        mThumbnailTopMargin = getResources().getDimension(R.dimen.task_thumbnail_top_margin);
        setClipToOutline(true);
    }

    @Override
@@ -108,6 +111,17 @@ public class TaskMenuView extends AbstractFloatingView {
        return (type & TYPE_TASK_MENU) != 0;
    }

    @Override
    public ViewOutlineProvider getOutlineProvider() {
        return new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(),
                        TaskCornerRadius.get(view.getContext()));
            }
        };
    }

    public void setPosition(float x, float y, PagedOrientationHandler pagedOrientationHandler) {
        float adjustedY = y + mThumbnailTopMargin;
        // Changing pivot to make computations easier
@@ -260,7 +274,7 @@ public class TaskMenuView extends AbstractFloatingView {
    }

    private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
        float radius = Themes.getDialogCornerRadius(getContext());
        float radius = TaskCornerRadius.get(mContext);
        Rect fromRect = new Rect(0, 0, getWidth(), 0);
        Rect toRect = new Rect(0, 0, getWidth(), getHeight());
        return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);