Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/ru/sawim/view/ChatView.java
- IDEA additional info:
- Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
- <+>UTF-8
- ===================================================================
- --- src/ru/sawim/view/ChatView.java (date 1397838109000)
- +++ src/ru/sawim/view/ChatView.java (revision )
- @@ -72,6 +72,7 @@
- private String sharingText;
- private boolean sendByEnter;
- +
- private RosterAdapter chatsSpinnerAdapter;
- private MessagesAdapter adapter;
- private EditText messageEditor;
- @@ -445,10 +446,12 @@
- if (chat == null) return;
- initChat(protocol, contact);
- oldChat = chat.getContact().getUserId();
- - View item = chatListView.getChildAt(0);
- +
- chat.scrollPosition = chatListView.getFirstVisiblePosition();
- + View item = chatListView.getChildAt(0);
- chat.offset = (item == null) ? 0 : Math.abs(item.getBottom());
- chat.dividerPosition = chat.getMessCount();
- + chat.isBottomScroll = chat.dividerPosition == chatListView.getLastVisiblePosition() + 1;
- chat.message = getText().length() == 0 ? null : getText();
- chat.setVisibleChat(false);
- @@ -503,7 +506,14 @@
- }
- } else {
- //chatListView.setSelectionFromTop(chat.scrollPosition + 1, chat.offset - (isLastPosition() ? 0 : chat.offset / 2));
- - chatListView.setSelectionFromTop(chat.scrollPosition + (isLastPosition() ? 1 : 2), chat.offset);
- + if(!chat.isBottomScroll || unreadMessageCount == 0)
- + {
- + chatListView.setSelectionFromTop(chat.scrollPosition + 1, chat.offset);
- + }
- + else
- + {
- + chatListView.setSelectionFromTop(chat.getMessData().size() - unreadMessageCount,67);
- + }
- }
- adapter.refreshList(chat.getMessData());
- chatListView.postDelayed(new Runnable() {
- \ No newline at end of file
- Index: src/ru/sawim/chat/Chat.java
- IDEA additional info:
- Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
- <+>UTF-8
- ===================================================================
- --- src/ru/sawim/chat/Chat.java (date 1397838109000)
- +++ src/ru/sawim/chat/Chat.java (revision )
- @@ -33,6 +33,7 @@
- public int scrollPosition;
- public int offset;
- public int dividerPosition;
- + public boolean isBottomScroll;
- public Chat(Protocol p, Contact item) {
- contact = item;
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement