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

Commit c62cc793 authored by Brian Attwell's avatar Brian Attwell
Browse files

Display phone numbers as LTR

Also, force some TextView to align with viewStart. Otherwise, when using
a LTR locale some TextViews will have different alignment depending on their
contents. This looks bad.

Bug: 17761636
Change-Id: If40dafc73ae5f4f3c99d985304d426ad59722140
parent f9271f67
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
        android:layout_toEndOf="@+id/icon"
        android:layout_toStartOf="@+id/icon_alternate"
        android:textColor="@color/quickcontact_entry_header_text_color"
        android:textAlignment="viewStart"
        android:layout_marginBottom="@dimen/expanding_entry_card_header_margin_bottom" />

    <TextView
@@ -53,6 +54,7 @@
        android:layout_below="@+id/header"
        android:layout_toEndOf="@+id/icon_sub_header"
        android:layout_toStartOf="@+id/icon_alternate"
        android:textAlignment="viewStart"
        android:textColor="@color/quickcontact_entry_sub_header_text_color" />

    <ImageView
@@ -71,6 +73,7 @@
        android:layout_below="@+id/sub_header"
        android:layout_toEndOf="@+id/icon_text"
        android:layout_toStartOf="@+id/icon_alternate"
        android:textAlignment="viewStart"
        android:textColor="@color/quickcontact_entry_sub_header_text_color" />

    <ImageView
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
    android:textColor="@color/actionbar_text_color"
    android:maxLines="@integer/quickcontact_title_lines"
    android:textSize="@dimen/quickcontact_maximum_title_size"
    android:textAlignment="viewStart"
    android:ellipsize="end"
    android:importantForAccessibility="no"
    android:id="@+id/large_title"/>
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -34,7 +34,9 @@ import android.content.res.Resources.NotFoundException;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.ContactsContract.DisplayNameSources;
import android.text.BidiFormatter;
import android.text.Html;
import android.text.TextDirectionHeuristics;
import android.text.TextUtils;
import android.util.Log;
import android.view.MenuItem;
@@ -52,6 +54,7 @@ import java.util.List;
 */
public class ContactDisplayUtils {
    private static final String TAG = "ContactDisplayUtils";
    private static BidiFormatter sBidiFormatter = BidiFormatter.getInstance();

    /**
     * Returns the display name of the contact, using the current display order setting.
@@ -62,6 +65,10 @@ public class ContactDisplayUtils {
        final CharSequence displayName = contactData.getDisplayName();
        if (prefs.getDisplayOrder() == ContactsPreferences.DISPLAY_ORDER_PRIMARY) {
            if (!TextUtils.isEmpty(displayName)) {
                if (contactData.getDisplayNameSource() == DisplayNameSources.PHONE) {
                    return sBidiFormatter.unicodeWrap(
                            displayName.toString(), TextDirectionHeuristics.LTR);
                }
                return displayName;
            }
        } else {
+5 −2
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.util.Log;
import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;

/**
 * Represents a call log event interaction, wrapping the columns in
@@ -46,6 +47,7 @@ public class CallLogInteraction implements ContactInteraction {
    private static final String URI_TARGET_PREFIX = "tel:";
    private static final int CALL_LOG_ICON_RES = R.drawable.ic_phone_24dp;
    private static final int CALL_ARROW_ICON_RES = R.drawable.ic_call_arrow;
    private static BidiFormatter sBidiFormatter = BidiFormatter.getInstance();

    private ContentValues mValues;

@@ -159,7 +161,8 @@ public class CallLogInteraction implements ContactInteraction {
    }

    public String getNumber() {
        return mValues.getAsString(Calls.NUMBER);
        return sBidiFormatter.unicodeWrap(
                mValues.getAsString(Calls.NUMBER), TextDirectionHeuristics.LTR);
    }

    public Integer getNumberPresentation() {
+5 −1
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.Telephony.Sms;
import android.text.BidiFormatter;
import android.text.TextDirectionHeuristics;

/**
 * Represents an sms interaction, wrapping the columns in
@@ -32,6 +34,7 @@ public class SmsInteraction implements ContactInteraction {

    private static final String URI_TARGET_PREFIX = "smsto:";
    private static final int SMS_ICON_RES = R.drawable.ic_message_24dp;
    private static BidiFormatter sBidiFormatter = BidiFormatter.getInstance();

    private ContentValues mValues;

@@ -89,7 +92,8 @@ public class SmsInteraction implements ContactInteraction {
    }

    public String getAddress() {
        return mValues.getAsString(Sms.ADDRESS);
        return sBidiFormatter.unicodeWrap(
                mValues.getAsString(Sms.ADDRESS), TextDirectionHeuristics.LTR);
    }

    public String getBody() {
Loading