Merge "Alternate method for adding dismiss in talkback" into nyc-dev
diff --git a/packages/SystemUI/res/layout-television/recents_on_tv.xml b/packages/SystemUI/res/layout-television/recents_on_tv.xml
index 1dbd1b3..82b9f8c 100644
--- a/packages/SystemUI/res/layout-television/recents_on_tv.xml
+++ b/packages/SystemUI/res/layout-television/recents_on_tv.xml
@@ -40,4 +40,16 @@
android:focusable="true"
android:visibility="visible" />
+ <!-- Placeholder to dismiss during talkback. -->
+ <ImageView
+ android:id="@+id/dismiss_placeholder"
+ android:layout_width="@dimen/recents_tv_dismiss_icon_size"
+ android:layout_height="@dimen/recents_tv_dismiss_icon_size"
+ android:layout_gravity="bottom|center_horizontal"
+ android:layout_marginBottom="50dp"
+ android:src="@drawable/ic_cancel_white_24dp"
+ android:contentDescription="@string/status_bar_accessibility_dismiss_recents"
+ android:focusable="true"
+ android:visibility="gone" />
+
</com.android.systemui.recents.tv.views.RecentsTvView>
diff --git a/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml b/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
index 36df924..08a1a93 100644
--- a/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
+++ b/packages/SystemUI/res/layout-television/recents_tv_task_card_view.xml
@@ -50,7 +50,6 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/recents_tv_dismiss_icon_top_margin"
android:layout_marginBottom="@dimen/recents_tv_dismiss_icon_bottom_margin"
- android:contentDescription="@string/status_bar_accessibility_dismiss_recents"
android:alpha="@integer/dismiss_unselected_alpha"
android:src="@drawable/recents_tv_dismiss_icon" />
<TextView
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java b/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
index ecb64f6..1a55958 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/RecentsTvActivity.java
@@ -388,6 +388,26 @@
mTaskStackHorizontalGridView.setSelectedPosition(0);
}
+ View dismissPlaceholder = findViewById(R.id.dismiss_placeholder);
+ if (ssp.isTouchExplorationEnabled()) {
+ dismissPlaceholder.setAccessibilityTraversalBefore(R.id.task_list);
+ dismissPlaceholder.setAccessibilityTraversalAfter(R.id.dismiss_placeholder);
+ mTaskStackHorizontalGridView.setAccessibilityTraversalAfter(R.id.dismiss_placeholder);
+ mTaskStackHorizontalGridView.setAccessibilityTraversalBefore(R.id.pip);
+ dismissPlaceholder.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mTaskStackHorizontalGridView.requestFocus();
+ mTaskStackHorizontalGridView.
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
+ Task focusedTask = mTaskStackHorizontalGridView.getFocusedTask();
+ if (focusedTask != null) {
+ mTaskStackViewAdapter.removeTask(focusedTask);
+ EventBus.getDefault().send(new DeleteTaskDataEvent(focusedTask));
+ }
+ }
+ });
+ }
updatePipUI();
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
index b082658..06b2441 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/RecentsTvView.java
@@ -54,6 +54,7 @@
private TaskStack mStack;
private TaskStackHorizontalGridView mTaskStackHorizontalView;
private View mEmptyView;
+ private View mDismissPlaceholder;
private RecentsRowFocusAnimationHolder mEmptyViewFocusAnimationHolder;
private boolean mAwaitingFirstLayout = true;
private Rect mSystemInsets = new Rect();
@@ -86,6 +87,12 @@
mTransitionHelper = new RecentsTvTransitionHelper(mContext, mHandler);
}
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ mDismissPlaceholder = findViewById(R.id.dismiss_placeholder);
+ }
+
public void setTaskStack(TaskStack stack) {
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
@@ -198,6 +205,9 @@
public void showEmptyView() {
mEmptyView.setVisibility(View.VISIBLE);
mTaskStackHorizontalView.setVisibility(View.GONE);
+ if (Recents.getSystemServices().isTouchExplorationEnabled()) {
+ mDismissPlaceholder.setVisibility(View.GONE);
+ }
}
/**
@@ -206,6 +216,9 @@
public void hideEmptyView() {
mEmptyView.setVisibility(View.GONE);
mTaskStackHorizontalView.setVisibility(View.VISIBLE);
+ if (Recents.getSystemServices().isTouchExplorationEnabled()) {
+ mDismissPlaceholder.setVisibility(View.VISIBLE);
+ }
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java b/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
index bd85748..4eca5d5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/tv/views/TaskCardView.java
@@ -88,22 +88,10 @@
R.dimen.recents_task_view_rounded_corners_radius);
mRecentsRowFocusAnimationHolder = new RecentsRowFocusAnimationHolder(this, title);
SystemServicesProxy ssp = Recents.getSystemServices();
- if (ssp.isTouchExplorationEnabled()) {
- mDismissIconView.setFocusable(true);
- mDismissIconView.setFocusableInTouchMode(true);
- mDismissIconView.setOnFocusChangeListener(new OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- if (hasFocus) {
- setDismissState(true);
- } else {
- setDismissState(false);
- }
- }
- });
+ if (!ssp.isTouchExplorationEnabled()) {
+ mDismissIconView.setVisibility(VISIBLE);
} else {
- mDismissIconView.setFocusable(false);
- mDismissIconView.setFocusableInTouchMode(false);
+ mDismissIconView.setVisibility(GONE);
}
mViewFocusAnimator = new ViewFocusAnimator(this);
}