aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-07 22:50:21 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-07 22:50:21 +0200
commit620e6569bbbe7ed3544cab88f1ad024cb2e49612 (patch)
tree76651c8f5b6d69c8415e0d88b75d89db3e586a49 /src/main/java/de
parent271555fe6cef8d33efb6dfe304b0aff77c6354c5 (diff)
decrease delay when scrolling to position
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 8284630ce..24d698b49 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -146,6 +146,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
private final PendingItem<Bundle> pendingExtras = new PendingItem<>();
private final PendingItem<Uri> pendingTakePhotoUri = new PendingItem<>();
private final PendingItem<ScrollState> pendingScrollState = new PendingItem<>();
+ private final PendingItem<Message> pendingMessage = new PendingItem<>();
protected MessageAdapter messageListAdapter;
private Conversation conversation;
public FragmentConversationBinding binding;
@@ -153,9 +154,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
SimpleDateFormat sdf = new SimpleDateFormat("EEEE, dd. MMM yyyy", Locale.getDefault());
private Toast messageLoaderToast;
private ConversationsActivity activity;
-
private boolean reInitRequiredOnStart = true;
-
protected OnClickListener clickToVerify = new OnClickListener() {
@Override
public void onClick(View v) {
@@ -278,6 +277,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
}
};
+
private EditMessage.OnCommitContentListener mEditorContentListener = new EditMessage.OnCommitContentListener() {
@Override
public boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, Bundle opts, String[] contentMimeTypes) {
@@ -462,7 +462,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
private int lastCompletionCursor;
private boolean firstWord = false;
private Message mPendingDownloadableMessage;
- private final PendingItem<Message> pendingMessage = new PendingItem<>();
private static ConversationFragment findConversationFragment(Activity activity) {
Fragment fragment = activity.getFragmentManager().findFragmentById(R.id.main_fragment);
@@ -575,6 +574,24 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
};
+ private static boolean allGranted(int[] grantResults) {
+ for (int grantResult : grantResults) {
+ if (grantResult != PackageManager.PERMISSION_GRANTED) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static String getFirstDenied(int[] grantResults, String[] permissions) {
+ for (int i = 0; i < grantResults.length; ++i) {
+ if (grantResults[i] == PackageManager.PERMISSION_DENIED) {
+ return permissions[i];
+ }
+ }
+ return null;
+ }
+
private int getIndexOf(String uuid, List<Message> messages) {
if (uuid == null) {
return messages.size() - 1;
@@ -1567,24 +1584,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
}
- private static boolean allGranted(int[] grantResults) {
- for (int grantResult : grantResults) {
- if (grantResult != PackageManager.PERMISSION_GRANTED) {
- return false;
- }
- }
- return true;
- }
-
- private static String getFirstDenied(int[] grantResults, String[] permissions) {
- for (int i = 0; i < grantResults.length; ++i) {
- if (grantResults[i] == PackageManager.PERMISSION_DENIED) {
- return permissions[i];
- }
- }
- return null;
- }
-
public void startDownloadable(Message message) {
if (!Config.ONLY_INTERNAL_STORAGE && !hasStoragePermission(REQUEST_START_DOWNLOAD)) {
this.mPendingDownloadableMessage = message;
@@ -2087,7 +2086,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
int i = getIndexOf(first.getUuid(), this.messageList);
pos = i < 0 ? bottom : i;
}
- this.binding.messagesView.setSelection(pos);
+ setSelection(pos);
}
}
// todo add swipe listener --> causes strange scrolling in chats
@@ -2104,6 +2103,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return true;
}
+ private void setSelection(int pos) {
+ this.binding.messagesView.setSelection(pos);
+ this.binding.messagesView.post(() -> this.binding.messagesView.setSelection(pos));
+ }
+
private boolean scrolledToBottom() {
if (this.binding == null) {
return false;