|
|
@@ -0,0 +1,37 @@
|
|
|
+package com.miekir.newmvp;
|
|
|
+
|
|
|
+import android.util.Log;
|
|
|
+
|
|
|
+import org.aspectj.lang.ProceedingJoinPoint;
|
|
|
+import org.aspectj.lang.annotation.After;
|
|
|
+import org.aspectj.lang.annotation.Around;
|
|
|
+import org.aspectj.lang.annotation.Aspect;
|
|
|
+import org.aspectj.lang.annotation.Pointcut;
|
|
|
+
|
|
|
+import java.lang.reflect.Method;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 加载框
|
|
|
+ */
|
|
|
+@Aspect
|
|
|
+public class LoadingAspect {
|
|
|
+ private static final String TAG = "LoadingAspect";
|
|
|
+ //https://blog.csdn.net/zhengchao1991/article/details/53391244
|
|
|
+ @Pointcut("@annotation(com.miekir.mvp.base.NeedLoading)")
|
|
|
+ public void timeTask() {}
|
|
|
+
|
|
|
+ @After("timeTask()")
|
|
|
+ public void onTimeTaskAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
|
|
+ // 注入加载框
|
|
|
+ Log.e("log", "do loading");
|
|
|
+// Object targetObject = joinPoint.getTarget();
|
|
|
+// try {
|
|
|
+// Method m = targetObject.getClass().getMethod("showLoading");
|
|
|
+// m.invoke(targetObject);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+
|
|
|
+ joinPoint.proceed();
|
|
|
+ }
|
|
|
+}
|