diff options
author | Brian Attwell <brianattwell@google.com> | 2014-10-17 14:32:35 -0700 |
---|---|---|
committer | Brian Attwell <brianattwell@google.com> | 2014-10-17 21:38:32 +0000 |
commit | ed95f6c490fb9549a88918ddf421cfb70694c52d (patch) | |
tree | 0265a853b72551d9389174c0abf29123672f1bb1 /src/com/android/contacts/common/vcard/ExportVCardActivity.java | |
parent | aef550d6b509fa31e5f19a8a700abc31c5d4689f (diff) | |
download | android_packages_apps_ContactsCommon-ed95f6c490fb9549a88918ddf421cfb70694c52d.tar.gz android_packages_apps_ContactsCommon-ed95f6c490fb9549a88918ddf421cfb70694c52d.tar.bz2 android_packages_apps_ContactsCommon-ed95f6c490fb9549a88918ddf421cfb70694c52d.zip |
Improve appearance of export file path
I fixed two issues
1. We were using two kinds of numerals in the file path, arabic
and english. Lets just stick with english numerals
2. English numerals are "weakly LTR" characters. Therefore,
having the following formatting 0001.vcf is equivalent to
<weak ltr chars><neutral chars><strong rtl chars>. This results
in weird rendering, since the default locale is RTL. Fix: put
the url in a LTR embedding.
Bug: 9195099
Change-Id: I1260a3430d7d3a0c029c1a1ac5ffcc421b08a98a
Diffstat (limited to 'src/com/android/contacts/common/vcard/ExportVCardActivity.java')
-rw-r--r-- | src/com/android/contacts/common/vcard/ExportVCardActivity.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/contacts/common/vcard/ExportVCardActivity.java b/src/com/android/contacts/common/vcard/ExportVCardActivity.java index 3d6f6022..008beb68 100644 --- a/src/com/android/contacts/common/vcard/ExportVCardActivity.java +++ b/src/com/android/contacts/common/vcard/ExportVCardActivity.java @@ -30,6 +30,8 @@ import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Messenger; +import android.text.BidiFormatter; +import android.text.TextDirectionHeuristics; import android.text.TextUtils; import android.util.Log; @@ -111,6 +113,7 @@ public class ExportVCardActivity extends Activity implements ServiceConnection, private VCardService mService; private final Messenger mIncomingMessenger = new Messenger(new IncomingHandler()); + private static final BidiFormatter mBidiFormatter = BidiFormatter.getInstance(); // Used temporarily when asking users to confirm the file name private String mTargetFileName; @@ -208,13 +211,22 @@ public class ExportVCardActivity extends Activity implements ServiceConnection, } } + /** + * Returns the name of the target path with additional formatting characters to improve its + * appearance in bidirectional text. + */ + private String getTargetFileForDisplay() { + return mBidiFormatter.unicodeWrap(mTargetFileName, TextDirectionHeuristics.LTR); + } + @Override protected Dialog onCreateDialog(int id, Bundle bundle) { switch (id) { case R.id.dialog_export_confirmation: { return new AlertDialog.Builder(this) .setTitle(R.string.confirm_export_title) - .setMessage(getString(R.string.confirm_export_message, mTargetFileName)) + .setMessage(getString(R.string.confirm_export_message, + getTargetFileForDisplay())) .setPositiveButton(android.R.string.ok, new ExportConfirmationListener(mTargetFileName)) .setNegativeButton(android.R.string.cancel, this) @@ -258,7 +270,7 @@ public class ExportVCardActivity extends Activity implements ServiceConnection, ((AlertDialog)dialog).setMessage(mErrorReason); } else if (id == R.id.dialog_export_confirmation) { ((AlertDialog)dialog).setMessage( - getString(R.string.confirm_export_message, mTargetFileName)); + getString(R.string.confirm_export_message, getTargetFileForDisplay())); } else { super.onPrepareDialog(id, dialog, args); } |