Fix tablet chat && contacts fragment

This commit is contained in:
Margaux Clerc 2015-04-16 17:05:14 +02:00
parent fc53b21ea2
commit 540a1c6fb4
2 changed files with 24 additions and 12 deletions

View file

@ -108,6 +108,9 @@ public class EditContactFragment extends Fragment {
} }
getFragmentManager().popBackStackImmediate(); getFragmentManager().popBackStackImmediate();
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.isTablet))
ContactsFragment.instance().invalidate();
} }
}); });

View file

@ -615,19 +615,24 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
String displayName = contact != null ? contact.getName() : null; String displayName = contact != null ? contact.getName() : null;
String pictureUri = contact != null && contact.getPhotoUri() != null ? contact.getPhotoUri().toString() : null; String pictureUri = contact != null && contact.getPhotoUri() != null ? contact.getPhotoUri().toString() : null;
if (isTablet() && (currentFragment == FragmentsAvailable.CHATLIST || currentFragment == FragmentsAvailable.CHAT)) { if (isTablet()){
Fragment fragment2 = getSupportFragmentManager().findFragmentById(R.id.fragmentContainer2); if (currentFragment == FragmentsAvailable.CHATLIST || currentFragment == FragmentsAvailable.CHAT){
if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CHAT) { Fragment fragment2 = getSupportFragmentManager().findFragmentById(R.id.fragmentContainer2);
ChatFragment chatFragment = (ChatFragment) fragment2; if (fragment2 != null && fragment2.isVisible() && currentFragment == FragmentsAvailable.CHAT) {
chatFragment.changeDisplayedChat(sipUri, displayName, pictureUri); ChatFragment chatFragment = (ChatFragment) fragment2;
} else { chatFragment.changeDisplayedChat(sipUri, displayName, pictureUri);
Bundle extras = new Bundle(); } else {
extras.putString("SipUri", sipUri); Bundle extras = new Bundle();
if (lAddress.getDisplayName() != null) { extras.putString("SipUri", sipUri);
extras.putString("DisplayName", displayName); if (lAddress.getDisplayName() != null) {
extras.putString("PictureUri", pictureUri); extras.putString("DisplayName", displayName);
extras.putString("PictureUri", pictureUri);
}
changeCurrentFragment(FragmentsAvailable.CHAT, extras);
} }
changeCurrentFragment(FragmentsAvailable.CHAT, extras); } else {
changeCurrentFragment(FragmentsAvailable.CHATLIST, null);
displayChat(sipUri);
} }
} else { } else {
Intent intent = new Intent(this, ChatActivity.class); Intent intent = new Intent(this, ChatActivity.class);
@ -794,6 +799,10 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
public int onMessageSent(String to, String message) { public int onMessageSent(String to, String message) {
getChatStorage().deleteDraft(to); getChatStorage().deleteDraft(to);
if (messageListFragment != null && messageListFragment.isVisible()) {
((ChatListFragment) messageListFragment).refresh();
}
return getChatStorage().saveTextMessage("", to, message, System.currentTimeMillis()); return getChatStorage().saveTextMessage("", to, message, System.currentTimeMillis());
} }