Commit 5987da76 authored by Grigory Fedorov's avatar Grigory Fedorov

ChatViewerFragment: toolbar updated correctly on chat update.

parent b3a7271c
...@@ -81,6 +81,8 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -81,6 +81,8 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
private Animation shakeAnimation = null; private Animation shakeAnimation = null;
private int contextMenuItemPosition; private int contextMenuItemPosition;
private RecyclerView recyclerView; private RecyclerView recyclerView;
private View contactTitleView;
private AbstractContact abstractContact;
public static ChatViewerFragment newInstance(String account, String user) { public static ChatViewerFragment newInstance(String account, String user) {
ChatViewerFragment fragment = new ChatViewerFragment(); ChatViewerFragment fragment = new ChatViewerFragment();
...@@ -120,11 +122,10 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -120,11 +122,10 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
View view = inflater.inflate(R.layout.chat_fragment, container, false); View view = inflater.inflate(R.layout.chat_fragment, container, false);
View contactTitle = view.findViewById(R.id.contact_title); contactTitleView = view.findViewById(R.id.contact_title);
final AbstractContact abstractContact = RosterManager.getInstance().getBestContact(account, user); abstractContact = RosterManager.getInstance().getBestContact(account, user);
ContactTitleInflater.updateTitle(contactTitle, getActivity(), abstractContact); contactTitleView.findViewById(R.id.avatar).setOnClickListener(this);
contactTitle.findViewById(R.id.avatar).setOnClickListener(this);
ActionBarPainter actionBarPainter = new ActionBarPainter((ActionBarActivity) getActivity()); ActionBarPainter actionBarPainter = new ActionBarPainter((ActionBarActivity) getActivity());
...@@ -412,9 +413,9 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -412,9 +413,9 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
} }
public void updateChat() { public void updateChat() {
ContactTitleInflater.updateTitle(contactTitleView, getActivity(), abstractContact);
chatMessageAdapter.onChange(); chatMessageAdapter.onChange();
recyclerView.scrollToPosition(chatMessageAdapter.getItemCount() - 1); recyclerView.scrollToPosition(chatMessageAdapter.getItemCount() - 1);
setUpOptionsMenu(toolbar.getMenu()); setUpOptionsMenu(toolbar.getMenu());
updateSecurityButton(); updateSecurityButton();
} }
......
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