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

Commit 23e2836c authored by Paul Soulos's avatar Paul Soulos
Browse files

Adds TalkBack content details to Contact card

bug: 17308004
Change-Id: I357c6b508eaa3ef7dbb61be99c09806b322f6770
parent 9bb1a80e
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -702,6 +702,19 @@
    <!-- Content description for directions secondary button [CHAR LIMIT=NONE] -->
    <!-- Content description for directions secondary button [CHAR LIMIT=NONE] -->
    <string name="content_description_directions">directions to location</string>
    <string name="content_description_directions">directions to location</string>


    <!-- Content description for recent sms interaction [CHAR LIMIT=NONE] -->
    <string name="content_description_recent_sms">recent sms. <xliff:g id="message_details">%s</xliff:g>. click to respond</string>

    <!-- Header for the Relation entry [CHAR LIMIT=NONE] -->
    <string name="content_description_recent_call_type_incoming">incoming</string>
    <!-- Header for the Relation entry [CHAR LIMIT=NONE] -->
    <string name="content_description_recent_call_type_outgoing">outgoing</string>
    <!-- Header for the Relation entry [CHAR LIMIT=NONE] -->
    <string name="content_description_recent_call_type_missed">missed</string>

    <!-- Content description for recent sms interaction [CHAR LIMIT=NONE] -->
    <string name="content_description_recent_call">recent call. <xliff:g id="call_details">%s</xliff:g>. click to call back</string>

    <!-- Prefix for messages that you sent [CHAR LIMIT=40] -->
    <!-- Prefix for messages that you sent [CHAR LIMIT=40] -->
    <string name="message_from_you_prefix">You: <xliff:g id="sms_body">%s</xliff:g></string>
    <string name="message_from_you_prefix">You: <xliff:g id="sms_body">%s</xliff:g></string>


+6 −0
Original line number Original line Diff line number Diff line
@@ -276,4 +276,10 @@ public class CalendarInteraction implements ContactInteraction {
    public String getUid2445() {
    public String getUid2445() {
        return mValues.getAsString(Attendees.UID_2445);
        return mValues.getAsString(Attendees.UID_2445);
    }
    }

    @Override
    public String getContentDescription(Context context) {
        // The default TalkBack is good
        return null;
    }
}
}
+29 −0
Original line number Original line Diff line number Diff line
@@ -173,4 +173,33 @@ public class CallLogInteraction implements ContactInteraction {
    public Integer getType() {
    public Integer getType() {
        return mValues.getAsInteger(Calls.TYPE);
        return mValues.getAsInteger(Calls.TYPE);
    }
    }

    @Override
    public String getContentDescription(Context context) {
        String callDetails = getCallTypeString(context) + ". " + getViewFooter(context) + ". " +
                getViewHeader(context) + ". " + getViewFooter(context);
        return context.getResources().getString(R.string.content_description_recent_call,
                callDetails);
    }

    private String getCallTypeString(Context context) {
        String callType = "";
        Resources res = context.getResources();
        Integer type = getType();
        if (type == null) {
            return callType;
        }
        switch (type) {
            case Calls.INCOMING_TYPE:
                callType = res.getString(R.string.content_description_recent_call_type_incoming);
                break;
            case Calls.MISSED_TYPE:
                callType = res.getString(R.string.content_description_recent_call_type_missed);
                break;
            case Calls.OUTGOING_TYPE:
                callType = res.getString(R.string.content_description_recent_call_type_outgoing);
                break;
        }
        return callType;
    }
}
}
 No newline at end of file
+1 −0
Original line number Original line Diff line number Diff line
@@ -32,4 +32,5 @@ public interface ContactInteraction {
    Drawable getIcon(Context context);
    Drawable getIcon(Context context);
    Drawable getBodyIcon(Context context);
    Drawable getBodyIcon(Context context);
    Drawable getFooterIcon(Context context);
    Drawable getFooterIcon(Context context);
    String getContentDescription(Context context);
}
}
+8 −0
Original line number Original line Diff line number Diff line
@@ -152,4 +152,12 @@ public class SmsInteraction implements ContactInteraction {
    public Integer getType() {
    public Integer getType() {
        return mValues.getAsInteger(Sms.TYPE);
        return mValues.getAsInteger(Sms.TYPE);
    }
    }

    @Override
    public String getContentDescription(Context context) {
        String messageDetails = getViewHeader(context) + ". " + getViewBody(context) + ". " +
                getViewFooter(context);
        return context.getResources().getString(R.string.content_description_recent_sms,
                messageDetails);
    }
}
}
Loading