stop scrolling before changing conversations. fixes #2700

This commit is contained in:
Daniel Gultsch 2017-11-17 21:00:01 +01:00
parent a2d4ec46ba
commit e452d5d46d
2 changed files with 14 additions and 0 deletions

View file

@ -139,6 +139,9 @@ public class ConversationActivity extends XmppActivity
}
public void showConversationsOverview() {
if (mConversationFragment != null) {
mConversationFragment.stopScrolling();
}
if (mContentView instanceof SlidingPaneLayout) {
SlidingPaneLayout mSlidingPaneLayout = (SlidingPaneLayout) mContentView;
mShouldPanelBeOpen.set(true);
@ -222,6 +225,7 @@ public class ConversationActivity extends XmppActivity
public void onItemClick(AdapterView<?> arg0, View clickedView,
int position, long arg3) {
if (getSelectedConversation() != conversationList.get(position)) {
ConversationActivity.this.mConversationFragment.stopScrolling();
setSelectedConversation(conversationList.get(position));
ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation());
conversationWasSelectedByKeyboard = false;
@ -1110,6 +1114,7 @@ public class ConversationActivity extends XmppActivity
private boolean openConversationByIndex(int index) {
try {
this.conversationWasSelectedByKeyboard = true;
this.mConversationFragment.stopScrolling();
setSelectedConversation(this.conversationList.get(index));
this.mConversationFragment.reInit(getSelectedConversation());
if (index > listView.getLastVisiblePosition() - 1 || index < listView.getFirstVisiblePosition() + 1) {
@ -1328,6 +1333,7 @@ public class ConversationActivity extends XmppActivity
final String text = intent.getStringExtra(TEXT);
final String nick = intent.getStringExtra(NICK);
final boolean pm = intent.getBooleanExtra(PRIVATE_MESSAGE, false);
this.mConversationFragment.stopScrolling();
if (selectConversationByUuid(uuid)) {
this.mConversationFragment.reInit(getSelectedConversation());
if (nick != null) {

View file

@ -11,6 +11,7 @@ import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.support.v13.view.inputmethod.InputConnectionCompat;
import android.support.v13.view.inputmethod.InputContentInfoCompat;
import android.text.Editable;
@ -25,6 +26,7 @@ import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@ -1425,6 +1427,12 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
}
public void stopScrolling() {
long now = SystemClock.uptimeMillis();
MotionEvent cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0, 0, 0);
messagesView.dispatchTouchEvent(cancel);
}
private boolean showLoadMoreMessages(final Conversation c) {
final boolean mam = hasMamSupport(c);
final MessageArchiveService service = activity.xmppConnectionService.getMessageArchiveService();