Merge pull request #22 from caneleex/patch/setSponsorBarRect-impl

fix field access in setSponsorBarReact
This commit is contained in:
KevinX8 2021-04-18 23:39:02 +01:00 committed by GitHub
commit 261560c983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import android.view.ViewGroup;
import android.widget.Toast;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Timer;
@ -305,7 +306,9 @@ public class PlayerController {
public static void setSponsorBarRect(final Object self) {
try {
Rect rect = ((Rect) self.getClass().getField("e").get(self));
Field field = self.getClass().getDeclaredField("e");
field.setAccessible(true);
Rect rect = (Rect) field.get(self);
if (rect != null) {
setSponsorBarAbsoluteLeft(rect.left);
setSponsorBarAbsoluteRight(rect.right);