|
|
|
package com.qiwan.gamebox;
|
|
|
|
package com.qw7277.game;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.view.WindowManager;
|
|
|
|
import android.webkit.WebSettings;
|
|
|
|
import android.webkit.WebView;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.Toast;
|
|
|
|
import com.qw7277.game.util.AppUtils;
|
|
|
|
|
|
|
|
import com.readystatesoftware.systembartint.SystemBarTintManager;
|
|
|
|
|
|
|
|
public class MainActivity extends Activity {
|
|
|
|
private Context mContext;
|
|
|
|
private LinearLayout mLlRoot;
|
|
|
|
private WebView mWebView;
|
|
|
|
private SystemBarTintManager mTintManager;
|
|
|
|
private String mUrl = "https://cdn.kky.cn/yxhz/index.html#/home";
|
|
|
|
private String mParams="";
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
mContext = this;
|
|
|
|
mTintManager = new SystemBarTintManager(this);
|
|
|
|
mTintManager.setStatusBarTintEnabled(false);
|
|
|
|
mTintManager.setNavigationBarTintEnabled(true);
|
|
...
|
...
|
@@ -36,13 +43,13 @@ public class MainActivity extends Activity { |
|
|
|
initView();
|
|
|
|
initWebView();
|
|
|
|
initData();
|
|
|
|
|
|
|
|
mWebView.loadUrl(mUrl);
|
|
|
|
Log.d("ZhenWan", mUrl+"?"+mParams);
|
|
|
|
mWebView.loadUrl(mUrl+"?"+mParams);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void initView() {
|
|
|
|
mLlRoot = findViewById(R.id.ll_root);
|
|
|
|
mLlRoot.setPadding(0, mTintManager.getConfig().getStatusBarHeight(), 0, mTintManager.getConfig().getNavigationBarHeight()+20);
|
|
|
|
mLlRoot.setPadding(0, mTintManager.getConfig().getStatusBarHeight(), 0, mTintManager.getConfig().getNavigationBarHeight() + 20);
|
|
|
|
mWebView = findViewById(R.id.webview);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -58,21 +65,21 @@ public class MainActivity extends Activity { |
|
|
|
|
|
|
|
private void initData() {
|
|
|
|
Bundle extras = getIntent().getExtras();
|
|
|
|
if (extras != null) {
|
|
|
|
if (extras.containsKey("AuthParams")) {
|
|
|
|
String parameterValue = extras.getString("AuthParams");
|
|
|
|
mUrl = mUrl + "?" + parameterValue;
|
|
|
|
}
|
|
|
|
if (extras != null && extras.containsKey("AuthParams")) {
|
|
|
|
mParams = extras.getString("AuthParams");
|
|
|
|
}
|
|
|
|
String cid = AppUtils.getLogicChannel(mContext, "sid");
|
|
|
|
mParams += (TextUtils.isEmpty(mParams) ? "" : "&") + "cid=" + cid;
|
|
|
|
}
|
|
|
|
|
|
|
|
private long mBackPressedTime = 0;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onBackPressed() {
|
|
|
|
if (mWebView != null && mWebView.canGoBack()) {
|
|
|
|
mWebView.goBack();
|
|
|
|
} else {
|
|
|
|
if(System.currentTimeMillis() - mBackPressedTime > 2000) {
|
|
|
|
if (System.currentTimeMillis() - mBackPressedTime > 2000) {
|
|
|
|
Toast.makeText(this, "再按一次退出应用", Toast.LENGTH_SHORT).show();
|
|
|
|
mBackPressedTime = System.currentTimeMillis();
|
|
|
|
} else {
|
...
|
...
|
|