完善个人资料,离开修改页面提示弹窗,完成领取弹窗

This commit is contained in:
18401019693 2023-05-11 14:34:39 +08:00
parent 8410439a90
commit 576d39461a
14 changed files with 375 additions and 22 deletions

View File

@ -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;
}

View File

@ -694,4 +694,10 @@ public interface PDLiveApi {
*/
@GET("/api/public/?service=User.setLogOff")
Observable<ResponseModel<List<Object>>> setLogOff();
/**
* 领取完善资料奖励
*/
@GET("/api/public/?service=Task.userInfoTask")
Observable<ResponseModel<List<Object>>> userInfoTask();
}

View File

@ -1427,6 +1427,28 @@ public class LiveNetManager {
}).isDisposed();
}
public void userInfoTask(HttpCallback<String> callback) {
API.get().pdLiveApi(mContext)
.userInfoTask()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<Object>>>() {
@Override
public void accept(ResponseModel<List<Object>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getMsg());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
/**
* 直播间取消网络请求
*/

View File

@ -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();
}
}

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="274dp"
android:layout_height="168.5dp"
app:cardCornerRadius="15dp"
app:cardElevation="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/complete_information_hint"
android:layout_width="124.5dp"
android:layout_height="wrap_content"
android:layout_marginStart="25.5dp"
android:layout_marginTop="30.5dp"
android:text="@string/complete_information_hint"
android:textColor="#333333"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--表情-->
<ImageView
android:id="@+id/expression"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginStart="40dp"
android:layout_marginTop="22.5dp"
android:src="@mipmap/icon_smiling_face" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/complete_information2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18.5dp"
android:layout_marginTop="7dp"
android:text="@string/complete_information_hint2"
android:textColor="#666666"
android:textSize="10sp" />
<ImageView
android:id="@+id/icon_live"
android:layout_width="34dp"
android:layout_height="10dp"
android:layout_gravity="bottom"
android:layout_marginStart="2dp"
android:src="@mipmap/icon_live" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/live_open_cancel"
android:layout_width="111dp"
android:layout_height="37dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:background="@drawable/backgroud_live_open_lfet"
android:gravity="center"
android:text="@string/cancel"
android:textColor="#FFC621"
android:textSize="14sp" />
<TextView
android:id="@+id/live_open_ok"
android:layout_width="100dp"
android:layout_height="36dp"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="16dp"
android:background="@drawable/backgroud_live_open_right"
android:gravity="center"
android:text="@string/confirm"
android:textColor="@color/white"
android:textSize="14sp" />
</FrameLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -1157,4 +1157,8 @@ Limited ride And limited avatar frame</string>
<string name="love_powder_medal">真愛粉\n勛章(7天)</string>
<string name="man_student">男生</string>
<string name="girl_student">女生</string>
<string name="complete_information_hint">已將獎勵發送至您的背包,請注意查看。</string>
<string name="complete_information_hint3">離開會讓您失去獎勵,您確認離開嗎?</string>
<string name="complete_information_hint2">愛你,愛你</string>
<string name="you_guide_me">指導下我好嗎</string>
</resources>

View File

@ -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<String>() {
@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"));
}
}
}

View File

@ -498,17 +498,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
//获取指导员账号
ConversationIMListManager.get(this).getUserInstructor(this);
checkVersion();
//是否完善个人资料
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
@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<UserBean>() {
@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);
}
/**

View File

@ -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

View File

@ -130,7 +130,7 @@
android:layout_marginTop="2dp"
android:layout_marginEnd="20dp"
android:background="@drawable/background_ff5075"
android:visibility="visible" />
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB