Improved memory again (and a few other things along the way)
This commit is contained in:
parent
ac6bf5dfe2
commit
cebe5d9b00
6 changed files with 40 additions and 98 deletions
|
@ -39,7 +39,6 @@ import org.linphone.core.LinphoneCoreListenerBase;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.ui.BubbleChat;
|
import org.linphone.ui.BubbleChat;
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
@ -47,7 +46,6 @@ import android.app.Fragment;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
@ -89,8 +87,6 @@ import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener {
|
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener {
|
||||||
private static ChatFragment instance;
|
|
||||||
|
|
||||||
private static final int ADD_PHOTO = 1337;
|
private static final int ADD_PHOTO = 1337;
|
||||||
private static final int MENU_DELETE_MESSAGE = 0;
|
private static final int MENU_DELETE_MESSAGE = 0;
|
||||||
private static final int MENU_PICTURE_SMALL = 2;
|
private static final int MENU_PICTURE_SMALL = 2;
|
||||||
|
@ -128,14 +124,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
private ByteArrayInputStream mUploadingImageStream;
|
private ByteArrayInputStream mUploadingImageStream;
|
||||||
private boolean newChatConversation = false;
|
private boolean newChatConversation = false;
|
||||||
|
|
||||||
public static boolean isInstanciated() {
|
|
||||||
return instance != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
instance = this;
|
|
||||||
final View view = inflater.inflate(R.layout.chat, container, false);
|
final View view = inflater.inflate(R.layout.chat, container, false);
|
||||||
|
|
||||||
LinphoneManager.addListener(this);
|
LinphoneManager.addListener(this);
|
||||||
|
@ -219,6 +210,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||||
LinphoneAddress from = cr.getPeerAddress();
|
LinphoneAddress from = cr.getPeerAddress();
|
||||||
if (from.asStringUriOnly().equals(sipUri)) {
|
if (from.asStringUriOnly().equals(sipUri)) {
|
||||||
|
LinphoneService.instance().removeMessageNotification();
|
||||||
|
cr.markAsRead();
|
||||||
invalidate();
|
invalidate();
|
||||||
messagesList.setSelection(adapter.getCount()-1);
|
messagesList.setSelection(adapter.getCount()-1);
|
||||||
|
|
||||||
|
@ -257,10 +250,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatFragment instance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSipUri() {
|
public String getSipUri() {
|
||||||
return sipUri;
|
return sipUri;
|
||||||
}
|
}
|
||||||
|
@ -567,10 +556,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
|
|
||||||
LinphoneService.instance().removeMessageNotification();
|
LinphoneService.instance().removeMessageNotification();
|
||||||
|
|
||||||
if (LinphoneActivity.isInstanciated()) {
|
|
||||||
LinphoneActivity.instance().updateChatFragment(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
lc.removeListener(mListener);
|
lc.removeListener(mListener);
|
||||||
|
@ -598,7 +583,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
|
|
||||||
if (LinphoneActivity.isInstanciated()) {
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT);
|
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT);
|
||||||
LinphoneActivity.instance().updateChatFragment(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(LinphoneManager.getLc().isIncall()){
|
if(LinphoneManager.getLc().isIncall()){
|
||||||
|
|
|
@ -22,8 +22,10 @@ import java.util.List;
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneChatMessage;
|
import org.linphone.core.LinphoneChatMessage;
|
||||||
import org.linphone.core.LinphoneChatRoom;
|
import org.linphone.core.LinphoneChatRoom;
|
||||||
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.core.LinphoneCoreException;
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
|
import org.linphone.core.LinphoneCoreListenerBase;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
@ -61,6 +63,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
private ImageView edit, selectAll, deselectAll, delete, newDiscussion, cancel, backInCall;
|
private ImageView edit, selectAll, deselectAll, delete, newDiscussion, cancel, backInCall;
|
||||||
private LinearLayout editList, topbar;
|
private LinearLayout editList, topbar;
|
||||||
private boolean isEditMode = false;
|
private boolean isEditMode = false;
|
||||||
|
private LinphoneCoreListenerBase mListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
@ -97,6 +100,13 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
delete = (ImageView) view.findViewById(R.id.delete);
|
delete = (ImageView) view.findViewById(R.id.delete);
|
||||||
delete.setOnClickListener(this);
|
delete.setOnClickListener(this);
|
||||||
|
|
||||||
|
mListener = new LinphoneCoreListenerBase() {
|
||||||
|
@Override
|
||||||
|
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
};
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,12 +204,25 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
if (LinphoneActivity.isInstanciated()) {
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT_LIST);
|
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CHAT_LIST);
|
||||||
LinphoneActivity.instance().updateChatListFragment(this);
|
|
||||||
LinphoneActivity.instance().hideTabBar(false);
|
LinphoneActivity.instance().hideTabBar(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
if (lc != null) {
|
||||||
|
lc.addListener(mListener);
|
||||||
|
}
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
|
if (lc != null) {
|
||||||
|
lc.removeListener(mListener);
|
||||||
|
}
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
||||||
|
@ -381,7 +404,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
displayName.setText(contact == null ? LinphoneUtils.getAddressDisplayName(address) : contact.getFullName());
|
displayName.setText(contact == null ? LinphoneUtils.getAddressDisplayName(address) : contact.getFullName());
|
||||||
|
|
||||||
|
|
||||||
if(contact != null){
|
if (contact != null) {
|
||||||
LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||||
} else {
|
} else {
|
||||||
contactPicture.setImageResource(R.drawable.avatar);
|
contactPicture.setImageResource(R.drawable.avatar);
|
||||||
|
|
|
@ -144,14 +144,6 @@ public class ContactEditorFragment extends Fragment {
|
||||||
contact.addOrUpdateNumberOrAddress(numberOrAddress);
|
contact.addOrUpdateNumberOrAddress(numberOrAddress);
|
||||||
}
|
}
|
||||||
contact.save();
|
contact.save();
|
||||||
|
|
||||||
if (!isNewContact) {
|
|
||||||
if (LinphoneActivity.instance().getResources().getBoolean(R.bool.isTablet)) {
|
|
||||||
if(ContactsListFragment.isInstanciated()) {
|
|
||||||
ContactsListFragment.instance().invalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getFragmentManager().popBackStackImmediate();
|
getFragmentManager().popBackStackImmediate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -68,16 +68,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
||||||
private ImageView clearSearchField;
|
private ImageView clearSearchField;
|
||||||
private EditText searchField;
|
private EditText searchField;
|
||||||
|
|
||||||
private static ContactsListFragment instance;
|
|
||||||
|
|
||||||
static final boolean isInstanciated() {
|
|
||||||
return instance != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final ContactsListFragment instance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
mInflater = inflater;
|
mInflater = inflater;
|
||||||
|
@ -379,7 +369,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
instance = this;
|
|
||||||
ContactsManager.addContactsListener(this);
|
ContactsManager.addContactsListener(this);
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
@ -399,7 +388,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
instance = null;
|
|
||||||
ContactsManager.removeContactsListener(this);
|
ContactsManager.removeContactsListener(this);
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,8 +112,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
private ImageView cancel;
|
private ImageView cancel;
|
||||||
private FragmentsAvailable currentFragment, nextFragment;
|
private FragmentsAvailable currentFragment, nextFragment;
|
||||||
private List<FragmentsAvailable> fragmentsHistory;
|
private List<FragmentsAvailable> fragmentsHistory;
|
||||||
private Fragment dialerFragment, chatListFragment, historyListFragment, contactListFragment;
|
private Fragment dialerFragment;
|
||||||
private ChatFragment chatFragment;
|
|
||||||
private Fragment.SavedState dialerSavedState;
|
private Fragment.SavedState dialerSavedState;
|
||||||
private boolean newProxyConfig;
|
private boolean newProxyConfig;
|
||||||
private boolean isAnimationDisabled = true, emptyFragment = false, permissionAsked = false;
|
private boolean isAnimationDisabled = true, emptyFragment = false, permissionAsked = false;
|
||||||
|
@ -195,13 +194,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
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(getUnreadMessageCount());
|
displayMissedChats(getUnreadMessageCount());
|
||||||
if (chatListFragment != null && chatListFragment.isVisible()) {
|
|
||||||
((ChatListFragment) chatListFragment).refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -373,14 +366,18 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
switch (newFragmentType) {
|
switch (newFragmentType) {
|
||||||
case HISTORY_LIST:
|
case HISTORY_LIST:
|
||||||
newFragment = new HistoryListFragment();
|
newFragment = new HistoryListFragment();
|
||||||
historyListFragment = newFragment;
|
if (isTablet()) {
|
||||||
|
((HistoryListFragment) newFragment).displayFirstLog();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case HISTORY_DETAIL:
|
case HISTORY_DETAIL:
|
||||||
newFragment = new HistoryDetailFragment();
|
newFragment = new HistoryDetailFragment();
|
||||||
break;
|
break;
|
||||||
case CONTACTS_LIST:
|
case CONTACTS_LIST:
|
||||||
newFragment = new ContactsListFragment();
|
newFragment = new ContactsListFragment();
|
||||||
contactListFragment = newFragment;
|
if (isTablet()) {
|
||||||
|
((ContactsListFragment) newFragment).displayFirstContact();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CONTACT_DETAIL:
|
case CONTACT_DETAIL:
|
||||||
newFragment = new ContactDetailsFragment();
|
newFragment = new ContactDetailsFragment();
|
||||||
|
@ -409,7 +406,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
break;
|
break;
|
||||||
case CHAT_LIST:
|
case CHAT_LIST:
|
||||||
newFragment = new ChatListFragment();
|
newFragment = new ChatListFragment();
|
||||||
chatListFragment = newFragment;
|
if (isTablet()) {
|
||||||
|
((ChatListFragment) newFragment).displayFirstChat();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CHAT:
|
case CHAT:
|
||||||
newFragment = new ChatFragment();
|
newFragment = new ChatFragment();
|
||||||
|
@ -642,15 +641,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class));
|
startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean displayChatMessageNotification(String address){
|
|
||||||
if(chatFragment != null) {
|
|
||||||
if(chatFragment.getSipUri().equals(address)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getUnreadMessageCount() {
|
public int getUnreadMessageCount() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
|
LinphoneChatRoom[] chats = LinphoneManager.getLc().getChatRooms();
|
||||||
|
@ -718,10 +708,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatListFragment != null && chatListFragment.isVisible()) {
|
|
||||||
((ChatListFragment) chatListFragment).refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
LinphoneService.instance().resetMessageNotifCount();
|
LinphoneService.instance().resetMessageNotifCount();
|
||||||
LinphoneService.instance().removeMessageNotification();
|
LinphoneService.instance().removeMessageNotification();
|
||||||
displayMissedChats(getUnreadMessageCount());
|
displayMissedChats(getUnreadMessageCount());
|
||||||
|
@ -737,30 +723,15 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
history_selected.setVisibility(View.VISIBLE);
|
history_selected.setVisibility(View.VISIBLE);
|
||||||
LinphoneManager.getLc().resetMissedCallsCount();
|
LinphoneManager.getLc().resetMissedCallsCount();
|
||||||
displayMissedCalls(0);
|
displayMissedCalls(0);
|
||||||
if(isTablet()) {
|
|
||||||
if (historyListFragment != null && historyListFragment.isVisible()) {
|
|
||||||
((HistoryListFragment) historyListFragment).displayFirstLog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (id == R.id.contacts) {
|
} else if (id == R.id.contacts) {
|
||||||
changeCurrentFragment(FragmentsAvailable.CONTACTS_LIST, null);
|
changeCurrentFragment(FragmentsAvailable.CONTACTS_LIST, null);
|
||||||
contacts_selected.setVisibility(View.VISIBLE);
|
contacts_selected.setVisibility(View.VISIBLE);
|
||||||
if(isTablet()) {
|
|
||||||
if (contactListFragment != null && contactListFragment.isVisible()) {
|
|
||||||
((ContactsListFragment) contactListFragment).displayFirstContact();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (id == R.id.dialer) {
|
} else if (id == R.id.dialer) {
|
||||||
changeCurrentFragment(FragmentsAvailable.DIALER, null);
|
changeCurrentFragment(FragmentsAvailable.DIALER, null);
|
||||||
dialer_selected.setVisibility(View.VISIBLE);
|
dialer_selected.setVisibility(View.VISIBLE);
|
||||||
} else if (id == R.id.chat) {
|
} else if (id == R.id.chat) {
|
||||||
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
|
changeCurrentFragment(FragmentsAvailable.CHAT_LIST, null);
|
||||||
chat_selected.setVisibility(View.VISIBLE);
|
chat_selected.setVisibility(View.VISIBLE);
|
||||||
if(isTablet()) {
|
|
||||||
if (chatListFragment != null && chatListFragment.isVisible()) {
|
|
||||||
((ChatListFragment) chatListFragment).displayFirstChat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (id == R.id.cancel){
|
} else if (id == R.id.cancel){
|
||||||
hideTopBar();
|
hideTopBar();
|
||||||
displayDialer();
|
displayDialer();
|
||||||
|
@ -825,14 +796,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateChatFragment(ChatFragment fragment) {
|
|
||||||
chatFragment = fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateChatListFragment(ChatListFragment fragment) {
|
|
||||||
chatListFragment = fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateStatusFragment(StatusFragment fragment) {
|
public void updateStatusFragment(StatusFragment fragment) {
|
||||||
statusFragment = fragment;
|
statusFragment = fragment;
|
||||||
}
|
}
|
||||||
|
@ -884,10 +847,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
|
|
||||||
public int onMessageSent(String to, String message) {
|
public int onMessageSent(String to, String message) {
|
||||||
getChatStorage().deleteDraft(to);
|
getChatStorage().deleteDraft(to);
|
||||||
if (chatListFragment != null && chatListFragment.isVisible()) {
|
|
||||||
((ChatListFragment) chatListFragment).refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
return getChatStorage().saveTextMessage("", to, message, System.currentTimeMillis());
|
return getChatStorage().saveTextMessage("", to, message, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -864,14 +864,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
||||||
try {
|
try {
|
||||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
|
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(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 (contact != null) {
|
||||||
return;
|
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getFullName(), textMessage);
|
||||||
} else {
|
} else {
|
||||||
if (contact != null) {
|
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getUserName(), textMessage);
|
||||||
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getFullName(), textMessage);
|
|
||||||
} else {
|
|
||||||
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getUserName(), textMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in a new issue