Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
5b19c90a
Commit
5b19c90a
authored
May 15, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chat messages scroll corrected: chat was not scrolled down for new messages in some situations.
parent
9937f1ba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
ChatViewerFragment.java
...c/main/java/com/xabber/android/ui/ChatViewerFragment.java
+17
-15
No files found.
app/src/main/java/com/xabber/android/ui/ChatViewerFragment.java
View file @
5b19c90a
...
...
@@ -215,10 +215,17 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
});
updateChat
();
return
view
;
}
@Override
public
void
onResume
()
{
super
.
onResume
();
listener
.
registerChat
(
this
);
updateChat
();
restoreInputState
();
}
@Override
public
void
onDetach
()
{
...
...
@@ -267,16 +274,6 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
}
}
@Override
public
void
onResume
()
{
super
.
onResume
();
listener
.
registerChat
(
this
);
updateChat
();
restoreInputState
();
}
public
void
restoreInputState
()
{
skipOnTextChanges
=
true
;
...
...
@@ -361,7 +358,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
public
void
updateChat
()
{
ContactTitleInflater
.
updateTitle
(
contactTitleView
,
getActivity
(),
abstractContact
);
int
itemCountBeforeUpdate
=
recyclerView
.
getAdapter
()
.
getItemCount
();
int
itemCountBeforeUpdate
=
chatMessageAdapter
.
getItemCount
();
chatMessageAdapter
.
onChange
();
scrollChat
(
itemCountBeforeUpdate
);
setUpOptionsMenu
(
toolbar
.
getMenu
());
...
...
@@ -369,9 +366,14 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
}
private
void
scrollChat
(
int
itemCountBeforeUpdate
)
{
if
(
layoutManager
.
findLastVisibleItemPosition
()
==
(
itemCountBeforeUpdate
-
1
))
{
recyclerView
.
scrollToPosition
(
chatMessageAdapter
.
getItemCount
()
-
1
);
int
lastVisibleItemPosition
=
layoutManager
.
findLastVisibleItemPosition
();
if
(
lastVisibleItemPosition
==
-
1
||
lastVisibleItemPosition
==
(
itemCountBeforeUpdate
-
1
))
{
scrollDown
();
}
}
private
void
scrollDown
()
{
recyclerView
.
scrollToPosition
(
chatMessageAdapter
.
getItemCount
()
-
1
);
}
private
void
updateSecurityButton
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment