Fixed scroll position

pull/178/head
M66B 5 years ago
parent 270c6d3ded
commit e30e4d47e1

@ -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…
Cancel
Save