1:完成挚友功能
2:添加在送特定礼物展示弹框功能 3:修改部分图片格式变成wedp 4:用户主页添加礼物墙和挚友
@@ -0,0 +1,73 @@
|
||||
package com.xscm.moduleutil.bean
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
import lombok.Data
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
* 项目名称:羽声语音
|
||||
* 时间:2025/11/20 15:13
|
||||
* 用途:心动空间中的关系实体
|
||||
*/
|
||||
@Data
|
||||
class RelationBean : MultiItemEntity {
|
||||
|
||||
var cp: UserInfo.CpInfo = UserInfo.CpInfo()
|
||||
var no_cp: List<NoCpBean> = ArrayList()
|
||||
override fun getItemType(): Int {
|
||||
|
||||
// 情况3:no_cp集合,relation_name不等于"",并且relation_list的大小是1
|
||||
if (no_cp.isNotEmpty() && no_cp[0].relation_name.isNotEmpty() && no_cp[0].relation_list.size == 1) {
|
||||
return 3
|
||||
}
|
||||
|
||||
// 情况4:no_cp集合,relation_list的大小是1
|
||||
if (no_cp.isNotEmpty() && no_cp[0].relation_list.size == 1) {
|
||||
return 4
|
||||
}
|
||||
|
||||
if (no_cp.isNotEmpty() && no_cp[0].relation_name.isNotEmpty() && no_cp[0].relation_list.size > 1){
|
||||
return 5
|
||||
}
|
||||
|
||||
// 其他情况返回5
|
||||
return 6
|
||||
}
|
||||
|
||||
class NoCpBean : MultiItemEntity{
|
||||
var relation_name: String = ""
|
||||
var relation_list: List<RelationshipBean> = ArrayList()
|
||||
override fun getItemType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*"cp": [
|
||||
{
|
||||
"relation_name": "string",
|
||||
"relation_list": [
|
||||
{
|
||||
"nickname1": "string",
|
||||
"avatar1": "string",
|
||||
"user_id1": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"no_cp": [
|
||||
{
|
||||
"relation_name": "string",
|
||||
"relation_list": [
|
||||
{
|
||||
"user_info1": {},
|
||||
"user_info2": "string",
|
||||
"level": "string",
|
||||
"exp": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}*/
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.xscm.moduleutil.bean;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -10,7 +12,7 @@ import lombok.Data;
|
||||
* @description: 关系信息
|
||||
*/
|
||||
@Data
|
||||
public class RelationshipBean implements Serializable {
|
||||
public class RelationshipBean implements Serializable, MultiItemEntity {
|
||||
|
||||
|
||||
private int relation_id;//关系id 3,
|
||||
@@ -31,4 +33,11 @@ public class RelationshipBean implements Serializable {
|
||||
private int heart_value;// 0,
|
||||
private int is_top;// 0
|
||||
private int type;// 1,亲密;2:真爱
|
||||
private int sex1;//1:女 2:男
|
||||
private int sex2;//
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xscm.moduleutil.bean;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.xscm.moduleutil.BaseEvent;
|
||||
import com.xscm.moduleutil.bean.room.FriendInfo;
|
||||
@@ -38,7 +39,7 @@ public class UserInfo extends BaseEvent implements Serializable {
|
||||
private int is_in_pit;//是否在麦上,1在0不在
|
||||
private int is_open_live_remind;//是否设置开播提醒
|
||||
private String birthday;//生日
|
||||
private String profile;//简介
|
||||
private String profile = "";//简介
|
||||
private String home_bgimages;//背景图片
|
||||
private int is_follow;//是否关注
|
||||
private List<UserTagBean> tag_list;
|
||||
@@ -95,7 +96,16 @@ public class UserInfo extends BaseEvent implements Serializable {
|
||||
"direction": "string",
|
||||
|
||||
}*/
|
||||
public static class CpInfo implements Serializable{
|
||||
|
||||
@Data
|
||||
public static class CpInfo implements Serializable, MultiItemEntity {
|
||||
private int id;
|
||||
private int user_id1;
|
||||
private int user_id2;
|
||||
private int status;
|
||||
|
||||
private long createtime;
|
||||
|
||||
public String name;
|
||||
public String level;
|
||||
public String exp;
|
||||
@@ -104,13 +114,22 @@ public class UserInfo extends BaseEvent implements Serializable {
|
||||
public UserInfo1 user_info1;
|
||||
public UserInfo2 user_info2;
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
if(!name.isEmpty()) {
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class UserInfo1 implements Serializable {
|
||||
public String user_id;
|
||||
public String nickname;
|
||||
public String avatar;
|
||||
public String dress;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class UserInfo2 implements Serializable {
|
||||
public String user_id;
|
||||
public String nickname;
|
||||
@@ -143,6 +162,7 @@ public class UserInfo extends BaseEvent implements Serializable {
|
||||
private String total;
|
||||
|
||||
private List<SendUserInfo> send_user_info;
|
||||
|
||||
@Data
|
||||
public static class SendUserInfo implements Serializable {
|
||||
private String nickname;
|
||||
|
||||
@@ -385,6 +385,10 @@ public interface ApiServer {
|
||||
Call<BaseModel<String>> commentZone(@Field("id") String id, @Field("content") String content, @Field("pid") String pid, @Field("reply_to") String reply_to);
|
||||
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_FRIEND_LIST)
|
||||
Call<BaseModel<RelationBean>> getFriendList(@Field("user_id") String user_id, @Field("page") String page, @Field("page_limit") String page_limit);
|
||||
|
||||
@GET(Constants.GET_MY_CP_ROOM_LIST)
|
||||
Call<BaseModel<List<MyCpRoom>>> myCpRoom();
|
||||
|
||||
@@ -754,6 +758,10 @@ public interface ApiServer {
|
||||
@POST(Constants.POST_QUIT_ROOM)
|
||||
Call<ResponseBody> quitRoom(@Field("room_id") String room_id, @Field("user_id") String user_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_FRIEND_LIST_MORE)
|
||||
Call<BaseModel<List<RelationshipBean>>> getFriendListMore(@Field("user_id") String user_id, @Field("relation_id") String relation_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_RELATION_CARD)
|
||||
Call<BaseModel<RelationCardBean>> relationCard(@Field("user_id") String user_id);
|
||||
|
||||
@@ -3595,6 +3595,35 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getFriendListMore(String user_id,String relation_id,BaseObserver<List<RelationshipBean>> observer){
|
||||
sApiServer.getFriendListMore(user_id,relation_id).enqueue(new Callback<BaseModel<List<RelationshipBean>>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RelationshipBean>>> call, Response<BaseModel<List<RelationshipBean>>> response) {
|
||||
if (response.code()==200){
|
||||
BaseModel<List<RelationshipBean>> baseModel = response.body();
|
||||
if (baseModel.getCode()==1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
}else if (baseModel.getCode()==301){
|
||||
try {
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}else {
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<RelationshipBean>>> call, Throwable t) {
|
||||
LogUtils.e("getFriendListMore",t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void checkTxt(String room_name, String room_cover, String
|
||||
room_intro, BaseObserver<String> observer) {
|
||||
sApiServer.checkTxt(room_name, room_cover, room_intro).enqueue(new Callback<ResponseBody>() {
|
||||
@@ -3712,8 +3741,7 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void commentZone(String id, String content, String pid, String
|
||||
reply_to, BaseObserver<String> observer) {
|
||||
public void commentZone(String id, String content, String pid, String reply_to, BaseObserver<String> observer) {
|
||||
sApiServer.commentZone(id, content, pid, reply_to).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
@@ -3727,6 +3755,34 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void getFriendList(String userId,String page,String page_limit,BaseObserver<RelationBean> observer) {
|
||||
sApiServer.getFriendList(userId, page, page_limit).enqueue(new Callback<BaseModel<RelationBean>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<RelationBean>> call, Response<BaseModel<RelationBean>> response) {
|
||||
if (response.code()==200){
|
||||
BaseModel<RelationBean> body = response.body();
|
||||
if (body.getCode()==1){
|
||||
observer.onNext(body.getData());
|
||||
}else if (body.getCode()==301){
|
||||
try {
|
||||
ToastUtils.showShort(body.getMsg());
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}else {
|
||||
ToastUtils.showShort(body.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<RelationBean>> call, Throwable t) {
|
||||
LogUtils.e("getFriendList",t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void clearLoginInfo(BaseObserver<String> observer) {
|
||||
sApiServer.clearLoginInfo(SpUtil.getToken()).enqueue(new Callback<BaseModel<String>>() {
|
||||
|
||||
@@ -72,4 +72,12 @@ public class MeHeadView extends ConstraintLayout {
|
||||
mIvOnline.setVisibility(VISIBLE);
|
||||
mIvOnline.setImageResource(isOnline ? R.mipmap.me_online_icon : R.mipmap.me_icon_unchecked);
|
||||
}
|
||||
|
||||
public void setSex(int sex,String headPicture) {
|
||||
if (!TextUtils.isEmpty(headPicture)) {
|
||||
ImageUtils.loadHead(headPicture, mRiv);
|
||||
}
|
||||
mIvSex.setVisibility(VISIBLE);
|
||||
mIvSex.setImageResource(sex == 1 ? R.mipmap.nan : R.mipmap.nv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,4 +237,25 @@ public class TimeUtils {
|
||||
|
||||
return sb.toString().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时长(毫秒),只返回天数部分。
|
||||
* 例如:输入 90000000 (90,000秒,即1天多),返回 "1天"
|
||||
*
|
||||
* @param durationMs 时长,单位为毫秒
|
||||
* @return 格式化后的天数字符串,如 "1天",如果不足一天则返回空字符串 ""
|
||||
*/
|
||||
public static String formatDurationDaysOnly(long durationMs) {
|
||||
long totalSeconds = durationMs / 1000;
|
||||
long days = totalSeconds / 86400;
|
||||
|
||||
// 如果天数大于0,则构建返回字符串
|
||||
if (days > 0) {
|
||||
return days + "天";
|
||||
}
|
||||
|
||||
// 如果天数不足1天,根据需求可以返回空字符串,也可以返回 "0天" 或其他
|
||||
return ""; // 或者 return "0天";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -422,6 +422,8 @@ public class Constants {
|
||||
public static final String POST_SINGER_ADD_SONG = "/api/SingerSong/singerAddSong";//歌手添加歌曲
|
||||
public static final String POST_SINGER_DELETE_SONG = "/api/SingerSong/singerDelSong";//歌手删除 歌曲
|
||||
public static final String POST_SINGER_UPDATE_SONG = "/api/SingerSong/singerEditSong";//歌手修改歌曲
|
||||
public static final String POST_FRIEND_LIST = "/api/User/get_friend_list";//挚友列表
|
||||
public static final String POST_FRIEND_LIST_MORE = "/api/User/get_friend_list_more";//挚友列表查看更多
|
||||
public static final String POST_SEND_LOG = "api/Report/android_log_report";//上传log信息
|
||||
|
||||
|
||||
|
||||
5
BaseModule/src/main/res/drawable/bg_r48_ff8acc.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/dp_48" />
|
||||
<solid android:color="#FF8ACC" />
|
||||
</shape>
|
||||
@@ -43,7 +43,8 @@
|
||||
app:layout_constraintWidth_percent="1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline"
|
||||
@@ -61,7 +62,8 @@
|
||||
app:layout_constraintHeight_default="spread"
|
||||
app:layout_constraintTop_toTopOf="@+id/guideline"
|
||||
app:layout_constraintWidth_default="spread"
|
||||
tools:src="@mipmap/me_sj" />
|
||||
tools:src="@mipmap/me_sj"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_online"
|
||||
|
||||
|
Before Width: | Height: | Size: 151 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/icon_dialog_u_bg.webp
Normal file
|
After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/icon_dialog_u_cp_.webp
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 96 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/icon_dialog_u_cp_bg.webp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 10 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/icon_dialog_u_cp_lv.webp
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/icon_dialog_u_master.webp
Normal file
|
After Width: | Height: | Size: 904 B |
|
Before Width: | Height: | Size: 7.1 KiB |
BIN
BaseModule/src/main/res/mipmap-hdpi/icon_guild_bg.webp
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 474 B |
BIN
BaseModule/src/main/res/mipmap-mdpi/music_sy.webp
Normal file
|
After Width: | Height: | Size: 450 B |
|
Before Width: | Height: | Size: 12 KiB |
BIN
BaseModule/src/main/res/mipmap-mdpi/red_tx.webp
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 180 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/icon_dialog_u_bg.webp
Normal file
|
After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/icon_dialog_u_cp_.webp
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 165 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/icon_dialog_u_cp_bg.webp
Normal file
|
After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 718 B |
|
Before Width: | Height: | Size: 17 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/icon_dialog_u_cp_lv.webp
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/icon_dialog_u_master.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 11 KiB |
BIN
BaseModule/src/main/res/mipmap-xhdpi/icon_guild_bg.webp
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 410 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/icon_dialog_u_bg.webp
Normal file
|
After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 11 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/icon_dialog_u_cp_.webp
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 325 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/icon_dialog_u_cp_bg.webp
Normal file
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 35 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/icon_dialog_u_cp_lv.webp
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/icon_dialog_u_master.webp
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 22 KiB |
BIN
BaseModule/src/main/res/mipmap-xxhdpi/icon_guild_bg.webp
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/common_et_clear_icon.webp
Normal file
|
After Width: | Height: | Size: 652 B |
|
Before Width: | Height: | Size: 828 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/firsh_bj.webp
Normal file
|
After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 140 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/home_gg.webp
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 319 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/home_rm.webp
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 489 B |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/home_xx.webp
Normal file
|
After Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 2.7 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/index_close_youth.webp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/index_icon_search.webp
Normal file
|
After Width: | Height: | Size: 540 B |
|
Before Width: | Height: | Size: 32 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/index_img_room_mask.webp
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 18 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/jiaoy_ks.webp
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 11 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/jiks.webp
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 11 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/jxz.webp
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 543 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/ke_bg.webp
Normal file
|
After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 8.7 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/room_xsb.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 936 B |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/xiaox_bq.webp
Normal file
|
After Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 58 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/xlhxd.webp
Normal file
|
After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 21 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/xr_ykj.webp
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 41 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/xr_ykj_xz.webp
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 19 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/za_maiw_b.webp
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 130 KiB |
BIN
BaseModule/src/main/res/mipmap-xxxhdpi/za_maiw_o.webp
Normal file
|
After Width: | Height: | Size: 32 KiB |
@@ -51,6 +51,9 @@ dependencies {
|
||||
implementation libs.activity
|
||||
implementation libs.constraintlayout
|
||||
implementation project(':locktableview')
|
||||
implementation libs.lifecycle.livedata.ktx
|
||||
implementation libs.lifecycle.viewmodel.ktx
|
||||
implementation libs.androidx.fragment.ktx
|
||||
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
@@ -68,5 +71,6 @@ dependencies {
|
||||
api project(':tuichat')
|
||||
api project(':BaseModule')
|
||||
|
||||
|
||||
}
|
||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
@@ -6,6 +6,12 @@
|
||||
<uses-permission android:name="android.permission.REORDER_TASKS" />
|
||||
|
||||
<application android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".activity.user.activity.RelationshipActivity"
|
||||
android:exported="true" />
|
||||
<activity
|
||||
android:name=".activity.user.activity.BosomFriendActivity"
|
||||
android:exported="true" />
|
||||
<activity
|
||||
android:name=".activity.user.activity.UserPlaylistActivity"
|
||||
android:exported="false" />
|
||||
@@ -195,16 +201,6 @@
|
||||
android:name=".service.CancelNoticeService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<!-- <provider-->
|
||||
<!-- android:name="androidx.core.content.FileProvider"-->
|
||||
<!-- android:authorities="${applicationId}.fileprovider"-->
|
||||
<!-- android:exported="false"-->
|
||||
<!-- android:grantUriPermissions="true">-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
|
||||
<!-- android:resource="@xml/file_paths" />-->
|
||||
<!-- </provider>-->
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -8,6 +8,9 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.databinding.ItemRequestedSongBinding;
|
||||
import com.xscm.moduleutil.bean.SongPlaylist;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
@@ -18,22 +21,15 @@ import java.util.List;
|
||||
/**
|
||||
* 已点歌曲列表适配器
|
||||
*/
|
||||
public class RequestedSongsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
public class RequestedSongsAdapter extends BaseQuickAdapter<SongPlaylist.SongPlaylistBean, BaseViewHolder> {
|
||||
|
||||
// 歌曲状态常量
|
||||
public static final int STATUS_PLAYING = 1; // 正在播放
|
||||
public static final int STATUS_PENDING = 2; // 等待播放
|
||||
public static final int STATUS_TOP = 3; // 置顶
|
||||
|
||||
// 列表项类型
|
||||
private static final int TYPE_NORMAL = 0; // 普通列表项
|
||||
private static final int TYPE_FOOTER = 1; // 底部加载更多项
|
||||
|
||||
private List<SongPlaylist.SongPlaylistBean> songList = new ArrayList<>();
|
||||
private boolean isShowFooter = false; // 是否显示底部加载更多
|
||||
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public RequestedSongsAdapter() {
|
||||
super(R.layout.item_requested_song);
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onPlayClick(SongPlaylist.SongPlaylistBean song, int position);
|
||||
|
||||
@@ -44,166 +40,32 @@ public class RequestedSongsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
// 创建普通列表项视图
|
||||
ItemRequestedSongBinding binding = ItemRequestedSongBinding.inflate(
|
||||
LayoutInflater.from(parent.getContext()), parent, false);
|
||||
return new SongViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof FooterViewHolder) {
|
||||
// 底部加载更多项,不需要处理
|
||||
return;
|
||||
}
|
||||
|
||||
if (holder instanceof SongViewHolder) {
|
||||
// 普通列表项
|
||||
SongViewHolder songHolder = (SongViewHolder) holder;
|
||||
|
||||
// 检查位置是否有效,防止索引越界
|
||||
if (position >= songList.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SongPlaylist.SongPlaylistBean song = songList.get(position);
|
||||
|
||||
// 设置歌曲信息
|
||||
songHolder.binding.tvSongName.setText(song.getSong_name());
|
||||
ImageUtils.loadHead(song.getBase_image(), songHolder.binding.ivSongCover);
|
||||
songHolder.binding.tvSinger.setText("演唱者:" + song.getSinger_nickname());
|
||||
songHolder.binding.tvRequestBos.setText("老板:" + song.getBoss_nickname());
|
||||
|
||||
protected void convert(@NonNull BaseViewHolder helper, SongPlaylist.SongPlaylistBean item) {
|
||||
helper.setText(R.id.tv_song_name, item.getSong_name());
|
||||
helper.setText(R.id.tv_singer, "演唱者:" + item.getSinger_nickname());
|
||||
helper.setText(R.id.tv_request_bos, "老板:" + item.getBoss_nickname());
|
||||
ImageUtils.loadHead(item.getBase_image(), helper.getView(R.id.iv_song_cover));
|
||||
// 根据位置显示不同的UI
|
||||
if (position == 0) {
|
||||
if (helper.getLayoutPosition() == 0) {
|
||||
// 第一个是正在播放
|
||||
songHolder.binding.tvRequestStatus.setText("正在播放");
|
||||
songHolder.binding.tvRequestStatus.setTextColor(0xFF3ABC6D);
|
||||
songHolder.binding.tvRequestStatus.setBackgroundColor(android.graphics.Color.TRANSPARENT);
|
||||
helper.setText(R.id.tv_request_status, "正在播放");
|
||||
helper.setTextColor(R.id.tv_request_status, 0xFF3ABC6D);
|
||||
helper.setBackgroundRes(R.id.tv_request_status, android.graphics.Color.TRANSPARENT);
|
||||
} else {
|
||||
// 第三个以后都是置顶,文字是白色的
|
||||
songHolder.binding.tvRequestStatus.setText("置顶");
|
||||
songHolder.binding.tvRequestStatus.setTextColor(0xFFFFFFFF);
|
||||
songHolder.binding.tvRequestStatus.setBackgroundResource(com.xscm.moduleutil.R.drawable.bg_r34_3abc6d);
|
||||
helper.setText(R.id.tv_request_status, "置顶");
|
||||
helper.setTextColor(R.id.tv_request_status, 0xFFFFFFFF);
|
||||
helper.setBackgroundRes(R.id.tv_request_status, com.xscm.moduleutil.R.drawable.bg_r34_3abc6d);
|
||||
}
|
||||
|
||||
|
||||
// 设置tvRequestStatus的点击事件,只有置顶状态才能点击
|
||||
songHolder.binding.tvRequestStatus.setOnClickListener(v -> {
|
||||
helper.getView(R.id.tv_request_status).setOnClickListener(v -> {
|
||||
// 只有第三个及以后的项目(position > 1)才能点击tvRequestStatus
|
||||
if (position > 1 && onItemClickListener != null) {
|
||||
onItemClickListener.onTopClick(song, position);
|
||||
if (helper.getLayoutPosition() > 1 && onItemClickListener != null) {
|
||||
onItemClickListener.onTopClick(item, helper.getLayoutPosition());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// 如果是最后一项且需要显示底部加载更多,则返回底部类型
|
||||
if (position == songList.size() && isShowFooter) {
|
||||
return TYPE_FOOTER;
|
||||
}
|
||||
return TYPE_NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
// 如果需要显示底部加载更多,则数量加1
|
||||
return songList.size() + (isShowFooter ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据歌曲对象获取状态
|
||||
*/
|
||||
private int getStatusFromSong(SongPlaylist.SongPlaylistBean song) {
|
||||
// 根据业务逻辑判断状态,这里仅作为示例
|
||||
if ("1".equals(song.getStatus())) {
|
||||
return STATUS_PLAYING;
|
||||
} else if ("0".equals(song.getStatus())) {
|
||||
return STATUS_TOP;
|
||||
} else {
|
||||
return STATUS_PENDING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置歌曲列表
|
||||
*/
|
||||
public void setSongList(List<SongPlaylist.SongPlaylistBean> list) {
|
||||
if (list != null) {
|
||||
this.songList.clear();
|
||||
this.songList.addAll(list);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加歌曲列表(用于加载更多)
|
||||
*/
|
||||
public void addSongList(List<SongPlaylist.SongPlaylistBean> list) {
|
||||
if (list != null) {
|
||||
int startPos = this.songList.size();
|
||||
this.songList.addAll(list);
|
||||
notifyItemRangeInserted(startPos, list.size());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示或隐藏底部加载更多
|
||||
*/
|
||||
public void setShowFooter(boolean showFooter) {
|
||||
boolean wasShowing = this.isShowFooter;
|
||||
this.isShowFooter = showFooter;
|
||||
|
||||
if (wasShowing != showFooter) {
|
||||
if (showFooter) {
|
||||
notifyItemInserted(songList.size());
|
||||
} else {
|
||||
notifyItemRemoved(songList.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空列表
|
||||
*/
|
||||
public void clear() {
|
||||
this.songList.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定位置的歌曲
|
||||
*/
|
||||
public SongPlaylist.SongPlaylistBean getItem(int position) {
|
||||
if (position >= 0 && position < songList.size()) {
|
||||
return songList.get(position);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通列表项ViewHolder
|
||||
*/
|
||||
static class SongViewHolder extends RecyclerView.ViewHolder {
|
||||
ItemRequestedSongBinding binding;
|
||||
|
||||
public SongViewHolder(@NonNull ItemRequestedSongBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 底部加载更多ViewHolder
|
||||
*/
|
||||
static class FooterViewHolder extends RecyclerView.ViewHolder {
|
||||
public FooterViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ public class RelationshipFragment extends BaseMvpDialogFragment<RoomUserPresente
|
||||
adapter = new RelationshipAdapter();
|
||||
mBinding.rvHostList.setAdapter(adapter);
|
||||
adapter.setOnItemClickListener((RelationshipAdapter.OnItemClickListener) (view, data, position) -> {
|
||||
if (view.getId() == R.id.im_zhid) {
|
||||
if (view.getId() == R.id.icon_cp_zd) {
|
||||
queren(1, data.getId(), "");
|
||||
} else if (view.getId() == R.id.im_shanchu) {
|
||||
} else if (view.getId() == R.id.icon_cp_dele) {
|
||||
queren(2, data.getId(), data.getDelete_me_coin());
|
||||
}
|
||||
});
|
||||
|
||||