新增头像选择界面

This commit is contained in:
2023-07-19 18:30:32 +08:00
parent 3108c898c2
commit 736592b4e1
19 changed files with 249 additions and 56 deletions

View File

@@ -1,18 +1,16 @@
package com.yunbao.common.bean;
public class UserAvatarSelectBean {
import com.google.gson.annotations.SerializedName;
public class UserAvatarSelectBean extends BaseModel {
@SerializedName("id")
private int id;
private String url;
private int select;
public UserAvatarSelectBean(int id, String url, int select) {
this.id = id;
this.url = url;
this.select = select;
}
public UserAvatarSelectBean() {
}
@SerializedName("name")
private String name;
@SerializedName("path")
private String path;
@SerializedName("checked")
private int checked;
public int getId() {
return id;
@@ -22,19 +20,27 @@ public class UserAvatarSelectBean {
this.id = id;
}
public String getUrl() {
return url;
public String getName() {
return name;
}
public void setUrl(String url) {
this.url = url;
public void setName(String name) {
this.name = name;
}
public int getSelect() {
return select;
public String getPath() {
return path;
}
public void setSelect(int select) {
this.select = select;
public void setPath(String path) {
this.path = path;
}
public int getChecked() {
return checked;
}
public void setChecked(int checked) {
this.checked = checked;
}
}

View File

@@ -45,6 +45,7 @@ import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.SlideInBannerModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.UserAreaBean;
import com.yunbao.common.bean.UserAvatarSelectBean;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.bean.WishListGiftConfModel;
import com.yunbao.common.bean.WishListModel;
@@ -829,4 +830,19 @@ public interface PDLiveApi {
@Query("stream") String stream,
@Query("red_packet_id") String redPacketId
);
/**
* 获取系统默认头像列表
*/
@GET("/api/public/?service=Userhome.getDefaultAvatarList")
Observable<ResponseModel<List<UserAvatarSelectBean>>> getSystemUserAvatar();
/**
* 设置系统默认头像
* @param id 头像id
*/
@GET("/api/public/?service=Userhome.setAvatar")
Observable<ResponseModel<Object>> setSystemUserAvatar(
@Query("avatar_id") int id
);
}

View File

@@ -41,6 +41,7 @@ import com.yunbao.common.bean.RedPacketListBean;
import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.bean.StarChallengeStatusModel;
import com.yunbao.common.bean.UserAreaBean;
import com.yunbao.common.bean.UserAvatarSelectBean;
import com.yunbao.common.bean.VipModel;
import com.yunbao.common.bean.WishListGiftConfModel;
import com.yunbao.common.bean.WishListModel;
@@ -1795,7 +1796,52 @@ public class LiveNetManager {
}
}).isDisposed();
}
public void getSystemUserAvatar(HttpCallback<List<UserAvatarSelectBean>> callback) {
API.get().pdLiveApi(mContext)
.getSystemUserAvatar()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<UserAvatarSelectBean>>>() {
@Override
public void accept(ResponseModel<List<UserAvatarSelectBean>> objectResponseModel) throws Exception {
if (objectResponseModel.getData().getCode() == 0) {
callback.onSuccess(objectResponseModel.getData().getInfo());
} else {
callback.onError(objectResponseModel.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();
}
public void setSystemUserAvatar(int id, HttpCallback<String> callback) {
API.get().pdLiveApi(mContext)
.setSystemUserAvatar(id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<Object>>() {
@Override
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
if (objectResponseModel.getData().getCode() == 0) {
callback.onSuccess(objectResponseModel.getData().getMsg());
} else {
callback.onError(objectResponseModel.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

@@ -1249,6 +1249,8 @@ Limited ride And limited avatar frame</string>
<string name="lucky_red_envelope">%s drew %s in the lucky red envelope</string>
<string name="lucky_red_envelope_amount">number</string>
<string name="red_envelope_released_successfully">Red successfully</string>
<string name="me_edit_avatar_system">Select System Avatar</string>
<string name="me_edit_avatar_system_tip">This function needs to be used to use it after lv.5, please work hard to upgrade ~</string>
</resources>

View File

@@ -1244,4 +1244,6 @@
<string name="lucky_red_envelope">" %s 在 好運紅包 中抽到了 %s"</string>
<string name="lucky_red_envelope_amount">数量</string>
<string name="red_envelope_released_successfully">红包发布成功</string>
<string name="me_edit_avatar_system">選擇系統頭像</string>
<string name="me_edit_avatar_system_tip">該功能需升至Lv.5后使用,請努力升級吧~</string>
</resources>

View File

@@ -1243,4 +1243,6 @@
<string name="lucky_red_envelope">" %s 在 好運紅包 中抽到了 %s"</string>
<string name="lucky_red_envelope_amount">数量</string>
<string name="red_envelope_released_successfully">红包发布成功</string>
<string name="me_edit_avatar_system">選擇系統頭像</string>
<string name="me_edit_avatar_system_tip">該功能需升至Lv.5后使用,請努力升級吧~</string>
</resources>

View File

@@ -1244,6 +1244,8 @@
<string name="lucky_red_envelope">" %s 在 好運紅包 中抽到了 %s"</string>
<string name="lucky_red_envelope_amount">数量</string>
<string name="red_envelope_released_successfully">红包发布成功</string>
<string name="me_edit_avatar_system">選擇系統頭像</string>
<string name="me_edit_avatar_system_tip">該功能需升至Lv.5后使用,請努力升級吧~</string>
</resources>

View File

@@ -1250,4 +1250,6 @@ Limited ride And limited avatar frame</string>
<string name="lucky_red_envelope">%s drew %s in the lucky red envelope</string>
<string name="lucky_red_envelope_amount">number</string>
<string name="red_envelope_released_successfully">>Red successfully</string>
<string name="me_edit_avatar_system">Select System Avatar</string>
<string name="me_edit_avatar_system_tip">This function needs to be used to use it after lv.5, please work hard to upgrade ~</string>
</resources>