Bladeren bron

优化入账通知展示与内部h5加载参数优化

zengjiebin 7 jaren geleden
bovenliggende
commit
aa61e527b2

+ 0 - 4
app/src/main/java/com/sheep/gamegroup/absBase/IJumpWeb.java

@@ -6,10 +6,6 @@ package com.sheep.gamegroup.absBase;
  * 跳转h5的接口
  */
 public interface IJumpWeb extends IJump {
-    String KEY_URL = "url";
-    String KEY_TITLE = "title";
-    String KEY_NEEDJSINTERACT = "needJsInteract";
-    String KEY_JSURL = "jsUrl";
     int NEEDJSINTERACT = 1;
     //要注入的js的地址
     String getJsUrl();

+ 15 - 15
app/src/main/java/com/sheep/gamegroup/greendao/download/DaoMaster.java

@@ -21,26 +21,26 @@ public class DaoMaster extends AbstractDaoMaster {
 
     /** Creates underlying database table using DAOs. */
     public static void createAllTables(Database db, boolean ifNotExists) {
-        ProcessRecordDao.createTable(db, ifNotExists);
-        AppdownloadBeanDao.createTable(db, ifNotExists);
-        SdkLoginUserDao.createTable(db, ifNotExists);
-        ScreenShotRecordDao.createTable(db, ifNotExists);
         AcceptTaskRecordDao.createTable(db, ifNotExists);
         AccountDao.createTable(db, ifNotExists);
-        SearchRecordDao.createTable(db, ifNotExists);
+        AppdownloadBeanDao.createTable(db, ifNotExists);
         DownLoadInfoDao.createTable(db, ifNotExists);
+        ProcessRecordDao.createTable(db, ifNotExists);
+        ScreenShotRecordDao.createTable(db, ifNotExists);
+        SdkLoginUserDao.createTable(db, ifNotExists);
+        SearchRecordDao.createTable(db, ifNotExists);
     }
 
     /** Drops underlying database table using DAOs. */
     public static void dropAllTables(Database db, boolean ifExists) {
-        ProcessRecordDao.dropTable(db, ifExists);
-        AppdownloadBeanDao.dropTable(db, ifExists);
-        SdkLoginUserDao.dropTable(db, ifExists);
-        ScreenShotRecordDao.dropTable(db, ifExists);
         AcceptTaskRecordDao.dropTable(db, ifExists);
         AccountDao.dropTable(db, ifExists);
-        SearchRecordDao.dropTable(db, ifExists);
+        AppdownloadBeanDao.dropTable(db, ifExists);
         DownLoadInfoDao.dropTable(db, ifExists);
+        ProcessRecordDao.dropTable(db, ifExists);
+        ScreenShotRecordDao.dropTable(db, ifExists);
+        SdkLoginUserDao.dropTable(db, ifExists);
+        SearchRecordDao.dropTable(db, ifExists);
     }
 
     /**
@@ -59,14 +59,14 @@ public class DaoMaster extends AbstractDaoMaster {
 
     public DaoMaster(Database db) {
         super(db, SCHEMA_VERSION);
-        registerDaoClass(ProcessRecordDao.class);
-        registerDaoClass(AppdownloadBeanDao.class);
-        registerDaoClass(SdkLoginUserDao.class);
-        registerDaoClass(ScreenShotRecordDao.class);
         registerDaoClass(AcceptTaskRecordDao.class);
         registerDaoClass(AccountDao.class);
-        registerDaoClass(SearchRecordDao.class);
+        registerDaoClass(AppdownloadBeanDao.class);
         registerDaoClass(DownLoadInfoDao.class);
+        registerDaoClass(ProcessRecordDao.class);
+        registerDaoClass(ScreenShotRecordDao.class);
+        registerDaoClass(SdkLoginUserDao.class);
+        registerDaoClass(SearchRecordDao.class);
     }
 
     public DaoSession newSession() {

+ 61 - 61
app/src/main/java/com/sheep/gamegroup/greendao/download/DaoSession.java

@@ -8,23 +8,23 @@ import org.greenrobot.greendao.database.Database;
 import org.greenrobot.greendao.identityscope.IdentityScopeType;
 import org.greenrobot.greendao.internal.DaoConfig;
 
-import com.sheep.gamegroup.greendao.download.ProcessRecord;
-import com.sheep.gamegroup.greendao.download.AppdownloadBean;
-import com.sheep.gamegroup.greendao.download.SdkLoginUser;
-import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
 import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
 import com.sheep.gamegroup.greendao.download.Account;
-import com.sheep.gamegroup.greendao.download.SearchRecord;
+import com.sheep.gamegroup.greendao.download.AppdownloadBean;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.gamegroup.greendao.download.ProcessRecord;
+import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
+import com.sheep.gamegroup.greendao.download.SdkLoginUser;
+import com.sheep.gamegroup.greendao.download.SearchRecord;
 
-import com.sheep.gamegroup.greendao.download.ProcessRecordDao;
-import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
-import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
-import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
 import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
 import com.sheep.gamegroup.greendao.download.AccountDao;
-import com.sheep.gamegroup.greendao.download.SearchRecordDao;
+import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
 import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
+import com.sheep.gamegroup.greendao.download.ProcessRecordDao;
+import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
+import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
+import com.sheep.gamegroup.greendao.download.SearchRecordDao;
 
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 
@@ -35,112 +35,112 @@ import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
  */
 public class DaoSession extends AbstractDaoSession {
 
-    private final DaoConfig processRecordDaoConfig;
-    private final DaoConfig appdownloadBeanDaoConfig;
-    private final DaoConfig sdkLoginUserDaoConfig;
-    private final DaoConfig screenShotRecordDaoConfig;
     private final DaoConfig acceptTaskRecordDaoConfig;
     private final DaoConfig accountDaoConfig;
-    private final DaoConfig searchRecordDaoConfig;
+    private final DaoConfig appdownloadBeanDaoConfig;
     private final DaoConfig downLoadInfoDaoConfig;
+    private final DaoConfig processRecordDaoConfig;
+    private final DaoConfig screenShotRecordDaoConfig;
+    private final DaoConfig sdkLoginUserDaoConfig;
+    private final DaoConfig searchRecordDaoConfig;
 
-    private final ProcessRecordDao processRecordDao;
-    private final AppdownloadBeanDao appdownloadBeanDao;
-    private final SdkLoginUserDao sdkLoginUserDao;
-    private final ScreenShotRecordDao screenShotRecordDao;
     private final AcceptTaskRecordDao acceptTaskRecordDao;
     private final AccountDao accountDao;
-    private final SearchRecordDao searchRecordDao;
+    private final AppdownloadBeanDao appdownloadBeanDao;
     private final DownLoadInfoDao downLoadInfoDao;
+    private final ProcessRecordDao processRecordDao;
+    private final ScreenShotRecordDao screenShotRecordDao;
+    private final SdkLoginUserDao sdkLoginUserDao;
+    private final SearchRecordDao searchRecordDao;
 
     public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
             daoConfigMap) {
         super(db);
 
-        processRecordDaoConfig = daoConfigMap.get(ProcessRecordDao.class).clone();
-        processRecordDaoConfig.initIdentityScope(type);
+        acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
+        acceptTaskRecordDaoConfig.initIdentityScope(type);
+
+        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
+        accountDaoConfig.initIdentityScope(type);
 
         appdownloadBeanDaoConfig = daoConfigMap.get(AppdownloadBeanDao.class).clone();
         appdownloadBeanDaoConfig.initIdentityScope(type);
 
-        sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
-        sdkLoginUserDaoConfig.initIdentityScope(type);
+        downLoadInfoDaoConfig = daoConfigMap.get(DownLoadInfoDao.class).clone();
+        downLoadInfoDaoConfig.initIdentityScope(type);
+
+        processRecordDaoConfig = daoConfigMap.get(ProcessRecordDao.class).clone();
+        processRecordDaoConfig.initIdentityScope(type);
 
         screenShotRecordDaoConfig = daoConfigMap.get(ScreenShotRecordDao.class).clone();
         screenShotRecordDaoConfig.initIdentityScope(type);
 
-        acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
-        acceptTaskRecordDaoConfig.initIdentityScope(type);
-
-        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
-        accountDaoConfig.initIdentityScope(type);
+        sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
+        sdkLoginUserDaoConfig.initIdentityScope(type);
 
         searchRecordDaoConfig = daoConfigMap.get(SearchRecordDao.class).clone();
         searchRecordDaoConfig.initIdentityScope(type);
 
-        downLoadInfoDaoConfig = daoConfigMap.get(DownLoadInfoDao.class).clone();
-        downLoadInfoDaoConfig.initIdentityScope(type);
-
-        processRecordDao = new ProcessRecordDao(processRecordDaoConfig, this);
-        appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
-        sdkLoginUserDao = new SdkLoginUserDao(sdkLoginUserDaoConfig, this);
-        screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
         acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
         accountDao = new AccountDao(accountDaoConfig, this);
-        searchRecordDao = new SearchRecordDao(searchRecordDaoConfig, this);
+        appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
         downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
+        processRecordDao = new ProcessRecordDao(processRecordDaoConfig, this);
+        screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
+        sdkLoginUserDao = new SdkLoginUserDao(sdkLoginUserDaoConfig, this);
+        searchRecordDao = new SearchRecordDao(searchRecordDaoConfig, this);
 
-        registerDao(ProcessRecord.class, processRecordDao);
-        registerDao(AppdownloadBean.class, appdownloadBeanDao);
-        registerDao(SdkLoginUser.class, sdkLoginUserDao);
-        registerDao(ScreenShotRecord.class, screenShotRecordDao);
         registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
         registerDao(Account.class, accountDao);
-        registerDao(SearchRecord.class, searchRecordDao);
+        registerDao(AppdownloadBean.class, appdownloadBeanDao);
         registerDao(DownLoadInfo.class, downLoadInfoDao);
+        registerDao(ProcessRecord.class, processRecordDao);
+        registerDao(ScreenShotRecord.class, screenShotRecordDao);
+        registerDao(SdkLoginUser.class, sdkLoginUserDao);
+        registerDao(SearchRecord.class, searchRecordDao);
     }
     
     public void clear() {
-        processRecordDaoConfig.clearIdentityScope();
-        appdownloadBeanDaoConfig.clearIdentityScope();
-        sdkLoginUserDaoConfig.clearIdentityScope();
-        screenShotRecordDaoConfig.clearIdentityScope();
         acceptTaskRecordDaoConfig.clearIdentityScope();
         accountDaoConfig.clearIdentityScope();
-        searchRecordDaoConfig.clearIdentityScope();
+        appdownloadBeanDaoConfig.clearIdentityScope();
         downLoadInfoDaoConfig.clearIdentityScope();
+        processRecordDaoConfig.clearIdentityScope();
+        screenShotRecordDaoConfig.clearIdentityScope();
+        sdkLoginUserDaoConfig.clearIdentityScope();
+        searchRecordDaoConfig.clearIdentityScope();
     }
 
-    public ProcessRecordDao getProcessRecordDao() {
-        return processRecordDao;
+    public AcceptTaskRecordDao getAcceptTaskRecordDao() {
+        return acceptTaskRecordDao;
+    }
+
+    public AccountDao getAccountDao() {
+        return accountDao;
     }
 
     public AppdownloadBeanDao getAppdownloadBeanDao() {
         return appdownloadBeanDao;
     }
 
-    public SdkLoginUserDao getSdkLoginUserDao() {
-        return sdkLoginUserDao;
+    public DownLoadInfoDao getDownLoadInfoDao() {
+        return downLoadInfoDao;
     }
 
-    public ScreenShotRecordDao getScreenShotRecordDao() {
-        return screenShotRecordDao;
+    public ProcessRecordDao getProcessRecordDao() {
+        return processRecordDao;
     }
 
-    public AcceptTaskRecordDao getAcceptTaskRecordDao() {
-        return acceptTaskRecordDao;
+    public ScreenShotRecordDao getScreenShotRecordDao() {
+        return screenShotRecordDao;
     }
 
-    public AccountDao getAccountDao() {
-        return accountDao;
+    public SdkLoginUserDao getSdkLoginUserDao() {
+        return sdkLoginUserDao;
     }
 
     public SearchRecordDao getSearchRecordDao() {
         return searchRecordDao;
     }
 
-    public DownLoadInfoDao getDownLoadInfoDao() {
-        return downLoadInfoDao;
-    }
-
 }

+ 89 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/WebParams.java

@@ -0,0 +1,89 @@
+package com.sheep.gamegroup.model.entity;
+
+import android.text.TextUtils;
+
+import java.io.Serializable;
+
+/**
+ * Created by realicing on 2018/12/26.
+ * realicing@sina.com
+ */
+public class WebParams implements Serializable {
+    private String url;//要加载的网页地址
+    private String jsUrl;//要注入的js的网页地址
+    private String title = "加载中";//页面默认标题
+    private boolean needJsInteract = false;
+    private boolean showTitle = true;
+    private String tokenKey = "authorization";
+
+    public WebParams(String url) {
+        this.url = url;
+    }
+
+    public WebParams(String url, String title) {
+        this.url = url;
+        if(!TextUtils.isEmpty(title))
+            this.title = title;
+    }
+
+    public WebParams setUrl(String url) {
+        this.url = url;
+        return this;
+    }
+
+    public WebParams setNeedJsInteract(boolean needJsInteract) {
+        this.needJsInteract = needJsInteract;
+        return this;
+    }
+
+    public WebParams setShowTitle(boolean showTitle) {
+        this.showTitle = showTitle;
+        return this;
+    }
+
+    public WebParams setTokenKey(String tokenKey) {
+        this.tokenKey = tokenKey;
+        return this;
+    }
+    public WebParams tokenFirstUpperCase() {
+        String start = tokenKey.substring(0, 1).toUpperCase();
+        String end = tokenKey.substring(1);
+        this.tokenKey = start + end;
+        return this;
+    }
+
+    public WebParams setTitle(String title) {
+        if(!TextUtils.isEmpty(title))
+            this.title = title;
+        return this;
+    }
+
+    public WebParams setJsUrl(String jsUrl) {
+        this.jsUrl = jsUrl;
+        return this;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public String getJsUrl() {
+        return jsUrl;
+    }
+
+    public boolean isNeedJsInteract() {
+        return needJsInteract;
+    }
+
+    public boolean isShowTitle() {
+        return showTitle;
+    }
+
+    public String getTokenKey() {
+        return tokenKey;
+    }
+}

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/module/home/adapter/AdpNotificationOfArrival.java

@@ -14,7 +14,7 @@ import java.util.List;
 /**
  * Created by realicing on 2018/12/25.
  * realicing@sina.com
- *
+ * <p>
  * 用户入账通知
  */
 public class AdpNotificationOfArrival extends BaseQuickAdapter<SystemNotification, BaseViewHolder> {
@@ -25,6 +25,6 @@ public class AdpNotificationOfArrival extends BaseQuickAdapter<SystemNotificatio
     @Override
     protected void convert(BaseViewHolder helper, SystemNotification item) {
         TextView item_noa_tv = helper.getView(R.id.item_noa_tv);
-        ViewUtil.setText(item_noa_tv, item.getContent());
+        ViewUtil.setText(item_noa_tv, "用户入账通知\t" + item.getContent());
     }
 }

+ 17 - 0
app/src/main/java/com/sheep/gamegroup/util/ApiJSONUtil.java

@@ -5,6 +5,8 @@ import android.support.annotation.IntDef;
 
 import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.SystemNotification;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.module.user.model.BuyVipReq;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
@@ -102,6 +104,21 @@ public class ApiJSONUtil {
         return SheepApp.getInstance().getNetComponent().getApiService().postBuyVip(jsonObject)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread());
+    }
+
+    //读取一条通知
+    public static void readSystemNotification(SystemNotification item) {
+        SheepApp.getInstance().getNetComponent().getApiService().getSystemNotification(item.getId())
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                    }
 
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                    }
+                });
     }
 }

+ 16 - 0
app/src/main/java/com/sheep/gamegroup/util/ConnectAddress.java

@@ -2,6 +2,7 @@ package com.sheep.gamegroup.util;
 
 
 import com.sheep.jiuyan.samllsheep.BuildConfig;
+import com.sheep.jiuyan.samllsheep.Config;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
 
@@ -100,6 +101,13 @@ public enum ConnectAddress {
             return "正式服";
         }
 
+        public String getYfShotHomeSheep(){
+            return Config.YF_SHOP_HOME_SHEEP;
+        }
+        public String getVipUrl(){
+            return Config.URL_VIP;
+        }
+
     };
     public abstract String getAppUrl();
 
