This commit is contained in:
zlzw 2022-11-08 11:38:20 +08:00
parent 40532a0972
commit a66a32038c
4 changed files with 83 additions and 9 deletions

View File

@ -32,6 +32,6 @@ public class NobleUtil {
case 6:return "皇帝";
case 7:return "超皇";
}
return "";
return "未开通";
}
}

View File

@ -1,6 +1,7 @@
package com.yunbao.live.dialog;
import android.app.Dialog;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@ -102,6 +103,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private TextView mPraise;
private TextView mSignDesc;
private TextView mNobleVal;
private TextView mReport;
private ImageView mFollowImage;
private ImageView mSex;
private ImageView good_nub_ico;
@ -109,7 +111,9 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private ImageView mLiveIcon2;
private ImageView mNoble;
private ImageView mAvatar;
private ImageView shawl;
private UserBean mUserBean;
private boolean mFollowing;
GifImageView btn_live;
SVGAImageView gift_svga;
@ -165,7 +169,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else if (mType == TYPE_AUD_AUD) {
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false);
} else if (mType == TYPE_ANC_AUD) {
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_2, mBottomContainer, false);
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false);
} else if (mType == TYPE_AUD_SELF) {
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_3, mBottomContainer, false);
}
@ -207,6 +211,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
mSignDesc = mRootView.findViewById(R.id.sign);
mAvatar = mRootView.findViewById(R.id.avatar);
mNobleVal = mRootView.findViewById(R.id.noble_val);
shawl = (ImageView) mRootView.findViewById(R.id.shawl);
mReport = mRootView.findViewById(R.id.btn_report);
}
private void initListener() {
@ -216,6 +222,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
// gotoLive(mToUid);
}
});
mAvatar.setOnClickListener(this);
mReport.setOnClickListener(this);
}
private void loadData() {
@ -251,6 +259,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}
private void showData(String data) {
ToastUtil.show(mLiveUid+"="+mToUid);
Log.i(TAG, "showData: " + data);
JSONObject obj = JSON.parseObject(data);
mUserBean = JSON.toJavaObject(obj, UserBean.class);
@ -300,10 +309,15 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
mSignDesc.setText(mUserBean.getSignature());
mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id())));
ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar);
mFollowing = obj.getIntValue("isattention") == 1;
updateFollow();
//装扮相关
JSONObject dress = obj.getJSONObject("dress");
if (dress.getJSONArray("wraps").size() >= 1) {
JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0);
ImgLoader.display(mContext, display.getString("display_src"), shawl);
}
if (dress.getJSONArray("avatar_frame").size() == 1) {
JSONObject ico = (JSONObject) dress.getJSONArray("avatar_frame").get(0);
if (ico.getString("effect_src") != null) {
if (ico.getString("effect_src").contains("svga")) {
@ -334,9 +348,69 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}
private void updateFollow() {
if (mFollowText != null) {
mFollowText.setText(mFollowing ? R.string.following : R.string.follow);
if (mFollowing) {
mFollowText.setTextColor(Color.parseColor("#B1B1B1"));
} else {
mFollowText.setTextColor(Color.parseColor("#FA6400"));
}
}
if (mFollowImage != null) {
if (mFollowing) {
mFollowImage.setVisibility(View.GONE);
} else {
mFollowImage.setVisibility(View.VISIBLE);
}
}
}
/**
* 关注
*/
private void setAttention() {
CommonHttpUtil.setAttention(mToUid, new CommonCallback<Integer>() {
@Override
public void callback(Integer isAttention) {
mFollowing = isAttention == 1;
updateFollow();
if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播
((LiveActivity) mContext).sendSystemMessage(
CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
}
}
});
}
/**
* 跳转到个人主页
*/
private void forwardHomePage() {
dismiss();
Constants.mStream = mStream;
RouteUtil.forwardUserHome(mContext, mToUid, true, mLiveUid, 0);
}
/**
* 举报
*/
private void report() {
LiveReportActivity.forward(mContext, mToUid);
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.btn_follow) {
setAttention();
} else if (i == R.id.btn_home_page) {
forwardHomePage();
} else if (i == R.id.btn_report) {
report();
} else if (i == R.id.avatar) {
forwardHomePage();
}
}
}

View File

@ -2411,7 +2411,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
*/
public void showUserDialog(String toUid) {
if (!TextUtils.isEmpty(mLiveUid) && !TextUtils.isEmpty(toUid)) {
LiveOldUserDialogFragment fragment = new LiveOldUserDialogFragment();
LiveUserDialogFragment fragment = new LiveUserDialogFragment();
Bundle bundle = new Bundle();
bundle.putString(Constants.LIVE_UID, mLiveUid);
bundle.putString(Constants.STREAM, mStream);

View File

@ -8,7 +8,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="43dp"
android:layout_marginTop="52dp"
android:background="@drawable/bg_live_user">