소스 검색

x5 or origin

hanjing 6 년 전
부모
커밋
16944c9b97
24개의 변경된 파일1914개의 추가작업 그리고 70개의 파일을 삭제
  1. 5 1
      app/src/main/AndroidManifest.xml
  2. 9 9
      app/src/main/java/com/sheep/gamegroup/module/webview/fragment/BaseFgtWeb.java
  3. 270 0
      app/src/main/java/com/sheep/gamegroup/module/webview/fragment/BaseFgtWebX5.java
  4. 616 0
      app/src/main/java/com/sheep/gamegroup/module/webview/fragment/FgtWeb.java
  5. 7 11
      app/src/main/java/com/sheep/gamegroup/module/webview/fragment/FgtWebX5.java
  6. 1 7
      app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java
  7. 20 0
      app/src/main/java/com/sheep/gamegroup/util/DeviceUtil.java
  8. 7 2
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  9. 6 1
      app/src/main/java/com/sheep/gamegroup/util/MainTab.java
  10. 2 2
      app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java
  11. 2 2
      app/src/main/java/com/sheep/gamegroup/util/TestUtil.java
  12. 14 15
      app/src/main/java/com/sheep/gamegroup/util/js/BaseActWeb.java
  13. 294 0
      app/src/main/java/com/sheep/gamegroup/util/js/BaseActWebX5.java
  14. 2 4
      app/src/main/java/com/sheep/gamegroup/util/js/KFZSJs.java
  15. 5 5
      app/src/main/java/com/sheep/gamegroup/util/share/ShareLinkConfig.java
  16. 2 2
      app/src/main/java/com/sheep/gamegroup/view/activity/ActInvitation.java
  17. 588 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActWeb.java
  18. 2 6
      app/src/main/java/com/sheep/gamegroup/view/activity/ActWebX5.java
  19. 0 1
      app/src/main/java/com/sheep/gamegroup/view/activity/ActWebX5SBD.java
  20. 1 1
      app/src/main/java/com/sheep/gamegroup/view/activity/ActYf.java
  21. 0 1
      app/src/main/java/org/afinal/simplecache/ApiKey.java
  22. 31 0
      app/src/main/res/layout/act_web.xml
  23. 30 0
      app/src/main/res/layout/fgt_web.xml
  24. BIN
      view/libs/tbs_sdk_thirdapp_v3.6.0.1325.jar

+ 5 - 1
app/src/main/AndroidManifest.xml

@@ -222,7 +222,7 @@
             </intent-filter>
         </activity>
         <activity
-            android:name="com.sheep.gamegroup.view.activity.ActYf"
+            android:name="com.sheep.gamegroup.view.activity.ActYfX5"
             android:screenOrientation="portrait"
             android:theme="@style/AppActionTheme"
             android:label="@string/app_name_yf"
@@ -457,6 +457,10 @@
             android:screenOrientation="portrait"
             android:theme="@style/AppActionTheme" />
         <activity
+            android:name="com.sheep.gamegroup.view.activity.ActWeb"
+            android:screenOrientation="portrait"
+            android:theme="@style/AppActionTheme" />
+        <activity
             android:name="com.sheep.gamegroup.view.activity.ActWebX5YF"
             android:screenOrientation="portrait"
             android:theme="@style/AppActionTheme" >

+ 9 - 9
app/src/main/java/com/sheep/gamegroup/module/webview/fragment/BaseFgtWeb.java

@@ -93,7 +93,7 @@ public abstract class BaseFgtWeb extends BaseFragment implements UMShareListener
     }
 
     protected boolean addSheepUserAgent = true;
-    protected void webViewLoadUrl(com.tencent.smtt.sdk.WebView webView, String url){
+    protected void webViewLoadUrl(WebView webView, String url){
         if(addSheepUserAgent){
             Map<String, String> extraHeaders = new HashMap<>();
             extraHeaders.put("User-Agent", getSheepUserAgent());
@@ -111,20 +111,20 @@ public abstract class BaseFgtWeb extends BaseFragment implements UMShareListener
         return BuildConfig.APPLICATION_ID + "/" + SysAppUtil.getUserAgent();
     }
 
-    protected void webViewLoadUrl(com.tencent.smtt.sdk.WebView webView, Map<String, String> map, String url){
+    protected void webViewLoadUrl(WebView webView, Map<String, String> map, String url){
         webView.loadUrl(url, map);
         if(TestUtil.isDev()){
             return;
         }
         WebViewCacheInterceptorInst.getInstance().loadUrl(url, map, webView.getSettings().getUserAgentString());
     }
-    protected void webViewLoadUrl(WebView webView, String url){
-        if(TestUtil.isDev()){
-            webView.loadUrl(url);
-            return;
-        }
-        WebViewCacheInterceptorInst.getInstance().loadUrl(webView,url);
-    }
+//    protected void webViewLoadUrl(WebView webView, String url){
+//        if(TestUtil.isDev()){
+//            webView.loadUrl(url);
+//            return;
+//        }
+//        WebViewCacheInterceptorInst.getInstance().loadUrl(webView,url);
+//    }
 
     @Override
     public boolean userButterKnife() {

+ 270 - 0
app/src/main/java/com/sheep/gamegroup/module/webview/fragment/BaseFgtWebX5.java

@@ -0,0 +1,270 @@
+package com.sheep.gamegroup.module.webview.fragment;
+
+import android.text.TextUtils;
+
+import com.kfzs.duanduan.utils.ApkUtils;
+import com.liulishuo.okdownload.DownloadTask;
+import com.liulishuo.okdownload.OkDownload;
+import com.liulishuo.okdownload.StatusUtil;
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.event.EventTypes;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.gamegroup.model.api.IWeb;
+import com.sheep.gamegroup.model.entity.TaskEty;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.DownloadUtil;
+import com.sheep.gamegroup.util.SysAppUtil;
+import com.sheep.gamegroup.util.TestUtil;
+import com.sheep.gamegroup.util.UMConfigUtils;
+import com.sheep.gamegroup.view.activity.TaskDetailAct;
+import com.sheep.jiuyan.samllsheep.BuildConfig;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+import com.sheep.jiuyan.samllsheep.utils.G;
+import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
+import com.tencent.mm.opensdk.constants.ConstantsAPI;
+import com.tencent.mm.opensdk.modelpay.PayResp;
+import com.tencent.smtt.sdk.WebView;
+import com.umeng.socialize.UMShareListener;
+import com.umeng.socialize.bean.SHARE_MEDIA;
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import ren.yale.android.cachewebviewlib.WebViewCacheInterceptorInst;
+
+/**
+ * Created by realicing on 2019/4/12.
+ * realicing@sina.com
+ */
+public abstract class BaseFgtWebX5 extends BaseFragment implements UMShareListener, IWeb {
+
+    public void superFinish(){
+        SheepApp.getInstance().getCurrentActivity().finish();
+    }
+
+
+    public static String addUrlToken(String url) {
+        return addUrlQuery(url, "authorization", SpUtils.getToken(SheepApp.getInstance()));
+    }
+
+    public static String addUrlQuery(String url, String key, String value) {
+        if(url.contains("?"+key+"=") || url.contains("#"+key+"=") || url.contains("&"+key+"=")){
+            return url;
+        }
+        return url + ((url.contains("?") || url.contains("#") && url.contains("=")) ? "&" : "?") + key + "=" + value;
+    }
+    public void setH5Type(String h5Type) {
+        switch (h5Type){
+            case "is_unicom":
+                break;
+        }
+    }
+    @Override
+    public void onStart(SHARE_MEDIA share_media) {
+        //开始分享
+        loadJs(String.format(Locale.CHINA, "callback(\"onStart\", %s)", share_media.getName()));
+    }
+
+    @Override
+    public void onResult(SHARE_MEDIA share_media) {
+        //分享成功 微信分享时,取消也会成功
+        loadJs(String.format(Locale.CHINA, "callback(\"onResult\", %s)", share_media.getName()));
+    }
+
+    @Override
+    public void onError(SHARE_MEDIA share_media, Throwable throwable) {
+        //分享出错
+        String msg = throwable.getMessage();
+        G.showToast(msg != null && msg.contains("没有安装应用") ? "没有安装应用" : msg);
+        loadJs(String.format(Locale.CHINA, "callback(\"onError\", %s)", share_media.getName()));
+    }
+
+    @Override
+    public void onCancel(SHARE_MEDIA share_media) {
+        //取消分享 微信分享时,没有取消
+        loadJs(String.format(Locale.CHINA, "callback(\"onCancel\", %s)", share_media.getName()));
+    }
+
+    protected boolean addSheepUserAgent = true;
+    protected void webViewLoadUrl(WebView webView, String url){
+        if(addSheepUserAgent){
+            Map<String, String> extraHeaders = new HashMap<>();
+            extraHeaders.put("User-Agent", getSheepUserAgent());
+            webViewLoadUrl(webView, extraHeaders, url);
+        } else {
+            webView.loadUrl(url);
+            if(TestUtil.isDev()){
+                return;
+            }
+            WebViewCacheInterceptorInst.getInstance().loadUrl(url, webView.getSettings().getUserAgentString());
+        }
+    }
+
+    public static String getSheepUserAgent(){
+        return BuildConfig.APPLICATION_ID + "/" + SysAppUtil.getUserAgent();
+    }
+
+    protected void webViewLoadUrl(WebView webView, Map<String, String> map, String url){
+        webView.loadUrl(url, map);
+        if(TestUtil.isDev()){
+            return;
+        }
+        WebViewCacheInterceptorInst.getInstance().loadUrl(url, map, webView.getSettings().getUserAgentString());
+    }
+//    protected void webViewLoadUrl(WebView webView, String url){
+//        if(TestUtil.isDev()){
+//            webView.loadUrl(url);
+//            return;
+//        }
+//        WebViewCacheInterceptorInst.getInstance().loadUrl(webView,url);
+//    }
+
+    @Override
+    public boolean userButterKnife() {
+        return true;
+    }
+
+    @Subscribe
+    public void onEventMainThread(PayResp resp) {
+        String result = "";
+        if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
+            result = String.valueOf(resp.errCode + 9000);//微信支付 0 为支付成功;支付宝为 "9000" 代表支付成功
+        }
+        loadJs(String.format(Locale.CHINA, "onAlipayResult('%s')", result));
+    }
+
+    protected TaskEty taskEty;
+
+    public void setTaskEty(TaskEty taskEty) {
+        this.taskEty = taskEty;
+    }
+
+    /**
+     * 主要的事件广播接收更新处理
+     *
+     * @param event
+     */
+    @Subscribe
+    public void onEventMainThread(BigEvent event) {
+        if (taskEty != null && event.getData() instanceof DownLoadInfo) {
+            DownLoadInfo task = (DownLoadInfo) event.getData();
+            if (TextUtils.equals(task.getMDownloadUrl(), taskEty.getDownload_link())) {
+                switch (event.getEventTypes()) {
+                    case DOWNLOAD_RUNNING:
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_ING));
+                        try {
+                            String btnText = String.format(Locale.CHINA, "%d%%(%s)", Math.abs(task.getMPercent()), task.getAverageSpeed());//添加下载速度
+                            String progressText = String.format(Locale.CHINA, "%d%%", Math.abs(task.getMPercent()));//添加下载速度简单版本
+                            loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", btnText));
+                            loadJs(String.format(Locale.CHINA, "onUpdateDownloadProgress('%s')", progressText));
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        break;
+                    case DOWNLOAD_STOP:
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_PAUSE));
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", CommonUtil.CONTINUE_DOWNLOAD));
+                        break;
+                    case DOWNLOAD_COMPLETE:
+                        //在这里处理任务完成的状态
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", CommonUtil.START_INSTALL));
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_FINISH));
+                        updateDownloadBtn();
+                        break;
+                    case DOWNLOAD_CANCEL:
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_DELETE));
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", "已经取消"));
+                        break;
+                    case DOWNLOAD_FAIL:
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_FAIL));
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", CommonUtil.FAIL_DOWNLOAD));
+                        break;
+                }
+            }
+        }
+    }
+
+    private DownloadUtil downloadUtil;
+    public void updateDownloadBtn() {
+        if (taskEty != null) {
+            if (downloadUtil == null)
+                downloadUtil = new DownloadUtil();
+            TaskDetailAct.setBtnStr(taskEty, downloadUtil, object -> SheepApp.getInstance().getCurrentActivity().runOnUiThread(() -> {
+                if (object instanceof Integer) {
+                    type = (int) object;
+                    loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", (int) object));
+                } else if (object instanceof String) {
+                    loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", (String) object));
+                } else if (object instanceof Boolean) {
+                    loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnEnable(%b)", (boolean) object));
+                }
+            }));
+        }
+    }
+    private int type = DownloadUtil.STATUS_INIT;
+    public void onClickDownloadBtn(){
+        switch (type){
+            case DownloadUtil.STATUS_INIT://开始下载
+            default:
+                downloadApk();
+                break;
+            case DownloadUtil.STATUS_FINISH:
+                ApkUtils.installApk(SheepApp.getInstance(), PackageUtil.isExistsFile(taskEty.getPackage_names(), taskEty.getDownload_link()));
+                break;
+            case DownloadUtil.STATUS_INSTALLED:
+                PackageUtil.startApp(SheepApp.getInstance(), taskEty.getPackage_names());
+                break;
+        }
+    }
+    public void downloadApk(){
+        if (taskEty != null) {
+            if (downloadUtil == null)
+                downloadUtil = new DownloadUtil();
+
+            final DownloadTask task;
+            if (TextUtils.isEmpty(taskEty.getDownload_link()) || !taskEty.getDownload_link().contains("http")) {
+                G.showToast(R.string.error_download_link);
+                return;
+            }
+            task = DownloadUtil.getTask(taskEty);
+            final StatusUtil.Status statusOnStore = StatusUtil.getStatus(task);
+            final DownLoadInfo downLoadInfo = downloadUtil.getDownloadTaskByUrl(taskEty);
+            switch (statusOnStore) {
+                case RUNNING:
+                case PENDING://等待的
+                    OkDownload.with().downloadDispatcher().cancel(task);
+                    break;
+                case IDLE://空闲的
+                case UNKNOWN:
+                    downloadUtil.start(downLoadInfo);
+                    break;
+                case COMPLETED://有可能之前已经下载完成,但是数据库里已经没有数据了,这时只需要修改状态
+                    if (task.getFile() != null) {
+                        if (downloadUtil.checkFinish(downLoadInfo)) {//检查文件是否真的完成
+                            downloadUtil.setDownloadTaskFinish(task.getUrl(), task.getFile().getAbsolutePath());
+                        } else {//重新开始下载
+                            downloadUtil.delete(downLoadInfo);
+                            downloadUtil.start(downloadUtil.getDownloadTaskByUrl(taskEty));
+                            downloadUtil.setDownloadTaskStatus(taskEty.getDownload_link(), DownloadUtil.STATUS_INIT);
+                        }
+                    }
+                    updateDownloadBtn();
+                    break;
+            }
+            new Thread(() -> {
+                if (downloadUtil.addDownloadTask(downLoadInfo)) {
+                    //发送红点信息
+                    EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.TIPS_DOWN_ICON));
+                }
+            }).start();
+            UMConfigUtils.onEvent(UMConfigUtils.Event.TASK_DOWNLOAD);
+        }
+    }
+}

