Fix notification issues + don't automatically show virtual keyboard when coming back to chat fragment from notification

This commit is contained in:
Sylvain Berfini 2012-09-25 14:51:15 +02:00
parent 3ae8cc3d48
commit 131a252ca5
3 changed files with 14 additions and 10 deletions

View file

@ -34,7 +34,7 @@
<activity android:name="org.linphone.LinphoneLauncherActivity" <activity android:name="org.linphone.LinphoneLauncherActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:windowSoftInputMode="adjustPan" android:windowSoftInputMode="adjustPan|stateHidden"
android:theme="@style/NoTitle"> android:theme="@style/NoTitle">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View file

@ -580,14 +580,14 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
public void updateDialerFragment(DialerFragment fragment) { public void updateDialerFragment(DialerFragment fragment) {
dialerFragment = fragment; dialerFragment = fragment;
// Hack to maintain ADJUST_PAN flag // Hack to maintain soft input flags
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
} }
public void updateChatFragment(ChatFragment fragment) { public void updateChatFragment(ChatFragment fragment) {
messageListenerFragment = fragment; messageListenerFragment = fragment;
// Hack to maintain ADJUST_PAN flag // Hack to maintain soft input flags
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
} }
public void updateChatListFragment(ChatListFragment fragment) { public void updateChatListFragment(ChatListFragment fragment) {

View file

@ -158,7 +158,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
Intent notifIntent = new Intent(this, incomingReceivedActivity); Intent notifIntent = new Intent(this, incomingReceivedActivity);
notifIntent.putExtra("Notification", true); notifIntent.putExtra("Notification", true);
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Compatibility.setNotificationLatestEventInfo(mNotif, this, mNotificationTitle, "", mNotifContentIntent); Compatibility.setNotificationLatestEventInfo(mNotif, this, mNotificationTitle, "", mNotifContentIntent);
@ -271,7 +271,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
} }
public void addNotification(Intent onClickIntent, int iconResourceID, String title, String message) { public void addNotification(Intent onClickIntent, int iconResourceID, String title, String message) {
PendingIntent notifContentIntent = PendingIntent.getActivity(this, 0, onClickIntent, PendingIntent.FLAG_CANCEL_CURRENT); PendingIntent notifContentIntent = PendingIntent.getActivity(this, 0, onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
if (mCustomNotif == null) { if (mCustomNotif == null) {
mCustomNotif = new Notification(); mCustomNotif = new Notification();
@ -295,7 +295,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
notifIntent.putExtra("GoToChat", true); notifIntent.putExtra("GoToChat", true);
notifIntent.putExtra("ChatContactSipUri", fromSipUri); notifIntent.putExtra("ChatContactSipUri", fromSipUri);
PendingIntent notifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT); PendingIntent notifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
if (fromName == null) { if (fromName == null) {
fromName = fromSipUri; fromName = fromSipUri;
@ -321,6 +321,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
public void removeMessageNotification() { public void removeMessageNotification() {
mNM.cancel(MESSAGE_NOTIF_ID); mNM.cancel(MESSAGE_NOTIF_ID);
resetIntentLaunchedOnNotificationClick();
} }
private static final Class<?>[] mSetFgSign = new Class[] {boolean.class}; private static final Class<?>[] mSetFgSign = new Class[] {boolean.class};
@ -523,9 +524,12 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
public void setActivityToLaunchOnIncomingReceived(Class<? extends Activity> activity) { public void setActivityToLaunchOnIncomingReceived(Class<? extends Activity> activity) {
incomingReceivedActivity = activity; incomingReceivedActivity = activity;
resetIntentLaunchedOnNotificationClick();
}
private void resetIntentLaunchedOnNotificationClick() {
Intent notifIntent = new Intent(this, incomingReceivedActivity); Intent notifIntent = new Intent(this, incomingReceivedActivity);
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, 0); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Compatibility.setNotificationLatestEventInfo(mNotif, this, mNotificationTitle, "", mNotifContentIntent); Compatibility.setNotificationLatestEventInfo(mNotif, this, mNotificationTitle, "", mNotifContentIntent);
} }