Merge branch 'dev_userCard'

# Conflicts:
#	main/src/main/java/com/yunbao/main/activity/MainActivity.java
This commit is contained in:
zlzw 2022-11-09 11:01:45 +08:00
commit 1fc417ec25
29 changed files with 1832 additions and 628 deletions

View File

@ -5,6 +5,7 @@ import android.os.Parcelable;
import android.text.TextUtils;
import com.alibaba.fastjson.annotation.JSONField;
import com.google.gson.annotations.SerializedName;
/**
* Created by cxf on 2017/8/14.
@ -56,6 +57,8 @@ public class UserBean implements Parcelable {
private String mobile;
private String front_task;
private String is_admin;
@SerializedName("user_love_num")
private int praise;
//是否隐藏
private boolean isHide = false;
@ -363,6 +366,14 @@ public class UserBean implements Parcelable {
return level;
}
public int getPraise() {
return praise;
}
public void setPraise(int praise) {
this.praise = praise;
}
public void setLevel(int level) {
this.level = level;
}

View File

@ -11,5 +11,8 @@ public class CommonIconUtil {
public static int getSexIcon(int key) {
return key == 1 ? R.mipmap.icon_sex_male_1 : R.mipmap.icon_sex_female_1;
}
public static int getSexIconForUserCard(int key) {
return key == 1 ? R.mipmap.user_card_man : R.mipmap.user_card_woman;
}
}

View File

@ -19,6 +19,8 @@ import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.LayoutRes;
import com.yunbao.common.R;
import java.util.ArrayList;
@ -320,6 +322,7 @@ public class DialogUitl {
private int mLength;
private SimpleCallback mClickCallback;
private SimpleCallback3 mClickCallback3;
private int mView = 0;
public Builder(Context context) {
mContext = context;
@ -385,9 +388,18 @@ public class DialogUitl {
return this;
}
public Builder setView(@LayoutRes int layoutRes) {
mView = layoutRes;
return this;
}
public Dialog build() {
final Dialog dialog = new Dialog(mContext, mBackgroundDimEnabled ? R.style.dialog : R.style.dialog2);
if (mView != 0) {
dialog.setContentView(mView);
} else {
dialog.setContentView(mInput ? R.layout.dialog_input : R.layout.dialog_simple);
}
dialog.setCancelable(mCancelable);
dialog.setCanceledOnTouchOutside(mCancelable);
TextView titleView = (TextView) dialog.findViewById(R.id.title);

View File

@ -22,4 +22,16 @@ public class NobleUtil {
}
return -1;
}
public static String nobleIdToStringName(int id){
switch (id){
case 1:return "男爵";
case 2:return "子爵";
case 3:return "侯爵";
case 4:return "公爵";
case 5:return "国王";
case 6:return "皇帝";
case 7:return "超皇";
}
return "未开通";
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="100dp" android:height="36dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffffc621" />
<corners android:radius="21dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog"
android:gravity="center_horizontal"
android:orientation="vertical"
>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:gravity="center_horizontal"
android:text="@string/dialog_tip"
android:textColor="@color/textColor"
android:textSize="15sp"
/>
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:gravity="center_horizontal"
android:textColor="#161616"
android:textSize="14sp"
/>
<LinearLayout
android:layout_width="match_parent"
android:gravity="center"
android:layout_marginBottom="22dp"
android:layout_height="40dp">
<TextView
android:id="@+id/btn_cancel"
android:layout_width="87dp"
android:layout_height="33dp"
android:gravity="center"
android:text="@string/cancel"
android:textColor="#FFC621"
android:layout_marginRight="7dp"
android:textSize="14sp"
android:background="@drawable/bg_dialog_unfollow_cancel"
/>
<TextView
android:id="@+id/btn_confirm"
android:layout_width="87dp"
android:layout_height="33dp"
android:gravity="center"
android:layout_marginLeft="7dp"
android:text="@string/confirm"
android:textColor="#FFFFFF"
android:textSize="14sp"
android:background="@mipmap/tipbox_btn_orange"
/>
</LinearLayout>
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -93,6 +93,9 @@
<string name="edit_profile_right_date">請選擇正確的日期</string>
<string name="edit_nick_name_price_msg">溫馨提示可以免費修改昵稱一次之後修改需要鑽石1800一次</string>
<string name="follow">關注</string>
<string name="unfollow"> 主播哪裡做的不好~\n哥哥確定要取消關注嗎?</string>
<string name="unfollow_confrim">繼續關注</string>
<string name="unfollow_cancel">不再關注</string>
<string name="following">已關注</string>
<string name="follow_my_follow">我的關注</string>
<string name="my_black">我的黑名單</string>
@ -702,6 +705,9 @@
<string name="chat_charge_pay">立即支付</string>
<string name="live_user_level">使用者等級</string>
<string name="live_user_level_anchor">主播等級</string>
<string name="live_user_card_level">用户等級</string>
<string name="live_noble_level_anchor">貴族等級</string>
<string name="live_honor_number_anchor">榮譽墻</string>
<string name="live_anchor_error">連接已斷開,請重新開播</string>
<string name="search_no_data_2">空空如也</string>
<string name="chat">聊天</string>
@ -947,4 +953,5 @@
<string name="chat_chat">聊聊天</string>
<string name="want_pre">想在其他APP上方也顯示小窗\n可前往設置進行授權。</string>
<string name="lucky_angel" translatable="false">恭喜 %s 在幸運天使中抽中 %s下一個幸運天使就是你哦</string>
<string name="user_card_guard" translatable="false">守護團%s人</string>
</resources>

View File

@ -479,6 +479,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
mLiveRoomViewHolder.setAvatar(u.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor());
mLiveRoomViewHolder.setLiveUid(u.getId());
mLiveRoomViewHolder.setAnchorGoodNumber(u.getGoodName());
}
mLiveRoomViewHolder.initHourRankList();
mLiveRoomViewHolder.startAnchorLight();

View File

@ -46,7 +46,6 @@ import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.JsonBean;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.BitmapUtil;
import com.yunbao.common.utils.Bus;
@ -597,6 +596,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.setName(u.getUserNiceName());
mLiveRoomViewHolder.setAvatar(u.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor());
mLiveRoomViewHolder.setAnchorGoodNumber(u.getGoodName());
mLiveRoomViewHolder.initHourRankList();
}
mLiveRoomViewHolder.startAnchorLight();

View File

@ -0,0 +1,810 @@
package com.yunbao.live.dialog;
import android.app.Dialog;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.ToastUtil;
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.ImpressBean;
import com.yunbao.live.custom.MyTextView;
import com.yunbao.live.event.LiveRoomChangeEvent;
import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.LiveTextRender;
import com.yunbao.live.views.LiveRoomViewHolder;
import org.greenrobot.eventbus.EventBus;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import io.rong.imlib.IRongCoreCallback;
import io.rong.imlib.IRongCoreEnum;
import io.rong.imlib.chatroom.base.RongChatRoomClient;
import pl.droidsonroids.gif.GifImageView;
/**
* Created by cxf on 2018/10/15.
* 直播间个人资料弹窗
*/
public class LiveOldUserDialogFragment extends AbsDialogFragment implements View.OnClickListener {
private static final int TYPE_AUD_AUD = 1;//观众点别的观众
private static final int TYPE_ANC_AUD = 2;//主播点观众
private static final int TYPE_AUD_ANC = 3;//观众点主播
private static final int TYPE_AUD_SELF = 4;//观众点自己
private static final int TYPE_ANC_SELF = 5;//主播点自己
private static final int SETTING_ACTION_SELF = 0;//设置 自己点自己
private static final int SETTING_ACTION_AUD = 30;//设置 普通观众点普通观众 或所有人点超管
private static final int SETTING_ACTION_ADM = 40;//设置 房间管理员点普通观众
private static final int SETTING_ACTION_SUP = 60;//设置 超管点主播
private static final int SETTING_ACTION_ANC_AUD = 501;//设置 主播点普通观众
private static final int SETTING_ACTION_ANC_ADM = 502;//设置 主播点房间管理员
private ViewGroup mBottomContainer;
private ImageView mAvatar;
private ImageView mLevelAnchor;
private ImageView mLevel;
private TextView mLevelText;
private TextView mLevelAnchorText;
private ImageView mSex;
private TextView mName;
private TextView mID;
private TextView mCity;
private LinearLayout mImpressGroup;
private TextView mFollow;
private TextView mSign;
private TextView mFans;
private TextView mConsume;//消费
private TextView mVotes;//收入
private TextView mConsumeTip;
private TextView mVotesTip;
private String mLiveUid;
private String mStream;
private String mAvatarUrl;
private String mToUid;
private TextView mFollowText;
private ImageView mFollowImage;
private int mType;
private int mAction;
private String mToName;//对方的名字
private UserBean mUserBean;
private boolean mFollowing;
private Drawable mFollowDrawable;
private Drawable mUnFollowDrawable;
SVGAImageView gift_svga;
LinearLayout ry_view;
ImageView medalIco1, shawl;
ImageView ry_ico1, ry_ico2, ry_ico3, ry_ico4, good_nub_ico;
View no_gz;
GifImageView btn_live;
@Override
protected int getLayoutId() {
return R.layout.dialog_live_user;
}
@Override
protected int getDialogStyle() {
return R.style.dialog2;
}
@Override
protected boolean canCancel() {
return true;
}
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(String live_id) {
DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveUid, new IRongCoreCallback.OperationCallback() {
@Override
public void onSuccess() {
Log.i("tx", "退出成功");
//连接socket
LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
@Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
}
});
V2TIMManager.getInstance().quitGroup("g" + mLiveUid, new V2TIMCallback() {
@Override
public void onSuccess() {
Log.i("tx", "退出成功" + mLiveUid);
//连接socket
LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
@Override
public void onError(int code, String desc) {
Log.i("tx", "退出失败");
}
});
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (mCheckLivePresenter == null) {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) {
return;
}
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
// if (mFromLiveRoom) {
// ((UserHomeActivity) mContext).onBackPressed();
dismiss();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
// } else {
// LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
// }
}
});
}
mCheckLivePresenter.checkLive(liveBean);
}
}
});
}
});
}
@Override
protected void setWindowAttributes(Window window) {
WindowManager.LayoutParams params = window.getAttributes();
window.setWindowAnimations(R.style.bottomToTopAnim);
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.BOTTOM;
window.setAttributes(params);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Bundle bundle = getArguments();
if (bundle == null) {
return;
}
mLiveUid = bundle.getString(Constants.LIVE_UID);
mToUid = bundle.getString(Constants.TO_UID);
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mToUid)) {
return;
}
mStream = bundle.getString(Constants.STREAM);
//头像边框
gift_svga = (SVGAImageView) mRootView.findViewById(R.id.gift_svga);
btn_live = mRootView.findViewById(R.id.btn_live);
btn_live.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
gotoLive(mToUid);
}
});
mBottomContainer = mRootView.findViewById(R.id.bottom_container);
ry_view = (LinearLayout) mRootView.findViewById(R.id.ry_view);
no_gz = (View) mRootView.findViewById(R.id.no_gz);
ry_ico1 = (ImageView) mRootView.findViewById(R.id.ry_ico1);
good_nub_ico = (ImageView) mRootView.findViewById(R.id.good_nub_ico);
ry_ico2 = (ImageView) mRootView.findViewById(R.id.ry_ico2);
ry_ico3 = (ImageView) mRootView.findViewById(R.id.ry_ico3);
ry_ico4 = (ImageView) mRootView.findViewById(R.id.ry_ico4);
mAvatar = (ImageView) mRootView.findViewById(R.id.avatar);
mLevelAnchor = (ImageView) mRootView.findViewById(R.id.anchor_level);
mLevel = (ImageView) mRootView.findViewById(R.id.level);
shawl = (ImageView) mRootView.findViewById(R.id.shawl);
mLevelText = mRootView.findViewById(R.id.level_text);
mLevelAnchorText = mRootView.findViewById(R.id.level_anchor_text);
mSex = (ImageView) mRootView.findViewById(R.id.sex);
mName = (TextView) mRootView.findViewById(R.id.name);
mID = (TextView) mRootView.findViewById(R.id.id_val);
mCity = (TextView) mRootView.findViewById(R.id.city);
mSign = mRootView.findViewById(R.id.sign);
mImpressGroup = (LinearLayout) mRootView.findViewById(R.id.impress_group);
mFollow = (TextView) mRootView.findViewById(R.id.follow);
mFans = (TextView) mRootView.findViewById(R.id.fans);
mConsume = (TextView) mRootView.findViewById(R.id.consume);
mVotes = (TextView) mRootView.findViewById(R.id.votes);
mConsumeTip = (TextView) mRootView.findViewById(R.id.consume_tip);
mVotesTip = (TextView) mRootView.findViewById(R.id.votes_tip);
medalIco1 = (ImageView) mRootView.findViewById(R.id.medal_ico1);
mAvatar.setOnClickListener(this);
// mRootView.findViewById(R.id.btn_close).setOnClickListener(this);
getType();
LayoutInflater inflater = LayoutInflater.from(mContext);
View bottomView = null;
if (mType == TYPE_AUD_ANC) {
if (mImpressGroup.getVisibility() != View.VISIBLE) {
mImpressGroup.setVisibility(View.VISIBLE);
}
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false);
} 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);
} else if (mType == TYPE_AUD_SELF) {
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_3, mBottomContainer, false);
}
if (bottomView != null) {
mFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_user_home_follow_1);
mUnFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_user_home_follow_0);
mBottomContainer.addView(bottomView);
mFollowText = bottomView.findViewById(R.id.follow_text);
mFollowImage = (ImageView) findViewById(R.id.follow_img);
View btnFollow = bottomView.findViewById(R.id.btn_follow);
if (btnFollow != null) {
btnFollow.setOnClickListener(this);
}
View btnPriMsg = bottomView.findViewById(R.id.btn_pri_msg);
if (btnPriMsg != null) {
btnPriMsg.setOnClickListener(this);
}
View btnHomePage = bottomView.findViewById(R.id.btn_home_page);
if (btnHomePage != null) {
btnHomePage.setOnClickListener(this);
}
}
loadData();
}
private void getType() {
String uid = CommonAppConfig.getInstance().getUid();
if (mToUid.equals(mLiveUid)) {
if (mLiveUid.equals(uid)) {//主播点自己
mType = TYPE_ANC_SELF;
} else {//观众点主播
mType = TYPE_AUD_ANC;
}
} else {
if (mLiveUid.equals(uid)) {//主播点观众
mType = TYPE_ANC_AUD;
} else {
if (mToUid.equals(uid)) {//观众点自己
mType = TYPE_AUD_SELF;
} else {//观众点别的观众
mType = TYPE_AUD_AUD;
}
}
}
}
private void loadData() {
LiveHttpUtil.getLiveUser(mToUid, mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
showData(info[0]);
}
}
});
}
private void showData(String data) {
JSONObject obj = JSON.parseObject(data);
mUserBean = JSON.toJavaObject(obj, UserBean.class);
if (mUserBean.getIslive().equals("1")) {
btn_live.setVisibility(View.VISIBLE);
} else {
btn_live.setVisibility(View.GONE);
}
//装扮相关
JSONObject dress = obj.getJSONObject("dress");
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")) {
try {
new SVGAParser(mContext).parse(new URL(ico.getString("effect_src")), new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
gift_svga.setImageDrawable(drawable);
SVGAViewUtils.playEndClear(gift_svga);
}
@Override
public void onError() {
}
});
} catch (MalformedURLException e) {
e.printStackTrace();
}
} else {
Log.e("eee", ico.getString("effect_src"));
ImgLoader.display(mContext, ico.getString("effect_src"), gift_svga);
}
}
}
medalIco1.setVisibility(View.GONE);
no_gz.setVisibility(View.GONE);
if (dress.getJSONArray("medal").size() >= 1) {
JSONObject display = (JSONObject) dress.getJSONArray("medal").get(0);
if (display.getString("display_src") != null) {
ImgLoader.display(mContext, display.getString("display_src"), medalIco1);
medalIco1.setVisibility(View.VISIBLE);
no_gz.setVisibility(View.VISIBLE);
}
}
if (dress.getJSONArray("wraps").size() >= 1) {
JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0);
ImgLoader.display(mContext, display.getString("display_src"), shawl);
}
JSONObject display = (JSONObject) dress.getJSONArray("medal").get(0);
if (dress.getJSONArray("medal_no") != null) {
Log.e("tag", dress.getJSONArray("medal_no").size() + "");
ry_view.setVisibility(View.VISIBLE);
JSONObject ry1 = (JSONObject) dress.getJSONArray("medal_no").get(0);
ImgLoader.display(mContext, ry1.get("display_src").toString(), ry_ico1);
ry_ico1.setVisibility(View.VISIBLE);
if (dress.getJSONArray("medal_no").size() >= 2) {
JSONObject ry2 = (JSONObject) dress.getJSONArray("medal_no").get(1);
ImgLoader.display(mContext, ry2.get("display_src").toString(), ry_ico2);
ry_ico2.setVisibility(View.VISIBLE);
}
if (dress.getJSONArray("medal_no").size() >= 3) {
JSONObject ry3 = (JSONObject) dress.getJSONArray("medal_no").get(2);
ImgLoader.display(mContext, ry3.get("display_src").toString(), ry_ico3);
ry_ico3.setVisibility(View.VISIBLE);
}
if (dress.getJSONArray("medal_no").size() >= 4) {
JSONObject ry4 = (JSONObject) dress.getJSONArray("medal_no").get(3);
ImgLoader.display(mContext, ry4.get("display_src").toString(), ry_ico4);
ry_ico4.setVisibility(View.VISIBLE);
}
} else {
ry_view.setVisibility(View.GONE);
}
CommonAppConfig appConfig = CommonAppConfig.getInstance();
if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) {
good_nub_ico.setVisibility(View.VISIBLE);
mID.setText("ID:" + mUserBean.getGoodnum());
} else {
good_nub_ico.setVisibility(View.GONE);
mID.setText(mUserBean.getLiangNameTip());
}
mToName = obj.getString("user_nicename");
mName.setText(mToName);
mCity.setText(obj.getString("city"));
ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar);
mAvatarUrl = obj.getString("avatar");
int levelAnchor = obj.getIntValue("level_anchor");
int level = obj.getIntValue("level");
mSign.setText(obj.getString("signature"));
LevelBean anchorLevelBean = appConfig.getAnchorLevel(obj.getIntValue("level_anchor"));
if (anchorLevelBean != null) {
ImgLoader.display(mContext, anchorLevelBean.getBgIcon(), mLevelAnchor);
}
LevelBean levelBean = appConfig.getLevel(obj.getIntValue("level"));
if (levelBean != null) {
ImgLoader.display(mContext, levelBean.getBgIcon(), mLevel);
}
mLevelAnchorText.setText(String.valueOf(levelAnchor));
mLevelText.setText(String.valueOf(level));
mSex.setImageResource(CommonIconUtil.getSexIcon(obj.getIntValue("sex")));
mFollow.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("follows")));
mFans.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("fans")));
mConsume.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("consumption")));
mVotes.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("votestotal")));
mConsumeTip.setText(WordUtil.getString(R.string.live_user_send) + appConfig.getCoinName());
mVotesTip.setText(WordUtil.getString(R.string.live_user_get) + appConfig.getVotesName());
if (mType == TYPE_AUD_ANC) {
showImpress(obj.getString("label"));
}
mFollowing = obj.getIntValue("isattention") == 1;
if (mFollowText != null) {
mFollowText.setText(mFollowing ? WordUtil.getString(R.string.following) : WordUtil.getString(R.string.follow));
}
if (mFollowImage != null) {
mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable);
}
mAction = obj.getIntValue("action");
if (mAction == SETTING_ACTION_AUD) {//设置 普通观众点普通观众 或所有人点超管
View btnReport = mRootView.findViewById(R.id.btn_report);
btnReport.setVisibility(View.VISIBLE);
btnReport.setOnClickListener(this);
} else if (mAction == SETTING_ACTION_ADM//设置 房间管理员点普通观众
|| mAction == SETTING_ACTION_SUP//设置 超管点主播
|| mAction == SETTING_ACTION_ANC_AUD//设置 主播点普通观众
|| mAction == SETTING_ACTION_ANC_ADM) {//设置 主播点房间管理员
View btnSetting = mRootView.findViewById(R.id.btn_setting);
btnSetting.setVisibility(View.VISIBLE);
btnSetting.setOnClickListener(this);
}
}
private void showImpress(String impressJson) {
List<ImpressBean> list = JSON.parseArray(impressJson, ImpressBean.class);
if (list.size() > 2) {
list = list.subList(0, 2);
}
LayoutInflater inflater = LayoutInflater.from(mContext);
for (int i = 0, size = list.size(); i < size; i++) {
MyTextView myTextView = (MyTextView) inflater.inflate(R.layout.view_impress_item_2, mImpressGroup, false);
ImpressBean bean = list.get(i);
bean.setCheck(1);
myTextView.setBean(bean);
mImpressGroup.addView(myTextView);
}
TextView textView = (TextView) inflater.inflate(R.layout.view_impress_item_add, mImpressGroup, false);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addImpress();
}
});
mImpressGroup.addView(textView);
}
/**
* 添加主播印象
*/
private void addImpress() {
dismiss();
((LiveActivity) mContext).openAddImpressWindow(mLiveUid);
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.btn_close) {
dismiss();
} else if (i == R.id.btn_follow) {
setAttention();
} else if (i == R.id.btn_pri_msg) {
openChatRoomWindow();
} else if (i == R.id.btn_home_page) {
forwardHomePage();
} else if (i == R.id.btn_setting) {
setting();
} else if (i == R.id.btn_report) {
report();
} else if (i == R.id.avatar) {
forwardHomePage();
}
}
/**
* 打开私信聊天窗口
*/
private void openChatRoomWindow() {
if (mUserBean != null) {
dismiss();
// ToastUtil.show("私聊暫不可用");
// if (!mToUid.equals(CommonAppConfig.getInstance().getUid())) {
// SystemMessageActivity.forward(mContext, "-1", mToUid, mToName, mAvatarUrl);
// }
((LiveActivity) mContext).openChatListWindow();
}
}
/**
* 关注
*/
private void setAttention() {
CommonHttpUtil.setAttention(mToUid, mAttentionCallback);
}
private CommonCallback<Integer> mAttentionCallback = new CommonCallback<Integer>() {
@Override
public void callback(Integer isAttention) {
mFollowing = isAttention == 1;
if (mFollowText != null) {
mFollowText.setText(mFollowing ? R.string.following : R.string.follow);
}
if (mFollowImage != null) {
mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable);
}
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);
// String url = HtmlConfig.PERSONAL + "?touid=" + mToUid + "&&isHomePage=1" + "&&fromType=0";
// Constants.myUrl = url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
}
/**
* 举报
*/
private void report() {
LiveReportActivity.forward(mContext, mToUid);
}
/**
* 设置
* <p>
* 某个大神说角色是权限的集合
* <p>
* 理论上角色的权限应该有服务端以数组或集合的形式返回这样可以在后台动态配置某种角色的权限而不是这样口头约定写死
* 然而是服务端这样做的我也很无奈也许他们不知道如何做成动态配置的吧
* <p>
* 我一直想通过不断重构把代码写的像艺术品然而最近发现这完全是多此一举自讨苦吃是我太天真了
* 下面是我发现的一篇文章说的非常好也点醒了我如果你们发现当前代码写的太烂不堪入目的话请阅读下面的文章
* <p>
* https://www.jianshu.com/p/71521541cd25?utm_campaign=haruki&utm_content=note&utm_medium=reader_share&utm_source=weixin_timeline&from=timeline
*/
private void setting() {
List<Integer> list = new ArrayList<>();
switch (mAction) {
case SETTING_ACTION_ADM://设置 房间管理员点普通观众
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_gap_2);
break;
case SETTING_ACTION_SUP://设置 超管点主播
list.add(R.string.live_setting_close_live);
list.add(R.string.live_setting_close_live_2);
list.add(R.string.live_setting_forbid_account);
break;
case SETTING_ACTION_ANC_AUD://设置 主播点普通观众
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_gap_2);
list.add(R.string.live_setting_admin);
list.add(R.string.live_setting_admin_list);
break;
case SETTING_ACTION_ANC_ADM://设置 主播点房间管理员
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_gap_2);
list.add(R.string.live_setting_admin_cancel);
list.add(R.string.live_setting_admin_list);
break;
}
DialogUitl.showStringArrayDialog(mContext, list.toArray(new Integer[list.size()]), mArrayDialogCallback);
}
private DialogUitl.StringArrayDialogCallback mArrayDialogCallback = new DialogUitl.StringArrayDialogCallback() {
@Override
public void onItemClick(String text, int tag) {
if (tag == R.string.live_setting_kick) {
kick();
} else if (tag == R.string.live_setting_gap) {//永久禁言->改成三天禁言
setShutUp();
} else if (tag == R.string.live_setting_gap_2) {//本场禁言
setShutUp2();
} else if (tag == R.string.live_setting_admin || tag == R.string.live_setting_admin_cancel) {
setAdmin();
} else if (tag == R.string.live_setting_admin_list) {
adminList();
} else if (tag == R.string.live_setting_close_live) {
closeLive();
} else if (tag == R.string.live_setting_forbid_account) {
forbidAccount();
} else if (tag == R.string.live_setting_close_live_2) {//禁用直播
closeLive2();
}
}
};
/**
* 查看管理员列表
*/
private void adminList() {
dismiss();
((LiveActivity) mContext).openAdminListWindow();
}
/**
* 踢人
*/
private void kick() {
LiveHttpUtil.kicking(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
((LiveActivity) mContext).kickUser(mToUid, mToName);
} else {
ToastUtil.show(msg);
}
}
});
}
/**
* 永久禁言->改成三天禁言
*/
private void setShutUp() {
LiveHttpUtil.setShutUp(mLiveUid, "0", 0, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
((LiveActivity) mContext).setShutUp(mToUid, mToName, 0);
} else {
ToastUtil.show(msg);
}
}
});
}
/**
* 本场禁言
*/
private void setShutUp2() {
LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
((LiveActivity) mContext).setShutUp(mToUid, mToName, 1);
} else {
ToastUtil.show(msg);
}
}
});
}
/**
* 设置或取消管理员
*/
private void setAdmin() {
LiveHttpUtil.setAdmin(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
int res = JSON.parseObject(info[0]).getIntValue("isadmin");
if (res == 1) {//被设为管理员
mAction = SETTING_ACTION_ANC_ADM;
} else {//被取消管理员
mAction = SETTING_ACTION_ANC_AUD;
}
((LiveActivity) mContext).sendSetAdminMessage(res, mToUid, mToName);
}
}
});
}
/**
* 超管关闭直播间
*/
private void closeLive() {
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 0, mSuperCloseRoomCallback);
}
/**
* 超管关闭直播间并禁止主播直播
*/
private void closeLive2() {
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 1, mSuperCloseRoomCallback);
}
/**
* 超管关闭直播间并禁用主播账户
*/
private void forbidAccount() {
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 2, mSuperCloseRoomCallback);
}
private HttpCallback mSuperCloseRoomCallback = new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
ToastUtil.show(JSON.parseObject(info[0]).getString("msg"));
((LiveActivity) mContext).superCloseRoom();
} else {
ToastUtil.show(msg);
}
}
};
@Override
public void onDestroy() {
LiveHttpUtil.cancel(LiveHttpConsts.GET_LIVE_USER);
if (mAvatar != null) {
ImgLoader.clear(mContext, mAvatar);
mAvatar.setImageDrawable(null);
}
mAvatar = null;
super.onDestroy();
}
}

View File

@ -1,9 +1,12 @@
package com.yunbao.live.dialog;
import android.app.Dialog;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
@ -26,6 +29,7 @@ import com.tencent.imsdk.v2.V2TIMCallback;
import com.tencent.imsdk.v2.V2TIMManager;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.FansMedalBean;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.AbsDialogFragment;
@ -35,13 +39,17 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.utils.CommonIconUtil;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.NobleUtil;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
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.activity.LiveRyAnchorActivity;
import com.yunbao.live.bean.GuardUserBean;
import com.yunbao.live.bean.ImpressBean;
import com.yunbao.common.bean.LiveBean;
import com.yunbao.live.custom.MyTextView;
@ -57,6 +65,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;
@ -70,6 +79,7 @@ import pl.droidsonroids.gif.GifImageView;
*/
public class LiveUserDialogFragment extends AbsDialogFragment implements View.OnClickListener {
private String TAG = "用户弹窗";
private static final int TYPE_AUD_AUD = 1;//观众点别的观众
private static final int TYPE_ANC_AUD = 2;//主播点观众
@ -84,46 +94,45 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private static final int SETTING_ACTION_ANC_AUD = 501;//设置 主播点普通观众
private static final int SETTING_ACTION_ANC_ADM = 502;//设置 主播点房间管理员
private ViewGroup mBottomContainer;
private ImageView mAvatar;
private ImageView mLevelAnchor;
private ImageView mLevel;
private TextView mLevelText;
private TextView mLevelAnchorText;
private ImageView mSex;
private String mLiveUid;
private String mToUid;
private String mStream;
private int mType;
private int guardNumber;
private TextView mFollowText;
private TextView mName;
private TextView mID;
private TextView mCity;
private LinearLayout mImpressGroup;
private TextView mFollow;
private TextView mSign;
private TextView mFans;
private TextView mConsume;//消费
private TextView mVotes;//收入
private TextView mConsumeTip;
private TextView mVotesTip;
private String mLiveUid;
private String mStream;
private String mAvatarUrl;
private String mToUid;
private TextView mFollowText;
private TextView userLv;
private TextView mLvDesc;
private TextView mFansVal;
private TextView mPraise;
private TextView mSignDesc;
private TextView mNobleVal;
private TextView mReport;
private TextView mGuard;
private TextView mUnion;
private TextView mHonorVal;
private ImageView mFollowImage;
private int mType;
private int mAction;
private String mToName;//对方的名字
private ImageView mSex;
private ImageView good_nub_ico;
private ImageView mLiveIcon;
private ImageView mLiveIcon2;
private ImageView mNoble;
private ImageView mNobleIcon;
private ImageView mAvatar;
private ImageView shawl;
private ImageView honorIcon;
private UserBean mUserBean;
private LinearLayout mGuardLayout;
private LinearLayout mUnionLayout;
private boolean mFollowing;
private Drawable mFollowDrawable;
private Drawable mUnFollowDrawable;
SVGAImageView gift_svga;
LinearLayout ry_view;
ImageView medalIco1, shawl;
ImageView ry_ico1, ry_ico2, ry_ico3, ry_ico4, good_nub_ico;
View no_gz;
GifImageView btn_live;
SVGAImageView gift_svga;
@Override
protected int getLayoutId() {
return R.layout.dialog_live_user;
return R.layout.dialog_new_live_user;
}
@Override
@ -138,80 +147,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private LiveRoomCheckLivePresenter mCheckLivePresenter;
private void gotoLive(String live_id) {
DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveUid, new IRongCoreCallback.OperationCallback() {
@Override
public void onSuccess() {
Log.i("tx", "退出成功");
//连接socket
LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
@Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
}
});
V2TIMManager.getInstance().quitGroup("g" + mLiveUid, new V2TIMCallback() {
@Override
public void onSuccess() {
Log.i("tx", "退出成功" + mLiveUid);
//连接socket
LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
@Override
public void onError(int code, String desc) {
Log.i("tx", "退出失败");
}
});
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (mCheckLivePresenter == null) {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) {
return;
}
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
// if (mFromLiveRoom) {
// ((UserHomeActivity) mContext).onBackPressed();
dismiss();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
// } else {
// LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
// }
}
});
}
mCheckLivePresenter.checkLive(liveBean);
}
}
});
}
});
}
@Override
protected void setWindowAttributes(Window window) {
@ -236,64 +171,22 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
return;
}
mStream = bundle.getString(Constants.STREAM);
//头像边框
gift_svga = (SVGAImageView) mRootView.findViewById(R.id.gift_svga);
btn_live = mRootView.findViewById(R.id.btn_live);
btn_live.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
gotoLive(mToUid);
}
});
mBottomContainer = mRootView.findViewById(R.id.bottom_container);
ry_view = (LinearLayout) mRootView.findViewById(R.id.ry_view);
no_gz = (View) mRootView.findViewById(R.id.no_gz);
ry_ico1 = (ImageView) mRootView.findViewById(R.id.ry_ico1);
good_nub_ico = (ImageView) mRootView.findViewById(R.id.good_nub_ico);
ry_ico2 = (ImageView) mRootView.findViewById(R.id.ry_ico2);
ry_ico3 = (ImageView) mRootView.findViewById(R.id.ry_ico3);
ry_ico4 = (ImageView) mRootView.findViewById(R.id.ry_ico4);
mAvatar = (ImageView) mRootView.findViewById(R.id.avatar);
mLevelAnchor = (ImageView) mRootView.findViewById(R.id.anchor_level);
mLevel = (ImageView) mRootView.findViewById(R.id.level);
shawl = (ImageView) mRootView.findViewById(R.id.shawl);
mLevelText = mRootView.findViewById(R.id.level_text);
mLevelAnchorText = mRootView.findViewById(R.id.level_anchor_text);
mSex = (ImageView) mRootView.findViewById(R.id.sex);
mName = (TextView) mRootView.findViewById(R.id.name);
mID = (TextView) mRootView.findViewById(R.id.id_val);
mCity = (TextView) mRootView.findViewById(R.id.city);
mSign = mRootView.findViewById(R.id.sign);
mImpressGroup = (LinearLayout) mRootView.findViewById(R.id.impress_group);
mFollow = (TextView) mRootView.findViewById(R.id.follow);
mFans = (TextView) mRootView.findViewById(R.id.fans);
mConsume = (TextView) mRootView.findViewById(R.id.consume);
mVotes = (TextView) mRootView.findViewById(R.id.votes);
mConsumeTip = (TextView) mRootView.findViewById(R.id.consume_tip);
mVotesTip = (TextView) mRootView.findViewById(R.id.votes_tip);
medalIco1 = (ImageView) mRootView.findViewById(R.id.medal_ico1);
mAvatar.setOnClickListener(this);
// mRootView.findViewById(R.id.btn_close).setOnClickListener(this);
getType();
initView();
initListener();
initGuardList();
LayoutInflater inflater = LayoutInflater.from(mContext);
View bottomView = null;
if (mType == TYPE_AUD_ANC) {
if (mImpressGroup.getVisibility() != View.VISIBLE) {
mImpressGroup.setVisibility(View.VISIBLE);
}
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false);
} 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);
}
if (bottomView != null) {
mFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_user_home_follow_1);
mUnFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_user_home_follow_0);
mBottomContainer.addView(bottomView);
mFollowText = bottomView.findViewById(R.id.follow_text);
mFollowImage = (ImageView) findViewById(R.id.follow_img);
@ -313,6 +206,58 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
loadData();
}
private void initView() {
gift_svga = (SVGAImageView) mRootView.findViewById(R.id.gift_svga);
btn_live = mRootView.findViewById(R.id.btn_live);
mBottomContainer = mRootView.findViewById(R.id.bottom_container);
mSex = (ImageView) mRootView.findViewById(R.id.sex);
mName = (TextView) mRootView.findViewById(R.id.name);
mID = (TextView) mRootView.findViewById(R.id.id_val);
good_nub_ico = (ImageView) mRootView.findViewById(R.id.good_nub_ico);
userLv = mRootView.findViewById(R.id.lv_val);
mLvDesc = mRootView.findViewById(R.id.lv_desc);
mLiveIcon = mRootView.findViewById(R.id.user_card_lv_icon);
mLiveIcon2 = mRootView.findViewById(R.id.live_icon);
mNoble = mRootView.findViewById(R.id.user_card_noble);
mFansVal = mRootView.findViewById(R.id.fans_val);
mPraise = mRootView.findViewById(R.id.praise_val);
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);
mGuardLayout = mRootView.findViewById(R.id.btn_guard);
mGuard = mRootView.findViewById(R.id.guard_val);
mNobleIcon = mRootView.findViewById(R.id.noble_icon);
honorIcon = mRootView.findViewById(R.id.honor_icon);
mUnionLayout = mRootView.findViewById(R.id.btn_union);
mUnion = mRootView.findViewById(R.id.union_val);
mHonorVal = mRootView.findViewById(R.id.honor_val);
}
private void initListener() {
btn_live.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// gotoLive(mToUid);
}
});
mAvatar.setOnClickListener(this);
mReport.setOnClickListener(this);
mGuardLayout.setOnClickListener(this);
}
private void loadData() {
LiveHttpUtil.getLiveUser(mToUid, mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
showData(info[0]);
}
}
});
}
private void getType() {
String uid = CommonAppConfig.getInstance().getUid();
if (mToUid.equals(mLiveUid)) {
@ -334,18 +279,9 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}
}
private void loadData() {
LiveHttpUtil.getLiveUser(mToUid, mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
showData(info[0]);
}
}
});
}
private void showData(String data) {
Log.i(TAG, "showData: " + data);
boolean isAnchor = mLiveUid.equals(mToUid);
JSONObject obj = JSON.parseObject(data);
mUserBean = JSON.toJavaObject(obj, UserBean.class);
if (mUserBean.getIslive().equals("1")) {
@ -353,12 +289,113 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else {
btn_live.setVisibility(View.GONE);
}
if (isAnchor) {
mGuardLayout.setVisibility(View.VISIBLE);
if (obj.containsKey("user_president_name") && !StringUtil.isEmpty(obj.getString("user_president_name"))) {
mUnion.setText(obj.getString("user_president_name"));
mUnionLayout.setVisibility(View.VISIBLE);
}
mNoble.setVisibility(View.GONE);
}
mName.setText(obj.getString("user_nicename"));
if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) {
good_nub_ico.setVisibility(View.VISIBLE);
mID.setText(mUserBean.getGoodnum());
} else {
good_nub_ico.setVisibility(View.GONE);
mID.setText(mUserBean.getId());
}
mSex.setImageResource(CommonIconUtil.getSexIconForUserCard(obj.getIntValue("sex")));
LevelBean levelBean;
if (mLiveUid.equals(mUserBean.getId())) {
levelBean = CommonAppConfig.getInstance().getAnchorLevel(mUserBean.getLevelAnchor());
userLv.setText("Lv." + mUserBean.getLevelAnchor());
mLvDesc.setText(R.string.live_user_level_anchor);
} else {
levelBean = CommonAppConfig.getInstance().getLevel(mUserBean.getLevel());
userLv.setText("Lv." + mUserBean.getLevel());
mLvDesc.setText(R.string.live_user_card_level);
}
new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() {
@Override
public void onLoadSuccess(Drawable drawable) {
ImgLoader.display2(mContext, drawable, mLiveIcon);
}
//装扮相关
@Override
public void onLoadFailed() {
}
});
ImgLoader.display(mContext, levelBean.getBgIcon(), mLiveIcon2);
FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level"));
if (fansMedalBean != null && !isAnchor) {
ImgLoader.display(mContext, fansMedalBean.getThumb(), mNoble);
} else {
mNoble.setVisibility(View.GONE);
}
mGuard.setText(String.format(mGuard.getText().toString(), guardNumber));
mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans());
mPraise.setText(WordUtil.getString(R.string.praise) + ":" + obj.getInteger("user_love_num"));
mSignDesc.setText(mUserBean.getSignature());
mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id())));
ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar);
JSONObject dress = obj.getJSONObject("dress");
if (dress.getJSONArray("avatar_frame").size() == 1) {
mHonorVal.setText(dress.getInteger("medal_num") + "");
if (obj.containsKey("level_thumb")) {
ImgLoader.display(mContext, obj.getJSONObject("level_thumb").getString("icon"), mLiveIcon2);
} else {
mLiveIcon2.setVisibility(View.INVISIBLE);
}
if (dress.containsKey("medal")) {
JSONObject item = null;
for (Object medal : dress.getJSONArray("medal")) {
JSONObject _item = (JSONObject) medal;
if (_item.getInteger("is_use") == 1) {
item = _item;
break;
}
}
if (item != null) {
String url = item.getString("display_src");
if (item.containsKey("noble_medal") && !isAnchor) {
mNoble.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, item.getString("noble_medal"), mNoble);
}
if (url != null) {
url = url.replace("qny.shayucm.com", "downs.yaoulive.com");
mNobleIcon.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, url, mNobleIcon);
} else {
mNobleIcon.setVisibility(View.INVISIBLE);
}
}
} else {
mNobleIcon.setVisibility(View.INVISIBLE);
}
if (dress.containsKey("medal_no")) {
JSONObject item = null;
if (dress.getJSONArray("medal_no").size() > 0) {
item = dress.getJSONArray("medal_no").getJSONObject(0);
String url = item.getString("display_src");
url = url.replace("qny.shayucm.com", "downs.yaoulive.com");
honorIcon.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, url, honorIcon);
}
} else {
honorIcon.setVisibility(View.INVISIBLE);
}
mFollowing = obj.getIntValue("isattention") == 1;
updateFollow();
//装扮相关
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")) {
@ -386,181 +423,24 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
}
}
medalIco1.setVisibility(View.GONE);
no_gz.setVisibility(View.GONE);
if (dress.getJSONArray("medal").size() >= 1) {
JSONObject display = (JSONObject) dress.getJSONArray("medal").get(0);
if (display.getString("display_src") != null) {
ImgLoader.display(mContext, display.getString("display_src"), medalIco1);
medalIco1.setVisibility(View.VISIBLE);
no_gz.setVisibility(View.VISIBLE);
}
}
if (dress.getJSONArray("wraps").size() >= 1) {
JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0);
ImgLoader.display(mContext, display.getString("display_src"), shawl);
}
JSONObject display = (JSONObject) dress.getJSONArray("medal").get(0);
if (dress.getJSONArray("medal_no") != null) {
Log.e("tag", dress.getJSONArray("medal_no").size() + "");
ry_view.setVisibility(View.VISIBLE);
JSONObject ry1 = (JSONObject) dress.getJSONArray("medal_no").get(0);
ImgLoader.display(mContext, ry1.get("display_src").toString(), ry_ico1);
ry_ico1.setVisibility(View.VISIBLE);
if (dress.getJSONArray("medal_no").size() >= 2) {
JSONObject ry2 = (JSONObject) dress.getJSONArray("medal_no").get(1);
ImgLoader.display(mContext, ry2.get("display_src").toString(), ry_ico2);
ry_ico2.setVisibility(View.VISIBLE);
}
if (dress.getJSONArray("medal_no").size() >= 3) {
JSONObject ry3 = (JSONObject) dress.getJSONArray("medal_no").get(2);
ImgLoader.display(mContext, ry3.get("display_src").toString(), ry_ico3);
ry_ico3.setVisibility(View.VISIBLE);
}
if (dress.getJSONArray("medal_no").size() >= 4) {
JSONObject ry4 = (JSONObject) dress.getJSONArray("medal_no").get(3);
ImgLoader.display(mContext, ry4.get("display_src").toString(), ry_ico4);
ry_ico4.setVisibility(View.VISIBLE);
}
} else {
ry_view.setVisibility(View.GONE);
}
CommonAppConfig appConfig = CommonAppConfig.getInstance();
if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) {
good_nub_ico.setVisibility(View.VISIBLE);
mID.setText("ID:" + mUserBean.getGoodnum());
} else {
good_nub_ico.setVisibility(View.GONE);
mID.setText(mUserBean.getLiangNameTip());
}
mToName = obj.getString("user_nicename");
mName.setText(mToName);
mCity.setText(obj.getString("city"));
ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar);
mAvatarUrl = obj.getString("avatar");
int levelAnchor = obj.getIntValue("level_anchor");
int level = obj.getIntValue("level");
mSign.setText(obj.getString("signature"));
LevelBean anchorLevelBean = appConfig.getAnchorLevel(obj.getIntValue("level_anchor"));
if (anchorLevelBean != null) {
ImgLoader.display(mContext, anchorLevelBean.getBgIcon(), mLevelAnchor);
}
LevelBean levelBean = appConfig.getLevel(obj.getIntValue("level"));
if (levelBean != null) {
ImgLoader.display(mContext, levelBean.getBgIcon(), mLevel);
}
mLevelAnchorText.setText(String.valueOf(levelAnchor));
mLevelText.setText(String.valueOf(level));
mSex.setImageResource(CommonIconUtil.getSexIcon(obj.getIntValue("sex")));
mFollow.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("follows")));
mFans.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("fans")));
mConsume.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("consumption")));
mVotes.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("votestotal")));
mConsumeTip.setText(WordUtil.getString(R.string.live_user_send) + appConfig.getCoinName());
mVotesTip.setText(WordUtil.getString(R.string.live_user_get) + appConfig.getVotesName());
if (mType == TYPE_AUD_ANC) {
showImpress(obj.getString("label"));
}
mFollowing = obj.getIntValue("isattention") == 1;
private void updateFollow() {
if (mFollowText != null) {
mFollowText.setText(mFollowing ? WordUtil.getString(R.string.following) : WordUtil.getString(R.string.follow));
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) {
mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable);
if (mFollowing) {
mFollowImage.setVisibility(View.GONE);
} else {
mFollowImage.setVisibility(View.VISIBLE);
}
mAction = obj.getIntValue("action");
if (mAction == SETTING_ACTION_AUD) {//设置 普通观众点普通观众 或所有人点超管
View btnReport = mRootView.findViewById(R.id.btn_report);
btnReport.setVisibility(View.VISIBLE);
btnReport.setOnClickListener(this);
} else if (mAction == SETTING_ACTION_ADM//设置 房间管理员点普通观众
|| mAction == SETTING_ACTION_SUP//设置 超管点主播
|| mAction == SETTING_ACTION_ANC_AUD//设置 主播点普通观众
|| mAction == SETTING_ACTION_ANC_ADM) {//设置 主播点房间管理员
View btnSetting = mRootView.findViewById(R.id.btn_setting);
btnSetting.setVisibility(View.VISIBLE);
btnSetting.setOnClickListener(this);
}
}
private void showImpress(String impressJson) {
List<ImpressBean> list = JSON.parseArray(impressJson, ImpressBean.class);
if (list.size() > 2) {
list = list.subList(0, 2);
}
LayoutInflater inflater = LayoutInflater.from(mContext);
for (int i = 0, size = list.size(); i < size; i++) {
MyTextView myTextView = (MyTextView) inflater.inflate(R.layout.view_impress_item_2, mImpressGroup, false);
ImpressBean bean = list.get(i);
bean.setCheck(1);
myTextView.setBean(bean);
mImpressGroup.addView(myTextView);
}
TextView textView = (TextView) inflater.inflate(R.layout.view_impress_item_add, mImpressGroup, false);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addImpress();
}
});
mImpressGroup.addView(textView);
}
/**
* 添加主播印象
*/
private void addImpress() {
dismiss();
((LiveActivity) mContext).openAddImpressWindow(mLiveUid);
}
@Override
public void onClick(View v) {
int i = v.getId();
if (i == R.id.btn_close) {
dismiss();
} else if (i == R.id.btn_follow) {
setAttention();
} else if (i == R.id.btn_pri_msg) {
openChatRoomWindow();
} else if (i == R.id.btn_home_page) {
forwardHomePage();
} else if (i == R.id.btn_setting) {
setting();
} else if (i == R.id.btn_report) {
report();
} else if (i == R.id.avatar) {
forwardHomePage();
}
}
/**
* 打开私信聊天窗口
*/
private void openChatRoomWindow() {
if (mUserBean != null) {
dismiss();
// ToastUtil.show("私聊暫不可用");
// if (!mToUid.equals(CommonAppConfig.getInstance().getUid())) {
// SystemMessageActivity.forward(mContext, "-1", mToUid, mToName, mAvatarUrl);
// }
((LiveActivity) mContext).openChatListWindow();
}
}
@ -568,26 +448,45 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
* 关注
*/
private void setAttention() {
CommonHttpUtil.setAttention(mToUid, mAttentionCallback);
if (mFollowing) {
DialogUitl.Builder builder = new DialogUitl.Builder(mContext)
.setContent(WordUtil.getString(R.string.unfollow))
.setConfrimString(WordUtil.getString(R.string.unfollow_confrim))
.setCancelString(WordUtil.getString(R.string.unfollow_cancel))
.setView(R.layout.dialog_live_unfollow)
.setClickCallback3(new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
dialog.dismiss();
}
private CommonCallback<Integer> mAttentionCallback = new CommonCallback<Integer>() {
@Override
public void onCancel() {
attention();
}
});
builder.build().show();
return;
}
attention();
}
private void attention() {
CommonHttpUtil.setAttention(mToUid, new CommonCallback<Integer>() {
@Override
public void callback(Integer isAttention) {
mFollowing = isAttention == 1;
if (mFollowText != null) {
mFollowText.setText(mFollowing ? R.string.following : R.string.follow);
}
if (mFollowImage != null) {
mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable);
}
updateFollow();
if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播
((LiveActivity) mContext).sendSystemMessage(
CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
}
}
};
});
}
/**
* 跳转到个人主页
@ -596,8 +495,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
dismiss();
Constants.mStream = mStream;
RouteUtil.forwardUserHome(mContext, mToUid, true, mLiveUid, 0);
// String url = HtmlConfig.PERSONAL + "?touid=" + mToUid + "&&isHomePage=1" + "&&fromType=0";
// Constants.myUrl = url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
}
/**
@ -607,203 +504,31 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
LiveReportActivity.forward(mContext, mToUid);
}
/**
* 设置
* <p>
* 某个大神说角色是权限的集合
* <p>
* 理论上角色的权限应该有服务端以数组或集合的形式返回这样可以在后台动态配置某种角色的权限而不是这样口头约定写死
* 然而是服务端这样做的我也很无奈也许他们不知道如何做成动态配置的吧
* <p>
* 我一直想通过不断重构把代码写的像艺术品然而最近发现这完全是多此一举自讨苦吃是我太天真了
* 下面是我发现的一篇文章说的非常好也点醒了我如果你们发现当前代码写的太烂不堪入目的话请阅读下面的文章
* <p>
* https://www.jianshu.com/p/71521541cd25?utm_campaign=haruki&utm_content=note&utm_medium=reader_share&utm_source=weixin_timeline&from=timeline
*/
private void setting() {
List<Integer> list = new ArrayList<>();
switch (mAction) {
case SETTING_ACTION_ADM://设置 房间管理员点普通观众
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_gap_2);
break;
case SETTING_ACTION_SUP://设置 超管点主播
list.add(R.string.live_setting_close_live);
list.add(R.string.live_setting_close_live_2);
list.add(R.string.live_setting_forbid_account);
break;
case SETTING_ACTION_ANC_AUD://设置 主播点普通观众
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_gap_2);
list.add(R.string.live_setting_admin);
list.add(R.string.live_setting_admin_list);
break;
case SETTING_ACTION_ANC_ADM://设置 主播点房间管理员
list.add(R.string.live_setting_kick);
// list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_gap_2);
list.add(R.string.live_setting_admin_cancel);
list.add(R.string.live_setting_admin_list);
break;
}
DialogUitl.showStringArrayDialog(mContext, list.toArray(new Integer[list.size()]), mArrayDialogCallback);
}
private DialogUitl.StringArrayDialogCallback mArrayDialogCallback = new DialogUitl.StringArrayDialogCallback() {
@Override
public void onItemClick(String text, int tag) {
if (tag == R.string.live_setting_kick) {
kick();
} else if (tag == R.string.live_setting_gap) {//永久禁言->改成三天禁言
setShutUp();
} else if (tag == R.string.live_setting_gap_2) {//本场禁言
setShutUp2();
} else if (tag == R.string.live_setting_admin || tag == R.string.live_setting_admin_cancel) {
setAdmin();
} else if (tag == R.string.live_setting_admin_list) {
adminList();
} else if (tag == R.string.live_setting_close_live) {
closeLive();
} else if (tag == R.string.live_setting_forbid_account) {
forbidAccount();
} else if (tag == R.string.live_setting_close_live_2) {//禁用直播
closeLive2();
}
}
};
/**
* 查看管理员列表
*/
private void adminList() {
dismiss();
((LiveActivity) mContext).openAdminListWindow();
}
/**
* 踢人
*/
private void kick() {
LiveHttpUtil.kicking(mLiveUid, mToUid, new HttpCallback() {
private void initGuardList() {
LiveHttpUtil.getGuardList(mLiveUid, 1, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
((LiveActivity) mContext).kickUser(mToUid, mToName);
} else {
ToastUtil.show(msg);
List<GuardUserBean> list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class);
if (list != null) {
guardNumber = list.size();
}
}
});
}
/**
* 永久禁言->改成三天禁言
*/
private void setShutUp() {
LiveHttpUtil.setShutUp(mLiveUid, "0", 0, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
((LiveActivity) mContext).setShutUp(mToUid, mToName, 0);
} else {
ToastUtil.show(msg);
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();
} else if (i == R.id.btn_guard) {
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
}
}
});
}
/**
* 本场禁言
*/
private void setShutUp2() {
LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
((LiveActivity) mContext).setShutUp(mToUid, mToName, 1);
} else {
ToastUtil.show(msg);
}
}
});
}
/**
* 设置或取消管理员
*/
private void setAdmin() {
LiveHttpUtil.setAdmin(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
int res = JSON.parseObject(info[0]).getIntValue("isadmin");
if (res == 1) {//被设为管理员
mAction = SETTING_ACTION_ANC_ADM;
} else {//被取消管理员
mAction = SETTING_ACTION_ANC_AUD;
}
((LiveActivity) mContext).sendSetAdminMessage(res, mToUid, mToName);
}
}
});
}
/**
* 超管关闭直播间
*/
private void closeLive() {
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 0, mSuperCloseRoomCallback);
}
/**
* 超管关闭直播间并禁止主播直播
*/
private void closeLive2() {
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 1, mSuperCloseRoomCallback);
}
/**
* 超管关闭直播间并禁用主播账户
*/
private void forbidAccount() {
dismiss();
LiveHttpUtil.superCloseRoom(mLiveUid, 2, mSuperCloseRoomCallback);
}
private HttpCallback mSuperCloseRoomCallback = new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
ToastUtil.show(JSON.parseObject(info[0]).getString("msg"));
((LiveActivity) mContext).superCloseRoom();
} else {
ToastUtil.show(msg);
}
}
};
@Override
public void onDestroy() {
LiveHttpUtil.cancel(LiveHttpConsts.GET_LIVE_USER);
if (mAvatar != null) {
ImgLoader.clear(mContext, mAvatar);
mAvatar.setImageDrawable(null);
}
mAvatar = null;
super.onDestroy();
}
}

