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 1400331337000)
- +++ src/ru/sawim/view/ChatView.java (revision )
- @@ -72,6 +72,7 @@
- private Contact contact;
- private String sharingText;
- private boolean sendByEnter;
- + private static int offsetNewMessage;
- private RosterAdapter chatsSpinnerAdapter;
- private MessagesAdapter adapter;
- @@ -443,11 +444,14 @@
- if (chat == null) return;
- initChat(protocol, contact);
- oldChat = chat.getContact().getUserId();
- + View item = chatListView.getChildAt(0);
- chat.scrollPosition = chatListView.getFirstVisiblePosition();
- - chat.offset = chatListView.getHeight() / 4;
- + chat.offset = (item == null) ? 0 : Math.abs(item.getBottom());
- chat.dividerPosition = chat.getMessCount();
- chat.lastVisiblePosition = chatListView.getLastVisiblePosition() + 1;
- chat.message = getText().length() == 0 ? null : getText();
- + chat.isBottomScroll = (chat.lastVisiblePosition == chat.dividerPosition);
- + offsetNewMessage = chatListView.getHeight() / 4;
- chat.setVisibleChat(false);
- RosterHelper.getInstance().setOnUpdateChat(null);
- @@ -489,7 +493,8 @@
- }
- private void setPosition(int unreadMessageCount) {
- - boolean hasHistory = chat.getHistory() != null && chat.getHistory().getHistorySize() > 0 && !chat.isBlogBot();
- + boolean hasHistory;
- + hasHistory = chat.getHistory() != null && chat.getHistory().getHistorySize() > 0 && !chat.isBlogBot();
- adapter.setPosition(chat.dividerPosition);
- int position = chat.getMessData().size() - unreadMessageCount;
- if (chat.dividerPosition == -1) {
- @@ -500,15 +505,11 @@
- chatListView.setSelection(position);
- }
- } else {
- - boolean isBottomScroll = chat.lastVisiblePosition == chat.dividerPosition;
- - if (isBottomScroll && unreadMessageCount == 0 && isLastPosition()) {
- - chatListView.setSelectionFromTop(chat.lastVisiblePosition, -(chat.offset * 4));
- - } else {
- - if (!isBottomScroll || unreadMessageCount == 0) {
- +
- + if (!chat.isBottomScroll || unreadMessageCount == 0) {
- - chatListView.setSelectionFromTop(chat.scrollPosition + 1, chat.offset);
- - } else {
- + chatListView.setSelectionFromTop(chat.scrollPosition + 1, chat.offset);
- + } else {
- - chatListView.setSelectionFromTop(position, chat.offset);
- - }
- + chatListView.setSelectionFromTop(chat.getMessData().size() - unreadMessageCount,offsetNewMessage );
- }
- }
- }
- \ 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 1400331337000)
- +++ src/ru/sawim/chat/Chat.java (revision )
- @@ -32,6 +32,7 @@
- public int offset;
- public int dividerPosition = -1;
- public int lastVisiblePosition;
- + 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