diff options
author | zhu youhua <youhua@codeaurora.org> | 2015-08-07 11:02:41 +0800 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:22:32 -0600 |
commit | c5feab282fde67e2a55777a67df7e3bb32ff31dd (patch) | |
tree | af65a4742328ffd0a07e5efd74b74291acdbe87e | |
parent | fa9cbae4e7e790d62c7fe68d7f7d52b5ccc17883 (diff) | |
download | packages_apps_PhoneCommon-c5feab282fde67e2a55777a67df7e3bb32ff31dd.tar.gz packages_apps_PhoneCommon-c5feab282fde67e2a55777a67df7e3bb32ff31dd.tar.bz2 packages_apps_PhoneCommon-c5feab282fde67e2a55777a67df7e3bb32ff31dd.zip |
add labels view in dialpad key for multi language
- adjust the dialpad key's layout to display both multi
language and default English character
Change-Id: I8fae739854d6b533abe947a2a7ec293d0e83b389
-rw-r--r-- | res/layout-land/dialpad_key.xml | 6 | ||||
-rw-r--r-- | res/layout-land/dialpad_key_one.xml | 5 | ||||
-rw-r--r-- | res/layout/dialpad_key.xml | 5 | ||||
-rw-r--r-- | res/layout/dialpad_key_one.xml | 3 | ||||
-rw-r--r-- | res/values/qtistrings.xml | 58 | ||||
-rw-r--r-- | src/com/android/phone/common/dialpad/DialpadView.java | 17 |
6 files changed, 94 insertions, 0 deletions
diff --git a/res/layout-land/dialpad_key.xml b/res/layout-land/dialpad_key.xml index 8342ba0..2b292e8 100644 --- a/res/layout-land/dialpad_key.xml +++ b/res/layout-land/dialpad_key.xml @@ -35,6 +35,12 @@ android:layout_marginRight="@dimen/dialpad_key_margin_right" /> <TextView + android:id="@+id/dialpad_key_labels" + style="@style/DialpadKeyLettersStyle" + android:layout_width="@dimen/dialpad_key_text_width" + android:layout_gravity="right|bottom" /> + + <TextView android:id="@+id/dialpad_key_letters" style="@style/DialpadKeyLettersStyle" android:layout_width="@dimen/dialpad_key_text_width" diff --git a/res/layout-land/dialpad_key_one.xml b/res/layout-land/dialpad_key_one.xml index fd4291b..1006e3f 100644 --- a/res/layout-land/dialpad_key_one.xml +++ b/res/layout-land/dialpad_key_one.xml @@ -28,6 +28,11 @@ android:layout_gravity="right" android:layout_marginBottom="0dp" android:layout_marginRight="@dimen/dialpad_key_one_margin_right" /> + <TextView + android:id="@+id/dialpad_key_labels" + style="@style/DialpadKeyLettersStyle" + android:layout_width="@dimen/dialpad_key_text_width" + android:layout_gravity="right|bottom" /> <FrameLayout android:layout_width="@dimen/dialpad_key_text_width" android:layout_height="wrap_content" diff --git a/res/layout/dialpad_key.xml b/res/layout/dialpad_key.xml index d5f47a4..fa5aed4 100644 --- a/res/layout/dialpad_key.xml +++ b/res/layout/dialpad_key.xml @@ -29,7 +29,12 @@ style="@style/DialpadKeyNumberStyle" /> <TextView + android:id="@+id/dialpad_key_labels" + style="@style/DialpadKeyLettersStyle" /> + + <TextView android:id="@+id/dialpad_key_letters" style="@style/DialpadKeyLettersStyle" /> + </LinearLayout> </com.android.phone.common.dialpad.DialpadKeyButton> diff --git a/res/layout/dialpad_key_one.xml b/res/layout/dialpad_key_one.xml index 6c6f199..58a41ab 100644 --- a/res/layout/dialpad_key_one.xml +++ b/res/layout/dialpad_key_one.xml @@ -22,6 +22,9 @@ <com.android.phone.common.dialpad.DialpadTextView android:id="@+id/dialpad_key_number" style="@style/DialpadKeyNumberStyle" /> + <TextView + android:id="@+id/dialpad_key_labels" + style="@style/DialpadKeyLettersStyle" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > diff --git a/res/values/qtistrings.xml b/res/values/qtistrings.xml new file mode 100644 index 0000000..3898ab1 --- /dev/null +++ b/res/values/qtistrings.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (c) 2015, The Linux Foundation. All rights reserved. + ~ + ~ Redistribution and use in source and binary forms, with or without + ~ modification, are permitted provided that the following conditions are + ~ met: + ~ Redistributions of source code must retain the above copyright + ~ notice, this list of conditions and the following disclaimer. + ~ Redistributions in binary form must reproduce the above + ~ copyright notice, this list of conditions and the following + ~ disclaimer in the documentation and/or other materials provided + ~ with the distribution. + ~ Neither the name of The Linux Foundation nor the names of its + ~ contributors may be used to endorse or promote products derived + ~ from this software without specific prior written permission. + ~ + ~ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + ~ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + ~ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + ~ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + ~ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + ~ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + ~ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + ~ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + ~ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + ~ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + ~ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ~ + --> + +<!-- The xml contains Qti specific resource strings neede for any value added features. --> +<resources> + <!-- Do not translate. --> + <string name="dialpad_0_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_1_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_2_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_3_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_4_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_5_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_6_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_7_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_8_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_9_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_star_labels"></string> + <!-- Do not translate. --> + <string name="dialpad_pound_labels"></string> +</resources> diff --git a/src/com/android/phone/common/dialpad/DialpadView.java b/src/com/android/phone/common/dialpad/DialpadView.java index 43bbeca..938379d 100644 --- a/src/com/android/phone/common/dialpad/DialpadView.java +++ b/src/com/android/phone/common/dialpad/DialpadView.java @@ -131,11 +131,18 @@ public class DialpadView extends LinearLayout { R.string.dialpad_8_letters, R.string.dialpad_9_letters, R.string.dialpad_star_letters, R.string.dialpad_pound_letters}; + final int[] labelIds = new int[] {R.string.dialpad_0_labels, R.string.dialpad_1_labels, + R.string.dialpad_2_labels, R.string.dialpad_3_labels, R.string.dialpad_4_labels, + R.string.dialpad_5_labels, R.string.dialpad_6_labels, R.string.dialpad_7_labels, + R.string.dialpad_8_labels, R.string.dialpad_9_labels, + R.string.dialpad_star_labels, R.string.dialpad_pound_labels}; + final Resources resources = getContext().getResources(); DialpadKeyButton dialpadKey; TextView numberView; TextView lettersView; + TextView labelsView; final Locale currentLocale = resources.getConfiguration().locale; final NumberFormat nf; @@ -151,6 +158,7 @@ public class DialpadView extends LinearLayout { dialpadKey = (DialpadKeyButton) findViewById(mButtonIds[i]); numberView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_number); lettersView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_letters); + labelsView = (TextView) dialpadKey.findViewById(R.id.dialpad_key_labels); final String numberString; final String numberContentDescription; @@ -184,6 +192,15 @@ public class DialpadView extends LinearLayout { if (lettersView != null) { lettersView.setText(resources.getString(letterIds[i])); } + if (labelsView != null) { + String label = resources.getString(labelIds[i]); + if (!TextUtils.isEmpty(label)) { + labelsView.setVisibility(View.VISIBLE); + labelsView.setText(label); + } else { + labelsView.setVisibility(View.GONE); + } + } } final DialpadKeyButton one = (DialpadKeyButton) findViewById(R.id.one); |