|
@@ -24,6 +24,8 @@ import rx.android.schedulers.AndroidSchedulers;
|
|
|
import rx.functions.Action1;
|
|
import rx.functions.Action1;
|
|
|
import rx.schedulers.Schedulers;
|
|
import rx.schedulers.Schedulers;
|
|
|
|
|
|
|
|
|
|
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_TASK;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Created by realicing on 2018/7/3.
|
|
* Created by realicing on 2018/7/3.
|
|
|
* realicing@sina.com
|
|
* realicing@sina.com
|
|
@@ -96,9 +98,9 @@ public class TaskHelper {
|
|
|
TextView find_information_game_task = (TextView)itemView.findViewById(R.id.find_information_game_task);
|
|
TextView find_information_game_task = (TextView)itemView.findViewById(R.id.find_information_game_task);
|
|
|
final TextView find_information_game_task_end_time = (TextView)itemView.findViewById(R.id.find_information_game_task_end_time);
|
|
final TextView find_information_game_task_end_time = (TextView)itemView.findViewById(R.id.find_information_game_task_end_time);
|
|
|
ViewUtil.setImage(find_information_game_icon, taskEty.getIcon());
|
|
ViewUtil.setImage(find_information_game_icon, taskEty.getIcon());
|
|
|
- ViewUtil.setText(find_information_game_name, taskEty.getName());
|
|
|
|
|
|
|
+ ViewUtil.setText(find_information_game_name, taskReleaseEty.getName());
|
|
|
ViewUtil.setText(find_information_game_surplus, String.format(Locale.CHINA, "剩余%s份", taskReleaseEty.getLast_num()));
|
|
ViewUtil.setText(find_information_game_surplus, String.format(Locale.CHINA, "剩余%s份", taskReleaseEty.getLast_num()));
|
|
|
- ViewUtil.setText(find_information_game_time, String.format(Locale.CHINA, "截止日期:%s", TimeUtil.TimeStamp2Date(NumberFormatUtils.parseLong(taskReleaseEty.getDeadline()), "yyyy/MM/dd\tHH:mm")));
|
|
|
|
|
|
|
+ ViewUtil.setText(find_information_game_time, String.format(Locale.CHINA, "截止日期:%s", taskReleaseEty.getDeadline().equals("永久") ? taskReleaseEty.getDeadline() : TimeUtil.TimeStamp2Date(NumberFormatUtils.parseLong(taskReleaseEty.getDeadline()), "yyyy/MM/dd HH:mm")));
|
|
|
ViewUtil.setText(find_information_game_yuan, String.format(Locale.CHINA, "+%s元", taskReleaseEty.getBonus()));
|
|
ViewUtil.setText(find_information_game_yuan, String.format(Locale.CHINA, "+%s元", taskReleaseEty.getBonus()));
|
|
|
find_information_game_yuan.setVisibility(View.VISIBLE);
|
|
find_information_game_yuan.setVisibility(View.VISIBLE);
|
|
|
if(taskAcceptedEty != null){
|
|
if(taskAcceptedEty != null){
|
|
@@ -106,27 +108,29 @@ public class TaskHelper {
|
|
|
case 1://"已接受任务";
|
|
case 1://"已接受任务";
|
|
|
case 2:// "正在进行中";
|
|
case 2:// "正在进行中";
|
|
|
find_information_game_task_end_time.setVisibility(View.VISIBLE);
|
|
find_information_game_task_end_time.setVisibility(View.VISIBLE);
|
|
|
- find_information_game_task_end_time.setText(TimeUtil.getHours(taskAcceptedEty.getEnd_time() * 1000));
|
|
|
|
|
- timer = RxjavaCountDownTimer.getInstance(taskAcceptedEty.getEnd_time())
|
|
|
|
|
- .setOnTickListener(new RxjavaCountDownTimer.OnTickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onFinish() {
|
|
|
|
|
- find_information_game_task_end_time.setVisibility(View.GONE);
|
|
|
|
|
- refreshTask();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onTicker(long time) {
|
|
|
|
|
- find_information_game_task_end_time.setText(TimeUtil.getHours(time * 1000));
|
|
|
|
|
- }
|
|
|
|
|
- }).start();
|
|
|
|
|
|
|
+ if(!taskReleaseEty.getDeadline().equals("永久")){
|
|
|
|
|
+ find_information_game_task_end_time.setText(TimeUtil.getHours(taskAcceptedEty.getEnd_time() * 1000));
|
|
|
|
|
+ timer = RxjavaCountDownTimer.getInstance(taskAcceptedEty.getEnd_time())
|
|
|
|
|
+ .setOnTickListener(new RxjavaCountDownTimer.OnTickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onFinish() {
|
|
|
|
|
+ find_information_game_task_end_time.setVisibility(View.GONE);
|
|
|
|
|
+ refreshTask();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onTicker(long time) {
|
|
|
|
|
+ find_information_game_task_end_time.setText(TimeUtil.getHours(time * 1000));
|
|
|
|
|
+ }
|
|
|
|
|
+ }).start();
|
|
|
|
|
+ }
|
|
|
find_information_game_task.setText("取消任务");
|
|
find_information_game_task.setText("取消任务");
|
|
|
find_information_game_task.setEnabled(true);
|
|
find_information_game_task.setEnabled(true);
|
|
|
find_information_game_task.setOnClickListener(new View.OnClickListener() {
|
|
find_information_game_task.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
public void onClick(View view) {
|
|
|
- SheepApp.getInstance().getNetComponent().getApiService().giveUpTask(taskReleaseEty.getId())
|
|
|
|
|
|
|
+ FIND_TASK.onEvent("release_task_id", release_task_id, "action", "取消任务");
|
|
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().giveUpTask(taskAcceptedEty.getId())
|
|
|
.subscribeOn(Schedulers.io())
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
.subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
@@ -183,6 +187,11 @@ public class TaskHelper {
|
|
|
find_information_game_task.setVisibility(View.VISIBLE);
|
|
find_information_game_task.setVisibility(View.VISIBLE);
|
|
|
find_information_game_task.setText("已经下线");
|
|
find_information_game_task.setText("已经下线");
|
|
|
find_information_game_task.setEnabled(false);
|
|
find_information_game_task.setEnabled(false);
|
|
|
|
|
+ } else if("0".equals(taskReleaseEty.getLast_num())){
|
|
|
|
|
+ find_information_game_task_end_time.setVisibility(View.GONE);
|
|
|
|
|
+ find_information_game_task.setVisibility(View.VISIBLE);
|
|
|
|
|
+ find_information_game_task.setText("任务已抢光");
|
|
|
|
|
+ find_information_game_task.setEnabled(false);
|
|
|
} else {
|
|
} else {
|
|
|
find_information_game_task_end_time.setVisibility(View.GONE);
|
|
find_information_game_task_end_time.setVisibility(View.GONE);
|
|
|
find_information_game_task.setVisibility(View.VISIBLE);
|
|
find_information_game_task.setVisibility(View.VISIBLE);
|
|
@@ -196,6 +205,7 @@ public class TaskHelper {
|
|
|
taskEty.setName(taskReleaseEty.getName());
|
|
taskEty.setName(taskReleaseEty.getName());
|
|
|
taskEty.setAcceptedTaskId(taskReleaseEty.getAccepted_task_id());
|
|
taskEty.setAcceptedTaskId(taskReleaseEty.getAccepted_task_id());
|
|
|
Jump2View.getInstance().goDialogActivityView(activity, taskEty);
|
|
Jump2View.getInstance().goDialogActivityView(activity, taskEty);
|
|
|
|
|
+ FIND_TASK.onEvent("release_task_id", release_task_id, "action", "领取任务");
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|