|
|
@@ -11,13 +11,13 @@ import android.webkit.WebView;
|
|
|
import android.webkit.WebViewClient;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
-import com.google.gson.JsonObject;
|
|
|
import com.kfzs.duanduan.BaseCompatActivity;
|
|
|
-import com.sheep.gamegroup.util.AppUtil;
|
|
|
+import com.sheep.gamegroup.model.entity.XianWanEntity;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.DeviceUtil;
|
|
|
+import com.sheep.gamegroup.util.MyDbManager;
|
|
|
+import com.sheep.gamegroup.util.WebviewJs;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
-import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
import com.zhy.http.okhttp.OkHttpUtils;
|
|
|
@@ -40,10 +40,9 @@ public class ActXinwanWeb extends BaseCompatActivity {
|
|
|
@BindView(R.id.tv_next)
|
|
|
TextView tv_next;
|
|
|
|
|
|
- private String url_js;
|
|
|
- private String title;
|
|
|
private WebSettings webViewSettings;
|
|
|
private Activity activity;
|
|
|
+ private XianWanEntity xianWanEntity;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -51,15 +50,17 @@ public class ActXinwanWeb extends BaseCompatActivity {
|
|
|
setContentView(R.layout.activity_guide_on_hook);
|
|
|
activity = this;
|
|
|
|
|
|
- url_js = getIntent().getStringExtra("js_url");
|
|
|
- title = getIntent().getStringExtra("title");
|
|
|
-// url_js = "http://10.8.210.172:8095/test.js";
|
|
|
+ xianWanEntity = (XianWanEntity) getIntent().getSerializableExtra("xianwan_enty");
|
|
|
|
|
|
ButterKnife.bind(this);
|
|
|
TitleBarUtils
|
|
|
.getInstance()
|
|
|
- .setTitle(this, title)
|
|
|
+ .setTitle(this, "闲玩")
|
|
|
.setTitleFinish(this);
|
|
|
+ tv_next.setVisibility(View.GONE);
|
|
|
+ if(xianWanEntity == null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
webViewSettings = mWebView.getSettings();
|
|
|
webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
|
|
|
@@ -69,13 +70,12 @@ public class ActXinwanWeb extends BaseCompatActivity {
|
|
|
if (getIntent().hasExtra(EXTRA_WEBVIEW_NO_TITLE)) {//不显示标题
|
|
|
findViewById(R.id.appbar_act_webview).setVisibility(View.GONE);
|
|
|
}
|
|
|
- tv_next.setVisibility(View.GONE);
|
|
|
initJsData();
|
|
|
}
|
|
|
|
|
|
private void initJsData() {
|
|
|
OkHttpUtils.get()
|
|
|
- .url(url_js)
|
|
|
+ .url(xianWanEntity.getJsUrl()+"")
|
|
|
.build()
|
|
|
.execute(new StringCallback() {
|
|
|
@Override
|
|
|
@@ -127,21 +127,8 @@ public class ActXinwanWeb extends BaseCompatActivity {
|
|
|
}
|
|
|
});
|
|
|
webViewSettings.setJavaScriptEnabled(true);
|
|
|
- String url = SheepApp.getInstance().getConnectAddress().getAppUrl()+"v1/app/common_config/?type_name=xianwan";
|
|
|
- OkHttpUtils.get()
|
|
|
- .url(url)
|
|
|
- .build()
|
|
|
- .execute(new StringCallback() {
|
|
|
- @Override
|
|
|
- public void onError(Call call, Exception e, int i) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onResponse(String s, int i) {
|
|
|
- // mWebView.loadUrl(assemblyData());
|
|
|
- }
|
|
|
- });
|
|
|
+ mWebView.addJavascriptInterface(new WebviewJs(activity, 0), "android");
|
|
|
+ mWebView.loadUrl(assemblyData());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -168,12 +155,18 @@ public class ActXinwanWeb extends BaseCompatActivity {
|
|
|
*/
|
|
|
private String assemblyData(){
|
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
|
- stringBuffer.append("https://h5.51xianwan.com/try/try_list_plus_browser.aspx?");
|
|
|
- stringBuffer.append("ptype"+"");
|
|
|
- stringBuffer.append("&deviceid"+ DeviceUtil.getDeviceId(activity));
|
|
|
- stringBuffer.append("&appid"+"");
|
|
|
- stringBuffer.append("&appsign"+"");
|
|
|
- stringBuffer.append("&keycode"+CommonUtil.getInstance().encrypt2Md5("10108883300242xw2100045455"));
|
|
|
+ stringBuffer.append(xianWanEntity.getUrl()+"?");
|
|
|
+ stringBuffer.append("ptype="+"2");
|
|
|
+ stringBuffer.append("&deviceid="+ DeviceUtil.getDeviceId(activity));
|
|
|
+ stringBuffer.append("&appid="+ xianWanEntity.getAndroid().getAppid());
|
|
|
+ stringBuffer.append("&appsign="+ MyDbManager.getInstance().dbFindId());
|
|
|
+ stringBuffer.append("&keycode="+CommonUtil.getInstance().encrypt2Md5(
|
|
|
+ xianWanEntity.getAndroid().getAppid()+""+
|
|
|
+ DeviceUtil.getDeviceId(activity) +
|
|
|
+ 2 +
|
|
|
+ MyDbManager.getInstance().dbFindId() +
|
|
|
+ xianWanEntity.getAndroid().getAppsecret()
|
|
|
+ ));
|
|
|
return stringBuffer.toString();
|
|
|
}
|
|
|
}
|