Fix numpad issue in audio call + fix incall notifications

This commit is contained in:
Sylvain Berfini 2012-08-02 11:01:21 +02:00
parent 84da207455
commit de27a3f87b
6 changed files with 56 additions and 65 deletions

View file

@ -62,6 +62,7 @@
<activity android:name="org.linphone.IncomingCallActivity"
android:theme="@android:style/Theme.NoTitleBar"
android:noHistory="true"
android:launchMode="singleTop"
android:screenOrientation="nosensor">
<intent-filter>
@ -72,7 +73,7 @@
<activity android:name="org.linphone.InCallActivity"
android:theme="@android:style/Theme.NoTitleBar"
android:noHistory="true"
android:launchMode="singleInstance">
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>

View file

@ -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) {

View file

@ -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);
}
}
}
}

View file

@ -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);

View file

@ -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();
}

View file

@ -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<String> 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);