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 e01c84df8e

View File

@ -13,6 +13,7 @@ import android.view.ViewGroup;
import android.widget.Toast; import android.widget.Toast;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays; import java.util.Arrays;
import java.util.Timer; import java.util.Timer;
@ -305,7 +306,9 @@ public class PlayerController {
public static void setSponsorBarRect(final Object self) { public static void setSponsorBarRect(final Object self) {
try { 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) { if (rect != null) {
setSponsorBarAbsoluteLeft(rect.left); setSponsorBarAbsoluteLeft(rect.left);
setSponsorBarAbsoluteRight(rect.right); setSponsorBarAbsoluteRight(rect.right);