Mark the conversation as read when scrolling the chat view to the latest message

This commit is contained in:
Sylvain Berfini 2013-11-29 16:00:48 +01:00
parent 0e445bff1e
commit f882ad1b01

View file

@ -184,7 +184,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (lc != null) { if (lc != null) {
chatRoom = lc.getOrCreateChatRoom(sipUri); chatRoom = lc.getOrCreateChatRoom(sipUri);
//Only works if using liblinphone storage //Only works if using liblinphone storage
LinphoneActivity.instance().getChatStorage().markConversationAsRead(chatRoom); chatRoom.markAsRead();
} }
if (savedInstanceState != null) { if (savedInstanceState != null) {
@ -315,7 +315,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (start != 0) { if (start != 0) {
messagesScrollView.setScrollViewListener(new ScrollViewListener() { messagesScrollView.setScrollViewListener(new ScrollViewListener() {
@Override @Override
public void OnScrollToTop(final int previousHeight) { public void OnScrollToTop(final int previousHeight) {
invalidate(); invalidate();
mHandler.postDelayed(new Runnable() { mHandler.postDelayed(new Runnable() {
@ -650,6 +650,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
@Override @Override
public void run() { public void run() {
messagesScrollView.fullScroll(View.FOCUS_DOWN); messagesScrollView.fullScroll(View.FOCUS_DOWN);
//Only works if using liblinphone storage
chatRoom.markAsRead();
} }
}, 100); }, 100);
} }