View File

@ -298,6 +298,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private List<WishlistItemModel> wishlist = new ArrayList<>();
private TextView mHourRank, mHotText;
private LinearLayout msg; //默认悬浮窗布局
private LinearLayout mAnchorLayout;
private ImageView mGoodNumberIcon;
private View msg2; //悬浮窗来私信的布局
private ConstraintLayout msgLayout; //悬浮窗
private TextView msgNumber;//悬浮窗左上角数标
@ -765,6 +767,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
fans = (TextView) findViewById(R.id.fans);
fans_btn = (LinearLayout) findViewById(R.id.fans_btn);
wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout);
mAnchorLayout = (LinearLayout) findViewById(R.id.group_1);
mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico);
if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) {
fans_btn.setVisibility(View.GONE);
@ -1050,6 +1054,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
Log.e("PortraitLiveManager", error);
}
});
}
public synchronized void showStart(StarChallengeStatusModel data) {
@ -1971,12 +1976,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} else if (i == R.id.btn_prize_pool_level) {
((LiveActivity) mContext).openPrizePoolWindow();
} else if (i == R.id.user_more) {
((LiveActivity) mContext).openUserMoreListWindow(1, false, false,mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveRyAnchorActivity);
} else if (i == R.id.hot_btn) {
((LiveActivity) mContext).openUserMoreListWindow(1, false, false,mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveRyAnchorActivity);
} else if (i == R.id.noble_seat) {
((LiveActivity) mContext).openUserMoreListWindow(1, false, true,mContext instanceof LiveRyAnchorActivity);
((LiveActivity) mContext).openUserMoreListWindow(1, false, true, mContext instanceof LiveRyAnchorActivity);
} else if (i == R.id.btn_close) {
close();
//小屏
@ -2877,6 +2882,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "faceUi");
}
public void setAnchorGoodNumber(String goodNumber) {
if (!StringUtil.isEmpty(goodNumber) && !goodNumber.equals("0")) {
mAnchorLayout.setBackgroundResource(R.drawable.bg_live_anchor_goodnum);
mGoodNumberIcon.setVisibility(View.VISIBLE);
}
}
private static class LiveRoomHandler extends Handler {
private LiveRoomViewHolder mLiveRoomViewHolder;

View File

@ -267,6 +267,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setName(data.getUserNiceName());
mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
mLiveRoomViewHolder.setTitle(data.getTitle());
mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum());
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="30dp" />
<solid android:color="#FF63C1" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="142dp" android:height="34dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#abafb3ff" />
<gradient android:type="linear" android:useLevel="true" android:startColor="#b8b2a4ff" android:endColor="#80722cff" android:angle="90" />
<corners android:radius="17dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="112dp" android:height="56dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffff9782" android:endColor="#ffffbf8a" android:angle="180" />
<corners android:radius="6dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="74dp" android:height="23dp">
<shape android:layout_width="match_parent" android:layout_height="wrap_content" android:shape="rectangle">
<gradient android:angle="180" android:centerColor="#ffe782ff" android:endColor="#ffff9c9c" android:startColor="#ff9e96ff" android:type="linear" android:useLevel="true" />
<corners android:radius="12dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="112dp" android:height="56dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#fffe9afc" android:endColor="#ff8ab3ff" android:angle="180" />
<corners android:radius="6dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="112dp" android:height="56dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffff8abd" android:endColor="#fffe9aaa" android:angle="180" />
<corners android:radius="6dp" />
</shape>
</item>
</selector>

