|
|
@@ -1,8 +1,10 @@
|
|
|
package com.xzjmyk.pm.activity.ui.erp.activity;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.xzjmyk.pm.activity.MyApplication;
|
|
|
import com.xzjmyk.pm.activity.ui.MainActivity;
|
|
|
import com.xzjmyk.pm.activity.ui.base.BaseActivity;
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.R;
|
|
|
|
|
|
@@ -57,8 +59,7 @@ public class WebViewCommActivity extends BaseActivity {
|
|
|
String p = "";//动态改变文字显示
|
|
|
try {
|
|
|
p = intent.getStringExtra("p");
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
+ } catch (Exception e) {}
|
|
|
if (p != null) {
|
|
|
getSupportActionBar().setTitle(p);
|
|
|
}
|
|
|
@@ -72,48 +73,42 @@ public class WebViewCommActivity extends BaseActivity {
|
|
|
webView.getRefreshableView().getSettings().setDatabaseEnabled(true);
|
|
|
webView.getRefreshableView().getSettings().setAppCacheEnabled(true);
|
|
|
if (MyApplication.cookie != null) {
|
|
|
- synCookies(this, url);
|
|
|
+ //synCookies(this, url);
|
|
|
}else{
|
|
|
- clearCookie();
|
|
|
- webView.getRefreshableView().clearHistory();
|
|
|
- webView.getRefreshableView().clearCache(true);
|
|
|
+ clearCookie();
|
|
|
}
|
|
|
-
|
|
|
webView.getRefreshableView().loadUrl(url);
|
|
|
webView.getRefreshableView().setWebViewClient(new WebViewClient() {
|
|
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
- if (MyApplication.cookie != null) {
|
|
|
- synCookies(WebViewCommActivity.this, url);
|
|
|
+ System.out.println("link url=" + url);
|
|
|
+ if (!url.equals("http://www.ubtob.com/signin#")){
|
|
|
+ if (MyApplication.cookie != null) {
|
|
|
+ // synCookies(WebViewCommActivity.this, url);
|
|
|
+ view.loadUrl(url);
|
|
|
+ }else{
|
|
|
+// ViewUtil.ShowMessageTitleAutoDismiss(WebViewCommActivity.this,
|
|
|
+// "您的登录会话过期!请重新登录!",1000);
|
|
|
+ view.loadUrl(url);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (MyApplication.cookie != null) {
|
|
|
+ // synCookies(WebViewCommActivity.this, "http://www.ubtob.com/#");
|
|
|
+ view.loadUrl("http://www.ubtob.com/#");
|
|
|
+ }else{
|
|
|
+ view.loadUrl(url);
|
|
|
+ }
|
|
|
}
|
|
|
- view.loadUrl(url);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
});
|
|
|
webView.getRefreshableView().setWebChromeClient(new WebChromeClient());
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
protected void onResume() {
|
|
|
super.onResume();
|
|
|
-// XGPushClickedResult result=XGPushManager.onActivityStarted(this);
|
|
|
-// if (result!=null) {
|
|
|
-// isStartApp=true;
|
|
|
-// String customParam=result.getCustomContent();
|
|
|
-// Map<String,Object> pMap=FlexJsonUtil.fromJson(customParam);
|
|
|
-// title.setText(pMap.get("title").toString());
|
|
|
-// url=Constants.basicURL+
|
|
|
-// "?b_username="+CommonUtil.getSharedPreferences(this, "user_phone")+"&b_password="+
|
|
|
-// CommonUtil.getSharedPreferences(this, "user_password")+
|
|
|
-// pMap.get("url").toString();
|
|
|
-// if (MyActivityManager.cookie!=null) {
|
|
|
-// synCookies(this, url);
|
|
|
-// }
|
|
|
-// Log.i("xinge", "onResue url="+url);
|
|
|
-// webView.getRefreshableView().loadUrl(url);
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -143,12 +138,9 @@ public class WebViewCommActivity extends BaseActivity {
|
|
|
String cookieStr = sessionCookie.getName() + "="
|
|
|
+ sessionCookie.getValue() + "; domain="
|
|
|
+ sessionCookie.getDomain();
|
|
|
- System.out.println("webview cookie:" + cookieStr);
|
|
|
-// if (!StringUtils.isEmpty(CommonUtil.getSharedPreferences(context, "b2b_cookie"))) {
|
|
|
-// cookieManager.setCookie(url, CommonUtil.getSharedPreferences(context, "b2b_cookie"));//cookies是在HttpClient中获得的cookie
|
|
|
-// } else {
|
|
|
- cookieManager.setCookie(url, cookieStr);//cookies是在HttpClient中获得的cookie
|
|
|
-// }
|
|
|
+ //System.out.println("app cookie:"+ JSON.toJSONString(sessionCookie));
|
|
|
+ System.out.println("cookie:" + cookieStr);
|
|
|
+ cookieManager.setCookie(url, cookieStr);//cookies是在HttpClient中获得的cookie
|
|
|
CookieSyncManager.getInstance().sync();
|
|
|
}
|
|
|
|
|
|
@@ -156,6 +148,8 @@ public class WebViewCommActivity extends BaseActivity {
|
|
|
CookieManager cookieManager = CookieManager.getInstance();
|
|
|
cookieManager.removeSessionCookie();//移除
|
|
|
cookieManager.removeAllCookie();
|
|
|
+ webView.getRefreshableView().clearHistory();
|
|
|
+ webView.getRefreshableView().clearCache(true);
|
|
|
}
|
|
|
|
|
|
|