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(){
|
mListener = new LinphoneCoreListenerBase(){
|
||||||
@Override
|
@Override
|
||||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||||
|
if(!displayChatMessageNotification(message.getFrom().asStringUriOnly())) {
|
||||||
|
cr.markAsRead();
|
||||||
|
}
|
||||||
displayMissedChats(getChatStorage().getUnreadMessageCount());
|
displayMissedChats(getChatStorage().getUnreadMessageCount());
|
||||||
if (messageListFragment != null && messageListFragment.isVisible()) {
|
if (messageListFragment != null && messageListFragment.isVisible()) {
|
||||||
((ChatListFragment) messageListFragment).refresh();
|
((ChatListFragment) messageListFragment).refresh();
|
||||||
|
@ -603,11 +606,11 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
public boolean displayChatMessageNotification(String address){
|
public boolean displayChatMessageNotification(String address){
|
||||||
if(chatFragment != null) {
|
if(chatFragment != null) {
|
||||||
if(chatFragment.getSipUri().equals(address)){
|
if(chatFragment.getSipUri().equals(address)){
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void displayChat(String sipUri) {
|
public void displayChat(String sipUri) {
|
||||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
if (getResources().getBoolean(R.bool.disable_chat)) {
|
||||||
|
@ -651,6 +654,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
changeCurrentFragment(FragmentsAvailable.CHATLIST, null);
|
changeCurrentFragment(FragmentsAvailable.CHATLIST, null);
|
||||||
displayChat(sipUri);
|
displayChat(sipUri);
|
||||||
}
|
}
|
||||||
|
if (messageListFragment != null && messageListFragment.isVisible()) {
|
||||||
|
((ChatListFragment) messageListFragment).refresh();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Intent intent = new Intent(this, ChatActivity.class);
|
Intent intent = new Intent(this, ChatActivity.class);
|
||||||
intent.putExtra("SipUri", sipUri);
|
intent.putExtra("SipUri", sipUri);
|
||||||
|
|
|
@ -717,7 +717,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
try {
|
try {
|
||||||
Contact contact = ContactsManager.getInstance().findContactWithAddress(mServiceContext.getContentResolver(),from);
|
Contact contact = ContactsManager.getInstance().findContactWithAddress(mServiceContext.getContentResolver(),from);
|
||||||
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat__message_notification)) {
|
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) {
|
if (contact != null) {
|
||||||
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getName(), textMessage);
|
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getName(), textMessage);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue