柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 MajiaApplication.java 源代码,内容仅作参考
package net.duohuo.magappx;
import android.app.ActivityManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Process;
import android.webkit.WebView;
import androidx.multidex.MultiDexApplication;
import com.alibaba.fastjson.parser.ParserConfig;
import com.danikula.videocache.HttpProxyCacheServer;
import com.facebook.cache.disk.DiskCacheConfig;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.backends.okhttp3.OkHttpImagePipelineConfigFactory;
import com.facebook.imagepipeline.decoder.ProgressiveJpegConfig;
import com.facebook.imagepipeline.image.ImmutableQualityInfo;
import com.facebook.imagepipeline.image.QualityInfo;
import com.jianpuzhaitong.forum.R;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.tencent.ijk.media.player.IjkMediaMeta;
import java.io.File;
import java.util.List;
import java.util.concurrent.TimeUnit;
import net.duohuo.core.Const;
import net.duohuo.core.dataview.TypeBean;
import net.duohuo.core.dataview.TypeBeanDeserializer;
import net.duohuo.core.db.DbUpgradeChain;
import net.duohuo.core.db.DbUpgradeHandler;
import net.duohuo.core.db.DhDB;
import net.duohuo.core.dialog.IDialog;
import net.duohuo.core.eventbus.EventBus;
import net.duohuo.core.fresco.BitmapMemoryCacheParamsSupplier;
import net.duohuo.core.fresco.FrescoImageView;
import net.duohuo.core.ioc.ActivityManager;
import net.duohuo.core.ioc.Instance;
import net.duohuo.core.ioc.Ioc;
import net.duohuo.core.net.NetInterceptor;
import net.duohuo.core.util.IUtil;
import net.duohuo.core.util.LogUtil;
import net.duohuo.magapp.BuildConfig;
import net.duohuo.magapp.chat.util.MsgLog;
import net.duohuo.magappx.API;
import net.duohuo.magappx.common.model.TabConfig;
import net.duohuo.magappx.common.net.MagOkHttpNetworkFetcher;
import net.duohuo.magappx.common.net.RequestInterceptor;
import net.duohuo.magappx.common.util.AppPreference;
import net.duohuo.magappx.common.view.dialog.MagDialog;
import net.duohuo.magappx.common.web.MallHelper;
import net.duohuo.magappx.common.web.SimpleCookieJar;
import net.duohuo.magappx.main.IndexTabActivity;
import net.duohuo.magappx.main.login.model.UserPreference;
import net.duohuo.magappx.video.util.Utils;
import okhttp3.CookieJar;
import okhttp3.OkHttpClient;
public class MajiaApplication extends MultiDexApplication {
private static final String IMAGE_PIPELINE_CACHE_DIR = "image_cache";
private static final String IMAGE_PIPELINE_SMALL_CACHE_DIR = "image_small_cache";
private static final int MAX_DISK_SMALL_CACHE_SIZE = 209715200;
private static final int MAX_DISK_SMALL_ONLOWDISKSPACE_CACHE_SIZE = 26214400;
public static int assemblyRadius = 0;
public static int listRadius = 0;
public static final boolean refreshVibrate = false;
private HttpProxyCacheServer proxy;
public static HttpProxyCacheServer getProxy(Context context) {
MajiaApplication majiaApplication = (MajiaApplication) context.getApplicationContext();
HttpProxyCacheServer httpProxyCacheServer = majiaApplication.proxy;
if (httpProxyCacheServer != null) {
return httpProxyCacheServer;
}
HttpProxyCacheServer newProxy = majiaApplication.newProxy();
majiaApplication.proxy = newProxy;
return newProxy;
}
private HttpProxyCacheServer newProxy() {
return new HttpProxyCacheServer.Builder(this).maxCacheSize(IjkMediaMeta.AV_CH_STEREO_LEFT).cacheDirectory(Utils.getVideoCacheDir(this)).maxCacheFilesCount(30).build();
}
@Override
public void onCreate() {
super.onCreate();
Ioc.initApplication(this);
if ("com.jianpuzhaitong.forum".equals(getProcessName(this))) {
AppAbilitySplit.initConfig();
}
SharedPreferences sharedPreferences = getSharedPreferences("is_user_commit", 0);
if (BuildConfig.cjad.booleanValue()) {
System.loadLibrary("msaoaidsec");
}
ActivityManager activityManager = (ActivityManager) Ioc.get(ActivityManager.class);
registerActivityLifecycleCallbacks(activityManager.getActivityLifecycleCallbacks());
registerActivityLifecycleCallbacks(MallHelper.getActivityLifecycleCallbacks());
activityManager.setForeBackCallback(new ActivityManager.ForeBackCallback() {
@Override
public void changeToForeground() {
((EventBus) Ioc.get(EventBus.class)).fireEvent(API.Event.refresh_msg_count, new Object[0]);
MsgLog.log("changeToForeground");
}
@Override
public void changeToBackground() {
MsgLog.log("changeToBackground");
}
});
activityManager.setIndexActivity(IndexTabActivity.class);
if (sharedPreferences.getBoolean("isOk", false) && sharedPreferences.getBoolean("1046", false)) {
init();
}
}
public void init() {
if (Build.VERSION.SDK_INT >= 28) {
String processName = getProcessName();
if (!"com.jianpuzhaitong.forum".equals(processName)) {
WebView.setDataDirectorySuffix(processName);
}
}
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler());
ParserConfig.getGlobalInstance().putDeserializer(TypeBean.class, new TypeBeanDeserializer());
DataViewType.init();
Ioc.bind(MagDialog.class).to(IDialog.class).scope(Instance.InstanceScope.SCOPE_SINGLETON);
Ioc.bind(SimpleCookieJar.class).to(CookieJar.class).scope(Instance.InstanceScope.SCOPE_SINGLETON);
Ioc.bind(RequestInterceptor.class).to(NetInterceptor.class).scope(Instance.InstanceScope.SCOPE_SINGLETON);
Ioc.build(new Instance.BeanBuilder() {
@Override
public Object builder(Context context) {
return new OkHttpClient.Builder().connectTimeout(30L, TimeUnit.SECONDS).writeTimeout(30L, TimeUnit.SECONDS).readTimeout(30L, TimeUnit.SECONDS).followRedirects(true).followSslRedirects(true).cookieJar((CookieJar) Ioc.get(CookieJar.class)).build();
}
}).to(OkHttpClient.class).scope(Instance.InstanceScope.SCOPE_SINGLETON);
Ioc.build(new Instance.BeanBuilder() {
@Override
public Object builder(Context context) {
DhDB dhDB = new DhDB();
dhDB.init(MajiaApplication.this.getResources().getString(R.string.app_code), 5, new DhDB.SQLiteDbUpgradeCallback() {
@Override
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
new DbUpgradeChain(sQLiteDatabase, i).addDbUpgradeHandler(new DbUpgradeHandler() {
int version = 4;
@Override
public void doUpgrade(SQLiteDatabase sQLiteDatabase2, int i3, DbUpgradeChain dbUpgradeChain) {
dbUpgradeChain.next();
}
}).addDbUpgradeHandler(new DbUpgradeHandler() {
int version = 5;
@Override
public void doUpgrade(SQLiteDatabase sQLiteDatabase2, int i3, DbUpgradeChain dbUpgradeChain) {
if (i3 < this.version) {
Cursor rawQuery = sQLiteDatabase2.rawQuery("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='systemNotify2'", null);
if (rawQuery.moveToNext() && rawQuery.getInt(0) == 1) {
sQLiteDatabase2.execSQL("ALTER TABLE systemNotify2 ADD COLUMN userId INTEGER ");
sQLiteDatabase2.execSQL("ALTER TABLE systemNotify2 ADD COLUMN create_time INTEGER ");
sQLiteDatabase2.execSQL("ALTER TABLE systemNotify2 ADD COLUMN notifyId INTEGER ");
sQLiteDatabase2.execSQL("ALTER TABLE systemNotify2 ADD COLUMN from_num_str ");
}
rawQuery.close();
}
dbUpgradeChain.next();
}
}).upgrade();
}
});
return dhDB;
}
}).to(DhDB.class).scope(Instance.InstanceScope.SCOPE_SINGLETON);
initFresco();
((UserPreference) Ioc.get(UserPreference.class)).load();
((AppPreference) Ioc.get(AppPreference.class)).load();
Const.net_error_try = true;
UrlScheme.initJson();
UmengInitializer.init(this);
listRadius = IUtil.dip2px(getBaseContext(), getListRadius());
assemblyRadius = IUtil.dip2px(getBaseContext(), getAssemblyRadius());
LogUtil.setLog(false);
}
public int getListRadius() {
try {
String pic_tb_round = TabConfig.getInstance().getPic_tb_round();
char c = 65535;
switch (pic_tb_round.hashCode()) {
case 49:
if (pic_tb_round.equals("1")) {
c = 0;
break;
}
break;
case 50:
if (pic_tb_round.equals("2")) {
c = 1;
break;
}
break;
case 51:
if (pic_tb_round.equals("3")) {
c = 2;
break;
}
break;
}
if (c == 0) {
return 0;
}
if (c != 1) {
return c != 2 ? 0 : 10;
}
return 6;
} catch (Exception unused) {
return 0;
}
}
public int getAssemblyRadius() {
try {
String component_round = TabConfig.getInstance().getComponent_round();
char c = 65535;
switch (component_round.hashCode()) {
case 49:
if (component_round.equals("1")) {
c = 0;
break;
}
break;
case 50:
if (component_round.equals("2")) {
c = 1;
break;
}
break;
case 51:
if (component_round.equals("3")) {
c = 2;
break;
}
break;
}
if (c == 0) {
return 0;
}
if (c != 1) {
return c != 2 ? 0 : 10;
}
return 6;
} catch (Exception unused) {
return 0;
}
}
private void initFresco() {
MagOkHttpNetworkFetcher magOkHttpNetworkFetcher = new MagOkHttpNetworkFetcher((OkHttpClient) Ioc.get(OkHttpClient.class));
File cacheDir = getApplicationContext().getCacheDir();
DiskCacheConfig build = DiskCacheConfig.newBuilder(this).setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR).setBaseDirectoryPath(cacheDir).build();
Fresco.initialize(this, OkHttpImagePipelineConfigFactory.newBuilder(this, (OkHttpClient) Ioc.get(OkHttpClient.class)).setNetworkFetcher(magOkHttpNetworkFetcher).setBitmapsConfig(Bitmap.Config.ARGB_8888).setProgressiveJpegConfig(new ProgressiveJpegConfig() {
@Override
public int getNextScanNumberToDecode(int i) {
return i + 2;
}
@Override
public QualityInfo getQualityInfo(int i) {
return ImmutableQualityInfo.of(i, i >= 5, false);
}
}).setDownsampleEnabled(true).setBitmapMemoryCacheParamsSupplier(new BitmapMemoryCacheParamsSupplier()).setMainDiskCacheConfig(build).setSmallImageDiskCacheConfig(DiskCacheConfig.newBuilder(this).setBaseDirectoryPath(cacheDir).setBaseDirectoryName(IMAGE_PIPELINE_SMALL_CACHE_DIR).setMaxCacheSize(209715200L).setMaxCacheSizeOnLowDiskSpace(26214400L).build()).build());
FrescoImageView.setBaseUrl("https://app.jpztong.com/");
}
public static String getProcessName(Context context) {
int myPid = Process.myPid();
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = ((android.app.ActivityManager) context.getSystemService(PushConstants.INTENT_ACTIVITY_NAME)).getRunningAppProcesses();
if (runningAppProcesses == null) {
return null;
}
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) {
if (runningAppProcessInfo.pid == myPid) {
return runningAppProcessInfo.processName;
}
}
return null;
}
}