add clear history to call history tab
This commit is contained in:
parent
a16ef1961d
commit
39c0604397
12 changed files with 204 additions and 90 deletions
|
@ -58,5 +58,6 @@
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -25,26 +25,16 @@
|
||||||
android:layout_width="fill_parent"></EditText>
|
android:layout_width="fill_parent"></EditText>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<TableLayout android:layout_width="fill_parent" android:id="@+id/Dialer"
|
||||||
<LinearLayout android:id="@+id/LinearLayout01"
|
android:layout_height="fill_parent" android:layout_weight="1">
|
||||||
android:orientation="vertical" android:layout_width="fill_parent"
|
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/IncallControlRow">
|
||||||
android:layout_height="fill_parent">
|
<ToggleButton android:id="@+id/mic_mute_button" android:textOn="" android:textOff="" android:layout_height="fill_parent" android:layout_width="fill_parent" android:drawableTop="@drawable/mic_active" android:checked="true" android:layout_weight="1"></ToggleButton>
|
||||||
|
<ImageButton android:src="@drawable/red" android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/HangUp" android:layout_weight="1"></ImageButton>
|
||||||
|
<ToggleButton android:id="@+id/speaker_button" android:textOn="" android:textOff="" android:layout_height="fill_parent" android:layout_width="fill_parent" android:drawableTop="@drawable/speaker_32_on" android:layout_weight="1"></ToggleButton>
|
||||||
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
<LinearLayout android:layout_height="fill_parent"
|
<LinearLayout android:layout_height="fill_parent"
|
||||||
android:layout_width="fill_parent" android:id="@+id/IncallControlRow">
|
android:layout_width="fill_parent" android:id="@+id/CallControlRow" android:layout_weight="1">
|
||||||
<ToggleButton android:id="@+id/mic_mute_button"
|
|
||||||
android:textOn="" android:textOff="" android:layout_weight="0.25"
|
|
||||||
android:layout_height="fill_parent" android:layout_width="fill_parent"
|
|
||||||
android:drawableTop="@drawable/mic_active" android:checked="true"></ToggleButton>
|
|
||||||
<ImageButton android:src="@drawable/red"
|
|
||||||
android:layout_height="fill_parent" android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="0.25" android:id="@+id/HangUp"></ImageButton>
|
|
||||||
<ToggleButton android:id="@+id/speaker_button"
|
|
||||||
android:textOn="" android:textOff="" android:layout_weight="0.25"
|
|
||||||
android:layout_height="fill_parent" android:layout_width="fill_parent"
|
|
||||||
android:drawableTop="@drawable/speaker_32_on"></ToggleButton>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent" android:id="@+id/CallControlRow">
|
|
||||||
<ImageButton android:id="@+id/Call"
|
<ImageButton android:id="@+id/Call"
|
||||||
android:layout_height="fill_parent" android:src="@drawable/green"
|
android:layout_height="fill_parent" android:src="@drawable/green"
|
||||||
android:layout_width="fill_parent" android:layout_weight="0.25">
|
android:layout_width="fill_parent" android:layout_weight="0.25">
|
||||||
|
@ -63,6 +53,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent" android:orientation="vertical" android:gravity="center" android:layout_height="fill_parent">
|
android:layout_width="fill_parent" android:orientation="vertical" android:gravity="center" android:layout_height="fill_parent">
|
||||||
<ImageView android:id="@+id/ImageView01" android:layout_height="wrap_content" android:src="@drawable/linphone_3_250x130" android:layout_width="wrap_content"></ImageView>
|
<ImageView android:id="@+id/ImageView01" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/linphone_3_250x130"></ImageView>
|
||||||
<TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/about_text" android:autoLink="web" android:gravity="center" android:paddingTop="50sp" android:textStyle="bold"></TextView>
|
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/about_text" android:autoLink="web" android:gravity="center" android:paddingTop="50sp" android:textStyle="bold" android:id="@+id/AboutText"></TextView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -11,93 +11,105 @@
|
||||||
android:hint="sip:" android:layout_width="fill_parent"
|
android:hint="sip:" android:layout_width="fill_parent"
|
||||||
android:lines="1" android:layout_weight="0.2"></EditText>
|
android:lines="1" android:layout_weight="0.2"></EditText>
|
||||||
<Button android:layout_height="wrap_content" android:id="@+id/Erase"
|
<Button android:layout_height="wrap_content" android:id="@+id/Erase"
|
||||||
android:layout_width="fill_parent" android:text="<-" android:layout_weight="0.8" android:textSize="20sp" android:textStyle="bold"></Button>
|
android:layout_width="fill_parent" android:text="<-"
|
||||||
|
android:layout_weight="0.8" android:textSize="20sp"
|
||||||
|
android:textStyle="bold"></Button>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/IncallAddressLayout"><EditText android:text="@+id/EditText01" android:layout_height="wrap_content" android:lines="1" android:id="@+id/DisplayNameView" android:clickable="false" android:cursorVisible="false" android:gravity="center" android:layout_width="fill_parent"></EditText>
|
<LinearLayout android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent" android:id="@+id/IncallAddressLayout">
|
||||||
|
<EditText android:text="@+id/EditText01"
|
||||||
|
android:layout_height="wrap_content" android:lines="1"
|
||||||
|
android:id="@+id/DisplayNameView" android:clickable="false"
|
||||||
|
android:cursorVisible="false" android:gravity="center"
|
||||||
|
android:layout_width="fill_parent"></EditText>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TableLayout android:layout_width="fill_parent" android:id="@+id/Dialer"
|
<TableLayout android:layout_width="fill_parent" android:id="@+id/Dialer"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent" android:layout_weight="1">
|
||||||
<TableRow android:layout_height="fill_parent"
|
<TableRow android:layout_height="fill_parent"
|
||||||
android:layout_weight="1" android:id="@+id/DialerRow01"
|
android:layout_weight="1" android:id="@+id/DialerRow01"
|
||||||
android:layout_width="fill_parent">
|
android:layout_width="fill_parent">
|
||||||
<Button android:id="@+id/Button01" android:text="1"
|
<Button android:id="@+id/Button01" android:text="1"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
<Button android:id="@+id/Button02" android:text="2"
|
<Button android:id="@+id/Button02" android:text="2"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
<Button android:id="@+id/Button03" android:text="3"
|
<Button android:id="@+id/Button03" android:text="3"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:layout_height="fill_parent"
|
<TableRow android:layout_height="fill_parent"
|
||||||
android:layout_weight="1" android:id="@+id/DialerRow02"
|
android:layout_weight="1" android:id="@+id/DialerRow02"
|
||||||
android:layout_width="fill_parent">
|
android:layout_width="fill_parent">
|
||||||
<Button android:id="@+id/Button04" android:text="4"
|
<Button android:id="@+id/Button04" android:text="4"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
<Button android:text="5" android:id="@+id/Button05"
|
<Button android:text="5" android:id="@+id/Button05"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
<Button android:id="@+id/Button06" android:text="6"
|
<Button android:id="@+id/Button06" android:text="6"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
||||||
android:id="@+id/DialerRow03" android:layout_width="fill_parent">
|
android:id="@+id/DialerRow03" android:layout_width="fill_parent">
|
||||||
<Button android:text="7" android:id="@+id/Button07"
|
<Button android:text="7" android:id="@+id/Button07"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
<Button android:id="@+id/Button08" android:text="8"
|
<Button android:id="@+id/Button08" android:text="8"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
<Button android:text="9" android:id="@+id/Button09"
|
<Button android:text="9" android:id="@+id/Button09"
|
||||||
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_width="fill_parent" android:layout_height="fill_parent"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
||||||
android:id="@+id/DialerRow04" android:layout_width="fill_parent">
|
android:id="@+id/DialerRow04" android:layout_width="fill_parent">
|
||||||
<Button android:layout_width="fill_parent"
|
<Button android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" android:text="*"
|
android:layout_height="fill_parent" android:text="*" android:id="@+id/ButtonStar"
|
||||||
android:id="@+id/ButtonStar" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
<Button android:layout_width="fill_parent"
|
<Button android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" android:text="0+" android:id="@+id/Button00" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:layout_height="fill_parent" android:text="0+" android:id="@+id/Button00"
|
||||||
|
android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
<Button android:layout_width="fill_parent"
|
<Button android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent" android:id="@+id/ButtonHash"
|
android:layout_height="fill_parent" android:id="@+id/ButtonHash"
|
||||||
android:text="#" android:layout_weight="0.33" android:textStyle="bold" android:textSize="20sp"></Button>
|
android:text="#" android:textStyle="bold" android:textSize="20sp"
|
||||||
|
android:layout_weight="1"></Button>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/LinearLayout01"
|
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/IncallControlRow">
|
||||||
<LinearLayout android:layout_height="fill_parent"
|
<ToggleButton android:id="@+id/mic_mute_button" android:textOn="" android:textOff="" android:layout_height="fill_parent" android:layout_width="fill_parent" android:drawableTop="@drawable/mic_active" android:checked="true" android:layout_weight="1"></ToggleButton>
|
||||||
android:layout_width="fill_parent" android:id="@+id/IncallControlRow">
|
<ImageButton android:src="@drawable/red" android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/HangUp" android:layout_weight="1"></ImageButton>
|
||||||
<ToggleButton android:id="@+id/mic_mute_button"
|
<ToggleButton android:id="@+id/speaker_button" android:textOn="" android:textOff="" android:layout_height="fill_parent" android:layout_width="fill_parent" android:drawableTop="@drawable/speaker_32_on" android:layout_weight="1"></ToggleButton>
|
||||||
android:textOn="" android:textOff=""
|
</TableRow>
|
||||||
android:layout_weight="0.25" android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent" android:drawableTop="@drawable/mic_active" android:checked="true"></ToggleButton>
|
|
||||||
<ImageButton android:src="@drawable/red"
|
|
||||||
android:layout_height="fill_parent" android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="0.25" android:id="@+id/HangUp"></ImageButton>
|
|
||||||
<ToggleButton android:id="@+id/speaker_button"
|
|
||||||
android:textOn="" android:textOff=""
|
|
||||||
android:layout_weight="0.25" android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent" android:drawableTop="@drawable/speaker_32_on"></ToggleButton>
|
|
||||||
</LinearLayout>
|
|
||||||
<LinearLayout android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent" android:id="@+id/CallControlRow">
|
|
||||||
<ImageButton android:id="@+id/Call"
|
|
||||||
android:layout_height="fill_parent" android:src="@drawable/green"
|
|
||||||
android:layout_width="fill_parent" android:layout_weight="0.25">
|
|
||||||
</ImageButton>
|
|
||||||
<ImageButton android:src="@drawable/red"
|
|
||||||
android:layout_height="fill_parent" android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="0.25" android:id="@+id/Decline"></ImageButton>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
<EditText android:layout_width="fill_parent" android:id="@+id/status_label"
|
|
||||||
android:clickable="false" android:focusable="false"
|
|
||||||
android:cursorVisible="false" android:textSize="12sp" android:height="15sp"
|
|
||||||
android:layout_height="wrap_content" android:background="@android:color/transparent"
|
|
||||||
android:textColor="@android:color/white"></EditText>
|
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
<LinearLayout android:id="@+id/LinearLayout01" android:layout_height="wrap_content" android:orientation="vertical" android:layout_width="fill_parent">
|
||||||
|
|
||||||
|
<LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/CallControlRow">
|
||||||
|
<ImageButton android:id="@+id/Call" android:layout_height="fill_parent" android:src="@drawable/green" android:layout_width="fill_parent" android:layout_weight="0.25">
|
||||||
|
</ImageButton>
|
||||||
|
<ImageButton android:src="@drawable/red" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:id="@+id/Decline"></ImageButton>
|
||||||
|
</LinearLayout><EditText android:layout_width="fill_parent" android:id="@+id/status_label" android:clickable="false" android:focusable="false" android:cursorVisible="false" android:textSize="12sp" android:height="15sp" android:layout_height="wrap_content" android:background="@android:color/transparent" android:textColor="@android:color/white"></EditText>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
res/menu/history_activity_menu.xml
Normal file
6
res/menu/history_activity_menu.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:title="@string/menu_clear_history" android:id="@+id/menu_clear_history">
|
||||||
|
</item>
|
||||||
|
</menu>
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="about_text">Linphone 3.1.2 SIP (rfc 3261) Compatible Internet phone \n http://www.linphone.org</string>
|
<string name="about_text">Linphone %s SIP (rfc 3261) Compatible Internet phone \n http://www.linphone.org</string>
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
<string name="pref_audio">Audio</string>
|
<string name="pref_audio">Audio</string>
|
||||||
<string name="menu_exit">Exit</string>
|
<string name="menu_exit">Exit</string>
|
||||||
|
@ -26,4 +26,6 @@
|
||||||
<string name="warning_already_incall">Cannot initiate a new call because a call is already engaged</string>
|
<string name="warning_already_incall">Cannot initiate a new call because a call is already engaged</string>
|
||||||
<string name="tab_history">History</string>
|
<string name="tab_history">History</string>
|
||||||
<string name="warning_wrong_destination_address">Cannot build destination address from [%s]</string>
|
<string name="warning_wrong_destination_address">Cannot build destination address from [%s]</string>
|
||||||
|
<string name="menu_clear_history">Clear</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -19,13 +19,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class AboutActivity extends Activity {
|
public class AboutActivity extends Activity {
|
||||||
|
TextView aboutText;
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.about);
|
setContentView(R.layout.about);
|
||||||
|
aboutText = (TextView) findViewById(R.id.AboutText);
|
||||||
|
try {
|
||||||
|
aboutText.setText(String.format(getString(R.string.about_text), getPackageManager().getPackageInfo(getPackageName(), 0).versionName));
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
Log.e(LinphoneService.TAG, "cannot get version name", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,16 @@ import android.content.Context;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.PowerManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.View.OnLongClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TableRow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.ToggleButton;
|
import android.widget.ToggleButton;
|
||||||
|
@ -71,7 +74,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
private ToggleButton mSpeaker;
|
private ToggleButton mSpeaker;
|
||||||
|
|
||||||
private LinearLayout mCallControlRow;
|
private LinearLayout mCallControlRow;
|
||||||
private LinearLayout mInCallControlRow;
|
private TableRow mInCallControlRow;
|
||||||
private LinearLayout mAddressLayout;
|
private LinearLayout mAddressLayout;
|
||||||
private LinearLayout mInCallAddressLayout;
|
private LinearLayout mInCallAddressLayout;
|
||||||
|
|
||||||
|
@ -79,6 +82,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
private String mDisplayName;
|
private String mDisplayName;
|
||||||
private AudioManager mAudioManager;
|
private AudioManager mAudioManager;
|
||||||
|
private PowerManager.WakeLock mWakeLock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -99,6 +103,9 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.dialer);
|
setContentView(R.layout.dialer);
|
||||||
mAudioManager = ((AudioManager)getSystemService(Context.AUDIO_SERVICE));
|
mAudioManager = ((AudioManager)getSystemService(Context.AUDIO_SERVICE));
|
||||||
|
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
|
||||||
|
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"Linphone");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,6 +126,13 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
mErase.setOnLongClickListener(new OnLongClickListener() {
|
||||||
|
public boolean onLongClick(View arg0) {
|
||||||
|
mAddress.getEditableText().clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
mCall = (ImageButton) findViewById(R.id.Call);
|
mCall = (ImageButton) findViewById(R.id.Call);
|
||||||
mCall.setOnClickListener(new OnClickListener() {
|
mCall.setOnClickListener(new OnClickListener() {
|
||||||
|
@ -170,19 +184,30 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mAddressView = anAddress;
|
mAddressView = anAddress;
|
||||||
}
|
}
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mAddressView.append(mKeyCode);
|
LinphoneCore lc = LinphoneService.instance().getLinphoneCore();
|
||||||
|
if (lc.isIncall()) {
|
||||||
|
lc.sendDtmf(mKeyCode.charAt(0));
|
||||||
|
} else {
|
||||||
|
int lBegin = mAddressView.getSelectionStart();
|
||||||
|
if (lBegin == -1) {
|
||||||
|
lBegin = mAddressView.getEditableText().length();
|
||||||
|
}
|
||||||
|
if (lBegin >=0) {
|
||||||
|
mAddressView.getEditableText().insert(lBegin,mKeyCode);
|
||||||
|
}
|
||||||
mDisplayName="";
|
mDisplayName="";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
|
mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
|
||||||
mInCallControlRow = (LinearLayout) findViewById(R.id.IncallControlRow);
|
mInCallControlRow = (TableRow) findViewById(R.id.IncallControlRow);
|
||||||
mAddressLayout = (LinearLayout) findViewById(R.id.Addresslayout);
|
mAddressLayout = (LinearLayout) findViewById(R.id.Addresslayout);
|
||||||
mInCallAddressLayout = (LinearLayout) findViewById(R.id.IncallAddressLayout);
|
mInCallAddressLayout = (LinearLayout) findViewById(R.id.IncallAddressLayout);
|
||||||
|
|
||||||
mInCallControlRow.setVisibility(View.GONE);
|
mInCallControlRow.setVisibility(View.GONE);
|
||||||
mInCallAddressLayout.setVisibility(View.GONE);
|
mInCallAddressLayout.setVisibility(View.GONE);
|
||||||
|
mDecline.setEnabled(false);
|
||||||
if (LinphoneService.isready()) {
|
if (LinphoneService.isready()) {
|
||||||
if (LinphoneService.instance().getLinphoneCore().isIncall()) {
|
if (LinphoneService.instance().getLinphoneCore().isIncall()) {
|
||||||
mCall.setEnabled(false);
|
mCall.setEnabled(false);
|
||||||
|
@ -230,6 +255,19 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
if (mZero != null) {
|
if (mZero != null) {
|
||||||
|
|
||||||
mZero.setOnClickListener(new DialKeyListener(mAddress,'0'));
|
mZero.setOnClickListener(new DialKeyListener(mAddress,'0'));
|
||||||
|
mZero.setOnLongClickListener(new OnLongClickListener() {
|
||||||
|
public boolean onLongClick(View arg0) {
|
||||||
|
int lBegin = mAddress.getSelectionStart();
|
||||||
|
if (lBegin == -1) {
|
||||||
|
lBegin = mAddress.getEditableText().length();
|
||||||
|
}
|
||||||
|
if (lBegin >=0) {
|
||||||
|
mAddress.getEditableText().insert(lBegin,"+");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
mOne = (Button) findViewById(R.id.Button01) ;
|
mOne = (Button) findViewById(R.id.Button01) ;
|
||||||
mOne.setOnClickListener(new DialKeyListener(mAddress,'1'));
|
mOne.setOnClickListener(new DialKeyListener(mAddress,'1'));
|
||||||
mTwo = (Button) findViewById(R.id.Button02);
|
mTwo = (Button) findViewById(R.id.Button02);
|
||||||
|
@ -298,20 +336,18 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GSTATE_CALL_OUT_INVITE: {
|
case GSTATE_CALL_OUT_INVITE: {
|
||||||
|
enterIncalMode(lc);
|
||||||
|
routeAudioToSpeaker();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case GSTATE_CALL_IN_INVITE: {
|
case GSTATE_CALL_IN_INVITE: {
|
||||||
enterIncalMode(lc);
|
mDecline.setEnabled(true);
|
||||||
routeAudioToSpeaker();
|
routeAudioToSpeaker();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GSTATE_CALL_IN_CONNECTED:
|
case GSTATE_CALL_IN_CONNECTED:
|
||||||
case GSTATE_CALL_OUT_CONNECTED: {
|
case GSTATE_CALL_OUT_CONNECTED: {
|
||||||
if (mSpeaker.isChecked()) {
|
enterIncalMode(lc);
|
||||||
routeAudioToSpeaker();
|
|
||||||
} else {
|
|
||||||
routeAudioToReceiver();
|
|
||||||
}
|
|
||||||
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GSTATE_CALL_ERROR: {
|
case GSTATE_CALL_ERROR: {
|
||||||
|
@ -337,6 +373,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterIncalMode(LinphoneCore lc) {
|
private void enterIncalMode(LinphoneCore lc) {
|
||||||
|
mWakeLock.acquire();
|
||||||
mCallControlRow.setVisibility(View.GONE);
|
mCallControlRow.setVisibility(View.GONE);
|
||||||
mInCallControlRow.setVisibility(View.VISIBLE);
|
mInCallControlRow.setVisibility(View.VISIBLE);
|
||||||
mAddressLayout.setVisibility(View.GONE);
|
mAddressLayout.setVisibility(View.GONE);
|
||||||
|
@ -349,6 +386,12 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
} else {
|
} else {
|
||||||
mDisplayNameView.setText(lc.getRemoteAddress().getUserName());
|
mDisplayNameView.setText(lc.getRemoteAddress().getUserName());
|
||||||
}
|
}
|
||||||
|
if (mSpeaker.isChecked()) {
|
||||||
|
routeAudioToSpeaker();
|
||||||
|
} else {
|
||||||
|
routeAudioToReceiver();
|
||||||
|
}
|
||||||
|
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
|
||||||
}
|
}
|
||||||
private void exitCallMode() {
|
private void exitCallMode() {
|
||||||
mCallControlRow.setVisibility(View.VISIBLE);
|
mCallControlRow.setVisibility(View.VISIBLE);
|
||||||
|
@ -358,6 +401,10 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mCall.setEnabled(true);
|
mCall.setEnabled(true);
|
||||||
mHangup.setEnabled(false);
|
mHangup.setEnabled(false);
|
||||||
setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
|
setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
|
||||||
|
mMute.setChecked(true);
|
||||||
|
mSpeaker.setChecked(false);
|
||||||
|
mDecline.setEnabled(false);
|
||||||
|
mWakeLock.release();
|
||||||
}
|
}
|
||||||
private void routeAudioToSpeaker() {
|
private void routeAudioToSpeaker() {
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.DONUT) {
|
||||||
|
|
|
@ -30,8 +30,13 @@ import org.linphone.core.LinphoneCallLog.CallDirection;
|
||||||
|
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
@ -70,6 +75,30 @@ public class HistoryActivity extends ListActivity {
|
||||||
setListAdapter(new CallHistoryAdapter(this));
|
setListAdapter(new CallHistoryAdapter(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the currently selected menu XML resource.
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.history_activity_menu, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.menu_clear_history:
|
||||||
|
LinphoneService.instance().getLinphoneCore().clearCallLogs();
|
||||||
|
setListAdapter(new CallHistoryAdapter(this));
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Log.e(LinphoneService.TAG, "Unknown menu item ["+item+"]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class CallHistoryAdapter extends BaseAdapter {
|
class CallHistoryAdapter extends BaseAdapter {
|
||||||
final List<LinphoneCallLog> mLogs;
|
final List<LinphoneCallLog> mLogs;
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class LinphoneAddressImpl implements LinphoneAddress {
|
||||||
private native String getDomain(long ptr);
|
private native String getDomain(long ptr);
|
||||||
private native String toUri(long ptr);
|
private native String toUri(long ptr);
|
||||||
private native String setDisplayName(long ptr,String name);
|
private native String setDisplayName(long ptr,String name);
|
||||||
|
private native String toString(long ptr);
|
||||||
|
|
||||||
|
|
||||||
protected LinphoneAddressImpl(String username,String domain,String displayName) {
|
protected LinphoneAddressImpl(String username,String domain,String displayName) {
|
||||||
|
@ -53,7 +54,7 @@ public class LinphoneAddressImpl implements LinphoneAddress {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return toUri();
|
return toString(nativePtr);
|
||||||
}
|
}
|
||||||
public String toUri() {
|
public String toUri() {
|
||||||
return toUri(nativePtr);
|
return toUri(nativePtr);
|
||||||
|
|
|
@ -160,6 +160,13 @@ public interface LinphoneCore {
|
||||||
* @throws If no LinphonrAddress can be built from destination
|
* @throws If no LinphonrAddress can be built from destination
|
||||||
*/
|
*/
|
||||||
public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException;
|
public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException;
|
||||||
|
/**
|
||||||
|
* Initiate a dtmf signal if in call
|
||||||
|
* @param number
|
||||||
|
*/
|
||||||
|
public void sendDtmf(char number);
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void clearCallLogs();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,8 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
private native void muteMic(long nativePtr,boolean isMuted);
|
private native void muteMic(long nativePtr,boolean isMuted);
|
||||||
private native long interpretUrl(long nativePtr,String destination);
|
private native long interpretUrl(long nativePtr,String destination);
|
||||||
private native void inviteAddress(long nativePtr,long to);
|
private native void inviteAddress(long nativePtr,long to);
|
||||||
|
private native void sendDtmf(long nativePtr,char dtmf);
|
||||||
|
private native void clearCallLogs(long nativePtr);
|
||||||
|
|
||||||
|
|
||||||
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
||||||
|
@ -182,4 +184,10 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
public void invite(LinphoneAddress to) {
|
public void invite(LinphoneAddress to) {
|
||||||
inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr);
|
inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr);
|
||||||
}
|
}
|
||||||
|
public void sendDtmf(char number) {
|
||||||
|
sendDtmf(nativePtr,number);
|
||||||
|
}
|
||||||
|
public void clearCallLogs() {
|
||||||
|
clearCallLogs(nativePtr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue