Example usage for android.text BidiFormatter getInstance

List of usage examples for android.text BidiFormatter getInstance

Introduction

In this page you can find the example usage for android.text BidiFormatter getInstance.

Prototype

public static BidiFormatter getInstance() 

Source Link

Document

Factory for creating an instance of BidiFormatter for the default locale directionality.

Usage

From source file:tk.wasdennnoch.androidn_ify.ui.emergency.preferences.ContactPreference.java

public void setUri(@NonNull Uri contactUri) {
    if (mContact != null && !contactUri.equals(mContact.getContactUri()) && mRemoveContactDialog != null) {
        mRemoveContactDialog.dismiss();//  w w  w.j a va  2 s.com
    }

    mContact = EmergencyContactManager.getContact(getContext(), contactUri);

    setTitle(mContact.getName());
    setKey(mContact.getContactUri().toString());
    String summary = mContact.getPhoneType() == null ? mContact.getPhoneNumber()
            : String.format(getContext().getResources().getString(R.string.phone_type_and_phone_number),
                    mContact.getPhoneType(), BidiFormatter.getInstance().unicodeWrap(mContact.getPhoneNumber(),
                            TextDirectionHeuristics.LTR));
    setSummary(summary);

    // Update the message to show the correct name.
    if (mRemoveContactDialog != null) {
        mRemoveContactDialog
                .setMessage(String.format(getContext().getString(R.string.remove_contact), mContact.getName()));
    }

    //TODO: Consider doing the following in a non-UI thread.
    Drawable icon;
    if (mContact.getPhoto() != null) {
        icon = new CircleFramedDrawable(mContact.getPhoto(),
                (int) getContext().getResources().getDimension(R.dimen.circle_avatar_size));
    } else {
        icon = getContext().getResources().getDrawable(R.drawable.ic_person_black_24dp);
    }
    setIcon(icon);
}

From source file:com.android.contacts.preference.DisplayOptionsPreferenceFragment.java

public void updateMyInfoPreference(boolean hasProfile, String displayName, long contactId,
        int displayNameSource) {
    final CharSequence summary = !hasProfile ? getString(R.string.set_up_profile)
            : displayNameSource == DisplayNameSources.PHONE
                    ? BidiFormatter.getInstance().unicodeWrap(displayName, TextDirectionHeuristics.LTR)
                    : displayName;//from w  w  w . j  a v  a 2s.c  om
    mMyInfoPreference.setSummary(summary);
    mHasProfile = hasProfile;
    mProfileContactId = contactId;
    mMyInfoPreference.setOnPreferenceClickListener(this);
}