First task should launch when tapped.

Broken from previous CL.
Bug: 79539824

Change-Id: I9c4b00731afeeb815d2c7f3dcaf4ae4f029dec30
This commit is contained in:
Hyunyoung Song 2018-05-16 14:03:20 -07:00
parent 0d1db51ce8
commit 27289bbe40
2 changed files with 9 additions and 12 deletions

View File

@ -418,7 +418,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
final int requiredChildCount = tasks.size();
for (int i = getChildCount(); i < requiredChildCount; i++) {
final TaskView taskView = (TaskView) inflater.inflate(R.layout.task, this, false);
taskView.setOnClickListener(this::onTaskClicked);
addView(taskView);
}
while (getChildCount() > requiredChildCount) {
@ -444,17 +443,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
onTaskStackUpdated();
}
private void onTaskClicked(View v) {
TaskView taskView = (TaskView) v;
if (taskView.getTask() == null) {
return;
}
taskView.launchTask(true /* animate */);
mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(
Touch.TAP, Direction.NONE, indexOfChild(taskView),
TaskUtils.getComponentKeyForTask(taskView.getTask().key));
}
protected void onTaskStackUpdated() { }
public void resetTaskVisuals() {

View File

@ -110,6 +110,15 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback
public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setOnClickListener((view) -> {
if (getTask() == null) {
return;
}
launchTask(true /* animate */);
BaseActivity.fromContext(context).getUserEventDispatcher().logTaskLaunchOrDismiss(
Touch.TAP, Direction.NONE, ((RecentsView) getParent()).indexOfChild(this),
TaskUtils.getComponentKeyForTask(getTask().key));
});
setOutlineProvider(new TaskOutlineProvider(getResources()));
}