Add several new widgets.
AddressTex, EraseButton, HangCallButton, MuteMicButton, SpeakerButton
This commit is contained in:
parent
61e3fd3e69
commit
83b638abbb
11 changed files with 420 additions and 226 deletions
|
@ -7,12 +7,12 @@
|
||||||
android:layout_height="wrap_content" android:layout_width="fill_parent">
|
android:layout_height="wrap_content" android:layout_width="fill_parent">
|
||||||
<LinearLayout android:layout_height="wrap_content"
|
<LinearLayout android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent" android:id="@+id/Addresslayout">
|
android:layout_width="fill_parent" android:id="@+id/Addresslayout">
|
||||||
<EditText android:id="@+id/SipUri" android:layout_height="wrap_content"
|
<org.linphone.ui.AddressText android:id="@+id/SipUri" android:layout_height="wrap_content"
|
||||||
android:hint="sip:" android:layout_width="fill_parent" android:lines="1"
|
android:hint="sip:" android:layout_width="fill_parent" android:lines="1"
|
||||||
android:layout_weight="0.2"></EditText>
|
android:layout_weight="0.2"/>
|
||||||
<Button android:layout_height="wrap_content" android:id="@+id/Erase"
|
<org.linphone.ui.EraseButton android:layout_height="wrap_content" android:id="@+id/Erase"
|
||||||
android:layout_width="fill_parent" android:layout_weight="0.8"
|
android:layout_width="fill_parent" android:layout_weight="0.8"
|
||||||
android:text="<"></Button>
|
android:text="<"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@
|
||||||
android:id="@+id/DisplayNameView" android:clickable="false"
|
android:id="@+id/DisplayNameView" android:clickable="false"
|
||||||
android:cursorVisible="false" android:gravity="center"
|
android:cursorVisible="false" android:gravity="center"
|
||||||
android:layout_width="fill_parent"></EditText>
|
android:layout_width="fill_parent"></EditText>
|
||||||
<org.linphone.component.ToggleImageButton
|
<org.linphone.ui.MuteMicButton
|
||||||
android:id="@+id/mic_mute_button" android:layout_height="wrap_content"
|
android:id="@+id/mic_mute_button" android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content" android:layout_weight="0.5"
|
android:layout_width="wrap_content" android:layout_weight="0.5"
|
||||||
checked="@drawable/mic_muted" unchecked="@drawable/mic_active"
|
checked="@drawable/mic_muted" unchecked="@drawable/mic_active"
|
||||||
android:layout_gravity="left|center_vertical" />
|
android:layout_gravity="left|center_vertical" />
|
||||||
<org.linphone.component.ToggleImageButton
|
<org.linphone.ui.SpeakerButton
|
||||||
android:id="@+id/speaker_button" android:layout_height="wrap_content"
|
android:id="@+id/speaker_button" android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content" android:layout_weight="0.5"
|
android:layout_width="wrap_content" android:layout_weight="0.5"
|
||||||
checked="@drawable/speaker_32_on" unchecked="@drawable/speaker_32_off"
|
checked="@drawable/speaker_32_on" unchecked="@drawable/speaker_32_off"
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
android:layout_height="fill_parent" android:layout_weight="1">
|
android:layout_height="fill_parent" android:layout_weight="1">
|
||||||
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/IncallControlRow" >
|
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/IncallControlRow" >
|
||||||
<ImageButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/AddVideo" android:layout_weight="1" android:src="@drawable/startvideo_green" android:background="@drawable/clavier_bg"></ImageButton>
|
<ImageButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/AddVideo" android:layout_weight="1" android:src="@drawable/startvideo_green" android:background="@drawable/clavier_bg"></ImageButton>
|
||||||
<ImageButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/HangUp" android:layout_weight="1" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"></ImageButton>
|
<org.linphone.ui.HangCallButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/HangUp" android:layout_weight="1" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
<LinearLayout android:layout_height="fill_parent"
|
<LinearLayout android:layout_height="fill_parent"
|
||||||
|
@ -47,8 +47,8 @@
|
||||||
<ImageButton android:id="@+id/Call"
|
<ImageButton android:id="@+id/Call"
|
||||||
android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg" android:src="@drawable/startcall_green">
|
android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg" android:src="@drawable/startcall_green">
|
||||||
</ImageButton>
|
</ImageButton>
|
||||||
<ImageButton android:layout_height="fill_parent" android:layout_width="fill_parent"
|
<org.linphone.ui.HangCallButton android:layout_height="fill_parent" android:layout_width="fill_parent"
|
||||||
android:layout_weight="0.25" android:id="@+id/Decline" android:background="@drawable/clavier_bg" android:src="@drawable/stopcall_red"></ImageButton>
|
android:layout_weight="0.25" android:id="@+id/Decline" android:background="@drawable/clavier_bg" android:src="@drawable/stopcall_red"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<EditText android:layout_width="fill_parent" android:id="@+id/status_label"
|
<EditText android:layout_width="fill_parent" android:id="@+id/status_label"
|
||||||
android:clickable="false" android:focusable="false"
|
android:clickable="false" android:focusable="false"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:linphone="http://schemas.android.com/apk/res/linphone"
|
||||||
android:orientation="vertical" android:layout_width="fill_parent"
|
android:orientation="vertical" android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
@ -7,11 +9,11 @@
|
||||||
android:layout_height="wrap_content" android:layout_width="fill_parent">
|
android:layout_height="wrap_content" android:layout_width="fill_parent">
|
||||||
<LinearLayout android:layout_height="wrap_content"
|
<LinearLayout android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent" android:id="@+id/Addresslayout">
|
android:layout_width="fill_parent" android:id="@+id/Addresslayout">
|
||||||
<EditText android:id="@+id/SipUri" android:background="@drawable/clavier_bg_grey" android:hint="sip:" android:layout_width="fill_parent"
|
<org.linphone.ui.AddressText android:id="@+id/SipUri" android:background="@drawable/clavier_bg_grey" android:hint="sip:" android:layout_width="fill_parent"
|
||||||
android:lines="1" android:layout_weight="0.2" android:layout_height="fill_parent" android:padding="10px" android:maxLines="1"></EditText>
|
android:lines="1" android:layout_weight="0.2" android:layout_height="fill_parent" android:padding="10px" android:maxLines="1"/>
|
||||||
<Button android:layout_height="fill_parent" android:background="@drawable/clavier_bg" android:id="@+id/Erase"
|
<org.linphone.ui.EraseButton android:layout_height="fill_parent" android:background="@drawable/clavier_bg" android:id="@+id/Erase"
|
||||||
android:layout_width="fill_parent" android:layout_weight="0.8" android:textSize="20sp"
|
android:layout_width="fill_parent" android:layout_weight="0.8" android:textSize="20sp"
|
||||||
android:textStyle="bold" android:text="<" android:layout_gravity="top" android:textColor="@android:color/black"></Button>
|
android:textStyle="bold" android:text="<" android:layout_gravity="top" android:textColor="@android:color/black"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,13 +24,12 @@
|
||||||
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:id="@+id/DisplayNameView" android:clickable="false"
|
android:id="@+id/DisplayNameView" android:clickable="false"
|
||||||
android:cursorVisible="false" android:layout_gravity="center"
|
android:cursorVisible="false" android:layout_gravity="center"></EditText>
|
||||||
></EditText>
|
<org.linphone.ui.MuteMicButton android:id="@+id/mic_mute_button"
|
||||||
<org.linphone.component.ToggleImageButton android:id="@+id/mic_mute_button"
|
|
||||||
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
||||||
checked="@drawable/mic_muted" unchecked="@drawable/mic_active"
|
checked="@drawable/mic_muted" unchecked="@drawable/mic_active"
|
||||||
android:layout_gravity="left|center_vertical"/>
|
android:layout_gravity="left|center_vertical"/>
|
||||||
<org.linphone.component.ToggleImageButton android:id="@+id/speaker_button"
|
<org.linphone.ui.SpeakerButton android:id="@+id/speaker_button"
|
||||||
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
android:layout_height="wrap_content" android:layout_width="wrap_content"
|
||||||
checked="@drawable/speaker_32_on" unchecked="@drawable/speaker_32_off"
|
checked="@drawable/speaker_32_on" unchecked="@drawable/speaker_32_off"
|
||||||
android:layout_gravity="right|center_vertical"/>
|
android:layout_gravity="right|center_vertical"/>
|
||||||
|
@ -41,39 +42,39 @@
|
||||||
<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">
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button01"
|
<org.linphone.ui.Digit android:id="@+id/Digit1"
|
||||||
android:text="1" style="@style/DialerDigit" />
|
android:text="1" style="@style/DialerDigit" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button02"
|
<org.linphone.ui.Digit android:id="@+id/Digit2"
|
||||||
android:text="2" style="@style/DialerDigit" />
|
android:text="2" style="@style/DialerDigit" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button03"
|
<org.linphone.ui.Digit android:id="@+id/Digit3"
|
||||||
android:text="3" style="@style/DialerDigit" />
|
android:text="3" style="@style/DialerDigit" />
|
||||||
</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">
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button04"
|
<org.linphone.ui.Digit android:id="@+id/Digit4"
|
||||||
android:text="4" style="@style/DialerDigit" />
|
android:text="4" style="@style/DialerDigit" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button05"
|
<org.linphone.ui.Digit android:id="@+id/Digit5"
|
||||||
android:text="5" style="@style/DialerDigit" />
|
android:text="5" style="@style/DialerDigit" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button06"
|
<org.linphone.ui.Digit android:id="@+id/Digit6"
|
||||||
android:text="6" style="@style/DialerDigit" />
|
android:text="6" style="@style/DialerDigit" />
|
||||||
</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">
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button07"
|
<org.linphone.ui.Digit android:id="@+id/Digit7"
|
||||||
android:text="7" style="@style/DialerDigit" />
|
android:text="7" style="@style/DialerDigit" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button08"
|
<org.linphone.ui.Digit android:id="@+id/Digit8"
|
||||||
android:text="8" style="@style/DialerDigit" />
|
android:text="8" style="@style/DialerDigit" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button09"
|
<org.linphone.ui.Digit android:id="@+id/Digit9"
|
||||||
android:text="9" style="@style/DialerDigit" />
|
android:text="9" style="@style/DialerDigit" />
|
||||||
</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">
|
||||||
<org.linphone.ui.Digit android:id="@+id/ButtonStar"
|
<org.linphone.ui.Digit android:id="@+id/DigitStar"
|
||||||
android:text="*" style="@style/DialerDigit" />
|
android:text="*" style="@style/DialerDigit" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/Button00"
|
<org.linphone.ui.Digit android:id="@+id/Digit00"
|
||||||
android:text="0+" style="@style/DialerDigit" />
|
android:text="0+" style="@style/DialerDigit" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/ButtonHash"
|
<org.linphone.ui.Digit android:id="@+id/DigitHash"
|
||||||
android:text="#" style="@style/DialerDigit" />
|
android:text="#" style="@style/DialerDigit" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
@ -82,14 +83,14 @@
|
||||||
|
|
||||||
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/IncallControlRow">
|
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/IncallControlRow">
|
||||||
<ImageButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/AddVideo" android:layout_weight="1" android:src="@drawable/startvideo_green" android:background="@drawable/clavier_bg"></ImageButton>
|
<ImageButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/AddVideo" android:layout_weight="1" android:src="@drawable/startvideo_green" android:background="@drawable/clavier_bg"></ImageButton>
|
||||||
<ImageButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/HangUp" android:layout_weight="1" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"></ImageButton>
|
<org.linphone.ui.HangCallButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/HangUp" android:layout_weight="1" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/LinearLayout01" android:layout_height="wrap_content" android:orientation="vertical" android:layout_width="fill_parent">
|
<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">
|
<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:layout_width="fill_parent" android:layout_weight="0.25" android:src="@drawable/startcall_green" android:background="@drawable/clavier_bg"></ImageButton>
|
<ImageButton android:id="@+id/Call" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:src="@drawable/startcall_green" android:background="@drawable/clavier_bg"></ImageButton>
|
||||||
<ImageButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:id="@+id/Decline" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"></ImageButton>
|
<org.linphone.ui.HangCallButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:id="@+id/Decline" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/>
|
||||||
</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><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>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
import org.linphone.component.ToggleImageButton;
|
|
||||||
import org.linphone.component.ToggleImageButton.OnCheckedChangeListener;
|
|
||||||
import org.linphone.core.AndroidCameraRecordManager;
|
import org.linphone.core.AndroidCameraRecordManager;
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
|
@ -31,7 +29,11 @@ import org.linphone.core.LinphoneFriend;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||||
|
import org.linphone.ui.AddressText;
|
||||||
import org.linphone.ui.Digit;
|
import org.linphone.ui.Digit;
|
||||||
|
import org.linphone.ui.EraseButton;
|
||||||
|
import org.linphone.ui.MuteMicButton;
|
||||||
|
import org.linphone.ui.SpeakerButton;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -41,7 +43,6 @@ import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
|
@ -51,8 +52,6 @@ import android.text.Html;
|
||||||
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.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TableRow;
|
import android.widget.TableRow;
|
||||||
|
@ -61,17 +60,16 @@ import android.widget.Toast;
|
||||||
|
|
||||||
public class DialerActivity extends Activity implements LinphoneCoreListener {
|
public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
private TextView mAddress;
|
private AddressText mAddress;
|
||||||
private TextView mDisplayNameView;
|
private TextView mDisplayNameView;
|
||||||
|
|
||||||
private TextView mStatus;
|
private TextView mStatus;
|
||||||
private ImageButton mCall;
|
private ImageButton mCall;
|
||||||
private ImageButton mDecline;
|
private View mDecline;
|
||||||
private ImageButton mHangup;
|
private View mHangup;
|
||||||
private Button mErase;
|
|
||||||
|
|
||||||
private ToggleImageButton mMute;
|
private MuteMicButton mMute;
|
||||||
private ToggleImageButton mSpeaker;
|
private SpeakerButton mSpeaker;
|
||||||
|
|
||||||
private LinearLayout mCallControlRow;
|
private LinearLayout mCallControlRow;
|
||||||
private TableRow mInCallControlRow;
|
private TableRow mInCallControlRow;
|
||||||
|
@ -80,8 +78,6 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
private static DialerActivity theDialer;
|
private static DialerActivity theDialer;
|
||||||
|
|
||||||
private String mDisplayName;
|
|
||||||
private AudioManager mAudioManager;
|
|
||||||
private PowerManager.WakeLock mWakeLock;
|
private PowerManager.WakeLock mWakeLock;
|
||||||
private SharedPreferences mPref;
|
private SharedPreferences mPref;
|
||||||
private ImageButton mAddVideo;
|
private ImageButton mAddVideo;
|
||||||
|
@ -105,15 +101,11 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
return theDialer;
|
return theDialer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContactAddress(String aContact,String aDisplayName) {
|
|
||||||
mAddress.setText(aContact);
|
|
||||||
mDisplayName = aDisplayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.dialer);
|
setContentView(R.layout.dialer);
|
||||||
mAudioManager = ((AudioManager)getSystemService(Context.AUDIO_SERVICE));
|
LinphoneManager.getInstance().setAudioManager(((AudioManager)getSystemService(Context.AUDIO_SERVICE)));
|
||||||
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
|
||||||
mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,"Linphone");
|
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,"Linphone");
|
||||||
|
@ -121,30 +113,10 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mAddress = (TextView) findViewById(R.id.SipUri);
|
mAddress = (AddressText) findViewById(R.id.SipUri);
|
||||||
mDisplayNameView = (TextView) findViewById(R.id.DisplayNameView);
|
mDisplayNameView = (TextView) findViewById(R.id.DisplayNameView);
|
||||||
mErase = (Button)findViewById(R.id.Erase);
|
((EraseButton) findViewById(R.id.Erase)).setAddressView(mAddress);
|
||||||
|
|
||||||
mErase.setOnClickListener(new OnClickListener() {
|
|
||||||
public void onClick(View v) {
|
|
||||||
mDisplayName=null;
|
|
||||||
if (mAddress.length() >0) {
|
|
||||||
int lBegin = mAddress.getSelectionStart();
|
|
||||||
if (lBegin == -1) {
|
|
||||||
lBegin = mAddress.getEditableText().length()-1;
|
|
||||||
}
|
|
||||||
if (lBegin >0) {
|
|
||||||
mAddress.getEditableText().delete(lBegin-1,lBegin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mErase.setOnLongClickListener(new OnLongClickListener() {
|
|
||||||
public boolean onLongClick(View arg0) {
|
|
||||||
mAddress.getEditableText().clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mAddVideo = (ImageButton) findViewById(R.id.AddVideo);
|
mAddVideo = (ImageButton) findViewById(R.id.AddVideo);
|
||||||
mAddVideo.setOnClickListener(new OnClickListener() {
|
mAddVideo.setOnClickListener(new OnClickListener() {
|
||||||
|
@ -161,46 +133,21 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mCall = (ImageButton) findViewById(R.id.Call);
|
mCall = (ImageButton) findViewById(R.id.Call);
|
||||||
mCall.setOnClickListener(new OnClickListener() {
|
mCall.setOnClickListener(new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
callOrAcceptIncommingCall();
|
||||||
if (lLinphoneCore.isInComingInvitePending()) {
|
|
||||||
try {
|
|
||||||
lLinphoneCore.acceptCall(lLinphoneCore.getCurrentCall());
|
|
||||||
} catch (LinphoneCoreException e) {
|
|
||||||
lLinphoneCore.terminateCall(lLinphoneCore.getCurrentCall());
|
|
||||||
Toast toast = Toast.makeText(DialerActivity.this
|
|
||||||
,String.format(getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
|
||||||
,Toast.LENGTH_LONG);
|
|
||||||
toast.show();
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mAddress.getText().length() >0) {
|
|
||||||
newOutgoingCall(mAddress.getText().toString(),mDisplayName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
mDecline= (ImageButton) findViewById(R.id.Decline);
|
mDecline= findViewById(R.id.Decline);
|
||||||
mHangup = (ImageButton) findViewById(R.id.HangUp);
|
mDecline.setEnabled(false);
|
||||||
|
|
||||||
OnClickListener lHangupListener = new OnClickListener() {
|
mHangup = findViewById(R.id.HangUp);
|
||||||
|
|
||||||
public void onClick(View v) {
|
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
|
||||||
lLinphoneCore.terminateCall(lLinphoneCore.getCurrentCall());
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
mHangup.setOnClickListener(lHangupListener);
|
|
||||||
mDecline.setOnClickListener(lHangupListener);
|
|
||||||
|
|
||||||
|
|
||||||
mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
|
mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
|
||||||
mInCallControlRow = (TableRow) findViewById(R.id.IncallControlRow);
|
mInCallControlRow = (TableRow) findViewById(R.id.IncallControlRow);
|
||||||
mAddressLayout = (View) findViewById(R.id.Addresslayout);
|
mAddressLayout = (View) findViewById(R.id.Addresslayout);
|
||||||
mInCallAddressLayout = (View) findViewById(R.id.IncallAddressLayout);
|
mInCallAddressLayout = (View) findViewById(R.id.IncallAddressLayout);
|
||||||
mMute = (ToggleImageButton)findViewById(R.id.mic_mute_button);
|
mMute = (MuteMicButton)findViewById(R.id.mic_mute_button);
|
||||||
mSpeaker = (ToggleImageButton)findViewById(R.id.speaker_button);
|
mSpeaker = (SpeakerButton)findViewById(R.id.speaker_button);
|
||||||
/* if (Hacks.isGalaxyS()) {
|
/* if (Hacks.isGalaxyS()) {
|
||||||
// Galaxy S doesn't handle audio routing properly
|
// Galaxy S doesn't handle audio routing properly
|
||||||
// so disabling it totally
|
// so disabling it totally
|
||||||
|
@ -208,16 +155,17 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}*/
|
}*/
|
||||||
mInCallControlRow.setVisibility(View.GONE);
|
mInCallControlRow.setVisibility(View.GONE);
|
||||||
mInCallAddressLayout.setVisibility(View.GONE);
|
mInCallAddressLayout.setVisibility(View.GONE);
|
||||||
mDecline.setEnabled(false);
|
|
||||||
if (LinphoneService.isready() && getIntent().getData() != null && !LinphoneService.instance().getLinphoneCore().isIncall()) {
|
if (LinphoneService.isready() && getIntent().getData() != null && !LinphoneService.getLc().isIncall()) {
|
||||||
newOutgoingCall(getIntent().getData().toString().substring("tel://".length()));
|
newOutgoingCall(getIntent().getData().toString().substring("tel://".length()));
|
||||||
getIntent().setData(null);
|
getIntent().setData(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LinphoneService.isready()) {
|
if (LinphoneService.isready()) {
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
LinphoneCore lc = LinphoneService.getLc();
|
||||||
if (lLinphoneCore.isIncall()) {
|
if (lc.isIncall()) {
|
||||||
if(lLinphoneCore.isInComingInvitePending()) {
|
if(lc.isInComingInvitePending()) {
|
||||||
callPending(lLinphoneCore.getCurrentCall());
|
callPending(lc.getCurrentCall());
|
||||||
} else {
|
} else {
|
||||||
mCall.setEnabled(false);
|
mCall.setEnabled(false);
|
||||||
mHangup.setEnabled(!mCall.isEnabled());
|
mHangup.setEnabled(!mCall.isEnabled());
|
||||||
|
@ -227,13 +175,13 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mAddressLayout.setVisibility(View.GONE);
|
mAddressLayout.setVisibility(View.GONE);
|
||||||
mInCallAddressLayout.setVisibility(View.VISIBLE);
|
mInCallAddressLayout.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
String DisplayName = lLinphoneCore.getRemoteAddress().getDisplayName();
|
String DisplayName = lc.getRemoteAddress().getDisplayName();
|
||||||
if (DisplayName!=null) {
|
if (DisplayName!=null) {
|
||||||
mDisplayNameView.setText(DisplayName);
|
mDisplayNameView.setText(DisplayName);
|
||||||
} else {
|
} else {
|
||||||
mDisplayNameView.setText(lLinphoneCore.getRemoteAddress().getUserName());
|
mDisplayNameView.setText(lc.getRemoteAddress().getUserName());
|
||||||
}
|
}
|
||||||
configureMuteAndSpeakerButtons();
|
loadMicAndSpeakerUiStateFromLibrary();
|
||||||
LinphoneActivity.instance().startProxymitySensor();
|
LinphoneActivity.instance().startProxymitySensor();
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
}
|
}
|
||||||
|
@ -241,30 +189,6 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mMute.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
public void onCheckedChanged(ToggleImageButton button, boolean isChecked) {
|
|
||||||
LinphoneCore lc = LinphoneService.instance().getLinphoneCore();
|
|
||||||
if (isChecked) {
|
|
||||||
lc.muteMic(true);
|
|
||||||
} else {
|
|
||||||
lc.muteMic(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
mSpeaker.setOnCheckedChangeListener(new OnCheckedChangeListener() {
|
|
||||||
public void onCheckedChanged(ToggleImageButton buttonView, boolean isChecked) {
|
|
||||||
if (isChecked) {
|
|
||||||
LinphoneManager.routeAudioToSpeaker(mAudioManager);
|
|
||||||
} else {
|
|
||||||
LinphoneManager.routeAudioToReceiver(mAudioManager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
initializeDigits();
|
initializeDigits();
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,19 +204,40 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
if (!accountCheckingDone) checkAccountsSettings();
|
if (!accountCheckingDone) checkAccountsSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void callOrAcceptIncommingCall() {
|
||||||
|
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
||||||
|
if (lLinphoneCore.isInComingInvitePending()) {
|
||||||
|
try {
|
||||||
|
lLinphoneCore.acceptCall(lLinphoneCore.getCurrentCall());
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
lLinphoneCore.terminateCall(lLinphoneCore.getCurrentCall());
|
||||||
|
Toast toast = Toast.makeText(DialerActivity.this
|
||||||
|
,String.format(getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
||||||
|
,Toast.LENGTH_LONG);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mAddress.getText().length() >0) {
|
||||||
|
newOutgoingCall(mAddress.getText().toString(), mAddress.getDisplayedName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeDigits() {
|
private void initializeDigits() {
|
||||||
((Digit) findViewById(R.id.Button00)).setWidgets(mAddress, mDisplayName);
|
if (findViewById(R.id.Digit00) == null) return; // In landscape view, no keyboard
|
||||||
((Digit) findViewById(R.id.Button01)).setWidgets(mAddress, mDisplayName);
|
|
||||||
((Digit) findViewById(R.id.Button02)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit00)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.Button03)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit1)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.Button04)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit2)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.Button05)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit3)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.Button06)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit4)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.Button07)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit5)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.Button08)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit6)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.Button09)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit7)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.ButtonStar)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit8)).setAddressWidget(mAddress);
|
||||||
((Digit) findViewById(R.id.ButtonHash)).setWidgets(mAddress, mDisplayName);
|
((Digit) findViewById(R.id.Digit9)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.DigitStar)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.DigitHash)).setAddressWidget(mAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkDefined(int ... keys) {
|
private boolean checkDefined(int ... keys) {
|
||||||
|
@ -377,7 +322,8 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
public void onSaveInstanceState(Bundle savedInstanceState) {
|
public void onSaveInstanceState(Bundle savedInstanceState) {
|
||||||
super.onSaveInstanceState(savedInstanceState);
|
super.onSaveInstanceState(savedInstanceState);
|
||||||
savedInstanceState.putString(CURRENT_ADDRESS, mAddress.getText().toString());
|
savedInstanceState.putString(CURRENT_ADDRESS, mAddress.getText().toString());
|
||||||
if (mDisplayName != null) savedInstanceState.putString(CURRENT_DISPLAYNAME,mDisplayName);
|
if (mAddress.getDisplayedName() != null)
|
||||||
|
savedInstanceState.putString(CURRENT_DISPLAYNAME,mAddress.getDisplayedName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -387,7 +333,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
if (lAddress != null && mAddress != null) {
|
if (lAddress != null && mAddress != null) {
|
||||||
mAddress.setText(lAddress);
|
mAddress.setText(lAddress);
|
||||||
}
|
}
|
||||||
mDisplayName = savedInstanceState.getString(CURRENT_DISPLAYNAME);
|
mAddress.setDisplayedName(savedInstanceState.getString(CURRENT_DISPLAYNAME));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
@ -400,27 +346,17 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
public void authInfoRequested(LinphoneCore lc, String realm, String username) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
public void authInfoRequested(LinphoneCore lc, String realm, String username) /*nop*/{}
|
||||||
public void byeReceived(LinphoneCore lc, String from) {
|
public void byeReceived(LinphoneCore lc, String from) {/*nop*/}
|
||||||
// TODO Auto-generated method stub
|
public void displayMessage(LinphoneCore lc, String message) {/*nop*/}
|
||||||
|
public void displayWarning(LinphoneCore lc, String message) {/*nop*/}
|
||||||
|
|
||||||
}
|
|
||||||
public void displayMessage(LinphoneCore lc, String message) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
public void displayStatus(LinphoneCore lc, String message) {
|
public void displayStatus(LinphoneCore lc, String message) {
|
||||||
mStatus.setText(message);
|
mStatus.setText(message);
|
||||||
}
|
}
|
||||||
public void displayWarning(LinphoneCore lc, String message) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
public void globalState(LinphoneCore lc, LinphoneCore.GlobalState state, String message) {
|
public void globalState(LinphoneCore lc, LinphoneCore.GlobalState state, String message) {
|
||||||
|
|
||||||
if (state == LinphoneCore.GlobalState.GlobalOn) {
|
if (state == LinphoneCore.GlobalState.GlobalOn) {
|
||||||
mCall.setEnabled(!lc.isIncall());
|
mCall.setEnabled(!lc.isIncall());
|
||||||
mHangup.setEnabled(!mCall.isEnabled());
|
mHangup.setEnabled(!mCall.isEnabled());
|
||||||
|
@ -436,6 +372,8 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void startVideoView(int requestCode) {
|
private void startVideoView(int requestCode) {
|
||||||
Intent lIntent = new Intent();
|
Intent lIntent = new Intent();
|
||||||
lIntent.setClass(this, VideoCallActivity.class);
|
lIntent.setClass(this, VideoCallActivity.class);
|
||||||
|
@ -447,7 +385,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
if (state == LinphoneCall.State.OutgoingInit) {
|
if (state == LinphoneCall.State.OutgoingInit) {
|
||||||
enterIncalMode(lc);
|
enterIncalMode(lc);
|
||||||
LinphoneManager.routeAudioToReceiver(mAudioManager);
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
} else if (state == LinphoneCall.State.IncomingReceived) {
|
} else if (state == LinphoneCall.State.IncomingReceived) {
|
||||||
resetCameraFromPreferences();
|
resetCameraFromPreferences();
|
||||||
callPending(call);
|
callPending(call);
|
||||||
|
@ -469,13 +407,9 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show(LinphoneCore lc) {
|
public void show(LinphoneCore lc) {/*nop*/}
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enterIncalMode(LinphoneCore lc) {
|
private void enterIncalMode(LinphoneCore lc) {
|
||||||
mCallControlRow.setVisibility(View.GONE);
|
mCallControlRow.setVisibility(View.GONE);
|
||||||
|
@ -496,26 +430,21 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mDisplayNameView.setText(lc.getRemoteAddress().toString());
|
mDisplayNameView.setText(lc.getRemoteAddress().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
configureMuteAndSpeakerButtons();
|
loadMicAndSpeakerUiStateFromLibrary();
|
||||||
|
|
||||||
if (mSpeaker.isChecked()) {
|
if (mSpeaker.isSpeakerOn()) {
|
||||||
LinphoneManager.routeAudioToSpeaker(mAudioManager);
|
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||||
} else {
|
} else {
|
||||||
LinphoneManager.routeAudioToReceiver(mAudioManager);
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
}
|
}
|
||||||
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
|
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
|
||||||
LinphoneActivity.instance().startProxymitySensor();
|
LinphoneActivity.instance().startProxymitySensor();
|
||||||
if (!mWakeLock.isHeld()) mWakeLock.acquire();
|
if (!mWakeLock.isHeld()) mWakeLock.acquire();
|
||||||
|
|
||||||
}
|
}
|
||||||
private void configureMuteAndSpeakerButtons() {
|
private void loadMicAndSpeakerUiStateFromLibrary() {
|
||||||
mMute.setChecked(LinphoneService.instance().getLinphoneCore().isMicMuted());
|
mMute.setChecked(LinphoneService.getLc().isMicMuted());
|
||||||
if ((Integer.parseInt(Build.VERSION.SDK) <=4 && mAudioManager.getRouting(AudioManager.MODE_NORMAL) == AudioManager.ROUTE_SPEAKER)
|
mSpeaker.setSpeakerOn(LinphoneManager.getInstance().isSpeakerOn());
|
||||||
|| Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn()) {
|
|
||||||
mSpeaker.setChecked(true);
|
|
||||||
} else {
|
|
||||||
mSpeaker.setChecked(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetCameraFromPreferences() {
|
private void resetCameraFromPreferences() {
|
||||||
|
@ -539,8 +468,8 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
finishActivity(VIDEO_VIEW_ACTIVITY);
|
finishActivity(VIDEO_VIEW_ACTIVITY);
|
||||||
}
|
}
|
||||||
if (mWakeLock.isHeld())mWakeLock.release();
|
if (mWakeLock.isHeld())mWakeLock.release();
|
||||||
mSpeaker.setChecked(false);
|
mSpeaker.setSpeakerOn(false);
|
||||||
LinphoneManager.routeAudioToReceiver(mAudioManager);
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
BandwidthManager.getInstance().setUserRestriction(false);
|
BandwidthManager.getInstance().setUserRestriction(false);
|
||||||
resetCameraFromPreferences();
|
resetCameraFromPreferences();
|
||||||
LinphoneActivity.instance().stopProxymitySensor();
|
LinphoneActivity.instance().stopProxymitySensor();
|
||||||
|
@ -561,13 +490,13 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public synchronized void newOutgoingCall(String aTo, String displayName) {
|
private synchronized void newOutgoingCall(String aTo, String displayName) {
|
||||||
String lto = aTo;
|
String lto = aTo;
|
||||||
if (aTo.contains(OutgoingCallReceiver.TAG)) {
|
if (aTo.contains(OutgoingCallReceiver.TAG)) {
|
||||||
lto = aTo.replace(OutgoingCallReceiver.TAG, "");
|
lto = aTo.replace(OutgoingCallReceiver.TAG, "");
|
||||||
}
|
}
|
||||||
mAddress.setText(lto);
|
mAddress.setText(lto);
|
||||||
mDisplayName = displayName;
|
mAddress.setDisplayedName(displayName);
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
||||||
if (lLinphoneCore.isIncall()) {
|
if (lLinphoneCore.isIncall()) {
|
||||||
Toast toast = Toast.makeText(DialerActivity.this, getString(R.string.warning_already_incall), Toast.LENGTH_LONG);
|
Toast toast = Toast.makeText(DialerActivity.this, getString(R.string.warning_already_incall), Toast.LENGTH_LONG);
|
||||||
|
@ -584,7 +513,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
toast.show();
|
toast.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lAddress.setDisplayName(mDisplayName);
|
lAddress.setDisplayName(mAddress.getDisplayedName());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean prefVideoEnable = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
boolean prefVideoEnable = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
||||||
|
@ -601,28 +530,22 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,
|
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url) {}
|
||||||
String url) {
|
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {}
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,
|
public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,
|
||||||
LinphoneAddress from, String message) {
|
LinphoneAddress from, String message) {}
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private AndroidCameraRecordManager getVideoManager() {
|
private AndroidCameraRecordManager getVideoManager() {
|
||||||
return AndroidCameraRecordManager.getInstance();
|
return AndroidCameraRecordManager.getInstance();
|
||||||
}
|
}
|
||||||
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
||||||
int delay_ms, Object data) {
|
int delay_ms, Object data) {}
|
||||||
|
|
||||||
|
public void setContactAddress(String aContact,String aDisplayName) {
|
||||||
|
mAddress.setText(aContact);
|
||||||
|
mAddress.setDisplayedName(aDisplayName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
BigManager.java
|
LinphoneManager.java
|
||||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
|
@ -20,30 +20,33 @@ package org.linphone;
|
||||||
|
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
public class LinphoneManager {
|
public class LinphoneManager {
|
||||||
|
|
||||||
private static LinphoneManager instance;
|
private static LinphoneManager instance;
|
||||||
|
private AudioManager mAudioManager;
|
||||||
|
|
||||||
public static void routeAudioToSpeaker(AudioManager mAudioManager) {
|
|
||||||
|
public void routeAudioToSpeaker() {
|
||||||
if (Integer.parseInt(Build.VERSION.SDK) <= 4 /*<donut*/) {
|
if (Integer.parseInt(Build.VERSION.SDK) <= 4 /*<donut*/) {
|
||||||
mAudioManager.setRouting(AudioManager.MODE_NORMAL,
|
mAudioManager.setRouting(AudioManager.MODE_NORMAL,
|
||||||
AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL);
|
AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL);
|
||||||
} else {
|
} else {
|
||||||
mAudioManager.setSpeakerphoneOn(true);
|
mAudioManager.setSpeakerphoneOn(true);
|
||||||
}
|
}
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
LinphoneCore lc = LinphoneService.getLc();
|
||||||
if (lLinphoneCore.isIncall()) {
|
if (lc.isIncall()) {
|
||||||
/*disable EC*/
|
/*disable EC*/
|
||||||
lLinphoneCore.getCurrentCall().enableEchoCancellation(false);
|
lc.getCurrentCall().enableEchoCancellation(false);
|
||||||
lLinphoneCore.getCurrentCall().enableEchoLimiter(true);
|
lc.getCurrentCall().enableEchoLimiter(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void routeAudioToReceiver(AudioManager mAudioManager) {
|
public void routeAudioToReceiver() {
|
||||||
if (Integer.parseInt(Build.VERSION.SDK) <=4 /*<donut*/) {
|
if (Integer.parseInt(Build.VERSION.SDK) <=4 /*<donut*/) {
|
||||||
mAudioManager.setRouting(AudioManager.MODE_NORMAL,
|
mAudioManager.setRouting(AudioManager.MODE_NORMAL,
|
||||||
AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL);
|
AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL);
|
||||||
|
@ -51,11 +54,11 @@ public class LinphoneManager {
|
||||||
mAudioManager.setSpeakerphoneOn(false);
|
mAudioManager.setSpeakerphoneOn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
LinphoneCore lc = LinphoneService.getLc();
|
||||||
if (lLinphoneCore.isIncall()) {
|
if (lc.isIncall()) {
|
||||||
//Restore default value
|
//Restore default value
|
||||||
lLinphoneCore.getCurrentCall().enableEchoCancellation(lLinphoneCore.isEchoCancellationEnabled());
|
lc.getCurrentCall().enableEchoCancellation(lc.isEchoCancellationEnabled());
|
||||||
lLinphoneCore.getCurrentCall().enableEchoLimiter(false);
|
lc.getCurrentCall().enableEchoLimiter(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,4 +74,17 @@ public class LinphoneManager {
|
||||||
public static void startLinphone() {
|
public static void startLinphone() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAudioManager(AudioManager manager) {
|
||||||
|
mAudioManager = manager;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSpeakerOn() {
|
||||||
|
return (Integer.parseInt(Build.VERSION.SDK) <=4 && mAudioManager.getRouting(AudioManager.MODE_NORMAL) == AudioManager.ROUTE_SPEAKER)
|
||||||
|
|| Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ import android.widget.ImageButton;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ToggleImageButton extends ImageButton implements OnClickListener {
|
public class ToggleImageButton extends ImageButton implements OnClickListener {
|
||||||
private static final String namespace = null;
|
// private static final String ns = "http://schemas.android.com/apk/res/linphone";
|
||||||
|
private static final String ns = null;
|
||||||
private boolean checked;
|
private boolean checked;
|
||||||
private Drawable stateChecked;
|
private Drawable stateChecked;
|
||||||
private Drawable stateUnChecked;
|
private Drawable stateUnChecked;
|
||||||
|
@ -44,8 +45,8 @@ public class ToggleImageButton extends ImageButton implements OnClickListener {
|
||||||
|
|
||||||
public ToggleImageButton(Context context, AttributeSet attrs) {
|
public ToggleImageButton(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
stateChecked = getResources().getDrawable(attrs.getAttributeResourceValue(namespace, "checked", -1));
|
stateChecked = getResources().getDrawable(attrs.getAttributeResourceValue(ns, "checked", -1));
|
||||||
stateUnChecked = getResources().getDrawable(attrs.getAttributeResourceValue(namespace, "unchecked", -1));
|
stateUnChecked = getResources().getDrawable(attrs.getAttributeResourceValue(ns, "unchecked", -1));
|
||||||
setBackgroundColor(Color.TRANSPARENT);
|
setBackgroundColor(Color.TRANSPARENT);
|
||||||
|
|
||||||
setOnClickListener(this);
|
setOnClickListener(this);
|
||||||
|
|
49
src/org/linphone/ui/AddressText.java
Normal file
49
src/org/linphone/ui/AddressText.java
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
AddressView.java
|
||||||
|
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
public class AddressText extends EditText {
|
||||||
|
|
||||||
|
private String displayedName;
|
||||||
|
|
||||||
|
public AddressText(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearDisplayedName() {
|
||||||
|
displayedName = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayedName() {
|
||||||
|
return displayedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContactAddress(String uri, String displayedName) {
|
||||||
|
this.displayedName = displayedName;
|
||||||
|
setText(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayedName(String displayedName) {
|
||||||
|
this.displayedName = displayedName;
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,12 +26,10 @@ import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
public class Digit extends Button {
|
public class Digit extends Button {
|
||||||
|
|
||||||
private TextView mAddress;
|
private AddressText mAddress;
|
||||||
private String mDisplayName; // FIXME not linked with dialeractivity
|
|
||||||
|
|
||||||
private final void createWidget(Context context, AttributeSet attrs) {
|
private final void createWidget(Context context, AttributeSet attrs) {
|
||||||
String ns = "http://schemas.android.com/apk/res/android";
|
String ns = "http://schemas.android.com/apk/res/android";
|
||||||
|
@ -89,7 +87,7 @@ public class Digit extends Button {
|
||||||
if (lBegin >=0) {
|
if (lBegin >=0) {
|
||||||
mAddress.getEditableText().insert(lBegin,mKeyCode);
|
mAddress.getEditableText().insert(lBegin,mKeyCode);
|
||||||
}
|
}
|
||||||
mDisplayName="";
|
mAddress.clearDisplayedName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
@ -112,8 +110,7 @@ public class Digit extends Button {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public void setWidgets(TextView address, String displayName) {
|
public void setAddressWidget(AddressText address) {
|
||||||
mAddress = address;
|
mAddress = address;
|
||||||
mDisplayName = displayName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
60
src/org/linphone/ui/EraseButton.java
Normal file
60
src/org/linphone/ui/EraseButton.java
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
EraseButton.java
|
||||||
|
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.View.OnLongClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
public class EraseButton extends Button implements OnClickListener, OnLongClickListener{
|
||||||
|
|
||||||
|
private AddressText address;
|
||||||
|
|
||||||
|
public EraseButton(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
setOnClickListener(this);
|
||||||
|
setOnLongClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
address.clearDisplayedName();
|
||||||
|
if (address.getText().length() >0) {
|
||||||
|
int lBegin = address.getSelectionStart();
|
||||||
|
if (lBegin == -1) {
|
||||||
|
lBegin = address.getEditableText().length()-1;
|
||||||
|
}
|
||||||
|
if (lBegin >0) {
|
||||||
|
address.getEditableText().delete(lBegin-1,lBegin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
address.getEditableText().clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddressView(AddressText view) {
|
||||||
|
address = view;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
41
src/org/linphone/ui/HangCallButton.java
Normal file
41
src/org/linphone/ui/HangCallButton.java
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
SpeakerButton.java
|
||||||
|
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneManager;
|
||||||
|
import org.linphone.core.LinphoneCore;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
|
public class HangCallButton extends ImageButton implements OnClickListener {
|
||||||
|
|
||||||
|
public HangCallButton(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
|
lc.terminateCall(lc.getCurrentCall());
|
||||||
|
}
|
||||||
|
}
|
52
src/org/linphone/ui/MuteMicButton.java
Normal file
52
src/org/linphone/ui/MuteMicButton.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
SpeakerButton.java
|
||||||
|
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneManager;
|
||||||
|
import org.linphone.component.ToggleImageButton;
|
||||||
|
import org.linphone.component.ToggleImageButton.OnCheckedChangeListener;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
public class MuteMicButton extends ToggleImageButton implements OnCheckedChangeListener {
|
||||||
|
|
||||||
|
public MuteMicButton(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
setOnCheckedChangeListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isMicMuted() {
|
||||||
|
return isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMicMuted(boolean state) {
|
||||||
|
setChecked(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onCheckedChanged(ToggleImageButton button, boolean checked) {
|
||||||
|
if (checked) {
|
||||||
|
LinphoneManager.getLc().muteMic(true);
|
||||||
|
} else {
|
||||||
|
LinphoneManager.getLc().muteMic(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
src/org/linphone/ui/SpeakerButton.java
Normal file
54
src/org/linphone/ui/SpeakerButton.java
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
SpeakerButton.java
|
||||||
|
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneManager;
|
||||||
|
import org.linphone.component.ToggleImageButton;
|
||||||
|
import org.linphone.component.ToggleImageButton.OnCheckedChangeListener;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
public class SpeakerButton extends ToggleImageButton implements OnCheckedChangeListener {
|
||||||
|
|
||||||
|
public SpeakerButton(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
setOnCheckedChangeListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isSpeakerOn() {
|
||||||
|
return isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpeakerOn(boolean state) {
|
||||||
|
setChecked(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onCheckedChanged(ToggleImageButton button, boolean checked) {
|
||||||
|
if (checked) {
|
||||||
|
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||||
|
} else {
|
||||||
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue