1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-25 15:32:52 +00:00

Fixed scroll position

This commit is contained in:
M66B 2020-05-05 17:39:07 +02:00
parent 270c6d3ded
commit e30e4d47e1
2 changed files with 6 additions and 2 deletions

View file

@ -4090,11 +4090,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int line = tvBody.getLayout().getLineForOffset(pos);
int y = tvBody.getLayout().getLineTop(line);
int dy = Helper.dp2pixels(context, 48);
Rect rect = new Rect();
tvBody.getDrawingRect(rect);
((ViewGroup) itemView).offsetDescendantRectToMyCoords(tvBody, rect);
properties.scrollTo(apos, rect.top + y);
properties.scrollTo(apos, rect.top + y - dy);
} catch (Throwable ex) {
Log.e(ex);
}

View file

@ -1546,7 +1546,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void run() {
LinearLayoutManager llm = (LinearLayoutManager) rvMessage.getLayoutManager();
llm.scrollToPositionWithOffset(pos, -y);
View child = llm.getChildAt(pos);
int dy = (child == null ? 0 : llm.getTopDecorationHeight(child));
llm.scrollToPositionWithOffset(pos, -y - dy);
}
});
}