[automerger] Changed the Task Menu to overlay on top of the task view am: 1b9c3d6fe3
Change-Id: I572cb5fe8801b2374487d489f78f2bf232df7217
This commit is contained in:
commit
184e968628
|
@ -13,33 +13,16 @@
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="88.0dp"
|
android:width="24dp"
|
||||||
android:height="88.0dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="88.0"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="88.0" >
|
android:viewportHeight="24">
|
||||||
|
|
||||||
<path
|
<path
|
||||||
android:pathData="M 32,11
|
android:fillColor="@android:color/white"
|
||||||
C 32,11 68,11 68,11
|
android:pathData="M18,4v5H6V4H18 M18,2H6C4.9,2,4,2.9,4,4v5c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V4C20,2.9,19.1,2,18,2L18,2z" />
|
||||||
76.74,11.06 76.98,12.76 77,21
|
<path
|
||||||
77.01,25.97 78.50,38.23 73.85,40.98
|
android:fillColor="@android:color/white"
|
||||||
71.80,42.19 68.35,42 66,42
|
android:pathData="M18,15v5H6v-5H18 M18,13H6c-1.1,0-2,0.9-2,2v5c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-5C20,13.9,19.1,13,18,13L18,13z" />
|
||||||
66,42 22,42 22,42
|
|
||||||
18.82,41.99 14.87,42.38 12.60,39.69
|
|
||||||
10.71,37.44 11.01,33.77 11,31
|
|
||||||
10.99,25.54 9.53,16.08 13.31,12.02
|
|
||||||
18.07,10.21 26.66,11 32,11 Z
|
|
||||||
M 32,46
|
|
||||||
C 32,46 68,46 68,46
|
|
||||||
76.74,46.06 76.98,47.76 77,56
|
|
||||||
77.01,60.97 78.50,73.23 73.85,75.98
|
|
||||||
71.80,77.19 68.35,77 66,77
|
|
||||||
66,77 22,77 22,77
|
|
||||||
18.82,76.99 14.87,77.38 12.60,74.69
|
|
||||||
10.71,72.44 11.01,68.77 11,66
|
|
||||||
10.99,60.54 9.53,51.08 13.31,47.02
|
|
||||||
18.07,45.21 26.66,46 32,46 Z"
|
|
||||||
android:fillColor="@android:color/white" />
|
|
||||||
</vector>
|
</vector>
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
<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="@dimen/task_corner_radius"
|
||||||
|
android:topRightRadius="@dimen/task_corner_radius"
|
||||||
|
android:bottomLeftRadius="0dp"
|
||||||
|
android:bottomRightRadius="0dp" />
|
||||||
|
<solid android:color="?attr/popupColorPrimary" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
|
@ -16,21 +16,31 @@
|
||||||
-->
|
-->
|
||||||
<com.android.quickstep.views.TaskMenuView
|
<com.android.quickstep.views.TaskMenuView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="@dimen/bg_popup_item_width"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="invisible"
|
android:animateLayoutChanges="true"
|
||||||
android:elevation="@dimen/deep_shortcuts_elevation"
|
android:background="@drawable/task_menu_bg"
|
||||||
|
android:paddingBottom="@dimen/task_card_menu_shadow_height"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:background="?attr/popupColorPrimary"
|
android:visibility="invisible">
|
||||||
android:divider="@drawable/all_apps_divider"
|
|
||||||
android:showDividers="middle"
|
|
||||||
android:animateLayoutChanges="true">
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/task_icon_and_name"
|
android:id="@+id/task_icon_and_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="112dp"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="14sp"
|
android:drawablePadding="@dimen/deep_shortcut_drawable_padding"
|
||||||
android:paddingTop="18dp"
|
android:gravity="center_horizontal"
|
||||||
android:drawablePadding="8dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:gravity="center_horizontal"/>
|
android:textSize="12sp"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/menu_option_layout"
|
||||||
|
style="@style/TaskMenu"
|
||||||
|
android:divider="@drawable/all_apps_divider"
|
||||||
|
android:showDividers="beginning"
|
||||||
|
android:paddingStart="@dimen/task_card_menu_horizontal_padding"
|
||||||
|
android:paddingEnd="@dimen/task_card_menu_horizontal_padding"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
</com.android.quickstep.views.TaskMenuView>
|
</com.android.quickstep.views.TaskMenuView>
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
style="@style/TaskMenu.Option"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="@dimen/task_card_menu_option_vertical_padding"
|
||||||
|
android:paddingBottom="@dimen/task_card_menu_option_vertical_padding"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:theme="@style/PopupItem" >
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="@dimen/system_shortcut_icon_size"
|
||||||
|
android:layout_height="@dimen/system_shortcut_icon_size"
|
||||||
|
android:layout_marginTop="@dimen/system_shortcut_header_icon_padding"
|
||||||
|
android:layout_marginBottom="@dimen/deep_shortcut_drawable_padding"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:backgroundTint="?android:attr/textColorTertiary"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/BaseIcon"
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="@dimen/popup_padding_end"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:fontFamily="sans-serif"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:focusable="false" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<dimen name="task_card_menu_horizontal_padding">24dp</dimen>
|
||||||
|
</resources>
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<!-- Task Menu layout styles. -->
|
||||||
|
<style name="TaskMenu">
|
||||||
|
<item name="android:orientation">horizontal</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Task Menu Option layout styles. -->
|
||||||
|
<style name="TaskMenu.Option">
|
||||||
|
<item name="android:layout_width">0dp</item>
|
||||||
|
<item name="android:layout_weight">1</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
<dimen name="task_thumbnail_top_margin">24dp</dimen>
|
<dimen name="task_thumbnail_top_margin">24dp</dimen>
|
||||||
<dimen name="task_thumbnail_icon_size">48dp</dimen>
|
<dimen name="task_thumbnail_icon_size">48dp</dimen>
|
||||||
<dimen name="task_menu_background_radius">12dp</dimen>
|
|
||||||
<dimen name="task_corner_radius">2dp</dimen>
|
<dimen name="task_corner_radius">2dp</dimen>
|
||||||
<dimen name="recents_page_spacing">10dp</dimen>
|
<dimen name="recents_page_spacing">10dp</dimen>
|
||||||
<dimen name="quickscrub_adjacent_visible_width">20dp</dimen>
|
<dimen name="quickscrub_adjacent_visible_width">20dp</dimen>
|
||||||
|
@ -41,6 +40,9 @@
|
||||||
<!-- Total space (start + end) between the task card and the edge of the screen
|
<!-- Total space (start + end) between the task card and the edge of the screen
|
||||||
in various configurations -->
|
in various configurations -->
|
||||||
<dimen name="task_card_vert_space">40dp</dimen>
|
<dimen name="task_card_vert_space">40dp</dimen>
|
||||||
|
<dimen name="task_card_menu_option_vertical_padding">8dp</dimen>
|
||||||
|
<dimen name="task_card_menu_shadow_height">3dp</dimen>
|
||||||
|
<dimen name="task_card_menu_horizontal_padding">0dp</dimen>
|
||||||
<dimen name="portrait_task_card_horz_space">136dp</dimen>
|
<dimen name="portrait_task_card_horz_space">136dp</dimen>
|
||||||
<dimen name="landscape_task_card_horz_space">200dp</dimen>
|
<dimen name="landscape_task_card_horz_space">200dp</dimen>
|
||||||
<dimen name="multi_window_task_card_horz_space">100dp</dimen>
|
<dimen name="multi_window_task_card_horz_space">100dp</dimen>
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2018 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.
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<!-- Task Menu layout styles. -->
|
||||||
|
<style name="TaskMenu">
|
||||||
|
<item name="android:orientation">vertical</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Task Menu Option layout styles. -->
|
||||||
|
<style name="TaskMenu.Option">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
|
@ -16,19 +16,19 @@
|
||||||
|
|
||||||
package com.android.quickstep.views;
|
package com.android.quickstep.views;
|
||||||
|
|
||||||
|
import static com.android.quickstep.views.TaskThumbnailView.DIM_ALPHA;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorSet;
|
import android.animation.AnimatorSet;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Outline;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Point;
|
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewOutlineProvider;
|
import android.widget.LinearLayout;
|
||||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.launcher3.AbstractFloatingView;
|
import com.android.launcher3.AbstractFloatingView;
|
||||||
|
@ -37,8 +37,8 @@ import com.android.launcher3.LauncherAnimUtils;
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||||
|
import com.android.launcher3.anim.Interpolators;
|
||||||
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
|
||||||
import com.android.launcher3.shortcuts.DeepShortcutView;
|
|
||||||
import com.android.launcher3.views.BaseDragLayer;
|
import com.android.launcher3.views.BaseDragLayer;
|
||||||
import com.android.quickstep.TaskSystemShortcut;
|
import com.android.quickstep.TaskSystemShortcut;
|
||||||
import com.android.quickstep.TaskUtils;
|
import com.android.quickstep.TaskUtils;
|
||||||
|
@ -58,12 +58,14 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||||
new TaskSystemShortcut.Install(),
|
new TaskSystemShortcut.Install(),
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final long OPEN_CLOSE_DURATION = 220;
|
private static final int REVEAL_OPEN_DURATION = 150;
|
||||||
|
private static final int REVEAL_CLOSE_DURATION = 100;
|
||||||
|
|
||||||
private BaseDraggingActivity mActivity;
|
private BaseDraggingActivity mActivity;
|
||||||
private TextView mTaskIconAndName;
|
private TextView mTaskIconAndName;
|
||||||
private AnimatorSet mOpenCloseAnimator;
|
private AnimatorSet mOpenCloseAnimator;
|
||||||
private TaskView mTaskView;
|
private TaskView mTaskView;
|
||||||
|
private LinearLayout mOptionLayout;
|
||||||
|
|
||||||
public TaskMenuView(Context context, AttributeSet attrs) {
|
public TaskMenuView(Context context, AttributeSet attrs) {
|
||||||
this(context, attrs, 0);
|
this(context, attrs, 0);
|
||||||
|
@ -73,20 +75,13 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
|
|
||||||
mActivity = BaseDraggingActivity.fromContext(context);
|
mActivity = BaseDraggingActivity.fromContext(context);
|
||||||
setClipToOutline(true);
|
|
||||||
setOutlineProvider(new ViewOutlineProvider() {
|
|
||||||
@Override
|
|
||||||
public void getOutline(View view, Outline outline) {
|
|
||||||
float r = getResources().getDimensionPixelSize(R.dimen.task_menu_background_radius);
|
|
||||||
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), r);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
mTaskIconAndName = findViewById(R.id.task_icon_and_name);
|
mTaskIconAndName = findViewById(R.id.task_icon_and_name);
|
||||||
|
mOptionLayout = findViewById(R.id.menu_option_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -148,6 +143,12 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||||
mTaskIconAndName.setText(TaskUtils.getTitle(getContext(), taskView.getTask()));
|
mTaskIconAndName.setText(TaskUtils.getTitle(getContext(), taskView.getTask()));
|
||||||
mTaskIconAndName.setOnClickListener(v -> close(true));
|
mTaskIconAndName.setOnClickListener(v -> close(true));
|
||||||
|
|
||||||
|
// Move the icon and text up half an icon size to lay over the TaskView
|
||||||
|
LinearLayout.LayoutParams params =
|
||||||
|
(LinearLayout.LayoutParams) mTaskIconAndName.getLayoutParams();
|
||||||
|
params.topMargin = (int) -getResources().getDimension(R.dimen.task_thumbnail_top_margin);
|
||||||
|
mTaskIconAndName.setLayoutParams(params);
|
||||||
|
|
||||||
for (TaskSystemShortcut menuOption : MENU_OPTIONS) {
|
for (TaskSystemShortcut menuOption : MENU_OPTIONS) {
|
||||||
OnClickListener onClickListener = menuOption.getOnClickListener(mActivity, taskView);
|
OnClickListener onClickListener = menuOption.getOnClickListener(mActivity, taskView);
|
||||||
if (onClickListener != null) {
|
if (onClickListener != null) {
|
||||||
|
@ -157,21 +158,24 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMenuOption(TaskSystemShortcut menuOption, OnClickListener onClickListener) {
|
private void addMenuOption(TaskSystemShortcut menuOption, OnClickListener onClickListener) {
|
||||||
DeepShortcutView menuOptionView = (DeepShortcutView) mActivity.getLayoutInflater().inflate(
|
ViewGroup menuOptionView = (ViewGroup) mActivity.getLayoutInflater().inflate(
|
||||||
R.layout.system_shortcut, this, false);
|
R.layout.task_view_menu_option, this, false);
|
||||||
menuOptionView.getIconView().setBackgroundResource(menuOption.iconResId);
|
menuOptionView.findViewById(R.id.icon).setBackgroundResource(menuOption.iconResId);
|
||||||
menuOptionView.getBubbleText().setText(menuOption.labelResId);
|
((TextView) menuOptionView.findViewById(R.id.text)).setText(menuOption.labelResId);
|
||||||
menuOptionView.setOnClickListener(onClickListener);
|
menuOptionView.setOnClickListener(onClickListener);
|
||||||
addView(menuOptionView);
|
mOptionLayout.addView(menuOptionView);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void orientAroundTaskView(TaskView taskView) {
|
private void orientAroundTaskView(TaskView taskView) {
|
||||||
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
|
||||||
mActivity.getDragLayer().getDescendantRectRelativeToSelf(taskView, sTempRect);
|
mActivity.getDragLayer().getDescendantRectRelativeToSelf(taskView, sTempRect);
|
||||||
Rect insets = mActivity.getDragLayer().getInsets();
|
Rect insets = mActivity.getDragLayer().getInsets();
|
||||||
int x = sTempRect.left + (sTempRect.width() - getMeasuredWidth()) / 2 - insets.left;
|
BaseDragLayer.LayoutParams params = (BaseDragLayer.LayoutParams) getLayoutParams();
|
||||||
setX(Utilities.isRtl(getResources()) ? -x : x);
|
params.width = sTempRect.width();
|
||||||
setY(sTempRect.top - mTaskIconAndName.getPaddingTop() - insets.top);
|
setLayoutParams(params);
|
||||||
|
setX(Utilities.isRtl(getResources()) ? -sTempRect.left : sTempRect.left);
|
||||||
|
setY(sTempRect.top + getResources().getDimension(R.dimen.task_thumbnail_top_margin)
|
||||||
|
- insets.top);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animateOpen() {
|
private void animateOpen() {
|
||||||
|
@ -188,8 +192,13 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mOpenCloseAnimator = LauncherAnimUtils.createAnimatorSet();
|
mOpenCloseAnimator = LauncherAnimUtils.createAnimatorSet();
|
||||||
mOpenCloseAnimator.play(createOpenCloseOutlineProvider()
|
|
||||||
.createRevealAnimator(this, closing));
|
final Animator revealAnimator = createOpenCloseOutlineProvider()
|
||||||
|
.createRevealAnimator(this, closing);
|
||||||
|
revealAnimator.setInterpolator(Interpolators.DEACCEL);
|
||||||
|
mOpenCloseAnimator.play(revealAnimator);
|
||||||
|
mOpenCloseAnimator.play(ObjectAnimator.ofFloat(mTaskView.getThumbnail(), DIM_ALPHA,
|
||||||
|
closing ? 0 : TaskView.MAX_PAGE_SCRIM_ALPHA));
|
||||||
mOpenCloseAnimator.addListener(new AnimationSuccessListener() {
|
mOpenCloseAnimator.addListener(new AnimationSuccessListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animator animation) {
|
public void onAnimationStart(Animator animation) {
|
||||||
|
@ -204,8 +213,7 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mOpenCloseAnimator.play(ObjectAnimator.ofFloat(this, ALPHA, closing ? 0 : 1));
|
mOpenCloseAnimator.play(ObjectAnimator.ofFloat(this, ALPHA, closing ? 0 : 1));
|
||||||
mOpenCloseAnimator.setDuration(OPEN_CLOSE_DURATION);
|
mOpenCloseAnimator.setDuration(closing ? REVEAL_CLOSE_DURATION: REVEAL_OPEN_DURATION);
|
||||||
mOpenCloseAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
|
||||||
mOpenCloseAnimator.start();
|
mOpenCloseAnimator.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,18 +223,9 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
|
private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
|
||||||
int iconSize = getResources().getDimensionPixelSize(R.dimen.task_thumbnail_icon_size);
|
float radius = getResources().getDimension(R.dimen.task_corner_radius);
|
||||||
float fromRadius = iconSize / 2;
|
Rect fromRect = new Rect(0, 0, getWidth(), 0);
|
||||||
float toRadius = getResources().getDimensionPixelSize(
|
|
||||||
R.dimen.task_menu_background_radius);
|
|
||||||
Point iconCenter = new Point(getWidth() / 2, mTaskIconAndName.getPaddingTop() + iconSize / 2);
|
|
||||||
Rect fromRect = new Rect(iconCenter.x, iconCenter.y, iconCenter.x, iconCenter.y);
|
|
||||||
Rect toRect = new Rect(0, 0, getWidth(), getHeight());
|
Rect toRect = new Rect(0, 0, getWidth(), getHeight());
|
||||||
return new RoundedRectRevealOutlineProvider(fromRadius, toRadius, fromRect, toRect) {
|
return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);
|
||||||
@Override
|
|
||||||
public boolean shouldRemoveElevationDuringAnimation() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import android.graphics.Matrix;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
import android.support.v4.graphics.ColorUtils;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.FloatProperty;
|
import android.util.FloatProperty;
|
||||||
import android.util.Property;
|
import android.util.Property;
|
||||||
|
@ -68,6 +67,19 @@ public class TaskThumbnailView extends View {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final Property<TaskThumbnailView, Float> DIM_ALPHA =
|
||||||
|
new FloatProperty<TaskThumbnailView>("dimAlpha") {
|
||||||
|
@Override
|
||||||
|
public void setValue(TaskThumbnailView thumbnail, float dimAlpha) {
|
||||||
|
thumbnail.setDimAlpha(dimAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Float get(TaskThumbnailView thumbnailView) {
|
||||||
|
return thumbnailView.mDimAlpha;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private final float mCornerRadius;
|
private final float mCornerRadius;
|
||||||
|
|
||||||
private final BaseActivity mActivity;
|
private final BaseActivity mActivity;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback
|
||||||
* The alpha of a black scrim on a page in the carousel as it leaves the screen.
|
* The alpha of a black scrim on a page in the carousel as it leaves the screen.
|
||||||
* In the resting position of the carousel, the adjacent pages have about half this scrim.
|
* In the resting position of the carousel, the adjacent pages have about half this scrim.
|
||||||
*/
|
*/
|
||||||
private static final float MAX_PAGE_SCRIM_ALPHA = 0.4f;
|
public static final float MAX_PAGE_SCRIM_ALPHA = 0.4f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How much to scale down pages near the edge of the screen.
|
* How much to scale down pages near the edge of the screen.
|
||||||
|
|
|
@ -16,12 +16,17 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24.0"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24.0"
|
android:viewportHeight="24"
|
||||||
android:tint="?android:attr/textColorPrimary">
|
android:tint="?android:attr/textColorPrimary">
|
||||||
|
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="#FFFFFF"
|
||||||
android:pathData="M12,17L12,17c0.55,0,1-0.45,1-1v-4c0-0.55-0.45-1-1-1l0,0c-0.55,0-1,0.45-1,1v4C11,16.55,11.45,17,12,17z M12,2C6.48,
|
android:pathData="M 11 7 H 13 V 9 H 11 V 7 Z" />
|
||||||
2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M12,20c-4.41,0-8-3.59-8-8s3.59-8,8-8s8,3.59,8,8S16.41,20,12,20zM12,
|
<path
|
||||||
9.1L12,9.1c0.61,0,1.1-0.49,1.1-1.1l0,0c0-0.61-0.49-1.1-1.1-1.1l0,0c-0.61,0-1.1,0.49-1.1,1.1l0,0C10.9,8.61,11.39,9.1,12,9.1z"/>
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M 11 11 H 13 V 17 H 11 V 11 Z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M12,2C6.48,2,2,6.48,2,12c0,5.52,4.48,10,10,10s10-4.48,10-10C22,6.48,17.52,2,12,2z M12,20c-4.41,0-8-3.59-8-8 c0-4.41,3.59-8,8-8s8,3.59,8,8C20,16.41,16.41,20,12,20z" />
|
||||||
</vector>
|
</vector>
|
||||||
|
|
Loading…
Reference in New Issue