This commit is contained in:
wangcongtao
2020-10-21 11:06:06 +08:00
parent 3c5a59cab1
commit d76cdb1eb3

View File

@@ -23,6 +23,8 @@ public class BnHooker implements InvocationHandler {
private static final String TAG = "BnHooker";
private Object host;
private Method getGLMapEngineMethod;
private GLMapEngine glMapEngineObject;
public BnHooker( AMap map ) throws Exception {
@@ -47,11 +49,17 @@ public class BnHooker implements InvocationHandler {
}
public void clearAllMessages() throws Exception {
Method method = host.getClass().getDeclaredMethod( "getGLMapEngine" );
method.setAccessible( true );
GLMapEngine glMapEngine = ( GLMapEngine ) method.invoke( host );
clearMessageList( "mStateMessageList", glMapEngine );
clearMessageList( "mAnimateStateMessageList", glMapEngine );
if ( glMapEngineObject == null ) {
if ( getGLMapEngineMethod == null ) {
getGLMapEngineMethod = host.getClass().getDeclaredMethod( "getGLMapEngine" );
getGLMapEngineMethod.setAccessible( true );
}
glMapEngineObject = ( GLMapEngine ) getGLMapEngineMethod.invoke( host );
}
if ( glMapEngineObject != null ) {
clearMessageList( "mStateMessageList", glMapEngineObject );
clearMessageList( "mAnimateStateMessageList", glMapEngineObject );
}
}
private void clearMessageList( String filedName, Object obj ) throws Exception {