blob: 46af4c1ced026566a6a88ee5bc67626514087744 [file] [log] [blame]
Winson Chung303e1ff2014-03-07 15:06:19 -08001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.systemui.recents.views;
18
Winson Chung14926462014-04-14 18:57:14 -070019import android.animation.TimeInterpolator;
20import android.animation.ValueAnimator;
Winson Chung6cb485f2014-05-19 10:30:43 -070021import android.content.ContentResolver;
Winson Chung303e1ff2014-03-07 15:06:19 -080022import android.content.Context;
Winson Chung14926462014-04-14 18:57:14 -070023import android.graphics.Canvas;
Winson Chung96e3bc12014-05-06 16:44:12 -070024import android.graphics.Outline;
Winson Chung14926462014-04-14 18:57:14 -070025import android.graphics.Path;
Winson Chung9f9679d2014-04-11 16:49:09 -070026import android.graphics.Point;
Winson Chung303e1ff2014-03-07 15:06:19 -080027import android.graphics.Rect;
Winson Chung14926462014-04-14 18:57:14 -070028import android.graphics.RectF;
Winson Chung6cb485f2014-05-19 10:30:43 -070029import android.provider.Settings;
Winson Chung37c8d8e2014-03-24 14:53:07 -070030import android.util.AttributeSet;
Winson Chung9f9679d2014-04-11 16:49:09 -070031import android.view.MotionEvent;
Winson Chung303e1ff2014-03-07 15:06:19 -080032import android.view.View;
Winson Chung14926462014-04-14 18:57:14 -070033import android.view.animation.AccelerateInterpolator;
Winson Chung303e1ff2014-03-07 15:06:19 -080034import android.widget.FrameLayout;
Winson Chung37c8d8e2014-03-24 14:53:07 -070035import com.android.systemui.R;
Winson Chung14926462014-04-14 18:57:14 -070036import com.android.systemui.recents.Constants;
Winson Chung303e1ff2014-03-07 15:06:19 -080037import com.android.systemui.recents.RecentsConfiguration;
38import com.android.systemui.recents.model.Task;
Winson Chung303e1ff2014-03-07 15:06:19 -080039
Winson Chung303e1ff2014-03-07 15:06:19 -080040
Winson Chung37c8d8e2014-03-24 14:53:07 -070041/* A task view */
Winson Chung6cb485f2014-05-19 10:30:43 -070042public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.OnClickListener,
43 View.OnLongClickListener {
Winson Chung37c8d8e2014-03-24 14:53:07 -070044 /** The TaskView callbacks */
45 interface TaskViewCallbacks {
46 public void onTaskIconClicked(TaskView tv);
Winson Chung9f9679d2014-04-11 16:49:09 -070047 public void onTaskInfoPanelShown(TaskView tv);
48 public void onTaskInfoPanelHidden(TaskView tv);
49 public void onTaskAppInfoClicked(TaskView tv);
Winson Chung54e297a2014-05-09 17:15:32 -070050 public void onTaskDismissed(TaskView tv);
Winson Chung9f9679d2014-04-11 16:49:09 -070051
Winson Chung37c8d8e2014-03-24 14:53:07 -070052 // public void onTaskViewReboundToTask(TaskView tv, Task t);
53 }
54
Winson Chung14926462014-04-14 18:57:14 -070055 int mDim;
56 int mMaxDim;
57 TimeInterpolator mDimInterpolator = new AccelerateInterpolator();
58
Winson Chung303e1ff2014-03-07 15:06:19 -080059 Task mTask;
Winson Chung37c8d8e2014-03-24 14:53:07 -070060 boolean mTaskDataLoaded;
Winson Chung9f9679d2014-04-11 16:49:09 -070061 boolean mTaskInfoPaneVisible;
Winson Chung1e8d71b2014-05-16 17:05:22 -070062 boolean mIsFocused;
Winson Chung9f9679d2014-04-11 16:49:09 -070063 Point mLastTouchDown = new Point();
Winson Chung14926462014-04-14 18:57:14 -070064 Path mRoundedRectClipPath = new Path();
Winson Chung37c8d8e2014-03-24 14:53:07 -070065
66 TaskThumbnailView mThumbnailView;
67 TaskBarView mBarView;
Winson Chung9f9679d2014-04-11 16:49:09 -070068 TaskInfoView mInfoView;
Winson Chung37c8d8e2014-03-24 14:53:07 -070069 TaskViewCallbacks mCb;
Winson Chung303e1ff2014-03-07 15:06:19 -080070
Winson Chung37c8d8e2014-03-24 14:53:07 -070071
72 public TaskView(Context context) {
73 this(context, null);
Winson Chung303e1ff2014-03-07 15:06:19 -080074 }
75
Winson Chung37c8d8e2014-03-24 14:53:07 -070076 public TaskView(Context context, AttributeSet attrs) {
77 this(context, attrs, 0);
78 }
Winson Chung303e1ff2014-03-07 15:06:19 -080079
Winson Chung37c8d8e2014-03-24 14:53:07 -070080 public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
81 this(context, attrs, defStyleAttr, 0);
82 }
83
84 public TaskView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
85 super(context, attrs, defStyleAttr, defStyleRes);
Winson Chung14926462014-04-14 18:57:14 -070086 setWillNotDraw(false);
Winson Chung37c8d8e2014-03-24 14:53:07 -070087 }
88
89 @Override
90 protected void onFinishInflate() {
Winson Chung14926462014-04-14 18:57:14 -070091 RecentsConfiguration config = RecentsConfiguration.getInstance();
92 mMaxDim = config.taskStackMaxDim;
93
Winson Chung37c8d8e2014-03-24 14:53:07 -070094 // Bind the views
95 mThumbnailView = (TaskThumbnailView) findViewById(R.id.task_view_thumbnail);
96 mBarView = (TaskBarView) findViewById(R.id.task_view_bar);
Winson Chung9f9679d2014-04-11 16:49:09 -070097 mInfoView = (TaskInfoView) findViewById(R.id.task_view_info_pane);
98
Winson Chung37c8d8e2014-03-24 14:53:07 -070099 if (mTaskDataLoaded) {
100 onTaskDataLoaded(false);
Winson Chung303e1ff2014-03-07 15:06:19 -0800101 }
102 }
103
Winson Chung9f9679d2014-04-11 16:49:09 -0700104 @Override
Winson Chung14926462014-04-14 18:57:14 -0700105 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
106 super.onMeasure(widthMeasureSpec, heightMeasureSpec);
107
108 // Update the rounded rect clip path
109 RecentsConfiguration config = RecentsConfiguration.getInstance();
110 float radius = config.taskViewRoundedCornerRadiusPx;
111 mRoundedRectClipPath.reset();
112 mRoundedRectClipPath.addRoundRect(new RectF(0, 0, getMeasuredWidth(), getMeasuredHeight()),
113 radius, radius, Path.Direction.CW);
Winson Chung96e3bc12014-05-06 16:44:12 -0700114
115 // Update the outline
116 Outline o = new Outline();
117 o.setRoundRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), radius);
118 setOutline(o);
Winson Chung14926462014-04-14 18:57:14 -0700119 }
120
121 @Override
Winson Chung9f9679d2014-04-11 16:49:09 -0700122 public boolean onInterceptTouchEvent(MotionEvent ev) {
123 switch (ev.getAction()) {
124 case MotionEvent.ACTION_DOWN:
125 case MotionEvent.ACTION_MOVE:
126 mLastTouchDown.set((int) ev.getX(), (int) ev.getY());
127 break;
128 }
129 return super.onInterceptTouchEvent(ev);
130 }
131
Winson Chung04dfe0d2014-03-14 14:06:29 -0700132 /** Set callback */
133 void setCallbacks(TaskViewCallbacks cb) {
Winson Chung303e1ff2014-03-07 15:06:19 -0800134 mCb = cb;
135 }
136
Winson Chung303e1ff2014-03-07 15:06:19 -0800137 /** Gets the task */
138 Task getTask() {
139 return mTask;
140 }
141
142 /** Synchronizes this view's properties with the task's transform */
Winson Chungc6a16232014-04-01 14:04:48 -0700143 void updateViewPropertiesToTaskTransform(TaskViewTransform animateFromTransform,
144 TaskViewTransform toTransform, int duration) {
Winson Chung96e3bc12014-05-06 16:44:12 -0700145 RecentsConfiguration config = RecentsConfiguration.getInstance();
146 int minZ = config.taskViewTranslationZMinPx;
147 int incZ = config.taskViewTranslationZIncrementPx;
148
Winson Chung54e297a2014-05-09 17:15:32 -0700149 // Update the bar view
150 mBarView.updateViewPropertiesToTaskTransform(animateFromTransform, toTransform, duration);
151
152 // Update this task view
Winson Chung303e1ff2014-03-07 15:06:19 -0800153 if (duration > 0) {
154 if (animateFromTransform != null) {
155 setTranslationY(animateFromTransform.translationY);
Winson Chung814086d2014-05-07 15:01:14 -0700156 if (Constants.DebugFlags.App.EnableShadows) {
157 setTranslationZ(Math.max(minZ, minZ + (animateFromTransform.t * incZ)));
158 }
Winson Chung303e1ff2014-03-07 15:06:19 -0800159 setScaleX(animateFromTransform.scale);
160 setScaleY(animateFromTransform.scale);
Winson Chungc6a16232014-04-01 14:04:48 -0700161 setAlpha(animateFromTransform.alpha);
Winson Chung303e1ff2014-03-07 15:06:19 -0800162 }
Winson Chung814086d2014-05-07 15:01:14 -0700163 if (Constants.DebugFlags.App.EnableShadows) {
164 animate().translationZ(Math.max(minZ, minZ + (toTransform.t * incZ)));
165 }
Winson Chungc6a16232014-04-01 14:04:48 -0700166 animate().translationY(toTransform.translationY)
167 .scaleX(toTransform.scale)
168 .scaleY(toTransform.scale)
169 .alpha(toTransform.alpha)
Winson Chung303e1ff2014-03-07 15:06:19 -0800170 .setDuration(duration)
Winson Chung918c0722014-05-08 15:04:23 -0700171 .setInterpolator(config.defaultBezierInterpolator)
Winson Chungc6a16232014-04-01 14:04:48 -0700172 .withLayer()
Winson Chung14926462014-04-14 18:57:14 -0700173 .setUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
174 @Override
175 public void onAnimationUpdate(ValueAnimator animation) {
176 updateDimOverlayFromScale();
177 }
178 })
Winson Chung303e1ff2014-03-07 15:06:19 -0800179 .start();
180 } else {
Winson Chungc6a16232014-04-01 14:04:48 -0700181 setTranslationY(toTransform.translationY);
Winson Chung814086d2014-05-07 15:01:14 -0700182 if (Constants.DebugFlags.App.EnableShadows) {
183 setTranslationZ(Math.max(minZ, minZ + (toTransform.t * incZ)));
184 }
Winson Chungc6a16232014-04-01 14:04:48 -0700185 setScaleX(toTransform.scale);
186 setScaleY(toTransform.scale);
187 setAlpha(toTransform.alpha);
Winson Chung303e1ff2014-03-07 15:06:19 -0800188 }
Winson Chung14926462014-04-14 18:57:14 -0700189 updateDimOverlayFromScale();
190 invalidate();
Winson Chung303e1ff2014-03-07 15:06:19 -0800191 }
192
193 /** Resets this view's properties */
194 void resetViewProperties() {
195 setTranslationX(0f);
196 setTranslationY(0f);
Winson Chung814086d2014-05-07 15:01:14 -0700197 if (Constants.DebugFlags.App.EnableShadows) {
198 setTranslationZ(0f);
199 }
Winson Chung303e1ff2014-03-07 15:06:19 -0800200 setScaleX(1f);
201 setScaleY(1f);
202 setAlpha(1f);
Winson Chung14926462014-04-14 18:57:14 -0700203 invalidate();
Winson Chung303e1ff2014-03-07 15:06:19 -0800204 }
205
Winson Chung11ca76a52014-04-10 17:29:13 -0700206 /**
207 * When we are un/filtering, this method will set up the transform that we are animating to,
208 * in order to hide the task.
209 */
Winson Chungc6a16232014-04-01 14:04:48 -0700210 void prepareTaskTransformForFilterTaskHidden(TaskViewTransform toTransform) {
211 // Fade the view out and slide it away
212 toTransform.alpha = 0f;
213 toTransform.translationY += 200;
214 }
215
Winson Chung11ca76a52014-04-10 17:29:13 -0700216 /**
217 * When we are un/filtering, this method will setup the transform that we are animating from,
218 * in order to show the task.
219 */
Winson Chungc6a16232014-04-01 14:04:48 -0700220 void prepareTaskTransformForFilterTaskVisible(TaskViewTransform fromTransform) {
221 // Fade the view in
222 fromTransform.alpha = 0f;
223 }
224
Winson Chung303e1ff2014-03-07 15:06:19 -0800225 /** Animates this task view as it enters recents */
226 public void animateOnEnterRecents() {
Winson Chung37c8d8e2014-03-24 14:53:07 -0700227 RecentsConfiguration config = RecentsConfiguration.getInstance();
Winson Chung37c8d8e2014-03-24 14:53:07 -0700228 mBarView.setAlpha(0f);
Winson Chung37c8d8e2014-03-24 14:53:07 -0700229 mBarView.animate()
230 .alpha(1f)
Winson Chung918c0722014-05-08 15:04:23 -0700231 .setStartDelay(250)
232 .setInterpolator(config.defaultBezierInterpolator)
Winson Chung0d767552014-04-09 14:33:23 -0700233 .setDuration(config.taskBarEnterAnimDuration)
Winson Chung37c8d8e2014-03-24 14:53:07 -0700234 .withLayer()
235 .start();
Winson Chung303e1ff2014-03-07 15:06:19 -0800236 }
237
238 /** Animates this task view as it exits recents */
239 public void animateOnLeavingRecents(final Runnable r) {
Winson Chung37c8d8e2014-03-24 14:53:07 -0700240 RecentsConfiguration config = RecentsConfiguration.getInstance();
Winson Chung37c8d8e2014-03-24 14:53:07 -0700241 mBarView.animate()
242 .alpha(0f)
Winson Chung37c8d8e2014-03-24 14:53:07 -0700243 .setStartDelay(0)
Winson Chung918c0722014-05-08 15:04:23 -0700244 .setInterpolator(config.defaultBezierInterpolator)
Winson Chungf5e22e72014-05-02 18:35:35 -0700245 .setDuration(config.taskBarExitAnimDuration)
Winson Chung37c8d8e2014-03-24 14:53:07 -0700246 .withLayer()
Winson Chung0d767552014-04-09 14:33:23 -0700247 .withEndAction(new Runnable() {
248 @Override
249 public void run() {
250 post(r);
251 }
252 })
Winson Chung37c8d8e2014-03-24 14:53:07 -0700253 .start();
Winson Chung303e1ff2014-03-07 15:06:19 -0800254 }
255
Winson Chung9f49df92014-05-07 18:08:34 -0700256 /** Animates the deletion of this task view */
257 public void animateRemoval(final Runnable r) {
258 RecentsConfiguration config = RecentsConfiguration.getInstance();
259 animate().translationX(config.taskViewRemoveAnimTranslationXPx)
260 .alpha(0f)
261 .setStartDelay(0)
Winson Chung918c0722014-05-08 15:04:23 -0700262 .setInterpolator(config.defaultBezierInterpolator)
Winson Chung9f49df92014-05-07 18:08:34 -0700263 .setDuration(config.taskViewRemoveAnimDuration)
264 .withLayer()
265 .withEndAction(new Runnable() {
266 @Override
267 public void run() {
268 post(r);
269 }
270 })
271 .start();
272 }
273
Winson Chung303e1ff2014-03-07 15:06:19 -0800274 /** Returns the rect we want to clip (it may not be the full rect) */
Winson Chung0d767552014-04-09 14:33:23 -0700275 Rect getClippingRect(Rect outRect) {
Winson Chung303e1ff2014-03-07 15:06:19 -0800276 getHitRect(outRect);
277 // XXX: We should get the hit rect of the thumbnail view and intersect, but this is faster
278 outRect.right = outRect.left + mThumbnailView.getRight();
279 outRect.bottom = outRect.top + mThumbnailView.getBottom();
Winson Chung303e1ff2014-03-07 15:06:19 -0800280 return outRect;
281 }
282
Winson Chung9f9679d2014-04-11 16:49:09 -0700283 /** Returns whether this task has an info pane visible */
284 boolean isInfoPaneVisible() {
285 return mTaskInfoPaneVisible;
286 }
287
288 /** Shows the info pane if it is not visible. */
289 void showInfoPane(Rect taskVisibleRect) {
290 if (mTaskInfoPaneVisible) return;
291
292 // Remove the bar view from the visible rect and update the info pane contents
293 taskVisibleRect.top += mBarView.getMeasuredHeight();
294 mInfoView.updateContents(taskVisibleRect);
295
296 // Show the info pane and animate it into view
297 mInfoView.setVisibility(View.VISIBLE);
298 mInfoView.animateCircularClip(mLastTouchDown, 0f, 1f, null, true);
299 mInfoView.setOnClickListener(this);
300 mTaskInfoPaneVisible = true;
301
302 // Notify any callbacks
303 if (mCb != null) {
304 mCb.onTaskInfoPanelShown(this);
305 }
306 }
307
308 /** Hides the info pane if it is visible. */
309 void hideInfoPane() {
310 if (!mTaskInfoPaneVisible) return;
311 RecentsConfiguration config = RecentsConfiguration.getInstance();
312
313 // Cancel any circular clip animation
314 mInfoView.cancelCircularClipAnimation();
315
316 // Animate the info pane out
317 mInfoView.animate()
318 .alpha(0f)
319 .setDuration(config.taskViewInfoPaneAnimDuration)
Winson Chung918c0722014-05-08 15:04:23 -0700320 .setInterpolator(config.defaultBezierInterpolator)
Winson Chung9f9679d2014-04-11 16:49:09 -0700321 .withLayer()
322 .withEndAction(new Runnable() {
323 @Override
324 public void run() {
325 mInfoView.setVisibility(View.INVISIBLE);
326 mInfoView.setOnClickListener(null);
327
328 mInfoView.setAlpha(1f);
329 }
330 })
331 .start();
332 mTaskInfoPaneVisible = false;
333
334 // Notify any callbacks
335 if (mCb != null) {
336 mCb.onTaskInfoPanelHidden(this);
337 }
338 }
339
Winson Chung303e1ff2014-03-07 15:06:19 -0800340 /** Enable the hw layers on this task view */
341 void enableHwLayers() {
Winson Chung303e1ff2014-03-07 15:06:19 -0800342 mThumbnailView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
343 }
344
345 /** Disable the hw layers on this task view */
346 void disableHwLayers() {
Winson Chung303e1ff2014-03-07 15:06:19 -0800347 mThumbnailView.setLayerType(View.LAYER_TYPE_NONE, null);
348 }
349
Winson Chung14926462014-04-14 18:57:14 -0700350 /** Update the dim as a function of the scale of this view. */
351 void updateDimOverlayFromScale() {
352 float minScale = Constants.Values.TaskStackView.StackPeekMinScale;
353 float scaleRange = 1f - minScale;
354 float dim = (1f - getScaleX()) / scaleRange;
355 dim = mDimInterpolator.getInterpolation(Math.min(dim, 1f));
356 mDim = Math.max(0, Math.min(mMaxDim, (int) (dim * 255)));
357 invalidate();
358 }
359
360 @Override
361 public void draw(Canvas canvas) {
362 // Apply the rounded rect clip path on the whole view
363 canvas.clipPath(mRoundedRectClipPath);
364
365 super.draw(canvas);
366
367 // Apply the dim if necessary
368 if (mDim > 0) {
369 canvas.drawColor(mDim << 24);
370 }
371 }
372
Winson Chung1e8d71b2014-05-16 17:05:22 -0700373 /**
374 * Sets the focused task explicitly. We need a separate flag because requestFocus() won't happen
375 * if the view is not currently visible, or we are in touch state (where we still want to keep
376 * track of focus).
377 */
378 public void setFocusedTask() {
379 mIsFocused = true;
380 requestFocus();
381 }
382
383 /**
384 * Updates the explicitly focused state when the view focus changes.
385 */
386 @Override
387 protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
388 super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
389 if (!gainFocus) {
390 mIsFocused = false;
391 }
392 }
393
394 /**
395 * Returns whether we have explicitly been focused.
396 */
397 public boolean isFocusedTask() {
398 return mIsFocused || isFocused();
399 }
400
Winson Chung4d7b0922014-03-13 17:14:17 -0700401 /**** TaskCallbacks Implementation ****/
402
Winson Chung04dfe0d2014-03-14 14:06:29 -0700403 /** Binds this task view to the task */
404 public void onTaskBound(Task t) {
405 mTask = t;
406 mTask.setCallbacks(this);
Winson Chung303e1ff2014-03-07 15:06:19 -0800407 }
408
409 @Override
Winson Chung4c71aef2014-03-21 15:15:11 -0700410 public void onTaskDataLoaded(boolean reloadingTaskData) {
Winson Chung9f9679d2014-04-11 16:49:09 -0700411 if (mThumbnailView != null && mBarView != null && mInfoView != null) {
Winson Chung37c8d8e2014-03-24 14:53:07 -0700412 // Bind each of the views to the new task data
413 mThumbnailView.rebindToTask(mTask, reloadingTaskData);
414 mBarView.rebindToTask(mTask, reloadingTaskData);
Winson Chungf5e22e72014-05-02 18:35:35 -0700415 mInfoView.rebindToTask(mTask, reloadingTaskData);
Winson Chung9f9679d2014-04-11 16:49:09 -0700416 // Rebind any listeners
417 mBarView.mApplicationIcon.setOnClickListener(this);
Winson Chung54e297a2014-05-09 17:15:32 -0700418 mBarView.mDismissButton.setOnClickListener(this);
Winson Chung6cb485f2014-05-19 10:30:43 -0700419 if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) {
420 ContentResolver cr = getContext().getContentResolver();
421 boolean devOptsEnabled = Settings.Global.getInt(cr,
422 Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
423 if (devOptsEnabled) {
424 mBarView.mApplicationIcon.setOnLongClickListener(this);
425 }
426 }
427 if (Constants.DebugFlags.App.EnableInfoPane) {
428 mInfoView.mAppInfoButton.setOnClickListener(this);
429 }
Winson Chung37c8d8e2014-03-24 14:53:07 -0700430 }
431 mTaskDataLoaded = true;
Winson Chung4d7b0922014-03-13 17:14:17 -0700432 }
433
434 @Override
Winson Chung04dfe0d2014-03-14 14:06:29 -0700435 public void onTaskDataUnloaded() {
Winson Chung9f9679d2014-04-11 16:49:09 -0700436 if (mThumbnailView != null && mBarView != null && mInfoView != null) {
Winson Chung37c8d8e2014-03-24 14:53:07 -0700437 // Unbind each of the views from the task data and remove the task callback
438 mTask.setCallbacks(null);
439 mThumbnailView.unbindFromTask();
440 mBarView.unbindFromTask();
Winson Chung9f9679d2014-04-11 16:49:09 -0700441 // Unbind any listeners
442 mBarView.mApplicationIcon.setOnClickListener(null);
Winson Chung6cb485f2014-05-19 10:30:43 -0700443 mBarView.mDismissButton.setOnClickListener(null);
444 if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) {
445 mBarView.mApplicationIcon.setOnLongClickListener(null);
446 }
447 if (Constants.DebugFlags.App.EnableInfoPane) {
448 mInfoView.mAppInfoButton.setOnClickListener(null);
449 }
Winson Chung37c8d8e2014-03-24 14:53:07 -0700450 }
451 mTaskDataLoaded = false;
Winson Chung4d7b0922014-03-13 17:14:17 -0700452 }
453
454 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -0800455 public void onClick(View v) {
Winson Chung9f9679d2014-04-11 16:49:09 -0700456 if (v == mInfoView) {
Winson Chung96e3bc12014-05-06 16:44:12 -0700457 hideInfoPane();
Winson Chung9f9679d2014-04-11 16:49:09 -0700458 } else if (v == mBarView.mApplicationIcon) {
459 mCb.onTaskIconClicked(this);
Winson Chung54e297a2014-05-09 17:15:32 -0700460 } else if (v == mBarView.mDismissButton) {
461 // Animate out the view and call the callback
462 final TaskView tv = this;
463 animateRemoval(new Runnable() {
464 @Override
465 public void run() {
466 mCb.onTaskDismissed(tv);
467 }
468 });
Winson Chung9f9679d2014-04-11 16:49:09 -0700469 } else if (v == mInfoView.mAppInfoButton) {
470 mCb.onTaskAppInfoClicked(this);
471 }
Winson Chung303e1ff2014-03-07 15:06:19 -0800472 }
Winson Chung6cb485f2014-05-19 10:30:43 -0700473
474 @Override
475 public boolean onLongClick(View v) {
476 if (v == mBarView.mApplicationIcon) {
477 mCb.onTaskAppInfoClicked(this);
478 return true;
479 }
480 return false;
481 }
Winson Chung303e1ff2014-03-07 15:06:19 -0800482}