Fix interface on small screens + increased dtmf volume

This commit is contained in:
Sylvain Berfini 2012-10-11 15:01:29 +02:00
parent 92ba7ac64a
commit 974c54258a
10 changed files with 574 additions and 5 deletions

157
res/layout-small/main.xml Normal file
View file

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Hack to adjust perfectly on every screen the bottom of the fragment with the curved menu -->
<LinearLayout
android:id="@+id/mark"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<ImageView
android:contentDescription="@string/content_description_mark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/mark"
android:visibility="invisible" />
<ImageView
android:contentDescription="@string/content_description_mark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/mark"
android:visibility="invisible" />
<ImageView
android:contentDescription="@string/content_description_mark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/mark"
android:visibility="invisible" />
<ImageView
android:contentDescription="@string/content_description_mark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/mark"
android:visibility="invisible" />
<ImageView
android:contentDescription="@string/content_description_mark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/mark"
android:visibility="invisible" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/mark"
android:layout_alignParentTop="true">
<LinearLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingTop="20dp" />
<fragment
android:id="@+id/status"
android:name="org.linphone.StatusFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="@layout/status" />
</FrameLayout>
<LinearLayout
android:id="@+id/menu"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2">
<include layout="@layout/menu_history_button" />
<TextView
android:id="@+id/missedCalls"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/missed_calls_bg"
android:gravity="center"
android:textSize="20dp"
android:visibility="gone" />
</RelativeLayout>
<include layout="@layout/menu_contact_button" />
<ImageView
android:id="@+id/dialer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_dialer"
android:scaleType="fitXY"
android:src="@drawable/dialer" />
<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">
<include layout="@layout/menu_chat_button" />
<TextView
android:id="@+id/missedChats"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/missed_calls_bg"
android:gravity="center"
android:textSize="20dp"
android:visibility="gone" />
</RelativeLayout>
<include layout="@layout/menu_settings_button" />
<include layout="@layout/menu_about_settings_button" />
</LinearLayout>
</RelativeLayout>

View file

@ -0,0 +1,30 @@
<?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"
android:textSize="13dp" />
</RelativeLayout>

View file

@ -0,0 +1,30 @@
<?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"
android:textSize="13dp" />
</RelativeLayout>

View file

@ -0,0 +1,28 @@
<?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"
android:textSize="13dp" />
</RelativeLayout>

View file

@ -0,0 +1,29 @@
<?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"
android:textSize="13dp" />
</RelativeLayout>

View file

@ -0,0 +1,28 @@
<?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"
android:textSize="13dp" />
</RelativeLayout>

View file

@ -0,0 +1,29 @@
<?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"
android:textSize="13dp" />
</RelativeLayout>

236
res/layout-small/status.xml Normal file
View file

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:linphone="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<org.linphone.ui.SlidingDrawer
android:id="@+id/statusBar"
linphone:direction="topToBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
linphone:handle="@+id/handle"
linphone:content="@+id/content">
<RelativeLayout
android:id="@id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableLayout
android:id="@+id/callStats"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:background="@android:color/black">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:id="@+id/call_stats_title"
android:textStyle="bold"
android:textColor="@color/text_default"
android:textSize="18dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_codec"
android:textStyle="bold"
android:textColor="@android:color/white"
android:textSize="12dp"/>
<TextView
android:id="@+id/codec"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:textColor="@android:color/white"
android:textSize="12dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_upload"
android:textStyle="bold"
android:textColor="@android:color/white"
android:textSize="12dp"/>
<TextView
android:id="@+id/uploadBandwith"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:textColor="@android:color/white"
android:textSize="12dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_download"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="12dp"/>
<TextView
android:id="@+id/downloadBandwith"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:textColor="@android:color/white"
android:textSize="12dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_ice"
android:textStyle="bold"
android:textColor="@android:color/white"
android:textSize="12dp"/>
<TextView
android:id="@+id/ice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:textColor="@android:color/white"
android:textSize="12dp"/>
</TableRow>
</TableLayout>
<ListView
android:id="@+id/accounts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stackFromBottom="true"
android:paddingBottom="10dp"
android:background="@android:color/black"/>
</RelativeLayout>
<RelativeLayout
android:id="@id/handle"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/statebar_background"/>
<ImageView
android:contentDescription="@string/content_description_led"
android:id="@+id/statusLed"
android:paddingLeft="5dp"
android:src="@drawable/led_error"
android:adjustViewBounds="true"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<TextView
android:id="@+id/statusText"
android:text="@string/status_not_connected"
android:textColor="@android:color/white"
android:textSize="14dp"
android:paddingLeft="5dp"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_toRightOf="@id/statusLed" />
<LinearLayout
android:id="@+id/moreStatusLed"
android:layout_width="wrap_content"
android:layout_height="10dp"
android:orientation="horizontal"
android:layout_toRightOf="@id/statusLed"/>
<ImageView
android:contentDescription="@string/content_description_call_quality"
android:id="@+id/callQuality"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@drawable/call_quality_indicator_0"
android:adjustViewBounds="true"
android:layout_centerHorizontal="true"
android:visibility="gone" />
<ImageView
android:contentDescription="@string/content_description_encryption"
android:id="@+id/encryption"
android:paddingRight="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:src="@drawable/security_pending"
android:adjustViewBounds="true"
android:visibility="gone"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/exit"
android:text="@string/menu_exit"
android:textColor="@android:color/white"
android:textSize="14dp"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_alignParentRight="true"
android:paddingRight="10dp" />
</RelativeLayout>
</org.linphone.ui.SlidingDrawer>
</RelativeLayout>

View file

@ -38,6 +38,7 @@ remote_ring=/data/data/org.linphone/files/ringback.wav
local_ring=/data/data/org.linphone/files/oldphone_mono.wav
ec_tail_len=120
ec_framesize=128
dtmf_player_amp=0.1
el_type=mic
el_thres=0.03

View file

@ -81,7 +81,7 @@ public class AddressText extends EditText implements AddressType {
if (resizedText.equals("") && getHint() != null) {
resizedText = getHint().toString();
}
refitText(resizedText, getWidth());
refitText(resizedText, getWidth(), getHeight());
if (dialer != null) {
dialer.enableDisableAddContact();
@ -97,16 +97,17 @@ public class AddressText extends EditText implements AddressType {
if (resizedText.equals("") && getHint() != null) {
resizedText = getHint().toString();
}
refitText(resizedText, getWidth());
refitText(resizedText, getWidth(), getHeight());
}
}
private void refitText(String text, int textWidth) {
private void refitText(String text, int textWidth, int textHeight) {
if (textWidth <= 0) {
return;
}
int targetWidth = textWidth - getPaddingLeft() - getPaddingRight();
int targetHeight = textHeight - getPaddingTop() - getPaddingBottom();
float hi = 90;
float lo = 2;
final float threshold = 0.5f;
@ -116,7 +117,7 @@ public class AddressText extends EditText implements AddressType {
while ((hi - lo) > threshold) {
float size = (hi + lo) / 2;
mTestPaint.setTextSize(size);
if (mTestPaint.measureText(text) >= targetWidth) {
if (mTestPaint.measureText(text) >= targetWidth || size >= targetHeight) {
hi = size;
}
else {
@ -136,7 +137,7 @@ public class AddressText extends EditText implements AddressType {
if (resizedText.equals("") && getHint() != null) {
resizedText = getHint().toString();
}
refitText(resizedText, parentWidth);
refitText(resizedText, parentWidth, height);
setMeasuredDimension(parentWidth, height);
}