Browse Source

修改服务器配置;修复发现模块中的下载游戏时没有先保存数据库的bug

zengjiebin 7 years ago
parent
commit
764a00f957

+ 1 - 1
app/src/main/java/com/kfzs/duanduan/fragment/FgtFindChild.java

@@ -407,7 +407,7 @@ public class FgtFindChild extends BaseCompatFragment {
             if(textView != null) {
                 switch (intent.getAction()){
                     case ACTION_PACKAGE_ADDED:
-                        textView.setText(CommonUtil.GAME_OEPN);
+                        textView.setText(CommonUtil.GAME_OPEN);
                         break;
                     case ACTION_PACKAGE_REMOVED:
                         String path = PackageUtil.isExistsFile(packageName);

+ 0 - 2
app/src/main/java/com/kfzs/duanduan/services/DownloadTaskService.java

@@ -394,8 +394,6 @@ public class DownloadTaskService {
             filePath = DIR+ File.separator+downLoadInfo.getMGameName()+ ClassFileHelper.FILE_SUFFIX;
         }
         task.setFilePath(filePath).start();
-        //发送红点
-        EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.TIPS_DOWN_ICON));
     }
 
     public void pause(DownLoadInfo downLoadInfo) {

+ 33 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UrlConfig.java

@@ -0,0 +1,33 @@
+package com.sheep.gamegroup.model.entity;
+
+import java.io.Serializable;
+
+/**
+ * Created by realicing on 2018/7/3.
+ * realicing@sina.com
+ */
+public class UrlConfig implements Serializable {
+//    agenturl
+//            faqurl
+//    dragon_boat_url
+//            task_desc_url
+//    world_cup_url
+    private String task_desc_url;
+    private String world_cup_url;
+
+    public String getTask_desc_url() {
+        return task_desc_url;
+    }
+
+    public void setTask_desc_url(String task_desc_url) {
+        this.task_desc_url = task_desc_url;
+    }
+
+    public String getWorld_cup_url() {
+        return world_cup_url;
+    }
+
+    public void setWorld_cup_url(String world_cup_url) {
+        this.world_cup_url = world_cup_url;
+    }
+}

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

@@ -85,7 +85,7 @@ public class CommonUtil {
     public static String GAME_RECHAGE = "充值游戏";
     public static String GAME_DOWNLOAD = "下载游戏";
     public static String GAME_INSTALL = "安装游戏";
-    public static String GAME_OEPN = "启动游戏";
+    public static String GAME_OPEN = "开始试玩";
     private static CommonUtil commonUtil;
 
     public static CommonUtil getInstance(){

+ 3 - 24
app/src/main/java/com/sheep/gamegroup/util/ConnectAddress.java

@@ -14,7 +14,7 @@ public enum ConnectAddress {
 
         @Override
         public String getAppUrl() {
-            return "http://10.8.240.23:8080/";
+            return "http://10.8.240.156:8080/";
         }
         @Override
         public String getName() {
@@ -25,43 +25,22 @@ public enum ConnectAddress {
 
         @Override
         public String getAppUrl() {
-            return "http://10.8.210.211:8080/";
+            return "http://10.8.220.229:8080/";
         }
         @Override
         public String getName() {
             return "谢兴";
         }
-    },
-    sheepwuchengshuang {
-
-        @Override
-        public String getAppUrl() {
-            return "http://10.8.240.185:18316/";
-        }
-        @Override
-        public String getName() {
-            return "吴成双";
-        }
     },sheepzhangwei {
 
         @Override
         public String getAppUrl() {
-            return "http://10.8.210.171:8080/";
+            return "http://10.8.220.171:8080/";
         }
         @Override
         public String getName() {
             return "张伟";
         }
-    },sheeplishuyang {
-
-        @Override
-        public String getAppUrl() {
-            return "http://10.8.210.170:8080/";
-        }
-        @Override
-        public String getName() {
-            return "李抒阳";
-        }
     },sheeptest {
 
         @Override

+ 11 - 0
app/src/main/java/com/sheep/gamegroup/util/FindAppHelper.java

@@ -26,6 +26,8 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
 
+import org.greenrobot.eventbus.EventBus;
+
 import java.util.Locale;
 
 import rx.android.schedulers.AndroidSchedulers;
@@ -93,6 +95,15 @@ public class FindAppHelper {
                     } else {
                         mDownloadTaskService.start(downLoadInfo);
                     }
+                    new Thread(new Runnable() {
+                        @Override
+                        public void run() {
+                            if(mDownloadTaskService.addDownloadTask(downLoadInfo)){//添加数据到数据库,可以在下载管理中看到
+                                //发送红点信息
+                                EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.TIPS_DOWN_ICON));
+                            }
+                        }
+                    }).start();
                 }
                 break;
             case DownloadTaskService.STATUS_FINISH://已经下载完成,可以安装

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

@@ -24,10 +24,8 @@ import com.arialyy.annotations.Download;
 import com.arialyy.aria.core.Aria;
 import com.arialyy.aria.core.download.DownloadTask;
 import com.kfzs.duanduan.services.DownloadTaskService;
-import com.kfzs.duanduan.utils.InstallButtonUtils;
 import com.kfzs.duanduan.utils.StatusBarUtils;
 import com.kfzs.duanduan.utils.dlg.HelperUtils;
-import com.kfzs.duanduan.view.KFProgressButton;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.FindApp;
@@ -47,7 +45,6 @@ import com.sheep.gamegroup.view.customview.SheepViewPager;
 import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.utils.ClassFileHelper;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
@@ -55,7 +52,6 @@ import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
-import java.io.File;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -543,7 +539,7 @@ public class ActFindGame extends BaseActivity {
             if(textView != null) {
                 switch (intent.getAction()){
                     case ACTION_PACKAGE_ADDED:
-                        textView.setText(CommonUtil.GAME_OEPN);
+                        textView.setText(CommonUtil.GAME_OPEN);
                         break;
                     case ACTION_PACKAGE_REMOVED:
                         String path = PackageUtil.isExistsFile(packageName);

+ 9 - 4
app/src/main/java/com/sheep/gamegroup/view/activity/ActFindInformation.java

@@ -21,15 +21,14 @@ import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.FindApp;
 import com.sheep.gamegroup.model.entity.FindItem;
-import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.TaskReleaseEty;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
-import com.sheep.gamegroup.util.FindAppHelper;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.LogUtil;
+import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewHolder;
@@ -39,6 +38,7 @@ 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 org.greenrobot.eventbus.EventBus;
@@ -88,7 +88,12 @@ public class ActFindInformation extends BaseActivity {
                 .setRightImgBotton(this, R.mipmap.share, new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        G.showToast("您点击了分享");
+                        try{
+                            String url = String.format(Locale.CHINA, "%s?authorization=%s&find_id=%d", "地址", SpUtils.getOpenId(ActFindInformation.this), id);
+                            CommonUtil.getInstance().popShare(ActFindInformation.this, url, "all");
+                        }catch (Exception e){
+                            e.printStackTrace();
+                        }
                     }
                 });
 
@@ -433,7 +438,7 @@ public class ActFindInformation extends BaseActivity {
             if(textView != null) {
                 switch (intent.getAction()){
                     case ACTION_PACKAGE_ADDED:
-                        textView.setText(CommonUtil.GAME_OEPN);
+                        textView.setText(CommonUtil.GAME_OPEN);
                         break;
                     case ACTION_PACKAGE_REMOVED:
                         String path = PackageUtil.isExistsFile(packageName);

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

@@ -357,7 +357,7 @@ public class ActReservation extends BaseActivity {
             if(textView != null) {
                 switch (intent.getAction()){
                     case ACTION_PACKAGE_ADDED:
-                        textView.setText(CommonUtil.GAME_OEPN);
+                        textView.setText(CommonUtil.GAME_OPEN);
                         break;
                     case ACTION_PACKAGE_REMOVED:
                         String path = PackageUtil.isExistsFile(packageName);

+ 12 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -6,11 +6,13 @@ import android.os.Bundle;
 import android.support.multidex.MultiDex;
 import android.util.DisplayMetrics;
 
+import com.alibaba.fastjson.JSON;
 import com.kfzs.duanduan.ActMain;
 import com.kfzs.duanduan.react.SharedPreferences;
 import com.sheep.gamegroup.di.components.DaggerNetComponent;
 import com.sheep.gamegroup.di.components.NetComponent;
 import com.sheep.gamegroup.di.modules.NetModule;
+import com.sheep.gamegroup.model.entity.UrlConfig;
 import com.sheep.gamegroup.model.util.AutoTaskListUtil;
 import com.sheep.gamegroup.util.ActivityManager;
 import com.sheep.gamegroup.util.AppUtil;
@@ -27,6 +29,8 @@ import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 import com.tencent.bugly.Bugly;
 import com.tencent.bugly.beta.Beta;
 
+import org.afinal.simplecache.ACache;
+
 import rx.functions.Action1;
 
 /**
@@ -93,6 +97,14 @@ public class SheepApp extends BaseApplication {
             initNet();
 //            Beta.autoCheckUpgrade = false;
             Bugly.init(getApplicationContext(), Config.BUGLY_APPID, BuildConfig.DEBUG);
+            if(BuildConfig.DEBUG) {
+                UrlConfig urlConfig = new UrlConfig();
+                urlConfig.setTask_desc_url("1111111111111111");
+                urlConfig.setTask_desc_url("1111111111111111");
+                ACache.get(this).put(UrlConfig.class.getSimpleName(), urlConfig);
+                UrlConfig newUrlConfig = (UrlConfig) ACache.get(this).getAsObject(UrlConfig.class.getSimpleName());
+                LogUtil.println("test", "urlConfig", JSON.toJSON(urlConfig), JSON.toJSON(newUrlConfig));
+            }
         }
     }
 

+ 9 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/service/DownloadService.java

@@ -12,6 +12,7 @@ import com.kfzs.duanduan.services.DownloadTaskService;
 import com.kfzs.duanduan.utils.ApkUtils;
 import com.kfzs.duanduan.utils.dlg.HelperUtils;
 import com.kfzs.duanduan.view.DialogStorageLow;
+import com.sheep.gamegroup.util.LogUtil;
 
 /**
  *  @auther realicing
@@ -29,17 +30,22 @@ public class DownloadService extends Service{
     }
 
     @Download.onPre void onPre(DownloadTask task) {
+        LogUtil.println("DownloadService", "onPre", task.getKey(), task.getTaskName());
     }
     @Download.onTaskStart void taskStart(DownloadTask task) {
+        LogUtil.println("DownloadService", "taskStart", task.getKey(), task.getTaskName());
     }
     @Download.onTaskResume void taskResume(DownloadTask task) {
+        LogUtil.println("DownloadService", "taskResume", task.getKey(), task.getTaskName());
     }
     //在这里处理任务执行中的状态,如进度进度条的刷新
     @Download.onTaskRunning protected void running(DownloadTask task) {
+        LogUtil.println("DownloadService", "running", task.getKey(), task.getTaskName(), task.getPercent());
         mDownloadTaskService.setDownloadTaskPercent(task.getPercent(), task.getCurrentProgress()/1024d/1024d,task.getFileSize()/1024d/1024d,0,task.getKey());
     }
 
     @Download.onTaskStop void taskStop(DownloadTask task) {
+        LogUtil.println("DownloadService", "taskStop", task.getKey(), task.getTaskName());
         mDownloadTaskService.setDownloadTaskStatus(task.getKey(), DownloadTaskService.STATUS_PAUSE);
     }
 
@@ -47,10 +53,12 @@ public class DownloadService extends Service{
     }
 
     @Download.onTaskCancel void taskCancel(DownloadTask task) {
+        LogUtil.println("DownloadService", "taskCancel", task.getKey(), task.getTaskName());
         mDownloadTaskService.deleteDownloadTaskByDownloadUrl(task.getKey());
     }
 
     @Download.onTaskFail void taskFail(DownloadTask task) {
+        LogUtil.println("DownloadService", "taskFail", task.getKey(), task.getTaskName());
         mDownloadTaskService.setDownloadTaskStatus(task.getKey(), DownloadTaskService.STATUS_FAIL);
         //空间不足,弹框提示
         try{
@@ -63,6 +71,7 @@ public class DownloadService extends Service{
     }
 
     @Download.onTaskComplete void taskComplete(DownloadTask task) {
+        LogUtil.println("DownloadService", "taskComplete", task.getKey(), task.getTaskName());
         mDownloadTaskService.setDownloadTaskFinish(task.getKey(), task.getDownloadPath());
         ApkUtils.installApk(getApplicationContext(), task.getDownloadPath());
     }