|
@@ -17,6 +17,8 @@ import com.arialyy.annotations.Download;
|
|
|
import com.arialyy.aria.core.Aria;
|
|
import com.arialyy.aria.core.Aria;
|
|
|
import com.arialyy.aria.core.download.DownloadTask;
|
|
import com.arialyy.aria.core.download.DownloadTask;
|
|
|
import com.sheep.gamegroup.event.BigEvent;
|
|
import com.sheep.gamegroup.event.BigEvent;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.TaskEty;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.TaskReleaseEty;
|
|
|
import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
|
|
import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
|
|
|
import com.sheep.gamegroup.util.DownloadUtil;
|
|
import com.sheep.gamegroup.util.DownloadUtil;
|
|
|
import com.kfzs.duanduan.view.ViewPagerAutoHeigh;
|
|
import com.kfzs.duanduan.view.ViewPagerAutoHeigh;
|
|
@@ -335,21 +337,31 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
|
|
|
|
|
@Download.onPre
|
|
@Download.onPre
|
|
|
void onPre(DownloadTask task) {
|
|
void onPre(DownloadTask task) {
|
|
|
- if (find_game_down_tv != null) {
|
|
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.downLinks())) {//游戏任务
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (find_game_down_tv != null && gameEntity.downLinks().equals(task.getKey())) {
|
|
|
find_game_down_tv.setText("准备下载中");
|
|
find_game_down_tv.setText("准备下载中");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Download.onTaskStart
|
|
@Download.onTaskStart
|
|
|
void taskStart(DownloadTask task) {
|
|
void taskStart(DownloadTask task) {
|
|
|
- if (find_game_down_tv != null) {
|
|
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.downLinks())) {//游戏任务
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (find_game_down_tv != null && gameEntity.downLinks().equals(task.getKey())) {
|
|
|
find_game_down_tv.setText("开始下载中");
|
|
find_game_down_tv.setText("开始下载中");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Download.onTaskResume
|
|
@Download.onTaskResume
|
|
|
void taskResume(DownloadTask task) {
|
|
void taskResume(DownloadTask task) {
|
|
|
- if (find_game_down_tv != null) {
|
|
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.downLinks())) {//游戏任务
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (find_game_down_tv != null && gameEntity.downLinks().equals(task.getKey())) {
|
|
|
find_game_down_tv.setText("恢复下载中");
|
|
find_game_down_tv.setText("恢复下载中");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -357,14 +369,20 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
//在这里处理任务执行中的状态,如进度进度条的刷新
|
|
//在这里处理任务执行中的状态,如进度进度条的刷新
|
|
|
@Download.onTaskRunning
|
|
@Download.onTaskRunning
|
|
|
protected void running(DownloadTask task) {
|
|
protected void running(DownloadTask task) {
|
|
|
- if (find_game_down_tv != null) {
|
|
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.downLinks())) {//游戏任务
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (find_game_down_tv != null && gameEntity.downLinks().equals(task.getKey())) {
|
|
|
find_game_down_tv.setText(String.format(Locale.CHINA, "%d%%", Math.abs(task.getPercent())));
|
|
find_game_down_tv.setText(String.format(Locale.CHINA, "%d%%", Math.abs(task.getPercent())));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Download.onTaskStop
|
|
@Download.onTaskStop
|
|
|
void taskStop(DownloadTask task) {
|
|
void taskStop(DownloadTask task) {
|
|
|
- if (find_game_down_tv != null) {
|
|
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.downLinks())) {//游戏任务
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (find_game_down_tv != null && gameEntity.downLinks().equals(task.getKey())) {
|
|
|
find_game_down_tv.setText(CommonUtil.CONTINUE_DOWNLOAD);
|
|
find_game_down_tv.setText(CommonUtil.CONTINUE_DOWNLOAD);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -375,21 +393,30 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
|
|
|
|
|
@Download.onTaskCancel
|
|
@Download.onTaskCancel
|
|
|
void taskCancel(DownloadTask task) {
|
|
void taskCancel(DownloadTask task) {
|
|
|
- if (find_game_down_tv != null) {
|
|
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.downLinks())) {//游戏任务
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (find_game_down_tv != null && gameEntity.downLinks().equals(task.getKey())) {
|
|
|
find_game_down_tv.setText("已经取消");
|
|
find_game_down_tv.setText("已经取消");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Download.onTaskFail
|
|
@Download.onTaskFail
|
|
|
void taskFail(DownloadTask task) {
|
|
void taskFail(DownloadTask task) {
|
|
|
- if (find_game_down_tv != null) {
|
|
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.downLinks())) {//游戏任务
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (find_game_down_tv != null && gameEntity.downLinks().equals(task.getKey())) {
|
|
|
find_game_down_tv.setText(CommonUtil.FAIL_DOWNLOAD);
|
|
find_game_down_tv.setText(CommonUtil.FAIL_DOWNLOAD);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Download.onTaskComplete
|
|
@Download.onTaskComplete
|
|
|
void taskComplete(DownloadTask task) {
|
|
void taskComplete(DownloadTask task) {
|
|
|
- if (find_game_down_tv != null) {
|
|
|
|
|
|
|
+ if(TextUtils.isEmpty(gameEntity.downLinks())) {//游戏任务
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (find_game_down_tv != null && gameEntity.downLinks().equals(task.getKey())) {
|
|
|
find_game_down_tv.setText(CommonUtil.START_INSTALL);
|
|
find_game_down_tv.setText(CommonUtil.START_INSTALL);
|
|
|
}
|
|
}
|
|
|
if (gameEntity != null && gameEntity.getApp() != null && TextUtils.equals(task.getKey(), gameEntity.getApp().getDownload_link()))
|
|
if (gameEntity != null && gameEntity.getApp() != null && TextUtils.equals(task.getKey(), gameEntity.getApp().getDownload_link()))
|
|
@@ -402,6 +429,9 @@ public class ActPlayGameDetail extends BaseActivity implements Action1<Integer>
|
|
|
public void onEventMainThread(Intent intent) {
|
|
public void onEventMainThread(Intent intent) {
|
|
|
if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
|
|
if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
|
|
|
String packageName = intent.getDataString().replace("package:", "");
|
|
String packageName = intent.getDataString().replace("package:", "");
|
|
|
|
|
+ if (!TextUtils.equals(packageName, playGameEntity.getPackage_names())) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (find_game_down_tv != null) {
|
|
if (find_game_down_tv != null) {
|
|
|
switch (intent.getAction()) {
|
|
switch (intent.getAction()) {
|