+ 616 - 0
app/src/main/java/com/sheep/gamegroup/module/webview/fragment/FgtWeb.java

@@ -0,0 +1,616 @@
+package com.sheep.gamegroup.module.webview.fragment;
+
+import android.annotation.SuppressLint;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Environment;
+import android.provider.MediaStore;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AlertDialog;
+import android.text.TextUtils;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.webkit.ValueCallback;
+import android.webkit.WebChromeClient;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+
+import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.model.entity.DialogConfig;
+import com.sheep.gamegroup.model.entity.WebParams;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.Constant;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.DeviceUtil;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.LogUtil;
+import com.sheep.gamegroup.util.NetUtil;
+import com.sheep.gamegroup.util.StringUtils;
+import com.sheep.gamegroup.util.SysAppUtil;
+import com.sheep.gamegroup.util.TestUtil;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.util.js.KFZSJs;
+import com.sheep.gamegroup.view.activity.MiddleSchemeAct;
+import com.sheep.jiuyan.samllsheep.BuildConfig;
+import com.sheep.jiuyan.samllsheep.Config;
+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.SpUtils;
+import com.yalantis.ucrop.util.FileUtils;
+import com.zhy.http.okhttp.OkHttpUtils;
+import com.zhy.http.okhttp.callback.StringCallback;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import butterknife.BindView;
+import cn.modificator.waterwave_progress.WidgetUtil;
+import okhttp3.Call;
+
+import static android.app.Activity.RESULT_OK;
+
+/**
+ * Created by realicing on 2019/4/12.
+ * realicing@sina.com
+ */
+public class FgtWeb extends BaseFgtWeb {
+
+    @BindView(R.id.webview)
+    WebView mWebView;
+    @BindView(R.id.act_web_loading_pb)
+    ProgressBar act_web_loading_pb;
+    @BindView(R.id.act_web_loading_iv)
+    ImageView act_web_loading_iv;
+    protected WebParams webParams;
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.fgt_web_x5;
+    }
+
+    @Override
+    public void onViewCreated() {
+        initView();
+        initListener();
+    }
+
+    public void initView() {
+        ViewUtil.setImage(act_web_loading_iv, R.drawable.gif_sheep_loading);
+
+        if (webParams == null) {
+            LogUtil.println("程序出错了 没有初始化webParams");
+            //程序出错了
+            return;
+        }
+        String url = webParams.getUrl();
+        String jsUrl = webParams.getJsUrl();
+        if (!TextUtils.isEmpty(url)) {
+            url = url.trim();
+        }
+        if (webParams.isShowTitle()) {
+
+        }
+        initWebViewSettings(mWebView);
+//        try {
+//            if (TestUtil.isTest())
+//                WebView.setWebContentsDebuggingEnabled(true);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+//            webViewSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
+        }
+        if (TextUtils.isEmpty(jsUrl)) {
+            loadUrl(url);
+        } else {
+            initJsData(url, jsUrl);
+        }
+    }
+
+    public static FgtWeb newInstance(WebParams webParams) {
+        FgtWeb fragment = new FgtWeb();
+        fragment.webParams = webParams;
+//        Bundle bundle = new Bundle();
+//        DataUtil.putObject(bundle, webParams);
+//        fragment.setArguments(bundle);
+        return fragment;
+    }
+
+    public FgtWeb() {
+    }
+
+//    @Override
+//    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+//        View rootView = super.onCreateView(inflater, container, savedInstanceState);
+//        Bundle bundle = getArguments();
+//        if (bundle != null) {
+//            WebParams webParams = DataUtil.getObject(bundle, WebParams.class);
+//            if(webParams != null){
+//                this.webParams = webParams;
+//                checkWebParams(webParams);
+//                initView();
+//                initListener();
+//            }
+//        }
+//        return rootView;
+//    }
+
+    //忽略 添加有范商城快捷入口
+    public static final String KEY_IGNORE_ADD_YOU_FAN_LAUNCHER = "ignore_add_you_fan_launcher";
+
+    private void checkWebParams(WebParams webParams) {
+        if (webParams.getUrl().startsWith(Config.YF_SHOP_HOME_SHEEP.split("\\?")[0]) || webParams.getUrl().startsWith(Config.YF_SHOP_HOME_SHEEP_TEST.split("\\?")[0])) {//检测是否是有范商城地址
+            boolean isIgnore = SpUtils.getAsBoolean(KEY_IGNORE_ADD_YOU_FAN_LAUNCHER, false);
+            boolean hasShortcut = SysAppUtil.hasShortcut(SheepApp.getInstance(), Config.YF_SHOP_NAME);
+            boolean isShow = !hasShortcut && !isIgnore && !CommonUtil.getInstance().hasYouFanLauncher();//未忽略并且没有添加有范商品入口
+//            boolean isShow = !isIgnore && !SysAppUtil.isEnableComponentYf();
+            if (isShow) {
+                ViewUtil.showMsgDialog(SheepApp.getInstance().getCurrentActivity(), new DialogConfig().setTitle("温馨提示")
+                        .setMsg("亲,喜欢的话,就添加一个商城的桌面快捷入口吧!(点击否将不再提示)")
+                        .setBtnLeftText("否").setBtnLeftOnClickListener(view -> SpUtils.putAsBoolean(KEY_IGNORE_ADD_YOU_FAN_LAUNCHER, true))
+                        .setBtnRightText("是").setBtnRightOnClickListener(view -> CommonUtil.getInstance().addYouFanLauncher()));
+//                        .setBtnRightText("是").setBtnRightOnClickListener(view -> SysAppUtil.enableComponentYf()));
+            }
+        }
+    }
+
+    //初始化js代码数据
+    private void initJsData(final String url, String jsUrl) {
+        OkHttpUtils.get()
+                .url(jsUrl)
+                .build()
+                .execute(new StringCallback() {
+                    @Override
+                    public void onError(Call call, Exception e, int id) {
+                        G.showToast(R.string.service_data_error);
+                    }
+
+                    @Override
+                    public void onResponse(String response, int id) {
+                        js = response;
+                        loadUrl(url);
+                    }
+                });
+    }
+
+    public void initListener() {
+        CommonUtil.getInstance().setDownloadListener(SheepApp.getInstance().getCurrentActivity(), mWebView);
+    }
+
+    public static void initWebViewSettings(WebView webView) {
+        webView.setClickable(true);
+        WebSettings webSetting = webView.getSettings();
+        webSetting.setJavaScriptEnabled(true);
+        webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
+        webSetting.setAllowFileAccess(true);
+        webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
+//        webSetting.setSupportZoom(true);
+//        webSetting.setBuiltInZoomControls(true);
+        webSetting.setUseWideViewPort(true);
+        webSetting.setSupportMultipleWindows(true);
+        // webSetting.setLoadWithOverviewMode(true);
+        webSetting.setAppCacheEnabled(true);
+        // webSetting.setDatabaseEnabled(true);
+        webSetting.setDomStorageEnabled(true);
+        webSetting.setGeolocationEnabled(true);
+        webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
+        // webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
+        webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
+        // webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
+        webSetting.setCacheMode(NetUtil.CAN_CONNECT_SERVICE ? WebSettings.LOAD_DEFAULT : WebSettings.LOAD_CACHE_ELSE_NETWORK);
+
+        // this.getSettingsExtension().setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);//extension
+        // settings 的设计
+        webSetting.setUserAgentString(getSheepUserAgent());
+    }
+
+    @Override
+    public void onDestroy() {
+        if (act_web_loading_iv != null) {
+            try {
+                act_web_loading_iv.clearAnimation();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        if (mWebView != null) {
+            mWebView.setVisibility(View.GONE);
+            mWebView.removeAllViews();
+            mWebView.destroy();
+        }
+        super.onDestroy();
+    }
+
+    /**
+     *
+     */
+    public static final int INPUT_FILE_REQUEST_CODE = 1;
+    private ValueCallback<Uri> mUploadMessage;
+    private final static int FILECHOOSER_RESULTCODE = 2;
+    private ValueCallback<Uri[]> mFilePathCallback;
+
+    private String mCameraPhotoPath;
+
+    private void loadUrl(final String url) {
+
+        mWebView.setWebChromeClient(new WebChromeClient() {
+            @Override
+            public void onReceivedTitle(WebView view, String title) {
+                super.onReceivedTitle(view, title);
+//                if (webParams.isShowTitle())
+//                    TitleBarUtils
+//                            .getInstance()
+//                            .setTitle(ActWebX5.this, title);
+            }
+
+            @Override
+            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
+                if (mFilePathCallback != null) {
+                    mFilePathCallback.onReceiveValue(null);
+                }
+                mFilePathCallback = filePathCallback;
+
+                /*PhotoPicker.builder()
+                        .setPhotoCount(1)
+                        .setShowCamera(true)
+                        .setShowGif(false)
+                        .setPreviewEnabled(true)
+                        .start(ActWeb.this, PhotoPicker.REQUEST_CODE);*/
+                Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+                if (takePictureIntent.resolveActivity(SheepApp.getInstance().getPackageManager()) != null) {
+                    // Create the File where the photo should go
+                    File photoFile;
+                    photoFile = createImageFile();
+                    takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
+
+                    // Continue only if the File was successfully created
+                    if (photoFile != null) {
+                        mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
+                        takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
+                                Uri.fromFile(photoFile));
+                    } else {
+                    }
+                }
+
+                Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
+                contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
+                contentSelectionIntent.setType("image/*");
+
+                Intent[] intentArray;
+                takePictureIntent = null;//步调用相机
+                if (takePictureIntent != null) {
+                    intentArray = new Intent[]{takePictureIntent};
+                } else {
+                    intentArray = new Intent[0];
+                }
+
+                Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
+                chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
+                chooserIntent.putExtra(Intent.EXTRA_TITLE, "图片选择");
+                chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
+
+                startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);
+
+                return /*super.onShowFileChooser(webView, filePathCallback, fileChooserParams)*/true;
+            }
+
+            //For Android 4.1
+            public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
+                mUploadMessage = uploadMsg;
+                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
+                i.addCategory(Intent.CATEGORY_OPENABLE);
+                i.setType("image/*");
+                FgtWeb.this.startActivityForResult(Intent.createChooser(i, "Image Chooser"), FILECHOOSER_RESULTCODE);
+
+            }
+
+            @Override
+            public void onProgressChanged(WebView view, int newProgress) {
+                LogUtil.println("ActWeb", "onProgressChanged", newProgress);
+                if (newProgress == 100 && ViewUtil.isVisible(act_web_loading_iv)) {
+                    Animation animation = AnimationUtils.loadAnimation(SheepApp.getInstance(), R.anim.anim_alpha_1_0);
+                    animation.setAnimationListener(new Animation.AnimationListener() {
+                        @Override
+                        public void onAnimationStart(Animation animation) {
+
+                        }
+
+                        @Override
+                        public void onAnimationEnd(Animation animation) {
+                            ViewUtil.setVisibility(act_web_loading_iv, false);
+                        }
+
+                        @Override
+                        public void onAnimationRepeat(Animation animation) {
+
+                        }
+                    });
+                    act_web_loading_iv.startAnimation(animation);
+                }
+                ViewUtil.setVisibility(act_web_loading_pb, newProgress != 100);
+                if (act_web_loading_pb != null)
+                    act_web_loading_pb.setProgress(newProgress);
+                super.onProgressChanged(view, newProgress);
+            }
+        });
+        mWebView.setWebViewClient(new WebViewClient() {
+//            @Override
+//            public WebResourceResponse shouldInterceptRequest(WebView webView, String s) {
+//                if (TestUtil.isDev()) {
+//                    return super.shouldInterceptRequest(webView, s);
+//                }
+//                if (s.contains("ssnocache=1")) return null;
+//                LogUtil.println("ActWeb", "shouldInterceptRequest from cache", url);
+//                return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(s));
+//            }
+//
+//            @Override
+//            public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
+//                if (TestUtil.isDev()) {
+//                    return super.shouldInterceptRequest(webView, webResourceRequest);
+//                }
+//                if (url.contains("ssnocache=1")) return null;
+//                LogUtil.println("ActWeb", "shouldInterceptRequest from cache", url);
+//                return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(WebResourceRequestAdapter.adapter(webResourceRequest)));
+//            }
+
+            @Override
+            public boolean shouldOverrideUrlLoading(WebView view, String url) {
+                LogUtil.println("ActWeb", "shouldOverrideUrlLoading", url);
+                //微信H5支付核心代码
+                if (url.startsWith(Config.SHEEP_PAY)) {
+                    String order_no = StringUtils.getQueryParameter(url, Config.YF_SHOP_ORDER_NUMBER_KEY);
+                    Jump2View.getInstance().goActPay(SheepApp.getInstance().getCurrentActivity(), order_no, SpUtils.getToken(SheepApp.getInstance()));
+                    return true;
+                } else if (url.startsWith(Config.SHEEP)) {
+                    MiddleSchemeAct.parseAndJumpUri(SheepApp.getInstance().getCurrentActivity(), Uri.parse(url));
+                    return true;
+                } else if (url.startsWith("weixin://wap/pay?")) {
+                    try {
+                        Intent intent = new Intent();
+                        intent.setAction(Intent.ACTION_VIEW);
+                        intent.setData(Uri.parse(url));
+                        startActivity(intent);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return true;
+                } else if (url.startsWith("alipays:") || url.startsWith("alipay")) {
+                    try {
+                        startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url)));
+                    } catch (Exception e) {
+                        new AlertDialog.Builder(SheepApp.getInstance().getCurrentActivity())
+                                .setMessage("未检测到支付宝客户端,请安装后重试。")
+                                .setPositiveButton("立即安装", new DialogInterface.OnClickListener() {
+
+                                    @Override
+                                    public void onClick(DialogInterface dialog, int which) {
+                                        Uri alipayUrl = Uri.parse("https://d.alipay.com");
+                                        startActivity(new Intent("android.intent.action.VIEW", alipayUrl));
+                                    }
+                                }).setNegativeButton("取消", null).show();
+                    }
+                    return true;
+                } else if (url.startsWith("https://wx.tenpay.com")) {
+                    Map<String, String> extraHeaders = new HashMap<>();
+                    extraHeaders.put("Referer", "http://17xmy.com");
+                    webViewLoadUrl(view, extraHeaders, url);
+                    return true;
+                } else if (url.contains("kfzs.com") || (url.startsWith("http://10.8.") && TestUtil.isDev())) {
+                    Map<String, String> extraHeaders = new HashMap<>();
+                    extraHeaders.put("Referer", "http://kfzs.com");
+                    webViewLoadUrl(view, extraHeaders, url);
+                    return true;
+                } else {
+                    return false;
+                }
+            }
+
+            @Override
+            public void onPageStarted(WebView view, String url, Bitmap favicon) {
+                LogUtil.println("ActWeb", "onPageStarted", url);
+                super.onPageStarted(view, url, favicon);
+            }
+
+            @Override
+            public void onPageFinished(WebView view, String url) {
+                LogUtil.println("ActWeb", "onPageFinished", url);
+                super.onPageFinished(view, url);
+                loadJs();
+            }
+        });
+
+        if (webParams.isNeedJsInteract()) {
+            mWebView.addJavascriptInterface(new KFZSJs(SheepApp.getInstance().getCurrentActivity(), this), "kfzsjs");
+            String loadUrl = url;
+            if (webParams.getTokenKey() != null) {
+                if (url.startsWith(Config.YF_SHOP_HOME)) {
+                    webParams.tokenFirstUpperCase();
+                }
+                loadUrl = addUrlQuery(url, webParams.getTokenKey(), SpUtils.getToken(SheepApp.getInstance()));
+                loadUrl = addUrlQuery(loadUrl, "pf", Config.YF_SHOP_PLATFORM);
+                loadUrl = addUrlQuery(loadUrl, "device_id", DeviceUtil.getDeviceId(SheepApp.getInstance()));
+            }
+            loadUrl = addUrlQuery(loadUrl, webParams.getInvitationCodeKey(), DataUtil.getInstance().getInvitationCode());
+            LogUtil.println("ActWeb loadUrl = " + loadUrl);
+            webViewLoadUrl(mWebView, loadUrl);
+        } else {
+            webViewLoadUrl(mWebView, url);
+        }
+    }
+
+    //在sdcard卡创建缩略图
+    //createImageFileInSdcard
+    @SuppressLint("SdCardPath")
+    private File createImageFile() {
+        //mCameraPhotoPath="/mnt/sdcard/tmp.png";
+        File file = new File(Environment.getExternalStorageDirectory() + "/", "tmp.png");
+        mCameraPhotoPath = file.getAbsolutePath();
+        if (!file.exists()) {
+            try {
+                file.createNewFile();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return file;
+    }
+
+    /**
+     * 是否响应返回键
+     */
+    private boolean responseBack = true;
+
+    @Override
+    public boolean onBackPressed() {
+        if (responseBack) {
+            if (mWebView != null && mWebView.canGoBack()) {
+                mWebView.goBack();
+                return true;
+            } else {
+                return false;
+            }
+        } else {
+            loadJs("onBackPressed()");
+            return true;
+        }
+    }
+
+    @Override
+    public void loadJs(String js) {
+        ViewUtil.loadJs(mWebView, js);
+    }
+
+    private int onResumeCount = 0;
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (onResumeCount > 0 && mWebView != null && webParams != null && webParams.isRefreshClick()) {
+            loadJs("refreshClick()");
+        }
+        onResumeCount++;
+    }
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == FILECHOOSER_RESULTCODE) {
+            if (null == mUploadMessage) return;
+            Uri result = data == null || resultCode != RESULT_OK ? null
+                    : data.getData();
+            if (result != null) {
+                String imagePath = FileUtils.getPath(SheepApp.getInstance(), result);
+                if (!TextUtils.isEmpty(imagePath)) {
+                    result = Uri.parse("file:///" + imagePath);
+                }
+            }
+            mUploadMessage.onReceiveValue(result);
+            mUploadMessage = null;
+        } else if (requestCode == INPUT_FILE_REQUEST_CODE && mFilePathCallback != null) {
+            // 5.0的回调
+            Uri[] results = null;
+
+            // Check that the response is a good one
+            if (resultCode == RESULT_OK) {
+                if (data == null) {
+                    // If there is not data, then we may have taken a photo
+                    if (mCameraPhotoPath != null) {
+                        results = new Uri[]{Uri.parse(mCameraPhotoPath)};
+                    }
+                } else {
+                    String dataString = data.getDataString();
+                    if (dataString != null) {
+                        results = new Uri[]{Uri.parse(dataString)};
+                    }
+                }
+            }
+
+            mFilePathCallback.onReceiveValue(results);
+            mFilePathCallback = null;
+        } else if (Constant.INTENT_RECHARGE == requestCode) {
+            mWebView.reload();
+        } else {
+            super.onActivityResult(requestCode, resultCode, data);
+            return;
+        }
+    }
+
+    // 注入js函数监听
+    public void loadJs() {
+        if (TextUtils.isEmpty(js))
+            return;
+        ViewUtil.loadJs(mWebView, getJs());
+        LogUtil.println("ActWeb", "loadJs", js);
+    }
+
+    private String js;
+
+    private String getJs() {
+        String testJsStart = "alert('成功注入');";
+        return BuildConfig.DEBUG ? testJsStart + "\n" + js : js;
+    }
+
+    @Override
+    public boolean isResponseBack() {
+        return responseBack;
+    }
+
+    @Override
+    public void setResponseBack(boolean responseBack) {
+        this.responseBack = responseBack;
+    }
+
+    @Override
+    public void clearWebView() {
+        mWebView = null;
+    }
+
+    @Override
+    public void showTitleBar(boolean isShow) {
+        try {
+            ActionBar actionBar = ((BaseActivity) SheepApp.getInstance().getCurrentActivity()).getSupportActionBar();
+            if (actionBar != null)
+                actionBar.hide();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void setNonTouchArea(float height) {
+        mWebView.setOnTouchListener((v, event) -> {
+            float y = event.getY();
+            int yy = WidgetUtil.Px2Dp(getContext(), y);
+            switch (event.getAction()) {
+                case MotionEvent.ACTION_DOWN:
+                    if (yy < height) {
+                        mWebView.requestDisallowInterceptTouchEvent(true);
+                    } else {
+                        mWebView.requestDisallowInterceptTouchEvent(false);
+                    }
+                    break;
+                case MotionEvent.ACTION_UP:
+                    break;
+                case MotionEvent.ACTION_MOVE:
+                    break;
+            }
+            return false;
+        });
+    }
+
+    public void callTransparent(String callback, String data) {
+        loadJs(callback + "(" + data + ")");
+    }
+
+}

+ 7 - 11
app/src/main/java/com/sheep/gamegroup/module/webview/fragment/FgtWebX5.java

@@ -6,17 +6,13 @@ import android.content.Intent;
 import android.graphics.Bitmap;
 import android.net.Uri;
 import android.os.Build;
-import android.os.Bundle;
 import android.os.Environment;
 import android.provider.MediaStore;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AlertDialog;
 import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.ViewGroup;
 import android.view.animation.Animation;
 import android.view.animation.AnimationUtils;
 import android.widget.ImageView;
@@ -73,7 +69,7 @@ import static android.app.Activity.RESULT_OK;
  * Created by realicing on 2019/4/12.
  * realicing@sina.com
  */
-public class FgtWebX5 extends BaseFgtWeb {
+public class FgtWebX5 extends BaseFgtWebX5 {
 
     @BindView(R.id.webview)
     WebView mWebView;
@@ -111,12 +107,12 @@ public class FgtWebX5 extends BaseFgtWeb {
 
         }
         initWebViewSettings(mWebView);
-        try {
-            if (TestUtil.isTest())
-                WebView.setWebContentsDebuggingEnabled(true);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+//        try {
+//            if (TestUtil.isTest())
+//                WebView.setWebContentsDebuggingEnabled(true);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
 //            webViewSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
         }

+ 1 - 7
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -13,22 +13,18 @@ import android.os.Message;
 import android.support.design.widget.TabLayout;
 import android.support.v7.app.AlertDialog;
 import android.support.v7.widget.GridLayoutManager;
-import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.text.Html;
 import android.text.TextUtils;
 import android.util.TypedValue;
 import android.view.Gravity;
 import android.view.LayoutInflater;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
-import android.view.WindowManager;
 import android.webkit.WebView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
-import android.widget.PopupWindow;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
@@ -71,14 +67,12 @@ import com.sheep.gamegroup.model.entity.WithdrawalEty;
 import com.sheep.gamegroup.model.entity.XiaomiGameEntity;
 import com.sheep.gamegroup.model.util.EntityUtils;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
-import com.sheep.gamegroup.module.home.adapter.AdpDailyPlay;
 import com.sheep.gamegroup.module.home.adapter.AdpHomeList;
-import com.sheep.gamegroup.module.skin.util.SkinUtil;
 import com.sheep.gamegroup.usage.AppUsageManager;
 import com.sheep.gamegroup.util.viewHelper.PopupWindowUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
-import com.sheep.gamegroup.view.activity.GameTaskOrderListAct;
 import com.sheep.gamegroup.view.activity.ActWebX5YF;
+import com.sheep.gamegroup.view.activity.GameTaskOrderListAct;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.Config;

+ 20 - 0
app/src/main/java/com/sheep/gamegroup/util/DeviceUtil.java

@@ -1,12 +1,14 @@
 package com.sheep.gamegroup.util;
 
 import android.content.Context;
+import android.os.Build;
 import android.provider.Settings;
 import android.text.TextUtils;
 
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 
+import java.lang.reflect.Field;
 import java.util.Random;
 
 /**
@@ -98,4 +100,22 @@ public class DeviceUtil {
         return uniqueId.toString()+"";
     }
 
+    public static boolean checkCpuArchInfo() {
+        Field[] fields = Build.class.getDeclaredFields();
+        for (Field field : fields) {
+            try {
+                field.setAccessible(true);
+                if (field.getName().contains("CPU_ABI")) {
+                    Object obj = field.get(null);
+                    if (obj != null && "x86".equals(obj.toString())) {
+                        return false;
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return true;
+    }
+
 }

+ 7 - 2
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -33,7 +33,6 @@ import com.sheep.gamegroup.model.entity.DiscoveryVideo;
 import com.sheep.gamegroup.model.entity.GameEntity;
 import com.sheep.gamegroup.model.entity.GameListTag;
 import com.sheep.gamegroup.model.entity.GameListType;
-import com.sheep.gamegroup.model.entity.GiftBag;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
 import com.sheep.gamegroup.model.entity.IDBean;
 import com.sheep.gamegroup.model.entity.LoginEntity;
@@ -135,6 +134,7 @@ import com.sheep.gamegroup.view.activity.ActUserLabelList;
 import com.sheep.gamegroup.view.activity.ActUserNoviceGuidance;
 import com.sheep.gamegroup.view.activity.ActVideoComment;
 import com.sheep.gamegroup.view.activity.ActVideoDetail;
+import com.sheep.gamegroup.view.activity.ActWeb;
 import com.sheep.gamegroup.view.activity.ActWebX5;
 import com.sheep.gamegroup.view.activity.ActXianWanWeb;
 import com.sheep.gamegroup.view.activity.ActXiaomiGame;
@@ -1022,7 +1022,12 @@ public class Jump2View {
             goActPlayVideo(url, webParams.getTitle());
             return;
         }
-        Intent intent = new Intent(context, ActWebX5.class);
+        Intent intent = null;
+        if (DeviceUtil.checkCpuArchInfo()) {
+            intent = new Intent(context, ActWebX5.class);
+        } else {
+            intent = new Intent(context, ActWeb.class);
+        }
         intent.putExtra(WebParams.class.getSimpleName(), webParams);
         if (webParams.isForResult()) {
             ((Activity) context).startActivityForResult(intent, webParams.getAction());

+ 6 - 1
app/src/main/java/com/sheep/gamegroup/util/MainTab.java

@@ -5,6 +5,7 @@ import android.support.v4.app.Fragment;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.module.game.fragment.FgtGameCenter;
 import com.sheep.gamegroup.module.skin.util.SkinUtil;
+import com.sheep.gamegroup.module.webview.fragment.FgtWeb;
 import com.sheep.gamegroup.module.webview.fragment.FgtWebX5;
 import com.sheep.gamegroup.view.fragment.FgtAskGetMoney;
 import com.sheep.gamegroup.view.fragment.FgtAskGetMoneyNewYear;
@@ -57,7 +58,11 @@ public enum MainTab {
         @Override
         public Fragment getFragment() {
 //            return SkinUtil.isLoadNewYearSkin() ? new FgtAskGetMoneyNewYear() : new FgtAskGetMoney();
-            return FgtWebX5.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_SMALL_SHEEP_INVITATION_HOME), "邀请赚钱"));
+            if(DeviceUtil.checkCpuArchInfo()) {
+                return FgtWebX5.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_SMALL_SHEEP_INVITATION_HOME), "邀请赚钱"));
+            }else{
+                return FgtWeb.newInstance(new WebParams(Config.getUrlByPath(Config.PATH_SMALL_SHEEP_INVITATION_HOME), "邀请赚钱"));
+            }
         }
 
         @Override

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/util/SysAppUtil.java

@@ -1122,13 +1122,13 @@ public class SysAppUtil {
     public static void enableComponentYf() {
         new Thread(() -> {
             //启用有范商城
-            ComponentName testComponent = new ComponentName(SheepApp.getInstance(), "com.sheep.gamegroup.view.activity.ActYf");
+            ComponentName testComponent = new ComponentName(SheepApp.getInstance(), "com.sheep.gamegroup.view.activity.ActYfX5");
             enableComponent(testComponent, true);
         }).start();
     }
     public static boolean isEnableComponentYf() {
         //启用有范商城
-        ComponentName testComponent = new ComponentName(SheepApp.getInstance(), "com.sheep.gamegroup.view.activity.ActYf");
+        ComponentName testComponent = new ComponentName(SheepApp.getInstance(), "com.sheep.gamegroup.view.activity.ActYfX5");
         return isEnableComponent(testComponent);
     }
     /**

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/util/TestUtil.java

@@ -49,7 +49,7 @@ import com.sheep.gamegroup.module.plugin.util.SheepPluginUtil;
 import com.sheep.gamegroup.module.skin.util.SkinUtil;
 import com.sheep.gamegroup.module.yf_shop.model.ReceiveCouponsCheckResq;
 import com.sheep.gamegroup.usage.AppUsageManager;
-import com.sheep.gamegroup.util.js.BaseActWeb;
+import com.sheep.gamegroup.util.js.BaseActWebX5;
 import com.sheep.gamegroup.util.share.ShareLinkConfig;
 import com.sheep.gamegroup.view.activity.ActInstallApkList;
 import com.sheep.gamegroup.view.activity.ActMain;
@@ -922,7 +922,7 @@ public class TestUtil {
         CommonUtil.getInstance().initUrlConfigByNet(name, new Action1<String>() {
             @Override
             public void call(String url) {
-                StringUtils.CopyText(BaseActWeb.addUrlToken(url));
+                StringUtils.CopyText(BaseActWebX5.addUrlToken(url));
             }
         });
     }

+ 14 - 15
app/src/main/java/com/sheep/gamegroup/util/js/BaseActWeb.java

@@ -36,7 +36,6 @@ import com.umeng.socialize.bean.SHARE_MEDIA;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
-import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 
@@ -117,25 +116,25 @@ public abstract class BaseActWeb extends BaseUMActivity implements IWeb {
     }
 
     protected boolean addSheepUserAgent = true;
-    protected void webViewLoadUrl(com.tencent.smtt.sdk.WebView webView, String url){
-        if(addSheepUserAgent){
-            Map<String, String> extraHeaders = new HashMap<>();
-            extraHeaders.put("User-Agent", getSheepUserAgent());
-            webViewLoadUrl(webView, extraHeaders, url);
-        } else {
-            webView.loadUrl(url);
-            if(TestUtil.isDev()){
-                return;
-            }
-            WebViewCacheInterceptorInst.getInstance().loadUrl(url, webView.getSettings().getUserAgentString());
-        }
-    }
+//    protected void webViewLoadUrl(com.tencent.smtt.sdk.WebView webView, String url){
+//        if(addSheepUserAgent){
+//            Map<String, String> extraHeaders = new HashMap<>();
+//            extraHeaders.put("User-Agent", getSheepUserAgent());
+//            webViewLoadUrl(webView, extraHeaders, url);
+//        } else {
+//            webView.loadUrl(url);
+//            if(TestUtil.isDev()){
+//                return;
+//            }
+//            WebViewCacheInterceptorInst.getInstance().loadUrl(url, webView.getSettings().getUserAgentString());
+//        }
+//    }
 
     public static String getSheepUserAgent(){
         return BuildConfig.APPLICATION_ID + "/" + SysAppUtil.getUserAgent();
     }
 
-    protected void webViewLoadUrl(com.tencent.smtt.sdk.WebView webView, Map<String, String> map, String url){
+    protected void webViewLoadUrl(WebView webView, Map<String, String> map, String url){
         webView.loadUrl(url, map);
         if(TestUtil.isDev()){
             return;

+ 294 - 0
app/src/main/java/com/sheep/gamegroup/util/js/BaseActWebX5.java

@@ -0,0 +1,294 @@
+package com.sheep.gamegroup.util.js;
+
+import android.text.TextUtils;
+import android.view.View;
+import android.webkit.WebView;
+
+import com.kfzs.duanduan.utils.ApkUtils;
+import com.liulishuo.okdownload.DownloadTask;
+import com.liulishuo.okdownload.OkDownload;
+import com.liulishuo.okdownload.StatusUtil;
+import com.sheep.gamegroup.absBase.BaseUMActivity;
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.event.EventTypes;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.gamegroup.model.api.IWeb;
+import com.sheep.gamegroup.model.entity.TaskEty;
+import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.DownloadUtil;
+import com.sheep.gamegroup.util.SysAppUtil;
+import com.sheep.gamegroup.util.TestUtil;
+import com.sheep.gamegroup.util.UMConfigUtils;
+import com.sheep.gamegroup.util.share.ShareLinkConfig;
+import com.sheep.gamegroup.view.activity.TaskDetailAct;
+import com.sheep.jiuyan.samllsheep.BuildConfig;
+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.PackageUtil;
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+import com.tencent.mm.opensdk.constants.ConstantsAPI;
+import com.tencent.mm.opensdk.modelpay.PayResp;
+import com.umeng.socialize.bean.SHARE_MEDIA;
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import ren.yale.android.cachewebviewlib.WebViewCacheInterceptorInst;
+import rx.functions.Action1;
+
+/**
+ * Created by realicing on 2018/11/23.
+ * realicing@sina.com
+ */
+public abstract class BaseActWebX5 extends BaseUMActivity implements IWeb {
+
+    public void superFinish(){
+        super.finish();
+    }
+
+
+    public static String addUrlToken(String url) {
+        return addUrlQuery(url, "authorization", SpUtils.getToken(SheepApp.getInstance()));
+    }
+
+    public static String addUrlQuery(String url, String key, String value) {
+        if(url.contains("?"+key+"=") || url.contains("#"+key+"=") || url.contains("&"+key+"=")){
+            return url;
+        }
+        return url + ((url.contains("?") || url.contains("#") && url.contains("=")) ? "&" : "?") + key + "=" + value;
+    }
+    public void setH5Type(String h5Type) {
+        switch (h5Type){
+            case "is_unicom":
+                TitleBarUtils
+                        .getInstance()
+                        .setRightImgBotton(this, R.mipmap.share, new View.OnClickListener() {
+                            @Override
+                            public void onClick(View view) {
+                                CommonUtil.getInstance().callActionWithUserInfo(new Action1<UserEntity>() {
+                                    @Override
+                                    public void call(UserEntity userEntity) {
+                                        if (userEntity == null) {
+                                            G.showToast("分享功能调试中");
+                                            return;
+                                        }
+//                                是否是联通卡分享 1:是 0:不是
+//                                分享链接需要加个 is_unicom  参数
+                                        String url = addUrlQuery(userEntity.getShareLink(), "is_unicom", "1");
+                                        new ShareLinkConfig().setLink(url).setTitle("下载小绵羊,免费领取联通大/小天神卡").toShare(BaseActWebX5.this);
+                                    }
+                                });
+                            }
+                        });
+                break;
+        }
+    }
+    @Override
+    public void onStart(SHARE_MEDIA share_media) {
+        //开始分享
+        loadJs(String.format(Locale.CHINA, "callback(\"onStart\", %s)", share_media.getName()));
+    }
+
+    @Override
+    public void onResult(SHARE_MEDIA share_media) {
+        //分享成功 微信分享时,取消也会成功
+        loadJs(String.format(Locale.CHINA, "callback(\"onResult\", %s)", share_media.getName()));
+    }
+
+    @Override
+    public void onError(SHARE_MEDIA share_media, Throwable throwable) {
+        //分享出错
+        String msg = throwable.getMessage();
+        G.showToast(msg != null && msg.contains("没有安装应用") ? "没有安装应用" : msg);
+        loadJs(String.format(Locale.CHINA, "callback(\"onError\", %s)", share_media.getName()));
+    }
+
+    @Override
+    public void onCancel(SHARE_MEDIA share_media) {
+        //取消分享 微信分享时,没有取消
+        loadJs(String.format(Locale.CHINA, "callback(\"onCancel\", %s)", share_media.getName()));
+    }
+
+    protected boolean addSheepUserAgent = true;
+    protected void webViewLoadUrl(com.tencent.smtt.sdk.WebView webView, String url){
+        if(addSheepUserAgent){
+            Map<String, String> extraHeaders = new HashMap<>();
+            extraHeaders.put("User-Agent", getSheepUserAgent());
+            webViewLoadUrl(webView, extraHeaders, url);
+        } else {
+            webView.loadUrl(url);
+            if(TestUtil.isDev()){
+                return;
+            }
+            WebViewCacheInterceptorInst.getInstance().loadUrl(url, webView.getSettings().getUserAgentString());
+        }
+    }
+
+    public static String getSheepUserAgent(){
+        return BuildConfig.APPLICATION_ID + "/" + SysAppUtil.getUserAgent();
+    }
+
+    protected void webViewLoadUrl(com.tencent.smtt.sdk.WebView webView, Map<String, String> map, String url){
+        webView.loadUrl(url, map);
+        if(TestUtil.isDev()){
+            return;
+        }
+        WebViewCacheInterceptorInst.getInstance().loadUrl(url, map, webView.getSettings().getUserAgentString());
+    }
+    protected void webViewLoadUrl(WebView webView, String url){
+        if(TestUtil.isDev()){
+            webView.loadUrl(url);
+            return;
+        }
+        WebViewCacheInterceptorInst.getInstance().loadUrl(webView,url);
+    }
+
+    @Override
+    protected boolean needRegisterEventBus() {
+        return true;
+    }
+
+    @Subscribe
+    public void onEventMainThread(PayResp resp) {
+        String result = "";
+        if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
+            result = String.valueOf(resp.errCode + 9000);//微信支付 0 为支付成功;支付宝为 "9000" 代表支付成功
+        }
+        loadJs(String.format(Locale.CHINA, "onAlipayResult('%s')", result));
+    }
+
+    protected TaskEty taskEty;
+
+    public void setTaskEty(TaskEty taskEty) {
+        this.taskEty = taskEty;
+    }
+
+    /**
+     * 主要的事件广播接收更新处理
+     *
+     * @param event
+     */
+    @Subscribe
+    public void onEventMainThread(BigEvent event) {
+        if (taskEty != null && event.getData() instanceof DownLoadInfo) {
+            DownLoadInfo task = (DownLoadInfo) event.getData();
+            if (TextUtils.equals(task.getMDownloadUrl(), taskEty.getDownload_link())) {
+                switch (event.getEventTypes()) {
+                    case DOWNLOAD_RUNNING:
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_ING));
+                        try {
+                            String btnText = String.format(Locale.CHINA, "%d%%(%s)", Math.abs(task.getMPercent()), task.getAverageSpeed());//添加下载速度
+                            String progressText = String.format(Locale.CHINA, "%d%%", Math.abs(task.getMPercent()));//添加下载速度简单版本
+                            loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", btnText));
+                            loadJs(String.format(Locale.CHINA, "onUpdateDownloadProgress('%s')", progressText));
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        break;
+                    case DOWNLOAD_STOP:
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_PAUSE));
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", CommonUtil.CONTINUE_DOWNLOAD));
+                        break;
+                    case DOWNLOAD_COMPLETE:
+                        //在这里处理任务完成的状态
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", CommonUtil.START_INSTALL));
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_FINISH));
+                        updateDownloadBtn();
+                        break;
+                    case DOWNLOAD_CANCEL:
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_DELETE));
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", "已经取消"));
+                        break;
+                    case DOWNLOAD_FAIL:
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", DownloadUtil.STATUS_FAIL));
+                        loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", CommonUtil.FAIL_DOWNLOAD));
+                        break;
+                }
+            }
+        }
+    }
+
+    private DownloadUtil downloadUtil;
+    public void updateDownloadBtn() {
+        if (taskEty != null) {
+            if (downloadUtil == null)
+                downloadUtil = new DownloadUtil();
+            TaskDetailAct.setBtnStr(taskEty, downloadUtil, object -> runOnUiThread(() -> {
+                if (object instanceof Integer) {
+                    type = (int) object;
+                    loadJs(String.format(Locale.CHINA, "onUpdateDownloadStatus(%d)", (int) object));
+                } else if (object instanceof String) {
+                    loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnText('%s')", (String) object));
+                } else if (object instanceof Boolean) {
+                    loadJs(String.format(Locale.CHINA, "onUpdateDownloadBtnEnable(%b)", (boolean) object));
+                }
+            }));
+        }
+    }
+    private int type = DownloadUtil.STATUS_INIT;
+    public void onClickDownloadBtn(){
+        switch (type){
+            case DownloadUtil.STATUS_INIT://开始下载
+            default:
+                downloadApk();
+                break;
+            case DownloadUtil.STATUS_FINISH:
+                ApkUtils.installApk(SheepApp.getInstance(), PackageUtil.isExistsFile(taskEty.getPackage_names(), taskEty.getDownload_link()));
+                break;
+            case DownloadUtil.STATUS_INSTALLED:
+                PackageUtil.startApp(SheepApp.getInstance(), taskEty.getPackage_names());
+                break;
+        }
+    }
+    public void downloadApk(){
+        if (taskEty != null) {
+            if (downloadUtil == null)
+                downloadUtil = new DownloadUtil();
+
+            final DownloadTask task;
+            if (TextUtils.isEmpty(taskEty.getDownload_link()) || !taskEty.getDownload_link().contains("http")) {
+                G.showToast(R.string.error_download_link);
+                return;
+            }
+            task = DownloadUtil.getTask(taskEty);
+            final StatusUtil.Status statusOnStore = StatusUtil.getStatus(task);
+            final DownLoadInfo downLoadInfo = downloadUtil.getDownloadTaskByUrl(taskEty);
+            switch (statusOnStore) {
+                case RUNNING:
+                case PENDING://等待的
+                    OkDownload.with().downloadDispatcher().cancel(task);
+                    break;
+                case IDLE://空闲的
+                case UNKNOWN:
+                    downloadUtil.start(downLoadInfo);
+                    break;
+                case COMPLETED://有可能之前已经下载完成,但是数据库里已经没有数据了,这时只需要修改状态
+                    if (task.getFile() != null) {
+                        if (downloadUtil.checkFinish(downLoadInfo)) {//检查文件是否真的完成
+                            downloadUtil.setDownloadTaskFinish(task.getUrl(), task.getFile().getAbsolutePath());
+                        } else {//重新开始下载
+                            downloadUtil.delete(downLoadInfo);
+                            downloadUtil.start(downloadUtil.getDownloadTaskByUrl(taskEty));
+                            downloadUtil.setDownloadTaskStatus(taskEty.getDownload_link(), DownloadUtil.STATUS_INIT);
+                        }
+                    }
+                    updateDownloadBtn();
+                    break;
+            }
+            new Thread(() -> {
+                if (downloadUtil.addDownloadTask(downLoadInfo)) {
+                    //发送红点信息
+                    EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.TIPS_DOWN_ICON));
+                }
+            }).start();
+            UMConfigUtils.onEvent(UMConfigUtils.Event.TASK_DOWNLOAD);
+        }
+    }
+}

