|
|
@@ -68,6 +68,7 @@ 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.SpUtils;
|
|
|
import com.umeng.socialize.ShareAction;
|
|
|
import com.umeng.socialize.UMAuthListener;
|
|
|
@@ -2113,59 +2114,66 @@ public class CommonUtil {
|
|
|
}
|
|
|
/**
|
|
|
* 玩转游戏 按钮设置
|
|
|
+ * type 1
|
|
|
*/
|
|
|
- public void palyGameDetailBtnValue(final Context context, final GameEntity gameEntity, TextView detail_task_tv_center){
|
|
|
+ public void palyGameDetailBtnValue(final Context context, final GameEntity gameEntity, TextView detail_task_tv_center, int type){
|
|
|
final TaskReleaseEty releaseEty = gameEntity.getRelease_task();
|
|
|
final TaskEty taskEty = releaseEty != null?releaseEty.getTask():null;
|
|
|
if(releaseEty != null && taskEty != null) {//游戏任务
|
|
|
|
|
|
- if (taskEty.isGameReservation()) {//预约
|
|
|
+ if (taskEty.isGameReservationCantDownload()) {//预约
|
|
|
detail_task_tv_center.setText("预约下载");
|
|
|
detail_task_tv_center.setEnabled(true);
|
|
|
- detail_task_tv_center.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- CommonUtil.getInstance().reservationGameTask(context, releaseEty, new Action1<Integer>() {
|
|
|
- @Override
|
|
|
- public void call(Integer integer) {
|
|
|
+ if(type == 0){
|
|
|
+ detail_task_tv_center.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ CommonUtil.getInstance().reservationGameTask(context, releaseEty, new Action1<Integer>() {
|
|
|
+ @Override
|
|
|
+ public void call(Integer integer) {
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
} else {
|
|
|
- releaseEty.getDownloadHelper().updateDownloadTaskView((Activity) context, taskEty, detail_task_tv_center);
|
|
|
+ releaseEty.getDownloadHelper().updateDownloadTaskView((Activity) context, taskEty, detail_task_tv_center, null, type);
|
|
|
if (releaseEty.getDownloadHelper().getDownLoadType() == DownloadTaskService.STATUS_INSTALLED) {//已经安装的话
|
|
|
detail_task_tv_center.setText("领取奖励");
|
|
|
detail_task_tv_center.setEnabled(true);
|
|
|
- detail_task_tv_center.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- if (taskEty.isGameReservationCantDownload()) {
|
|
|
- CommonUtil.getInstance().reservationGameTask(context, releaseEty, new Action1<Integer>() {
|
|
|
- @Override
|
|
|
- public void call(Integer integer) {
|
|
|
+ if(type == 0){
|
|
|
+
|
|
|
+ detail_task_tv_center.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ if (taskEty.isGameReservationCantDownload()) {
|
|
|
+ CommonUtil.getInstance().reservationGameTask(context, releaseEty, new Action1<Integer>() {
|
|
|
+ @Override
|
|
|
+ public void call(Integer integer) {
|
|
|
// if(action1 != null)
|
|
|
// action1.call(TO_REFRESH);
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- CommonUtil.getInstance().receiveAward(context, gameEntity, new Action1<Integer>() {
|
|
|
- @Override
|
|
|
- public void call(Integer integer) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ CommonUtil.getInstance().receiveAward(context, gameEntity, new Action1<Integer>() {
|
|
|
+ @Override
|
|
|
+ public void call(Integer integer) {
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}else if (gameEntity.getApp().isCanDonload()) {//可下载
|
|
|
- gameEntity.getApp().getFindAppHelper().updateDownloadTaskView((Activity) context, gameEntity.getApp(), detail_task_tv_center);
|
|
|
+ gameEntity.getApp().getFindAppHelper().updateDownloadTaskView((Activity) context, gameEntity.getApp(), detail_task_tv_center, type);
|
|
|
detail_task_tv_center.setTag("PUBLIC_TAG_PREFIX_TEXTVIEW_LIST" + gameEntity.getApp().getDownload_link());
|
|
|
} else {//预约下载
|
|
|
- gameEntity.getApp().getFindAppHelper().updateReservationView((Activity) context, gameEntity.getApp(), detail_task_tv_center);
|
|
|
+ gameEntity.getApp().getFindAppHelper().updateReservationView((Activity) context, gameEntity.getApp(), detail_task_tv_center, type);
|
|
|
detail_task_tv_center.setTag("PUBLIC_TAG_PREFIX_TEXTVIEW_LIST" + gameEntity.getApp().getDownload_link());
|
|
|
}
|
|
|
}
|
|
|
@@ -2194,4 +2202,16 @@ public class CommonUtil {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断是否 安装应用
|
|
|
+ */
|
|
|
+ public boolean isInstallApp(String packageName, String name){
|
|
|
+ boolean isInstalled = PackageUtil.isAppInstalled(SheepApp.getInstance(), packageName);
|
|
|
+ if(!isInstalled){
|
|
|
+ G.showToast("还未安装"+name);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|