mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-29 21:25:35 +00:00
Bug 1337947 - Fix tab strip item offsets for RTL. r=maliu
MozReview-Commit-ID: HrOETozOSfW --HG-- extra : rebase_source : e051b92d9b3b5105fe9a054b667b2334180e938f
This commit is contained in:
parent
6e7d85d68f
commit
0a9827ccd3
@ -68,8 +68,16 @@ class TabStripDividerItem extends RecyclerView.ItemDecoration {
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
final int position = parent.getChildAdapterPosition(view);
|
||||
final int leftOffset = position == 0 ? 0 : margin;
|
||||
final int rightOffset = position == parent.getAdapter().getItemCount() - 1 ? 0 : margin;
|
||||
|
||||
// RTL positions start from the right, but offsets are still LTR since view is LTR.
|
||||
final int leftOffset, rightOffset;
|
||||
if (ViewUtils.isLayoutRtl(parent)) {
|
||||
leftOffset = position == parent.getAdapter().getItemCount() - 1 ? 0 : margin;
|
||||
rightOffset = position == 0 ? 0 : margin;
|
||||
} else {
|
||||
leftOffset = position == 0 ? 0 : margin;
|
||||
rightOffset = position == parent.getAdapter().getItemCount() - 1 ? 0 : margin;
|
||||
}
|
||||
|
||||
outRect.set(leftOffset, 0, rightOffset, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user