From ece5a60db443e5e22a3f7681caa17e802053caf2 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 10 Sep 2012 16:03:56 +0200 Subject: [PATCH] Menu buttons translatable --- res/drawable/about_chat.xml~ | 9 --- res/drawable/about_settings.xml~ | 9 --- res/drawable/text_color.xml | 8 +++ res/layout-xlarge-land/main.xml | 74 +++++------------------ res/layout/main.xml | 60 ++---------------- res/layout/menu_about_chat_button.xml | 29 +++++++++ res/layout/menu_about_settings_button.xml | 29 +++++++++ res/layout/menu_chat_button.xml | 27 +++++++++ res/layout/menu_contact_button.xml | 28 +++++++++ res/layout/menu_history_button.xml | 27 +++++++++ res/layout/menu_settings_button.xml | 28 +++++++++ res/values/color.xml | 6 +- res/values/strings.xml | 6 ++ src/org/linphone/LinphoneActivity.java | 35 ++++++++--- 14 files changed, 235 insertions(+), 140 deletions(-) delete mode 100644 res/drawable/about_chat.xml~ delete mode 100644 res/drawable/about_settings.xml~ create mode 100644 res/drawable/text_color.xml create mode 100644 res/layout/menu_about_chat_button.xml create mode 100644 res/layout/menu_about_settings_button.xml create mode 100644 res/layout/menu_chat_button.xml create mode 100644 res/layout/menu_contact_button.xml create mode 100644 res/layout/menu_history_button.xml create mode 100644 res/layout/menu_settings_button.xml diff --git a/res/drawable/about_chat.xml~ b/res/drawable/about_chat.xml~ deleted file mode 100644 index a7a0da6b3..000000000 --- a/res/drawable/about_chat.xml~ +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/res/drawable/about_settings.xml~ b/res/drawable/about_settings.xml~ deleted file mode 100644 index 365633495..000000000 --- a/res/drawable/about_settings.xml~ +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/res/drawable/text_color.xml b/res/drawable/text_color.xml new file mode 100644 index 000000000..e58dadddb --- /dev/null +++ b/res/drawable/text_color.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/res/layout-xlarge-land/main.xml b/res/layout-xlarge-land/main.xml index 4ca287d32..b3586abb6 100644 --- a/res/layout-xlarge-land/main.xml +++ b/res/layout-xlarge-land/main.xml @@ -99,21 +99,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:orientation="horizontal" > + android:orientation="horizontal"> + android:layout_weight="0.2"> - + - - + + - + - + - + + android:layout_weight="0.2"> - + + diff --git a/res/layout/main.xml b/res/layout/main.xml index d1e7b900b..a188e06ce 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -94,14 +94,7 @@ android:layout_height="wrap_content" android:layout_weight="0.2"> - + - + - + - + - + - + + + + + + + + \ No newline at end of file diff --git a/res/layout/menu_about_settings_button.xml b/res/layout/menu_about_settings_button.xml new file mode 100644 index 000000000..61b445dc4 --- /dev/null +++ b/res/layout/menu_about_settings_button.xml @@ -0,0 +1,29 @@ + + + + + + + + \ No newline at end of file diff --git a/res/layout/menu_chat_button.xml b/res/layout/menu_chat_button.xml new file mode 100644 index 000000000..8d9b77cb2 --- /dev/null +++ b/res/layout/menu_chat_button.xml @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/res/layout/menu_contact_button.xml b/res/layout/menu_contact_button.xml new file mode 100644 index 000000000..1d38ade0d --- /dev/null +++ b/res/layout/menu_contact_button.xml @@ -0,0 +1,28 @@ + + + + + + + + \ No newline at end of file diff --git a/res/layout/menu_history_button.xml b/res/layout/menu_history_button.xml new file mode 100644 index 000000000..d2eb10dd8 --- /dev/null +++ b/res/layout/menu_history_button.xml @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/res/layout/menu_settings_button.xml b/res/layout/menu_settings_button.xml new file mode 100644 index 000000000..267785be9 --- /dev/null +++ b/res/layout/menu_settings_button.xml @@ -0,0 +1,28 @@ + + + + + + + + \ No newline at end of file diff --git a/res/values/color.xml b/res/values/color.xml index 54f5cbd7d..09ad00971 100644 --- a/res/values/color.xml +++ b/res/values/color.xml @@ -2,10 +2,14 @@ #ffcf4c29 + #ffcf4c29 + #ffb9c4cb + #ff5b656f + #ffe4edf2 #ffd8d8d8 #ffb1bdc3 #ffcf4c29 #00000000 - \ No newline at end of file + diff --git a/res/values/strings.xml b/res/values/strings.xml index d270a6ca4..a9956a6cd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -319,4 +319,10 @@ Your account has not been validated yet. Your account has been validated. + History + Contacts + Settings + Chat + About + diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 6330db960..98cea95b5 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -49,6 +49,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; +import android.graphics.Typeface; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -68,6 +69,7 @@ import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.TextView; /** @@ -86,7 +88,8 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene private StatusFragment statusFragment; private TextView missedCalls, missedChats; - private ImageView history, contacts, dialer, settings, chat, aboutChat, aboutSettings; + private ImageView dialer; + private RelativeLayout contacts, history, settings, chat, aboutChat, aboutSettings; private FragmentsAvailable currentFragment, nextFragment; private Fragment dialerFragment, messageListenerFragment; private SavedState dialerSavedState; @@ -154,18 +157,27 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene } private void initButtons() { - history = (ImageView) findViewById(R.id.history); +// Typeface typeface = Typeface.createFromAsset(getAssets(), "font_linphone.ttf"); + Typeface typeface = null; + + history = (RelativeLayout) findViewById(R.id.history); history.setOnClickListener(this); - contacts = (ImageView) findViewById(R.id.contacts); + setMenuTypeface(history, typeface); + contacts = (RelativeLayout) findViewById(R.id.contacts); contacts.setOnClickListener(this); + setMenuTypeface(contacts, typeface); dialer = (ImageView) findViewById(R.id.dialer); dialer.setOnClickListener(this); - settings = (ImageView) findViewById(R.id.settings); + settings = (RelativeLayout) findViewById(R.id.settings); settings.setOnClickListener(this); - chat = (ImageView) findViewById(R.id.chat); + setMenuTypeface(settings, typeface); + chat = (RelativeLayout) findViewById(R.id.chat); chat.setOnClickListener(this); - aboutChat = (ImageView) findViewById(R.id.about_chat); - aboutSettings = (ImageView) findViewById(R.id.about_settings); + setMenuTypeface(chat, typeface); + aboutChat = (RelativeLayout) findViewById(R.id.about_chat); + setMenuTypeface(aboutChat, typeface); + aboutSettings = (RelativeLayout) findViewById(R.id.about_settings); + setMenuTypeface(aboutSettings, typeface); if (getResources().getBoolean(R.bool.replace_chat_by_about)) { chat.setVisibility(View.GONE); @@ -868,6 +880,15 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene stopService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class)); } + private void setMenuTypeface(RelativeLayout menu, Typeface typeface) { + if (typeface == null) { + return; + } + + TextView tv = (TextView) menu.findViewById(R.id.text); + tv.setTypeface(typeface); + } + @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(resultCode, requestCode, data);