Remove accessibility delegate on shortcut card.
An accessbility delegate is set in the Call Log Adaptor to
automatically expand the call log list item when tapped in
accessibility mode. We don't want this for the shortcut card,
because it shouldn't be expandable.
When not doing this expansion, the shortcut card now obtains
accessibility focus and reading properly.
Change the description text for the shortcut card so it reads
"call back #/name". Should update this later with a string to
include the other information, but it's not straightforward to
do right now.
Bug: 17929331
Change-Id: I691fe238ea436916ab7505c39039b6c1cea27781
diff --git a/src/com/android/dialer/list/ShortcutCardsAdapter.java b/src/com/android/dialer/list/ShortcutCardsAdapter.java
index 09f4e49..4fe638e 100644
--- a/src/com/android/dialer/list/ShortcutCardsAdapter.java
+++ b/src/com/android/dialer/list/ShortcutCardsAdapter.java
@@ -21,7 +21,6 @@
import android.database.Cursor;
import android.database.DataSetObserver;
import android.graphics.Rect;
-import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
@@ -29,6 +28,7 @@
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
+import android.widget.TextView;
import com.android.dialer.R;
import com.android.dialer.calllog.CallLogAdapter;
@@ -197,7 +197,8 @@
// the PhoneFavoriteMergedAdapter, but keep the original look of the item in
// the CallLogAdapter.
final View view = mCallLogAdapter.getView(position, convertView == null ?
- null : wrapper.getChildAt(0), parent);
+ null : wrapper.getChildAt(0), parent
+ );
wrapper.removeAllViews();
wrapper.prepareChildView(view);
wrapper.addView(view);
@@ -234,6 +235,8 @@
}
private void prepareChildView(View view) {
+ // Override CallLogAdapter's accessibility behavior; don't expand the shortcut card.
+ view.setAccessibilityDelegate(null);
view.setBackgroundResource(R.drawable.rounded_corner_bg);
final FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
@@ -247,13 +250,18 @@
view.setLayoutParams(params);
LinearLayout actionView =
- (LinearLayout)view.findViewById(R.id.primary_action_view);
+ (LinearLayout) view.findViewById(R.id.primary_action_view);
actionView.setPaddingRelative(
mCallLogPaddingStart,
mCallLogPaddingTop,
actionView.getPaddingEnd(),
mCallLogPaddingBottom);
+ // TODO: Set content description including type/location and time information.
+ TextView nameView = (TextView) actionView.findViewById(R.id.name);
+ actionView.setContentDescription(getResources().getString(
+ R.string.description_call_back_action, nameView.getText()));
+
mPreviousTranslationZ = getResources().getDimensionPixelSize(
R.dimen.recent_call_log_item_translation_z);
view.setTranslationZ(mPreviousTranslationZ);