|
@@ -1,6 +1,5 @@
|
|
|
package com.edufound.reader.presenter;
|
|
|
|
|
|
-import android.animation.LayoutTransition;
|
|
|
import android.app.Activity;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
@@ -12,7 +11,6 @@ import android.widget.FrameLayout;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
-import android.widget.Toast;
|
|
|
|
|
|
import com.edufound.reader.R;
|
|
|
import com.edufound.reader.activity.MainActivity;
|
|
@@ -20,14 +18,13 @@ import com.edufound.reader.adapter.PopupMyOrderAdapter;
|
|
|
import com.edufound.reader.apiserver.UserApiServerImpl;
|
|
|
import com.edufound.reader.application.EApplication;
|
|
|
import com.edufound.reader.bean.HttpResultBean;
|
|
|
+import com.edufound.reader.bean.MyInfoBean;
|
|
|
import com.edufound.reader.bean.RecordResultBean;
|
|
|
import com.edufound.reader.bean.UserRecordBean;
|
|
|
import com.edufound.reader.listener.PopupRecordStatusListener;
|
|
|
import com.edufound.reader.model.PopWindowModelImpl;
|
|
|
import com.edufound.reader.popwindow.PopWindowUtil;
|
|
|
import com.edufound.reader.util.Consts;
|
|
|
-import com.edufound.reader.util.GlideUtils;
|
|
|
-import com.edufound.reader.util.OkHttpClient;
|
|
|
import com.edufound.reader.util.QRCodeUtil;
|
|
|
import com.edufound.reader.util.SizeUtils;
|
|
|
import com.google.gson.Gson;
|
|
@@ -53,6 +50,7 @@ public class PopWindowPresneter {
|
|
|
ProgressCallback mUploadProgressBack;
|
|
|
Gson mGson;
|
|
|
UserApiServerImpl userApi;
|
|
|
+ Activity mActivity;
|
|
|
|
|
|
public PopWindowPresneter() {
|
|
|
userApi = new UserApiServerImpl();
|
|
@@ -60,7 +58,8 @@ public class PopWindowPresneter {
|
|
|
mGson = new Gson();
|
|
|
}
|
|
|
|
|
|
- public void initRecordStatusWindow(Activity context, View dialog_view, RecordResultBean bean, UserRecordBean.UserRead userread, PopupRecordStatusListener listener) {
|
|
|
+ public void initRecordStatusWindow(Activity activity, View dialog_view, RecordResultBean bean, UserRecordBean.UserRead userread, PopupRecordStatusListener listener) {
|
|
|
+ mActivity = activity;
|
|
|
FrameLayout mOverFrame = dialog_view.findViewById(R.id.popupwindow_record_status_over_frame);
|
|
|
FrameLayout mUploadingFrame = dialog_view.findViewById(R.id.popupwindow_record_status_uploading_frame);
|
|
|
FrameLayout mUploadingSuccessFrame = dialog_view.findViewById(R.id.popupwindow_record_status_uploading_success_frame);
|
|
@@ -96,7 +95,7 @@ public class PopWindowPresneter {
|
|
|
mOverFrame.setVisibility(View.VISIBLE);
|
|
|
startLayout.removeAllViews();
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
- ImageView start = new ImageView(context);
|
|
|
+ ImageView start = new ImageView(activity);
|
|
|
if (i < startCount) {
|
|
|
start.setImageResource(R.drawable.popup_record_status_over_stars_true);
|
|
|
} else {
|
|
@@ -189,7 +188,7 @@ public class PopWindowPresneter {
|
|
|
postUserRead.put("type", "READ");
|
|
|
postUserRead.put("uid", Consts.getUID());
|
|
|
|
|
|
- mModel.postUserRead(context, mGson.toJson(postUserRead), new Callback() {
|
|
|
+ mModel.postUserRead(activity, mGson.toJson(postUserRead), new Callback() {
|
|
|
@Override
|
|
|
public void onSuccess(HttpInfo info) throws IOException {
|
|
|
//发布朗读成功了,成功之后求情评测数据接口
|
|
@@ -203,7 +202,7 @@ public class PopWindowPresneter {
|
|
|
postAssessment.put("score", String.valueOf(score));
|
|
|
postAssessment.put("accuracy", String.valueOf(accuracy));
|
|
|
postAssessment.put("userReadId", read.getData().getId());
|
|
|
- mModel.postAssessment(context, mGson.toJson(postAssessment), new Callback() {
|
|
|
+ mModel.postAssessment(activity, mGson.toJson(postAssessment), new Callback() {
|
|
|
@Override
|
|
|
public void onSuccess(HttpInfo info) throws IOException {
|
|
|
Logger.e("请求评测成功:" + info.getRetDetail());
|
|
@@ -217,9 +216,9 @@ public class PopWindowPresneter {
|
|
|
for (int i = 0; i < EApplication.mActivityList.size(); i++) {
|
|
|
EApplication.mActivityList.get(i).finish();
|
|
|
}
|
|
|
- Intent intent = new Intent(context, MainActivity.class);
|
|
|
+ Intent intent = new Intent(activity, MainActivity.class);
|
|
|
intent.putExtra("defaultIndex", 0);
|
|
|
- context.startActivity(intent);
|
|
|
+ activity.startActivity(intent);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -255,7 +254,7 @@ public class PopWindowPresneter {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
// Toast.makeText(context, "重新上传", Toast.LENGTH_SHORT).show();
|
|
|
- mModel.upLoadRecord(context, Consts.getRecordUpLoadFileUrl(), mUploadProgressBack);
|
|
|
+ mModel.upLoadRecord(activity, Consts.getRecordUpLoadFileUrl(), mUploadProgressBack);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -278,7 +277,7 @@ public class PopWindowPresneter {
|
|
|
//上传录音
|
|
|
mOverFrame.setVisibility(View.GONE);
|
|
|
mUploadingFrame.setVisibility(View.VISIBLE);
|
|
|
- mModel.upLoadRecord(context, Consts.getRecordUpLoadFileUrl(), mUploadProgressBack);
|
|
|
+ mModel.upLoadRecord(activity, Consts.getRecordUpLoadFileUrl(), mUploadProgressBack);
|
|
|
|
|
|
}
|
|
|
});
|
|
@@ -324,6 +323,7 @@ public class PopWindowPresneter {
|
|
|
|
|
|
|
|
|
public void getBindWeChatPath(Activity activity, ImageView imageView) {
|
|
|
+ mActivity = activity;
|
|
|
userApi.getBindWeChatPath(activity, new Callback() {
|
|
|
@Override
|
|
|
public void onSuccess(HttpInfo info) throws IOException {
|
|
@@ -331,6 +331,7 @@ public class PopWindowPresneter {
|
|
|
HttpResultBean<String> bean = info.getRetDetail(new TypeToken<HttpResultBean<String>>() {
|
|
|
}.getType());
|
|
|
imageView.setImageBitmap(QRCodeUtil.createQRCode(bean.getData(), SizeUtils.dp2px(activity, 900)));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -340,7 +341,38 @@ public class PopWindowPresneter {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- private static Handler handler = new Handler(new Handler.Callback() {
|
|
|
+ public void getMyInfo(Activity activity, TextView textView) {
|
|
|
+ mActivity = activity;
|
|
|
+ userApi.getMyInfo(activity, new Callback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(HttpInfo info) throws IOException {
|
|
|
+ HttpResultBean<MyInfoBean> bean = info.getRetDetail(new TypeToken<HttpResultBean<MyInfoBean>>() {
|
|
|
+ }.getType());
|
|
|
+ if (bean.getData().getUser().getOpenId() == null || bean.getData().getUser().getOpenId().equals("")) {
|
|
|
+ textView.setText("");
|
|
|
+ } else {
|
|
|
+ textView.setText("微信昵称:" + bean.getData().getUser().getWechatName());
|
|
|
+ textView.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(HttpInfo info) throws IOException {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ Message message = new Message();
|
|
|
+ message.obj = textView;
|
|
|
+ message.what = 0x1312;
|
|
|
+ handler.sendMessageDelayed(message, 3000);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Handler getPopHandler() {
|
|
|
+ return handler;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Handler handler = new Handler(new Handler.Callback() {
|
|
|
@Override
|
|
|
public boolean handleMessage(@NonNull Message message) {
|
|
|
switch (message.what) {
|
|
@@ -348,6 +380,9 @@ public class PopWindowPresneter {
|
|
|
case 0x0131:
|
|
|
((TextView) message.obj).setText(message.arg1 + "/100");
|
|
|
break;
|
|
|
+ case 0x1312:
|
|
|
+ getMyInfo(mActivity, (TextView) message.obj);
|
|
|
+ break;
|
|
|
|
|
|
}
|
|
|
return false;
|