Call last adress called when click on call button if adress field is empty
This commit is contained in:
parent
583855ceca
commit
f96130528a
2 changed files with 20 additions and 1 deletions
|
@ -16,7 +16,7 @@
|
||||||
<bool name="only_display_username_if_unknown">true</bool>
|
<bool name="only_display_username_if_unknown">true</bool>
|
||||||
<bool name="display_messages_time">true</bool> <!-- Used to show the time of each message arrival -->
|
<bool name="display_messages_time">true</bool> <!-- Used to show the time of each message arrival -->
|
||||||
<bool name="display_time_aside">false</bool> <!-- if display_messages_time = true, display time on the side of the message instead of below -->
|
<bool name="display_time_aside">false</bool> <!-- if display_messages_time = true, display time on the side of the message instead of below -->
|
||||||
|
<bool name="call_last_log_if_adress_is_empty">true</bool>
|
||||||
<bool name="allow_ringing_while_early_media">true</bool>
|
<bool name="allow_ringing_while_early_media">true</bool>
|
||||||
<bool name="allow_transfers">true</bool>
|
<bool name="allow_transfers">true</bool>
|
||||||
<bool name="allow_edit_in_dialer">true</bool>
|
<bool name="allow_edit_in_dialer">true</bool>
|
||||||
|
|
|
@ -20,6 +20,8 @@ package org.linphone.ui;
|
||||||
|
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
|
import org.linphone.core.CallDirection;
|
||||||
|
import org.linphone.core.LinphoneCallLog;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -50,6 +52,23 @@ public class CallButton extends ImageView implements OnClickListener, AddressAwa
|
||||||
if (!LinphoneManager.getInstance().acceptCallIfIncomingPending()) {
|
if (!LinphoneManager.getInstance().acceptCallIfIncomingPending()) {
|
||||||
if (mAddress.getText().length() > 0) {
|
if (mAddress.getText().length() > 0) {
|
||||||
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
||||||
|
} else {
|
||||||
|
if (getContext().getResources().getBoolean(R.bool.call_last_log_if_adress_is_empty)) {
|
||||||
|
LinphoneCallLog[] logs = LinphoneManager.getLc().getCallLogs();
|
||||||
|
LinphoneCallLog log = null;
|
||||||
|
for (int i = logs.length - 1; i >= 0; i--) {
|
||||||
|
if (logs[i].getDirection() == CallDirection.Outgoing) {
|
||||||
|
log = logs[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (log == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mAddress.setText(log.getTo().asStringUriOnly());
|
||||||
|
mAddress.setDisplayedName(log.getTo().getDisplayName());
|
||||||
|
LinphoneManager.getInstance().newOutgoingCall(mAddress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (LinphoneCoreException e) {
|
} catch (LinphoneCoreException e) {
|
||||||
|
|
Loading…
Reference in a new issue