Commit 7d7cbafb authored by xujialang's avatar xujialang

增加广播回调的动态代理

parent 30f3e9c9
......@@ -12,6 +12,7 @@ public class NameInterfaceHelp {
private static String FG_Class_Path = "";
private static String FG_StartCallback_Class_Path = "";
private static String FG_NotificationConfig_Class_Path = "";
private static String Action_Listener_Class_Path = "";
private static String FG_Start_Method_Name = "";
public static String getClassPath() {
......@@ -126,6 +127,31 @@ public class NameInterfaceHelp {
return FG_NotificationConfig_Class_Path;
}
/**
* 获取ActionListener类的路径
*/
public static String getActionListenerClassPath() {
if (TextUtils.isEmpty(Action_Listener_Class_Path)) {
try {
Class<?> kpClass = Class.forName(NameInterfaceHelp.getClassPath());
Method fNameMethod = kpClass.getMethod(NameInterfaceHelp.GetFGStringMethod, String.class);
Object fgStr = fNameMethod.invoke(null, "ActionListener");
if (fgStr == null) {
Action_Listener_Class_Path = "";
} else {
Action_Listener_Class_Path = (String) fgStr;
}
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
IllegalAccessException ignored) {
LogUtil.d("OutShow 反射获取 getActionListenerClassPath (catch) " + ignored);
}
}
LogUtil.d("OutShow getActionListenerClassPath=" + Action_Listener_Class_Path);
return Action_Listener_Class_Path;
}
public static Object getNewCallBack() {
try {
Class<?> kpClass = Class.forName(NameInterfaceHelp.getClassPath());
......@@ -141,13 +167,40 @@ public class NameInterfaceHelp {
}
public static Object getActionListener() {
try {
Class<?> kpClass = Class.forName(NameInterfaceHelp.getClassPath());
Method callBackMethod = kpClass.getMethod(NameInterfaceHelp.GetActionListenerMethod);
return callBackMethod.invoke(null);
} catch (ClassNotFoundException | InvocationTargetException | NoSuchMethodException |
IllegalAccessException ignored) {
LogUtil.d("OutShow 反射获取 getActionListener (catch) " + ignored);
}
return null;
}
/**
* 获取FG相关名称或路径的方法名称
*/
public static String GetFGStringMethod = "getFName";
/**
* 拉起弹窗的回调实例的方法名称
*/
public static String GetNewCallBackMethod = "getNewCallBack";
/**
* 接收广播的回调实例的方法名称
*/
public static String GetActionListenerMethod = "getActionListener";
/**
* 添加广告回调的方法名称
*/
public static String RegisterActionMethod = "registerAction";
/**
* 获取保活方法的方法名称
*/
......
This diff is collapsed.
......@@ -9,6 +9,7 @@ import com.zl.sdk.bean.OutAdData;
import com.zl.sdk.bean.RemindersInfo;
import com.zl.sdk.event.statistics.Statistics;
import com.zl.sdk.icon.IconHelp;
import com.zl.sdk.out.CheckHelper;
import com.zl.sdk.util.LogUtil;
import org.json.JSONException;
......@@ -247,6 +248,7 @@ public final class EventUtils {
hashMap.put(AdsParamsInfo.AD_CURRENCYCode, bean.currencyCode);
hashMap.put(AdsParamsInfo.AD_VALUEMICROS, String.valueOf(bean.valueMicros));
hashMap.put(AdsParamsInfo.AD_SCENES, bean.ad_scenes);
hashMap.put(AdsParamsInfo.NET, CheckHelper.isNetworkAvailable(OutHelp.get().getContext()) ? "1" : "0");
hashMap.put("hide", String.valueOf(IconHelp.get().isIconHide()));
if (!TextUtils.isEmpty(bean.eventid)) {
if (!bean.eventid.equals(AdsParamsInfo.F_REQUEST)) {
......
......@@ -345,7 +345,6 @@ public class OutAdManager extends BaseOutShowManager {
outDialogShowFail(context, actionFrom, remindersInfo, data, reason);
}
});
} catch (Exception e) {
LogUtil.d(TAG + "广告弹窗 拉起失败 catch 不再重试");
returnFailCallBack("slk show fail");
......@@ -467,6 +466,7 @@ public class OutAdManager extends BaseOutShowManager {
// LogUtil.d(TAG + "加载广告(原生) adData :" + normalAdData);
// TopOnAdLoadManager.getInstance().loadNativeAd(normalAdData, AdScenes.AD_SCENES_PURE);
// } else
if (OutAdData.CP_AD_TYPE_CHAPING.equals(normalAdData.cpAdtype)) {
LogUtil.d(TAG + "加载广告(插屏) adData :" + normalAdData);
hadStartAdDialogFail = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment