i自然 v1.5.2版本的 MD5 值为:4186de3133535afd3ad8a76e7e4d0eff
以下内容为反编译后的 CmsMainAc.java 源代码,内容仅作参考
package com.mnr.app.cms.view;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.core.app.ActivityCompat;
import com.just.agentweb.AgentWeb;
import com.just.agentweb.AgentWebUIControllerImplBase;
import com.just.agentweb.WebChromeClient;
import com.mnr.app.R;
import com.mnr.app.app.Myapp;
import com.mnr.app.cms.CommonWebViewClient;
import com.mnr.app.cms.CommonWebViewListener;
import com.mnr.app.cms.SuperBaseActivity;
import com.mnr.app.cms.util.Constant;
import com.mnr.app.cms.util.SharedPreferencesUtil;
import com.mnr.app.cms.util.UtilsNet;
import com.mnr.app.cms.util.cache.ACache;
import com.mnr.dependencies.Utils.ToastUtils;
public class CmsMainAc extends SuperBaseActivity implements View.OnTouchListener {
private static final int FLING_MIN_DISTANCE = 50;
private static final int FLING_MIN_VELOCITY = 0;
private CommonWebViewClient a;
private CommonWebViewClient commonWebViewClient;
private boolean isShowTitleBar;
private ImageView iv_btn_back;
private AgentWeb mAgentWeb;
private View mButtonClose;
private ACache mCache;
private View mErrorView;
private long mExitTime;
private GestureDetector mGestureDetector;
private long mLastBackTimeMill;
private View mSettingView;
private String title;
private String webViewUrl;
private View webview_view;
private String urls = "";
private String TAG = "MainActivity";
public final String[] mRoomPermission = {"android.permission.CAMERA", "android.permission.BLUETOOTH", "android.permission.RECORD_AUDIO", "android.permission.READ_PHONE_STATE", "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE"};
private boolean isError = false;
private boolean showMainFrameError = false;
GestureDetector.SimpleOnGestureListener myGestureListener = new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
Log.e("<--滑动测试-->", "开始滑动");
float x = e1.getX() - e2.getX();
float x2 = e2.getX() - e1.getX();
if ((x > 50.0f && Math.abs(velocityX) > 0.0f) || x2 <= 50.0f) {
return true;
}
Math.abs(velocityX);
return true;
}
};
public void forwardToLiveRoom(int cRole) {
}
@Override
protected int getResLayoutId() {
return R.layout.activity_cms_main;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferencesUtil.newInstance(this, Constant.SP_KEY_SERVERCONFIG);
SharedPreferencesUtil.saveBoolean(Constant.IS_FIRST_LOGIN, false);
initWebView();
setSwipeBackEnable(false);
if (Build.VERSION.SDK_INT >= 23) {
ActivityCompat.requestPermissions(this, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.ACCESS_FINE_LOCATION", "android.permission.READ_LOGS", "android.permission.READ_PHONE_STATE", "android.permission.READ_EXTERNAL_STORAGE", "android.permission.SET_DEBUG_APP", "android.permission.SYSTEM_ALERT_WINDOW", "android.permission.GET_ACCOUNTS", "android.permission.WRITE_APN_SETTINGS", "android.permission.CAMERA", "android.permission.BLUETOOTH", "android.permission.RECORD_AUDIO"}, 123);
}
this.mGestureDetector = new GestureDetector(this, this.myGestureListener);
}
@Override
public void initView() {
super.initView();
this.mButtonClose = findViewById(R.id.button_close);
this.mErrorView = findViewById(R.id.error_layout);
this.mSettingView = findViewById(R.id.image_setting);
this.webview_view = findViewById(R.id.parent_view);
this.mErrorView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CmsMainAc.this.lambda$initView$0$CmsMainAc(view);
}
});
this.mButtonClose.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CmsMainAc.this.lambda$initView$1$CmsMainAc(view);
}
});
}
public void lambda$initView$0$CmsMainAc(View view) {
AgentWeb agentWeb = this.mAgentWeb;
if (agentWeb != null) {
agentWeb.getWebCreator().getWebView().reload();
}
}
public void lambda$initView$1$CmsMainAc(View view) {
finish();
}
private void initWebView() {
CommonWebViewClient commonWebViewClient = new CommonWebViewClient(this) {
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
String uri = request.getUrl().toString();
Log.e("Tag1", uri);
return CmsMainAc.this.shouldOverrideDO(uri);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, final String url) {
Log.e("Tag2", url);
return CmsMainAc.this.shouldOverrideDO(url);
}
};
this.commonWebViewClient = commonWebViewClient;
commonWebViewClient.setCommonWebViewListener(new CommonWebViewListener() {
@Override
public void onPageStarted() {
CmsMainAc.this.mErrorView.setVisibility(8);
CmsMainAc.this.isError = false;
}
@Override
public void onPageFinished() {
if (!CmsMainAc.this.showMainFrameError || UtilsNet.checkNet(CmsMainAc.this)) {
if (CmsMainAc.this.isError || CmsMainAc.this.urls.contains("login-index.html")) {
CmsMainAc.this.mSettingView.setVisibility(8);
} else {
CmsMainAc.this.mSettingView.setVisibility(8);
}
String url = CmsMainAc.this.mAgentWeb.getWebCreator().getWebView().getUrl();
if (url.contains("login-index.html") || url.contains("/admin/sys/mobile2/admin/admin-page.html")) {
CmsMainAc.this.mButtonClose.setVisibility(0);
return;
} else {
CmsMainAc.this.mButtonClose.setVisibility(8);
return;
}
}
CmsMainAc.this.mErrorView.setVisibility(0);
CmsMainAc.this.mSettingView.setVisibility(8);
CmsMainAc.this.showMainFrameError = false;
}
@Override
public void OnPageError() {
Log.e("123", "============OnPageError=============");
CmsMainAc.this.isError = true;
CmsMainAc.this.mErrorView.setVisibility(0);
CmsMainAc.this.mSettingView.setVisibility(0);
}
});
this.mCache = ACache.get(Myapp.app);
this.webViewUrl = "http://cms.iziran.net/";
if ("http://cms.iziran.net/" != 0 && !"http://cms.iziran.net/".equals("")) {
AgentWeb.PreAgentWeb createAgentWeb = AgentWeb.with(this).setAgentWebParent((RelativeLayout) this.webview_view, new RelativeLayout.LayoutParams(-1, -1)).useDefaultIndicator().setAgentWebUIController(new AgentWebUIControllerImplBase() {
@Override
public void onMainFrameError(WebView view, int errorCode, String description, String failingUrl) {
CmsMainAc.this.showMainFrameError = true;
Log.e("123", "onMainFrameError========");
}
@Override
public void onShowMessage(String message, String from) {
super.onShowMessage(message, from);
Log.e("123", "onShowMessage========");
}
}).setWebViewClient(this.commonWebViewClient).setWebChromeClient(new WebChromeClient() {
}).createAgentWeb();
WebSettings webSettings = createAgentWeb.get().getAgentWebSettings().getWebSettings();
webSettings.setUserAgentString("MTApp");
webSettings.setJavaScriptEnabled(true);
webSettings.setCacheMode(-1);
webSettings.setAllowFileAccess(true);
webSettings.setSupportZoom(true);
webSettings.setDatabaseEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setUserAgentString("MTApp");
webSettings.setMixedContentMode(0);
CookieManager.getInstance().setAcceptCookie(true);
CookieManager.getInstance().setAcceptThirdPartyCookies(createAgentWeb.get().getWebCreator().getWebView(), true);
webSettings.setAppCacheMaxSize(8388608L);
webSettings.setAppCacheEnabled(true);
webSettings.setAppCachePath(Myapp.app.getCacheDir().getAbsolutePath());
webSettings.setBuiltInZoomControls(true);
webSettings.setUseWideViewPort(true);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webSettings.setLoadWithOverviewMode(true);
this.mAgentWeb = createAgentWeb.ready().go(this.webViewUrl + Constant.loginUrl);
return;
}
ToastUtils.showLong(this, "url地址为空");
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
for (int i = 0; i < permissions.length; i++) {
Log.e("123", "============权限" + permissions[i] + "===========" + grantResults[i]);
}
}
@Override
public void getIntentData(Intent intent) {
super.getIntentData(intent);
this.title = intent.getStringExtra("title");
boolean booleanExtra = intent.getBooleanExtra("isShowTitleBar", false);
this.isShowTitleBar = booleanExtra;
isShowTitle(booleanExtra);
setTitle(this.title);
}
@Override
public void onResume() {
super.onResume();
this.mAgentWeb.getWebLifeCycle().onResume();
}
@Override
public void onPause() {
super.onPause();
this.mAgentWeb.getWebLifeCycle().onPause();
}
@Override
public void onDestroy() {
this.mAgentWeb.getWebLifeCycle().onDestroy();
super.onDestroy();
}
@Override
public boolean onTouch(View v, MotionEvent event) {
Log.e("123", "onTouch===============" + this.urls);
if (this.urls.contains("login-index.html")) {
return this.mGestureDetector.onTouchEvent(event);
}
return super.onTouchEvent(event);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1000) {
initWebView();
}
}
public boolean shouldOverrideDO(String url) {
this.urls = url;
if (url.contains("userinfo://userID=")) {
String str = url.substring(18, url.length()).split("&")[0];
this.mSettingView.postDelayed(new Runnable() {
@Override
public final void run() {
CmsMainAc.this.lambda$shouldOverrideDO$2$CmsMainAc();
}
}, 2000L);
}
if (url.contains("login-index.html")) {
this.mSettingView.setVisibility(0);
} else {
this.mSettingView.setVisibility(8);
}
if (url.contains("livemanager://userID")) {
return true;
}
if (!url.contains("videoconnect://")) {
return false;
}
String[] split = url.substring(15).split("&");
String str2 = split[0];
String str3 = split[1];
String str4 = split[2];
String str5 = split[3];
String str6 = split[4];
String str7 = split[5];
str2.substring(6);
str3.substring(6);
str4.substring(7);
str5.substring(7);
str6.substring(9);
str7.substring(9);
return true;
}
public void lambda$shouldOverrideDO$2$CmsMainAc() {
Log.e("123", "-----------" + CookieManager.getInstance().getCookie(this.urls));
}
}