+ 2 - 4
app/src/main/java/com/sheep/gamegroup/util/js/KFZSJs.java

@@ -4,7 +4,6 @@ import android.app.Activity;
 import android.content.Intent;
 import android.provider.MediaStore;
 import android.text.TextUtils;
-import android.util.Log;
 import android.view.View;
 import android.webkit.JavascriptInterface;
 
@@ -13,7 +12,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.absBase.AbsObserver;
 import com.sheep.gamegroup.event.WebViewEvent;
 import com.sheep.gamegroup.model.api.IWeb;
-import com.sheep.gamegroup.model.entity.Article;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
 import com.sheep.gamegroup.model.entity.TaskEty;
@@ -64,9 +62,9 @@ public class KFZSJs {
     private Activity activity;
     private IWeb iWeb;
 
-    public KFZSJs(BaseActWeb activity) {
+    public KFZSJs(Activity activity) {
         this.activity = activity;
-        this.iWeb = activity;
+        this.iWeb = (IWeb) activity;
     }
 
     public KFZSJs(Activity activity, IWeb iWeb) {

+ 5 - 5
app/src/main/java/com/sheep/gamegroup/util/share/ShareLinkConfig.java

@@ -22,7 +22,7 @@ import com.sheep.gamegroup.util.StringUtils;
 import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.util.ZipChannelUtil;
-import com.sheep.gamegroup.util.js.BaseActWeb;
+import com.sheep.gamegroup.util.js.BaseActWebX5;
 import com.sheep.gamegroup.util.viewHelper.CacheImageUtil;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -391,14 +391,14 @@ public class ShareLinkConfig {
         switch (type) {
             case ShareLinkConfig.WX:
             case ShareLinkConfig.WEIXIN_CIRCLE:
-                return BaseActWeb.addUrlQuery(url,"type","1");
+                return BaseActWebX5.addUrlQuery(url,"type","1");
             case ShareLinkConfig.QQ:
             case ShareLinkConfig.QZONE:
-                return BaseActWeb.addUrlQuery(url,"type","2");
+                return BaseActWebX5.addUrlQuery(url,"type","2");
             case ShareLinkConfig.FACE_TO_FACE:
-                return BaseActWeb.addUrlQuery(url, "type", "4");
+                return BaseActWebX5.addUrlQuery(url, "type", "4");
             default:
-                return BaseActWeb.addUrlQuery(url,"type","5");
+                return BaseActWebX5.addUrlQuery(url,"type","5");
         }
     }
     public final static String FACE_TO_FACE = "face_to_face";

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/view/activity/ActInvitation.java

@@ -46,7 +46,7 @@ import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.ViewHolder;
 import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.gamegroup.util.js.BaseActWeb;
+import com.sheep.gamegroup.util.js.BaseActWebX5;
 import com.sheep.gamegroup.util.share.ShareLinkConfig;
 import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
 import com.sheep.gamegroup.view.adapter.ArrayPagerAdapter;
@@ -343,7 +343,7 @@ public class ActInvitation extends BaseUMActivity {
                     float radius = 4 / 216F;
                     float topRadius = 2 / 216F;
                     float logoRadius = rqRadius * 16 / 68;
-                    GlideImageLoader.saveAndSetRqImage(image_bottom, TestUtil.isSheep() ? item.getLink() : BaseActWeb.addUrlQuery(userEntity.getShareLink(), "flag", item.getFlag()), 400, new RequestOptions().disallowHardwareConfig().override((int) (imgWidth * rqRadius)));
+                    GlideImageLoader.saveAndSetRqImage(image_bottom, TestUtil.isSheep() ? item.getLink() : BaseActWebX5.addUrlQuery(userEntity.getShareLink(), "flag", item.getFlag()), 400, new RequestOptions().disallowHardwareConfig().override((int) (imgWidth * rqRadius)));
                     //重新设置logo的宽高
                     ViewGroup.LayoutParams layoutParams = image_logo.getLayoutParams();
                     layoutParams.width = (int) (imgWidth * logoRadius);

+ 588 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActWeb.java

@@ -0,0 +1,588 @@
+package com.sheep.gamegroup.view.activity;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Environment;
+import android.provider.MediaStore;
+import android.support.annotation.Nullable;
+import android.support.annotation.RequiresApi;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AlertDialog;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.webkit.ValueCallback;
+import android.webkit.WebChromeClient;
+import android.webkit.WebSettings;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+
+import com.sheep.gamegroup.model.entity.WebParams;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.Constant;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.DeviceUtil;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.LogUtil;
+import com.sheep.gamegroup.util.NetUtil;
+import com.sheep.gamegroup.util.StringUtils;
+import com.sheep.gamegroup.util.SysAppUtil;
+import com.sheep.gamegroup.util.TestUtil;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.util.js.BaseActWeb;
+import com.sheep.gamegroup.util.js.BaseActWebX5;
+import com.sheep.gamegroup.util.js.KFZSJs;
+import com.sheep.jiuyan.samllsheep.BuildConfig;
+import com.sheep.jiuyan.samllsheep.Config;
+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.SpUtils;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+import com.yalantis.ucrop.util.FileUtils;
+import com.zhy.http.okhttp.OkHttpUtils;
+import com.zhy.http.okhttp.callback.StringCallback;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import butterknife.BindView;
+import okhttp3.Call;
+
+
+/**
+ * web页面--含有所有js及url后添加authorization
+ * Created by zengjiebin on 2018/4/27.
+ */
+public class ActWeb extends BaseActWeb {
+
+    @BindView(R.id.webview)
+    WebView mWebView;
+    @BindView(R.id.act_web_loading_pb)
+    ProgressBar act_web_loading_pb;
+    @BindView(R.id.act_web_loading_iv)
+    ImageView act_web_loading_iv;
+    protected WebParams webParams;
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        initWebParams();
+        super.onCreate(savedInstanceState);
+    }
+
+    @Override
+    protected int getTitleLayoutId() {
+        if(checkWebParams(webParams)){
+            return R.layout.title_yf;
+        }
+        return super.getTitleLayoutId();
+    }
+
+    @Override
+    protected int getLayoutId() {
+        return R.layout.act_web_x5;
+    }
+
+    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
+    @Override
+    public void initView() {
+        ViewUtil.setImage(act_web_loading_iv, R.drawable.gif_sheep_loading);
+
+        String url = webParams.getUrl();
+        String jsUrl = webParams.getJsUrl();
+        if (!TextUtils.isEmpty(url)) {
+            url = url.trim();
+        }
+        if(checkWebParams(webParams)){
+            TitleBarUtils
+                    .getInstance()
+                    .setShowOrHide(this, true)
+                    .setTitle(this, webParams.getTitle())
+                    .setRightSecondBtn(this, R.mipmap.tianjtb, view -> SysAppUtil.addShortcut(this))
+                    .setRightImgBotton(this, R.mipmap.guanb, view -> super.finish())
+                    .setTitleFinish(this);
+        } else if (webParams.isShowTitle()) {
+            TitleBarUtils
+                    .getInstance()
+                    .setShowOrHide(this, true)
+                    .setTitle(this, webParams.getTitle())
+                    .setRightImgBotton(this, R.drawable.ic_edit_text_delete, view -> super.finish())
+                    .setTitleFinish(this);
+        }
+        initWebViewSettings(mWebView);
+        try {
+            if (TestUtil.isTest())
+                WebView.setWebContentsDebuggingEnabled(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+//            webViewSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
+        }
+        if (TextUtils.isEmpty(jsUrl)) {
+            loadUrl(url);
+        } else {
+            initJsData(url, jsUrl);
+        }
+    }
+
+    public void initWebParams() {
+        Intent intent = getIntent();
+        webParams = (WebParams) intent.getSerializableExtra(WebParams.class.getSimpleName());
+    }
+
+//    //忽略 添加有范商城快捷入口
+//    public static final String KEY_IGNORE_ADD_YOU_FAN_LAUNCHER = "ignore_add_you_fan_launcher";
+//    private void checkWebParams(WebParams webParams) {
+//        if(webParams.getUrl().startsWith(Config.YF_SHOP_HOME_SHEEP.split("\\?")[0]) || webParams.getUrl().startsWith(Config.YF_SHOP_HOME_SHEEP_TEST.split("\\?")[0])) {//检测是否是有范商城地址
+//            boolean isIgnore = SpUtils.getAsBoolean(KEY_IGNORE_ADD_YOU_FAN_LAUNCHER, false);
+//            boolean hasShortcut = SysAppUtil.hasShortcut(SheepApp.getInstance(), Config.YF_SHOP_NAME);
+//            boolean isShow = !hasShortcut && !isIgnore && !CommonUtil.getInstance().hasYouFanLauncher();//未忽略并且没有添加有范商品入口
+////            boolean isShow = !isIgnore && !SysAppUtil.isEnableComponentYf();
+//            if (isShow) {
+//                ViewUtil.showMsgDialog(this, new DialogConfig().setTitle("温馨提示")
+//                        .setMsg("亲,喜欢的话,就添加一个商城的桌面快捷入口吧!(点击否将不再提示)")
+//                        .setBtnLeftText("否").setBtnLeftOnClickListener(view -> SpUtils.putAsBoolean(KEY_IGNORE_ADD_YOU_FAN_LAUNCHER, true))
+//                        .setBtnRightText("是").setBtnRightOnClickListener(view -> CommonUtil.getInstance().addYouFanLauncher()));
+////                        .setBtnRightText("是").setBtnRightOnClickListener(view -> SysAppUtil.enableComponentYf()));
+//            }
+//        }
+//    }
+    private boolean checkWebParams(WebParams webParams) {
+        return webParams.getUrl().startsWith(Config.YF_SHOP_HOME_SHEEP.split("\\?")[0]) || webParams.getUrl().startsWith(Config.YF_SHOP_HOME_SHEEP_TEST.split("\\?")[0]);//检测是否是有范商城地址
+    }
+
+    //初始化js代码数据
+    private void initJsData(final String url, String jsUrl) {
+        OkHttpUtils.get()
+                .url(jsUrl)
+                .build()
+                .execute(new StringCallback() {
+                    @Override
+                    public void onError(Call call, Exception e, int id) {
+                        G.showToast(R.string.service_data_error);
+                    }
+
+                    @Override
+                    public void onResponse(String response, int id) {
+                        js = response;
+                        loadUrl(url);
+                    }
+                });
+    }
+
+    @Override
+    public void initListener() {
+        CommonUtil.getInstance().setDownloadListener(this, mWebView);
+    }
+
+    public static void initWebViewSettings(WebView webView) {
+        webView.setClickable(true);
+        WebSettings webSetting = webView.getSettings();
+        webSetting.setJavaScriptEnabled(true);
+        webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
+        webSetting.setAllowFileAccess(true);
+        webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
+//        webSetting.setSupportZoom(true);
+//        webSetting.setBuiltInZoomControls(true);
+        webSetting.setUseWideViewPort(true);
+        webSetting.setSupportMultipleWindows(true);
+        // webSetting.setLoadWithOverviewMode(true);
+        webSetting.setAppCacheEnabled(true);
+        // webSetting.setDatabaseEnabled(true);
+        webSetting.setDomStorageEnabled(true);
+        webSetting.setGeolocationEnabled(true);
+        webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
+        // webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
+        webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
+        // webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
+        webSetting.setCacheMode(NetUtil.CAN_CONNECT_SERVICE ? WebSettings.LOAD_DEFAULT : WebSettings.LOAD_CACHE_ELSE_NETWORK);
+
+        // this.getSettingsExtension().setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);//extension
+        // settings 的设计
+        webSetting.setUserAgentString(getSheepUserAgent());
+    }
+
+    @Override
+    protected void onDestroy() {
+        if (act_web_loading_iv != null) {
+            try {
+                act_web_loading_iv.clearAnimation();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        if (mWebView != null) {
+            mWebView.setVisibility(View.GONE);
+            mWebView.removeAllViews();
+            mWebView.destroy();
+        }
+        super.onDestroy();
+    }
+
+    /**
+     *
+     */
+    public static final int INPUT_FILE_REQUEST_CODE = 1;
+    private ValueCallback<Uri> mUploadMessage;
+    private final static int FILECHOOSER_RESULTCODE = 2;
+    private ValueCallback<Uri[]> mFilePathCallback;
+
+    private String mCameraPhotoPath;
+
+    private void loadUrl(final String url) {
+
+        mWebView.setWebChromeClient(new WebChromeClient() {
+            @Override
+            public void onReceivedTitle(WebView view, String title) {
+                super.onReceivedTitle(view, title);
+                if (webParams.isShowTitle())
+                    TitleBarUtils
+                            .getInstance()
+                            .setTitle(ActWeb.this, title);
+            }
+
+            @Override
+            public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
+                if (mFilePathCallback != null) {
+                    mFilePathCallback.onReceiveValue(null);
+                }
+                mFilePathCallback = filePathCallback;
+
+                /*PhotoPicker.builder()
+                        .setPhotoCount(1)
+                        .setShowCamera(true)
+                        .setShowGif(false)
+                        .setPreviewEnabled(true)
+                        .start(ActWeb.this, PhotoPicker.REQUEST_CODE);*/
+                Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+                if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
+                    // Create the File where the photo should go
+                    File photoFile;
+                    photoFile = createImageFile();
+                    takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
+
+                    // Continue only if the File was successfully created
+                    if (photoFile != null) {
+                        mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
+                        takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
+                                Uri.fromFile(photoFile));
+                    } else {
+                    }
+                }
+
+                Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
+                contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
+                contentSelectionIntent.setType("image/*");
+
+                Intent[] intentArray;
+                takePictureIntent = null;//步调用相机
+                if (takePictureIntent != null) {
+                    intentArray = new Intent[]{takePictureIntent};
+                } else {
+                    intentArray = new Intent[0];
+                }
+
+                Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
+                chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
+                chooserIntent.putExtra(Intent.EXTRA_TITLE, "图片选择");
+                chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
+
+                startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);
+
+                return /*super.onShowFileChooser(webView, filePathCallback, fileChooserParams)*/true;
+            }
+
+            //For Android 4.1
+            public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) {
+                mUploadMessage = uploadMsg;
+                Intent i = new Intent(Intent.ACTION_GET_CONTENT);
+                i.addCategory(Intent.CATEGORY_OPENABLE);
+                i.setType("image/*");
+                ActWeb.this.startActivityForResult(Intent.createChooser(i, "Image Chooser"), FILECHOOSER_RESULTCODE);
+
+            }
+
+            @Override
+            public void onProgressChanged(WebView view, int newProgress) {
+                LogUtil.println("ActWeb", "onProgressChanged", newProgress);
+                if (newProgress == 100 && ViewUtil.isVisible(act_web_loading_iv)) {
+                    Animation animation = AnimationUtils.loadAnimation(SheepApp.getInstance(), R.anim.anim_alpha_1_0);
+                    animation.setAnimationListener(new Animation.AnimationListener() {
+                        @Override
+                        public void onAnimationStart(Animation animation) {
+
+                        }
+
+                        @Override
+                        public void onAnimationEnd(Animation animation) {
+                            ViewUtil.setVisibility(act_web_loading_iv, false);
+                        }
+
+                        @Override
+                        public void onAnimationRepeat(Animation animation) {
+
+                        }
+                    });
+                    act_web_loading_iv.startAnimation(animation);
+                }
+                ViewUtil.setVisibility(act_web_loading_pb, newProgress != 100);
+                if (act_web_loading_pb != null)
+                    act_web_loading_pb.setProgress(newProgress);
+                super.onProgressChanged(view, newProgress);
+            }
+        });
+        mWebView.setWebViewClient(new WebViewClient() {
+//            @Override
+//            public WebResourceResponse shouldInterceptRequest(WebView webView, String s) {
+//                if(TestUtil.isDev()){
+//                    return super.shouldInterceptRequest(webView, s);
+//                }
+//                if (s.contains("ssnocache=1")) return null;
+//                LogUtil.println("ActWeb", "shouldInterceptRequest from cache", url);
+//                return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(s));
+//            }
+//
+//            @Override
+//            public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
+//                if(TestUtil.isDev()){
+//                    return super.shouldInterceptRequest(webView, webResourceRequest);
+//                }
+//                if (url.contains("ssnocache=1")) return null;
+//                LogUtil.println("ActWeb", "shouldInterceptRequest from cache", url);
+//                return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(WebResourceRequestAdapter.adapter(webResourceRequest)));
+//            }
+
+            @Override
+            public boolean shouldOverrideUrlLoading(WebView view, String url) {
+                LogUtil.println("ActWeb", "shouldOverrideUrlLoading", url);
+                //微信H5支付核心代码
+                if (url.startsWith(Config.SHEEP_PAY)) {
+                    String order_no = StringUtils.getQueryParameter(url, Config.YF_SHOP_ORDER_NUMBER_KEY);
+                    Jump2View.getInstance().goActPay(ActWeb.this, order_no, SpUtils.getToken(SheepApp.getInstance()));
+                    return true;
+                } else if (url.startsWith(Config.SHEEP)) {
+                    MiddleSchemeAct.parseAndJumpUri(ActWeb.this, Uri.parse(url));
+                    return true;
+                } else if (url.startsWith("weixin://wap/pay?")) {
+                    try {
+                        Intent intent = new Intent();
+                        intent.setAction(Intent.ACTION_VIEW);
+                        intent.setData(Uri.parse(url));
+                        startActivity(intent);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    return true;
+                } else if (url.startsWith("alipays:") || url.startsWith("alipay")) {
+                    try {
+                        startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url)));
+                    } catch (Exception e) {
+                        new AlertDialog.Builder(ActWeb.this)
+                                .setMessage("未检测到支付宝客户端,请安装后重试。")
+                                .setPositiveButton("立即安装", new DialogInterface.OnClickListener() {
+
+                                    @Override
+                                    public void onClick(DialogInterface dialog, int which) {
+                                        Uri alipayUrl = Uri.parse("https://d.alipay.com");
+                                        startActivity(new Intent("android.intent.action.VIEW", alipayUrl));
+                                    }
+                                }).setNegativeButton("取消", null).show();
+                    }
+                    return true;
+                } else if (url.startsWith("https://wx.tenpay.com")) {
+                    Map<String, String> extraHeaders = new HashMap<>();
+                    extraHeaders.put("Referer", "http://17xmy.com");
+                    webViewLoadUrl(view, extraHeaders, url);
+                    return true;
+                } else if (url.contains("kfzs.com") || (url.startsWith("http://10.8.") && TestUtil.isDev())) {
+                    Map<String, String> extraHeaders = new HashMap<>();
+                    extraHeaders.put("Referer", "http://kfzs.com");
+                    webViewLoadUrl(view, extraHeaders, url);
+                    return true;
+                } else {
+                    return false;
+                }
+            }
+
+            @Override
+            public void onPageStarted(WebView view, String url, Bitmap favicon) {
+                LogUtil.println("ActWeb", "onPageStarted", url);
+                super.onPageStarted(view, url, favicon);
+            }
+
+            @Override
+            public void onPageFinished(WebView view, String url) {
+                LogUtil.println("ActWeb", "onPageFinished", url);
+                super.onPageFinished(view, url);
+                loadJs();
+            }
+        });
+
+        if (webParams.isNeedJsInteract()) {
+            mWebView.addJavascriptInterface(new KFZSJs(this), "kfzsjs");
+            String loadUrl = url;
+            if (webParams.getTokenKey() != null) {
+                if (url.startsWith(Config.YF_SHOP_HOME)) {
+                    webParams.tokenFirstUpperCase();
+                }
+                loadUrl = addUrlQuery(url, webParams.getTokenKey(), SpUtils.getToken(SheepApp.getInstance()));
+                loadUrl = addUrlQuery(loadUrl, "pf", Config.YF_SHOP_PLATFORM);
+                loadUrl = addUrlQuery(loadUrl, "device_id", DeviceUtil.getDeviceId(SheepApp.getInstance()));
+            }
+            loadUrl = addUrlQuery(loadUrl, webParams.getInvitationCodeKey(), DataUtil.getInstance().getInvitationCode());
+            LogUtil.println("ActWeb loadUrl = " + loadUrl);
+            webViewLoadUrl(mWebView, loadUrl);
+        } else {
+            webViewLoadUrl(mWebView, url);
+        }
+    }
+
+    //在sdcard卡创建缩略图
+    //createImageFileInSdcard
+    @SuppressLint("SdCardPath")
+    private File createImageFile() {
+        //mCameraPhotoPath="/mnt/sdcard/tmp.png";
+        File file = new File(Environment.getExternalStorageDirectory() + "/", "tmp.png");
+        mCameraPhotoPath = file.getAbsolutePath();
+        if (!file.exists()) {
+            try {
+                file.createNewFile();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return file;
+    }
+
+    /**
+     * 是否响应返回键
+     */
+    private boolean responseBack = true;
+
+    @Override
+    public void onBackPressed() {
+        if (responseBack) {
+            if (mWebView != null && mWebView.canGoBack()) {
+                mWebView.goBack();
+
+            } else {
+                super.onBackPressed();
+            }
+        } else {
+            loadJs("onBackPressed()");
+        }
+    }
+
+    @Override
+    public void loadJs(String js) {
+        ViewUtil.loadJs(mWebView, js);
+    }
+
+    private int onResumeCount = 0;
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if(onResumeCount > 0 && mWebView != null && webParams.isRefreshClick()){
+            loadJs("refreshClick()");
+        }
+        onResumeCount ++;
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == FILECHOOSER_RESULTCODE) {
+            if (null == mUploadMessage) return;
+            Uri result = data == null || resultCode != RESULT_OK ? null
+                    : data.getData();
+            if (result != null) {
+                String imagePath = FileUtils.getPath(this, result);
+                if (!TextUtils.isEmpty(imagePath)) {
+                    result = Uri.parse("file:///" + imagePath);
+                }
+            }
+            mUploadMessage.onReceiveValue(result);
+            mUploadMessage = null;
+        } else if (requestCode == INPUT_FILE_REQUEST_CODE && mFilePathCallback != null) {
+            // 5.0的回调
+            Uri[] results = null;
+
+            // Check that the response is a good one
+            if (resultCode == Activity.RESULT_OK) {
+                if (data == null) {
+                    // If there is not data, then we may have taken a photo
+                    if (mCameraPhotoPath != null) {
+                        results = new Uri[]{Uri.parse(mCameraPhotoPath)};
+                    }
+                } else {
+                    String dataString = data.getDataString();
+                    if (dataString != null) {
+                        results = new Uri[]{Uri.parse(dataString)};
+                    }
+                }
+            }
+
+            mFilePathCallback.onReceiveValue(results);
+            mFilePathCallback = null;
+        } else if (Constant.INTENT_RECHARGE == requestCode) {
+            mWebView.reload();
+        } else {
+            super.onActivityResult(requestCode, resultCode, data);
+            return;
+        }
+    }
+
+    // 注入js函数监听
+    public void loadJs() {
+        if (TextUtils.isEmpty(js))
+            return;
+        ViewUtil.loadJs(mWebView, getJs());
+        LogUtil.println("ActWeb", "loadJs", js);
+    }
+
+    private String js;
+
+    private String getJs() {
+        String testJsStart = "alert('成功注入');";
+        return BuildConfig.DEBUG ? testJsStart + "\n" + js : js;
+    }
+
+    @Override
+    public boolean isResponseBack() {
+        return responseBack;
+    }
+
+    @Override
+    public void setResponseBack(boolean responseBack) {
+        this.responseBack = responseBack;
+    }
+
+    @Override
+    public void clearWebView() {
+        mWebView = null;
+    }
+
+    @Override
+    public void showTitleBar(boolean isShow) {
+        ActionBar actionBar = getSupportActionBar();
+        if (actionBar != null)
+            actionBar.hide();
+    }
+
+    @Override
+    public void setNonTouchArea(float height) {
+
+    }
+
+}

