소스 검색

龙猫没有安装时,可以直接下载

zengjiebin 7 년 전
부모
커밋
f589ad9d20
2개의 변경된 파일35개의 추가작업 그리고 10개의 파일을 삭제
  1. 33 10
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  2. 2 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/Config.java

+ 33 - 10
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -13,6 +13,7 @@ import android.view.View;
 
 import com.danikula.videocache.HttpProxyCacheServer;
 import com.kfzs.cfyl.share_library.util.CallBackAPI;
+import com.kfzs.duanduan.utils.ApkUtils;
 import com.sheep.gamegroup.absBase.AbsObserver;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.absBase.IHomePageSearch;
@@ -162,6 +163,8 @@ import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 import com.youmi.android.offer.BaseActYmPermissionCheck;
 import com.youmi.android.offer.YmConfig;
+import com.zhy.http.okhttp.OkHttpUtils;
+import com.zhy.http.okhttp.callback.FileCallBack;
 
 import org.afinal.simplecache.DataKey;
 import org.xutils.ex.DbException;
@@ -180,6 +183,7 @@ import io.reactivex.functions.Function;
 import io.reactivex.schedulers.Schedulers;
 import me.iwf.photopicker.PhotoPicker;
 import me.iwf.photopicker.PhotoPreview;
+import okhttp3.Call;
 import rx.functions.Action1;
 
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.ASK_MAKE_MONEY_INVITATION;
@@ -210,6 +214,7 @@ import static com.sheep.gamegroup.util.UMConfigUtils.Event.USER_TASK_RECORD;
 import static com.sheep.gamegroup.util.UMConfigUtils.Event.XIAOMI_GAME_LIST;
 import static com.sheep.jiuyan.samllsheep.service.FloatShotScreenService.SET_SHOW_OR_HIDE;
 import static com.sheep.jiuyan.samllsheep.service.ListenerShotService.IS_RECORD_PATH;
+import static com.sheep.jiuyan.samllsheep.utils.ClassFileHelper.DIR;
 
 /**
  * Created by ljy on 2018/3/18.
@@ -576,7 +581,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
@@ -1522,7 +1527,7 @@ public class Jump2View {
                             public void onNext(Object result) {
                                 if (result instanceof BaseMessage) {
                                     ReceiveCouponsCheckResq data = ((BaseMessage) result).getData(ReceiveCouponsCheckResq.class);
-                                    if(data.notReceive()) {//未领取显示领取优惠券
+                                    if (data.notReceive()) {//未领取显示领取优惠券
                                         ViewUtil.showYfShopAd(activity, data);
                                         return;
                                     }
@@ -2478,11 +2483,12 @@ public class Jump2View {
 
     /**
      * 小绵羊3.4.7新增 -- 跳转VIP介绍界面
+     *
      * @param activity
      */
     public void gotoVip(Activity activity) {
         CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_BUY_VIP_URL, url -> {
-            if(url == null){
+            if (url == null) {
                 G.showToast(R.string.coming_soon);
                 return;
             }
@@ -2490,8 +2496,10 @@ public class Jump2View {
             goWeb(activity, webParams);
         });
     }
+
     /**
      * 小绵羊3.4.7新增 -- 跳转VIP介绍界面
+     *
      * @param activity
      */
     public void goActVip(Activity activity) {
@@ -2501,14 +2509,27 @@ public class Jump2View {
 
     /**
      * 小绵羊3.4.7新增 -- 跳转龙猫界面
+     *
      * @param activity
      * @return 原生启动成功返回true
      */
     public boolean gotoLongMao(Activity activity) {
-        if(!PackageUtil.isAppInstalled(SheepApp.getInstance(), Config.LONG_MAO_APP_PACKAGE_NAME)){
+        if (!PackageUtil.isAppInstalled(SheepApp.getInstance(), Config.LONG_MAO_APP_PACKAGE_NAME)) {
             CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_LMJC_URL, url -> {
-                if(url == null){
-                    G.showToast(R.string.coming_soon);
+                if (url == null) {
+                    ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("安装提示").setMsg("点击确定将下载" + Config.LONG_MAO_APP_REAL_NAME)
+                            .setBtnLeftText("取消").setBtnRightText("确定").setCancelable(false)
+                            .setBtnRightOnClickListener(view -> OkHttpUtils.get().url(Config.LONG_MAO_APP_DOWNLOAD_URL).build().execute(new FileCallBack(DIR, "long_mao_guess.apk") {
+                                @Override
+                                public void onError(Call call, Exception e, int id) {
+                                    G.showToast(e);
+                                }
+
+                                @Override
+                                public void onResponse(File response, int id) {
+                                    ApkUtils.installApk(activity, response.getAbsolutePath());
+                                }
+                            })));
                     return;
                 }
                 goWeb(activity, new WebParams(url, Config.LONG_MAO_APP_NAME).setShowTitle(false));
@@ -2531,11 +2552,12 @@ public class Jump2View {
 
     /**
      * 小绵羊3.4.7新增 -- 跳转商城优惠购物界面
+     *
      * @param activity
      */
     public void gotoYfShop(Activity activity) {
         CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_YF_SHOP_URL, url -> {
-            if(url == null)
+            if (url == null)
                 url = SheepApp.getInstance().getConnectAddress().getYfShotHomeSheep();
             goWeb(activity, new WebParams(url, Config.YF_SHOP_NAME).setShowTitle(false).tokenFirstUpperCase());
         });
@@ -2543,11 +2565,11 @@ public class Jump2View {
 
     //点击一条消息
     public void onClickSystemNotification(Activity activity, SystemNotification item) {
-        switch (item.getType()){//消息类型 1:通知 2:活动 3:模块上线 4:任务上线 5:任务成功 6:任务失败
+        switch (item.getType()) {//消息类型 1:通知 2:活动 3:模块上线 4:任务上线 5:任务成功 6:任务失败
             case SystemNotification.TYPE_MODULE_ONLINE:
                 try {
                     HomeListEntity homeListEntity = item.getRelation_data(HomeListEntity.class);
-                    if(homeListEntity != null){
+                    if (homeListEntity != null) {
                         CommonUtil.getInstance().goWhere(activity, homeListEntity, "消息中心");
                     }
                 } catch (Exception e) {
@@ -2574,11 +2596,12 @@ public class Jump2View {
 
     /**
      * 小绵羊3.4.7新增 -- 跳转  界面我的收件信息 界面
+     *
      * @param activity
      */
     public void goActUserAddrInfo(Activity activity) {
         CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_USER_ADDRESS_URL, url -> {
-            if(url == null){
+            if (url == null) {
                 G.showToast(R.string.coming_soon);
                 return;
             }

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

@@ -24,8 +24,10 @@ public class Config {
 
     //以龙猫开头的则认为是龙猫app
     public static final String LONG_MAO_APP_NAME = "龙猫";
+    public static final String LONG_MAO_APP_REAL_NAME = "龙猫电竞";
     public static final String LONG_MAO_APP_PACKAGE_NAME = "com.cfyl.galesaur.guess";
     public static final String LONG_MAO_APP_URI = "guess://longmao";
+    public static final String LONG_MAO_APP_DOWNLOAD_URL = "http://apps.yunduanzs.cn/guess";//龙猫电竞下载地址
 
     //有范商城地址的 key
     public static final String KEY_YF_SHOP_URL = "yf_shop_url";