package com.edufound.reader.presenter; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.edufound.reader.R; import com.edufound.reader.activity.MainActivity; import com.edufound.reader.adapter.PopupMyOrderAdapter; import com.edufound.reader.adapter.RankListItemAdapter; import com.edufound.reader.apiserver.OrderApiServerImpl; import com.edufound.reader.apiserver.UserApiServerImpl; import com.edufound.reader.application.EApplication; import com.edufound.reader.bean.ChannelCodeEnum; import com.edufound.reader.bean.HttpResultBean; import com.edufound.reader.bean.MyInfoBean; import com.edufound.reader.bean.MyOrderListBean; import com.edufound.reader.bean.RankListBean; import com.edufound.reader.bean.RecordResultBean; import com.edufound.reader.bean.SignBean; import com.edufound.reader.bean.UserBean; import com.edufound.reader.bean.UserEventEnum; import com.edufound.reader.bean.UserRecordBean; import com.edufound.reader.cusview.CusToast; import com.edufound.reader.listener.PopupRecordStatusListener; import com.edufound.reader.miutil.MiSoundSDKUtil; import com.edufound.reader.model.PopWindowModelImpl; import com.edufound.reader.popwindow.PopWindowUtil; import com.edufound.reader.util.Consts; import com.edufound.reader.util.DeviceUuidFactory; import com.edufound.reader.util.EfunboxUtil; 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; import com.google.gson.reflect.TypeToken; import com.jakewharton.rxbinding4.view.RxView; import com.okhttplib.HttpInfo; import com.okhttplib.callback.Callback; import com.okhttplib.callback.ProgressCallback; import com.orhanobut.logger.Logger; import org.json.JSONObject; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; public class PopWindowPresneter { PopWindowModelImpl mModel; ProgressCallback mUploadProgressBack; Gson mGson; UserApiServerImpl userApi; Activity mActivity; OrderApiServerImpl mOrderApi; public PopWindowPresneter() { userApi = new UserApiServerImpl(); mOrderApi = new OrderApiServerImpl(); mModel = new PopWindowModelImpl(); mGson = new Gson(); } 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); FrameLayout mUploadingErrorFrame = dialog_view.findViewById(R.id.popupwindow_record_status_uploading_error_frame); LinearLayout startLayout = mOverFrame.findViewById(R.id.popupwindow_record_status_over_start_layout); FrameLayout mRePlay = mOverFrame.findViewById(R.id.popupwindow_record_status_over_replay); FrameLayout mUpload = mOverFrame.findViewById(R.id.popupwindow_record_status_over_upload); // float a = bean.getOverall() / 100f;//百分制 int integrity = bean.getIntegrity(); int accuracy = bean.getAccuracy(); int speedd = bean.getSpeed(); int tone = bean.getTone(); int score = (int) ((integrity * 0.5) + (bean.getOverall() * 0.3) + (speedd * 0.1) + (tone * 0.1)); int startCount = 0; if (score > 0 && score <= 20) { //1个星星 startCount = 1; } else if (score > 20 && score <= 40) { //2个星星 startCount = 2; } else if (score > 40 && score <= 60) { //3个星星 startCount = 3; } else if (score > 60 && score <= 80) { //4个星星 startCount = 4; } else if (score > 80 && score <= 100) { //5个星星 startCount = 5; } //先显示评测报告,处理测评报告逻辑 { mOverFrame.setVisibility(View.VISIBLE); startLayout.removeAllViews(); for (int i = 0; i < 5; i++) { ImageView start = new ImageView(activity); if (i < startCount) { start.setImageResource(R.drawable.popup_record_status_over_stars_true); } else { start.setImageResource(R.drawable.popup_record_status_over_stars_false); } start.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1)); startLayout.addView(start); } TextView completionText = mOverFrame.findViewById(R.id.popupwindow_record_status_over_completion_text); TextView correctrateText = mOverFrame.findViewById(R.id.popupwindow_record_status_over_correctrate_text); TextView speedText = mOverFrame.findViewById(R.id.popupwindow_record_status_over_speed_text); TextView intonationText = mOverFrame.findViewById(R.id.popupwindow_record_status_over_intonation_text); completionText.post(new Runnable() { @Override public void run() { for (int completionPoint = 0; completionPoint < integrity; completionPoint++) { Message msg = new Message(); msg.obj = completionText; msg.arg1 = completionPoint + 1; msg.what = 0x0131; handler.sendMessageDelayed(msg, 50 * completionPoint); } } }); correctrateText.post(new Runnable() { @Override public void run() { for (int correctrate = 0; correctrate < accuracy; correctrate++) { Message msg = new Message(); msg.obj = correctrateText; msg.arg1 = correctrate + 1; msg.what = 0x0131; handler.sendMessageDelayed(msg, 50 * correctrate); } } }); speedText.post(new Runnable() { @Override public void run() { for (int speed = 0; speed < speedd; speed++) { Message msg = new Message(); msg.obj = speedText; msg.arg1 = speed + 1; msg.what = 0x0131; handler.sendMessageDelayed(msg, 50 * speed); } } }); intonationText.post(new Runnable() { @Override public void run() { for (int intonation = 0; intonation < tone; intonation++) { Message msg = new Message(); msg.obj = intonationText; msg.arg1 = intonation + 1; msg.what = 0x0131; handler.sendMessageDelayed(msg, 50 * intonation); } } }); mUploadProgressBack = new ProgressCallback() { @Override public void onResponseMain(String filePath, HttpInfo info) { super.onResponseMain(filePath, info); Logger.e("onResponseMain:" + info.getRetDetail()); Logger.e("onResponseMain--netCode:" + info.getNetCode()); if (info.getNetCode() == 200) { //上传完成了 //上传成功逻辑 { HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.getType()); Logger.e("filePath:" + bean.getData()); //请求发布接口 Map postUserRead = new HashMap<>(); postUserRead.put("audioPath", bean.getData()); postUserRead.put("coverImg", userread.getCoverImg()); postUserRead.put("exampleId", userread.getExampleId()); postUserRead.put("originVideo", userread.getOriginVideo()); postUserRead.put("shareImg", userread.getShareImg()); postUserRead.put("title", userread.getTitle()); postUserRead.put("type", "READ"); postUserRead.put("uid", Consts.getUID()); mModel.postUserRead(activity, mGson.toJson(postUserRead), new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { //发布朗读成功了,成功之后求情评测数据接口 Logger.e("发布朗读成功了:" + info.getRetDetail()); HttpResultBean read = info.getRetDetail(new TypeToken>() { }.getType()); Map postAssessment = new HashMap<>(); postAssessment.put("complete", String.valueOf(integrity)); postAssessment.put("speed", String.valueOf(speedd)); postAssessment.put("intonation", String.valueOf(tone)); postAssessment.put("score", String.valueOf(score)); postAssessment.put("accuracy", String.valueOf(accuracy)); postAssessment.put("userReadId", read.getData().getId()); mModel.postAssessment(activity, mGson.toJson(postAssessment), new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { Logger.e("请求评测成功:" + info.getRetDetail()); mUploadingSuccessFrame.setVisibility(View.VISIBLE); FrameLayout toLisMySelf = mUploadingSuccessFrame.findViewById(R.id.popup_record_status_upload_success_btn); toLisMySelf.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopWindowUtil.hidePopupWindow(); // Toast.makeText(context, "去听听(首页->我的tab)", Toast.LENGTH_SHORT).show(); EApplication.reloadApp(0); } }); } @Override public void onFailure(HttpInfo info) throws IOException { Logger.e("请求评测失败:" + info.getRetDetail()); } }); } @Override public void onFailure(HttpInfo info) throws IOException { Logger.e("发布朗读失败了:" + info.getRetDetail()); } }); } } else { //失败逻辑 { mUploadingErrorFrame.setVisibility(View.VISIBLE); FrameLayout mCancelUpload = mUploadingErrorFrame.findViewById(R.id.popupwindow_record_status_uploading_error_cancel_upload); FrameLayout mReUpload = mUploadingErrorFrame.findViewById(R.id.popupwindow_record_status_uploading_error_re_upload); mCancelUpload.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { PopWindowUtil.hidePopupWindow(); } }); mReUpload.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Toast.makeText(context, "重新上传", Toast.LENGTH_SHORT).show(); Logger.e("重新上传"); mUploadingErrorFrame.setVisibility(View.GONE); mUploadingFrame.setVisibility(View.VISIBLE); userApi.postUserEvent(activity, UserEventEnum.EVENT_UPLOAD.getEvent()); mModel.upLoadRecord(activity, Consts.getRecordUpLoadFileUrl(), mUploadProgressBack); } }); } } } @Override public void onProgressAsync(int percent, long bytesWritten, long contentLength, boolean done) { super.onProgressAsync(percent, bytesWritten, contentLength, done); } @Override public void onProgressMain(int percent, long bytesWritten, long contentLength, boolean done) { super.onProgressMain(percent, bytesWritten, contentLength, done); } }; mUpload.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //上传录音 mOverFrame.setVisibility(View.GONE); mUploadingFrame.setVisibility(View.VISIBLE); userApi.postUserEvent(activity, UserEventEnum.EVENT_UPLOAD.getEvent()); mModel.upLoadRecord(activity, Consts.getRecordUpLoadFileUrl(), mUploadProgressBack); } }); mRePlay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { listener.clickReRecord(); } }); } } public void myOrderWindowInit(Activity context, View view) { // for (int i = 0; i < 30; i++) { // mDataList.add("i=" + i); // } OkHttpClient.doGetAsync(context, new HttpInfo.Builder().setUrl(Consts.getFinalApi() + "/order"), new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { Logger.e("info:" + info.getRetDetail()); HttpResultBean> bean = info.getRetDetail(new TypeToken>>() { }.getType()); if (bean.getData() != null && bean.getData().size() > 0) { RecyclerView rv = view.findViewById(R.id.popupwindow_myorder_recyclerview); PopupMyOrderAdapter popupMyOrderAdapter = new PopupMyOrderAdapter(context, bean.getData()); rv.addItemDecoration(new OrderSpacesItemDecoration(SizeUtils.dp2px(context, 10), bean.getData().size())); rv.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); rv.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() { @Override public void onChildViewAttachedToWindow(@androidx.annotation.NonNull View view) { } @Override public void onChildViewDetachedFromWindow(@androidx.annotation.NonNull View view) { } }); rv.setAdapter(popupMyOrderAdapter); } else { view.findViewById(R.id.popupwindow_myorder_noitem).setVisibility(View.VISIBLE); } } @Override public void onFailure(HttpInfo info) throws IOException { } }); } public void getBindWeChatPath(Activity activity, ImageView imageView) { mActivity = activity; userApi.getBindWeChatPath(activity, new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { Logger.e("获取绑定微信成功:" + info.getRetDetail()); HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.getType()); imageView.setImageBitmap(QRCodeUtil.createQRCode(bean.getData(), SizeUtils.dp2px(activity, 900))); } @Override public void onFailure(HttpInfo info) throws IOException { Logger.e("获取绑定微信失败:" + info.getRetDetail()); } }); } public void getMyInfo(Activity activity, TextView textView) { mActivity = activity; userApi.getMyInfo(activity, new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.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 void rankListInit(Context context, View dialog_view, String id) { Logger.e("id:" + id); //请求排行榜接口 userApi.getRankList(id, new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.getType()); //设置数据 if (bean.getData().getActivityUserReadList() != null && bean.getData().getActivityUserReadList().size() > 0) { RankListItemAdapter adapter = new RankListItemAdapter(context, bean.getData().getActivityUserReadList()); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context); RecyclerView recyclerView = dialog_view.findViewById(R.id.popupwindow_ranklist_recyclerview); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setAdapter(adapter); FrameLayout myInfoLayout = dialog_view.findViewById(R.id.popupwindow_ranklist_myinfo_layout); TextView myNum = dialog_view.findViewById(R.id.popupwindow_show_ranklist_my_num); TextView myName = dialog_view.findViewById(R.id.popupwindow_show_ranklist_my_name); TextView myThumb = dialog_view.findViewById(R.id.popupwindow_show_ranklist_my_thumb); TextView myCollection = dialog_view.findViewById(R.id.popupwindow_show_ranklist_my_collection); TextView myScore = dialog_view.findViewById(R.id.popupwindow_show_ranklist_my_score); myInfoLayout.setVisibility(View.GONE); boolean getMyRank = false; for (int i = 0; i < bean.getData().getActivityUserReadList().size(); i++) { if (getMyRank == false && bean.getData().getActivityUserReadList().get(i).getUser().getUid().equals(Consts.getUID())) { //获取到数据了,并且只获取第一次得到的 getMyRank = true; myName.setText("我自己"); myNum.setText((i + 1) + ""); myThumb.setText(bean.getData().getActivityUserReadList().get(i).getUserRead().getLikeAmount()); myCollection.setText(bean.getData().getActivityUserReadList().get(i).getUserRead().getFavoritesAmount()); myScore.setText(bean.getData().getActivityUserReadList().get(i).getUserRead().getScore()); myInfoLayout.setVisibility(View.VISIBLE); } } } else { LinearLayout recyParent = dialog_view.findViewById(R.id.popupwindow_ranklist_recyclerview_layout); recyParent.setVisibility(View.GONE); ImageView noList = dialog_view.findViewById(R.id.popupwindow_ranklist_recyclerview_layout_nolist); noList.setVisibility(View.VISIBLE); } } @Override public void onFailure(HttpInfo info) throws IOException { } }); } boolean loginSuccess = false; MISoundLoginCallBack miSoundLoginCallback; int mVCodeCount = 60; TextView getVCodeTimeText; public void initMiSoundLoginWindow(Context context, View dialog_view, int type, MISoundLoginCallBack callBack) { miSoundLoginCallback = callBack; switch (type) { case MiSoundSDKUtil.MI_SOUND_QRCODE_TYPE: ImageView qrcode = dialog_view.findViewById(R.id.popupwindow_mi_sound_qrcode); userApi.getLoginQRCode(new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { Logger.e("info:" + info.getRetDetail()); HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.getType()); Logger.e("bean.getData:" + bean.getData()); if (bean.getCode().equals("200") && bean.getSuccess()) { Logger.e("加载二维码"); GlideUtils.loadImageSizeKipMemoryCache(context, bean.getData(), qrcode); loginSuccess = false; handler.sendEmptyMessageDelayed(0x1313, 1000); } else { Logger.e("加载二维码失败"); } } @Override public void onFailure(HttpInfo info) throws IOException { Logger.e("获取登录二维码失败"); } }); break; case MiSoundSDKUtil.MI_SOUND_BIND_PHONENUM: { EditText bindPhoneNumEdit = dialog_view.findViewById(R.id.popupwindow_mi_sound_bind_phone_num_edit); EditText bindPhoneNumGetVCode = dialog_view.findViewById(R.id.popupwindow_mi_sound_bind_phone_vcode_edit); getVCodeTimeText = dialog_view.findViewById(R.id.popupwindow_mi_sound_bind_phone_getvcode_text); FrameLayout mBindSubmit = dialog_view.findViewById(R.id.popupwindow_mi_sound_bind_phone_num_submit); TextView mErrorText = dialog_view.findViewById(R.id.popupwindow_mi_sound_bind_phone_error_text); mErrorText.setVisibility(View.GONE); // { // //测试 // bindPhoneNumEdit.setText("18611822573"); // bindPhoneNumGetVCode.setText("9999"); // } RxView.focusChanges(bindPhoneNumEdit).subscribe(hasFocus -> { if (!hasFocus) { hideSoftInput(bindPhoneNumEdit); } }); RxView.focusChanges(bindPhoneNumGetVCode).subscribe(hasFocus -> { if (!hasFocus) { hideSoftInput(bindPhoneNumGetVCode); } }); //获取验证码 RxView.clicks(getVCodeTimeText).throttleFirst(2, TimeUnit.SECONDS).subscribe(o -> { String mobile = bindPhoneNumEdit.getText().toString().trim(); if (!EfunboxUtil.isMobileNO(mobile)) { //弹不出来 // CusToast.getInstance(context).show("请输入正确的手机号", 1000); mErrorText.setText("请输入正确的手机号"); mErrorText.setVisibility(View.VISIBLE); return; } OkHttpClient.doGetAsync(HttpInfo.Builder().setUrl(Consts.getFinalApi() + "/user/verifyCode").addParam("mobileNo", mobile), new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { getVCodeTimeText.setText(String.valueOf(mVCodeCount)); getVCodeTimeText.setEnabled(false); getVCodeTimeText.setClickable(false); handler.sendEmptyMessageDelayed(0x1314, 1000); } @Override public void onFailure(HttpInfo info) throws IOException { //弹不出来 // CusToast.getInstance(Consts.getmApplicAtion()).show("获取验证码失败", 1000); mErrorText.setText("获取验证码失败:" + info.getRetDetail()); mErrorText.setVisibility(View.VISIBLE); getVCodeTimeText.setEnabled(true); getVCodeTimeText.setClickable(true); } }); }); //提交绑定手机号 RxView.clicks(mBindSubmit).throttleFirst(2, TimeUnit.SECONDS).subscribe(o -> { String mobile = bindPhoneNumEdit.getText().toString().trim(); if (!EfunboxUtil.isMobileNO(mobile)) { // CusToast.getInstance(context).show("请输入正确的手机号", 1000); mErrorText.setText("请输入正确的手机号"); mErrorText.setVisibility(View.VISIBLE); return; } userApi.bindPhoneNum(mobile, new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.getType()); Logger.e("绑定手机号:" + info.getRetDetail()); if (bean.getCode().equals("200")) { if (bean.getSuccess()) { Logger.e("绑定手机号成功:" + info.getRetDetail()); Consts.setmConstsUserBean(bean.getData()); Toast.makeText(context, "绑定手机号成功", Toast.LENGTH_LONG).show(); mErrorText.setText("绑定手机号成功"); mErrorText.setVisibility(View.VISIBLE); miSoundLoginCallback.success(); } } else if (bean.getCode().equals("706")) { mErrorText.setText("绑定手机号失败:" + bean.getMessage()); mErrorText.setVisibility(View.VISIBLE); } } @Override public void onFailure(HttpInfo info) throws IOException { Logger.e("绑定手机号失败:" + info.getRetDetail()); mErrorText.setText("绑定手机号失败:" + info.getRetDetail()); mErrorText.setVisibility(View.VISIBLE); } }); }); } break; case MiSoundSDKUtil.MI_SOUND_SHOW_BINDPHONENUM: { TextView tv = dialog_view.findViewById(R.id.popupwindow_mi_sound_show_bind_phoneNum_layout_phoneNum); tv.setText("手机号码 :" + Consts.getmConstsUserBean().getMobile()); } break; } } private void hideSoftInput(View view) { InputMethodManager manager = ((InputMethodManager) Consts.getmApplicAtion().getSystemService(Context.INPUT_METHOD_SERVICE)); if (manager != null) { manager.hideSoftInputFromWindow(view.getWindowToken(), 0); } } public Handler getPopHandler() { return handler; } private Handler handler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(@NonNull Message message) { switch (message.what) { case 0x0131: ((TextView) message.obj).setText(message.arg1 + "/100"); break; case 0x1312: getMyInfo(mActivity, (TextView) message.obj); break; case 0x1313: //小米绑定手机号轮询查询用户逻辑 if (loginSuccess) { handler.removeMessages(0x1313); return true; } userApi.MiSoundIsLogin(DeviceUuidFactory.getUuid(), new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { try { JSONObject object = new JSONObject(info.getRetDetail()); if (object.getString("code").equals("300") || object.getInt("code") == 300) { //暂无数据 Logger.e("暂无数据"); handler.sendEmptyMessageDelayed(0x1313, 1000); return; } else { Logger.e("info.getR:" + info.getRetDetail()); handler.removeMessages(0x1313); loginSuccess = true; HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.getType()); Consts.setUID(bean.getData().getUid()); //用户是否登录,登录了,创建Consts的userbean Consts.setmConstsUserBean(bean.getData()); userApi.loginSign(null, new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { try { HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.getType()); if (bean.getData().getIsSign()) { CusToast.getInstance(Consts.getmApplicAtion()).show("恭喜签到成功\n奖励" + bean.getData().getCount() + "朵小红花", 2000); } } catch (Exception e) { e.printStackTrace(); } finally { miSoundLoginCallback.success(); if (Consts.getUmengChannel().equals(ChannelCodeEnum.YIFANG.getChannelCode()) || Consts.getUmengChannel().equals(ChannelCodeEnum.TMAIL.getChannelCode()) || Consts.getUmengChannel().equals(ChannelCodeEnum.MISOUND.getChannelCode()) ) { //义方渠道检查权限 if (Consts.getmConstsUserBean() != null) { mOrderApi.getAuth(new Callback() { @Override public void onSuccess(HttpInfo info) throws IOException { HttpResultBean bean = info.getRetDetail(new TypeToken>() { }.getType()); if (!TextUtils.isEmpty(bean.getData())) { Consts.setIsYFVip(true); } } @Override public void onFailure(HttpInfo info) throws IOException { } }); } } } } @Override public void onFailure(HttpInfo info) throws IOException { Logger.e("info:" + info.getRetDetail()); } }); } } catch (Exception e) { e.printStackTrace(); } finally { } } @Override public void onFailure(HttpInfo info) throws IOException { Logger.e("misound_login_error_info.get:" + info.getRetDetail()); } }); break; case 0x1314: //小米绑定手机号倒计时逻辑 if (mVCodeCount == 0) { mVCodeCount = 60; handler.removeMessages(0x1314); getVCodeTimeText.setEnabled(true); getVCodeTimeText.setClickable(true); getVCodeTimeText.setText("获取验证码"); return true; } else { mVCodeCount--; getVCodeTimeText.setText(String.valueOf(mVCodeCount)); handler.sendEmptyMessageDelayed(0x1314, 1000); } break; } return false; } }); public interface MISoundLoginCallBack { void success(); } } class OrderSpacesItemDecoration extends RecyclerView.ItemDecoration { private int space; private int maxCount; public OrderSpacesItemDecoration(int space, int max) { this.space = space; this.maxCount = max; } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { int position = parent.getChildAdapterPosition(view); Logger.e("position:" + position); Logger.e("parent:" + parent.getChildCount()); if (position < 1) { outRect.top = space * 10; outRect.bottom = space; } else { outRect.bottom = space; } if (position == maxCount - 1) { outRect.bottom = space * 10; } } }