From f42cdaa5ca80605e17f8866bdc8cbe14afb1f8fa Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Tue, 13 Jun 2017 11:32:34 +0200 Subject: [PATCH] Change incoming view icon: when call asking for video and video should automatically accept --- .../org/linphone/CallIncomingActivity.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/android/org/linphone/CallIncomingActivity.java b/src/android/org/linphone/CallIncomingActivity.java index a00344ea7..aa519650c 100644 --- a/src/android/org/linphone/CallIncomingActivity.java +++ b/src/android/org/linphone/CallIncomingActivity.java @@ -90,6 +90,12 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin declineUnlock = (LinearLayout) findViewById(R.id.declineUnlock); accept = (ImageView) findViewById(R.id.accept); + lookupCurrentCall(); + if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null && + LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() && + mCall.getRemoteParams().getVideoEnabled()) { + accept.setImageResource(R.drawable.call_video_start); + } decline = (ImageView) findViewById(R.id.decline); arrow = (ImageView) findViewById(R.id.arrow_hangup); accept.setOnClickListener(new View.OnClickListener() { @@ -206,15 +212,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin mCall = null; // Only one call ringing at a time is allowed - if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { - List calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc()); - for (LinphoneCall call : calls) { - if (State.IncomingReceived == call.getState()) { - mCall = call; - break; - } - } - } + lookupCurrentCall(); if (mCall == null) { //The incoming call no longer exists. Log.d("Couldn't find incoming call"); @@ -264,6 +262,18 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin return super.onKeyDown(keyCode, event); } + private void lookupCurrentCall() { + if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) { + List calls = LinphoneUtils.getLinphoneCalls(LinphoneManager.getLc()); + for (LinphoneCall call : calls) { + if (State.IncomingReceived == call.getState()) { + mCall = call; + break; + } + } + } + } + private void decline() { if (alreadyAcceptedOrDeniedCall) { return;