Commit f3411ee0 authored by Grigory Fedorov's avatar Grigory Fedorov

ChatViewer: all fragments completely updated on new message. Incoming message animation removed.

parent 3932760b
......@@ -65,11 +65,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
private String extraText = null;
private boolean isIncoming = false;
private String incomingAccount;
private String incomingUser;
ChatViewerAdapter chatViewerAdapter;
ViewPager viewPager;
......@@ -250,13 +245,19 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
@Override
public void onChatChanged(final String account, final String user,
final boolean incoming) {
chatViewerAdapter.onChange();
if (incoming) {
isIncoming = true;
incomingAccount = account;
incomingUser = user;
String currentAccount = null;
String currentUser = null;
AbstractChat chatByPageNumber = chatViewerAdapter.getChatByPageNumber(viewPager.getCurrentItem());
if (chatByPageNumber != null) {
currentAccount = chatByPageNumber.getAccount();
currentUser = chatByPageNumber.getUser();
}
chatViewerAdapter.onChange();
selectPage(currentAccount, currentUser, false);
}
@Override
......@@ -302,6 +303,7 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
if (selectedChat == null) {
setTitle(getString(R.string.chat_list));
MessageManager.getInstance().removeVisibleChat();
return;
}
......@@ -365,15 +367,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
updateRegisteredChats();
updateRegisteredRecentChatsFragments();
if (isIncoming) {
for (ChatViewerFragment chat : registeredChats) {
if (chat.isEqual(incomingAccount, incomingUser)) {
chat.updateChat(true);
}
}
isIncoming = false;
}
Fragment currentFragment = chatViewerAdapter.getCurrentFragment();
if (currentFragment instanceof ChatViewerFragment) {
((ChatViewerFragment)currentFragment).setInputFocus();
......
......@@ -171,4 +171,9 @@ public class ChatViewerAdapter extends FragmentStatePagerAdapter implements Upda
public ArrayList<AbstractChat> getActiveChats() {
return activeChats;
}
@Override
public int getItemPosition(Object object) {
return POSITION_NONE;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment