From 2b19bc850d354b7e5ffd185a89320e8b6a914d77 Mon Sep 17 00:00:00 2001 From: Constantin Piber <59023762+cpiber@users.noreply.github.com> Date: Sat, 14 Feb 2026 17:36:28 +0100 Subject: [PATCH] Introduce `Rect.set` (#1900) * Introduce `Rect.set` As used by Young Jump+ Also fixes the `Rect(Rect)` constructor to use the correct values * Missing line --- .../src/main/java/android/graphics/Rect.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/AndroidCompat/src/main/java/android/graphics/Rect.java b/AndroidCompat/src/main/java/android/graphics/Rect.java index 67c28f134..e57a933ee 100644 --- a/AndroidCompat/src/main/java/android/graphics/Rect.java +++ b/AndroidCompat/src/main/java/android/graphics/Rect.java @@ -37,13 +37,27 @@ public final class Rect { this.right = 0; this.bottom = 0; } else { - this.left = left; - this.top = top; - this.right = right; - this.bottom = bottom; + this.left = r.left; + this.top = r.top; + this.right = r.right; + this.bottom = r.bottom; } } + public void set(int left, int top, int right, int bottom) { + this.left = left; + this.top = top; + this.right = right; + this.bottom = bottom; + } + + public void set(Rect r) { + this.left = r.left; + this.top = r.top; + this.right = r.right; + this.bottom = r.bottom; + } + public final int getWidth() { return right - left; }