|
|
@@ -13,6 +13,7 @@ import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.arialyy.annotations.Download;
|
|
|
import com.arialyy.aria.core.Aria;
|
|
|
import com.arialyy.aria.core.download.DownloadTask;
|
|
|
@@ -21,6 +22,7 @@ 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;
|
|
|
@@ -28,8 +30,9 @@ import com.sheep.gamegroup.util.CommonUtil;
|
|
|
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.StringUtils;
|
|
|
import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
+import com.sheep.gamegroup.util.TaskHelper;
|
|
|
import com.sheep.gamegroup.util.TimeUtil;
|
|
|
import com.sheep.gamegroup.util.ViewHolder;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
@@ -41,6 +44,7 @@ import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
|
|
|
+import org.afinal.simplecache.ACache;
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
|
@@ -61,7 +65,7 @@ import static android.content.Intent.ACTION_PACKAGE_REMOVED;
|
|
|
* Created by realicing on 2018/5/10.
|
|
|
* realicing@sina.com
|
|
|
*/
|
|
|
-public class ActFindInformation extends BaseActivity {
|
|
|
+public class ActFindInformation extends BaseActivity implements Action1<Integer>{
|
|
|
@Override
|
|
|
protected int getLayoutId() {
|
|
|
return R.layout.net_empty_fresh_list;
|
|
|
@@ -89,8 +93,12 @@ public class ActFindInformation extends BaseActivity {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
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");
|
|
|
+ Object url_config1 = ACache.get(SheepApp.getInstance()).getAsObject("url_config");
|
|
|
+ if(url_config1 instanceof JSONObject) {
|
|
|
+ String find_share_url = ((JSONObject) url_config1).getString("find_share_url");
|
|
|
+ String url = String.format(Locale.CHINA, "%s?authorization=%s&find_id=%d", find_share_url, SpUtils.getOpenId(ActFindInformation.this), id);
|
|
|
+ CommonUtil.getInstance().popShare(ActFindInformation.this, url, "all");
|
|
|
+ }
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -152,13 +160,14 @@ public class ActFindInformation extends BaseActivity {
|
|
|
ViewUtil.loadDataWithBaseURL(find_information_content_wb, findItem.getContent());
|
|
|
|
|
|
}
|
|
|
+ private TaskHelper taskHelper = new TaskHelper(this);
|
|
|
private void loadBottom(ViewGroup viewGroup) {
|
|
|
- if(taskReleaseEty != null && taskReleaseEty.getTask() != null) {
|
|
|
- loadTask(viewGroup.getChildAt(0));
|
|
|
+ if(taskHelper.hasTask()) {
|
|
|
+ taskHelper.loadTask(viewGroup.getChildAt(0));
|
|
|
} else {
|
|
|
viewGroup.getChildAt(0).setVisibility(View.GONE);
|
|
|
}
|
|
|
- viewGroup.getChildAt(1).setVisibility(taskReleaseEty != null && taskReleaseEty.getTask() != null && findApp != null ? View.VISIBLE : View.GONE);
|
|
|
+ viewGroup.getChildAt(1).setVisibility(taskHelper.hasTask() && findApp != null ? View.VISIBLE : View.GONE);
|
|
|
if(findApp != null) {
|
|
|
loadGame(viewGroup.getChildAt(2));
|
|
|
} else {
|
|
|
@@ -166,35 +175,6 @@ public class ActFindInformation extends BaseActivity {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void loadTask(View itemView) {
|
|
|
- itemView.setVisibility(View.VISIBLE);
|
|
|
- final TaskEty taskEty = taskReleaseEty.getTask();
|
|
|
- ImageView find_information_game_icon = (ImageView)itemView.findViewById(R.id.find_information_game_icon);
|
|
|
- TextView find_information_game_name = (TextView)itemView.findViewById(R.id.find_information_game_name);
|
|
|
- TextView find_information_game_surplus = (TextView)itemView.findViewById(R.id.find_information_game_surplus);
|
|
|
- TextView find_information_game_time = (TextView)itemView.findViewById(R.id.find_information_game_time);
|
|
|
- TextView find_information_game_yuan = (TextView)itemView.findViewById(R.id.find_information_game_yuan);
|
|
|
- TextView find_information_game_task = (TextView)itemView.findViewById(R.id.find_information_game_task);
|
|
|
- ViewUtil.setImage(find_information_game_icon, taskEty.getIcon());
|
|
|
- ViewUtil.setText(find_information_game_name, taskEty.getName());
|
|
|
- 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(findItem.getCreated_at(), "yyyy/MM/dd\tHH:mm")));
|
|
|
- ViewUtil.setText(find_information_game_yuan, String.format(Locale.CHINA, "+%s元", taskReleaseEty.getBonus()));
|
|
|
- find_information_game_yuan.setVisibility(View.VISIBLE);
|
|
|
- find_information_game_task.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- G.showToast("点击接受任务");
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- itemView.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- Jump2View.getInstance().goTaskDetailView(ActFindInformation.this, findItem.getRelease_task_id());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
private void loadGame(View itemView) {
|
|
|
itemView.setVisibility(View.VISIBLE);
|
|
|
ImageView find_information_game_icon = (ImageView)itemView.findViewById(R.id.find_information_game_icon);
|
|
|
@@ -259,8 +239,7 @@ public class ActFindInformation extends BaseActivity {
|
|
|
list.add("bottom");
|
|
|
notifyDataSetChanged();
|
|
|
if(findItem.getRelease_task_id() != 0){//包含任务
|
|
|
- initTask(findItem.getRelease_task_id());
|
|
|
-// initAcceptedTask(findItem.getRelease_task_id());
|
|
|
+ taskHelper.initAcceptedTask(ActFindInformation.this, findItem.getRelease_task_id());
|
|
|
}
|
|
|
if(findItem.getApplication_id() != 0){//包含游戏
|
|
|
initFindApp(findItem.getApplication_id());
|
|
|
@@ -296,45 +275,6 @@ public class ActFindInformation extends BaseActivity {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-// private TaskAcceptedEty taskAcceptedEty;
|
|
|
-// private void initAcceptedTask(final int release_task_id) {
|
|
|
-// SheepApp.getInstance().getNetComponent().getApiService().getAcceptedTaskDetail(release_task_id)
|
|
|
-// .subscribeOn(Schedulers.io())
|
|
|
-// .observeOn(AndroidSchedulers.mainThread())
|
|
|
-// .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
-// @Override
|
|
|
-// public void onNext(BaseMessage baseMessage) {
|
|
|
-// LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
|
|
|
-// taskAcceptedEty = baseMessage.getData(TaskAcceptedEty.class);
|
|
|
-// initTask(release_task_id);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onError(BaseMessage baseMessage) {
|
|
|
-// LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
- private TaskReleaseEty taskReleaseEty;
|
|
|
- private void initTask(int release_task_id) {
|
|
|
- SheepApp.getInstance().getNetComponent().getApiService().taskDesc(release_task_id)
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
- @Override
|
|
|
- public void onNext(BaseMessage baseMessage) {
|
|
|
- LogUtil.println("baseMessage onNext "+JSON.toJSONString(baseMessage));
|
|
|
- taskReleaseEty = baseMessage.getData(TaskReleaseEty.class);
|
|
|
- notifyDataSetChanged();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onError(BaseMessage baseMessage) {
|
|
|
- LogUtil.println("baseMessage onError "+JSON.toJSONString(baseMessage));
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
private FindItem findItem;
|
|
|
|
|
|
@@ -473,4 +413,13 @@ public class ActFindInformation extends BaseActivity {
|
|
|
super.onDestroy();
|
|
|
EventBus.getDefault().unregister(this);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void call(Integer integer) {
|
|
|
+ switch (integer){
|
|
|
+ case 1://刷新界面
|
|
|
+ notifyDataSetChanged();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|