This commit is contained in:
zlzw 2022-11-08 13:17:35 +08:00
parent a66a32038c
commit 34dd3ca883
3 changed files with 35 additions and 2 deletions

View File

@ -93,6 +93,7 @@
<string name="edit_profile_right_date">請選擇正確的日期</string> <string name="edit_profile_right_date">請選擇正確的日期</string>
<string name="edit_nick_name_price_msg">溫馨提示可以免費修改昵稱一次之後修改需要鑽石1800一次</string> <string name="edit_nick_name_price_msg">溫馨提示可以免費修改昵稱一次之後修改需要鑽石1800一次</string>
<string name="follow">關注</string> <string name="follow">關注</string>
<string name="unfollow"> 主播哪裡做的不好~\n哥哥確定要取消關注嗎?</string>
<string name="following">已關注</string> <string name="following">已關注</string>
<string name="follow_my_follow">我的關注</string> <string name="follow_my_follow">我的關注</string>
<string name="my_black">我的黑名單</string> <string name="my_black">我的黑名單</string>

View File

@ -47,6 +47,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveReportActivity; import com.yunbao.live.activity.LiveReportActivity;
import com.yunbao.live.bean.GuardUserBean;
import com.yunbao.live.bean.ImpressBean; import com.yunbao.live.bean.ImpressBean;
import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveBean;
import com.yunbao.live.custom.MyTextView; import com.yunbao.live.custom.MyTextView;
@ -62,6 +63,7 @@ import org.greenrobot.eventbus.EventBus;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import io.rong.imlib.IRongCoreCallback; import io.rong.imlib.IRongCoreCallback;
@ -94,6 +96,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private String mToUid; private String mToUid;
private String mStream; private String mStream;
private int mType; private int mType;
private int guardNumber;
private TextView mFollowText; private TextView mFollowText;
private TextView mName; private TextView mName;
private TextView mID; private TextView mID;
@ -104,6 +107,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private TextView mSignDesc; private TextView mSignDesc;
private TextView mNobleVal; private TextView mNobleVal;
private TextView mReport; private TextView mReport;
private TextView mGuard;
private ImageView mFollowImage; private ImageView mFollowImage;
private ImageView mSex; private ImageView mSex;
private ImageView good_nub_ico; private ImageView good_nub_ico;
@ -113,6 +117,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private ImageView mAvatar; private ImageView mAvatar;
private ImageView shawl; private ImageView shawl;
private UserBean mUserBean; private UserBean mUserBean;
private LinearLayout mGuardLayout;
private boolean mFollowing; private boolean mFollowing;
GifImageView btn_live; GifImageView btn_live;
SVGAImageView gift_svga; SVGAImageView gift_svga;
@ -162,6 +167,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
getType(); getType();
initView(); initView();
initListener(); initListener();
initGuardList();
LayoutInflater inflater = LayoutInflater.from(mContext); LayoutInflater inflater = LayoutInflater.from(mContext);
View bottomView = null; View bottomView = null;
if (mType == TYPE_AUD_ANC) { if (mType == TYPE_AUD_ANC) {
@ -213,6 +219,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
mNobleVal = mRootView.findViewById(R.id.noble_val); mNobleVal = mRootView.findViewById(R.id.noble_val);
shawl = (ImageView) mRootView.findViewById(R.id.shawl); shawl = (ImageView) mRootView.findViewById(R.id.shawl);
mReport = mRootView.findViewById(R.id.btn_report); mReport = mRootView.findViewById(R.id.btn_report);
mGuardLayout = mRootView.findViewById(R.id.btn_guard);
mGuard = mRootView.findViewById(R.id.guard_val);
} }
private void initListener() { private void initListener() {
@ -224,6 +232,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}); });
mAvatar.setOnClickListener(this); mAvatar.setOnClickListener(this);
mReport.setOnClickListener(this); mReport.setOnClickListener(this);
mGuardLayout.setOnClickListener(this);
} }
private void loadData() { private void loadData() {
@ -259,7 +268,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} }
private void showData(String data) { private void showData(String data) {
ToastUtil.show(mLiveUid+"="+mToUid);
Log.i(TAG, "showData: " + data); Log.i(TAG, "showData: " + data);
JSONObject obj = JSON.parseObject(data); JSONObject obj = JSON.parseObject(data);
mUserBean = JSON.toJavaObject(obj, UserBean.class); mUserBean = JSON.toJavaObject(obj, UserBean.class);
@ -268,6 +276,9 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else { } else {
btn_live.setVisibility(View.GONE); btn_live.setVisibility(View.GONE);
} }
if (mLiveUid.equals(mToUid)) {
mGuardLayout.setVisibility(View.VISIBLE);
}
mName.setText(obj.getString("user_nicename")); mName.setText(obj.getString("user_nicename"));
if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) {
good_nub_ico.setVisibility(View.VISIBLE); good_nub_ico.setVisibility(View.VISIBLE);
@ -305,6 +316,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else { } else {
mNoble.setVisibility(View.INVISIBLE); mNoble.setVisibility(View.INVISIBLE);
} }
mGuard.setText(String.format(mGuard.getText().toString(), guardNumber));
mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans()); mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans());
mSignDesc.setText(mUserBean.getSignature()); mSignDesc.setText(mUserBean.getSignature());
mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id()))); mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id())));
@ -370,6 +382,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 关注 * 关注
*/ */
private void setAttention() { private void setAttention() {
if(mFollowing) {
//DialogUitl.showSimpleDialog(mContext,WordUtil.getString(R.string.unfollow));
return;
}
attention();
}
private void attention(){
CommonHttpUtil.setAttention(mToUid, new CommonCallback<Integer>() { CommonHttpUtil.setAttention(mToUid, new CommonCallback<Integer>() {
@Override @Override
@ -400,6 +419,18 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
LiveReportActivity.forward(mContext, mToUid); LiveReportActivity.forward(mContext, mToUid);
} }
private void initGuardList() {
LiveHttpUtil.getGuardList(mLiveUid, 1, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
List<GuardUserBean> list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class);
if (list != null) {
guardNumber = list.size();
}
}
});
}
@Override @Override
public void onClick(View v) { public void onClick(View v) {
int i = v.getId(); int i = v.getId();

View File

@ -34,11 +34,12 @@
android:background="@drawable/bg_user_card_guard" android:background="@drawable/bg_user_card_guard"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="visible" android:visibility="invisible"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<TextView <TextView
android:id="@+id/guard_val"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="1dp" android:layout_marginStart="1dp"