柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 UmengInitializer.java 源代码,内容仅作参考
package net.duohuo.magappx;
import android.app.Application;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.alibaba.fastjson.JSONObject;
import com.baidu.location.LocationClient;
import com.baidu.mapapi.SDKInitializer;
import com.haodanku.sdk.Hdk;
import com.huawei.hms.framework.common.ContainerUtils;
import com.jianpuzhaitong.forum.R;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.message.IUmengRegisterCallback;
import com.umeng.message.PushAgent;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;
import net.duohuo.alibctrade.AlibcTradeUtil;
import net.duohuo.cloudad.CloudAdUtil;
import net.duohuo.core.ITongdunOperation;
import net.duohuo.core.dialog.DialogCallBack;
import net.duohuo.core.dialog.IDialog;
import net.duohuo.core.ioc.Instance;
import net.duohuo.core.ioc.Ioc;
import net.duohuo.core.util.SafeJsonUtil;
import net.duohuo.dataview.AdnetCustomDataView;
import net.duohuo.magapp.onlinevoice.CreateVoiceUtil;
import net.duohuo.magappx.common.service.ConfigService;
import net.duohuo.magappx.common.util.PermissionChecker;
import net.duohuo.magappx.common.util.StatisticsReport;
import net.duohuo.magappx.common.view.ActionSheet;
import net.duohuo.magappx.main.login.UserApi;
import net.duohuo.magappx.main.login.model.UserPreference;
import net.duohuo.magappx.main.user.BlackListActivity;
import net.duohuo.webview.AbstractBizWebView;
import org.android.agoo.huawei.HuaWeiRegister;
import org.android.agoo.mezu.MeizuRegister;
import org.android.agoo.oppo.OppoRegister;
import org.android.agoo.vivo.VivoRegister;
import org.android.agoo.xiaomi.MiPushRegistar;
public class UmengInitializer {
public static void init(Application application) {
UMConfigure.init(application, application.getResources().getString(R.string.um_appkey), "Channel ID", 1, application.getResources().getString(R.string.um_smg_secret));
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.LEGACY_AUTO);
try {
PushAgent pushAgent = PushAgent.getInstance(application);
pushAgent.register(new IUmengRegisterCallback() {
@Override
public void onFailure(String str, String str2) {
}
@Override
public void onSuccess(String str) {
StatisticsReport.deviceToken = str;
}
});
pushAgent.setPushIntentServiceClass(MyPushIntentService.class);
} catch (Exception unused) {
}
if (!TextUtils.isEmpty(application.getString(R.string.huaweiid))) {
HuaWeiRegister.register(application);
}
if (!TextUtils.isEmpty(application.getString(R.string.xiaomiid))) {
MiPushRegistar.register(application, application.getString(R.string.xiaomiid), application.getString(R.string.xiaomikey));
}
if (!TextUtils.isEmpty(application.getString(R.string.meizuid))) {
MeizuRegister.register(application, application.getString(R.string.meizuid), application.getString(R.string.meizuid));
}
if (!TextUtils.isEmpty(application.getString(R.string.oppokey))) {
OppoRegister.register(application, application.getString(R.string.oppokey), application.getString(R.string.opposecret));
}
if (!TextUtils.isEmpty(application.getString(R.string.vivoid))) {
VivoRegister.register(application);
}
PlatformConfig.setWeixin(application.getResources().getString(R.string.wx_appid), application.getResources().getString(R.string.wx_secret));
PlatformConfig.setWXFileProvider(application.getPackageName() + ".fileprovider");
PlatformConfig.setSinaWeibo(application.getResources().getString(R.string.sina_appid), application.getResources().getString(R.string.sina_secret), "http://www.baidu.com");
PlatformConfig.setSinaFileProvider(application.getPackageName() + ".fileprovider");
PlatformConfig.setQQZone(application.getResources().getString(R.string.qq_appid), application.getResources().getString(R.string.qq_secret));
PlatformConfig.setQQFileProvider(application.getPackageName() + ".fileprovider");
UMShareAPI.get(application);
MobclickAgent.setScenarioType(application, MobclickAgent.EScenarioType.E_UM_NORMAL);
AbstractBizWebView.initX5Env(application);
SDKInitializer.setAgreePrivacy(application, true);
SDKInitializer.initialize(application);
LocationClient.setAgreePrivacy(true);
try {
if (!TextUtils.isEmpty(application.getString(R.string.android_partner_key))) {
Ioc.bind(MyTongdunOperation.class).to(ITongdunOperation.class).scope(Instance.InstanceScope.SCOPE_SINGLETON);
((ITongdunOperation) Ioc.get(ITongdunOperation.class)).init(application);
} else {
Ioc.bind(MyTongdunOperation.class).to(ITongdunOperation.class).scope(Instance.InstanceScope.SCOPE_SINGLETON);
}
} catch (Exception e) {
e.printStackTrace();
}
String loadCloudAdIdByType = ((ConfigService) Ioc.get(ConfigService.class)).loadCloudAdIdByType("media_id");
if (!TextUtils.isEmpty(loadCloudAdIdByType)) {
CloudAdUtil.init(application, loadCloudAdIdByType);
}
if (!TextUtils.isEmpty(application.getResources().getString(R.string.xunfei))) {
CreateVoiceUtil.initVoice(application, ContainerUtils.KEY_VALUE_DELIMITER + application.getResources().getString(R.string.xunfei));
}
boolean isEmpty = TextUtils.isEmpty(((SiteConfig) Ioc.get(SiteConfig.class)).kdhAppKey);
if (!isEmpty) {
Hdk.init(application, isEmpty ? "143ea247f2" : ((SiteConfig) Ioc.get(SiteConfig.class)).kdhAppKey, new Hdk.InitCallback() {
@Override
public void onResult(int i, String str) {
}
}, true);
}
AdnetCustomDataView.cloudAdIdByType = new AdnetCustomDataView.CloudAdIdByType() {
@Override
public String getId(String str) {
return ((ConfigService) Ioc.get(ConfigService.class)).loadCloudAdIdByType(str);
}
};
AdnetCustomDataView.closecallback = new AdnetCustomDataView.Closecallback() {
@Override
public void onClick(Context context, final View.OnClickListener onClickListener) {
final ActionSheet actionSheet = new ActionSheet(context);
SiteConfig siteConfig = (SiteConfig) Ioc.get(SiteConfig.class);
if ("1".equals(siteConfig.global_cloud_ad_close_open)) {
View inflate = LayoutInflater.from(context).inflate(R.layout.action_sheet_item, (ViewGroup) null);
TextView textView = (TextView) inflate.findViewById(R.id.name);
textView.setText(siteConfig.global_cloud_ad_close_txt);
textView.setTextColor(Color.parseColor("#FF3B30"));
inflate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!UserApi.checkLogin()) {
UserApi.afterLogin(Ioc.getCurrentActivity(), new UserApi.LoginCallBack() {
@Override
public void onLogin() {
}
});
} else if (((UserPreference) Ioc.get(UserPreference.class)).cloud_ad_close_open) {
onClickListener.onClick(null);
} else {
final JSONObject parseJSONObject = SafeJsonUtil.parseJSONObject(((UserPreference) Ioc.get(UserPreference.class)).cloud_ad_close_config);
((IDialog) Ioc.get(IDialog.class)).showDialog(Ioc.getCurrentActivity(), "提示", SafeJsonUtil.getString(parseJSONObject, "des"), "取消", SafeJsonUtil.getString(parseJSONObject, "right_button_txt"), new DialogCallBack() {
@Override
public void onClick(int i) {
if (i == -1) {
UrlScheme.toUrl(Ioc.getCurrentActivity(), SafeJsonUtil.getString(parseJSONObject, "link"));
}
}
});
}
actionSheet.dismiss();
}
});
actionSheet.addItemView(inflate);
}
View inflate2 = LayoutInflater.from(context).inflate(R.layout.action_sheet_item, (ViewGroup) null);
((TextView) inflate2.findViewById(R.id.name)).setText("关闭此条广告");
inflate2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onClickListener.onClick(null);
actionSheet.dismiss();
}
});
actionSheet.addItemView(inflate2);
actionSheet.show(Ioc.getCurrentActivity());
}
@Override
public boolean withoutAd() {
return ((UserPreference) Ioc.get(UserPreference.class)).cloud_ad_close_open;
}
};
AlibcTradeUtil.init(application);
PermissionChecker.reset();
BlackListActivity.initBlackList();
}
}