Merge "Remove task based on object rather than position" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e1293b7d07
@@ -16,7 +16,6 @@
|
|||||||
package com.android.systemui.recents.tv.views;
|
package com.android.systemui.recents.tv.views;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.app.Activity;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -87,7 +86,7 @@ public class TaskStackHorizontalViewAdapter extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
removeAt(position);
|
removeTask(task);
|
||||||
EventBus.getDefault().send(new DeleteTaskDataEvent(task));
|
EventBus.getDefault().send(new DeleteTaskDataEvent(task));
|
||||||
mShouldReset = true;
|
mShouldReset = true;
|
||||||
}
|
}
|
||||||
@@ -148,20 +147,15 @@ public class TaskStackHorizontalViewAdapter extends
|
|||||||
return mTaskList.size();
|
return mTaskList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeAt(int position) {
|
|
||||||
Task removedTask = mTaskList.remove(position);
|
|
||||||
if (mGridView != null) {
|
|
||||||
mGridView.getStack().removeTask(removedTask, AnimationProps.IMMEDIATE,
|
|
||||||
false);
|
|
||||||
}
|
|
||||||
notifyItemRemoved(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeTask(Task task) {
|
public void removeTask(Task task) {
|
||||||
int position = mTaskList.indexOf(task);
|
int position = mTaskList.indexOf(task);
|
||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
mTaskList.remove(position);
|
mTaskList.remove(position);
|
||||||
notifyItemRemoved(position);
|
notifyItemRemoved(position);
|
||||||
|
if (mGridView != null) {
|
||||||
|
mGridView.getStack().removeTask(task, AnimationProps.IMMEDIATE,
|
||||||
|
false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user