Fix notification chat for tablets
This commit is contained in:
parent
e076acb251
commit
bfe4941c5c
2 changed files with 9 additions and 3 deletions
|
@ -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,10 +606,10 @@ 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 false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void displayChat(String sipUri) {
|
||||
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue