Merge "PIP: Fix regressions" into nyc-dev
This commit is contained in:
@@ -35,9 +35,9 @@
|
|||||||
<!-- Placeholder view to give focus to the PIP menus. -->
|
<!-- Placeholder view to give focus to the PIP menus. -->
|
||||||
<View
|
<View
|
||||||
android:id="@+id/pip"
|
android:id="@+id/pip"
|
||||||
android:layout_width="0dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="1dp"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:visibility="gone" />
|
android:visibility="visible" />
|
||||||
|
|
||||||
</com.android.systemui.recents.tv.views.RecentsTvView>
|
</com.android.systemui.recents.tv.views.RecentsTvView>
|
||||||
|
|||||||
@@ -606,8 +606,8 @@
|
|||||||
<dimen name="recents_layout_z_min">3dp</dimen>
|
<dimen name="recents_layout_z_min">3dp</dimen>
|
||||||
<dimen name="recents_layout_z_max">24dp</dimen>
|
<dimen name="recents_layout_z_max">24dp</dimen>
|
||||||
|
|
||||||
<!-- The margin between the freeform and stack. We also don't want this to change across
|
<!-- The margin between the freeform and stack. We also don't want this to change across
|
||||||
configurations that Recents can be opened in, so we define them statically for all
|
configurations that Recents can be opened in, so we define them statically for all
|
||||||
display sizes. -->
|
display sizes. -->
|
||||||
<dimen name="recents_freeform_layout_bottom_margin">16dp</dimen>
|
<dimen name="recents_freeform_layout_bottom_margin">16dp</dimen>
|
||||||
|
|
||||||
@@ -651,4 +651,7 @@
|
|||||||
|
|
||||||
<!-- The amount to translate when animating the removal of a task. -->
|
<!-- The amount to translate when animating the removal of a task. -->
|
||||||
<dimen name="recents_task_view_remove_anim_translation_x">100dp</dimen>
|
<dimen name="recents_task_view_remove_anim_translation_x">100dp</dimen>
|
||||||
|
|
||||||
|
<!-- The alpha to apply to the recents row when it doesn't have focus -->
|
||||||
|
<item name="recents_recents_row_dim_alpha" format="float" type="dimen">0.5</item>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -107,7 +107,9 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
|
|||||||
public void onMoveToFullscreen() {
|
public void onMoveToFullscreen() {
|
||||||
// Recents should be dismissed when PIP moves to fullscreen. If not, Recents will
|
// Recents should be dismissed when PIP moves to fullscreen. If not, Recents will
|
||||||
// be unnecessarily shown in the scenario: PIP->Fullscreen->PIP.
|
// be unnecessarily shown in the scenario: PIP->Fullscreen->PIP.
|
||||||
dismissRecentsToLaunchTargetTaskOrHome();
|
// Do not show Recents close animation because PIP->Fullscreen animation will be shown
|
||||||
|
// instead.
|
||||||
|
dismissRecentsToLaunchTargetTaskOrHome(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -118,7 +120,7 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
|
|||||||
new PipRecentsOverlayManager.Callback() {
|
new PipRecentsOverlayManager.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onClosed() {
|
public void onClosed() {
|
||||||
dismissRecentsToLaunchTargetTaskOrHome();
|
dismissRecentsToLaunchTargetTaskOrHome(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -211,13 +213,15 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean dismissRecentsToLaunchTargetTaskOrHome() {
|
boolean dismissRecentsToLaunchTargetTaskOrHome(boolean animate) {
|
||||||
SystemServicesProxy ssp = Recents.getSystemServices();
|
SystemServicesProxy ssp = Recents.getSystemServices();
|
||||||
if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
|
if (ssp.isRecentsTopMost(ssp.getTopMostTask(), null)) {
|
||||||
// If we have a focused Task, launch that Task now
|
// If we have a focused Task, launch that Task now
|
||||||
if (mRecentsView.launchPreviousTask()) return true;
|
if (mRecentsView.launchPreviousTask(animate)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// If none of the other cases apply, then just go Home
|
// If none of the other cases apply, then just go Home
|
||||||
dismissRecentsToHome(true /* animateTaskViews */);
|
dismissRecentsToHome(animate /* animateTaskViews */);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -247,7 +251,7 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
|
|||||||
dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
|
dismissEvent.addPostAnimationCallback(mFinishLaunchHomeRunnable);
|
||||||
dismissEvent.addPostAnimationCallback(closeSystemWindows);
|
dismissEvent.addPostAnimationCallback(closeSystemWindows);
|
||||||
|
|
||||||
if(mTaskStackHorizontalGridView.getChildCount() > 0 && animateTaskViews) {
|
if (mTaskStackHorizontalGridView.getChildCount() > 0 && animateTaskViews) {
|
||||||
mHomeRecentsEnterExitAnimationHolder.startExitAnimation(dismissEvent);
|
mHomeRecentsEnterExitAnimationHolder.startExitAnimation(dismissEvent);
|
||||||
} else {
|
} else {
|
||||||
closeSystemWindows.run();
|
closeSystemWindows.run();
|
||||||
@@ -374,7 +378,7 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
|
|||||||
public void onEnterAnimationComplete() {
|
public void onEnterAnimationComplete() {
|
||||||
super.onEnterAnimationComplete();
|
super.onEnterAnimationComplete();
|
||||||
if(mLaunchedFromHome) {
|
if(mLaunchedFromHome) {
|
||||||
mHomeRecentsEnterExitAnimationHolder.startEnterAnimation();
|
mHomeRecentsEnterExitAnimationHolder.startEnterAnimation(mPipManager.isPipShown());
|
||||||
}
|
}
|
||||||
EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
|
EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
|
||||||
}
|
}
|
||||||
@@ -463,7 +467,7 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
|
|||||||
if (launchState.launchedFromHome) {
|
if (launchState.launchedFromHome) {
|
||||||
dismissRecentsToHome(true /* animateTaskViews */);
|
dismissRecentsToHome(true /* animateTaskViews */);
|
||||||
} else {
|
} else {
|
||||||
dismissRecentsToLaunchTargetTaskOrHome();
|
dismissRecentsToLaunchTargetTaskOrHome(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,6 +565,8 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
|
|||||||
// as if it's the part of the Recents UI.
|
// as if it's the part of the Recents UI.
|
||||||
mPipRecentsOverlayManager.requestFocus(
|
mPipRecentsOverlayManager.requestFocus(
|
||||||
mTaskStackViewAdapter.getItemCount() > 0);
|
mTaskStackViewAdapter.getItemCount() > 0);
|
||||||
|
} else {
|
||||||
|
mPipRecentsOverlayManager.clearFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ public class DismissAnimationsHolder {
|
|||||||
private LinearLayout mDismissArea;
|
private LinearLayout mDismissArea;
|
||||||
private LinearLayout mInfoField;
|
private LinearLayout mInfoField;
|
||||||
private View mThumbnailView;
|
private View mThumbnailView;
|
||||||
private int mCardYDelta;
|
private int mDismissEnterYDelta;
|
||||||
|
private int mDismissStartYDelta;
|
||||||
private long mShortDuration;
|
private long mShortDuration;
|
||||||
private long mLongDuration;
|
private long mLongDuration;
|
||||||
|
|
||||||
@@ -38,7 +39,8 @@ public class DismissAnimationsHolder {
|
|||||||
mDismissArea = (LinearLayout) taskCardView.findViewById(R.id.card_dismiss);
|
mDismissArea = (LinearLayout) taskCardView.findViewById(R.id.card_dismiss);
|
||||||
mThumbnailView = taskCardView.findViewById(R.id.card_view_thumbnail);
|
mThumbnailView = taskCardView.findViewById(R.id.card_view_thumbnail);
|
||||||
Resources res = taskCardView.getResources();
|
Resources res = taskCardView.getResources();
|
||||||
mCardYDelta = res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
|
mDismissEnterYDelta = res.getDimensionPixelOffset(R.dimen.recents_tv_dismiss_shift_down);
|
||||||
|
mDismissStartYDelta = mDismissEnterYDelta * 2;
|
||||||
mShortDuration = res.getInteger(R.integer.dismiss_short_duration);
|
mShortDuration = res.getInteger(R.integer.dismiss_short_duration);
|
||||||
mLongDuration = res.getInteger(R.integer.dismiss_long_duration);
|
mLongDuration = res.getInteger(R.integer.dismiss_long_duration);
|
||||||
}
|
}
|
||||||
@@ -52,13 +54,13 @@ public class DismissAnimationsHolder {
|
|||||||
mInfoField.animate()
|
mInfoField.animate()
|
||||||
.setDuration(mShortDuration)
|
.setDuration(mShortDuration)
|
||||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
||||||
.translationYBy(mCardYDelta)
|
.translationY(mDismissEnterYDelta)
|
||||||
.alpha(0.5f);
|
.alpha(0.5f);
|
||||||
|
|
||||||
mThumbnailView.animate()
|
mThumbnailView.animate()
|
||||||
.setDuration(mShortDuration)
|
.setDuration(mShortDuration)
|
||||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
||||||
.translationYBy(mCardYDelta)
|
.translationY(mDismissEnterYDelta)
|
||||||
.alpha(0.5f);
|
.alpha(0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,13 +73,13 @@ public class DismissAnimationsHolder {
|
|||||||
mInfoField.animate()
|
mInfoField.animate()
|
||||||
.setDuration(mShortDuration)
|
.setDuration(mShortDuration)
|
||||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
||||||
.translationYBy(-mCardYDelta)
|
.translationY(0)
|
||||||
.alpha(1.0f);
|
.alpha(1.0f);
|
||||||
|
|
||||||
mThumbnailView.animate()
|
mThumbnailView.animate()
|
||||||
.setDuration(mShortDuration)
|
.setDuration(mShortDuration)
|
||||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
||||||
.translationYBy(-mCardYDelta)
|
.translationY(0)
|
||||||
.alpha(1.0f);
|
.alpha(1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,14 +92,14 @@ public class DismissAnimationsHolder {
|
|||||||
mInfoField.animate()
|
mInfoField.animate()
|
||||||
.setDuration(mLongDuration)
|
.setDuration(mLongDuration)
|
||||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
||||||
.translationYBy(mCardYDelta)
|
.translationY(mDismissStartYDelta)
|
||||||
.alpha(0.0f)
|
.alpha(0.0f)
|
||||||
.setListener(listener);
|
.setListener(listener);
|
||||||
|
|
||||||
mThumbnailView.animate()
|
mThumbnailView.animate()
|
||||||
.setDuration(mLongDuration)
|
.setDuration(mLongDuration)
|
||||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
||||||
.translationYBy(mCardYDelta)
|
.translationY(mDismissStartYDelta)
|
||||||
.alpha(0.0f);
|
.alpha(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class HomeRecentsEnterExitAnimationHolder {
|
|||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private TaskStackHorizontalGridView mGridView;
|
private TaskStackHorizontalGridView mGridView;
|
||||||
|
private float mDimAlpha;
|
||||||
private long mDelay;
|
private long mDelay;
|
||||||
private int mDuration;
|
private int mDuration;
|
||||||
private int mTranslationX;
|
private int mTranslationX;
|
||||||
@@ -36,18 +37,19 @@ public class HomeRecentsEnterExitAnimationHolder {
|
|||||||
TaskStackHorizontalGridView gridView) {
|
TaskStackHorizontalGridView gridView) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mGridView = gridView;
|
mGridView = gridView;
|
||||||
|
mDimAlpha = mContext.getResources().getFloat(R.dimen.recents_recents_row_dim_alpha);
|
||||||
mTranslationX = mContext.getResources()
|
mTranslationX = mContext.getResources()
|
||||||
.getDimensionPixelSize(R.dimen.recents_tv_home_recents_shift);
|
.getDimensionPixelSize(R.dimen.recents_tv_home_recents_shift);
|
||||||
mDelay = mContext.getResources().getInteger(R.integer.recents_home_delay);
|
mDelay = mContext.getResources().getInteger(R.integer.recents_home_delay);
|
||||||
mDuration = mContext.getResources().getInteger(R.integer.recents_home_duration);
|
mDuration = mContext.getResources().getInteger(R.integer.recents_home_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startEnterAnimation() {
|
public void startEnterAnimation(boolean isPipShown) {
|
||||||
for(int i = 0; i < mGridView.getChildCount(); i++) {
|
for(int i = 0; i < mGridView.getChildCount(); i++) {
|
||||||
TaskCardView view = (TaskCardView) mGridView.getChildAt(i);
|
TaskCardView view = (TaskCardView) mGridView.getChildAt(i);
|
||||||
view.setTranslationX(-mTranslationX);
|
view.setTranslationX(-mTranslationX);
|
||||||
view.animate()
|
view.animate()
|
||||||
.alpha(1.0f)
|
.alpha(isPipShown ? mDimAlpha : 1.0f)
|
||||||
.translationX(0)
|
.translationX(0)
|
||||||
.setDuration(mDuration)
|
.setDuration(mDuration)
|
||||||
.setStartDelay(mDelay * i)
|
.setStartDelay(mDelay * i)
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ import com.android.systemui.recents.tv.views.TaskCardView;
|
|||||||
* Recents row's focus animation with PIP controls.
|
* Recents row's focus animation with PIP controls.
|
||||||
*/
|
*/
|
||||||
public class RecentsRowFocusAnimationHolder {
|
public class RecentsRowFocusAnimationHolder {
|
||||||
private static final float DIM_ALPHA = 0.5f;
|
|
||||||
|
|
||||||
private View mView;
|
private View mView;
|
||||||
private View mTitleView;
|
private View mTitleView;
|
||||||
|
|
||||||
@@ -43,6 +41,7 @@ public class RecentsRowFocusAnimationHolder {
|
|||||||
|
|
||||||
Resources res = view.getResources();
|
Resources res = view.getResources();
|
||||||
int duration = res.getInteger(R.integer.recents_tv_pip_focus_anim_duration);
|
int duration = res.getInteger(R.integer.recents_tv_pip_focus_anim_duration);
|
||||||
|
float dimAlpha = res.getFloat(R.dimen.recents_recents_row_dim_alpha);
|
||||||
|
|
||||||
mFocusGainAnimatorSet = new AnimatorSet();
|
mFocusGainAnimatorSet = new AnimatorSet();
|
||||||
mFocusGainAnimatorSet.playTogether(
|
mFocusGainAnimatorSet.playTogether(
|
||||||
@@ -53,7 +52,7 @@ public class RecentsRowFocusAnimationHolder {
|
|||||||
|
|
||||||
mFocusLoseAnimatorSet = new AnimatorSet();
|
mFocusLoseAnimatorSet = new AnimatorSet();
|
||||||
mFocusLoseAnimatorSet.playTogether(
|
mFocusLoseAnimatorSet.playTogether(
|
||||||
ObjectAnimator.ofFloat(mView, "alpha", DIM_ALPHA),
|
ObjectAnimator.ofFloat(mView, "alpha", dimAlpha),
|
||||||
ObjectAnimator.ofFloat(mTitleView, "alpha", 0f));
|
ObjectAnimator.ofFloat(mTitleView, "alpha", 0f));
|
||||||
mFocusLoseAnimatorSet.setDuration(duration);
|
mFocusLoseAnimatorSet.setDuration(duration);
|
||||||
mFocusLoseAnimatorSet.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
|
mFocusLoseAnimatorSet.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class RecentsTvView extends FrameLayout {
|
|||||||
if (mTaskStackHorizontalView != null) {
|
if (mTaskStackHorizontalView != null) {
|
||||||
Task task = mTaskStackHorizontalView.getFocusedTask();
|
Task task = mTaskStackHorizontalView.getFocusedTask();
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
launchTaskFomRecents(task);
|
launchTaskFomRecents(task, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,12 +120,12 @@ public class RecentsTvView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Launches the task that recents was launched from if possible */
|
/** Launches the task that recents was launched from if possible */
|
||||||
public boolean launchPreviousTask() {
|
public boolean launchPreviousTask(boolean animate) {
|
||||||
if (mTaskStackHorizontalView != null) {
|
if (mTaskStackHorizontalView != null) {
|
||||||
TaskStack stack = mTaskStackHorizontalView.getStack();
|
TaskStack stack = mTaskStackHorizontalView.getStack();
|
||||||
Task task = stack.getLaunchTarget();
|
Task task = stack.getLaunchTarget();
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
launchTaskFomRecents(task);
|
launchTaskFomRecents(task, animate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,18 +137,25 @@ public class RecentsTvView extends FrameLayout {
|
|||||||
* attempt to scroll to focus the task before launching.
|
* attempt to scroll to focus the task before launching.
|
||||||
* @param task
|
* @param task
|
||||||
*/
|
*/
|
||||||
private void launchTaskFomRecents(final Task task) {
|
private void launchTaskFomRecents(final Task task, boolean animate) {
|
||||||
if(task != mTaskStackHorizontalView.getFocusedTask()) {
|
if (!animate) {
|
||||||
if(mScrollListener != null) {
|
SystemServicesProxy ssp = Recents.getSystemServices();
|
||||||
|
ssp.startActivityFromRecents(getContext(), task.key, task.title, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mTaskStackHorizontalView.requestFocus();
|
||||||
|
Task focusedTask = mTaskStackHorizontalView.getFocusedTask();
|
||||||
|
if (focusedTask != null && task != focusedTask) {
|
||||||
|
if (mScrollListener != null) {
|
||||||
mTaskStackHorizontalView.removeOnScrollListener(mScrollListener);
|
mTaskStackHorizontalView.removeOnScrollListener(mScrollListener);
|
||||||
}
|
}
|
||||||
mScrollListener = new OnScrollListener() {
|
mScrollListener = new OnScrollListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||||
super.onScrollStateChanged(recyclerView, newState);
|
super.onScrollStateChanged(recyclerView, newState);
|
||||||
if(newState == RecyclerView.SCROLL_STATE_IDLE) {
|
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||||
TaskCardView cardView = mTaskStackHorizontalView.getChildViewForTask(task);
|
TaskCardView cardView = mTaskStackHorizontalView.getChildViewForTask(task);
|
||||||
if(cardView != null) {
|
if (cardView != null) {
|
||||||
mTransitionHelper.launchTaskFromRecents(mStack, task,
|
mTransitionHelper.launchTaskFromRecents(mStack, task,
|
||||||
mTaskStackHorizontalView, cardView, null, INVALID_STACK_ID);
|
mTaskStackHorizontalView, cardView, null, INVALID_STACK_ID);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -150,10 +150,14 @@ public class PipRecentsOverlayManager {
|
|||||||
* is focused.
|
* is focused.
|
||||||
* This should be called only by {@link com.android.systemui.recents.tv.RecentsTvActivity}.
|
* This should be called only by {@link com.android.systemui.recents.tv.RecentsTvActivity}.
|
||||||
*/
|
*/
|
||||||
private void clearFocus() {
|
public void clearFocus() {
|
||||||
if (!mIsRecentsShown || !mIsPipFocusedInRecent) {
|
if (!mIsRecentsShown || !mIsPipFocusedInRecent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!mRecentsView.hasFocus()) {
|
||||||
|
// Let mRecentsView's focus listener handle clearFocus().
|
||||||
|
mRecentsView.requestFocus();
|
||||||
|
}
|
||||||
mIsPipFocusedInRecent = false;
|
mIsPipFocusedInRecent = false;
|
||||||
mPipManager.resizePinnedStack(STATE_PIP_RECENTS);
|
mPipManager.resizePinnedStack(STATE_PIP_RECENTS);
|
||||||
mWindowManager.updateViewLayout(mOverlayView, mPipRecentsControlsViewLayoutParams);
|
mWindowManager.updateViewLayout(mOverlayView, mPipRecentsControlsViewLayoutParams);
|
||||||
|
|||||||
Reference in New Issue
Block a user