View File

@ -2,55 +2,18 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#eeeeee"
/>
android:background="#eeeeee" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
>
android:orientation="horizontal">
<FrameLayout
android:id="@+id/btn_follow"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/follow_img"
android:layout_width="13dp"
android:layout_height="13dp"
/>
<TextView
android:id="@+id/follow_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:textColor="@color/textColor"
android:textSize="13sp"
/>
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/btn_pri_msg"
@ -64,14 +27,12 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">
<ImageView
android:layout_width="13dp"
android:layout_height="13dp"
android:src="@mipmap/icon_user_home_msg"
/>
android:src="@mipmap/icon_user_home_msg" />
<TextView
android:layout_width="wrap_content"
@ -79,8 +40,7 @@
android:layout_marginLeft="4dp"
android:text="@string/pri_msg"
android:textColor="@color/textColor"
android:textSize="13sp"
/>
android:textSize="13sp" />
</LinearLayout>
@ -90,22 +50,20 @@
android:id="@+id/btn_home_page"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
>
android:layout_weight="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:orientation="horizontal"
>
android:orientation="horizontal">
<ImageView
android:layout_width="13dp"
android:layout_height="13dp"
android:src="@mipmap/icon_user_dialog_home"
/>
android:visibility="gone" />
<TextView
android:id="@+id/black_text"
@ -114,13 +72,45 @@
android:layout_marginLeft="4dp"
android:text="@string/home_page"
android:textColor="@color/textColor"
android:textSize="13sp"
/>
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/btn_follow"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/follow_img"
android:layout_width="13dp"
android:layout_height="13dp"
android:src="@mipmap/icon_user_card_follow" />
<TextView
android:id="@+id/follow_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:textColor="#FA6400"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,457 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="52dp"
android:background="@drawable/bg_live_user">
<TextView
android:id="@+id/btn_report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:layout_marginEnd="14dp"
android:gravity="center"
android:text="@string/report"
android:textColor="#B1B1B1"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/btn_guard"
android:layout_width="88dp"
android:layout_height="23dp"
android:layout_marginStart="14dp"
android:layout_marginTop="14dp"
android:background="@drawable/bg_user_card_guard"
android:gravity="center"
android:orientation="horizontal"
android:visibility="invisible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/guard_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:text="@string/user_card_guard"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="10dp"
android:layout_height="10dp"
app:srcCompat="@mipmap/icon_arrow_right_3" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/shawl"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<RelativeLayout
android:layout_width="83dp"
android:layout_height="83dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="63dp"
android:layout_height="63dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:scaleType="centerCrop"
app:riv_oval="true" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/gift_svga"
android:layout_width="82dp"
android:layout_height="82dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
app:autoPlay="true" />
</RelativeLayout>
<pl.droidsonroids.gif.GifImageView
android:id="@+id/btn_live"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:src="@mipmap/icon_user_home_living"
android:visibility="visible" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@color/textColor"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_marginTop="13dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<ImageView
android:id="@+id/good_nub_ico"
android:layout_width="18dp"
android:layout_height="15dp"
android:layout_marginRight="6dp"
android:src="@mipmap/good_nub"
android:visibility="visible" />
<ImageView
android:id="@+id/user_card_id"
android:layout_width="18dp"
android:layout_height="15dp"
android:layout_marginRight="6dp"
android:src="@mipmap/user_card_id"
android:visibility="visible" />
<TextView
android:id="@+id/id_val"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingRight="10dp"
android:textColor="#B1B1B1"
android:textSize="13sp" />
<View
android:layout_width="1dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="#B1B1B1"
android:visibility="visible" />
<TextView
android:id="@+id/fans_val"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingRight="10dp"
android:textColor="#B1B1B1"
android:textSize="13sp" />
<View
android:layout_width="1dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="#B1B1B1"
android:visibility="visible" />
<TextView
android:id="@+id/praise_val"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingRight="10dp"
android:textColor="#B1B1B1"
android:textSize="13sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/sex"
android:layout_width="27dp"
android:layout_height="17dp"
android:layout_marginLeft="4dp" />
<ImageView
android:id="@+id/user_card_lv_icon"
android:layout_width="46.5dp"
android:layout_height="17.5dp"
android:layout_gravity="center"
android:layout_marginStart="6dp"/>
<LinearLayout
android:id="@+id/btn_union"
android:layout_width="88dp"
android:layout_height="23dp"
android:layout_marginStart="6dp"
android:background="@drawable/bg_user_card_guard"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/union_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:text="@string/user_card_guard"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<ImageView
android:id="@+id/user_card_noble"
android:layout_width="48dp"
android:layout_height="24dp"
android:layout_marginStart="6dp"
android:src="@mipmap/emperor_rom" />
</LinearLayout>
<TextView
android:id="@+id/sign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:textColor="#B1B1B1"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/medal_ico1"
android:layout_width="35dp"
android:layout_height="35dp" />
<LinearLayout
android:id="@+id/ry_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="visible">
<View
android:id="@+id/no_gz"
android:layout_width="1dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="#B1B1B1"
android:visibility="visible" />
<ImageView
android:id="@+id/ry_ico1"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="8dp"
android:visibility="visible" />
<ImageView
android:id="@+id/ry_ico2"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="8dp"
android:visibility="visible" />
<ImageView
android:id="@+id/ry_ico3"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="8dp"
android:visibility="visible" />
<ImageView
android:id="@+id/ry_ico4"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginLeft="8dp"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:visibility="visible">
<LinearLayout
android:layout_width="112dp"
android:layout_height="56dp"
android:background="@drawable/bg_user_card_lv"
android:gravity="center">
<ImageView
android:id="@+id/live_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:visibility="visible"
android:src="@mipmap/icon_chat_face" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:orientation="vertical">
<TextView
android:id="@+id/lv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/live_user_level_anchor"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/lv_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lv.0"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="112dp"
android:layout_height="56dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_user_card_fans"
android:gravity="center">
<ImageView
android:id="@+id/noble_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:visibility="visible"
android:src="@mipmap/icon_chat_face" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/live_noble_level_anchor"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/noble_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lv.0"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="112dp"
android:layout_height="56dp"
android:background="@drawable/bg_user_card_honor"
android:gravity="center">
<ImageView
android:id="@+id/honor_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:visibility="visible"
android:src="@mipmap/icon_chat_face"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/live_honor_number_anchor"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/honor_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#FFFFFF"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/bottom_container"
android:layout_marginTop="13dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>

