diff --git a/Makefile b/Makefile index 0b9db5d9d..fc02fab7a 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ BUILD_REMOTE_PROVISIONING=1 BUILD_X264=0 BUILD_AMRNB=full # 0, light or full BUILD_AMRWB=0 -BUILD_GPLV3_ZRTP=0 +BUILD_GPLV3_ZRTP=1 BUILD_SILK=1 BUILD_G729=0 BUILD_TUNNEL=0 diff --git a/res/layout/status.xml b/res/layout/status.xml index 4e2a64f3a..33b234e11 100644 --- a/res/layout/status.xml +++ b/res/layout/status.xml @@ -40,7 +40,7 @@ android:id="@+id/call_stats_title" android:textStyle="bold" android:textColor="@color/text_default" - android:textSize="18dp"/> + android:textSize="18sp"/> @@ -55,7 +55,7 @@ android:text="@string/call_stats_codec" android:textStyle="bold" android:textColor="@android:color/white" - android:textSize="12dp"/> + android:textSize="12sp"/> + android:textSize="12sp"/> @@ -79,7 +79,7 @@ android:text="@string/call_stats_upload" android:textStyle="bold" android:textColor="@android:color/white" - android:textSize="12dp"/> + android:textSize="12sp"/> + android:textSize="12sp"/> @@ -103,7 +103,7 @@ android:text="@string/call_stats_download" android:textColor="@android:color/white" android:textStyle="bold" - android:textSize="12dp"/> + android:textSize="12sp"/> + android:textSize="12sp"/> @@ -127,7 +127,7 @@ android:text="@string/call_stats_ice" android:textStyle="bold" android:textColor="@android:color/white" - android:textSize="12dp"/> + android:textSize="12sp"/> + android:textSize="12sp"/> @@ -179,7 +179,7 @@ android:id="@+id/statusText" android:text="@string/status_not_connected" android:textColor="@android:color/white" - android:textSize="18dp" + android:textSize="18sp" android:paddingLeft="5dp" android:layout_centerVertical="true" android:layout_width="wrap_content" @@ -205,18 +205,6 @@ android:layout_centerHorizontal="true" android:visibility="gone" /> - - + android:textSize="18sp" /> + + \ No newline at end of file diff --git a/res/values-FR/strings.xml b/res/values-FR/strings.xml index 905f4678e..4089d281b 100644 --- a/res/values-FR/strings.xml +++ b/res/values-FR/strings.xml @@ -379,4 +379,8 @@ Merci de patienter... Mise à jour de la base des messages + + Accepter + Refuser + Vous ne devriez accepter que si vous avez le même code (ci-dessus) que votre contact diff --git a/res/values/strings.xml b/res/values/strings.xml index ccae74cb9..9cb1f40b0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -433,4 +433,8 @@ Please wait... Updating messages database + + Accept + Deny + You should only accept if you have the same code (see above) as your correspondent diff --git a/src/org/linphone/StatusFragment.java b/src/org/linphone/StatusFragment.java index fdada2bbb..e06c7abef 100644 --- a/src/org/linphone/StatusFragment.java +++ b/src/org/linphone/StatusFragment.java @@ -30,18 +30,19 @@ import org.linphone.core.LinphoneCore.MediaEncryption; import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.PayloadType; +import org.linphone.mediastream.Log; import org.linphone.ui.SlidingDrawer; import org.linphone.ui.SlidingDrawer.OnDrawerOpenListener; import android.app.Activity; +import android.app.AlertDialog; import android.content.Context; +import android.content.DialogInterface; import android.content.SharedPreferences; import android.os.Bundle; -import android.os.CountDownTimer; import android.os.Handler; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -53,7 +54,6 @@ import android.widget.ImageView; import android.widget.ListView; import android.widget.TableLayout; import android.widget.TextView; -import android.widget.Toast; /** * @author Sylvain Berfini @@ -69,10 +69,6 @@ public class StatusFragment extends Fragment { // private LinearLayout allAccountsLed; private Runnable mCallQualityUpdater; private boolean isInCall, isAttached = false; - - private Toast zrtpToast; - private CountDownTimer zrtpHack; - private boolean hideZrtpToast = false; private Timer mTimer; private TimerTask mTask; @@ -358,10 +354,6 @@ public class StatusFragment extends Fragment { public void onPause() { super.onPause(); - if (zrtpToast != null) { - hideZRTPDialog(); - } - if (mCallQualityUpdater != null) { refreshHandler.removeCallbacks(mCallQualityUpdater); mCallQualityUpdater = null; @@ -399,80 +391,33 @@ public class StatusFragment extends Fragment { } } - private void hideZRTPDialog() { - hideZrtpToast = true; - - if (zrtpToast != null) { - zrtpToast.cancel(); - } - if (zrtpHack != null) { - zrtpHack.cancel(); - } - } - private void showZRTPDialog(final LinphoneCall call) { - boolean authVerified = call.isAuthenticationTokenVerified(); - String format = getString(authVerified ? R.string.reset_sas_fmt : R.string.verify_sas_fmt); - - LayoutInflater inflater = LayoutInflater.from(getActivity()); - View layout = inflater.inflate(R.layout.zrtp_dialog, (ViewGroup) getActivity().findViewById(R.id.toastRoot)); - - TextView toastText = (TextView) layout.findViewById(R.id.toastMessage); - toastText.setText(String.format(format, call.getAuthenticationToken())); - - zrtpToast = new Toast(getActivity()); - zrtpToast.setGravity(Gravity.TOP | Gravity.RIGHT, 0, LinphoneUtils.pixelsToDpi(getResources(), 40)); - zrtpToast.setDuration(Toast.LENGTH_LONG); - - ImageView ok = (ImageView) layout.findViewById(R.id.toastOK); - ok.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - if (call != null) { - call.setAuthenticationTokenVerified(true); - } - if (encryption != null) { - encryption.setImageResource(R.drawable.security_ok); - } - hideZRTPDialog(); - } - }); - - ImageView notOk = (ImageView) layout.findViewById(R.id.toastNotOK); - notOk.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - if (call != null) { - call.setAuthenticationTokenVerified(false); - } - if (encryption != null) { - encryption.setImageResource(R.drawable.security_pending); - } - hideZRTPDialog(); - } - }); - - zrtpHack = new CountDownTimer(3000, 1000) - { - public void onTick(long millisUntilFinished) - { - if (!hideZrtpToast) { - zrtpToast.show(); - } - } - public void onFinish() { - if (!hideZrtpToast) { - zrtpToast.show(); - zrtpHack.start(); - } - } - - }; - - zrtpToast.setView(layout); - hideZrtpToast = false; - zrtpToast.show(); - zrtpHack.start(); + if (getActivity() == null) { + Log.w("Can't display ZRTP popup, no Activity"); + return; + } + new AlertDialog.Builder(getActivity()) + .setTitle(call.getAuthenticationToken()) + .setMessage(getString(R.string.zrtp_help)) + .setPositiveButton(R.string.zrtp_accept, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + call.setAuthenticationTokenVerified(true); + if (encryption != null) { + encryption.setImageResource(R.drawable.security_ok); + } + } + }) + .setNegativeButton(R.string.zrtp_deny, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + if (call != null) { + call.setAuthenticationTokenVerified(false); + if (encryption != null) { + encryption.setImageResource(R.drawable.security_pending); + } + } + } + }) + .show(); } private void initCallStatsRefresher(final LinphoneCall call, final View view) {