diff --git a/res/layout/call_incoming.xml b/res/layout/call_incoming.xml
index 50998f542..2b7ee03ea 100644
--- a/res/layout/call_incoming.xml
+++ b/res/layout/call_incoming.xml
@@ -25,7 +25,6 @@
style="@style/font1"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingLeft="10dp"
android:gravity="center"/>
diff --git a/res/values/color.xml b/res/values/color.xml
index 740dc6902..336f84bde 100644
--- a/res/values/color.xml
+++ b/res/values/color.xml
@@ -12,7 +12,6 @@
#ffa645
#3eb5c0
#96c11f
- #ffeee5
#00000000
diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml
index bc3a817cc..102c1d5c3 100644
--- a/res/values/non_localizable_custom.xml
+++ b/res/values/non_localizable_custom.xml
@@ -3,8 +3,10 @@
false
+ false
sip.linphone.org
stun.linphone.org
+ true
https://www.linphone.org/wizard.php
diff --git a/src/org/linphone/CallActivity.java b/src/org/linphone/CallActivity.java
index 4aadd313f..fadd84ba0 100644
--- a/src/org/linphone/CallActivity.java
+++ b/src/org/linphone/CallActivity.java
@@ -32,6 +32,7 @@ import org.linphone.core.LinphonePlayer;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import org.linphone.ui.Numpad;
+import org.w3c.dom.Text;
import android.app.Activity;
import android.app.Dialog;
@@ -130,6 +131,7 @@ public class CallActivity extends Activity implements OnClickListener {
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
mListener = new LinphoneCoreListenerBase(){
+
@Override
public void callState(LinphoneCore lc, final LinphoneCall call, LinphoneCall.State state, String message) {
if (LinphoneManager.getLc().getCallsNb() == 0) {
@@ -163,13 +165,6 @@ public class CallActivity extends Activity implements OnClickListener {
}
}
- if (state == State.Connected) {
- if(call.getCurrentParamsCopy().getMediaEncryption().equals(LinphoneCore.MediaEncryption.ZRTP) && !call.isAuthenticationTokenVerified()){
- //TODO AFFICHER DIALOG ZRTP
- status.showZRTPDialog(call);
- }
- }
-
if (state == State.StreamsRunning) {
switchVideo(isVideoEnabled(call));
//Check media in progress
@@ -228,6 +223,9 @@ public class CallActivity extends Activity implements OnClickListener {
@Override
public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) {
if (status != null) {
+ if(call.getCurrentParamsCopy().getMediaEncryption().equals(LinphoneCore.MediaEncryption.ZRTP) && !call.isAuthenticationTokenVerified()){
+ status.showZRTPDialog(call);
+ }
status.refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled());
}
}
@@ -1450,109 +1448,54 @@ public class CallActivity extends Activity implements OnClickListener {
videoCallFragment = fragment;
}
- private void displayActiveCall(LinphoneCall call){
- if(!isVideoEnabled(call)){
- mActiveCallHeader.setVisibility(View.VISIBLE);
- mNoCurrentCall.setVisibility(View.GONE);
- }
- if(call == null) return;
- String sipUri = call.getRemoteAddress().asStringUriOnly();
- LinphoneAddress lAddress;
- try {
- lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
- } catch (LinphoneCoreException e) {
- Log.e("Incall activity cannot parse remote address",e);
- lAddress= LinphoneCoreFactory.instance().createLinphoneAddress("unknown","unknown","unknown");
- }
+ //CALL INFORMATION
- TextView contact = (TextView) findViewById(R.id.contact_name);
+ private void displayCurrentCall(LinphoneCall call){
+ //if(!isVideoEnabled(call)){
+ // mActiveCallHeader.setVisibility(View.VISIBLE);
+ // mNoCurrentCall.setVisibility(View.GONE);
+ //}
- Contact lContact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), lAddress);
- if (lContact == null) {
- contact.setText(lAddress.getUserName());
- } else {
- contact.setText(lContact.getName());
- LinphoneUtils.setImagePictureFromUri(contactPicture.getContext(), contactPicture, lContact.getPhotoUri(), lContact.getThumbnailUri());
- }
+ LinphoneAddress lAddress = call.getRemoteAddress();
+ TextView contactName = (TextView) findViewById(R.id.contact_name);
-
- /*if(contact != null) {
-
- } else {
- displayOrHideContactPicture(imageView, null, null, false);
- }
- callsList.addView(imageView);*/
-
- int callDuration = call.getDuration();
- if (callDuration == 0 && call.getState() != State.StreamsRunning) {
- return;
- }
-
- Chronometer timer = (Chronometer) findViewById(R.id.call_timer);
- if (timer == null) {
- throw new IllegalArgumentException("no callee_duration view found");
- }
-
- timer.setBase(SystemClock.elapsedRealtime() - 1000 * callDuration);
- timer.start();
+ setContactInformation(contactName, contactPicture, lAddress);
+ registerCallDurationTimer(null, call);
}
- private void displayOtherCalls(Resources resources, final LinphoneCall call, int index) {
- String sipUri = call.getRemoteAddress().asStringUriOnly();
- LinphoneAddress lAddress;
- try {
- lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
- } catch (LinphoneCoreException e) {
- Log.e("Incall activity cannot parse remote address",e);
- lAddress= LinphoneCoreFactory.instance().createLinphoneAddress("uknown","unknown","unkonown");
- }
+ private void displayPausedCalls(Resources resources, final LinphoneCall call, int index) {
+ LinphoneAddress lAddress = call.getRemoteAddress();
// Control Row
LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.call_inactive_row, container, false);
callView.setId(index+1);
- TextView contact = (TextView) callView.findViewById(R.id.contact_name);
+ TextView contactName = (TextView) callView.findViewById(R.id.contact_name);
+ ImageView contactImage = (ImageView) callView.findViewById(R.id.contact_picture);
- Contact lContact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), lAddress);
- if (lContact == null) {
- contact.setText(lAddress.getUserName());
- } else {
- contact.setText(lContact.getName());
- }
-
- displayCallStatusIconAndReturnCallPaused(callView, call);
- registerCallDurationTimer(callView, call);
- callsList.addView(callView);
-
- // Image Row
-
-
-
- // callView.setTag(imageView);
- /* callView.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getTag() != null) {
- View imageView = (View) v.getTag();
- if (imageView.getVisibility() == View.VISIBLE)
- imageView.setVisibility(View.GONE);
- else
- imageView.setVisibility(View.VISIBLE);
- callsList.invalidate();
- }
+ if(call == null) {
+ if(isConferenceRunning){
+ Log.w("conf running");
}
- });*/
+ contactName.setText(resources.getString(R.string.conference));
+ contactImage.setImageResource(R.drawable.conference_start);
+ } else {
+ setContactInformation(contactName, contactImage, lAddress);
+ displayCallStatusIconAndReturnCallPaused(callView, call);
+ registerCallDurationTimer(callView, call);
+ callsList.addView(callView);
+ }
}
- private void setContactName(LinearLayout callView, LinphoneAddress lAddress, String sipUri, Resources resources) {
- TextView contact = (TextView) callView.findViewById(R.id.contactNameOrNumber);
-
- Contact lContact = ContactsManager.getInstance().findContactWithAddress(callView.getContext().getContentResolver(), lAddress);
+ private void setContactInformation(TextView contactName, ImageView contactPicture, LinphoneAddress lAddress) {
+ Contact lContact = ContactsManager.getInstance().findContactWithAddress(contactName.getContext().getContentResolver(), lAddress);
if (lContact == null) {
- contact.setText(lAddress.getUserName());
+ contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
+ contactPicture.setImageResource(R.drawable.avatar);
} else {
- contact.setText(lContact.getName());
+ contactName.setText(lContact.getName());
+ LinphoneUtils.setImagePictureFromUri(contactPicture.getContext(), contactPicture, lContact.getPhotoUri(), lContact.getThumbnailUri());
}
}
@@ -1598,7 +1541,13 @@ public class CallActivity extends Activity implements OnClickListener {
return;
}
- Chronometer timer = (Chronometer) v.findViewById(R.id.call_timer);
+ Chronometer timer;
+ if(v == null){
+ timer = (Chronometer) findViewById(R.id.call_timer);
+ } else {
+ timer = (Chronometer) v.findViewById(R.id.call_timer);
+ }
+
if (timer == null) {
throw new IllegalArgumentException("no callee_duration view found");
}
@@ -1630,10 +1579,10 @@ public class CallActivity extends Activity implements OnClickListener {
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) {
if(call.isInConference()) break;
if (call != LinphoneManager.getLc().getCurrentCall()) {
- displayOtherCalls(resources, call, index);
+ displayPausedCalls(resources, call, index);
index++;
} else {
- displayActiveCall(call);
+ displayCurrentCall(call);
}
}
diff --git a/src/org/linphone/CallIncomingActivity.java b/src/org/linphone/CallIncomingActivity.java
index 4637526bb..4826fd9ca 100644
--- a/src/org/linphone/CallIncomingActivity.java
+++ b/src/org/linphone/CallIncomingActivity.java
@@ -27,20 +27,13 @@ import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.mediastream.Log;
-import org.linphone.ui.LinphoneSliders;
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
import android.app.Activity;
-import android.content.ClipData;
-import android.content.ClipDescription;
import android.content.Context;
-import android.content.Intent;
-import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
-import android.view.DragEvent;
-import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -278,7 +271,7 @@ public class CallIncomingActivity extends Activity implements LinphoneSliderTrig
}
private void answer() {
- LinphoneCallParams params = LinphoneManager.getLc().createDefaultCallParameters();
+ LinphoneCallParams params = LinphoneManager.getLc().createCallParams(mCall);
if (!LinphoneManager.getInstance().acceptCallWithParams(mCall, params)) {
// the above method takes care of Samsung Galaxy S
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index cfda7c550..84c1a869d 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -225,21 +225,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
routeAudioToSpeakerHelper(false);
}
- public synchronized final void destroyLinphoneCore(Context c) {
- BluetoothManager.getInstance().destroy();
- try {
- mTimer.cancel();
- mLc.destroy();
- }
- catch (RuntimeException e) {
- e.printStackTrace();
- }
- finally {
- mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
- mLc = null;
- }
- }
-
public synchronized static final LinphoneManager createAndStart(Context c) {
if (instance != null)
throw new RuntimeException("Linphone Manager is already initialized");
diff --git a/src/org/linphone/StatusFragment.java b/src/org/linphone/StatusFragment.java
index 16f1c3695..63ebd4ce6 100644
--- a/src/org/linphone/StatusFragment.java
+++ b/src/org/linphone/StatusFragment.java
@@ -67,6 +67,7 @@ public class StatusFragment extends Fragment {
private Timer mTimer;
private TimerTask mTask;
private LinphoneCoreListenerBase mListener;
+ private Dialog ZRTPdialog = null;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -384,46 +385,48 @@ public class StatusFragment extends Fragment {
return;
}
- final Dialog dialog = new Dialog(getActivity());
- dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
- Drawable d = new ColorDrawable(getResources().getColor(R.color.colorC));
- d.setAlpha(200);
- dialog.setContentView(R.layout.dialog);
- dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
- dialog.getWindow().setBackgroundDrawable(d);
+ if(ZRTPdialog == null || !ZRTPdialog.isShowing()) {
+ ZRTPdialog = new Dialog(getActivity());
+ ZRTPdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
+ Drawable d = new ColorDrawable(getResources().getColor(R.color.colorC));
+ d.setAlpha(200);
+ ZRTPdialog.setContentView(R.layout.dialog);
+ ZRTPdialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
+ ZRTPdialog.getWindow().setBackgroundDrawable(d);
- TextView customText = (TextView) dialog.findViewById(R.id.customText);
- String newText = getString(R.string.zrtp_dialog).replace("%s",call.getAuthenticationToken());
- customText.setText(newText);
- Button delete = (Button) dialog.findViewById(R.id.delete);
- delete.setText(R.string.accept);
- Button cancel = (Button) dialog.findViewById(R.id.cancel);
- cancel.setText(R.string.deny);
+ TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText);
+ String newText = getString(R.string.zrtp_dialog).replace("%s", call.getAuthenticationToken());
+ customText.setText(newText);
+ Button delete = (Button) ZRTPdialog.findViewById(R.id.delete);
+ delete.setText(R.string.accept);
+ Button cancel = (Button) ZRTPdialog.findViewById(R.id.cancel);
+ cancel.setText(R.string.deny);
- delete.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- call.setAuthenticationTokenVerified(true);
- if (encryption != null) {
- encryption.setImageResource(R.drawable.security_ok);
- }
- dialog.dismiss();
- }
- });
-
- cancel.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- if (call != null) {
- call.setAuthenticationTokenVerified(false);
+ delete.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ call.setAuthenticationTokenVerified(true);
if (encryption != null) {
- encryption.setImageResource(R.drawable.security_pending);
+ encryption.setImageResource(R.drawable.security_ok);
}
+ ZRTPdialog.dismiss();
}
- dialog.dismiss();
- }
- });
- dialog.show();
+ });
+
+ cancel.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (call != null) {
+ call.setAuthenticationTokenVerified(false);
+ if (encryption != null) {
+ encryption.setImageResource(R.drawable.security_ko);
+ }
+ }
+ ZRTPdialog.dismiss();
+ }
+ });
+ ZRTPdialog.show();
+ }
}
public void initCallStatsRefresher(final LinphoneCall call, final View view) {