|
|
@@ -12,7 +12,9 @@ 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;
|
|
|
@@ -61,6 +63,7 @@ import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
+import cn.modificator.waterwave_progress.WidgetUtil;
|
|
|
import okhttp3.Call;
|
|
|
import ren.yale.android.cachewebviewlib.WebViewCacheInterceptorInst;
|
|
|
|
|
|
@@ -94,7 +97,7 @@ public class FgtWebX5 extends BaseFgtWeb {
|
|
|
public void initView() {
|
|
|
ViewUtil.setImage(act_web_loading_iv, R.drawable.gif_sheep_loading);
|
|
|
|
|
|
- if(webParams == null){
|
|
|
+ if (webParams == null) {
|
|
|
LogUtil.println("程序出错了 没有初始化webParams");
|
|
|
//程序出错了
|
|
|
return;
|
|
|
@@ -154,8 +157,9 @@ public class FgtWebX5 extends BaseFgtWeb {
|
|
|
|
|
|
//忽略 添加有范商城快捷入口
|
|
|
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])) {//检测是否是有范商城地址
|
|
|
+ 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();//未忽略并且没有添加有范商品入口
|
|
|
@@ -352,7 +356,7 @@ public class FgtWebX5 extends BaseFgtWeb {
|
|
|
mWebView.setWebViewClient(new WebViewClient() {
|
|
|
@Override
|
|
|
public WebResourceResponse shouldInterceptRequest(WebView webView, String s) {
|
|
|
- if(TestUtil.isDev()){
|
|
|
+ if (TestUtil.isDev()) {
|
|
|
return super.shouldInterceptRequest(webView, s);
|
|
|
}
|
|
|
if (s.contains("ssnocache=1")) return null;
|
|
|
@@ -362,7 +366,7 @@ public class FgtWebX5 extends BaseFgtWeb {
|
|
|
|
|
|
@Override
|
|
|
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
|
|
|
- if(TestUtil.isDev()){
|
|
|
+ if (TestUtil.isDev()) {
|
|
|
return super.shouldInterceptRequest(webView, webResourceRequest);
|
|
|
}
|
|
|
if (url.contains("ssnocache=1")) return null;
|
|
|
@@ -498,13 +502,14 @@ public class FgtWebX5 extends BaseFgtWeb {
|
|
|
}
|
|
|
|
|
|
private int onResumeCount = 0;
|
|
|
+
|
|
|
@Override
|
|
|
public void onResume() {
|
|
|
super.onResume();
|
|
|
- if(onResumeCount > 0 && mWebView != null && webParams.isRefreshClick()){
|
|
|
+ if (onResumeCount > 0 && mWebView != null && webParams.isRefreshClick()) {
|
|
|
loadJs("refreshClick()");
|
|
|
}
|
|
|
- onResumeCount ++;
|
|
|
+ onResumeCount++;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -586,9 +591,32 @@ public class FgtWebX5 extends BaseFgtWeb {
|
|
|
ActionBar actionBar = ((BaseActivity) SheepApp.getInstance().getCurrentActivity()).getSupportActionBar();
|
|
|
if (actionBar != null)
|
|
|
actionBar.hide();
|
|
|
- } catch (Exception e){
|
|
|
+ } 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);
|
|
|
+ Log.e("compare", yy + " : " + height);
|
|
|
+ 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;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|