Browse Source

提交分类: 打包版本;
提交内容: 公共网页打开页面换用腾讯tbs控件
当前版本: 正式版本6.2.1
是否冲突: 否

raomeng 8 years ago
parent
commit
0d6e93b3d6

+ 43 - 33
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/WebViewCommActivity.java

@@ -9,7 +9,6 @@ import android.content.Intent;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.net.Uri;
-import android.net.http.SslError;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
@@ -18,14 +17,7 @@ import android.util.Log;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
-import android.webkit.CookieManager;
-import android.webkit.CookieSyncManager;
 import android.webkit.JavascriptInterface;
-import android.webkit.SslErrorHandler;
-import android.webkit.ValueCallback;
-import android.webkit.WebChromeClient;
-import android.webkit.WebView;
-import android.webkit.WebViewClient;
 import android.widget.ImageView;
 import android.widget.ProgressBar;
 import android.widget.TextView;
@@ -39,10 +31,16 @@ import com.common.system.SystemUtil;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.net.http.ViewUtil;
-import com.handmark.pulltorefresh.library.PullToRefreshBase;
-import com.handmark.pulltorefresh.library.PullToRefreshWebView;
 import com.modular.appmessages.model.SubMessage;
 import com.modular.login.activity.LoginActivity;
+import com.tencent.smtt.export.external.interfaces.SslError;
+import com.tencent.smtt.export.external.interfaces.SslErrorHandler;
+import com.tencent.smtt.sdk.CookieManager;
+import com.tencent.smtt.sdk.CookieSyncManager;
+import com.tencent.smtt.sdk.ValueCallback;
+import com.tencent.smtt.sdk.WebChromeClient;
+import com.tencent.smtt.sdk.WebView;
+import com.tencent.smtt.sdk.WebViewClient;
 import com.umeng.socialize.ShareAction;
 import com.umeng.socialize.bean.SHARE_MEDIA;
 import com.umeng.socialize.media.UMImage;
@@ -66,7 +64,7 @@ import java.util.Map;
  */
 public class WebViewCommActivity extends BaseActivity implements View.OnClickListener {
     public static final String TIME = "WebViewCommActivity_time";
-    private PullToRefreshWebView webView;
+    private com.tencent.smtt.sdk.WebView webView;
     private ProgressBar pb;
     private ImageView back;
     private ImageView refresh;
@@ -121,7 +119,7 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
         }
         Map<String, String> headers = new HashMap<>();
         headers.put("clientType", "uas client");
-        webView.getRefreshableView().loadUrl(url, headers);
+        webView.loadUrl(url, headers);
     }
 
     @SuppressLint("SetJavaScriptEnabled")
@@ -130,10 +128,9 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
         super.onCreate(savedInstanceState);
         Intent intent = getIntent();
         setContentView(R.layout.activity_webview);
-        webView = (PullToRefreshWebView) findViewById(R.id.webView_listview);
+        webView = (com.tencent.smtt.sdk.WebView) findViewById(R.id.webView_listview);
         mPreTv = (TextView) findViewById(R.id.web_previous_tv);
         mNextTv = (TextView) findViewById(R.id.web_next_tv);
-        webView.setMode(PullToRefreshBase.Mode.DISABLED);
         mReadSubs = new ArrayList<>();
         isStartApp = false;
         pb = (ProgressBar) findViewById(R.id.pb);
@@ -193,23 +190,26 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
         }
         long oldtime = PreferenceUtils.getLong(this, TIME, System.currentTimeMillis());
         if (((System.currentTimeMillis() - oldtime) / (1000 * 60)) > 20) {
-            if (isCookie)
+            if (isCookie) {
                 login(this);
+            }
         }
-        webView.getRefreshableView().getSettings().setJavaScriptEnabled(true);
-        webView.getRefreshableView().getSettings().setAllowFileAccess(true);// 设置允许访问文件数据
+        webView.getSettings().setJavaScriptEnabled(true);
+        webView.getSettings().setAllowFileAccess(true);// 设置允许访问文件数据
         //  webView.getRefreshableView().getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); //设置 缓存模式
-        webView.getRefreshableView().getSettings().setDomStorageEnabled(true);
-        webView.getRefreshableView().getSettings().setDatabaseEnabled(true);
-        webView.getRefreshableView().getSettings().setAppCacheEnabled(true);
-        webView.getRefreshableView().getSettings().setSavePassword(true);
-        webView.getRefreshableView().getSettings().setSaveFormData(true);
+        webView.getSettings().setDomStorageEnabled(true);
+        webView.getSettings().setDatabaseEnabled(true);
+        webView.getSettings().setAppCacheEnabled(true);
+        webView.getSettings().setSavePassword(true);
+        webView.getSettings().setSaveFormData(true);
 
         // 修改ua使得web端正确判断
