Menu buttons translatable
This commit is contained in:
parent
3bf8ca1522
commit
ece5a60db4
14 changed files with 235 additions and 140 deletions
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/chat_over" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/chat_selected" />
|
||||
<item
|
||||
android:drawable="@drawable/chat_default" />
|
||||
</selector>
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/settings_over" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/settings_selected" />
|
||||
<item
|
||||
android:drawable="@drawable/settings_default" />
|
||||
</selector>
|
8
res/drawable/text_color.xml
Normal file
8
res/drawable/text_color.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:color="@color/text_over" />
|
||||
<item android:state_selected="true"
|
||||
android:color="@color/text_selected" />
|
||||
<item android:color="@color/text_default" />
|
||||
</selector>
|
|
@ -106,14 +106,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/history"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_history"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/history" />
|
||||
<include layout="@layout/menu_history_button" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/missedCalls"
|
||||
|
@ -127,71 +120,31 @@
|
|||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contacts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_contacts"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/contacts" />
|
||||
<include layout="@layout/menu_contact_button" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dialer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.25"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_dialer"
|
||||
android:scaleType="fitEnd"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/dialer" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_settings"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/settings" />
|
||||
<include layout="@layout/menu_settings_button" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/about_settings"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_about"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/about_settings" />
|
||||
<include layout="@layout/menu_about_settings_button" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/about_chat"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_about"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/about_chat" />
|
||||
<include layout="@layout/menu_about_chat_button" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/completeChat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_chat"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/chat" />
|
||||
<include layout="@layout/menu_chat_button" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/missedChats"
|
||||
|
@ -203,6 +156,7 @@
|
|||
android:gravity="center"
|
||||
android:textSize="20dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -94,14 +94,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/history"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_history"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/history" />
|
||||
<include layout="@layout/menu_history_button" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/missedCalls"
|
||||
|
@ -115,15 +108,7 @@
|
|||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contacts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_contacts"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/contacts" />
|
||||
<include layout="@layout/menu_contact_button" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dialer"
|
||||
|
@ -135,37 +120,11 @@
|
|||
android:scaleType="fitXY"
|
||||
android:src="@drawable/dialer" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_settings"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/settings" />
|
||||
<include layout="@layout/menu_settings_button" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/about_settings"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_about"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/about_settings" />
|
||||
<include layout="@layout/menu_about_settings_button" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/about_chat"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_about"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/about_chat" />
|
||||
<include layout="@layout/menu_about_chat_button" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/completeChat"
|
||||
|
@ -173,14 +132,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/chat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_chat"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/chat" />
|
||||
<include layout="@layout/menu_chat_button" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/missedChats"
|
||||
|
|
29
res/layout/menu_about_chat_button.xml
Normal file
29
res/layout/menu_about_chat_button.xml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/about_chat"
|
||||
android:visibility="gone"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_weight="0.2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_about"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/about_chat" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignBottom="@id/image"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="@drawable/text_color"
|
||||
android:text="@string/button_about" />
|
||||
|
||||
</RelativeLayout>
|
29
res/layout/menu_about_settings_button.xml
Normal file
29
res/layout/menu_about_settings_button.xml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/about_settings"
|
||||
android:visibility="gone"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_weight="0.2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_about"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/about_settings" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignBottom="@id/image"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="@drawable/text_color"
|
||||
android:text="@string/button_about" />
|
||||
|
||||
</RelativeLayout>
|
27
res/layout/menu_chat_button.xml
Normal file
27
res/layout/menu_chat_button.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/chat"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_chat"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/chat" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignBottom="@id/image"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="@drawable/text_color"
|
||||
android:text="@string/button_chat" />
|
||||
|
||||
</RelativeLayout>
|
28
res/layout/menu_contact_button.xml
Normal file
28
res/layout/menu_contact_button.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/contacts"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_weight="0.2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_contacts"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/contacts" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignBottom="@id/image"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="@drawable/text_color"
|
||||
android:text="@string/button_contacts" />
|
||||
|
||||
</RelativeLayout>
|
27
res/layout/menu_history_button.xml
Normal file
27
res/layout/menu_history_button.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/history"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_history"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/history" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignBottom="@id/image"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="@drawable/text_color"
|
||||
android:text="@string/button_history" />
|
||||
|
||||
</RelativeLayout>
|
28
res/layout/menu_settings_button.xml
Normal file
28
res/layout/menu_settings_button.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_weight="0.2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:contentDescription="@string/content_description_about"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/settings" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignBottom="@id/image"
|
||||
android:paddingBottom="5dp"
|
||||
android:textColor="@drawable/text_color"
|
||||
android:text="@string/button_settings" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -2,6 +2,10 @@
|
|||
<resources>
|
||||
<color name="main_app_color">#ffcf4c29</color>
|
||||
|
||||
<color name="text_selected">#ffcf4c29</color>
|
||||
<color name="text_over">#ffb9c4cb</color>
|
||||
<color name="text_default">#ff5b656f</color>
|
||||
|
||||
<color name="numpad_background_bottom">#ffe4edf2</color>
|
||||
<color name="numpad_background_dialer">#ffd8d8d8</color>
|
||||
<color name="numpad_background_top">#ffb1bdc3</color>
|
||||
|
|
|
@ -319,4 +319,10 @@
|
|||
<string name="setup_account_not_validated">Your account has not been validated yet.</string>
|
||||
<string name="setup_account_validated">Your account has been validated.</string>
|
||||
|
||||
<string name="button_history">History</string>
|
||||
<string name="button_contacts">Contacts</string>
|
||||
<string name="button_settings">Settings</string>
|
||||
<string name="button_chat">Chat</string>
|
||||
<string name="button_about">About</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue