Fix notification chat for tablets

This commit is contained in:
Margaux Clerc 2015-04-29 11:06:16 +02:00
parent e076acb251
commit bfe4941c5c
2 changed files with 9 additions and 3 deletions

View file

@ -178,6 +178,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
mListener = new LinphoneCoreListenerBase(){
@Override
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
if(!displayChatMessageNotification(message.getFrom().asStringUriOnly())) {
cr.markAsRead();
}
displayMissedChats(getChatStorage().getUnreadMessageCount());
if (messageListFragment != null && messageListFragment.isVisible()) {
((ChatListFragment) messageListFragment).refresh();
@ -603,11 +606,11 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
public boolean displayChatMessageNotification(String address){
if(chatFragment != null) {
if(chatFragment.getSipUri().equals(address)){
return true;
}
}
return false;
}
}
return true;
}
public void displayChat(String sipUri) {
if (getResources().getBoolean(R.bool.disable_chat)) {
@ -651,6 +654,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
changeCurrentFragment(FragmentsAvailable.CHATLIST, null);
displayChat(sipUri);
}
if (messageListFragment != null && messageListFragment.isVisible()) {
((ChatListFragment) messageListFragment).refresh();
}
} else {
Intent intent = new Intent(this, ChatActivity.class);
intent.putExtra("SipUri", sipUri);

View file

@ -717,7 +717,7 @@ public class LinphoneManager implements LinphoneCoreListener {
try {
Contact contact = ContactsManager.getInstance().findContactWithAddress(mServiceContext.getContentResolver(),from);
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat__message_notification)) {
if(LinphoneActivity.isInstanciated() && !LinphoneActivity.instance().displayChatMessageNotification(from.asStringUriOnly())) {
if(LinphoneActivity.isInstanciated() && LinphoneActivity.instance().displayChatMessageNotification(from.asStringUriOnly())) {
if (contact != null) {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getName(), textMessage);
} else {