-        webView.getRefreshableView().addJavascriptInterface(new JSWebView(), "JSWebView"); //在JSWebView类里实现javascript想调用的方法,并将其实例化传入webview, "JSWebView"这个字串告诉javascript调用哪个实例的方法
+        webView.addJavascriptInterface(new JSWebView(), "JSWebView"); //在JSWebView类里实现javascript想调用的方法,并将其实例化传入webview, "JSWebView"这个字串告诉javascript调用哪个实例的方法
+
+        setThirdPartyCookiesEnabled(true);
 
-        String ua = webView.getRefreshableView().getSettings().getUserAgentString();
-        webView.getRefreshableView().getSettings().setUserAgentString(ua + " uasClient");
+        String ua = webView.getSettings().getUserAgentString();
+        webView.getSettings().setUserAgentString(ua + " uasClient");
 
         if (isCookie) {
             synCookies(this, url);
@@ -220,10 +220,10 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
         headers.put("client-name", "uasClient");
 //          url="http://192.168.253.132:9090/platform-b2c/?client=true";
         Log.d("webUrl", url);
-        webView.getRefreshableView().loadUrl(url, headers);
+        webView.loadUrl(url, headers);
 //        webView.getRefreshableView().loadUrl("file:///android_asset/submit.html");
-        webView.getRefreshableView().setWebChromeClient(new ChromeClient());
-        webView.getRefreshableView().setWebViewClient(new WebViewClient() {
+        webView.setWebChromeClient(new WebChromeClient());
+        webView.setWebViewClient(new WebViewClient(){
             @Override
             public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                 if (isCookie) {
@@ -285,7 +285,9 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
         switch (v.getId()) {
             case R.id.web_previous_tv:
                 mPosition--;
-                if (mSubscriptionMessages.get(mPosition).getStatus() == 0) mPosition--;
+                if (mSubscriptionMessages.get(mPosition).getStatus() == 0) {
+                    mPosition--;
+                }
                 break;
             case R.id.web_next_tv:
                 mPosition++;
@@ -320,7 +322,7 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
                     + "&sessionId=" + CommonUtil.getSharedPreferences(ct, "sessionId");
             Map<String, String> headers = new HashMap<>();
             headers.put("client-name", "uasClient");
-            webView.getRefreshableView().loadUrl(url, headers);
+            webView.loadUrl(url, headers);
         }
     }
 
@@ -354,7 +356,6 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
             if (newProgress == 100) {
                 pb.setProgress(newProgress);
                 pb.setVisibility(View.GONE);
-                webView.onRefreshComplete();
             }
             super.onProgressChanged(view, newProgress);
         }
@@ -472,8 +473,8 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
         CookieManager cookieManager = CookieManager.getInstance();
         cookieManager.removeSessionCookie();//移除
         cookieManager.removeAllCookie();
-        webView.getRefreshableView().clearHistory();
-        webView.getRefreshableView().clearCache(true);
+        webView.clearHistory();
+        webView.clearCache(true);
     }
 
     private void login(Context context) {
@@ -482,6 +483,15 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
         PreferenceUtils.putLong(context, TIME, System.currentTimeMillis());
     }
 
+    @SuppressLint("NewApi")
+    public void setThirdPartyCookiesEnabled(final boolean enabled) {
+        if (Build.VERSION.SDK_INT >= 21) {
+            com.tencent.smtt.sdk.CookieManager.getInstance().setAcceptThirdPartyCookies(webView, enabled);
+        } else {
+            com.tencent.smtt.sdk.CookieManager.getInstance().setAcceptCookie(true);
+        }
+    }
+
     @Override
     public void onBackPressed() {
         if (!mReadSubs.isEmpty()) {

+ 0 - 62
WeiChat/src/main/res/layout/activity_webview.xml

@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@color/lightgrey"
-    android:orientation="vertical">
-
-    <ProgressBar
-        android:id="@+id/pb"
-        style="?android:attr/progressBarStyleHorizontal"
-        android:layout_width="fill_parent"
-        android:layout_height="5dip"
-        android:animationResolution="100"
-        android:indeterminate="false"
-        android:indeterminateDuration="500"
-        android:indeterminateOnly="false"
-        android:max="100"
-        android:progressDrawable="@drawable/webview_progress_bar"
-        android:visibility="gone"></ProgressBar>
-
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <com.handmark.pulltorefresh.library.PullToRefreshWebView
-            android:id="@+id/webView_listview"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:background="@color/linen"
-            android:layerType="software" />
-
-        <TextView
-            android:id="@+id/web_previous_tv"
-            android:layout_width="100dp"
-            android:layout_height="36dp"
-            android:layout_alignParentBottom="true"
-            android:layout_marginBottom="25dp"
-            android:layout_marginLeft="30dp"
-            android:background="@drawable/selector_flip_btn"
-            android:gravity="center"
-            android:text="@string/web_previous_tv"
-            android:textColor="@color/white"
-            android:textSize="16sp"
-            android:visibility="gone"/>
-
-        <TextView
-            android:id="@+id/web_next_tv"
-            android:layout_width="100dp"
-            android:layout_height="36dp"
-            android:layout_alignParentBottom="true"
-            android:layout_alignParentRight="true"
-            android:layout_marginBottom="25dp"
-            android:layout_marginRight="30dp"
-            android:background="@drawable/selector_flip_btn"
-            android:gravity="center"
-            android:text="@string/web_next_tv"
-            android:textColor="@color/white"
-            android:textSize="16sp"
-            android:visibility="gone"/>
-    </RelativeLayout>
-
-</LinearLayout>

+ 5 - 5
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Mon Feb 26 17:52:29 CST 2018
-debugName=267
-versionName=619
-debugCode=267
-versionCode=158
+#Wed Feb 28 09:29:25 CST 2018
+debugName=273
+versionName=620
+debugCode=273
+versionCode=159

+ 1 - 1
app_core/common/src/main/res/layout/activity_webview.xml

@@ -22,7 +22,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.handmark.pulltorefresh.library.PullToRefreshWebView
+        <com.tencent.smtt.sdk.WebView
             android:id="@+id/webView_listview"
             android:layout_width="match_parent"
             android:layout_height="match_parent"

+ 10 - 9
app_modular/appmessages/src/main/res/layout/activity_real_time_form.xml

@@ -1,14 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
+xmlns:android="http://schemas.android.com/apk/res/android"
+android:layout_width="match_parent"
+android:layout_height="match_parent"
+android:orientation="vertical"
+android:background="@color/me_menu_item_normal">
+
+<android.support.v7.widget.RecyclerView
+    android:id="@+id/real_time_form_rv"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical">
-
-    <android.support.v7.widget.RecyclerView
-        android:id="@+id/real_time_form_rv"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:overScrollMode="never"
-        android:padding="20dp"/>
+    android:overScrollMode="never"
+    android:padding="20dp"/>
 </LinearLayout>

+ 6 - 1
app_modular/appworks/src/main/java/com/uas/appworks/activity/CustomerInquiryDetailActivity.java

@@ -239,10 +239,11 @@ public class CustomerInquiryDetailActivity extends BaseMVPActivity<WorkPlatPrese
             String customer = JSONUtil.getText(enterpriseObject, "enName");//客户
             String customerAddress = JSONUtil.getText(enterpriseObject, "enAddress");//客户地址
 
-            String userTel = "";
+            String userTel = "", userName = "";
             if (Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO.equals(mState)
                     || Constants.FLAG.STATE_PUBLIC_INQUIRY_DONE.equals(mState)) {
                 userTel = JSONUtil.getText(detailObject, "userTel");
+                userName = JSONUtil.getText(detailObject, "userName");
             } else if (recorderUser != null) {
                 userTel = JSONUtil.getText(recorderUser, "userTel");//客户联系电话
             }
@@ -269,6 +270,10 @@ public class CustomerInquiryDetailActivity extends BaseMVPActivity<WorkPlatPrese
             mB2BDetailListBeans.add(createB2BDetailListBean(B2BDetailListBean.TYPE_DETAIL_TEXT, getString(R.string.customer_inquiry_customer), customer, "", "客户", "", 0, null));
             mB2BDetailListBeans.add(createB2BDetailListBean(B2BDetailListBean.TYPE_DETAIL_TEXT, getString(R.string.customer_inquiry_customer_address), customerAddress, "", "客户地址", "", 0, null));
             mB2BDetailListBeans.add(createB2BDetailListBean(B2BDetailListBean.TYPE_DETAIL_TEXT, getString(R.string.customer_inquiry_customer_phone), userTel, "", "联系电话", "", 0, null));
+            if (Constants.FLAG.STATE_PUBLIC_INQUIRY_TODO.equals(mState)
+                    || Constants.FLAG.STATE_PUBLIC_INQUIRY_DONE.equals(mState)) {
+                mB2BDetailListBeans.add(createB2BDetailListBean(B2BDetailListBean.TYPE_DETAIL_TEXT, getString(R.string.public_inquiry_contact), userName, "", "联系人", "", 0, null));
+            }
             mB2BDetailListBeans.add(createB2BDetailListBean(B2BDetailListBean.TYPE_DETAIL_TEXT, getString(R.string.customer_inquiry_bill_num), billNum, "", "单据", "", 0, null));
             mB2BDetailListBeans.add(createB2BDetailListBean(B2BDetailListBean.TYPE_DETAIL_TEXT, getString(R.string.customer_inquiry_material), material, "", "物料", "", 0, null));