Fixed direct call from address book
This commit is contained in:
parent
04887af28e
commit
7832bc03d9
3 changed files with 41 additions and 2 deletions
|
@ -169,6 +169,15 @@ public class DialerFragment extends Fragment {
|
|||
shouldEmptyAddressField = true;
|
||||
}
|
||||
resetLayout(isCallTransferOngoing);
|
||||
|
||||
String addressWaitingToBeCalled = LinphoneActivity.instance().mAddressWaitingToBeCalled;
|
||||
if (addressWaitingToBeCalled != null) {
|
||||
mAddress.setText(addressWaitingToBeCalled);
|
||||
if (getResources().getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) {
|
||||
newOutgoingCall(addressWaitingToBeCalled);
|
||||
}
|
||||
LinphoneActivity.instance().mAddressWaitingToBeCalled = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetLayout(boolean callTransfer) {
|
||||
|
|
|
@ -141,6 +141,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
private boolean callTransfer = false;
|
||||
private boolean isOnBackground = false;
|
||||
|
||||
public String mAddressWaitingToBeCalled;
|
||||
|
||||
static final boolean isInstanciated() {
|
||||
return instance != null;
|
||||
}
|
||||
|
@ -1428,6 +1430,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
|
||||
|
||||
|
||||
if (getCurrentFragment() == FragmentsAvailable.SETTINGS) {
|
||||
if (fragment instanceof SettingsFragment) {
|
||||
|
@ -1465,6 +1469,11 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
} else {
|
||||
((DialerFragment) dialerFragment).newOutgoingCall(intent);
|
||||
}
|
||||
} else {
|
||||
if (extras != null && extras.containsKey("SipUriOrNumber")) {
|
||||
mAddressWaitingToBeCalled = extras.getString("SipUriOrNumber");
|
||||
goToDialerFragment();
|
||||
}
|
||||
}
|
||||
if (LinphoneManager.getLc().getCalls().length > 0) {
|
||||
// If a call is ringing, start incomingcallactivity
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.linphone;
|
|||
import static android.content.Intent.ACTION_MAIN;
|
||||
|
||||
import org.linphone.assistant.RemoteProvisioningActivity;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.tutorials.TutorialLauncherActivity;
|
||||
|
||||
|
@ -41,13 +42,14 @@ public class LinphoneLauncherActivity extends Activity {
|
|||
|
||||
private Handler mHandler;
|
||||
private ServiceWaitThread mServiceThread;
|
||||
private String addressToCall;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Hack to avoid to draw twice LinphoneActivity on tablets
|
||||
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
setContentView(R.layout.launch_screen);
|
||||
|
@ -55,7 +57,6 @@ public class LinphoneLauncherActivity extends Activity {
|
|||
mHandler = new Handler();
|
||||
|
||||
|
||||
|
||||
if (LinphoneService.isReady()) {
|
||||
onServiceReady();
|
||||
} else {
|
||||
|
@ -64,6 +65,21 @@ public class LinphoneLauncherActivity extends Activity {
|
|||
mServiceThread = new ServiceWaitThread();
|
||||
mServiceThread.start();
|
||||
}
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
String action = intent.getAction();
|
||||
if (Intent.ACTION_CALL.equals(action)) {
|
||||
if (intent.getData() != null) {
|
||||
addressToCall = intent.getData().toString();
|
||||
addressToCall = addressToCall.replace("%40", "@");
|
||||
addressToCall = addressToCall.replace("%3A", ":");
|
||||
if (addressToCall.startsWith("sip:")) {
|
||||
addressToCall = addressToCall.substring("sip:".length());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void onServiceReady() {
|
||||
|
@ -98,6 +114,11 @@ public class LinphoneLauncherActivity extends Activity {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (addressToCall != null) {
|
||||
newIntent.putExtra("SipUriOrNumber", addressToCall);
|
||||
Log.i("Intent has address to call : " + addressToCall);
|
||||
addressToCall = null;
|
||||
}
|
||||
startActivity(newIntent);
|
||||
if (classToStart == LinphoneActivity.class && LinphoneActivity.isInstanciated() && msgShared != null) {
|
||||
LinphoneActivity.instance().displayChat(null, msgShared);
|
||||
|
|
Loading…
Reference in a new issue