Fix bis function on dialer start call/add call/transfer call buttons

This commit is contained in:
Sylvain Berfini 2019-05-03 17:56:26 +02:00
parent 76df95c9fb
commit 630876fa8d
2 changed files with 18 additions and 28 deletions

View file

@ -77,37 +77,13 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
mStartCall = findViewById(R.id.start_call); mStartCall = findViewById(R.id.start_call);
mStartCall.setAddressWidget(mAddress); mStartCall.setAddressWidget(mAddress);
mStartCall.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
LinphoneManager.getCallManager().newOutgoingCall(mAddress);
}
});
mAddCall = findViewById(R.id.add_call); mAddCall = findViewById(R.id.add_call);
mAddCall.setAddressWidget(mAddress); mAddCall.setAddressWidget(mAddress);
mAddCall.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
LinphoneManager.getCallManager().newOutgoingCall(mAddress);
}
});
mTransferCall = findViewById(R.id.transfer_call); mTransferCall = findViewById(R.id.transfer_call);
mTransferCall.setAddressWidget(mAddress); mTransferCall.setAddressWidget(mAddress);
mTransferCall.setOnClickListener( mTransferCall.setIsTransfer(true);
new View.OnClickListener() {
@Override
public void onClick(View v) {
Core core = LinphoneManager.getCore();
if (core.getCurrentCall() == null) {
return;
}
core.transferCall(core.getCurrentCall(), mAddress.getText().toString());
}
});
mNumpad = findViewById(R.id.numpad); mNumpad = findViewById(R.id.numpad);
if (mNumpad != null) { if (mNumpad != null) {

View file

@ -34,11 +34,13 @@ import org.linphone.settings.LinphonePreferences;
@SuppressLint("AppCompatCustomView") @SuppressLint("AppCompatCustomView")
public class CallButton extends ImageView implements OnClickListener, AddressAware { public class CallButton extends ImageView implements OnClickListener, AddressAware {
private AddressText mAddress; private AddressText mAddress;
private boolean mIsTransfer;
public CallButton(Context context, AttributeSet attrs) { public CallButton(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mIsTransfer = false;
setOnClickListener(this); setOnClickListener(this);
} }
@ -46,9 +48,21 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
mAddress = a; mAddress = a;
} }
public void setIsTransfer(boolean isTransfer) {
mIsTransfer = isTransfer;
}
public void onClick(View v) { public void onClick(View v) {
if (mAddress.getText().length() > 0) { if (mAddress.getText().length() > 0) {
if (mIsTransfer) {
Core core = LinphoneManager.getCore();
if (core.getCurrentCall() == null) {
return;
}
core.transferCall(core.getCurrentCall(), mAddress.getText().toString());
} else {
LinphoneManager.getCallManager().newOutgoingCall(mAddress); LinphoneManager.getCallManager().newOutgoingCall(mAddress);
}
} else { } else {
if (LinphonePreferences.instance().isBisFeatureEnabled()) { if (LinphonePreferences.instance().isBisFeatureEnabled()) {
Core core = LinphoneManager.getCore(); Core core = LinphoneManager.getCore();