From 34dd3ca8835bac066c9b4ad32b847b629eac4749 Mon Sep 17 00:00:00 2001
From: zlzw <583819556@qq.com>
Date: Tue, 8 Nov 2022 13:17:35 +0800
Subject: [PATCH] update
---
common/src/main/res/values/strings.xml | 1 +
.../live/dialog/LiveUserDialogFragment.java | 33 ++++++++++++++++++-
.../main/res/layout/dialog_new_live_user.xml | 3 +-
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index 413db6e14..9816117cc 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -93,6 +93,7 @@
請選擇正確的日期
溫馨提示:可以免費修改昵稱一次,之後修改需要鑽石1800一次
關注
+ 主播哪裡做的不好~\n哥哥確定要取消關注嗎?
已關注
我的關注
我的黑名單
diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
index 9224bd156..bccc68faa 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java
@@ -47,6 +47,7 @@ import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.activity.LiveReportActivity;
+import com.yunbao.live.bean.GuardUserBean;
import com.yunbao.live.bean.ImpressBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.live.custom.MyTextView;
@@ -62,6 +63,7 @@ import org.greenrobot.eventbus.EventBus;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import io.rong.imlib.IRongCoreCallback;
@@ -94,6 +96,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private String mToUid;
private String mStream;
private int mType;
+ private int guardNumber;
private TextView mFollowText;
private TextView mName;
private TextView mID;
@@ -104,6 +107,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private TextView mSignDesc;
private TextView mNobleVal;
private TextView mReport;
+ private TextView mGuard;
private ImageView mFollowImage;
private ImageView mSex;
private ImageView good_nub_ico;
@@ -113,6 +117,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private ImageView mAvatar;
private ImageView shawl;
private UserBean mUserBean;
+ private LinearLayout mGuardLayout;
private boolean mFollowing;
GifImageView btn_live;
SVGAImageView gift_svga;
@@ -162,6 +167,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
getType();
initView();
initListener();
+ initGuardList();
LayoutInflater inflater = LayoutInflater.from(mContext);
View bottomView = null;
if (mType == TYPE_AUD_ANC) {
@@ -213,6 +219,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
mNobleVal = mRootView.findViewById(R.id.noble_val);
shawl = (ImageView) mRootView.findViewById(R.id.shawl);
mReport = mRootView.findViewById(R.id.btn_report);
+ mGuardLayout = mRootView.findViewById(R.id.btn_guard);
+ mGuard = mRootView.findViewById(R.id.guard_val);
}
private void initListener() {
@@ -224,6 +232,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
});
mAvatar.setOnClickListener(this);
mReport.setOnClickListener(this);
+ mGuardLayout.setOnClickListener(this);
}
private void loadData() {
@@ -259,7 +268,6 @@ 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);
@@ -268,6 +276,9 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else {
btn_live.setVisibility(View.GONE);
}
+ if (mLiveUid.equals(mToUid)) {
+ mGuardLayout.setVisibility(View.VISIBLE);
+ }
mName.setText(obj.getString("user_nicename"));
if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) {
good_nub_ico.setVisibility(View.VISIBLE);
@@ -305,6 +316,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else {
mNoble.setVisibility(View.INVISIBLE);
}
+ mGuard.setText(String.format(mGuard.getText().toString(), guardNumber));
mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans());
mSignDesc.setText(mUserBean.getSignature());
mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id())));
@@ -370,6 +382,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 关注
*/
private void setAttention() {
+ if(mFollowing) {
+ //DialogUitl.showSimpleDialog(mContext,WordUtil.getString(R.string.unfollow));
+ return;
+ }
+ attention();
+ }
+ private void attention(){
CommonHttpUtil.setAttention(mToUid, new CommonCallback() {
@Override
@@ -400,6 +419,18 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
LiveReportActivity.forward(mContext, mToUid);
}
+ private void initGuardList() {
+ LiveHttpUtil.getGuardList(mLiveUid, 1, new HttpCallback() {
+ @Override
+ public void onSuccess(int code, String msg, String[] info) {
+ List list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class);
+ if (list != null) {
+ guardNumber = list.size();
+ }
+ }
+ });
+ }
+
@Override
public void onClick(View v) {
int i = v.getId();
diff --git a/live/src/main/res/layout/dialog_new_live_user.xml b/live/src/main/res/layout/dialog_new_live_user.xml
index 0f8d3fa1a..7dbc7d359 100644
--- a/live/src/main/res/layout/dialog_new_live_user.xml
+++ b/live/src/main/res/layout/dialog_new_live_user.xml
@@ -34,11 +34,12 @@
android:background="@drawable/bg_user_card_guard"
android:gravity="center"
android:orientation="horizontal"
- android:visibility="visible"
+ android:visibility="invisible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">