Fixed call transfer button no shown, instead call add button is visible

This commit is contained in:
Sylvain Berfini 2019-04-18 12:52:29 +02:00
parent 6b3bff4412
commit aa5efc67f7
2 changed files with 17 additions and 38 deletions

View file

@ -412,7 +412,6 @@ public class LinphoneActivity extends LinphoneGenericActivity
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
mCallTransfer = false;
mIsOnBackground = true; mIsOnBackground = true;
super.onPause(); super.onPause();
@ -534,6 +533,7 @@ public class LinphoneActivity extends LinphoneGenericActivity
}*/ }*/
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
mCallTransfer = false;
if (extras != null) { if (extras != null) {
if (extras.getBoolean("GoToChat", false)) { if (extras.getBoolean("GoToChat", false)) {
String localSipUri = extras.getString("LocalSipUri"); String localSipUri = extras.getString("LocalSipUri");
@ -566,6 +566,12 @@ public class LinphoneActivity extends LinphoneGenericActivity
goToDialerFragment(); goToDialerFragment();
} else if (extras.getBoolean("Transfer", false)) { } else if (extras.getBoolean("Transfer", false)) {
intent.putExtra("DoNotGoToCallActivity", true); intent.putExtra("DoNotGoToCallActivity", true);
mCallTransfer = true;
if (LinphoneManager.getLc().getCallsNb() > 0) {
initInCallMenuLayout();
} else {
resetClassicMenuLayoutAndGoBackToCallIfStillRunning();
}
} else if (extras.getBoolean("AddCall", false)) { } else if (extras.getBoolean("AddCall", false)) {
intent.putExtra("DoNotGoToCallActivity", true); intent.putExtra("DoNotGoToCallActivity", true);
} else if (intent.getStringExtra("msgShared") != null) { } else if (intent.getStringExtra("msgShared") != null) {
@ -1382,7 +1388,12 @@ public class LinphoneActivity extends LinphoneGenericActivity
AddressType address = new AddressText(this, null); AddressType address = new AddressText(this, null);
address.setText(number); address.setText(number);
address.setDisplayedName(name); address.setDisplayedName(name);
if (!mCallTransfer) {
LinphoneManager.getInstance().newOutgoingCall(address); LinphoneManager.getInstance().newOutgoingCall(address);
} else {
addressWaitingToBeCalled = number;
displayDialer();
}
} }
public void startIncallActivity() { public void startIncallActivity() {

View file

@ -20,9 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.app.Fragment; import android.app.Fragment;
import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -32,11 +30,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import org.linphone.LinphoneActivity; import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphoneService;
import org.linphone.R; import org.linphone.R;
import org.linphone.contacts.ContactsManager;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.tools.Log;
import org.linphone.views.AddressAware; import org.linphone.views.AddressAware;
import org.linphone.views.AddressText; import org.linphone.views.AddressText;
import org.linphone.views.CallButton; import org.linphone.views.CallButton;
@ -178,7 +173,8 @@ public class DialerFragment extends Fragment {
String addressWaitingToBeCalled = LinphoneActivity.instance().addressWaitingToBeCalled; String addressWaitingToBeCalled = LinphoneActivity.instance().addressWaitingToBeCalled;
if (addressWaitingToBeCalled != null) { if (addressWaitingToBeCalled != null) {
mAddress.setText(addressWaitingToBeCalled); mAddress.setText(addressWaitingToBeCalled);
if (getResources() if (!LinphoneActivity.instance().isCallTransfer()
&& getResources()
.getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) { .getBoolean(R.bool.automatically_start_intercepted_outgoing_gsm_call)) {
newOutgoingCall(addressWaitingToBeCalled); newOutgoingCall(addressWaitingToBeCalled);
} }
@ -208,6 +204,7 @@ public class DialerFragment extends Fragment {
mAddContact.setImageResource(R.drawable.call_back); mAddContact.setImageResource(R.drawable.call_back);
mAddContact.setOnClickListener(mCancelListener); mAddContact.setOnClickListener(mCancelListener);
} else { } else {
mCall.resetClickListener();
if (LinphoneManager.getLc().getVideoActivationPolicy().getAutomaticallyInitiate()) { if (LinphoneManager.getLc().getVideoActivationPolicy().getAutomaticallyInitiate()) {
mCall.setImageResource(R.drawable.call_video_start); mCall.setImageResource(R.drawable.call_video_start);
} else { } else {
@ -235,33 +232,4 @@ public class DialerFragment extends Fragment {
displayTextInAddressBar(numberOrSipAddress); displayTextInAddressBar(numberOrSipAddress);
LinphoneManager.getInstance().newOutgoingCall(mAddress); LinphoneManager.getInstance().newOutgoingCall(mAddress);
} }
public void newOutgoingCall(Intent intent) {
if (intent != null && intent.getData() != null) {
String scheme = intent.getData().getScheme();
if (scheme.startsWith("imto")) {
mAddress.setText("sip:" + intent.getData().getLastPathSegment());
} else if (scheme.startsWith("call") || scheme.startsWith("sip")) {
mAddress.setText(intent.getData().getSchemeSpecificPart());
} else {
Uri contactUri = intent.getData();
String address =
ContactsManager.getInstance()
.getAddressOrNumberForAndroidContact(
LinphoneService.instance().getContentResolver(),
contactUri);
if (address != null) {
mAddress.setText(address);
} else {
Log.e("Unknown scheme: ", scheme);
mAddress.setText(intent.getData().getSchemeSpecificPart());
}
}
mAddress.clearDisplayedName();
intent.setData(null);
LinphoneManager.getInstance().newOutgoingCall(mAddress);
}
}
} }