|
@@ -8,8 +8,11 @@ import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
+import com.kfzs.duanduan.services.DownloadTaskService;
|
|
|
import com.sheep.gamegroup.model.entity.GameEntity;
|
|
import com.sheep.gamegroup.model.entity.GameEntity;
|
|
|
import com.sheep.gamegroup.model.entity.PlayGameEntity;
|
|
import com.sheep.gamegroup.model.entity.PlayGameEntity;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.TaskEty;
|
|
|
|
|
+import com.sheep.gamegroup.model.entity.TaskReleaseEty;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
@@ -19,6 +22,10 @@ import com.sheep.jiuyan.samllsheep.R;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
+import rx.functions.Action1;
|
|
|
|
|
+
|
|
|
|
|
+import static com.sheep.gamegroup.view.adapter.WelfareAdapter.TO_REFRESH;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Created by ljy on 2018/9/3.
|
|
* Created by ljy on 2018/9/3.
|
|
|
*/
|
|
*/
|
|
@@ -52,10 +59,57 @@ public class PlayGameItemAdapter extends AdbCommonRecycler<GameEntity>{
|
|
|
ViewUtil.setText(item_name_tv, gameEntity.getApp().getName());
|
|
ViewUtil.setText(item_name_tv, gameEntity.getApp().getName());
|
|
|
ViewUtil.setText(item_date_tv, gameEntity.getApp().getPackage_size()+"M");
|
|
ViewUtil.setText(item_date_tv, gameEntity.getApp().getPackage_size()+"M");
|
|
|
GlideImageLoader.setGameImage((ImageView) holder.itemView.findViewById(R.id.item_icon_iv), gameEntity.getApp().getIcon());
|
|
GlideImageLoader.setGameImage((ImageView) holder.itemView.findViewById(R.id.item_icon_iv), gameEntity.getApp().getIcon());
|
|
|
|
|
+ final TaskReleaseEty releaseEty = gameEntity.getRelease_task();
|
|
|
|
|
+ final TaskEty taskEty = releaseEty != null?releaseEty.getTask():null;
|
|
|
|
|
+ if(releaseEty != null && taskEty != null){
|
|
|
|
|
+
|
|
|
|
|
+ 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) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (gameEntity.getReceived_voucher()) {//已领取
|
|
|
|
|
+ if (gameEntity.getCan_download()) {
|
|
|
|
|
+ releaseEty.getDownloadHelper().updateDownloadTaskView((Activity) context, taskEty, detail_task_tv_center);
|
|
|
|
|
+ detail_task_tv_center.setTag("PUBLIC_TAG_PREFIX_TEXTVIEW_LIST" + taskEty.getDownload_link());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ detail_task_tv_center.setEnabled(false);
|
|
|
|
|
+ detail_task_tv_center.setText("已经预约");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ 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().receiveAward(context, releaseEty, new Action1<Integer>() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void call(Integer integer) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else
|
|
|
if (gameEntity.getApp().isCanDonload()) {//可下载
|
|
if (gameEntity.getApp().isCanDonload()) {//可下载
|
|
|
gameEntity.getApp().getFindAppHelper().updateDownloadTaskView((Activity) activity, gameEntity.getApp(), detail_task_tv_center);
|
|
gameEntity.getApp().getFindAppHelper().updateDownloadTaskView((Activity) activity, gameEntity.getApp(), detail_task_tv_center);
|
|
|
|
|
+ detail_task_tv_center.setTag("PUBLIC_TAG_PREFIX_TEXTVIEW_LIST" + gameEntity.getApp().getDownload_link());
|
|
|
} else {//预约下载
|
|
} else {//预约下载
|
|
|
gameEntity.getApp().getFindAppHelper().updateReservationView((Activity) activity, gameEntity.getApp(), detail_task_tv_center);
|
|
gameEntity.getApp().getFindAppHelper().updateReservationView((Activity) activity, gameEntity.getApp(), detail_task_tv_center);
|
|
|
|
|
+ detail_task_tv_center.setTag("PUBLIC_TAG_PREFIX_TEXTVIEW_LIST" + gameEntity.getApp().getDownload_link());
|
|
|
}
|
|
}
|
|
|
item_download_welfare_line.setVisibility(holder.getAdapterPosition() + 1 == getItemCount() ? View.GONE : View.VISIBLE);
|
|
item_download_welfare_line.setVisibility(holder.getAdapterPosition() + 1 == getItemCount() ? View.GONE : View.VISIBLE);
|
|
|
|
|
|