1:添加在房间点击用户头像,展示有师傅的头像,并且添加点击事件

2:点击用户头像,进入用户主页的时候,展示师傅的头像
This commit is contained in:
2025-12-01 10:29:34 +08:00
parent fd9af6a253
commit 9183342636
13 changed files with 70 additions and 13 deletions

View File

@@ -161,7 +161,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
//设置mqtt环境 false 测试环境 true 正式环境 //设置mqtt环境 false 测试环境 true 正式环境
// ExternalResConstants.INSTANCE.setIS_MQTT_RELEASE(false); // ExternalResConstants.INSTANCE.setIS_MQTT_RELEASE(false);
//设置http环境 false 测试环境 true 正式环境 //设置http环境 false 测试环境 true 正式环境
ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(true); ExternalResConstants.INSTANCE.setIS_HTTP_RELEASE(false);
currentEnvironment = ExternalResConstants.INSTANCE.HTTP_PATH(); currentEnvironment = ExternalResConstants.INSTANCE.HTTP_PATH();
initialization(); initialization();

View File

@@ -50,6 +50,8 @@ class MyFamilyBean {
var sign_user_ratio : Int = 0 //非首签签约比例 var sign_user_ratio : Int = 0 //非首签签约比例
var end_day: String = "" //签约剩余时长 var end_day: String = "" //签约剩余时长
val free_re_sign_day : Int=0 //免费续签时长
} }
/* "group_id": "string", /* "group_id": "string",

View File

@@ -89,6 +89,15 @@ public class UserInfo extends BaseEvent implements Serializable {
private String sign_value; private String sign_value;
private String sign_id; private String sign_id;
private Master master;
@Data
public static class Master implements Serializable {
private String user_id;
private String nickname;
private String avatar;
}
/*"cp_info": { /*"cp_info": {
"name": "string", "name": "string",
"user_id1": "string", "user_id1": "string",

View File

@@ -2567,8 +2567,7 @@ public class RetrofitClient {
}); });
} }
public void getRoomUserInfo(String room_id, String public void getRoomUserInfo(String room_id, String user_id, BaseObserver<UserInfo> observer) {
user_id, BaseObserver<UserInfo> observer) {
sApiServer.getRoomUserInfo(room_id, user_id).enqueue(new Callback<BaseModel<UserInfo>>() { sApiServer.getRoomUserInfo(room_id, user_id).enqueue(new Callback<BaseModel<UserInfo>>() {
@Override @Override
public void onResponse(Call<BaseModel<UserInfo>> call, Response<BaseModel<UserInfo>> response) { public void onResponse(Call<BaseModel<UserInfo>> call, Response<BaseModel<UserInfo>> response) {

View File

@@ -23,6 +23,7 @@ public class MeHeadView extends ConstraintLayout {
private ImageView mIvSex; private ImageView mIvSex;
private ImageView mIvOnline; private ImageView mIvOnline;
private ImageView iv_frame_bg; private ImageView iv_frame_bg;
private ImageView iv_master_bg;
public MeHeadView(Context context) { public MeHeadView(Context context) {
this(context, null, 0); this(context, null, 0);
@@ -44,6 +45,7 @@ public class MeHeadView extends ConstraintLayout {
mIvSex = findViewById(R.id.iv_sex); mIvSex = findViewById(R.id.iv_sex);
mIvOnline = findViewById(R.id.iv_online); mIvOnline = findViewById(R.id.iv_online);
iv_frame_bg = findViewById(R.id.iv_frame_bg); iv_frame_bg = findViewById(R.id.iv_frame_bg);
iv_master_bg = findViewById(R.id.iv_master_bg);
mIvSex.setVisibility(GONE); mIvSex.setVisibility(GONE);
} }
@@ -68,6 +70,15 @@ public class MeHeadView extends ConstraintLayout {
} }
public void setMaster(String headPicture) {
if (!TextUtils.isEmpty(headPicture)) {
ImageUtils.loadHead(headPicture, mRiv);
}
iv_master_bg.setVisibility(VISIBLE);
iv_master_bg.setImageResource(R.mipmap.icon_master);
}
public void setOnline(boolean isOnline) { public void setOnline(boolean isOnline) {
mIvOnline.setVisibility(VISIBLE); mIvOnline.setVisibility(VISIBLE);
mIvOnline.setImageResource(isOnline ? R.mipmap.me_online_icon : R.mipmap.me_icon_unchecked); mIvOnline.setImageResource(isOnline ? R.mipmap.me_online_icon : R.mipmap.me_icon_unchecked);

View File

@@ -65,6 +65,18 @@
tools:src="@mipmap/me_sj" tools:src="@mipmap/me_sj"
android:visibility="gone"/> android:visibility="gone"/>
<ImageView
android:id="@+id/iv_master_bg"
android:layout_width="match_parent"
android:layout_height="0dp"
android:contentDescription="@null"
android:scaleType="fitCenter"
app:layout_constraintHeight_default="spread"
app:layout_constraintTop_toTopOf="@+id/guideline"
app:layout_constraintWidth_default="spread"
tools:src="@mipmap/icon_master"
android:visibility="gone"/>
<ImageView <ImageView
android:id="@+id/iv_online" android:id="@+id/iv_online"
android:layout_width="@dimen/dp_13" android:layout_width="@dimen/dp_13"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -163,7 +163,7 @@ class MyFamilyFragment(var data: MyFamilyBean) : BaseFragment<FragmentMyFamilyBi
if (item.free_renewal > 0) { if (item.free_renewal > 0) {
queren1( queren1(
1, 1,
onMessage(1, item.nickname, item.free_renewal, null, null, null), onMessage(1, item.nickname, item.free_renewal, item.free_re_sign_day, null, null),
item.user_id.toString() item.user_id.toString()
) )
} else { } else {
@@ -194,15 +194,15 @@ class MyFamilyFragment(var data: MyFamilyBean) : BaseFragment<FragmentMyFamilyBi
type: Int,//类型 1免费续约 2续签 花金币 type: Int,//类型 1免费续约 2续签 花金币
userName: String? = null, //当前徒弟的名称 userName: String? = null, //当前徒弟的名称
remainingCount: Int? = 0, //当前免费续签次数 remainingCount: Int? = 0, //当前免费续签次数
percentage: Int? = null, //身价的百分比,是按照这个进行扣款的 percentage: Int? = null, //当type==1的时候这个值是合约延续的时间type=2的时候身价的百分比,是按照这个进行扣款的
days: Int? = null,// 花钱后最总的时长 days: Int? = null,// 花钱后最总的时长
userValue: Int? = null //当前徒弟的身价 userValue: Int? = null //当前徒弟的身价
): SpannableString { ): SpannableString {
return when (type) { return when (type) {
1 -> SpannableString("尊敬的用户:\n 您的徒弟【${userName ?: "?"}】当前为首次签约的免费签约期。续约后,师徒合约将延续7天,您剩余的免费续约次数:${remainingCount ?: "?"}") 1 -> SpannableString("尊敬的用户:\n 您的徒弟【${userName ?: "?"}】当前为首次签约的免费签约期。续约后,师徒合约将延续${percentage}天,您剩余的免费续约次数:${remainingCount ?: "?"}")
2 -> { 2 -> {
// 计算预估金币数,向上取整 // 计算预估金币数,向上取整
val actualUserValue = userValue ?: 1000 // 如果未提供用户身价默认使用1000 val actualUserValue = userValue ?: 10 // 如果未提供用户身价默认使用1000
val percentageValue = percentage ?: 10 val percentageValue = percentage ?: 10
val estimatedCoins = val estimatedCoins =
kotlin.math.ceil(actualUserValue * percentageValue / 100.0).toInt() kotlin.math.ceil(actualUserValue * percentageValue / 100.0).toInt()

View File

@@ -20,6 +20,7 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.fragment.app.FragmentStatePagerAdapter;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.ActivityUtils; import com.blankj.utilcode.util.ActivityUtils;
import com.google.android.flexbox.FlexboxLayout; import com.google.android.flexbox.FlexboxLayout;
import com.tencent.imsdk.v2.V2TIMConversation; import com.tencent.imsdk.v2.V2TIMConversation;
@@ -42,6 +43,7 @@ import com.xscm.moduleutil.bean.RelationshipBean;
import com.xscm.moduleutil.bean.UserInfo; import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.bean.UserTagBean; import com.xscm.moduleutil.bean.UserTagBean;
import com.xscm.moduleutil.color.ThemeableDrawableUtils; import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.ColorManager; import com.xscm.moduleutil.utils.ColorManager;
import com.xscm.moduleutil.utils.ImageUtils; import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.utils.SpUtil; import com.xscm.moduleutil.utils.SpUtil;
@@ -168,6 +170,13 @@ public class UserHomepageFragment extends BaseMvpFragment<UserHomepagePresenter,
mBinding.headerInfo.imBeautiful.setVisibility(View.GONE); mBinding.headerInfo.imBeautiful.setVisibility(View.GONE);
} }
if(userInfo.getMaster()!=null){
mBinding.headerInfo.ivRightAvatar.setVisibility(VISIBLE);
mBinding.headerInfo.ivRightAvatar.setMaster(userInfo.getMaster().getAvatar());
}else {
mBinding.headerInfo.ivRightAvatar.setVisibility(GONE);
}
if (!userInfo.getIcon().isEmpty()){ if (!userInfo.getIcon().isEmpty()){
mBinding.headerInfo.flexEntry.setVisibility(VISIBLE); mBinding.headerInfo.flexEntry.setVisibility(VISIBLE);
@@ -217,6 +226,7 @@ public class UserHomepageFragment extends BaseMvpFragment<UserHomepagePresenter,
mBinding.headerInfo.tvGz.setOnClickListener(this::onClick); mBinding.headerInfo.tvGz.setOnClickListener(this::onClick);
mBinding.headerInfo.tvGsSx.setOnClickListener(this::onClick); mBinding.headerInfo.tvGsSx.setOnClickListener(this::onClick);
mBinding.headerInfo.ivRightAvatar.setOnClickListener(this::onClick);
refreshView(); refreshView();
if (userInfo.getGuild() == null || userInfo.getGuild().isEmpty()) { if (userInfo.getGuild() == null || userInfo.getGuild().isEmpty()) {
mBinding.headerInfo.ctlGuild.setVisibility(View.GONE); mBinding.headerInfo.ctlGuild.setVisibility(View.GONE);
@@ -366,6 +376,8 @@ public class UserHomepageFragment extends BaseMvpFragment<UserHomepagePresenter,
Intent intent=new Intent(getContext(), GiftWallActivity.class); Intent intent=new Intent(getContext(), GiftWallActivity.class);
intent.putExtra("userId",userInfo.getUser_id()); intent.putExtra("userId",userInfo.getUser_id());
startActivity(intent); startActivity(intent);
}else if (view.getId()==R.id.iv_right_avatar){
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId",userInfo.getMaster().getUser_id()).navigation();
} }
} }

View File

@@ -180,11 +180,11 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
mBinding.textView2.setOnClickListener(this::onClick); mBinding.textView2.setOnClickListener(this::onClick);
mBinding.moreButton.setOnClickListener(this::onClick); mBinding.moreButton.setOnClickListener(this::onClick);
mBinding.imQml.setOnClickListener(this::onClick); mBinding.imQml.setOnClickListener(this::onClick);
mBinding.ivRightAvatar.setOnClickListener(this::onClick);
// ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.roomMCz, ColorManager.getInstance().getPrimaryColorInt(), 65); // ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.roomMCz, ColorManager.getInstance().getPrimaryColorInt(), 65);
// mBinding.roomMCz.setTextColor(ColorManager.getInstance().getButtonColorInt()); // mBinding.roomMCz.setTextColor(ColorManager.getInstance().getButtonColorInt());
mBinding.moreButton.setTextColor(ColorManager.getInstance().getPrimaryColorInt()); mBinding.moreButton.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
} }
@@ -275,6 +275,11 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
MvpPre.clearUserCharm(room_id, user_id); MvpPre.clearUserCharm(room_id, user_id);
} else if (id == R.id.im_gs) { } else if (id == R.id.im_gs) {
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), room_id, "", null); RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), room_id, "", null);
}else if (id == R.id.iv_right_avatar){
if(userInfo.getMaster()!=null && userInfo.getMaster().getUser_id()!=null) {
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", userInfo.getMaster().getUser_id() + "").navigation();
dismiss();
}
} }
} }
@@ -463,6 +468,13 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
mBinding.tvName.setShineType(0); mBinding.tvName.setShineType(0);
} }
if(userInfo.getMaster()!=null){
mBinding.ivRightAvatar.setVisibility(VISIBLE);
mBinding.ivRightAvatar.setMaster(userInfo.getMaster().getAvatar());
}else {
mBinding.ivRightAvatar.setVisibility(GONE);
}
// mBinding.tvName.setTextColor( (userInfo.getNickname_color()!=null && !userInfo.getNickname_color().equals(""))? Color.parseColor(userInfo.getNickname_color()):Color.parseColor("#333333")); // mBinding.tvName.setTextColor( (userInfo.getNickname_color()!=null && !userInfo.getNickname_color().equals(""))? Color.parseColor(userInfo.getNickname_color()):Color.parseColor("#333333"));
// mBinding.tvId.setText("ID:" + userInfo.getUser_code()); // mBinding.tvId.setText("ID:" + userInfo.getUser_code());
if (userInfo.getIs_in_pit() == 1) { if (userInfo.getIs_in_pit() == 1) {

View File

@@ -35,7 +35,7 @@
android:id="@+id/iv_right_avatar" android:id="@+id/iv_right_avatar"
android:layout_width="@dimen/dp_44" android:layout_width="@dimen/dp_44"
android:layout_height="@dimen/dp_44" android:layout_height="@dimen/dp_44"
android:layout_marginStart="-15dp" android:layout_marginStart="-6dp"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toEndOf="@+id/iv_avatar" app:layout_constraintStart_toEndOf="@+id/iv_avatar"
app:layout_constraintTop_toTopOf="@+id/iv_avatar" /> app:layout_constraintTop_toTopOf="@+id/iv_avatar" />