summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/recent
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2011-09-30 11:07:30 -0700
committerMichael Jurka <mikejurka@google.com>2011-09-30 16:44:01 -0700
commit7daf95d5526e3b60f5db29cbacd9a4852d99a6f4 (patch)
tree07f9ad6cfbc3c05660c95d823c6b3d4d0700f1b8 /packages/SystemUI/src/com/android/systemui/recent
parent55b039f1b7ecb0439e095082e82c4d4fa2627921 (diff)
downloadframeworks_base-7daf95d5526e3b60f5db29cbacd9a4852d99a6f4.zip
frameworks_base-7daf95d5526e3b60f5db29cbacd9a4852d99a6f4.tar.gz
frameworks_base-7daf95d5526e3b60f5db29cbacd9a4852d99a6f4.tar.bz2
Fixing accessibility support in Recent Apps
- also switching "Recent applications" to "Recent apps" as per our new language guidelines Change-Id: Ib625429ad22ce75ede782d59c0f45894d00c8502
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recent')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java60
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java30
3 files changed, 75 insertions, 42 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 1c9d80d..58af255 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -26,6 +26,7 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.View.OnTouchListener;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
@@ -65,6 +66,13 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
mPerformanceHelper.addViewCallback(view);
}
+ OnTouchListener noOpListener = new OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ return true;
+ }
+ };
+
view.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mCallback.dismiss();
@@ -78,22 +86,25 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
mCallback.handleOnClick(view);
}
};
+
+ final View thumbnailView = view.findViewById(R.id.app_thumbnail);
OnLongClickListener longClickListener = new OnLongClickListener() {
public boolean onLongClick(View v) {
final View anchorView = view.findViewById(R.id.app_description);
- final View thumbnailView = view.findViewById(R.id.app_thumbnail);
mCallback.handleLongPress(view, anchorView, thumbnailView);
return true;
}
};
- final View thumbnail = view.findViewById(R.id.app_thumbnail);
- thumbnail.setClickable(true);
- thumbnail.setOnClickListener(launchAppListener);
- thumbnail.setOnLongClickListener(longClickListener);
+ thumbnailView.setClickable(true);
+ thumbnailView.setOnClickListener(launchAppListener);
+ thumbnailView.setOnLongClickListener(longClickListener);
+
+ // We don't want to dismiss recents if a user clicks on the app title
+ // (we also don't want to launch the app either, though, because the
+ // app title is a small target and doesn't have great click feedback)
final View appTitle = view.findViewById(R.id.app_label);
- appTitle.setClickable(true);
- appTitle.setOnClickListener(launchAppListener);
- appTitle.setOnLongClickListener(longClickListener);
+ appTitle.setContentDescription(" ");
+ appTitle.setOnTouchListener(noOpListener);
mLinearLayout.addView(view);
}
// Scroll to end after layout.
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 54bc4e3..ca9e273 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -32,12 +32,9 @@ import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.RectF;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.StateListDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Handler;
@@ -56,7 +53,6 @@ import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
-import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.PopupMenu;
@@ -202,6 +198,7 @@ public class RecentsPanelView extends RelativeLayout
holder.descriptionView.setText(activityDescription.recentTaskInfo.description);
holder.thumbnailView.setTag(activityDescription);
holder.thumbnailView.setOnLongClickListener(new OnLongClickDelegate(convertView));
+ holder.thumbnailView.setContentDescription(activityDescription.getLabel());
holder.activityDescription = activityDescription;
return convertView;
@@ -228,6 +225,23 @@ public class RecentsPanelView extends RelativeLayout
}
public void show(boolean show, boolean animate) {
+ if (show) {
+ // Need to update list of recent apps before we set visibility so this view's
+ // content description is updated before it gets focus for TalkBack mode
+ refreshApplicationList();
+
+ // if there are no apps, either bring up a "No recent apps" message, or just
+ // quit early
+ boolean noApps = (mActivityDescriptions.size() == 0);
+ if (mRecentsNoApps != null) { // doesn't exist on large devices
+ mRecentsNoApps.setVisibility(noApps ? View.VISIBLE : View.INVISIBLE);
+ } else {
+ if (noApps) {
+ if (DEBUG) Log.v(TAG, "Nothing to show");
+ return;
+ }
+ }
+ }
if (animate) {
if (mShowing != show) {
mShowing = show;
@@ -378,11 +392,13 @@ public class RecentsPanelView extends RelativeLayout
mRecentsNoApps = findViewById(R.id.recents_no_apps);
mChoreo = new Choreographer(this, mRecentsScrim, mRecentsGlowView, mRecentsNoApps, this);
mRecentsDismissButton = findViewById(R.id.recents_dismiss_button);
- mRecentsDismissButton.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- hide(true);
- }
- });
+ if (mRecentsDismissButton != null) {
+ mRecentsDismissButton.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ hide(true);
+ }
+ });
+ }
// In order to save space, we make the background texture repeat in the Y direction
if (mRecentsScrim != null && mRecentsScrim.getBackground() instanceof BitmapDrawable) {
@@ -400,9 +416,6 @@ public class RecentsPanelView extends RelativeLayout
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + changedView + ", " + visibility + ")");
- if (visibility == View.VISIBLE && changedView == this) {
- refreshApplicationList();
- }
if (mRecentsContainer instanceof RecentsHorizontalScrollView) {
((RecentsHorizontalScrollView) mRecentsContainer).onRecentsVisibilityChanged();
@@ -553,6 +566,7 @@ public class RecentsPanelView extends RelativeLayout
}
h.iconView.setVisibility(View.VISIBLE);
h.labelView.setText(ad.getLabel());
+ h.thumbnailView.setContentDescription(ad.getLabel());
if (anim) {
h.labelView.setAnimation(AnimationUtils.loadAnimation(
mContext, R.anim.recent_appear));
@@ -582,10 +596,18 @@ public class RecentsPanelView extends RelativeLayout
mThumbnailLoader.cancel(false);
mThumbnailLoader = null;
}
- if (mRecentsNoApps != null) { // doesn't exist on large devices
- mRecentsNoApps.setVisibility(View.INVISIBLE);
- }
+
mActivityDescriptions = getRecentTasks();
+ int numRecentApps = mActivityDescriptions.size();
+ String recentAppsAccessibilityDescription;
+ if (numRecentApps == 0) {
+ recentAppsAccessibilityDescription =
+ getResources().getString(R.string.status_bar_no_recent_apps);
+ } else {
+ recentAppsAccessibilityDescription = getResources().getQuantityString(
+ R.plurals.status_bar_accessibility_recent_apps, numRecentApps, numRecentApps);
+ }
+ setContentDescription(recentAppsAccessibilityDescription);
for (ActivityDescription ad : mActivityDescriptions) {
ad.setThumbnail(mDefaultThumbnailBackground);
}
@@ -649,14 +671,6 @@ public class RecentsPanelView extends RelativeLayout
};
mThumbnailLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
- } else {
- // Immediately hide this panel
- if (DEBUG) Log.v(TAG, "Nothing to show");
- if (mRecentsNoApps != null) { // doesn't exist on large devices
- mRecentsNoApps.setVisibility(View.VISIBLE);
- } else {
- hide(false);
- }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 213803c..7853402 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -74,6 +74,13 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
}
if (old == null) {
+ OnTouchListener noOpListener = new OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ return true;
+ }
+ };
+
view.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mCallback.dismiss();
@@ -87,26 +94,27 @@ public class RecentsVerticalScrollView extends ScrollView implements SwipeHelper
mCallback.handleOnClick(view);
}
};
+
+ final View thumbnailView = view.findViewById(R.id.app_thumbnail);
OnLongClickListener longClickListener = new OnLongClickListener() {
public boolean onLongClick(View v) {
final View anchorView = view.findViewById(R.id.app_description);
- final View thumbnailView = view.findViewById(R.id.app_thumbnail);
mCallback.handleLongPress(view, anchorView, thumbnailView);
return true;
}
};
- final View thumbnail = view.findViewById(R.id.app_thumbnail);
- thumbnail.setClickable(true);
- thumbnail.setOnClickListener(launchAppListener);
- thumbnail.setOnLongClickListener(longClickListener);
+ thumbnailView.setClickable(true);
+ thumbnailView.setOnClickListener(launchAppListener);
+ thumbnailView.setOnLongClickListener(longClickListener);
+
+ // We don't want to dismiss recents if a user clicks on the app title
+ // (we also don't want to launch the app either, though, because the
+ // app title is a small target and doesn't have great click feedback)
final View appTitle = view.findViewById(R.id.app_label);
- appTitle.setClickable(true);
- appTitle.setOnClickListener(launchAppListener);
- appTitle.setOnLongClickListener(longClickListener);
+ appTitle.setContentDescription(" ");
+ appTitle.setOnTouchListener(noOpListener);
final View calloutLine = view.findViewById(R.id.recents_callout_line);
- calloutLine.setClickable(true);
- calloutLine.setOnClickListener(launchAppListener);
- calloutLine.setOnLongClickListener(longClickListener);
+ calloutLine.setOnTouchListener(noOpListener);
mLinearLayout.addView(view);
}
}