mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 15:58:34 +00:00
Fix and simplify Y translation calculation for Conversation.
This commit is contained in:
parent
c24d285cd3
commit
b06152ba58
@ -236,20 +236,14 @@ public class ConversationFragment extends Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setListVerticalTranslation() {
|
private void setListVerticalTranslation() {
|
||||||
int heightOfChildren = 0;
|
if (list.canScrollVertically(1) || list.canScrollVertically(-1) || list.getChildCount() == 0) {
|
||||||
for (int i = 0; i < list.getChildCount(); i++) {
|
|
||||||
heightOfChildren += list.getChildAt(i).getMeasuredHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.i(TAG, "Height of children: " + heightOfChildren + " my height: " + list.getMeasuredHeight());
|
|
||||||
if (heightOfChildren > list.getMeasuredHeight()) {
|
|
||||||
list.setTranslationY(0);
|
list.setTranslationY(0);
|
||||||
list.setOverScrollMode(RecyclerView.OVER_SCROLL_IF_CONTENT_SCROLLS);
|
list.setOverScrollMode(RecyclerView.OVER_SCROLL_IF_CONTENT_SCROLLS);
|
||||||
} else {
|
} else {
|
||||||
list.setTranslationY(heightOfChildren - list.getMeasuredHeight());
|
int chTop = list.getChildAt(list.getChildCount() - 1).getTop();
|
||||||
|
list.setTranslationY(Math.min(0, -chTop));
|
||||||
list.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
|
list.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
listener.onListVerticalTranslationChanged(list.getTranslationY());
|
listener.onListVerticalTranslationChanged(list.getTranslationY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user