diff --git a/res/drawable/call.xml b/res/drawable/call.xml index 9e30778e1..8d2b8d546 100644 --- a/res/drawable/call.xml +++ b/res/drawable/call.xml @@ -1,10 +1,10 @@ - - + + + android:drawable="@color/colorN"/> diff --git a/res/drawable/hangup.xml b/res/drawable/hangup.xml index 3a15ca838..57458d0d0 100644 --- a/res/drawable/hangup.xml +++ b/res/drawable/hangup.xml @@ -1,10 +1,10 @@ - - + + + android:drawable="@color/colorB"/> diff --git a/res/layout/call.xml b/res/layout/call.xml index f5d22e687..45924e332 100644 --- a/res/layout/call.xml +++ b/res/layout/call.xml @@ -24,15 +24,15 @@ + android:layout_above="@+id/menu" + android:layout_marginTop="30dp"> @@ -43,34 +43,48 @@ android:layout_height="wrap_content" android:visibility="visible"> - + android:layout_marginTop="10dp"> - + + + + + + + android:gravity="center_horizontal" + android:paddingTop="10dp"> + android:layout_width="115dp" + android:layout_height="115dp" + android:layout_gravity="center" + android:src="@drawable/waiting_time"/> + android:layout_gravity="center" + android:text="@string/call_paused_by_remote"/> + android:background="@color/colorH" + android:orientation="vertical" + > + android:background="@color/colorH" + android:paddingTop="5dp"/> @@ -146,36 +161,36 @@ + android:layout_width="115dp" + android:layout_height="115dp" + android:layout_gravity="center" + android:src="@drawable/waiting_time"/> + android:layout_gravity="center" + android:text="@string/no_current_call"/> @@ -189,7 +204,7 @@ @@ -201,9 +216,9 @@ + android:padding="10dp" + android:src="@drawable/speaker_default" + /> @@ -316,128 +331,128 @@ + android:orientation="horizontal"> + android:layout_weight="0.5" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:background="#aeaeae" + android:contentDescription="@string/content_description_bluetooth" + android:padding="15dp" + android:src="@drawable/route_bluetooth" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:background="#aeaeae" + android:contentDescription="@string/content_description_add_call" + android:padding="15dp" + android:src="@drawable/options_add_call_button" + android:visibility="invisible"/> + android:orientation="horizontal"> + android:layout_weight="0.5" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:background="#aeaeae" + android:contentDescription="@string/content_description_earpiece" + android:padding="15dp" + android:src="@drawable/route_earpiece" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:background="#aeaeae" + android:contentDescription="@string/content_description_transfer" + android:padding="15dp" + android:src="@drawable/options_transfer_call_button" + android:visibility="invisible"/> + android:layout_height="50dp" + android:layout_above="@id/menu_middle" + android:orientation="horizontal"> + android:layout_weight="0.5" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:background="#aeaeae" + android:contentDescription="@string/content_description_toggle_speaker" + android:padding="15dp" + android:src="@drawable/route_speaker" + android:visibility="invisible"/> + android:layout_weight="0.5" + android:background="#aeaeae" + android:contentDescription="@string/content_description_conference" + android:padding="10dp" + android:src="@drawable/options_start_conference_button" + android:visibility="invisible"/> diff --git a/res/layout/call_incoming.xml b/res/layout/call_incoming.xml index 7544cd73b..00e5cc6a4 100644 --- a/res/layout/call_incoming.xml +++ b/res/layout/call_incoming.xml @@ -1,6 +1,7 @@ + android:layout_below="@id/status" + android:layout_gravity="center" + android:background="@color/colorH" + android:gravity="center"> + + + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_toEndOf="@+id/imageView2" + android:gravity="center" + android:text="@string/incoming_call"/> @@ -42,7 +56,7 @@ style="@style/font5" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentTop="true" + android:layout_below="@+id/avatar_layout" android:layout_centerHorizontal="true" android:gravity="center_vertical|center_horizontal" android:paddingTop="5dp"/> @@ -61,24 +75,26 @@ android:id="@+id/avatar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@id/contact_number" + android:layout_alignParentTop="true" android:layout_margin="5dp" - android:gravity="center"> + android:gravity="center" + android:paddingTop="10dp"> - - + android:contentDescription="@string/content_description_contact_picture" + android:src="@drawable/avatar_big_secure1"/> + + @@ -98,7 +114,6 @@ android:layout_weight="1" android:background="@drawable/hangup" android:contentDescription="@string/content_description_decline" - android:padding="12dp" android:src="@drawable/call_hangup"/> + android:layout_below="@id/status" + android:layout_gravity="center" + android:background="@color/colorH" + android:gravity="center"> + + - + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_toEndOf="@+id/imageView2" + android:gravity="center" + android:text="@string/outgoing_call"/> @@ -62,24 +73,25 @@ android:id="@+id/avatar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@id/contact_number" + android:layout_alignParentTop="true" android:layout_margin="5dp" android:gravity="center"> - - + android:contentDescription="@string/content_description_contact_picture" + android:src="@drawable/avatar_big_secure1"/> + + @@ -105,7 +117,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:background="@drawable/button_background" + android:background=" #595959 " android:contentDescription="@string/content_description_toggle_micro" android:padding="10dp" android:src="@drawable/micro_default"/> @@ -115,9 +127,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:background="@drawable/button_background" + android:background=" #595959 " android:contentDescription="@string/content_description_toggle_speaker" - android:padding="15dp" + android:padding="10dp" android:src="@drawable/speaker_default"/> diff --git a/res/layout/chat_create.xml b/res/layout/chat_create.xml index 865ae2812..7d398794b 100644 --- a/res/layout/chat_create.xml +++ b/res/layout/chat_create.xml @@ -7,14 +7,14 @@ + android:layout_weight="0.2" + android:visibility="invisible"> + android:layout_weight="0.2" + android:visibility="invisible"> @@ -96,32 +96,30 @@ + android:background="#f5f5f5"> + android:src="@drawable/clean_field_default"/> @@ -130,7 +128,7 @@ android:layout_width="match_parent" android:layout_height="50dp" android:layout_marginTop="5dp" - android:background="@drawable/resizable_textfield" + android:background="@color/colorG" android:fadeScrollbars="false" android:lines="1"> @@ -155,7 +153,7 @@ android:id="@+id/contactsList" android:layout_width="match_parent" android:layout_height="match_parent" - android:divider="@color/colorE" + android:divider="@color/colorM" android:dividerHeight="1dp" android:fastScrollAlwaysVisible="true" android:fastScrollEnabled="true"/> diff --git a/res/layout/chat_imdn.xml b/res/layout/chat_imdn.xml index 21c5f59ae..5d32bf5d7 100644 --- a/res/layout/chat_imdn.xml +++ b/res/layout/chat_imdn.xml @@ -11,39 +11,46 @@ + android:layout_height="60dp" + android:background="@color/colorH" + android:orientation="horizontal"> + android:background="@drawable/toolbar_button" + android:contentDescription="@string/content_description_back" + android:src="@drawable/back" + /> + android:gravity="center" + android:padding="15dp" + android:text="@string/imdn_info"/> + android:padding="15dp" + android:visibility="invisible"/> + + + android:orientation="horizontal"> + android:orientation="horizontal"> + android:orientation="horizontal"> + android:src="@drawable/message_delivered" + android:visibility="invisible"/> @@ -158,14 +165,14 @@ android:id="@+id/undelivered_layout_header" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal" + android:background="@color/colorH" android:gravity="center" - android:background="@color/colorG"> + android:orientation="horizontal"> diff --git a/res/layout/search_contact_cell.xml b/res/layout/search_contact_cell.xml index 76edc61d7..4e6ae427b 100644 --- a/res/layout/search_contact_cell.xml +++ b/res/layout/search_contact_cell.xml @@ -15,22 +15,23 @@ + android:layout_marginLeft="5dp" + android:adjustViewBounds="true" + android:contentDescription="@string/content_description_contact_picture" + android:src="@drawable/avatar_big_secure1"/> + android:layout_marginLeft="5dp" + android:adjustViewBounds="true" + android:src="@drawable/avatar_mask" + android:visibility="gone"/> @@ -53,6 +54,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" + android:layout_marginLeft="15dp" android:gravity="top|left" android:lines="1"/> @@ -64,7 +66,8 @@ android:layout_centerVertical="true" android:ellipsize="end" android:gravity="bottom|left" - android:lines="1"/> + android:lines="1" + android:visibility="gone"/> @@ -72,12 +75,13 @@ android:id="@id/contact_linphone" android:layout_width="30dp" android:layout_height="30dp" + android:layout_centerVertical="true" android:layout_gravity="right" + android:layout_toLeftOf="@+id/contact_is_select" + android:layout_toStartOf="@+id/contact_is_select" android:paddingRight="10dp" android:src="@drawable/linphone_user" - android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/contact_is_select" - android:layout_toStartOf="@+id/contact_is_select"/> + android:visibility="gone"/> @@ -57,12 +56,13 @@ - - \ No newline at end of file diff --git a/src/android/org/linphone/LinphoneService.java b/src/android/org/linphone/LinphoneService.java index 3f0a4bdaa..39d849a0c 100644 --- a/src/android/org/linphone/LinphoneService.java +++ b/src/android/org/linphone/LinphoneService.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Map; import org.linphone.activities.LinphoneActivity; +import org.linphone.call.CallActivity; import org.linphone.compatibility.Compatibility; import org.linphone.contacts.ContactsManager; import org.linphone.contacts.LinphoneContact; @@ -353,7 +354,8 @@ public final class LinphoneService extends Service { } mNotif = Compatibility.createNotification(this, mNotificationTitle, "", R.drawable.linphone_notification_icon, R.mipmap.ic_launcher, bm, mNotifContentIntent, true,notifcationsPriority); - LinphoneManager.createAndStart(LinphoneService.this); + if (!LinphoneManager.isInstanciated()) + LinphoneManager.createAndStart(LinphoneService.this); instance = this; // instance is ready once linphone manager has been created incomingReceivedActivityName = LinphonePreferences.instance().getActivityToLaunchOnIncomingReceived(); @@ -378,9 +380,9 @@ public final class LinphoneService extends Service { if (state == State.End || state == State.Released || state == State.Error) { if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() == 0) { - if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getStatusFragment() != null) { + if (CallActivity.isInstanciated()) { removeSasNotification(); - LinphoneActivity.instance().getStatusFragment().setisZrtpAsk(false); + CallActivity.instance().setisZrtpAsk(false); } } destroyOverlay(); diff --git a/src/android/org/linphone/call/CallActivity.java b/src/android/org/linphone/call/CallActivity.java index 2fe3a2db2..921e69f71 100644 --- a/src/android/org/linphone/call/CallActivity.java +++ b/src/android/org/linphone/call/CallActivity.java @@ -24,6 +24,7 @@ import android.app.Activity; import android.app.Dialog; import android.app.Fragment; import android.app.FragmentTransaction; +import android.app.KeyguardManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -111,13 +112,13 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private TextView missedChats; private RelativeLayout mActiveCallHeader, sideMenuContent, avatar_layout; private ImageView pause, hangUp, dialer, video, micro, speaker, options, addCall, transfer, conference, conferenceStatus, contactPicture; - private ImageView audioRoute, routeSpeaker, routeEarpiece, routeBluetooth, menu, chat; + private ImageView audioRoute, routeSpeaker, routeEarpiece, routeBluetooth, menu, chat, encryption; private LinearLayout mNoCurrentCall, callInfo, mCallPaused; private ProgressBar videoProgress; private StatusFragment status; private CallAudioFragment audioCallFragment; private CallVideoFragment videoCallFragment; - private boolean isSpeakerEnabled = false, isMicMuted = false, isTransferAllowed, isVideoAsk; + private boolean isSpeakerEnabled = false, isMicMuted = false, isTransferAllowed, isVideoAsk, isZrtpAsk; private LinearLayout mControlsLayout; private Numpad numpad; private int cameraNumber; @@ -126,6 +127,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private Dialog dialog = null; private static long TimeRemind = 0; private HeadsetReceiver headsetReceiver; + private Dialog ZRTPdialog = null; private LinearLayout callsList, conferenceList; private LayoutInflater inflater; @@ -185,10 +187,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList @Override public void onCallStateChanged(Core lc, final Call call, Call.State state, String message) { if (LinphoneManager.getLc().getCallsNb() == 0) { - if (status != null) { - LinphoneService.instance().removeSasNotification(); - status.setisZrtpAsk(false); - } + LinphoneService.instance().removeSasNotification(); + setisZrtpAsk(false); finish(); return; } @@ -205,7 +205,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } } else if (state == State.Resuming) { if(LinphonePreferences.instance().isVideoEnabled()){ - status.refreshStatusItems(call, isVideoEnabled(call)); + refreshStatusItems(call, isVideoEnabled(call)); if(call.getCurrentParams().videoEnabled()){ showVideoView(); } @@ -217,10 +217,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList switchVideo(isVideoEnabled(call)); enableAndRefreshInCallActions(); - if (status != null) { - videoProgress.setVisibility(View.GONE); - status.refreshStatusItems(call, isVideoEnabled(call)); - } + videoProgress.setVisibility(View.GONE); + refreshStatusItems(call, isVideoEnabled(call)); } else if (state == State.UpdatedByRemote) { // If the correspondent proposes video while audio call boolean videoEnabled = LinphonePreferences.instance().isVideoEnabled(); @@ -251,12 +249,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList @Override public void onCallEncryptionChanged(Core lc, final Call call, boolean encrypted, String authenticationToken) { - if (status != null) { - if(call.getCurrentParams().getMediaEncryption().equals(MediaEncryption.ZRTP) && !call.getAuthenticationTokenVerified()){ - status.showZRTPDialog(call); + if(call.getCurrentParams().getMediaEncryption().equals(MediaEncryption.ZRTP) && !call.getAuthenticationTokenVerified()){ + showZRTPDialog(call); } - status.refreshStatusItems(call, call.getCurrentParams().videoEnabled()); - } + refreshStatusItems(call, call.getCurrentParams().videoEnabled()); } }; @@ -281,8 +277,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList TimeRemind = savedInstanceState.getLong("TimeRemind"); createTimerForDialog(TimeRemind); } - if (status != null && savedInstanceState.getBoolean("AskingZrtp")) { - status.setisZrtpAsk(savedInstanceState.getBoolean("AskingZrtp")); + if (savedInstanceState.getBoolean("AskingZrtp")) { + setisZrtpAsk(savedInstanceState.getBoolean("AskingZrtp")); } refreshInCallActions(); return; @@ -341,7 +337,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList outState.putBoolean("VideoCallPaused", isVideoCallPaused); outState.putBoolean("AskingVideo", isVideoAsk); outState.putLong("TimeRemind", TimeRemind); - if (status != null) outState.putBoolean("AskingZrtp", status.getisZrtpAsk()); + if (status != null) outState.putBoolean("AskingZrtp", getisZrtpAsk()); if (dialog != null) dialog.dismiss(); super.onSaveInstanceState(outState); } @@ -435,6 +431,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList mControlsLayout = (LinearLayout) findViewById(R.id.menu); + encryption = (ImageView) findViewById(R.id.encryption); + encryption.setVisibility(View.VISIBLE); + if (!isTransferAllowed) { addCall.setBackgroundResource(R.drawable.options_add_call); } @@ -540,10 +539,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } else { if(video.isEnabled()) { if (isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) { - video.setImageResource(R.drawable.camera_selected); + video.setImageResource(R.drawable.camera_default); videoProgress.setVisibility(View.INVISIBLE); } else { - video.setImageResource(R.drawable.camera_button); + video.setImageResource(R.drawable.camera_disabled); } } else { video.setImageResource(R.drawable.camera_button); @@ -554,7 +553,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } if (isSpeakerEnabled) { - speaker.setImageResource(R.drawable.speaker_selected); + speaker.setImageResource(R.drawable.route_speaker_default); } else { speaker.setImageResource(R.drawable.speaker_default); } @@ -569,21 +568,28 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } try { - routeSpeaker.setImageResource(R.drawable.route_speaker); + routeSpeaker.setImageResource(R.drawable.speaker_default); if (BluetoothManager.getInstance().isUsingBluetoothAudioRoute()) { isSpeakerEnabled = false; // We need this if isSpeakerEnabled wasn't set correctly - routeEarpiece.setImageResource(R.drawable.route_earpiece); - routeBluetooth.setImageResource(R.drawable.route_bluetooth_selected); + //routeEarpiece.setImageResource(R.drawable.route_earpiece); + //routeBluetooth.setImageResource(R.drawable.route_bluetooth_selected); + routeEarpiece.setAlpha(0.5f); + routeBluetooth.setAlpha(1f); return; } else { - routeEarpiece.setImageResource(R.drawable.route_earpiece_selected); - routeBluetooth.setImageResource(R.drawable.route_bluetooth); + //routeEarpiece.setImageResource(R.drawable.route_earpiece_selected); + //routeBluetooth.setImageResource(R.drawable.route_bluetooth); + routeEarpiece.setAlpha(1f); + routeBluetooth.setAlpha(0.5f); } if (isSpeakerEnabled) { - routeSpeaker.setImageResource(R.drawable.route_speaker_selected); - routeEarpiece.setImageResource(R.drawable.route_earpiece); - routeBluetooth.setImageResource(R.drawable.route_bluetooth); + routeSpeaker.setImageResource(R.drawable.route_speaker); + //routeSpeaker.setImageResource(R.drawable.route_speaker_selected); + //routeEarpiece.setImageResource(R.drawable.route_earpiece); + //routeBluetooth.setImageResource(R.drawable.route_bluetooth); + routeEarpiece.setAlpha(0.5f); + routeBluetooth.setAlpha(0.5f); } } catch (NullPointerException npe) { Log.e("Bluetooth: Audio routes menu disabled on tablets for now (4)"); @@ -702,26 +708,35 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList else if (id == R.id.route_bluetooth) { if (BluetoothManager.getInstance().routeAudioToBluetooth()) { isSpeakerEnabled = false; - routeBluetooth.setImageResource(R.drawable.route_bluetooth_selected); + /*routeBluetooth.setImageResource(R.drawable.route_bluetooth_selected); routeSpeaker.setImageResource(R.drawable.route_speaker); - routeEarpiece.setImageResource(R.drawable.route_earpiece); + routeEarpiece.setImageResource(R.drawable.route_earpiece);*/ + routeEarpiece.setAlpha(0.5f); + routeBluetooth.setAlpha(1f); + routeSpeaker.setImageResource(R.drawable.speaker_default); } hideOrDisplayAudioRoutes(); } else if (id == R.id.route_earpiece) { LinphoneManager.getInstance().routeAudioToReceiver(); isSpeakerEnabled = false; - routeBluetooth.setImageResource(R.drawable.route_bluetooth); + /*routeBluetooth.setImageResource(R.drawable.route_bluetooth); routeSpeaker.setImageResource(R.drawable.route_speaker); - routeEarpiece.setImageResource(R.drawable.route_earpiece_selected); + routeEarpiece.setImageResource(R.drawable.route_earpiece_selected);*/ + routeEarpiece.setAlpha(1f); + routeBluetooth.setAlpha(0.5f); + routeSpeaker.setImageResource(R.drawable.speaker_default); hideOrDisplayAudioRoutes(); } else if (id == R.id.route_speaker) { LinphoneManager.getInstance().routeAudioToSpeaker(); isSpeakerEnabled = true; - routeBluetooth.setImageResource(R.drawable.route_bluetooth); + /*routeBluetooth.setImageResource(R.drawable.route_bluetooth); routeSpeaker.setImageResource(R.drawable.route_speaker_selected); - routeEarpiece.setImageResource(R.drawable.route_earpiece); + routeEarpiece.setImageResource(R.drawable.route_earpiece);*/ + routeEarpiece.setAlpha(0.5f); + routeBluetooth.setAlpha(0.5f); + routeSpeaker.setImageResource(R.drawable.route_speaker_default); hideOrDisplayAudioRoutes(); } @@ -919,7 +934,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } if (isSpeakerEnabled) { LinphoneManager.getInstance().routeAudioToSpeaker(); - speaker.setImageResource(R.drawable.speaker_selected); + speaker.setImageResource(R.drawable.route_speaker_default); LinphoneManager.getInstance().enableSpeaker(isSpeakerEnabled); } else { Log.d("Toggle speaker off, routing back to earpiece"); @@ -1006,7 +1021,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList conference.setVisibility(View.INVISIBLE); displayVideoCall(false); numpad.setVisibility(View.GONE); - options.setImageResource(R.drawable.options_default); + //options.setImageResource(R.drawable.options_default); + options.setImageAlpha(125); } }, SECONDS_BEFORE_HIDING_CONTROLS); } @@ -1056,7 +1072,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList private void hideOrDisplayCallOptions() { //Hide options if (addCall.getVisibility() == View.VISIBLE) { - options.setImageResource(R.drawable.options_default); + //options.setImageResource(R.drawable.options_disabled); + options.setImageAlpha(125); if (isTransferAllowed) { transfer.setVisibility(View.INVISIBLE); } @@ -1068,7 +1085,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } addCall.setVisibility(View.VISIBLE); conference.setVisibility(View.VISIBLE); - options.setImageResource(R.drawable.options_selected); + //options.setImageResource(R.drawable.options_default); + options.setImageAlpha(255); transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null); } } @@ -1208,8 +1226,12 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList refreshIncallUi(); handleViewIntent(); - if (status != null && status.getisZrtpAsk() && lc != null) { - status.showZRTPDialog(lc.getCurrentCall()); + if (lc != null) { + refreshStatusItems(lc.getCurrentCall(), lc.getCurrentCall().getCurrentParams().videoEnabled()); + } + + if (lc != null) { + showZRTPDialog(lc.getCurrentCall()); } if (!isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) { @@ -1220,6 +1242,125 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList } } + public void showZRTPDialog(final Call call) { + if(ZRTPdialog == null || !ZRTPdialog.isShowing()) { + String token = call.getAuthenticationToken(); + + if (token == null){ + Log.w("Can't display ZRTP popup, no token !"); + return; + } + if (token.length()<4){ + Log.w("Can't display ZRTP popup, token is invalid ("+token+")"); + return; + } + + ZRTPdialog = new Dialog(this); + ZRTPdialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); + ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + Drawable d = new ColorDrawable(ContextCompat.getColor(this, 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); + String zrtpToRead, zrtpToListen; + isZrtpAsk = true; + + if (call.getDir().equals(Call.Dir.Incoming)) { + zrtpToRead = token.substring(0,2); + zrtpToListen = token.substring(2); + } else { + zrtpToListen = token.substring(0,2); + zrtpToRead = token.substring(2); + } + + // Obiane specific dev : display sas notif only if screen locked + KeyguardManager myKM = (KeyguardManager) this.getSystemService(Context.KEYGUARD_SERVICE); + if( myKM.inKeyguardRestrictedInputMode()) { + //Screen is locked + LinphoneService.instance().displaySasNotification(call.getAuthenticationToken()); + } + TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText); + String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead) + + getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen); + customText.setText(newText); + Button delete = (Button) ZRTPdialog.findViewById(R.id.delete_button); + 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_button_default); + } + isZrtpAsk = false; + ZRTPdialog.dismiss(); + LinphoneService.instance().removeSasNotification(); + } + }); + + cancel.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + if (call != null) { + call.setAuthenticationTokenVerified(false); + if (encryption != null) { + encryption.setImageResource(R.drawable.security_button1_over); + } + } + isZrtpAsk = false; + ZRTPdialog.dismiss(); + LinphoneService.instance().removeSasNotification(); + } + }); + ZRTPdialog.show(); + } + } + + public boolean getisZrtpAsk() { + return isZrtpAsk; + } + + public void setisZrtpAsk(boolean bool) { + isZrtpAsk = bool; + } + + public void refreshStatusItems(final Call call, boolean isVideoEnabled) { + if (call != null) { + MediaEncryption mediaEncryption = call.getCurrentParams().getMediaEncryption(); + + if (isVideoEnabled) { + //background.setVisibility(View.GONE); + } else { + //background.setVisibility(View.VISIBLE); + } + + if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.getAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) { + encryption.setImageResource(R.drawable.security_button_default); + } else if (mediaEncryption == MediaEncryption.ZRTP && !call.getAuthenticationTokenVerified()) { + encryption.setImageResource(R.drawable.security_button1_default); + } else { + encryption.setImageResource(R.drawable.security_button1_over); + } + + if (mediaEncryption == MediaEncryption.ZRTP) { + encryption.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + showZRTPDialog(call); + } + }); + } else { + encryption.setOnClickListener(null); + } + } + } + private void handleViewIntent() { Intent intent = getIntent(); if(intent != null && intent.getAction() == "android.intent.action.VIEW") { diff --git a/src/android/org/linphone/chat/ChatCreationFragment.java b/src/android/org/linphone/chat/ChatCreationFragment.java index 3732a7470..57b567c8a 100644 --- a/src/android/org/linphone/chat/ChatCreationFragment.java +++ b/src/android/org/linphone/chat/ChatCreationFragment.java @@ -117,7 +117,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen mNextButton = view.findViewById(R.id.next); mNextButton.setOnClickListener(this); - mNextButton.setEnabled(false); + //mNextButton.setEnabled(false); mSearchLayout = view.findViewById(R.id.layoutSearchField); mClearSearchFieldButton = view.findViewById(R.id.clearSearchField); @@ -234,7 +234,8 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen private void displayChatCreation() { mNextButton.setVisibility(View.VISIBLE); - mNextButton.setEnabled(mContactsSelected.size() > 0); + //mNextButton.setEnabled(mContactsSelected.size() > 0); + updateListSelected(); mContactsList.setVisibility(View.VISIBLE); mSearchLayout.setVisibility(View.VISIBLE); @@ -268,9 +269,13 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen private void updateListSelected() { if (mContactsSelected.size() > 0) { mContactsSelectLayout.invalidate(); - mNextButton.setEnabled(true); + //mNextButton.setEnabled(true); + mNextButton.setImageAlpha(255); + mNextButton.setClickable(true); } else { - mNextButton.setEnabled(false); + //mNextButton.setEnabled(false); + mNextButton.setImageAlpha(100); + mNextButton.setClickable(false); } } diff --git a/src/android/org/linphone/contacts/SearchContactsListAdapter.java b/src/android/org/linphone/contacts/SearchContactsListAdapter.java index e723294e1..54f972f7f 100644 --- a/src/android/org/linphone/contacts/SearchContactsListAdapter.java +++ b/src/android/org/linphone/contacts/SearchContactsListAdapter.java @@ -251,13 +251,14 @@ public class SearchContactsListAdapter extends BaseAdapter { holder.name.setVisibility(View.GONE); } holder.address.setText(a); - if (holder.linphoneContact != null) { + // Obiane + /*if (holder.linphoneContact != null) { if (contact.isLinphoneContact() && c != null && c.isInFriendList() && address != null) { holder.linphoneContact.setVisibility(View.VISIBLE); } else { holder.linphoneContact.setVisibility(View.GONE); } - } + }*/ if (holder.isSelect != null) { if (contactIsSelected(contact)) { holder.isSelect.setVisibility(View.VISIBLE); diff --git a/src/android/org/linphone/fragments/StatusFragment.java b/src/android/org/linphone/fragments/StatusFragment.java index 64e611cf3..7f36d8afc 100644 --- a/src/android/org/linphone/fragments/StatusFragment.java +++ b/src/android/org/linphone/fragments/StatusFragment.java @@ -58,11 +58,10 @@ import static org.linphone.LinphoneUtils.getTextFromRegistrationStatement; public class StatusFragment extends Fragment { private Handler refreshHandler = new Handler(); private TextView statusText, voicemailCount; - private ImageView statusLed, callQuality, encryption, menu, voicemail; + private ImageView statusLed, callQuality, menu, voicemail; private Runnable mCallQualityUpdater; - private boolean isInCall, isAttached = false, isZrtpAsk; + private boolean isInCall, isAttached = false; private CoreListenerStub mListener; - private Dialog ZRTPdialog = null; private int mDisplayedQuality = -1; @Override @@ -73,7 +72,6 @@ public class StatusFragment extends Fragment { statusText = (TextView) view.findViewById(R.id.status_text); statusLed = (ImageView) view.findViewById(R.id.status_led); callQuality = (ImageView) view.findViewById(R.id.call_quality); - encryption = (ImageView) view.findViewById(R.id.encryption); menu = (ImageView) view.findViewById(R.id.side_menu_button); voicemail = (ImageView) view.findViewById(R.id.voicemail); voicemailCount = (TextView) view.findViewById(R.id.voicemail_count); @@ -302,10 +300,8 @@ public class StatusFragment extends Fragment { if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) { if (call != null) { startCallQuality(); - refreshStatusItems(call, call.getCurrentParams().videoEnabled()); } menu.setVisibility(View.INVISIBLE); - encryption.setVisibility(View.VISIBLE); callQuality.setVisibility(View.VISIBLE); // We are obviously connected @@ -319,7 +315,6 @@ public class StatusFragment extends Fragment { } } else { statusText.setVisibility(View.VISIBLE); - encryption.setVisibility(View.GONE); } } @@ -337,129 +332,4 @@ public class StatusFragment extends Fragment { mCallQualityUpdater = null; } } - - public void refreshStatusItems(final Call call, boolean isVideoEnabled) { - if (call != null) { - voicemailCount.setVisibility(View.GONE); - MediaEncryption mediaEncryption = call.getCurrentParams().getMediaEncryption(); - - if (isVideoEnabled) { - //background.setVisibility(View.GONE); - } else { - //background.setVisibility(View.VISIBLE); - } - - if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.getAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) { - encryption.setImageResource(R.drawable.security_ok); - } else if (mediaEncryption == MediaEncryption.ZRTP && !call.getAuthenticationTokenVerified()) { - encryption.setImageResource(R.drawable.security_pending); - } else { - encryption.setImageResource(R.drawable.security_ko); - } - - if (mediaEncryption == MediaEncryption.ZRTP) { - encryption.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - showZRTPDialog(call); - } - }); - } else { - encryption.setOnClickListener(null); - } - } - } - - public void showZRTPDialog(final Call call) { - if (getActivity() == null) { - Log.w("Can't display ZRTP popup, no Activity"); - return; - } - - if(ZRTPdialog == null || !ZRTPdialog.isShowing()) { - String token = call.getAuthenticationToken(); - - if (token == null){ - Log.w("Can't display ZRTP popup, no token !"); - return; - } - if (token.length()<4){ - Log.w("Can't display ZRTP popup, token is invalid ("+token+")"); - return; - } - - ZRTPdialog = new Dialog(getActivity()); - ZRTPdialog.requestWindowFeature(Window.FEATURE_NO_TITLE); - ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); - ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); - ZRTPdialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - Drawable d = new ColorDrawable(ContextCompat.getColor(getActivity(), 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); - String zrtpToRead, zrtpToListen; - isZrtpAsk = true; - - if (call.getDir().equals(Call.Dir.Incoming)) { - zrtpToRead = token.substring(0,2); - zrtpToListen = token.substring(2); - } else { - zrtpToListen = token.substring(0,2); - zrtpToRead = token.substring(2); - } - - // Obiane specific dev : display sas notif only if screen locked - KeyguardManager myKM = (KeyguardManager) getActivity().getSystemService(Context.KEYGUARD_SERVICE); - if( myKM.inKeyguardRestrictedInputMode()) { - //Screen is locked - LinphoneService.instance().displaySasNotification(call.getAuthenticationToken()); - } - TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText); - String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead) - + getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen); - customText.setText(newText); - Button delete = (Button) ZRTPdialog.findViewById(R.id.delete_button); - 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); - } - isZrtpAsk = false; - ZRTPdialog.dismiss(); - LinphoneService.instance().removeSasNotification(); - } - }); - - 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); - } - } - isZrtpAsk = false; - ZRTPdialog.dismiss(); - LinphoneService.instance().removeSasNotification(); - } - }); - ZRTPdialog.show(); - } - } - - public boolean getisZrtpAsk() { - return isZrtpAsk; - } - - public void setisZrtpAsk(boolean bool) { - isZrtpAsk = bool; - } }