mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 23:43:07 +00:00
Fixed scroll position
This commit is contained in:
parent
270c6d3ded
commit
e30e4d47e1
2 changed files with 6 additions and 2 deletions
|
@ -4090,11 +4090,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
int line = tvBody.getLayout().getLineForOffset(pos);
|
int line = tvBody.getLayout().getLineForOffset(pos);
|
||||||
int y = tvBody.getLayout().getLineTop(line);
|
int y = tvBody.getLayout().getLineTop(line);
|
||||||
|
|
||||||
|
int dy = Helper.dp2pixels(context, 48);
|
||||||
|
|
||||||
Rect rect = new Rect();
|
Rect rect = new Rect();
|
||||||
tvBody.getDrawingRect(rect);
|
tvBody.getDrawingRect(rect);
|
||||||
((ViewGroup) itemView).offsetDescendantRectToMyCoords(tvBody, rect);
|
((ViewGroup) itemView).offsetDescendantRectToMyCoords(tvBody, rect);
|
||||||
|
|
||||||
properties.scrollTo(apos, rect.top + y);
|
properties.scrollTo(apos, rect.top + y - dy);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1546,7 +1546,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LinearLayoutManager llm = (LinearLayoutManager) rvMessage.getLayoutManager();
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue