Fix divider positioning logic.

When the divider was to be drawn relative to a view, it utilized methods
such getLeft() and getRight(). These methods returned a position
relative to that View's parent. This parent is not necessarily the
container and thus, the divider would be drawn at an incorrect position.

Instead, utilize getGlobalVisibleRect(), which returns a bounding box of
the view in global coordinates. Then, compare these coordinates with
that of the container to retrieve the relative positioning.

Test: Test on sample app.
Bug: 70354251
Change-Id: I335bbfe49d4d3761b990ac8092863951a2603c9e
diff --git a/car/src/main/java/androidx/car/widget/PagedListView.java b/car/src/main/java/androidx/car/widget/PagedListView.java
index 16593b9..c821286 100644
--- a/car/src/main/java/androidx/car/widget/PagedListView.java
+++ b/car/src/main/java/androidx/car/widget/PagedListView.java
@@ -1033,8 +1033,18 @@
                     continue;
                 }
 
-                int left = mDividerStartMargin + startChild.getLeft();
-                int right = endChild.getRight();
+                Rect containerRect = new Rect();
+                container.getGlobalVisibleRect(containerRect);
+
+                Rect startRect = new Rect();
+                startChild.getGlobalVisibleRect(startRect);
+
+                Rect endRect = new Rect();
+                endChild.getGlobalVisibleRect(endRect);
+
+                int left = container.getLeft() + mDividerStartMargin
+                        + (startRect.left - containerRect.left);
+                int right = container.getRight() - (endRect.right - containerRect.right);
                 int bottom = container.getBottom() + spacing / 2 + mDividerHeight / 2;
                 int top = bottom - mDividerHeight;