fix "partial scroll" when sending in certain cases

fixes #2856
Closes #4702
// FREEBIE
This commit is contained in:
Jake McGinty 2015-11-23 17:22:10 -08:00 committed by Moxie Marlinspike
parent 785f737244
commit 8914c79613

View File

@ -32,6 +32,7 @@ import android.support.v7.app.AlertDialog;
import android.support.v7.view.ActionMode; import android.support.v7.view.ActionMode;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ItemAnimator.ItemAnimatorFinishedListener;
import android.text.ClipboardManager; import android.text.ClipboardManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -160,6 +161,8 @@ public class ConversationFragment extends Fragment
if (this.recipients != null && this.threadId != -1) { if (this.recipients != null && this.threadId != -1) {
list.setAdapter(new ConversationAdapter(getActivity(), masterSecret, locale, selectionClickListener, null, this.recipients)); list.setAdapter(new ConversationAdapter(getActivity(), masterSecret, locale, selectionClickListener, null, this.recipients));
getLoaderManager().restartLoader(0, Bundle.EMPTY, this); getLoaderManager().restartLoader(0, Bundle.EMPTY, this);
list.getItemAnimator().setSupportsChangeAnimations(false);
list.getItemAnimator().setMoveDuration(120);
} }
} }
@ -211,9 +214,9 @@ public class ConversationFragment extends Fragment
} }
public void scrollToBottom() { public void scrollToBottom() {
list.post(new Runnable() { list.getItemAnimator().isRunning(new ItemAnimatorFinishedListener() {
@Override @Override
public void run() { public void onAnimationsFinished() {
list.stopScroll(); list.stopScroll();
list.smoothScrollToPosition(0); list.smoothScrollToPosition(0);
} }