Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e847677 authored by Andrew Lee's avatar Andrew Lee
Browse files

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
parent 13db1832
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import android.content.res.Resources;
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.view.ViewGroup;
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 @@ public class ShortcutCardsAdapter extends BaseAdapter {
        // 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 @@ public class ShortcutCardsAdapter extends BaseAdapter {
        }

        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(
@@ -254,6 +257,11 @@ public class ShortcutCardsAdapter extends BaseAdapter {
                    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);