diff --git a/common/src/main/java/com/yunbao/common/bean/UserBean.java b/common/src/main/java/com/yunbao/common/bean/UserBean.java index 211906d03..0577d6263 100644 --- a/common/src/main/java/com/yunbao/common/bean/UserBean.java +++ b/common/src/main/java/com/yunbao/common/bean/UserBean.java @@ -67,13 +67,13 @@ public class UserBean implements Parcelable { //随机天梯排位赛PK img,仅在主播PK时使用 private String mRankPkImgUrl; //是否填写完整资料 - private String user_info_complete; + private int user_info_complete; - public String getUserInfoComplete() { + public int getUserInfoComplete() { return user_info_complete; } - public UserBean seUserInfoComplete(String userInfoComplete) { + public UserBean seUserInfoComplete(int userInfoComplete) { this.user_info_complete = userInfoComplete; return this; } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 555f0108a..881ebe3f7 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -694,4 +694,10 @@ public interface PDLiveApi { */ @GET("/api/public/?service=User.setLogOff") Observable>> setLogOff(); + + /** + * 领取完善资料奖励 + */ + @GET("/api/public/?service=Task.userInfoTask") + Observable>> userInfoTask(); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 41bfecaaf..0eeb08137 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -1427,6 +1427,28 @@ public class LiveNetManager { }).isDisposed(); } + public void userInfoTask(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .userInfoTask() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getMsg()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/views/CompleteInformationPopup.java b/common/src/main/java/com/yunbao/common/views/CompleteInformationPopup.java new file mode 100644 index 000000000..1440bd29f --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/CompleteInformationPopup.java @@ -0,0 +1,80 @@ +package com.yunbao.common.views; + +import android.content.Context; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.R; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class CompleteInformationPopup extends CenterPopupView { + + private TextView completeInformationHint, completeInformation2; + private ImageView iconLive, expression; + private boolean isLeave; + private CompleteInformationCallBack callBack; + + public CompleteInformationPopup(@NonNull Context context, boolean isLeave, CompleteInformationCallBack callBack) { + super(context); + this.isLeave = isLeave; + this.callBack = callBack; + } + + // 返回自定义弹窗的布局离开 + @Override + protected int getImplLayoutId() { + return R.layout.view_complete_information; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + initView(); + } + + private void initView() { + completeInformationHint = findViewById(R.id.complete_information_hint); + completeInformation2 = findViewById(R.id.complete_information2); + iconLive = findViewById(R.id.icon_live); + expression = findViewById(R.id.expression); + if (isLeave) { + completeInformationHint.setText(R.string.complete_information_hint3); + completeInformation2.setText(R.string.you_guide_me); + iconLive.setVisibility(GONE); + ImgLoader.display(getContext(), R.mipmap.icon_cry_face, expression); + } else { + ImgLoader.display(getContext(), R.mipmap.icon_smiling_face, expression); + completeInformation2.setText(R.string.complete_information_hint2); + completeInformationHint.setText(R.string.complete_information_hint); + } + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_cancel), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + if (callBack != null) { + callBack.onCancel(); + } + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_ok), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + dismiss(); + if (callBack != null) { + callBack.onSure(); + } + } + }); + } + + public interface CompleteInformationCallBack { + void onCancel(); + + void onSure(); + } +} diff --git a/common/src/main/res/layout/view_complete_information.xml b/common/src/main/res/layout/view_complete_information.xml new file mode 100644 index 000000000..253534175 --- /dev/null +++ b/common/src/main/res/layout/view_complete_information.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/icon_cry_face.png b/common/src/main/res/mipmap-xxhdpi/icon_cry_face.png new file mode 100644 index 000000000..9a5279b2e Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_cry_face.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_live.png b/common/src/main/res/mipmap-xxhdpi/icon_live.png new file mode 100644 index 000000000..50a91c24e Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_live.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/icon_smiling_face.png b/common/src/main/res/mipmap-xxhdpi/icon_smiling_face.png new file mode 100644 index 000000000..7405dd2bd Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_smiling_face.png differ diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index bd29405c7..77c57258f 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1157,4 +1157,8 @@ Limited ride And limited avatar frame 真愛粉\n勛章(7天) 男生 女生 + 已將獎勵發送至您的背包,請注意查看。 + 離開會讓您失去獎勵,您確認離開嗎? + 愛你,愛你 + 指導下我好嗎 diff --git a/main/src/main/java/com/yunbao/main/activity/EditProfileActivity.java b/main/src/main/java/com/yunbao/main/activity/EditProfileActivity.java index 9afd10571..1926df313 100644 --- a/main/src/main/java/com/yunbao/main/activity/EditProfileActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EditProfileActivity.java @@ -13,6 +13,8 @@ import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.BasePopupView; +import com.lxj.xpopup.interfaces.XPopupCallback; import com.sahooz.library.Country; import com.sahooz.library.CountryPicker; import com.sahooz.library.OnPick; @@ -27,6 +29,7 @@ import com.yunbao.common.bean.UserBean; import com.yunbao.common.event.UpdateFieldEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.ActivityResultCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.ImageResultCallback; @@ -37,7 +40,9 @@ import com.yunbao.common.utils.ProcessImageUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.CompleteInformationPopup; import com.yunbao.common.views.UpdateSexPopup; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; import com.yunbao.main.event.EditProfileEvent; import com.yunbao.main.http.MainHttpConsts; @@ -165,6 +170,108 @@ public class EditProfileActivity extends AbsActivity { } }); } + ViewClicksAntiShake.clicksAntiShake(submit, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(mContext). + userInfoTask(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(String data) { + ToastUtil.show(data); + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + new XPopup.Builder(mContext) + .setPopupCallback(new XPopupCallback() { + @Override + public void onCreated(BasePopupView popupView) { + + } + + @Override + public void beforeShow(BasePopupView popupView) { + + } + + @Override + public void onShow(BasePopupView popupView) { + + } + + @Override + public void onDismiss(BasePopupView popupView) { + submit.setText(R.string.live_task_item_complete_true); + submit.setBackgroundResource(R.mipmap.bg_submit_cancel); + submit.setTextColor(Color.parseColor("#FFFFFF")); + } + + @Override + public void beforeDismiss(BasePopupView popupView) { + + } + + @Override + public boolean onBackPressed(BasePopupView popupView) { + return false; + } + + @Override + public void onKeyBoardStateChanged(BasePopupView popupView, int height) { + + } + + @Override + public void onDrag(BasePopupView popupView, int value, float percent, boolean upOrLeft) { + + } + + @Override + public void onClickOutside(BasePopupView popupView) { + + } + }) + .asCustom(new CompleteInformationPopup(mContext, false, + new CompleteInformationPopup.CompleteInformationCallBack() { + @Override + public void onCancel() { + + } + + @Override + public void onSure() { + + } + })) + .show(); + } + }); + } + + + @Override + public void onBackPressed() { + if (userModel.getUserInfoComplete() ==1) { + finish(); + } else { + new XPopup.Builder(mContext) + .asCustom(new CompleteInformationPopup(mContext, true, new CompleteInformationPopup.CompleteInformationCallBack() { + @Override + public void onCancel() { + + } + + @Override + public void onSure() { + finish(); + } + })) + .show(); + } + } private void getTaskType() { @@ -524,6 +631,7 @@ public class EditProfileActivity extends AbsActivity { viewProgress3.setBackgroundColor(Color.parseColor("#FFE5D0")); submit.setText(R.string.to_receive); submit.setTextColor(Color.parseColor("#935902")); + submit.setEnabled(true); } ImgLoader.displayAvatar(mContext, u.getAvatar(), mAvatar); mName.setText(u.getUserNiceName()); @@ -546,6 +654,24 @@ public class EditProfileActivity extends AbsActivity { tv_bind_phone.setHint(getResources().getString(R.string.bind_phone_text)); isBind = "0"; } + if (u.getUserInfoComplete() == 1) { + submit.setText(R.string.live_task_item_complete_true); + submit.setBackgroundResource(R.mipmap.bg_submit_cancel); + submit.setTextColor(Color.parseColor("#FFFFFF")); + submit.setEnabled(false); + } else { + if (index<4){ + submit.setText(R.string.to_complete); + submit.setBackgroundResource(R.mipmap.bg_submit); + submit.setTextColor(Color.parseColor("#FFFFFF")); + submit.setEnabled(false); + }else { + submit.setText(R.string.to_receive); + submit.setBackgroundResource(R.mipmap.bg_submit); + submit.setTextColor(Color.parseColor("#935902")); + } + + } } diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 1b126ceaa..e4785c2ed 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -498,17 +498,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //获取指导员账号 ConversationIMListManager.get(this).getUserInstructor(this); checkVersion(); - //是否完善个人资料 - MainHttpUtil.getBaseInfo(new CommonCallback() { - @Override - public void callback(UserBean bean) { - if (!TextUtils.equals(bean.getUserInfoComplete(), "1")) { - v_table_redpoint_me.setVisibility(View.VISIBLE); - } else { - v_table_redpoint_me.setVisibility(View.GONE); - } - } - }); + } @Override @@ -538,6 +528,30 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } }, 1000); + + } + + @Override + protected void onStart() { + super.onStart(); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + //是否完善个人资料 + MainHttpUtil.getBaseInfo(new CommonCallback() { + @Override + public void callback(UserBean bean) { + if (bean.getUserInfoComplete() == 0) { + v_table_redpoint_me.setVisibility(View.VISIBLE); + } else { + v_table_redpoint_me.setVisibility(View.GONE); + } + } + }); + + } + }, 1000); + } /** diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index 73bf8ac42..531087671 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -36,6 +36,7 @@ import com.yunbao.common.bean.GoogleBean; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.UserItemBean; +import com.yunbao.common.event.CompleteInformationEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; @@ -68,6 +69,8 @@ import com.yunbao.main.adapter.MainMeAdapter; import com.yunbao.main.http.MainHttpConsts; import com.yunbao.main.http.MainHttpUtil; +import org.greenrobot.eventbus.EventBus; + import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -185,12 +188,12 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi } }); redPoint.setVisibility(APKManager.get().getApkVerNew() ? View.GONE : View.VISIBLE); - ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.complete_information), new ViewClicksAntiShake.ViewClicksCallBack() { - @Override - public void onViewClicks() { - mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); - } - }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.complete_information), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + mContext.startActivity(new Intent(mContext, EditProfileActivity.class)); + } + }); } @Override @@ -421,13 +424,14 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi } Constants.myUid = u.getGoodnum(); Constants.myAvatar = u.getAvatar(); - if (TextUtils.equals(u.getUserInfoComplete(), "1")) { + if (u.getUserInfoComplete() == 1) { findViewById(R.id.complete_information_radius).setVisibility(View.INVISIBLE); findViewById(R.id.complete_information).setVisibility(View.INVISIBLE); } else { findViewById(R.id.complete_information_radius).setVisibility(View.VISIBLE); findViewById(R.id.complete_information).setVisibility(View.VISIBLE); } + EventBus.getDefault().post(new CompleteInformationEvent().setCompleteInformation(findViewById(R.id.complete_information).getVisibility() == View.VISIBLE)); } @Override diff --git a/main/src/main/res/layout/view_homemain.xml b/main/src/main/res/layout/view_homemain.xml index 6346959f9..175475a58 100644 --- a/main/src/main/res/layout/view_homemain.xml +++ b/main/src/main/res/layout/view_homemain.xml @@ -130,7 +130,7 @@ android:layout_marginTop="2dp" android:layout_marginEnd="20dp" android:background="@drawable/background_ff5075" - android:visibility="visible" /> + android:visibility="gone" /> diff --git a/main/src/main/res/mipmap-xxxhdpi/bg_submit_cancel.png b/main/src/main/res/mipmap-xxxhdpi/bg_submit_cancel.png new file mode 100644 index 000000000..35b92efd3 Binary files /dev/null and b/main/src/main/res/mipmap-xxxhdpi/bg_submit_cancel.png differ