diff options
author | Narayan Kamath <narayan@google.com> | 2014-11-27 13:54:51 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-27 13:54:51 +0000 |
commit | 0a8db3acefd9d5c2f97d8366c07960c1fd0427f1 (patch) | |
tree | 3d3ca404867b086040d8b05ce9860cee0da8906d /src/com/android/phone | |
parent | da2983f95be3f7eca6d48a775688c0c56f2bfed6 (diff) | |
parent | a34883557d27662e7d6ed98035f90335d0c09cf5 (diff) | |
download | packages_apps_PhoneCommon-0a8db3acefd9d5c2f97d8366c07960c1fd0427f1.tar.gz packages_apps_PhoneCommon-0a8db3acefd9d5c2f97d8366c07960c1fd0427f1.tar.bz2 packages_apps_PhoneCommon-0a8db3acefd9d5c2f97d8366c07960c1fd0427f1.zip |
am a3488355: Merge "Get rid of manual translations for numbers."
* commit 'a34883557d27662e7d6ed98035f90335d0c09cf5':
Get rid of manual translations for numbers.
Diffstat (limited to 'src/com/android/phone')
-rw-r--r-- | src/com/android/phone/common/dialpad/DialpadView.java | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/com/android/phone/common/dialpad/DialpadView.java b/src/com/android/phone/common/dialpad/DialpadView.java index fdce6f7..2500f98 100644 --- a/src/com/android/phone/common/dialpad/DialpadView.java +++ b/src/com/android/phone/common/dialpad/DialpadView.java @@ -38,6 +38,8 @@ import android.widget.TextView; import com.android.phone.common.R; import com.android.phone.common.animation.AnimUtils; +import java.text.DecimalFormat; +import java.text.NumberFormat; import java.util.Locale; /** @@ -115,12 +117,6 @@ public class DialpadView extends LinearLayout { } private void setupKeypad() { - final int[] numberIds = new int[] {R.string.dialpad_0_number, R.string.dialpad_1_number, - R.string.dialpad_2_number, R.string.dialpad_3_number, R.string.dialpad_4_number, - R.string.dialpad_5_number, R.string.dialpad_6_number, R.string.dialpad_7_number, - R.string.dialpad_8_number, R.string.dialpad_9_number, R.string.dialpad_star_number, - R.string.dialpad_pound_number}; - final int[] letterIds = new int[] {R.string.dialpad_0_letters, R.string.dialpad_1_letters, R.string.dialpad_2_letters, R.string.dialpad_3_letters, R.string.dialpad_4_letters, R.string.dialpad_5_letters, R.string.dialpad_6_letters, R.string.dialpad_7_letters, @@ -133,11 +129,30 @@ public class DialpadView extends LinearLayout { TextView numberView; TextView lettersView; + final Locale currentLocale = resources.getConfiguration().locale; + final NumberFormat nf; + // We translate dialpad numbers only for "fa" and not any other locale + // ("ar" anybody ?). + if ("fa".equals(currentLocale.getLanguage())) { + nf = DecimalFormat.getInstance(resources.getConfiguration().locale); + } else { + nf = DecimalFormat.getInstance(Locale.ENGLISH); + } + for (int i = 0; i < mButtonIds.length; i++) { dialpadKey = (DialpadKeyButton) findViewById(mButtonIds[i]); numberView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_number); lettersView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_letters); - final String numberString = resources.getString(numberIds[i]); + + final String numberString; + if (mButtonIds[i] == R.id.pound) { + numberString = resources.getString(R.string.dialpad_pound_number); + } else if (mButtonIds[i] == R.id.star) { + numberString = resources.getString(R.string.dialpad_star_number); + } else { + numberString = nf.format(i); + } + final RippleDrawable rippleBackground = (RippleDrawable) getContext().getDrawable(R.drawable.btn_dialpad_key); if (mRippleColor != null) { |