|
|
@@ -7,17 +7,21 @@ 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.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;
|
|
|
@@ -58,6 +62,7 @@ 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;
|
|
|
@@ -79,6 +84,20 @@ public class ActWebX5 extends BaseActWeb {
|
|
|
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;
|
|
|
}
|
|
|
@@ -88,13 +107,20 @@ public class ActWebX5 extends BaseActWeb {
|
|
|
public void initView() {
|
|
|
ViewUtil.setImage(act_web_loading_iv, R.drawable.gif_sheep_loading);
|
|
|
|
|
|
- initWebParams();
|
|
|
String url = webParams.getUrl();
|
|
|
String jsUrl = webParams.getJsUrl();
|
|
|
if (!TextUtils.isEmpty(url)) {
|
|
|
url = url.trim();
|
|
|
}
|
|
|
- if (webParams.isShowTitle()) {
|
|
|
+ if(checkWebParams(webParams)){
|
|
|
+ TitleBarUtils
|
|
|
+ .getInstance()
|
|
|
+ .setShowOrHide(this, true)
|
|
|
+ .setTitle(this, webParams.getTitle())
|
|
|
+ .setRightSecondBtn(this, R.mipmap.tianjtb, view -> SysAppUtil.addShortcutTest(this))
|
|
|
+ .setRightImgBotton(this, R.mipmap.guanb, view -> super.finish())
|
|
|
+ .setTitleFinish(this);
|
|
|
+ } else if (webParams.isShowTitle()) {
|
|
|
TitleBarUtils
|
|
|
.getInstance()
|
|
|
.setShowOrHide(this, true)
|
|
|
@@ -122,25 +148,27 @@ public class ActWebX5 extends BaseActWeb {
|
|
|
public void initWebParams() {
|
|
|
Intent intent = getIntent();
|
|
|
webParams = (WebParams) intent.getSerializableExtra(WebParams.class.getSimpleName());
|
|
|
- checkWebParams(webParams);
|
|
|
}
|
|
|
|
|
|
- //忽略 添加有范商城快捷入口
|
|
|
- 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()));
|
|
|
- }
|
|
|
- }
|
|
|
+// //忽略 添加有范商城快捷入口
|
|
|
+// 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代码数据
|