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

View file

@ -400,13 +400,14 @@ public class InCallActivity extends FragmentActivity implements
controlsHandler.removeCallbacks(mControls); controlsHandler.removeCallbacks(mControls);
} }
if (isVideoEnabled) {
controlsHandler.postDelayed(mControls = new Runnable() { controlsHandler.postDelayed(mControls = new Runnable() {
public void run() { public void run() {
hideNumpad(); hideNumpad();
if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) { if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) {
transfer.setVisibility(View.GONE); transfer.setVisibility(View.INVISIBLE);
addCall.setVisibility(View.GONE); addCall.setVisibility(View.INVISIBLE);
mControlsLayout.setVisibility(View.GONE); mControlsLayout.setVisibility(View.GONE);
switchCamera.setVisibility(View.INVISIBLE); switchCamera.setVisibility(View.INVISIBLE);
options.setImageResource(R.drawable.options); options.setImageResource(R.drawable.options);
@ -425,8 +426,8 @@ public class InCallActivity extends FragmentActivity implements
@Override @Override
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
video.setEnabled(true); // HACK: Used to avoid controls from being hided if video is switched while controls are hiding video.setEnabled(true); // HACK: Used to avoid controls from being hided if video is switched while controls are hiding
transfer.setVisibility(View.GONE); transfer.setVisibility(View.INVISIBLE);
addCall.setVisibility(View.GONE); addCall.setVisibility(View.INVISIBLE);
mControlsLayout.setVisibility(View.GONE); mControlsLayout.setVisibility(View.GONE);
switchCamera.setVisibility(View.INVISIBLE); switchCamera.setVisibility(View.INVISIBLE);
options.setImageResource(R.drawable.options); options.setImageResource(R.drawable.options);
@ -438,6 +439,7 @@ public class InCallActivity extends FragmentActivity implements
} }
}, SECONDS_BEFORE_HIDING_CONTROLS); }, SECONDS_BEFORE_HIDING_CONTROLS);
} }
}
public void setCallControlsVisibleAndRemoveCallbacks() { public void setCallControlsVisibleAndRemoveCallbacks() {
if (controlsHandler != null && mControls != null) { if (controlsHandler != null && mControls != null) {
@ -514,9 +516,9 @@ public class InCallActivity extends FragmentActivity implements
options.setImageResource(R.drawable.options); options.setImageResource(R.drawable.options);
if (getResources().getBoolean(R.bool.disable_animations)) { if (getResources().getBoolean(R.bool.disable_animations)) {
if (isTransferAllowed) { if (isTransferAllowed) {
transfer.setVisibility(View.GONE); transfer.setVisibility(View.INVISIBLE);
} }
addCall.setVisibility(View.GONE); addCall.setVisibility(View.INVISIBLE);
} else { } else {
Animation anim = AnimationUtils.loadAnimation(this, R.anim.slide_out_left_to_right); Animation anim = AnimationUtils.loadAnimation(this, R.anim.slide_out_left_to_right);
anim.setAnimationListener(new AnimationListener() { anim.setAnimationListener(new AnimationListener() {
@ -533,9 +535,9 @@ public class InCallActivity extends FragmentActivity implements
@Override @Override
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
if (isTransferAllowed) { if (isTransferAllowed) {
transfer.setVisibility(View.GONE); transfer.setVisibility(View.INVISIBLE);
} }
addCall.setVisibility(View.GONE); addCall.setVisibility(View.INVISIBLE);
} }
}); });
if (isTransferAllowed) { if (isTransferAllowed) {

View file

@ -831,6 +831,15 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
LinphoneService.instance().removeMessageNotification(); LinphoneService.instance().removeMessageNotification();
String sipUri = extras.getString("ChatContactSipUri"); String sipUri = extras.getString("ChatContactSipUri");
displayChat(sipUri); 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; mNotif.flags |= Notification.FLAG_ONGOING_EVENT;
Intent notifIntent = new Intent(this, incomingReceivedActivity); Intent notifIntent = new Intent(this, incomingReceivedActivity);
notifIntent.putExtra("Notification", true);
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT);
mNotif.setLatestEventInfo(this, mNotificationTitle,"", mNotifContentIntent); mNotif.setLatestEventInfo(this, mNotificationTitle,"", mNotifContentIntent);

View file

@ -138,9 +138,6 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
} }
} }
private void rotatePreviewIfNeeded() {
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -154,8 +151,6 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
} }
} }
rotatePreviewIfNeeded();
mWakeLock.acquire(); mWakeLock.acquire();
} }