@@ -122,6 +130,14 @@ public enum ConnectAddress {
     public String getWorldCupUrl(){
         return "http://10.8.210.172:8080/#/";
     }
+    //商城主页地址
+    public String getYfShotHomeSheep(){
+        return Config.YF_SHOP_HOME_SHEEP_TEST;
+    }
+    //VIP h5地址
+    public String getVipUrl(){
+        return Config.URL_VIP_TEST;
+    }
 
     public int getVersionType() {
         switch (this){

+ 36 - 66
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -44,6 +44,7 @@ import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.entity.VersionInfo;
 import com.sheep.gamegroup.model.entity.Video;
+import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.model.entity.WebviewEntity;
 import com.sheep.gamegroup.model.entity.XianWanEntity;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
@@ -574,7 +575,7 @@ public class Jump2View {
                         if (context instanceof BaseActivity) {
                             ((BaseActivity) context).hideProgress();
                         }
-                        Jump2View.getInstance().goWeb(context, baseMessage.getData().toString(), "微信二维码辅助好友注册");
+                        Jump2View.getInstance().goWeb(context, baseMessage.getData().toString(),"微信二维码辅助好友注册");
                     }
 
                     @Override
@@ -958,14 +959,15 @@ public class Jump2View {
         }
     }
 
+
     /**
      * 跳到web页面
      *
      * @param context
-     * @param url
-     * @param title
+     * @param webParams
      */
-    public void goWeb(Context context, String url, String title) {
+    public void goWeb(Context context, WebParams webParams) {
+        String url = webParams.getUrl();
         if (TextUtils.isEmpty(url)) {
             G.showToast(R.string.service_data_error);
             return;
@@ -980,14 +982,34 @@ public class Jump2View {
                 url = "http://" + url;
             }
         }
+        webParams.setUrl(url);
         Intent intent = new Intent(context, ActWebX5.class);
-        intent.putExtra(IJumpWeb.KEY_URL, url);
-        intent.putExtra(IJumpWeb.KEY_TITLE, TextUtils.isEmpty(title) ? "加载中..." : title);
-        intent.putExtra(IJumpWeb.KEY_NEEDJSINTERACT, true);
+        intent.putExtra(WebParams.class.getSimpleName(), webParams);
         context.startActivity(intent);
     }
 
     /**
+     * 跳到web页面
+     *
+     * @param context
+     * @param url
+     * @param title
+     */
+    public void goWeb(Context context, String url, String title) {
+        goWeb(context, new WebParams(url, title));
+    }
+
+    /**
+     * 跳到web页面
+     *
+     * @param context
+     * @param jumpWeb
+     */
+    public void goWeb(Context context, IJumpWeb jumpWeb) {
+        goWeb(context, new WebParams(jumpWeb.getUrl(), jumpWeb.getTitle()).setNeedJsInteract(jumpWeb.needJsInteract()));
+    }
+
+    /**
      * 尝试通过深度链接跳转应用
      *
      * @param url
@@ -1009,41 +1031,6 @@ public class Jump2View {
     }
 
     /**
-     * 跳到web页面
-     *
-     * @param context
-     * @param jumpWeb
-     */
-    public void goWeb(Context context, IJumpWeb jumpWeb) {
-        String url = jumpWeb.getUrl();
-        String title = jumpWeb.getTitle();
-        if (TextUtils.isEmpty(url)) {
-            G.showToast(R.string.service_data_error);
-            return;
-        }
-        //检查url是否是http开头并添加
-        if (!url.startsWith("http")) {
-            if (url.contains("://")) {
-                if (tryGotoDeepLink(url)) {
-                    return;
-                }
-            } else {
-                url = "http://" + url;
-            }
-        }
-        Intent intent = new Intent(context, ActWebX5.class);
-        intent.putExtra(IJumpWeb.KEY_URL, url);
-        intent.putExtra(IJumpWeb.KEY_TITLE, TextUtils.isEmpty(title) ? "加载中..." : title);
-        intent.putExtra(IJumpWeb.KEY_NEEDJSINTERACT, jumpWeb.needJsInteract());
-        //判断是否注入js
-        boolean hasJsUrl = !TextUtils.isEmpty(jumpWeb.getJsUrl());
-        if (hasJsUrl) {
-            intent.putExtra(IJumpWeb.KEY_JSURL, jumpWeb.getJsUrl());
-        }
-        context.startActivity(intent);
-    }
-
-    /**
      * 跳到我的资产界面
      *
      * @param context
@@ -2180,7 +2167,7 @@ public class Jump2View {
                 Jump2View.getInstance().goWeb(context, item.getUrl());
                 break;
             default:
-                Jump2View.getInstance().goWeb(context, item.getUrl(), item.getTitle());
+                Jump2View.getInstance().goWeb(context, new WebParams(item.getUrl(), item.getTitle()));
                 break;
         }
     }
@@ -2397,12 +2384,7 @@ public class Jump2View {
      * @param jsUrl
      */
     public void goActOverrideJsWeb(Activity activity, String title, String url, String jsUrl) {
-        Intent intent = new Intent(activity, ActWebX5.class);
-        intent.putExtra(IJumpWeb.KEY_TITLE, title);
-        intent.putExtra(IJumpWeb.KEY_URL, url);
-        intent.putExtra(IJumpWeb.KEY_JSURL, jsUrl);
-        intent.putExtra(IJumpWeb.KEY_NEEDJSINTERACT, true);
-        activity.startActivity(intent);
+        goWeb(activity, new WebParams(url, title).setJsUrl(jsUrl));
     }
 
     /**
@@ -2528,24 +2510,11 @@ public class Jump2View {
      * @param activity
      */
     public void gotoYfShop(Activity activity) {
-        goWeb(activity, Config.YF_SHOP_HOME_SHEEP, Config.YF_SHOP_NAME);
+        goWeb(activity, new WebParams(SheepApp.getInstance().getConnectAddress().getYfShotHomeSheep(), Config.YF_SHOP_NAME).setShowTitle(false).tokenFirstUpperCase());
     }
 
     //点击一条消息
     public void onClickSystemNotification(Activity activity, SystemNotification item) {
-        //注意:下面的接口调用不要删除,因为这里要去设置消息为可读
-        SheepApp.getInstance().getNetComponent().getApiService().getSystemNotification(item.getId())
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                    }
-                });
         switch (item.getType()){//消息类型 1:通知 2:活动 3:模块上线 4:任务上线 5:任务成功 6:任务失败
             case SystemNotification.TYPE_MODULE_ONLINE:
                 try {
@@ -2560,12 +2529,13 @@ public class Jump2View {
             case SystemNotification.TYPE_TASK_ONLINE:
                 Jump2View.getInstance().goTaskDetailView(activity, item.getRelation_id());
                 break;
-            case SystemNotification.TYPE_TASK_SUCCESS:
-                Jump2View.getInstance().goAuditTastList(activity, FgtMainAudit.POSITION_SUCCESS);
-                break;
+//            case SystemNotification.TYPE_TASK_SUCCESS:
+//                Jump2View.getInstance().goAuditTastList(activity, FgtMainAudit.POSITION_SUCCESS);
+//                break;
             case SystemNotification.TYPE_TASK_FAIL:
                 Jump2View.getInstance().goAuditTastList(activity, FgtMainAudit.POSITION_FAILED);
                 break;
+            case SystemNotification.TYPE_TASK_SUCCESS:
             case SystemNotification.TYPE_NOTICE:
             case SystemNotification.TYPE_ACT:
             default:

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

@@ -7,8 +7,10 @@ import android.text.SpannableStringBuilder;
 import android.text.TextUtils;
 import android.text.style.AbsoluteSizeSpan;
 import android.text.style.ForegroundColorSpan;
+import android.text.style.ImageSpan;
 
 import com.sheep.gamegroup.util.ResourceUtils;
+import com.sheep.jiuyan.samllsheep.SheepApp;
 
 /**
  * Created by realicing on 2018/11/23.
@@ -64,6 +66,24 @@ public class SpannableSb {
         return append(text).setTextSize(textSize).setTextColor(textColor);
     }
 
+    //添加图片
+    public SpannableSb appendDrawable(int drawableId) {
+        String text = "★";
+        ssb.append(text);
+        start = end;
+        end += text.length();
+        ImageSpan imageSpan = new ImageSpan(SheepApp.getInstance(), drawableId);
+        ssb.setSpan(imageSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+        //当调用builder.insert()方法时,Spannable标识就起作用了
+//        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE //前后都不包括
+//
+//        Spannable.SPAN_INCLUSIVE_EXCLUSIVE  //前包括后不包括
+//
+//        Spannable.SPAN_EXCLUSIVE_INCLUSIVE  //前不包括后包括
+//
+//        Spannable.SPAN_INCLUSIVE_INCLUSIVE  //前后都包括
+        return this;
+    }
 
     public SpannableStringBuilder getSsb() {
         return ssb;

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

@@ -9,7 +9,9 @@ import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.SystemNotification;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.util.string.SpannableSb;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
@@ -28,6 +30,8 @@ public class ActSysNfDetail extends BaseActivity {
 
     @BindView(R.id.tv_content)
     TextView tvContent;
+    @BindView(R.id.tv_content_end)
+    TextView tv_content_end;
     @BindView(R.id.tv_title)
     TextView tvTitle;
 
@@ -55,8 +59,17 @@ public class ActSysNfDetail extends BaseActivity {
     }
     private void loadData(SystemNotification systemNotification) {
         if (systemNotification != null) {
+            switch (systemNotification.getType()){
+                case SystemNotification.TYPE_TASK_SUCCESS:
+                    ViewUtil.setText(tvTitle, new SpannableSb().append("\t").appendDrawable(R.mipmap.ic_yuan_bao).append(" 账户入账通知").getSsb());
+                    break;
+                default:
+                    ViewUtil.setText(tvTitle, systemNotification.getTitle());
+                    break;
+            }
             ViewUtil.setText(tvContent, systemNotification.getContent());
-            ViewUtil.setText(tvTitle, systemNotification.getTitle());
+            int time = Math.max(systemNotification.getUpdated_at(), systemNotification.getCreated_at());
+            ViewUtil.setText(tv_content_end, "\n\n\n小绵羊运营团队\n" + TimeUtil.TimeStamp2Date(time, "yyyy年MM月dd日"));
         }
     }
 

+ 17 - 16
app/src/main/java/com/sheep/gamegroup/view/activity/ActWebX5.java

@@ -16,9 +16,11 @@ import android.text.TextUtils;
 import android.view.View;
 
 import com.sheep.gamegroup.absBase.IJumpWeb;
+import com.sheep.gamegroup.model.entity.WebParams;
 import com.sheep.gamegroup.util.CommonUtil;
 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.TestUtil;
 import com.sheep.gamegroup.util.ViewUtil;
@@ -57,9 +59,7 @@ public class ActWebX5 extends BaseActWeb {
 
     @BindView(R.id.webview)
     WebView mWebView;
-
-    private String title;//title为空时,不显示整个标题栏
-    private boolean needJsInteract;//是否需要js交互,有js交互的会对url进行操作:拼接token到后面
+    private WebParams webParams;
     private WebSettings webViewSettings;
 
     @Override
@@ -71,18 +71,19 @@ public class ActWebX5 extends BaseActWeb {
     @Override
     public void initView() {
         Intent intent = getIntent();
-        String url = intent.getStringExtra(IJumpWeb.KEY_URL);
-        title = intent.getStringExtra(IJumpWeb.KEY_TITLE);//title为空时,不显示整个标题栏
-        needJsInteract = intent.getBooleanExtra(IJumpWeb.KEY_NEEDJSINTERACT, false);
-        String jsUrl = intent.getStringExtra(IJumpWeb.KEY_JSURL);
+        webParams = (WebParams) intent.getSerializableExtra(WebParams.class.getSimpleName());
+        String url = webParams.getUrl();
+        String jsUrl = webParams.getJsUrl();
         if (!TextUtils.isEmpty(url)) {
             url = url.trim();
         }
-        TitleBarUtils
-                .getInstance()
-                .setShowOrHide(this, true)
-                .setTitle(this, TextUtils.isEmpty(title) ? "加载中" : title)
-                .setTitleFinish(this);
+        if(webParams.isShowTitle()) {
+            TitleBarUtils
+                    .getInstance()
+                    .setShowOrHide(this, true)
+                    .setTitle(this, webParams.getTitle())
+                    .setTitleFinish(this);
+        }
         initWebViewSettings(mWebView);
         webViewSettings = mWebView.getSettings();
         webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
@@ -146,7 +147,7 @@ public class ActWebX5 extends BaseActWeb {
         // webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
         webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
         // webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
-        webSetting.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
+        webSetting.setCacheMode(NetUtil.CAN_CONNECT_SERVICE ? WebSettings.LOAD_DEFAULT : WebSettings.LOAD_CACHE_ELSE_NETWORK);
 
         // this.getSettingsExtension().setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);//extension
         // settings 的设计
@@ -178,7 +179,7 @@ public class ActWebX5 extends BaseActWeb {
             @Override
             public void onReceivedTitle(WebView view, String title) {
                 super.onReceivedTitle(view, title);
-                if (ActWebX5.this.title == null)
+                if (webParams.isShowTitle())
                     TitleBarUtils
                             .getInstance()
                             .setTitle(ActWebX5.this, title);
@@ -319,9 +320,9 @@ public class ActWebX5 extends BaseActWeb {
             }
         });
         webViewSettings.setJavaScriptEnabled(true);
-        if (needJsInteract) {
+        if (webParams.isNeedJsInteract()) {
             mWebView.addJavascriptInterface(new KFZSJs(this), "kfzsjs");
-            String loadUrl = addUrlToken(url);
+            String loadUrl = addUrl(url, webParams.getTokenKey(), SpUtils.getToken(SheepApp.getInstance()));
             LogUtil.println("ActWeb loadUrl = " + loadUrl);
             if (CommonUtil.getInstance().judgeUrlPicture(url)) {
                 runWebviewUrl("file:///android_asset/loadImg.html");

+ 10 - 1
app/src/main/java/com/sheep/gamegroup/view/adapter/MessageLeftAdapter.java

@@ -16,6 +16,7 @@ import com.sheep.gamegroup.model.entity.SystemNotification;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.util.string.SpannableSb;
 import com.sheep.jiuyan.samllsheep.R;
 
 import java.util.List;
@@ -63,7 +64,15 @@ public class MessageLeftAdapter extends RecyclerView.Adapter<MessageLeftAdapter.
             ViewUtil.setText(viewHolder.tvTitle, item.getTitle());
 //            viewHolder.tvTime.setText(TimeUtil.TimeStamp2Date(item.getCreated_at(), "yyyy-MM-dd HH:mm"));
             viewHolder.tvTime.setText(DateUtil.getTimeText(item.getCreated_at()));
-            ViewUtil.setText(viewHolder.tvContent, item.getContent());
+            switch (item.getType()){
+                case SystemNotification.TYPE_TASK_SUCCESS:
+                    ViewUtil.setText(viewHolder.tvContent, new SpannableSb().append("【").appendDrawable(R.mipmap.ic_yuan_bao)
+                            .append("账户入账通知】").append(item.getContent()).getSsb());
+                    break;
+                default:
+                    ViewUtil.setText(viewHolder.tvContent, item.getContent());
+                    break;
+            }
             if (item.getIs_look() == 1) {
                 viewHolder.ivIcon.setImageResource(R.mipmap.icon_unread);//已读
             } else {

+ 12 - 8
app/src/main/java/com/sheep/gamegroup/view/dialog/DialogNotificationOfArrival.java

@@ -10,10 +10,13 @@ import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.SystemNotification;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.module.home.adapter.AdpNotificationOfArrival;
+import com.sheep.gamegroup.util.ApiJSONUtil;
 import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.TextToSpeechUtil;
 import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
@@ -63,15 +66,16 @@ public class DialogNotificationOfArrival {
         RecyclerView home_page_notice_rv = new RecyclerView(SheepApp.getInstance());
         home_root_rl.addView(home_page_notice_rv, new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
         home_root_rl.setTag(tag);//设置tag
-        if (home_page_notice_rv.getAdapter() == null) {
-            home_page_notice_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
-            AdpNotificationOfArrival adapter = new AdpNotificationOfArrival(notificationList);
-            adapter.bindToRecyclerView(home_page_notice_rv);
-        } else {
-            home_page_notice_rv.getAdapter().notifyDataSetChanged();
-        }
+        home_page_notice_rv.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
+        AdpNotificationOfArrival adapter = new AdpNotificationOfArrival(notificationList);
+        adapter.bindToRecyclerView(home_page_notice_rv);
+        adapter.setOnItemClickListener((adapter1, view, position) -> Jump2View.getInstance().onClickSystemNotification(activity, notificationList.get(position)));
+        //读取一条通知
+        SystemNotification item = notificationList.get(0);
+        if(!BuildConfig.DEBUG)//测试模式下不读取,方便查看效果
+            ApiJSONUtil.readSystemNotification(item);
         //语音
-        TextToSpeechUtil.get().speakMsg(notificationList.get(0).getContent());
+        TextToSpeechUtil.get().speakMsg(item.getContent());
         //动画
         ViewUtil.showThenHide(activity, home_page_notice_rv, true);
     }

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtMsgCenter.java

@@ -10,6 +10,7 @@ import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
 import com.sheep.gamegroup.model.entity.SystemNotification;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.ApiJSONUtil;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.Jump2View;
@@ -74,6 +75,7 @@ public class FgtMsgCenter extends BaseListFragment2<SystemNotification> implemen
         if(item == null){
             return;
         }
+       ApiJSONUtil.readSystemNotification(item);
        Jump2View.getInstance().onClickSystemNotification(activity, item);
     }
 }

+ 8 - 2
app/src/main/java/com/sheep/jiuyan/samllsheep/Config.java

@@ -6,7 +6,7 @@ package com.sheep.jiuyan.samllsheep;
 
 public class Config {
     public final static String BUGLY_APPID = "0dd998212c";
-    public static final String SHEEP_PAY = "sheep_pay://";
+    public static final String SHEEP_PAY = "sheeppay://";
     public static boolean USE_CHRISTMAS_THEME = true;//是否使用圣诞主题
 
     public static int getGameOrTaskOrGiftLayoutId() {
@@ -16,7 +16,8 @@ public class Config {
     //有范商城
     public final static String YF_SHOP_NAME = "有范商城";
     public final static String YF_SHOP_HOME = "http://shop.17xmy.com/mobile/";//有范商城主页地址
-    public final static String YF_SHOP_HOME_SHEEP = "http://shop.17xmy.com/mobile?pf=android.sheep.app";//小绵羊加载的有范商城主页地址
+    public final static String YF_SHOP_HOME_SHEEP = "http://shop.17xmy.com/mobile/?pf=android.sheep.app";//小绵羊加载的有范商城主页地址
+    public final static String YF_SHOP_HOME_SHEEP_TEST = "http://t.shop.17xmy.com/mobile/?pf=android.sheep.app";//小绵羊加载的有范商城主页地址
     public static final String YF_SHOP_ORDER_NUMBER_KEY = "order_number";
 
 
@@ -24,4 +25,9 @@ public class Config {
     public static final String LONG_MAO_APP_NAME = "龙猫";
     public static final String LONG_MAO_APP_PACKAGE_NAME = "com.cfyl.galesaur.guess";
     public static final String LONG_MAO_APP_URI = "guess://longmao";
+
+    //vip h5配置
+    public static final String URL_VIP = "http://10.8.220.229:8088/#/vip-desc";
+    public static final String URL_VIP_TEST = "http://10.8.220.229:8088/#/vip-desc";
+
 }

+ 1 - 0
app/src/main/res/layout/act_msg.xml

@@ -2,6 +2,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:background="@color/white"
     android:fitsSystemWindows="true"
     android:orientation="vertical">
 

+ 12 - 1
app/src/main/res/layout/act_sys_nf_detail.xml

@@ -23,7 +23,7 @@
     <TextView
         android:id="@+id/tv_content"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:layout_marginEnd="16dp"
         android:layout_marginStart="16dp"
         android:layout_marginTop="20dp"
@@ -31,4 +31,15 @@
         android:text="x  x奖励上线,限量1000分,奖励1元,赶紧去领取吧~!xx奖励上线,限量1000分,奖励1元,赶紧去领取吧~!"
         android:textColor="#666666"
         android:textSize="13sp" />
+    <TextView
+        android:id="@+id/tv_content_end"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:lineSpacingExtra="5dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginStart="16dp"
+        android:gravity="end"
+        android:text="小绵羊运营团队"
+        android:textColor="#666666"
+        android:textSize="13sp" />
 </LinearLayout>