+ 2 - 6
app/src/main/java/com/sheep/gamegroup/view/activity/ActWebX5.java

@@ -15,15 +15,12 @@ import android.support.annotation.RequiresApi;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AlertDialog;
 import android.text.TextUtils;
-import android.view.LayoutInflater;
 import android.view.View;
 import android.view.animation.Animation;
 import android.view.animation.AnimationUtils;
 import android.widget.ImageView;
 import android.widget.ProgressBar;
-import android.widget.RelativeLayout;
 
-import com.sheep.gamegroup.model.entity.DialogConfig;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.module.webview.util.WebResourceRequestAdapter;
 import com.sheep.gamegroup.module.webview.util.WebResourceResponseAdapter;
@@ -38,7 +35,7 @@ import com.sheep.gamegroup.util.StringUtils;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.gamegroup.util.js.BaseActWeb;
+import com.sheep.gamegroup.util.js.BaseActWebX5;
 import com.sheep.gamegroup.util.js.KFZSJs;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.Config;
@@ -62,7 +59,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.zip.Inflater;
 
 import butterknife.BindView;
 import okhttp3.Call;
@@ -73,7 +69,7 @@ import ren.yale.android.cachewebviewlib.WebViewCacheInterceptorInst;
  * web页面--含有所有js及url后添加authorization
  * Created by zengjiebin on 2018/4/27.
  */
