} else {
mRecentsView.getViewTreeObserver().addOnPreDrawListener(this);
}
- if(mTaskStackHorizontalGridView.getStack().getTaskCount() > 1 && !mLaunchedFromHome) {
- // If there are 2 or more tasks, and we are not launching from home
- // set the selected position to the 2nd task to allow for faster app switching
- mTaskStackHorizontalGridView.setSelectedPosition(1);
- } else {
- mTaskStackHorizontalGridView.setSelectedPosition(0);
- }
// If this is a new instance from a configuration change, then we have to manually trigger
// the enter animation state, or if recents was relaunched by AM, without going through
if(mLaunchedFromHome) {
mHomeRecentsEnterExitAnimationHolder.startEnterAnimation(mPipManager.isPipShown());
}
+ mTaskStackViewAdapter.setResetAddedCards(true);
EventBus.getDefault().send(new EnterRecentsWindowAnimationCompletedEvent());
}
public void onResume() {
super.onResume();
mPipRecentsOverlayManager.onRecentsResumed();
+ if(mTaskStackHorizontalGridView.getStack().getTaskCount() > 1 && !mLaunchedFromHome) {
+ // If there are 2 or more tasks, and we are not launching from home
+ // set the selected position to the 2nd task to allow for faster app switching
+ mTaskStackHorizontalGridView.setSelectedPosition(1);
+ } else {
+ mTaskStackHorizontalGridView.setSelectedPosition(0);
+ }
}
@Override
public void onPause() {
super.onPause();
mPipRecentsOverlayManager.onRecentsPaused();
+ mTaskStackViewAdapter.setResetAddedCards(false);
}
@Override
import android.animation.Animator.AnimatorListener;
import android.content.res.Resources;
import android.graphics.drawable.TransitionDrawable;
-import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
private TransitionDrawable mDismissDrawable;
private TextView mDismissText;
- private float mDismissUnselectedAlpha;
+ private float mDismissIconNotInDismissStateAlpha;
private long mShortDuration;
private long mLongDuration;
mDismissStartYDelta = mDismissEnterYDelta * 2;
mShortDuration = res.getInteger(R.integer.dismiss_short_duration);
mLongDuration = res.getInteger(R.integer.dismiss_long_duration);
- mDismissUnselectedAlpha = res.getFloat(R.integer.dismiss_unselected_alpha);
+ mDismissIconNotInDismissStateAlpha = res.getFloat(R.integer.dismiss_unselected_alpha);
}
public void startEnterAnimation() {
mCardDismissIcon.animate()
.setDuration(mShortDuration)
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .alpha(mDismissUnselectedAlpha)
+ .alpha(mDismissIconNotInDismissStateAlpha)
.withEndAction(new Runnable() {
@Override
public void run() {
mInfoField.animate().setListener(null);
mThumbnailView.setAlpha(1.0f);
mThumbnailView.setTranslationY(0);
- mCardDismissIcon.setAlpha(mDismissUnselectedAlpha);
+ mCardDismissIcon.setAlpha(0.0f);
mDismissText.setAlpha(0.0f);
}
}
private static final String TAG = "TaskStackViewAdapter";
private List<Task> mTaskList;
private TaskStackHorizontalGridView mGridView;
+ private boolean mResetAddedCards;
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
private TaskCardView mTaskCardView;
}
@Override
+ public void onViewAttachedToWindow(ViewHolder holder) {
+ if (mResetAddedCards) {
+ holder.mTaskCardView.reset();
+ }
+ }
+
+ @Override
public void onViewDetachedFromWindow(ViewHolder holder) {
// We only want to reset on view detach if this is the last task being dismissed.
// This is so that we do not reset when shifting to apps etc, as it is not needed.
mTaskList.add(position, task);
notifyItemInserted(position);
}
+
+ public void setResetAddedCards(boolean reset) {
+ mResetAddedCards = reset;
+ }
}