Add several new ui components.
Cleanups.
This commit is contained in:
parent
83b638abbb
commit
4d79c4e618
18 changed files with 459 additions and 283 deletions
|
@ -38,15 +38,14 @@
|
||||||
<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_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>
|
<org.linphone.ui.AddVideoButton 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"/>
|
||||||
<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"/>
|
<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"
|
||||||
android:layout_width="fill_parent" android:id="@+id/CallControlRow" android:layout_weight="1">
|
android:layout_width="fill_parent" android:id="@+id/CallControlRow" android:layout_weight="1">
|
||||||
<ImageButton android:id="@+id/Call"
|
<org.linphone.ui.CallButton 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>
|
|
||||||
<org.linphone.ui.HangCallButton 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"/>
|
android:layout_weight="0.25" android:id="@+id/Decline" android:background="@drawable/clavier_bg" android:src="@drawable/stopcall_red"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -40,56 +40,43 @@
|
||||||
<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_weight="1">
|
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">
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit1"
|
<org.linphone.ui.Digit android:id="@+id/Digit1" android:text="1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
android:text="1" style="@style/DialerDigit" />
|
<org.linphone.ui.Digit android:id="@+id/Digit2" android:text="2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit2"
|
<org.linphone.ui.Digit android:id="@+id/Digit3" android:text="3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
android:text="2" style="@style/DialerDigit" />
|
</TableRow>
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit3"
|
|
||||||
android:text="3" style="@style/DialerDigit" />
|
|
||||||
</TableRow>
|
|
||||||
<TableRow android:layout_height="fill_parent"
|
|
||||||
android:layout_weight="1" android:id="@+id/DialerRow02"
|
|
||||||
android:layout_width="fill_parent">
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit4"
|
|
||||||
android:text="4" style="@style/DialerDigit" />
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit5"
|
|
||||||
android:text="5" style="@style/DialerDigit" />
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit6"
|
|
||||||
android:text="6" style="@style/DialerDigit" />
|
|
||||||
</TableRow>
|
|
||||||
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
|
||||||
android:id="@+id/DialerRow03" android:layout_width="fill_parent">
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit7"
|
|
||||||
android:text="7" style="@style/DialerDigit" />
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit8"
|
|
||||||
android:text="8" style="@style/DialerDigit" />
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit9"
|
|
||||||
android:text="9" style="@style/DialerDigit" />
|
|
||||||
</TableRow>
|
|
||||||
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
|
||||||
android:id="@+id/DialerRow04" android:layout_width="fill_parent">
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/DigitStar"
|
|
||||||
android:text="*" style="@style/DialerDigit" />
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/Digit00"
|
|
||||||
android:text="0+" style="@style/DialerDigit" />
|
|
||||||
<org.linphone.ui.Digit android:id="@+id/DigitHash"
|
|
||||||
android:text="#" style="@style/DialerDigit" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<TableRow android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="1" android:id="@+id/DialerRow02"
|
||||||
|
android:layout_width="fill_parent">
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/Digit4" android:text="4" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/Digit5" android:text="5" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/Digit6" android:text="6" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
||||||
|
android:id="@+id/DialerRow03" android:layout_width="fill_parent">
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/Digit7" android:text="7" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/Digit8" android:text="8" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/Digit9" android:text="9" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
|
||||||
|
android:id="@+id/DialerRow04" android:layout_width="fill_parent">
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/DigitStar" android:text="*" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/Digit00" android:text="0+" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
<org.linphone.ui.Digit android:id="@+id/DigitHash" android:text="#" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
|
||||||
|
</TableRow>
|
||||||
<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>
|
<org.linphone.ui.AddVideoButton 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"/>
|
||||||
<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"/>
|
<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>
|
<org.linphone.ui.CallButton 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"/>
|
||||||
<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"/>
|
<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,22 +18,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneManager.NewOutgoingCallUiListener;
|
||||||
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;
|
||||||
import org.linphone.core.LinphoneChatRoom;
|
import org.linphone.core.LinphoneChatRoom;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
|
||||||
import org.linphone.core.LinphoneCoreListener;
|
import org.linphone.core.LinphoneCoreListener;
|
||||||
import org.linphone.core.LinphoneFriend;
|
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.AddVideoButton;
|
||||||
import org.linphone.ui.AddressText;
|
import org.linphone.ui.AddressText;
|
||||||
|
import org.linphone.ui.CallButton;
|
||||||
import org.linphone.ui.Digit;
|
import org.linphone.ui.Digit;
|
||||||
import org.linphone.ui.EraseButton;
|
import org.linphone.ui.EraseButton;
|
||||||
import org.linphone.ui.MuteMicButton;
|
import org.linphone.ui.MuteMicButton;
|
||||||
import org.linphone.ui.SpeakerButton;
|
import org.linphone.ui.SpeakerButton;
|
||||||
|
import org.linphone.ui.AddVideoButton.AlreadyInVideoCallListener;
|
||||||
|
import org.linphone.ui.CallButton.CallButtonListener;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
@ -51,20 +55,18 @@ import android.provider.Settings;
|
||||||
import android.text.Html;
|
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.widget.ImageButton;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TableRow;
|
import android.widget.TableRow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class DialerActivity extends Activity implements LinphoneCoreListener {
|
public class DialerActivity extends Activity implements LinphoneCoreListener, AlreadyInVideoCallListener, CallButtonListener, NewOutgoingCallUiListener {
|
||||||
|
|
||||||
private AddressText mAddress;
|
private AddressText mAddress;
|
||||||
private TextView mDisplayNameView;
|
private TextView mDisplayNameView;
|
||||||
|
|
||||||
private TextView mStatus;
|
private TextView mStatus;
|
||||||
private ImageButton mCall;
|
private CallButton mCall;
|
||||||
private View mDecline;
|
private View mDecline;
|
||||||
private View mHangup;
|
private View mHangup;
|
||||||
|
|
||||||
|
@ -80,7 +82,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
private PowerManager.WakeLock mWakeLock;
|
private PowerManager.WakeLock mWakeLock;
|
||||||
private SharedPreferences mPref;
|
private SharedPreferences mPref;
|
||||||
private ImageButton mAddVideo;
|
private AddVideoButton mAddVideo;
|
||||||
|
|
||||||
private static final String PREF_CHECK_CONFIG = "pref_check_config";
|
private static final String PREF_CHECK_CONFIG = "pref_check_config";
|
||||||
public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
|
public static final String PREF_FIRST_LAUNCH = "pref_first_launch";
|
||||||
|
@ -105,11 +107,13 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.dialer);
|
setContentView(R.layout.dialer);
|
||||||
LinphoneManager.getInstance().setAudioManager(((AudioManager)getSystemService(Context.AUDIO_SERVICE)));
|
mPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
LinphoneManager.getInstance().setUsefullStuff(am, mPref, getWindowManager(), getResources());
|
||||||
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");
|
||||||
mPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -118,24 +122,15 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
((EraseButton) findViewById(R.id.Erase)).setAddressView(mAddress);
|
((EraseButton) findViewById(R.id.Erase)).setAddressView(mAddress);
|
||||||
|
|
||||||
|
|
||||||
mAddVideo = (ImageButton) findViewById(R.id.AddVideo);
|
mAddVideo = (AddVideoButton) findViewById(R.id.AddVideo);
|
||||||
mAddVideo.setOnClickListener(new OnClickListener() {
|
mAddVideo.setOnAlreadyInVideoCallListener(this);
|
||||||
public void onClick(View v) {
|
|
||||||
// If no in video call; try to reinvite with video
|
|
||||||
boolean alreadyInVideoCall = !CallManager.getInstance().reinviteWithVideo();
|
|
||||||
if (alreadyInVideoCall) {
|
mCall = (CallButton) findViewById(R.id.Call);
|
||||||
// In video call; going back to video call activity
|
mCall.setCallButtonListerner(this);
|
||||||
startVideoView(VIDEO_VIEW_ACTIVITY);
|
mCall.setAddressWidget(mAddress);
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mCall = (ImageButton) findViewById(R.id.Call);
|
|
||||||
mCall.setOnClickListener(new OnClickListener() {
|
|
||||||
public void onClick(View v) {
|
|
||||||
callOrAcceptIncommingCall();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mDecline= findViewById(R.id.Decline);
|
mDecline= findViewById(R.id.Decline);
|
||||||
mDecline.setEnabled(false);
|
mDecline.setEnabled(false);
|
||||||
|
|
||||||
|
@ -143,18 +138,15 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
|
|
||||||
mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
|
mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
|
||||||
mInCallControlRow = (TableRow) findViewById(R.id.IncallControlRow);
|
|
||||||
mAddressLayout = (View) findViewById(R.id.Addresslayout);
|
mAddressLayout = (View) findViewById(R.id.Addresslayout);
|
||||||
|
|
||||||
|
mInCallControlRow = (TableRow) findViewById(R.id.IncallControlRow);
|
||||||
|
mInCallControlRow.setVisibility(View.GONE);
|
||||||
mInCallAddressLayout = (View) findViewById(R.id.IncallAddressLayout);
|
mInCallAddressLayout = (View) findViewById(R.id.IncallAddressLayout);
|
||||||
|
mInCallAddressLayout.setVisibility(View.GONE);
|
||||||
mMute = (MuteMicButton)findViewById(R.id.mic_mute_button);
|
mMute = (MuteMicButton)findViewById(R.id.mic_mute_button);
|
||||||
mSpeaker = (SpeakerButton)findViewById(R.id.speaker_button);
|
mSpeaker = (SpeakerButton)findViewById(R.id.speaker_button);
|
||||||
/* if (Hacks.isGalaxyS()) {
|
|
||||||
// Galaxy S doesn't handle audio routing properly
|
|
||||||
// so disabling it totally
|
|
||||||
mSpeaker.setVisibility(View.GONE);
|
|
||||||
}*/
|
|
||||||
mInCallControlRow.setVisibility(View.GONE);
|
|
||||||
mInCallAddressLayout.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
if (LinphoneService.isready() && getIntent().getData() != null && !LinphoneService.getLc().isIncall()) {
|
if (LinphoneService.isready() && getIntent().getData() != null && !LinphoneService.getLc().isIncall()) {
|
||||||
newOutgoingCall(getIntent().getData().toString().substring("tel://".length()));
|
newOutgoingCall(getIntent().getData().toString().substring("tel://".length()));
|
||||||
|
@ -189,8 +181,21 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
initializeDigits();
|
if (findViewById(R.id.Digit00) != null) { // In landscape view, no keyboard
|
||||||
|
((Digit) findViewById(R.id.Digit00)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit1)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit2)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit3)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit4)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit5)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit6)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit7)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit8)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.Digit9)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.DigitStar)).setAddressWidget(mAddress);
|
||||||
|
((Digit) findViewById(R.id.DigitHash)).setAddressWidget(mAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mStatus = (TextView) findViewById(R.id.status_label);
|
mStatus = (TextView) findViewById(R.id.status_label);
|
||||||
theDialer = this;
|
theDialer = this;
|
||||||
|
@ -201,44 +206,21 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!accountCheckingDone) checkAccountsSettings();
|
if (!accountCheckingDone) {
|
||||||
}
|
if (mPref.getBoolean(PREF_FIRST_LAUNCH, true)) {
|
||||||
|
onFirstLaunch();
|
||||||
private void callOrAcceptIncommingCall() {
|
} else if (!mPref.getBoolean(PREF_CHECK_CONFIG, false)
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
&& !checkDefined(R.string.pref_username_key, R.string.pref_passwd_key, R.string.pref_domain_key)) {
|
||||||
if (lLinphoneCore.isInComingInvitePending()) {
|
onBadSettings();
|
||||||
try {
|
} else {
|
||||||
lLinphoneCore.acceptCall(lLinphoneCore.getCurrentCall());
|
accountCheckingDone = true;
|
||||||
} 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() {
|
|
||||||
if (findViewById(R.id.Digit00) == null) return; // In landscape view, no keyboard
|
|
||||||
|
|
||||||
((Digit) findViewById(R.id.Digit00)).setAddressWidget(mAddress);
|
|
||||||
((Digit) findViewById(R.id.Digit1)).setAddressWidget(mAddress);
|
|
||||||
((Digit) findViewById(R.id.Digit2)).setAddressWidget(mAddress);
|
|
||||||
((Digit) findViewById(R.id.Digit3)).setAddressWidget(mAddress);
|
|
||||||
((Digit) findViewById(R.id.Digit4)).setAddressWidget(mAddress);
|
|
||||||
((Digit) findViewById(R.id.Digit5)).setAddressWidget(mAddress);
|
|
||||||
((Digit) findViewById(R.id.Digit6)).setAddressWidget(mAddress);
|
|
||||||
((Digit) findViewById(R.id.Digit7)).setAddressWidget(mAddress);
|
|
||||||
((Digit) findViewById(R.id.Digit8)).setAddressWidget(mAddress);
|
|
||||||
((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) {
|
||||||
for (int key : keys) {
|
for (int key : keys) {
|
||||||
|
@ -249,66 +231,58 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onFirstLaunch() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
TextView lDialogTextView = new TextView(this);
|
||||||
|
lDialogTextView.setAutoLinkMask(0x0f/*all*/);
|
||||||
|
lDialogTextView.setPadding(10, 10, 10, 10);
|
||||||
|
|
||||||
private void checkAccountsSettings() {
|
lDialogTextView.setText(Html.fromHtml(getString(R.string.first_launch_message)));
|
||||||
if (mPref.getBoolean(PREF_FIRST_LAUNCH, true)) {
|
|
||||||
// First launch
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
||||||
TextView lDialogTextView = new TextView(this);
|
|
||||||
lDialogTextView.setAutoLinkMask(0x0f/*all*/);
|
|
||||||
lDialogTextView.setPadding(10, 10, 10, 10);
|
|
||||||
|
|
||||||
lDialogTextView.setText(Html.fromHtml(getString(R.string.first_launch_message)));
|
builder.setCustomTitle(lDialogTextView)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.cont), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
LinphoneActivity.instance().startprefActivity();
|
||||||
|
accountCheckingDone = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
builder.setCustomTitle(lDialogTextView)
|
builder.create().show();
|
||||||
.setCancelable(false)
|
|
||||||
.setPositiveButton(getString(R.string.cont), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
LinphoneActivity.instance().startprefActivity();
|
|
||||||
accountCheckingDone = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.create().show();
|
|
||||||
|
|
||||||
|
|
||||||
} else if (!mPref.getBoolean(PREF_CHECK_CONFIG, false)
|
|
||||||
&& !checkDefined(R.string.pref_username_key, R.string.pref_passwd_key, R.string.pref_domain_key)) {
|
|
||||||
// Account not set
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
||||||
TextView lDialogTextView = new TextView(this);
|
|
||||||
lDialogTextView.setAutoLinkMask(0x0f/*all*/);
|
|
||||||
lDialogTextView.setPadding(10, 10, 10, 10);
|
|
||||||
|
|
||||||
lDialogTextView.setText(Html.fromHtml(getString(R.string.initial_config_error)));
|
|
||||||
|
|
||||||
builder.setCustomTitle(lDialogTextView)
|
|
||||||
.setCancelable(false)
|
|
||||||
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
LinphoneActivity.instance().startprefActivity();
|
|
||||||
accountCheckingDone = true;
|
|
||||||
}
|
|
||||||
}).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
dialog.cancel();
|
|
||||||
accountCheckingDone = true;
|
|
||||||
}
|
|
||||||
}).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit();
|
|
||||||
dialog.cancel();
|
|
||||||
accountCheckingDone = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.create().show();
|
|
||||||
} else {
|
|
||||||
accountCheckingDone = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onBadSettings() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
TextView lDialogTextView = new TextView(this);
|
||||||
|
lDialogTextView.setAutoLinkMask(0x0f/*all*/);
|
||||||
|
lDialogTextView.setPadding(10, 10, 10, 10);
|
||||||
|
|
||||||
|
lDialogTextView.setText(Html.fromHtml(getString(R.string.initial_config_error)));
|
||||||
|
|
||||||
|
builder.setCustomTitle(lDialogTextView)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
LinphoneActivity.instance().startprefActivity();
|
||||||
|
accountCheckingDone = true;
|
||||||
|
}
|
||||||
|
}).setNeutralButton(getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.cancel();
|
||||||
|
accountCheckingDone = true;
|
||||||
|
}
|
||||||
|
}).setNegativeButton(getString(R.string.never_remind), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
mPref.edit().putBoolean(PREF_CHECK_CONFIG, true).commit();
|
||||||
|
dialog.cancel();
|
||||||
|
accountCheckingDone = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void updateIncallVideoCallButton() {
|
private void updateIncallVideoCallButton() {
|
||||||
boolean prefVideoEnabled = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
boolean prefVideoEnabled = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
||||||
if (prefVideoEnabled && !mCall.isEnabled()) {
|
if (prefVideoEnabled && !mCall.isEnabled()) {
|
||||||
|
@ -384,13 +358,13 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) {
|
public void callState(final LinphoneCore lc,final LinphoneCall call, final State state, final String message) {
|
||||||
|
|
||||||
if (state == LinphoneCall.State.OutgoingInit) {
|
if (state == LinphoneCall.State.OutgoingInit) {
|
||||||
enterIncalMode(lc);
|
enterIncallMode(lc);
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
} else if (state == LinphoneCall.State.IncomingReceived) {
|
} else if (state == LinphoneCall.State.IncomingReceived) {
|
||||||
resetCameraFromPreferences();
|
LinphoneManager.getInstance().resetCameraFromPreferences();
|
||||||
callPending(call);
|
callPending(call);
|
||||||
} else if (state == LinphoneCall.State.Connected) {
|
} else if (state == LinphoneCall.State.Connected) {
|
||||||
enterIncalMode(lc);
|
enterIncallMode(lc);
|
||||||
} else if (state == LinphoneCall.State.Error) {
|
} else if (state == LinphoneCall.State.Error) {
|
||||||
if (mWakeLock.isHeld()) mWakeLock.release();
|
if (mWakeLock.isHeld()) mWakeLock.release();
|
||||||
Toast toast = Toast.makeText(this
|
Toast toast = Toast.makeText(this
|
||||||
|
@ -401,7 +375,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
} else if (state == LinphoneCall.State.CallEnd) {
|
} else if (state == LinphoneCall.State.CallEnd) {
|
||||||
exitCallMode();
|
exitCallMode();
|
||||||
} else if (state == LinphoneCall.State.StreamsRunning) {
|
} else if (state == LinphoneCall.State.StreamsRunning) {
|
||||||
if (LinphoneService.instance().getLinphoneCore().getCurrentCall().getCurrentParamsCopy().getVideoEnabled()) {
|
if (LinphoneService.getLc().getCurrentCall().getCurrentParamsCopy().getVideoEnabled()) {
|
||||||
if (!VideoCallActivity.launched) {
|
if (!VideoCallActivity.launched) {
|
||||||
startVideoView(VIDEO_VIEW_ACTIVITY);
|
startVideoView(VIDEO_VIEW_ACTIVITY);
|
||||||
}
|
}
|
||||||
|
@ -411,7 +385,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
|
|
||||||
public void show(LinphoneCore lc) {/*nop*/}
|
public void show(LinphoneCore lc) {/*nop*/}
|
||||||
|
|
||||||
private void enterIncalMode(LinphoneCore lc) {
|
private void enterIncallMode(LinphoneCore lc) {
|
||||||
mCallControlRow.setVisibility(View.GONE);
|
mCallControlRow.setVisibility(View.GONE);
|
||||||
mInCallControlRow.setVisibility(View.VISIBLE);
|
mInCallControlRow.setVisibility(View.VISIBLE);
|
||||||
mAddressLayout.setVisibility(View.GONE);
|
mAddressLayout.setVisibility(View.GONE);
|
||||||
|
@ -447,12 +421,6 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mSpeaker.setSpeakerOn(LinphoneManager.getInstance().isSpeakerOn());
|
mSpeaker.setSpeakerOn(LinphoneManager.getInstance().isSpeakerOn());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetCameraFromPreferences() {
|
|
||||||
boolean useFrontCam = mPref.getBoolean(getString(R.string.pref_video_use_front_camera_key), false);
|
|
||||||
getVideoManager().setUseFrontCamera(useFrontCam);
|
|
||||||
final int phoneOrientation = 90 * getWindowManager().getDefaultDisplay().getOrientation();
|
|
||||||
getVideoManager().setPhoneOrientation(phoneOrientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void exitCallMode() {
|
private void exitCallMode() {
|
||||||
mCallControlRow.setVisibility(View.VISIBLE);
|
mCallControlRow.setVisibility(View.VISIBLE);
|
||||||
|
@ -471,7 +439,7 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mSpeaker.setSpeakerOn(false);
|
mSpeaker.setSpeakerOn(false);
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
BandwidthManager.getInstance().setUserRestriction(false);
|
BandwidthManager.getInstance().setUserRestriction(false);
|
||||||
resetCameraFromPreferences();
|
LinphoneManager.getInstance().resetCameraFromPreferences();
|
||||||
LinphoneActivity.instance().stopProxymitySensor();
|
LinphoneActivity.instance().stopProxymitySensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,53 +450,17 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
// Privacy setting to not share the user camera by default
|
// Privacy setting to not share the user camera by default
|
||||||
boolean prefVideoEnable = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
boolean prefVideoEnable = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
||||||
boolean prefAutomaticallyShareMyCamera = mPref.getBoolean(getString(R.string.pref_video_automatically_share_my_video_key), false);
|
boolean prefAutomaticallyShareMyCamera = mPref.getBoolean(getString(R.string.pref_video_automatically_share_my_video_key), false);
|
||||||
getVideoManager().setMuted(!(prefVideoEnable && prefAutomaticallyShareMyCamera));
|
AndroidCameraRecordManager.getInstance().setMuted(!(prefVideoEnable && prefAutomaticallyShareMyCamera));
|
||||||
call.enableCamera(prefAutomaticallyShareMyCamera);
|
call.enableCamera(prefAutomaticallyShareMyCamera);
|
||||||
}
|
}
|
||||||
public void newOutgoingCall(String aTo) {
|
public void newOutgoingCall(String aTo) {
|
||||||
newOutgoingCall(aTo,null);
|
mAddress.setText(aTo);
|
||||||
|
mAddress.clearDisplayedName();
|
||||||
|
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private synchronized void newOutgoingCall(String aTo, String displayName) {
|
|
||||||
String lto = aTo;
|
|
||||||
if (aTo.contains(OutgoingCallReceiver.TAG)) {
|
|
||||||
lto = aTo.replace(OutgoingCallReceiver.TAG, "");
|
|
||||||
}
|
|
||||||
mAddress.setText(lto);
|
|
||||||
mAddress.setDisplayedName(displayName);
|
|
||||||
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
|
||||||
if (lLinphoneCore.isIncall()) {
|
|
||||||
Toast toast = Toast.makeText(DialerActivity.this, getString(R.string.warning_already_incall), Toast.LENGTH_LONG);
|
|
||||||
toast.show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LinphoneAddress lAddress;
|
|
||||||
try {
|
|
||||||
lAddress = lLinphoneCore.interpretUrl(lto);
|
|
||||||
} catch (LinphoneCoreException e) {
|
|
||||||
Toast toast = Toast.makeText(DialerActivity.this
|
|
||||||
,String.format(getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
|
||||||
, Toast.LENGTH_LONG);
|
|
||||||
toast.show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
lAddress.setDisplayName(mAddress.getDisplayedName());
|
|
||||||
|
|
||||||
try {
|
|
||||||
boolean prefVideoEnable = mPref.getBoolean(getString(R.string.pref_video_enable_key), false);
|
|
||||||
boolean prefInitiateWithVideo = mPref.getBoolean(getString(R.string.pref_video_initiate_call_with_video_key), false);
|
|
||||||
resetCameraFromPreferences();
|
|
||||||
CallManager.getInstance().inviteAddress(lAddress, prefVideoEnable && prefInitiateWithVideo);
|
|
||||||
|
|
||||||
} catch (LinphoneCoreException e) {
|
|
||||||
Toast toast = Toast.makeText(DialerActivity.this
|
|
||||||
,String.format(getString(R.string.error_cannot_get_call_parameters),mAddress.getText().toString())
|
|
||||||
,Toast.LENGTH_LONG);
|
|
||||||
toast.show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url) {}
|
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url) {}
|
||||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {}
|
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {}
|
||||||
|
@ -536,9 +468,6 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
LinphoneAddress from, String message) {}
|
LinphoneAddress from, String message) {}
|
||||||
|
|
||||||
|
|
||||||
private AndroidCameraRecordManager getVideoManager() {
|
|
||||||
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) {}
|
||||||
|
|
||||||
|
@ -546,6 +475,34 @@ public class DialerActivity extends Activity implements LinphoneCoreListener {
|
||||||
mAddress.setText(aContact);
|
mAddress.setText(aContact);
|
||||||
mAddress.setDisplayedName(aDisplayName);
|
mAddress.setDisplayedName(aDisplayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onAlreadyInVideoCall() {
|
||||||
|
startVideoView(VIDEO_VIEW_ACTIVITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onWrongDestinationAddress() {
|
||||||
|
Toast toast = Toast.makeText(DialerActivity.this
|
||||||
|
,String.format(getString(R.string.warning_wrong_destination_address),mAddress.getText().toString())
|
||||||
|
,Toast.LENGTH_LONG);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onAlreadyInCall() {
|
||||||
|
Toast toast = Toast.makeText(DialerActivity.this, getString(R.string.warning_already_incall), Toast.LENGTH_LONG);
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onCannotGetCallParameters() {
|
||||||
|
Toast toast = Toast.makeText(DialerActivity.this
|
||||||
|
,String.format(getString(R.string.error_cannot_get_call_parameters),mAddress.getText().toString())
|
||||||
|
,Toast.LENGTH_LONG);
|
||||||
|
toast.show();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ import android.util.Log;
|
||||||
|
|
||||||
public class Hacks {
|
public class Hacks {
|
||||||
|
|
||||||
|
private Hacks() {}
|
||||||
|
|
||||||
public static boolean isGalaxyS() {
|
public static boolean isGalaxyS() {
|
||||||
return Build.DEVICE.startsWith("GT-I9000") || Build.DEVICE.startsWith("GT-P1000");
|
return Build.DEVICE.startsWith("GT-I9000") || Build.DEVICE.startsWith("GT-P1000");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
ContactPickerActivity.java
|
KeepAliveReceiver.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
|
||||||
|
@ -25,7 +25,7 @@ import android.util.Log;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class KeepAliveManager extends BroadcastReceiver {
|
public class KeepAliveReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
|
@ -21,22 +21,17 @@ package org.linphone;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class LinphoneException extends Exception {
|
public class LinphoneException extends Exception {
|
||||||
|
|
||||||
public LinphoneException() {
|
public LinphoneException() {}
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinphoneException(String detailMessage) {
|
public LinphoneException(String detailMessage) {
|
||||||
super(detailMessage);
|
super(detailMessage);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinphoneException(Throwable throwable) {
|
public LinphoneException(Throwable throwable) {
|
||||||
super(throwable);
|
super(throwable);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinphoneException(String detailMessage, Throwable throwable) {
|
public LinphoneException(String detailMessage, Throwable throwable) {
|
||||||
super(detailMessage, throwable);
|
super(detailMessage, throwable);
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,17 +18,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
|
import org.linphone.core.AndroidCameraRecordManager;
|
||||||
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
|
import org.linphone.core.LinphoneCoreException;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
public class LinphoneManager {
|
public class LinphoneManager {
|
||||||
|
|
||||||
private static LinphoneManager instance;
|
private static LinphoneManager instance;
|
||||||
private AudioManager mAudioManager;
|
private AudioManager mAudioManager;
|
||||||
|
private NewOutgoingCallUiListener newOutgoingCallUiListener;
|
||||||
|
private SharedPreferences mPref;
|
||||||
|
private Resources mR;
|
||||||
|
private WindowManager mWindowManager;
|
||||||
|
|
||||||
|
private LinphoneManager() {}
|
||||||
|
|
||||||
public void routeAudioToSpeaker() {
|
public void routeAudioToSpeaker() {
|
||||||
if (Integer.parseInt(Build.VERSION.SDK) <= 4 /*<donut*/) {
|
if (Integer.parseInt(Build.VERSION.SDK) <= 4 /*<donut*/) {
|
||||||
|
@ -71,13 +81,12 @@ public class LinphoneManager {
|
||||||
return LinphoneService.getLc();
|
return LinphoneService.getLc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void startLinphone() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAudioManager(AudioManager manager) {
|
public void setUsefullStuff(AudioManager audioManager, SharedPreferences pref, WindowManager windowManager, Resources r) {
|
||||||
mAudioManager = manager;
|
mAudioManager = audioManager;
|
||||||
|
mPref = pref;
|
||||||
|
mR = r;
|
||||||
|
mWindowManager = windowManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSpeakerOn() {
|
public boolean isSpeakerOn() {
|
||||||
|
@ -85,6 +94,73 @@ public class LinphoneManager {
|
||||||
|| Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn();
|
|| Integer.parseInt(Build.VERSION.SDK) >4 &&mAudioManager.isSpeakerphoneOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void newOutgoingCall(AddressType address) {
|
||||||
|
String to = address.getText().toString();
|
||||||
|
if (to.contains(OutgoingCallReceiver.TAG)) {
|
||||||
|
to = to.replace(OutgoingCallReceiver.TAG, "");
|
||||||
|
address.setText(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
LinphoneCore lLinphoneCore = LinphoneService.instance().getLinphoneCore();
|
||||||
|
if (lLinphoneCore.isIncall()) {
|
||||||
|
newOutgoingCallUiListener.onAlreadyInCall();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LinphoneAddress lAddress;
|
||||||
|
try {
|
||||||
|
lAddress = lLinphoneCore.interpretUrl(to);
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
newOutgoingCallUiListener.onWrongDestinationAddress();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lAddress.setDisplayName(address.getDisplayedName());
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
boolean prefVideoEnable = mPref.getBoolean(mR.getString(R.string.pref_video_enable_key), false);
|
||||||
|
boolean prefInitiateWithVideo = mPref.getBoolean(mR.getString(R.string.pref_video_initiate_call_with_video_key), false);
|
||||||
|
resetCameraFromPreferences();
|
||||||
|
CallManager.getInstance().inviteAddress(lAddress, prefVideoEnable && prefInitiateWithVideo);
|
||||||
|
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
newOutgoingCallUiListener.onCannotGetCallParameters();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void resetCameraFromPreferences() {
|
||||||
|
boolean useFrontCam = mPref.getBoolean(mR.getString(R.string.pref_video_use_front_camera_key), false);
|
||||||
|
AndroidCameraRecordManager.getInstance().setUseFrontCamera(useFrontCam);
|
||||||
|
final int phoneOrientation = 90 * mWindowManager.getDefaultDisplay().getOrientation();
|
||||||
|
AndroidCameraRecordManager.getInstance().setPhoneOrientation(phoneOrientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewOutgoingCallUiListener(NewOutgoingCallUiListener l) {
|
||||||
|
this.newOutgoingCallUiListener = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface AddressType {
|
||||||
|
void setText(CharSequence s);
|
||||||
|
CharSequence getText();
|
||||||
|
void setDisplayedName(String s);
|
||||||
|
String getDisplayedName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static interface NewOutgoingCallUiListener {
|
||||||
|
public void onWrongDestinationAddress();
|
||||||
|
public void onCannotGetCallParameters();
|
||||||
|
public void onAlreadyInCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void sendStaticImage(boolean send) {
|
||||||
|
LinphoneCore lc = LinphoneService.getLc();
|
||||||
|
if (lc.isIncall()) {
|
||||||
|
lc.getCurrentCall().enableCamera(!send);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class LinphoneService extends Service implements LinphoneCoreListener {
|
||||||
LinphoneCall.State mCurrentCallState;
|
LinphoneCall.State mCurrentCallState;
|
||||||
Vibrator mVibrator;
|
Vibrator mVibrator;
|
||||||
private AudioManager mAudioManager;
|
private AudioManager mAudioManager;
|
||||||
private BroadcastReceiver mKeepAliveMgrReceiver = new KeepAliveManager();
|
private BroadcastReceiver mKeepAliveMgrReceiver = new KeepAliveReceiver();
|
||||||
private BroadcastReceiver mOutgoingCallReceiver = null;
|
private BroadcastReceiver mOutgoingCallReceiver = null;
|
||||||
|
|
||||||
private Handler mHandler = new Handler() ;
|
private Handler mHandler = new Handler() ;
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class VideoCallActivity extends Activity {
|
||||||
recordManager.setSurfaceView(mVideoCaptureView, phoneOrientation);
|
recordManager.setSurfaceView(mVideoCaptureView, phoneOrientation);
|
||||||
mVideoCaptureView.setZOrderOnTop(true);
|
mVideoCaptureView.setZOrderOnTop(true);
|
||||||
|
|
||||||
if (!recordManager.isMuted()) sendStaticImage(false);
|
if (!recordManager.isMuted()) LinphoneManager.getInstance().sendStaticImage(false);
|
||||||
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,"Linphone");
|
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,"Linphone");
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
|
@ -134,12 +134,7 @@ public class VideoCallActivity extends Activity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendStaticImage(boolean send) {
|
|
||||||
LinphoneCore lc = LinphoneService.getLc();
|
|
||||||
if (lc.isIncall()) {
|
|
||||||
lc.getCurrentCall().enableCamera(!send);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sv capture surface view to resize the layout
|
* @param sv capture surface view to resize the layout
|
||||||
|
@ -167,13 +162,13 @@ public class VideoCallActivity extends Activity {
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.videocall_menu_back_to_dialer:
|
case R.id.videocall_menu_back_to_dialer:
|
||||||
if (!recordManager.isMuted()) sendStaticImage(true);
|
if (!recordManager.isMuted()) LinphoneManager.getInstance().sendStaticImage(true);
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
case R.id.videocall_menu_change_resolution:
|
case R.id.videocall_menu_change_resolution:
|
||||||
BandwidthManager manager = BandwidthManager.getInstance();
|
BandwidthManager manager = BandwidthManager.getInstance();
|
||||||
manager.setUserRestriction(!manager.isUserRestriction());
|
manager.setUserRestriction(!manager.isUserRestriction());
|
||||||
sendStaticImage(recordManager.isMuted());
|
LinphoneManager.getInstance().sendStaticImage(recordManager.isMuted());
|
||||||
rewriteChangeResolutionItem(item);
|
rewriteChangeResolutionItem(item);
|
||||||
|
|
||||||
// Resize preview frame
|
// Resize preview frame
|
||||||
|
@ -188,7 +183,7 @@ public class VideoCallActivity extends Activity {
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
case R.id.videocall_menu_toggle_camera:
|
case R.id.videocall_menu_toggle_camera:
|
||||||
sendStaticImage(recordManager.toggleMute());
|
LinphoneManager.getInstance().sendStaticImage(recordManager.toggleMute());
|
||||||
rewriteToggleCameraItem(item);
|
rewriteToggleCameraItem(item);
|
||||||
break;
|
break;
|
||||||
case R.id.videocall_menu_switch_camera:
|
case R.id.videocall_menu_switch_camera:
|
||||||
|
|
58
src/org/linphone/ui/AddVideoButton.java
Normal file
58
src/org/linphone/ui/AddVideoButton.java
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
AddVideoButton.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.CallManager;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
|
public class AddVideoButton extends ImageButton implements OnClickListener {
|
||||||
|
|
||||||
|
private AlreadyInVideoCallListener alreadyInVideoCallListener;
|
||||||
|
|
||||||
|
public AddVideoButton(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
// If no in video call; try to reinvite with video
|
||||||
|
boolean alreadyInVideoCall = !CallManager.getInstance().reinviteWithVideo();
|
||||||
|
if (alreadyInVideoCall && alreadyInVideoCallListener != null) {
|
||||||
|
// In video call; going back to video call activity
|
||||||
|
alreadyInVideoCallListener.onAlreadyInVideoCall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setOnAlreadyInVideoCallListener(AlreadyInVideoCallListener listener) {
|
||||||
|
this.alreadyInVideoCallListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static interface AlreadyInVideoCallListener {
|
||||||
|
void onAlreadyInVideoCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
25
src/org/linphone/ui/AddressAwareWidget.java
Normal file
25
src/org/linphone/ui/AddressAwareWidget.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
AddressAwareWidget.java
|
||||||
|
Copyright (C) 2011 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;
|
||||||
|
|
||||||
|
public interface AddressAwareWidget {
|
||||||
|
|
||||||
|
void setAddressWidget(AddressText address);
|
||||||
|
|
||||||
|
}
|
|
@ -18,11 +18,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
import org.linphone.LinphoneManager.AddressType;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
public class AddressText extends EditText {
|
public class AddressText extends EditText implements AddressType {
|
||||||
|
|
||||||
private String displayedName;
|
private String displayedName;
|
||||||
|
|
||||||
|
|
72
src/org/linphone/ui/CallButton.java
Normal file
72
src/org/linphone/ui/CallButton.java
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
CallButton.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 org.linphone.core.LinphoneCoreException;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
|
public class CallButton extends ImageButton implements OnClickListener, AddressAwareWidget {
|
||||||
|
|
||||||
|
private CallButtonListener callButtonListener;
|
||||||
|
private AddressText mAddress;
|
||||||
|
|
||||||
|
public CallButton(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
|
if (lc.isInComingInvitePending()) {
|
||||||
|
try {
|
||||||
|
lc.acceptCall(lc.getCurrentCall());
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
lc.terminateCall(lc.getCurrentCall());
|
||||||
|
callButtonListener.onWrongDestinationAddress();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mAddress.getText().length() >0) {
|
||||||
|
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static interface CallButtonListener {
|
||||||
|
void onWrongDestinationAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setCallButtonListerner(CallButtonListener listener) {
|
||||||
|
callButtonListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddressWidget(AddressText address) {
|
||||||
|
mAddress = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -25,54 +25,64 @@ import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.OnLongClickListener;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
public class Digit extends Button {
|
public class Digit extends Button implements OnLongClickListener, AddressAwareWidget {
|
||||||
|
|
||||||
private AddressText mAddress;
|
private AddressText mAddress;
|
||||||
|
|
||||||
private final void createWidget(Context context, AttributeSet attrs) {
|
|
||||||
String ns = "http://schemas.android.com/apk/res/android";
|
@Override
|
||||||
String dtmf = attrs.getAttributeValue(ns, "text");
|
protected void onTextChanged(CharSequence text, int start, int before,
|
||||||
DialKeyListener lListener = new DialKeyListener(dtmf);
|
int after) {
|
||||||
|
super.onTextChanged(text, start, before, after);
|
||||||
|
|
||||||
|
if (text == null || text.length() < 1) return;
|
||||||
|
|
||||||
|
DialKeyListener lListener = new DialKeyListener();
|
||||||
setOnClickListener(lListener);
|
setOnClickListener(lListener);
|
||||||
setOnTouchListener(lListener);
|
setOnTouchListener(lListener);
|
||||||
|
|
||||||
if ("0+".equals(dtmf)) {
|
if ("0+".equals(text)) {
|
||||||
setOnLongClickListener(new OnLongClickListener() {
|
setOnLongClickListener(this);
|
||||||
public boolean onLongClick(View arg0) {
|
|
||||||
LinphoneCore lc = LinphoneManager.getLc();
|
|
||||||
lc.stopDtmf();
|
|
||||||
int lBegin = mAddress.getSelectionStart();
|
|
||||||
if (lBegin == -1) {
|
|
||||||
lBegin = mAddress.getEditableText().length();
|
|
||||||
}
|
|
||||||
if (lBegin >=0) {
|
|
||||||
mAddress.getEditableText().insert(lBegin,"+");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean onLongClick(View arg0) {
|
||||||
|
// Called if "0+" dtmf
|
||||||
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
|
lc.stopDtmf();
|
||||||
|
int lBegin = mAddress.getSelectionStart();
|
||||||
|
if (lBegin == -1) {
|
||||||
|
lBegin = mAddress.getEditableText().length();
|
||||||
|
}
|
||||||
|
if (lBegin >=0) {
|
||||||
|
mAddress.getEditableText().insert(lBegin,"+");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public Digit(Context context, AttributeSet attrs, int style) {
|
public Digit(Context context, AttributeSet attrs, int style) {
|
||||||
super(context, attrs, style);
|
super(context, attrs, style);
|
||||||
createWidget(context, attrs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Digit(Context context, AttributeSet attrs) {
|
public Digit(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
createWidget(context, attrs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Digit(Context context) {
|
||||||
|
super(context);
|
||||||
private class DialKeyListener implements OnClickListener ,OnTouchListener {
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private class DialKeyListener implements OnClickListener, OnTouchListener {
|
||||||
final CharSequence mKeyCode;
|
final CharSequence mKeyCode;
|
||||||
boolean mIsDtmfStarted=false;
|
boolean mIsDtmfStarted=false;
|
||||||
DialKeyListener(String aKeyCode) {
|
DialKeyListener() {
|
||||||
mKeyCode = aKeyCode.subSequence(0, 1);
|
mKeyCode = Digit.this.getText().subSequence(0, 1);
|
||||||
}
|
}
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
LinphoneCore lc = LinphoneManager.getLc();
|
LinphoneCore lc = LinphoneManager.getLc();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
SpeakerButton.java
|
HangCallButton.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
|
||||||
|
|
|
@ -19,8 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
|
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.component.ToggleImageButton;
|
import org.linphone.ui.ToggleImageButton.OnCheckedChangeListener;
|
||||||
import org.linphone.component.ToggleImageButton.OnCheckedChangeListener;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
|
@ -19,8 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
package org.linphone.ui;
|
package org.linphone.ui;
|
||||||
|
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.component.ToggleImageButton;
|
import org.linphone.ui.ToggleImageButton.OnCheckedChangeListener;
|
||||||
import org.linphone.component.ToggleImageButton.OnCheckedChangeListener;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone.component;
|
package org.linphone.ui;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
Loading…
Reference in a new issue