Merge "Add Launch Task Animation, re-do values for red-lines." into nyc-dev

am: d27dafeade

* commit 'd27dafeadeb38d451826122d0505702abf58bd1d':
  Add Launch Task Animation, re-do values for red-lines.
This commit is contained in:
Sid Soundararajan
2016-03-03 23:45:40 +00:00
committed by android-build-merger
18 changed files with 376 additions and 76 deletions

View File

@@ -245,7 +245,7 @@
android:stateNotNeeded="true"
android:resumeWhilePausing="true"
android:screenOrientation="behind"
android:theme="@style/RecentsTheme.Wallpaper">
android:theme="@style/RecentsTvTheme.Wallpaper">
<intent-filter>
<action android:name="com.android.systemui.recents.TOGGLE_RECENTS" />
</intent-filter>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#99000000"
android:endColor="#E6000000"
android:angle="90"/>
</shape>

View File

@@ -18,9 +18,10 @@
android:id="@+id/recents_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/recents_tv_background_gradient"
android:clipChildren="false"
android:clipToPadding="false" >
android:clipToPadding="false"
android:layoutDirection="rtl">
<com.android.systemui.recents.tv.views.TaskStackHorizontalGridView
android:id="@+id/task_list"
android:layout_width="wrap_content"

View File

@@ -20,28 +20,28 @@
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_gravity="center"
android:layout_centerInParent="true">
android:layout_centerInParent="true"
android:layoutDirection="ltr">
<RelativeLayout
<LinearLayout
android:layout_width="@dimen/recents_tv_card_width"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center">
<ImageView
android:id="@+id/card_view_thumbnail"
android:layout_width="match_parent"
android:layout_height="@dimen/recents_tv_card_height"
android:scaleType="centerCrop"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"/>
<RelativeLayout
android:layout_gravity="center"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/card_info_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/card_view_thumbnail"
android:background="@color/recents_tv_card_background_color" >
android:layout_height="wrap_content">
<ImageView
android:id="@+id/card_extra_badge"
android:layout_width="@dimen/recents_tv_card_extra_badge_size"
android:layout_height="@dimen/recents_tv_card_extra_badge_size"
android:layout_marginBottom="@dimen/recents_tv_icon_padding_bottom"
android:layout_marginEnd="@dimen/recents_tv_icon_padding_end"
android:scaleType="fitCenter"
android:layout_centerVertical="true"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/card_title_text"
android:layout_width="match_parent"
@@ -49,29 +49,21 @@
android:layout_alignParentTop="false"
android:includeFontPadding="true"
android:minLines="1"
android:maxLines="2"
android:maxLines="1"
android:textColor="@color/recents_tv_card_title_text_color"
android:ellipsize="end" />
<TextView
android:id="@+id/card_content_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@id/card_title_text"
android:includeFontPadding="true"
android:minLines="1"
android:maxLines="2"
android:textColor="@color/recents_tv_card_content_text_color"
android:ellipsize="end" />
<ImageView
android:id="@+id/card_extra_badge"
android:layout_width="@dimen/recents_tv_card_extra_badge_size"
android:layout_height="@dimen/recents_tv_card_extra_badge_size"
android:scaleType="fitCenter"
android:background="@android:color/transparent"
android:contentDescription="@null"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>
</RelativeLayout>
android:fontFamily="@string/font_roboto_regular"
android:textSize="@dimen/recents_tv_title_text_size"
android:layout_marginBottom="@dimen/recents_tv_text_padding_bottom"
android:ellipsize="end"/>
</LinearLayout>
<ImageView
android:id="@+id/card_view_thumbnail"
android:layout_width="match_parent"
android:layout_height="@dimen/recents_tv_card_height"
android:scaleType="centerCrop"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_below="@id/card_title_text" />
</LinearLayout>
</com.android.systemui.recents.tv.views.TaskCardView>

View File

@@ -18,7 +18,5 @@
-->
<resources>
<color name="recents_tv_card_background_color">#FF37474F</color>
<color name="recents_tv_card_title_text_color">#FFEEEEEE</color>
<color name="recents_tv_card_content_text_color">#99EEEEEE</color>
<color name="recents_tv_card_source_text_color">#99EEEEEE</color>
<color name="recents_tv_card_title_text_color">#CCEEEEEE</color>
</resources>

View File

@@ -18,15 +18,21 @@
-->
<resources>
<!-- Dimens for recents card in the recents view on tv -->
<dimen name="recents_tv_card_width">150dip</dimen>
<dimen name="recents_tv_card_height">85dip</dimen>
<dimen name="recents_tv_card_extra_badge_size">16dip</dimen>
<dimen name="recents_tv_card_width">268dip</dimen>
<dimen name="recents_tv_card_height">151dip</dimen>
<dimen name="recents_tv_card_extra_badge_size">20dip</dimen>
<dimen name="recents_tv_banner_width">114dip</dimen>
<dimen name="recents_tv_banner_height">64dip</dimen>
<dimen name="recents_tv_banner_margin_top">16dip</dimen>
<dimen name="recents_tv_icon_padding_bottom">8dip</dimen>
<dimen name="recents_tv_icon_padding_end">12dip</dimen>
<dimen name="recents_tv_text_padding_bottom">12dip</dimen>
<!-- Padding for grid view in recents view on tv -->
<dimen name="recents_tv_grid_row_padding">56dip</dimen>
<dimen name="recents_tv_gird_row_top_padding">57dip</dimen>
<dimen name="recents_tv_grid_max_row_height">200dip</dimen>
<dimen name="recents_tv_gird_card_spacing">8dip</dimen>
<dimen name="recents_tv_grid_max_row_height">268dip</dimen>
<dimen name="recents_tv_gird_card_spacing">20dip</dimen>
<!-- Values for focus animation -->
<dimen name="recents_tv_unselected_item_z">6dp</dimen>
@@ -34,4 +40,7 @@
<!-- Extra space around the PIP and its outline in PIP onboarding activity -->
<dimen name="tv_pip_bounds_space">3dp</dimen>
<!-- Values for text on recents cards on tv -->
<dimen name="recents_tv_title_text_size">12sp</dimen>
</resources>

View File

@@ -31,11 +31,13 @@
<string name="pip_cancel" translatable="false">Cancel</string>
<!-- Overlay text on PIP -->
<string name="pip_hold_home" translatable="false">Hold HOME to control PIP</string>
<!-- Picture-in-Picture onboarding screen -->
<eat-comment />
<!-- Description for onboarding screen. -->
<string name="pip_onboarding_description" translatable="false">Press and hold the HOME\nbutton to close or control it</string>
<!-- Button to close onboarding screen. -->
<string name="pip_onboarding_button" translatable="false">Got it</string>
<!-- Font for Recents -->
<!-- DO NOT TRANSLATE -->
<string name="font_roboto_regular" translatable="false">sans-serif</string>
</resources>

View File

@@ -22,4 +22,11 @@
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="RecentsTvTheme.Wallpaper" parent="@android:style/Theme.Material.NoActionBar.Overscan">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>

View File

@@ -66,6 +66,7 @@ import com.android.systemui.recents.model.RecentsTaskLoader;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskGrouping;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.tv.views.TaskStackHorizontalGridView;
import com.android.systemui.recents.views.TaskStackLayoutAlgorithm;
import com.android.systemui.recents.views.TaskStackView;
import com.android.systemui.recents.views.TaskStackViewScroller;

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.recents.events.activity;
import android.graphics.Rect;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.tv.views.TaskCardView;
public class LaunchTvTaskEvent extends EventBus.Event {
public final TaskCardView taskView;
public final Task task;
public final Rect targetTaskBounds;
public final int targetTaskStack;
public LaunchTvTaskEvent(TaskCardView taskView, Task task, Rect targetTaskBounds,
int targetTaskStack) {
this.taskView = taskView;
this.task = task;
this.targetTaskBounds = targetTaskBounds;
this.targetTaskStack = targetTaskStack;
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.recents.events.activity;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.tv.views.TaskCardView;
/**
* This event is sent following {@link LaunchTvTaskEvent} after the call to the system is made to
* start the task, only used on TV.
*/
public class LaunchTvTaskStartedEvent extends EventBus.AnimatedEvent {
public final TaskCardView taskView;
public LaunchTvTaskStartedEvent(TaskCardView taskView) {
this.taskView = taskView;
}
}

View File

@@ -694,6 +694,37 @@ public class SystemServicesProxy {
return icon;
}
/**
* Returns a banner used on TV for the specified Activity.
*/
public Drawable getActivityBanner(ActivityInfo info) {
if (mPm == null) return null;
// If we are mocking, then return a mock banner
if (RecentsDebugFlags.Static.EnableMockTasks) {
return new ColorDrawable(0xFF666666);
}
Drawable banner = info.loadBanner(mPm);
return banner;
}
/**
* Returns a logo used on TV for the specified Activity.
*/
public Drawable getActivityLogo(ActivityInfo info) {
if (mPm == null) return null;
// If we are mocking, then return a mock logo
if (RecentsDebugFlags.Static.EnableMockTasks) {
return new ColorDrawable(0xFF666666);
}
Drawable logo = info.loadLogo(mPm);
return logo;
}
/**
* Returns the given label for a user, badging if necessary.
*/

View File

@@ -59,6 +59,8 @@ import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.tv.pip.PipManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* The main TV recents activity started by the RecentsImpl.
@@ -156,11 +158,13 @@ public class RecentsTvActivity extends Activity implements OnPreDrawListener {
mRecentsView.setTaskStack(stack);
List stackTasks = stack.getStackTasks();
Collections.reverse(stackTasks);
if (mTaskStackViewAdapter == null) {
mTaskStackViewAdapter = new TaskStackHorizontalViewAdapter(stack.getStackTasks());
mTaskStackViewAdapter = new TaskStackHorizontalViewAdapter(stackTasks);
mRecentsView.setTaskStackViewAdapter(mTaskStackViewAdapter);
} else {
mTaskStackViewAdapter.setNewStackTasks(stack.getStackTasks());
mTaskStackViewAdapter.setNewStackTasks(stackTasks);
}
if (launchState.launchedToTaskId != -1) {

View File

@@ -0,0 +1,132 @@
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.recents.tv.views;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.IRemoteCallback;
import android.os.RemoteException;
import android.util.Log;
import android.view.WindowManagerGlobal;
import com.android.internal.annotations.GuardedBy;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.*;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
public class RecentsTvTransitionHelper {
private static final String TAG = "RecentsTvTransitionHelper";
private Context mContext;
private Handler mHandler;
public RecentsTvTransitionHelper(Context context, Handler handler) {
mContext = context;
mHandler = handler;
}
public void launchTaskFromRecents(final TaskStack stack, @Nullable final Task task,
final TaskStackHorizontalGridView stackView, final TaskCardView taskView,
final Rect bounds, int destinationStack) {
final ActivityOptions opts = ActivityOptions.makeBasic();
if (bounds != null) {
opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
}
final ActivityOptions.OnAnimationStartedListener animStartedListener;
if (task.thumbnail != null && task.thumbnail.getWidth() > 0 &&
task.thumbnail.getHeight() > 0) {
animStartedListener = new ActivityOptions.OnAnimationStartedListener() {
@Override
public void onAnimationStarted() {
// If we are launching into another task, cancel the previous task's
// window transition
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(task));
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
}
};
} else {
// This is only the case if the task is not on screen (scrolled offscreen for example)
animStartedListener = new ActivityOptions.OnAnimationStartedListener() {
@Override
public void onAnimationStarted() {
EventBus.getDefault().send(new ExitRecentsWindowFirstAnimationFrameEvent());
}
};
}
if (taskView == null) {
// If there is no task view, then we do not need to worry about animating out occluding
// task views, and we can launch immediately
startTaskActivity(stack, task, taskView, opts, animStartedListener);
} else {
LaunchTvTaskStartedEvent launchStartedEvent = new LaunchTvTaskStartedEvent(taskView);
EventBus.getDefault().send(launchStartedEvent);
startTaskActivity(stack, task, taskView, opts, animStartedListener);
}
}
private void startTaskActivity(TaskStack stack, Task task, @Nullable TaskCardView taskView,
ActivityOptions opts,final ActivityOptions.OnAnimationStartedListener animStartedListener) {
SystemServicesProxy ssp = Recents.getSystemServices();
if (ssp.startActivityFromRecents(mContext, task.key.id, task.title, opts)) {
// Keep track of the index of the task launch
int taskIndexFromFront = 0;
int taskIndex = stack.indexOfStackTask(task);
if (taskIndex > -1) {
taskIndexFromFront = stack.getTaskCount() - taskIndex - 1;
}
EventBus.getDefault().send(new LaunchTaskSucceededEvent(taskIndexFromFront));
} else {
// Keep track of failed launches
EventBus.getDefault().send(new LaunchTaskFailedEvent());
}
IRemoteCallback.Stub callback = null;
if (animStartedListener != null) {
callback = new IRemoteCallback.Stub() {
@Override
public void sendResult(Bundle data) throws RemoteException {
mHandler.post(new Runnable() {
@Override
public void run() {
if (animStartedListener != null) {
animStartedListener.onAnimationStarted();
}
}
});
}
};
}
try {
Rect taskRect = taskView.getGlobalRect();
WindowManagerGlobal.getWindowManagerService()
.overridePendingAppTransitionThumb(task.thumbnail, taskRect.left,
taskRect.top, callback, true);
} catch (RemoteException e) {
Log.w(TAG, "Failed to override transition: " + e);
}
}
}

View File

@@ -17,6 +17,7 @@ package com.android.systemui.recents.tv.views;
import android.content.Context;
import android.graphics.Rect;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -31,7 +32,7 @@ import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.CancelEnterRecentsWindowAnimationEvent;
import com.android.systemui.recents.events.activity.DismissRecentsToHomeAnimationStarted;
import com.android.systemui.recents.events.activity.TaskStackUpdatedEvent;
import com.android.systemui.recents.events.activity.LaunchTvTaskEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.Task;
@@ -53,7 +54,8 @@ public class RecentsTvView extends FrameLayout {
private View mEmptyView;
private boolean mAwaitingFirstLayout = true;
private Rect mSystemInsets = new Rect();
private RecentsTvTransitionHelper mTransitionHelper;
private Handler mHandler;
public RecentsTvView(Context context) {
this(context, null);
@@ -75,6 +77,8 @@ public class RecentsTvView extends FrameLayout {
LayoutInflater inflater = LayoutInflater.from(context);
mEmptyView = inflater.inflate(R.layout.recents_empty, this, false);
addView(mEmptyView);
mHandler = new Handler();
mTransitionHelper = new RecentsTvTransitionHelper(mContext, mHandler);
}
public void setTaskStack(TaskStack stack) {
@@ -209,6 +213,11 @@ public class RecentsTvView extends FrameLayout {
/**** EventBus Events ****/
public final void onBusEvent(LaunchTvTaskEvent event) {
mTransitionHelper.launchTaskFromRecents(mStack, event.task, mTaskStackHorizontalView,
event.taskView, event.targetTaskBounds, event.targetTaskStack);
}
public final void onBusEvent(DismissRecentsToHomeAnimationStarted event) {
// If we are going home, cancel the previous task's window transition
EventBus.getDefault().send(new CancelEnterRecentsWindowAnimationEvent(null));

View File

@@ -16,20 +16,20 @@
package com.android.systemui.recents.tv.views;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.tv.animations.ViewFocusAnimator;
import com.android.systemui.recents.model.Task;
public class TaskCardView extends RelativeLayout {
public class TaskCardView extends LinearLayout {
private ImageView mThumbnailView;
private TextView mTitleTextView;
private TextView mContentTextView;
private ImageView mBadgeView;
private Task mTask;
@@ -52,7 +52,6 @@ public class TaskCardView extends RelativeLayout {
protected void onFinishInflate() {
mThumbnailView = (ImageView) findViewById(R.id.card_view_thumbnail);
mTitleTextView = (TextView) findViewById(R.id.card_title_text);
mContentTextView = (TextView) findViewById(R.id.card_content_text);
mBadgeView = (ImageView) findViewById(R.id.card_extra_badge);
}
@@ -60,11 +59,27 @@ public class TaskCardView extends RelativeLayout {
mTask = task;
mThumbnailView.setImageBitmap(task.thumbnail);
mTitleTextView.setText(task.title);
mContentTextView.setText(task.contentDescription);
mBadgeView.setImageDrawable(task.icon);
}
public Task getTask() {
return mTask;
}
@Override
public void getFocusedRect(Rect r) {
mThumbnailView.getFocusedRect(r);
}
public Rect getFocusedRect() {
Rect r = new Rect();
getFocusedRect(r);
return r;
}
public Rect getGlobalRect() {
Rect r = new Rect();
getGlobalVisibleRect(r);
return r;
}
}

View File

@@ -15,7 +15,6 @@
*/
package com.android.systemui.recents.tv.views;
import android.content.Context;
import android.support.v17.leanback.widget.HorizontalGridView;
import android.util.AttributeSet;
@@ -36,13 +35,17 @@ import java.util.List;
/**
* Horizontal Grid View Implementation to show the Task Stack for TV.
*/
public class TaskStackHorizontalGridView extends HorizontalGridView implements TaskStackCallbacks{
public class TaskStackHorizontalGridView extends HorizontalGridView implements TaskStackCallbacks {
private TaskStack mStack;
private ArrayList<TaskCardView> mTaskViews = new ArrayList<>();
private Task mFocusedTask;
public TaskStackHorizontalGridView(Context context) {
this(context, null);
}
public TaskStackHorizontalGridView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@@ -64,8 +67,6 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T
* Resets this view for reuse.
*/
public void reset() {
// Reset the focused task
resetFocusedTask(getFocusedTask());
requestLayout();
}
@@ -73,12 +74,6 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T
* @param task - Task to reset
*/
private void resetFocusedTask(Task task) {
if (task != null) {
TaskCardView tv = getChildViewForTask(task);
if (tv != null) {
tv.requestFocus();
}
}
mFocusedTask = null;
}
@@ -107,6 +102,9 @@ public class TaskStackHorizontalGridView extends HorizontalGridView implements T
* @return - The focused task.
*/
public Task getFocusedTask() {
if (findFocus() != null) {
mFocusedTask = ((TaskCardView)findFocus()).getTask();
}
return mFocusedTask;
}

View File

@@ -16,7 +16,6 @@
package com.android.systemui.recents.tv.views;
import android.app.Activity;
import android.app.ActivityManagerNative;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
@@ -24,15 +23,20 @@ import android.view.View;
import android.view.ViewGroup;
import com.android.systemui.R;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.LaunchTvTaskEvent;
import com.android.systemui.recents.model.Task;
import java.util.ArrayList;
import java.util.List;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
public class TaskStackHorizontalViewAdapter extends
RecyclerView.Adapter<TaskStackHorizontalViewAdapter.ViewHolder> {
private static final String TAG = "TaskStackHorizontalViewAdapter";
//Full class name is 30 characters
private static final String TAG = "TaskStackViewAdapter";
private List<Task> mTaskList;
static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
@@ -54,7 +58,8 @@ public class TaskStackHorizontalViewAdapter extends
@Override
public void onClick(View v) {
try {
ActivityManagerNative.getDefault().startActivityFromRecents(mTask.key.id, null);
EventBus.getDefault().send(new LaunchTvTaskEvent(mTaskCardView, mTask,
null, INVALID_STACK_ID));
((Activity)(v.getContext())).finish();
} catch (Exception e) {
Log.e(TAG, v.getContext()
@@ -73,11 +78,12 @@ public class TaskStackHorizontalViewAdapter extends
mTaskList.addAll(tasks);
notifyDataSetChanged();
}
@Override
public TaskStackHorizontalViewAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.recents_task_card_view, parent, false);
.inflate(R.layout.recents_tv_task_card_view, parent, false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}