mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-18 20:07:19 +01:00
111 lines
3.8 KiB
Java
111 lines
3.8 KiB
Java
package androidx.transition;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.graphics.Matrix;
|
|
import android.util.Log;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RequiresApi;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import okio.Buffer$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RequiresApi(21)
|
|
/* loaded from: classes14.dex */
|
|
class GhostViewPlatform implements GhostView {
|
|
private static final String TAG = "GhostViewApi21";
|
|
private static Method sAddGhostMethod;
|
|
private static boolean sAddGhostMethodFetched;
|
|
private static Class<?> sGhostViewClass;
|
|
private static boolean sGhostViewClassFetched;
|
|
private static Method sRemoveGhostMethod;
|
|
private static boolean sRemoveGhostMethodFetched;
|
|
private final View mGhostView;
|
|
|
|
private GhostViewPlatform(@NonNull View view) {
|
|
this.mGhostView = view;
|
|
}
|
|
|
|
@SuppressLint({"BanUncheckedReflection"})
|
|
public static GhostView addGhost(View view, ViewGroup viewGroup, Matrix matrix) {
|
|
fetchAddGhostMethod();
|
|
Method method = sAddGhostMethod;
|
|
if (method != null) {
|
|
try {
|
|
return new GhostViewPlatform((View) method.invoke(null, view, viewGroup, matrix));
|
|
} catch (IllegalAccessException unused) {
|
|
} catch (InvocationTargetException e) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m(e.getCause());
|
|
return null;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private static void fetchAddGhostMethod() {
|
|
if (sAddGhostMethodFetched) {
|
|
return;
|
|
}
|
|
try {
|
|
fetchGhostViewClass();
|
|
Method declaredMethod = sGhostViewClass.getDeclaredMethod("addGhost", View.class, ViewGroup.class, Matrix.class);
|
|
sAddGhostMethod = declaredMethod;
|
|
declaredMethod.setAccessible(true);
|
|
} catch (NoSuchMethodException e) {
|
|
Log.i(TAG, "Failed to retrieve addGhost method", e);
|
|
}
|
|
sAddGhostMethodFetched = true;
|
|
}
|
|
|
|
private static void fetchGhostViewClass() {
|
|
if (sGhostViewClassFetched) {
|
|
return;
|
|
}
|
|
try {
|
|
sGhostViewClass = Class.forName("android.view.GhostView");
|
|
} catch (ClassNotFoundException e) {
|
|
Log.i(TAG, "Failed to retrieve GhostView class", e);
|
|
}
|
|
sGhostViewClassFetched = true;
|
|
}
|
|
|
|
private static void fetchRemoveGhostMethod() {
|
|
if (sRemoveGhostMethodFetched) {
|
|
return;
|
|
}
|
|
try {
|
|
fetchGhostViewClass();
|
|
Method declaredMethod = sGhostViewClass.getDeclaredMethod("removeGhost", View.class);
|
|
sRemoveGhostMethod = declaredMethod;
|
|
declaredMethod.setAccessible(true);
|
|
} catch (NoSuchMethodException e) {
|
|
Log.i(TAG, "Failed to retrieve removeGhost method", e);
|
|
}
|
|
sRemoveGhostMethodFetched = true;
|
|
}
|
|
|
|
@SuppressLint({"BanUncheckedReflection"})
|
|
public static void removeGhost(View view) {
|
|
fetchRemoveGhostMethod();
|
|
Method method = sRemoveGhostMethod;
|
|
if (method != null) {
|
|
try {
|
|
method.invoke(null, view);
|
|
} catch (IllegalAccessException unused) {
|
|
} catch (InvocationTargetException e) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m(e.getCause());
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // androidx.transition.GhostView
|
|
public void setVisibility(int i) {
|
|
this.mGhostView.setVisibility(i);
|
|
}
|
|
|
|
@Override // androidx.transition.GhostView
|
|
public void reserveEndViewTransition(ViewGroup viewGroup, View view) {
|
|
}
|
|
}
|