|
|
@@ -10,6 +10,8 @@ import android.os.Message;
|
|
|
import android.provider.MediaStore;
|
|
|
import android.support.v4.widget.SwipeRefreshLayout;
|
|
|
import android.text.TextUtils;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.AdapterView;
|
|
|
import android.widget.ListView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
@@ -24,20 +26,24 @@ import com.kfzs.duanduan.view.ListMore;
|
|
|
import com.sheep.gamegroup.di.components.DaggerTaskListComponent;
|
|
|
import com.sheep.gamegroup.di.modules.TaskListModule;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
+import com.sheep.gamegroup.model.entity.DialogEntity;
|
|
|
import com.sheep.gamegroup.model.entity.RecyleObj;
|
|
|
import com.sheep.gamegroup.model.entity.RecyleType;
|
|
|
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.entity.UploadResult;
|
|
|
+import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
import com.sheep.gamegroup.presenter.TaskListContract;
|
|
|
import com.sheep.gamegroup.presenter.TaskListPresenter;
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
import com.sheep.gamegroup.view.adapter.TaskListItemAdp;
|
|
|
import com.sheep.gamegroup.view.customview.RefreshLayout;
|
|
|
import com.sheep.gamegroup.view.dialog.DialogShowLoading;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+import com.sheep.jiuyan.samllsheep.base.AbsChooseImageActivity;
|
|
|
import com.sheep.jiuyan.samllsheep.base.BaseActivity;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
@@ -54,13 +60,15 @@ import javax.inject.Inject;
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.ButterKnife;
|
|
|
import go.kfzssafe.Kfzssafe;
|
|
|
+import rx.android.schedulers.AndroidSchedulers;
|
|
|
+import rx.schedulers.Schedulers;
|
|
|
|
|
|
/**
|
|
|
* 任务列表
|
|
|
* Created by ljy on 2018/3/21.
|
|
|
*/
|
|
|
|
|
|
-public class TaskListAct extends BaseActivity implements TaskListContract.View, UpFileListener {
|
|
|
+public class TaskListAct extends AbsChooseImageActivity implements TaskListContract.View {
|
|
|
@BindView(R.id.withdrawal_listview)
|
|
|
ListView withdrawalListview;
|
|
|
@BindView(R.id.swipe_container)
|
|
|
@@ -73,7 +81,6 @@ public class TaskListAct extends BaseActivity implements TaskListContract.View,
|
|
|
private List<TaskAcceptedEty> etyList = new ArrayList<>();
|
|
|
|
|
|
private TaskAcceptedEty taskEty;
|
|
|
- private DialogShowLoading dialogShowLoading;
|
|
|
/**
|
|
|
* 上传进度
|
|
|
*/
|
|
|
@@ -138,6 +145,23 @@ public class TaskListAct extends BaseActivity implements TaskListContract.View,
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+// withdrawalListview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
+// TaskAcceptedEty acceptedEtys = etyList.get(position);
|
|
|
+// if(acceptedEtys.getStatus() == 6) {//审核失败
|
|
|
+// Jump2View.getInstance()
|
|
|
+// .goNoticeAct(activity,
|
|
|
+// new DialogEntity(
|
|
|
+// "审核失败",
|
|
|
+// acceptedEtys.getRemarks(),
|
|
|
+// "重新提交",
|
|
|
+// "取 消",
|
|
|
+// EventTypes.TASK_AGAIN_UPLOAD_FILE));
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// });
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -182,13 +206,13 @@ public class TaskListAct extends BaseActivity implements TaskListContract.View,
|
|
|
|
|
|
@Override
|
|
|
public void taskStatusSuccess(BaseMessage baseMessage) {
|
|
|
- dialogShowLoading.getTextView().setText("完成");
|
|
|
+ setLoaddingText("完成");
|
|
|
// onGetNetImageUrl(data);
|
|
|
- dialogShowLoading.getAlertDialog().dismiss();
|
|
|
+ dismissLoaddingDialog();
|
|
|
G.showToast("提交成功,等待审核!");
|
|
|
- initData();
|
|
|
-// EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.ONFRESH_TRYMAKEMANY_PAGE));
|
|
|
+ EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.ONFRESH_TRYMAKEMANY_PAGE));
|
|
|
UMConfigUtils.finishTask();
|
|
|
+// finish();
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -204,66 +228,49 @@ public class TaskListAct extends BaseActivity implements TaskListContract.View,
|
|
|
updateError("失败");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
- public void Success(String msg, int index) {
|
|
|
- String json;
|
|
|
- if (TextUtils.isEmpty(msg)) {
|
|
|
- updateError("失败");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (msg.startsWith("{")) {
|
|
|
- json = msg;
|
|
|
- } else {
|
|
|
- try {
|
|
|
- byte[] bytes = HexUtils.hexStr2Bytes(msg);
|
|
|
- byte[] byteDecode = Kfzssafe.XByteDecode(bytes);
|
|
|
- json = new String(byteDecode);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- updateError("失败");
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- UploadResult uploadResult = JSON.parseObject(json, UploadResult.class);
|
|
|
- if (uploadResult != null) {
|
|
|
- final String data = uploadResult.getData().getUrl();
|
|
|
- dialogShowLoading.getTextView().setText("提交中");
|
|
|
- if(taskEty == null){
|
|
|
- updateError("提交错误!");
|
|
|
- return;
|
|
|
- }
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("id", taskEty.getId());
|
|
|
- jsonObject.put("screenshots",data+"");
|
|
|
- jsonObject.put("remark",taskEty.getRemarks()+"");
|
|
|
- jsonObject.put("package_name",taskEty.getRelease_task().getTask().getPackage_names()+"");
|
|
|
- jsonObject.put("status",7+"");
|
|
|
- presenter.taskStatus(jsonObject);
|
|
|
- taskEty.setScreenshots(data);
|
|
|
- }
|
|
|
+ public void Failure(String err) {
|
|
|
+ G.showToast(err);
|
|
|
}
|
|
|
|
|
|
- private void updateError(String msg) {
|
|
|
- dialogShowLoading.getTextView().setText(msg);
|
|
|
-// onNotGetImage(msg);
|
|
|
- dialogShowLoading.getAlertDialog().dismiss();
|
|
|
+ @Override
|
|
|
+ protected void onNotGetImage(String msg) {
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public void Progress(String progress, int index) {
|
|
|
- dialogShowLoading.getTextView().setText(progress);
|
|
|
- dialogShowLoading.getTextView().append("%");
|
|
|
+ protected void onGetImage(String path) {
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void Failure(String err) {
|
|
|
- G.showToast(err);
|
|
|
+ protected void onSetNetImageUrl(String url) {
|
|
|
+
|
|
|
+ setLoaddingText("提交中");
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("id", taskEty.getId());
|
|
|
+ jsonObject.put("screenshots",url+"");
|
|
|
+ jsonObject.put("remark",taskEty.getRemarks()+"");
|
|
|
+ jsonObject.put("package_name",taskEty.getRelease_task().getTask().getPackage_names()+"");
|
|
|
+ jsonObject.put("status",7+"");
|
|
|
+ presenter.taskStatus(jsonObject);
|
|
|
+ taskEty.setScreenshots(url);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onGetNetImageUrl(String url) {
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Subscribe
|
|
|
public void onEventMainThread(BigEvent event){
|
|
|
switch (event.getEventTypes()){
|
|
|
case TASK_AGAIN_UPLOAD_FILE:
|
|
|
+ showChooseDialog(false, true, DEFAULT_MAX_COUNT);
|
|
|
+ UMConfigUtils.onEvent(UMConfigUtils.Event.TASK_UPLOAD_PICTURE);
|
|
|
+ break;
|
|
|
+ case TASK_AGAIN_UPLOAD_FILE_DATA:
|
|
|
if(event.getData() instanceof TaskAcceptedEty)
|
|
|
taskEty = (TaskAcceptedEty) event.getData();
|
|
|
break;
|
|
|
@@ -273,23 +280,5 @@ public class TaskListAct extends BaseActivity implements TaskListContract.View,
|
|
|
@Override
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
-
|
|
|
- //获取图片路径
|
|
|
- if(requestCode == 0 && resultCode == Activity.RESULT_OK){
|
|
|
- adp.uploadImag(activity);
|
|
|
- }else
|
|
|
- if (requestCode == 1 && resultCode == Activity.RESULT_OK && data != null) {
|
|
|
- Uri selectedImage = data.getData();
|
|
|
- String[] filePathColumns = {MediaStore.Images.Media.DATA};
|
|
|
- Cursor c = getContentResolver().query(selectedImage, filePathColumns, null, null, null);
|
|
|
- c.moveToFirst();
|
|
|
- int columnIndex = c.getColumnIndex(filePathColumns[0]);
|
|
|
- String imagePath = c.getString(columnIndex);
|
|
|
- if (isUpload) {
|
|
|
- dialogShowLoading = DialogShowLoading.showDialog(activity);
|
|
|
- UpFileUtils.upImage(new File(imagePath), TaskListAct.this);
|
|
|
- }
|
|
|
- c.close();
|
|
|
- }
|
|
|
}
|
|
|
}
|