diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 96351ca56..de8bfba99 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -62,6 +62,7 @@ @@ -72,7 +73,7 @@ + android:launchMode="singleTop"> diff --git a/src/org/linphone/InCallActivity.java b/src/org/linphone/InCallActivity.java index d1704ba0b..09b3c6021 100644 --- a/src/org/linphone/InCallActivity.java +++ b/src/org/linphone/InCallActivity.java @@ -400,43 +400,45 @@ public class InCallActivity extends FragmentActivity implements controlsHandler.removeCallbacks(mControls); } - controlsHandler.postDelayed(mControls = new Runnable() { - public void run() { - hideNumpad(); - - if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) { - transfer.setVisibility(View.GONE); - addCall.setVisibility(View.GONE); - mControlsLayout.setVisibility(View.GONE); - switchCamera.setVisibility(View.INVISIBLE); - options.setImageResource(R.drawable.options); - } else { - Animation animation = AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_top_to_bottom); - animation.setAnimationListener(new AnimationListener() { - @Override - public void onAnimationStart(Animation animation) { - video.setEnabled(false); // HACK: Used to avoid controls from being hided if video is switched while controls are hiding - } - - @Override - public void onAnimationRepeat(Animation animation) { - } - - @Override - public void onAnimationEnd(Animation animation) { - video.setEnabled(true); // HACK: Used to avoid controls from being hided if video is switched while controls are hiding - transfer.setVisibility(View.GONE); - addCall.setVisibility(View.GONE); - mControlsLayout.setVisibility(View.GONE); - switchCamera.setVisibility(View.INVISIBLE); - options.setImageResource(R.drawable.options); - } - }); - mControlsLayout.startAnimation(animation); - switchCamera.startAnimation(AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_bottom_to_top)); + if (isVideoEnabled) { + controlsHandler.postDelayed(mControls = new Runnable() { + public void run() { + hideNumpad(); + + if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) { + transfer.setVisibility(View.INVISIBLE); + addCall.setVisibility(View.INVISIBLE); + mControlsLayout.setVisibility(View.GONE); + switchCamera.setVisibility(View.INVISIBLE); + options.setImageResource(R.drawable.options); + } else { + Animation animation = AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_top_to_bottom); + animation.setAnimationListener(new AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + video.setEnabled(false); // HACK: Used to avoid controls from being hided if video is switched while controls are hiding + } + + @Override + public void onAnimationRepeat(Animation animation) { + } + + @Override + public void onAnimationEnd(Animation animation) { + video.setEnabled(true); // HACK: Used to avoid controls from being hided if video is switched while controls are hiding + transfer.setVisibility(View.INVISIBLE); + addCall.setVisibility(View.INVISIBLE); + mControlsLayout.setVisibility(View.GONE); + switchCamera.setVisibility(View.INVISIBLE); + options.setImageResource(R.drawable.options); + } + }); + mControlsLayout.startAnimation(animation); + switchCamera.startAnimation(AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_bottom_to_top)); + } } - } - }, SECONDS_BEFORE_HIDING_CONTROLS); + }, SECONDS_BEFORE_HIDING_CONTROLS); + } } public void setCallControlsVisibleAndRemoveCallbacks() { @@ -514,9 +516,9 @@ public class InCallActivity extends FragmentActivity implements options.setImageResource(R.drawable.options); if (getResources().getBoolean(R.bool.disable_animations)) { if (isTransferAllowed) { - transfer.setVisibility(View.GONE); + transfer.setVisibility(View.INVISIBLE); } - addCall.setVisibility(View.GONE); + addCall.setVisibility(View.INVISIBLE); } else { Animation anim = AnimationUtils.loadAnimation(this, R.anim.slide_out_left_to_right); anim.setAnimationListener(new AnimationListener() { @@ -533,9 +535,9 @@ public class InCallActivity extends FragmentActivity implements @Override public void onAnimationEnd(Animation animation) { if (isTransferAllowed) { - transfer.setVisibility(View.GONE); + transfer.setVisibility(View.INVISIBLE); } - addCall.setVisibility(View.GONE); + addCall.setVisibility(View.INVISIBLE); } }); if (isTransferAllowed) { diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 79066eb78..815fb1d7b 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -831,6 +831,15 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene LinphoneService.instance().removeMessageNotification(); String sipUri = extras.getString("ChatContactSipUri"); displayChat(sipUri); + } else if (extras != null && extras.getBoolean("Notification", false)) { + if (LinphoneManager.getLc().getCallsNb() > 0) { + LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; + if (call.getCurrentParamsCopy().getVideoEnabled()) { + startVideoActivity(call); + } else { + startIncallActivity(call); + } + } } } diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index 72cdb1850..658206e2f 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -157,6 +157,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis mNotif.flags |= Notification.FLAG_ONGOING_EVENT; Intent notifIntent = new Intent(this, incomingReceivedActivity); + notifIntent.putExtra("Notification", true); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT); mNotif.setLatestEventInfo(this, mNotificationTitle,"", mNotifContentIntent); diff --git a/src/org/linphone/VideoCallFragment.java b/src/org/linphone/VideoCallFragment.java index 06ebbfbdc..cbcee29df 100644 --- a/src/org/linphone/VideoCallFragment.java +++ b/src/org/linphone/VideoCallFragment.java @@ -138,9 +138,6 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On } } - private void rotatePreviewIfNeeded() { - } - @Override public void onResume() { super.onResume(); @@ -154,8 +151,6 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On } } - rotatePreviewIfNeeded(); - mWakeLock.acquire(); } diff --git a/src/org/linphone/compatibility/Compatibility.java b/src/org/linphone/compatibility/Compatibility.java index 5704e1402..2f7e16621 100644 --- a/src/org/linphone/compatibility/Compatibility.java +++ b/src/org/linphone/compatibility/Compatibility.java @@ -48,8 +48,6 @@ public class Compatibility { public static Intent prepareAddContactIntent(String displayName, String sipUri) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.prepareAddContactIntent(displayName, sipUri); - } else { - //TODO } return null; } @@ -57,8 +55,6 @@ public class Compatibility { public static Intent prepareEditContactIntent(int id) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.prepareEditContactIntent(id); - } else { - //TODO } return null; } @@ -66,8 +62,6 @@ public class Compatibility { public static List extractContactNumbersAndAddresses(String id, ContentResolver cr) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.extractContactNumbersAndAddresses(id, cr); - } else { - //TODO } return null; } @@ -75,8 +69,6 @@ public class Compatibility { public static Cursor getContactsCursor(ContentResolver cr) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.getContactsCursor(cr); - } else { - //TODO } return null; } @@ -84,8 +76,6 @@ public class Compatibility { public static Cursor getSIPContactsCursor(ContentResolver cr) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.getSIPContactsCursor(cr); - } else { - //TODO } return null; } @@ -93,8 +83,6 @@ public class Compatibility { public static int getCursorDisplayNameColumnIndex(Cursor cursor) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.getCursorDisplayNameColumnIndex(cursor); - } else { - //TODO } return -1; } @@ -102,8 +90,6 @@ public class Compatibility { public static Contact getContact(ContentResolver cr, Cursor cursor, int position) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.getContact(cr, cursor, position); - } else { - //TODO } return null; } @@ -111,8 +97,6 @@ public class Compatibility { public static InputStream getContactPictureInputStream(ContentResolver cr, String id) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.getContactPictureInputStream(cr, id); - } else { - //TODO } return null; } @@ -120,8 +104,6 @@ public class Compatibility { public static Uri findUriPictureOfContactAndSetDisplayName(LinphoneAddress address, ContentResolver cr) { if (Version.sdkAboveOrEqual(5)) { return ApiFivePlus.findUriPictureOfContactAndSetDisplayName(address, cr); - } else { - //TODO } return null; } @@ -160,8 +142,9 @@ public class Compatibility { notif = ApiSixteenPlus.createInCallNotification(context, title, msg, iconID, contactIcon, contactName, intent); } else { notif = new Notification(); + notif.icon = iconID; notif.iconLevel = 0; - notif.when=System.currentTimeMillis(); + notif.when = System.currentTimeMillis(); notif.flags &= Notification.FLAG_ONGOING_EVENT; notif.setLatestEventInfo(context, title, msg, intent);