Skip to content

Commit

Permalink
Run getGlobalVisibleRect on the main thread instead of a background t…
Browse files Browse the repository at this point in the history
…hread.
  • Loading branch information
jsligh committed Jan 17, 2024
1 parent 7653e7f commit c739139
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ public String getDefaultPosition() {
public String getCurrentPosition() {
JSONObject position = new JSONObject();
Rect rect = new Rect();

adBaseView.getGlobalVisibleRect(rect);

Handler mainHandler = new Handler(Looper.getMainLooper());
mainHandler.post(() -> adBaseView.getGlobalVisibleRect(rect));
try {
position.put(JSON_X, (int) (rect.left / Utils.DENSITY));
position.put(JSON_Y, (int) (rect.top / Utils.DENSITY));
Expand Down

0 comments on commit c739139

Please sign in to comment.