View file

@ -48,8 +48,6 @@ public class Compatibility {
public static Intent prepareAddContactIntent(String displayName, String sipUri) { public static Intent prepareAddContactIntent(String displayName, String sipUri) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.prepareAddContactIntent(displayName, sipUri); return ApiFivePlus.prepareAddContactIntent(displayName, sipUri);
} else {
//TODO
} }
return null; return null;
} }
@ -57,8 +55,6 @@ public class Compatibility {
public static Intent prepareEditContactIntent(int id) { public static Intent prepareEditContactIntent(int id) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.prepareEditContactIntent(id); return ApiFivePlus.prepareEditContactIntent(id);
} else {
//TODO
} }
return null; return null;
} }
@ -66,8 +62,6 @@ public class Compatibility {
public static List<String> extractContactNumbersAndAddresses(String id, ContentResolver cr) { public static List<String> extractContactNumbersAndAddresses(String id, ContentResolver cr) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.extractContactNumbersAndAddresses(id, cr); return ApiFivePlus.extractContactNumbersAndAddresses(id, cr);
} else {
//TODO
} }
return null; return null;
} }
@ -75,8 +69,6 @@ public class Compatibility {
public static Cursor getContactsCursor(ContentResolver cr) { public static Cursor getContactsCursor(ContentResolver cr) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.getContactsCursor(cr); return ApiFivePlus.getContactsCursor(cr);
} else {
//TODO
} }
return null; return null;
} }
@ -84,8 +76,6 @@ public class Compatibility {
public static Cursor getSIPContactsCursor(ContentResolver cr) { public static Cursor getSIPContactsCursor(ContentResolver cr) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.getSIPContactsCursor(cr); return ApiFivePlus.getSIPContactsCursor(cr);
} else {
//TODO
} }
return null; return null;
} }
@ -93,8 +83,6 @@ public class Compatibility {
public static int getCursorDisplayNameColumnIndex(Cursor cursor) { public static int getCursorDisplayNameColumnIndex(Cursor cursor) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.getCursorDisplayNameColumnIndex(cursor); return ApiFivePlus.getCursorDisplayNameColumnIndex(cursor);
} else {
//TODO
} }
return -1; return -1;
} }
@ -102,8 +90,6 @@ public class Compatibility {
public static Contact getContact(ContentResolver cr, Cursor cursor, int position) { public static Contact getContact(ContentResolver cr, Cursor cursor, int position) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.getContact(cr, cursor, position); return ApiFivePlus.getContact(cr, cursor, position);
} else {
//TODO
} }
return null; return null;
} }
@ -111,8 +97,6 @@ public class Compatibility {
public static InputStream getContactPictureInputStream(ContentResolver cr, String id) { public static InputStream getContactPictureInputStream(ContentResolver cr, String id) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.getContactPictureInputStream(cr, id); return ApiFivePlus.getContactPictureInputStream(cr, id);
} else {
//TODO
} }
return null; return null;
} }
@ -120,8 +104,6 @@ public class Compatibility {
public static Uri findUriPictureOfContactAndSetDisplayName(LinphoneAddress address, ContentResolver cr) { public static Uri findUriPictureOfContactAndSetDisplayName(LinphoneAddress address, ContentResolver cr) {
if (Version.sdkAboveOrEqual(5)) { if (Version.sdkAboveOrEqual(5)) {
return ApiFivePlus.findUriPictureOfContactAndSetDisplayName(address, cr); return ApiFivePlus.findUriPictureOfContactAndSetDisplayName(address, cr);
} else {
//TODO
} }
return null; return null;
} }
@ -160,6 +142,7 @@ public class Compatibility {
notif = ApiSixteenPlus.createInCallNotification(context, title, msg, iconID, contactIcon, contactName, intent); notif = ApiSixteenPlus.createInCallNotification(context, title, msg, iconID, contactIcon, contactName, intent);
} else { } else {
notif = new Notification(); notif = new Notification();
notif.icon = iconID;
notif.iconLevel = 0; notif.iconLevel = 0;
notif.when = System.currentTimeMillis(); notif.when = System.currentTimeMillis();
notif.flags &= Notification.FLAG_ONGOING_EVENT; notif.flags &= Notification.FLAG_ONGOING_EVENT;