View File

@ -68,6 +68,20 @@
android:textColor="@color/white"
android:textSize="12sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageView
android:id="@+id/good_nub_ico"
android:layout_width="18dp"
android:layout_height="15dp"
android:layout_marginEnd="2dp"
android:src="@mipmap/good_nub"
android:visibility="gone" />
<TextView
android:id="@+id/id_val"
android:layout_width="wrap_content"
@ -76,6 +90,8 @@
android:text="1111"
android:textColor="@color/white"
android:textSize="8sp" />
</LinearLayout>
</LinearLayout>
@ -389,8 +405,8 @@
android:layout_height="wrap_content"
android:layout_alignTop="@id/hour_rank_layout"
android:layout_marginStart="10dp"
android:visibility="visible"
android:layout_toEndOf="@id/live_wks_layout">
android:layout_toEndOf="@id/live_wks_layout"
android:visibility="visible">
<include layout="@layout/view_noble_seat" />
</LinearLayout>
@ -2042,6 +2058,7 @@
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event4"
android:layout_width="67dp"
@ -2067,6 +2084,7 @@
app:indicator_width="8dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event3"
android:layout_width="67dp"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -11,6 +11,7 @@
<string name="views_rank">觀眾</string>
<string name="gurad_rank">觀眾</string>
<string name="fans">粉絲</string>
<string name="praise">獲讚</string>
<string name="room_msg">私信</string>
<string name="live_room_title">選擇房間類型</string>
<string name="live_room_public">公開房</string>

View File

@ -25,6 +25,7 @@ import com.blankj.utilcode.util.GsonUtils;
import com.fm.openinstall.OpenInstall;
import com.fm.openinstall.listener.AppInstallAdapter;
import com.fm.openinstall.model.AppData;
import com.lzy.okgo.model.Response;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
@ -39,6 +40,7 @@ import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.JsonBean;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager;
@ -336,6 +338,13 @@ public class LoginActivity extends AbsActivity {
finish();
}
@Override
public void onError(Response<JsonBean> response) {
super.onError(response);
String message = response.message();
System.out.println(">>>>>"+message);
}
});
}