-public class ActWebX5 extends BaseActWeb {
+public class ActWebX5 extends BaseActWebX5 {
 
     @BindView(R.id.webview)
     WebView mWebView;

+ 0 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/ActWebX5SBD.java

@@ -4,7 +4,6 @@ package com.sheep.gamegroup.view.activity;
 import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.jiuyan.samllsheep.Config;
-import com.sheep.jiuyan.samllsheep.SheepApp;
 
 /**
  * Created by realicing on 2019/3/20.

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/ActYf.java

@@ -11,7 +11,7 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
  * 有范商城入口;
  * 直接添加入口方式来实现
  */
-public class ActYf  extends ActWebX5 {
+public class ActYfX5 extends ActWebX5 {
     @Override
     public void initWebParams() {
         DataUtil.putAsBoolean(ActWebX5YF.KEY_HAS_YOU_FAN_LAUNCHER, true);

+ 0 - 1
app/src/main/java/org/afinal/simplecache/ApiKey.java

@@ -1,7 +1,6 @@
 package org.afinal.simplecache;
 
 import com.sheep.gamegroup.util.StringUtils;
-import com.sheep.gamegroup.util.js.BaseActWeb;
 
 import java.util.Locale;
 

+ 31 - 0
app/src/main/res/layout/act_web.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/white_F9F9F9"
+    android:fitsSystemWindows="true">
+
+    <WebView
+        android:id="@+id/webview"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
+        android:scrollbars="none" />
+
+    <ProgressBar
+        android:id="@+id/act_web_loading_pb"
+        style="?android:attr/progressBarStyleHorizontal"
+        android:layout_width="match_parent"
+        android:layout_height="2dp"
+        android:layout_alignParentTop="true"
+        android:max="100"
+        android:progress="0"
+        android:progressDrawable="@drawable/lay_list_progress_yellow" />
+
+    <ImageView
+        android:id="@+id/act_web_loading_iv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true" />
+
+</RelativeLayout>

+ 30 - 0
app/src/main/res/layout/fgt_web.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/white_F9F9F9">
+
+    <WebView
+        android:id="@+id/webview"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@drawable/x_shap_shadow_bg_rectgangle_white"
+        android:scrollbars="none" />
+
+    <ProgressBar
+        android:id="@+id/act_web_loading_pb"
+        style="?android:attr/progressBarStyleHorizontal"
+        android:layout_width="match_parent"
+        android:layout_height="2dp"
+        android:layout_alignParentTop="true"
+        android:max="100"
+        android:progress="0"
+        android:progressDrawable="@drawable/lay_list_progress_yellow" />
+
+    <ImageView
+        android:id="@+id/act_web_loading_iv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true" />
+
+</RelativeLayout>

BIN
view/libs/tbs_sdk_thirdapp_v3.6.0.1325.jar