改版主播直播界面

This commit is contained in:
zlzw 2022-09-15 14:11:29 +08:00
parent 7ef6c95c63
commit 3e776b63c4
7 changed files with 83 additions and 58 deletions

View File

@ -873,4 +873,5 @@ Limited ride And limited avatar frame</string>
<string name="live_room_air_ticket">has recommended an anchor to you!</string>
<string name="bonus_message">has sent you a reward, come and get it!</string>
<string name="live_class_tip_title">Pay attention to the channel that suits you.</string>
<string name="live_anchor_send">What do you say to everyone</string>
</resources>

View File

@ -890,4 +890,5 @@
<string name="system_notice">系統通知</string>
<string name="online_service">在線客服</string>
<string name="bonus_message">向你發送了一個獎勵,快來領取吧!</string>
<string name="live_anchor_send">和大家說些什麼</string>
</resources>

View File

@ -14,6 +14,7 @@ import androidx.fragment.app.DialogFragment;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.GsonUtils;
import com.lzy.okgo.callback.Callback;
import com.lzy.okgo.model.Progress;
import com.lzy.okgo.model.Response;
@ -43,6 +44,8 @@ import com.yunbao.live.R;
import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.bean.LiveGuardInfo;
import com.yunbao.live.bean.LiveKsyConfigBean;
import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.bean.WishlistModel;
import com.yunbao.live.dialog.LiveBeautyDialogFragment;
import com.yunbao.live.dialog.LiveFunctionDialogFragment;
import com.yunbao.live.dialog.LiveLinkMicListDialogFragment;
@ -611,8 +614,25 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.setName(u.getUserNiceName());
mLiveRoomViewHolder.setAvatar(u.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor());
mLiveRoomViewHolder.initHourRankList();
}
mLiveRoomViewHolder.startAnchorLight();
//心愿单
LiveHttpUtil.getWishList(mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (info.length > 0) {
String json = info[0];
WishlistModel model = GsonUtils.fromJson(json, WishlistModel.class);
if (mLiveRoomViewHolder != null && model != null) {
mLiveRoomViewHolder.initWishList(model.getWishlist());
}
}
}
@Override
public void onFinish() {
}
});
}
if (mLiveAnchorViewHolder == null) {
mLiveAnchorViewHolder = new LiveRyAnchorViewHolder(mContext, mContainer);
@ -1220,6 +1240,25 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
LiveHttpUtil.anchorCheckLive(mLiveUid, mStream, mCheckLiveCallback);
}
@Override
public void onSendGift(LiveReceiveGiftBean bean) {
//购买守护
if (bean.ismTypeBuyGuard()) {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.showGuardGifMessage(bean);
}
} else {
if (mLiveRoomViewHolder != null) {
if (bean.getmLiveUId().equals(bean.getRoomnum())) {
mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1);
}
mLiveRoomViewHolder.showGiftMessage(bean, false);
mLiveRoomViewHolder.updataWishList(bean.getGiftId(), bean.getGiftCount());
}
}
}
private void printLog(String content) {
if (mLogFile == null) {

View File

@ -477,28 +477,7 @@ public class LiveNewReadyRyViewHolder extends AbsViewHolder implements View.OnCl
isHttpBack = false;
final CommonAppConfig appConfig = CommonAppConfig.getInstance();
UserBean u = appConfig.getUserBean();
V2TIMManager.getInstance().createGroup(V2TIMManager.GROUP_TYPE_AVCHATROOM, "g" + appConfig.getUid(), "直播", new V2TIMSendCallback<String>() {
@Override
public void onProgress(int progress) {
}
@Override
public void onSuccess(String s) {
Log.i("tx", "创建成功");
((LiveAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
}
@Override
public void onError(int code, String desc) {
Log.i("tx", code + "创建失败" + desc);
if (code == 10025) {
((LiveAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
} else {
ToastUtil.show("开播失败,联系客服。");
}
}
});
((LiveRyAnchorActivity) mContext).startLiveSuccess(info[0], mLiveType, mLiveTypeVal);
} else {
ToastUtil.show(msg);
}

View File

@ -731,7 +731,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
findViewById(R.id.hot_btn).setOnClickListener(this);
try {
Glide.with(mContext).asGif().load(R.drawable.fans_medal).into(mViewMedal);
}catch (Exception e){
} catch (Exception e) {
System.err.println("发生异常行为");
e.printStackTrace();
}
@ -944,9 +944,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
findViewById(R.id.wish_list_layout).setEnabled(false);*/
findViewById(R.id.open_sidebar).setVisibility(View.GONE);
findViewById(R.id.btn_follow).setVisibility(View.GONE);
}else {
configBanner3();
}
reloadIM();
configBanner3();
}
private void showBanner2() {
@ -1178,6 +1179,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
ImageView hourPic = hourView.findViewById(R.id.wish_pic);
mHotText = hotView.findViewById(R.id.wish_index);
mHourRank = hourView.findViewById(R.id.wish_index);
mHotText.setText("0");
mHotText.setLayoutParams(textParams);
mHourRank.setLayoutParams(textParams);
mHotText.setGravity(Gravity.CENTER);
@ -1189,7 +1191,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
hourPic.setLayoutParams(params);
flipper.addView(hotView);
flipper.addView(hourView);
flipper.startFlipping();
if (mContext instanceof LiveRyAnchorActivity) {
return;
}
flipper.setOnClickListener(view -> {
Bundle bundle = new Bundle();
String path = info.get(0).getUrl();
@ -1207,7 +1212,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
liveHDDialogFragment.setArguments(bundle);
liveHDDialogFragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
});
flipper.startFlipping();
}
}, Throwable::printStackTrace)
.isDisposed();
@ -1326,8 +1331,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
});
//点击打开周星榜
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_wks_layout),
() -> Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_WKS)));
() -> {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.LIVE_WKS));
});
}
public static int pkEndIndex = 0;
@ -1711,7 +1719,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} else if (i == R.id.user_guard) {
// ((LiveActivity) mContext).openUserMoreListWindow(2, true);
((LiveActivity) mContext).openNewGuardListWindow();
} if (i == R.id.lt_trickery) {
}
if (i == R.id.lt_trickery) {
showTrickeryDialog();
}
@ -1803,7 +1812,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void onSuccess(List<Conversation> conversations) {
if (conversations != null && !conversations.isEmpty()) {
for (Conversation conversation : conversations) {
if(conversation.getUnreadMessageCount()!=0){
if (conversation.getUnreadMessageCount() != 0) {
UserInfo userInfo = RongUserInfoManager.getInstance().getUserInfo(conversation.getTargetId());
if (userInfo != null) {
ImgLoader.display(mContext, userInfo.getPortraitUri().toString(), msgUserIcon);
@ -1812,7 +1821,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
}
changeMsgView(msg2,msg);
changeMsgView(msg2, msg);
}
@Override

View File

@ -655,7 +655,7 @@
android:id="@+id/goto_room_view"
android:layout_width="wrap_content"
android:layout_height="27dp"
android:layout_below="@id/live_time"
android:layout_below="@id/lin"
android:layout_alignParentRight="true"
android:layout_marginTop="16dp"
android:layout_marginRight="9dp"

View File

@ -139,17 +139,16 @@ PK"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="@id/btn_close"
android:layout_toLeftOf="@id/btn_function"
android:padding="5dp"
android:src="@mipmap/icon_live_msg"
/>
android:src="@mipmap/icon_live_msg" />
<ImageView
android:id="@+id/btn_function"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="@id/btn_msg"
android:layout_toLeftOf="@id/btn_close"
android:padding="5dp"/>
<ImageView
@ -164,29 +163,28 @@ PK"
<TextView
android:id="@+id/et_input"
android:layout_width="match_parent"
android:layout_width="134dp"
android:layout_height="30dp"
android:layout_marginLeft="45dp"
android:background="@drawable/bg_live_item"
android:alpha="0.5"
android:layout_centerVertical="true"
android:hint="@string/live_say_something"
android:layout_marginLeft="10dp"
android:alpha="0.5"
android:background="@drawable/bg_live_item"
android:hint="@string/live_anchor_send"
android:padding="5dp"
android:singleLine="true"
android:textColor="@color/textColor"
android:textColorHint="@color/gray3"
android:textSize="14sp"
android:layout_toLeftOf="@id/btn_pk"
/>
android:textSize="14sp" />
<ImageView
android:layout_centerVertical="true"
android:id="@+id/btn_chat"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:padding="5dp"
android:src="@mipmap/icon_live_chat"
/>
android:visibility="gone" />
<TextView
android:id="@+id/btn_close_game"
@ -196,24 +194,23 @@ PK"
android:layout_marginTop="5dp"
android:layout_toRightOf="@id/btn_chat"
android:background="@drawable/bg_btn_game"
android:paddingBottom="5dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="5dp"
android:paddingRight="8dp"
android:paddingBottom="5dp"
android:text="@string/end"
android:textColor="@color/white"
android:textSize="13sp"
android:visibility="invisible"
/>
android:visibility="invisible" />
<TextView
android:id="@+id/red_point"
android:layout_width="wrap_content"
android:layout_height="14dp"
android:layout_alignRight="@id/btn_msg"
android:layout_alignTop="@id/btn_msg"
android:layout_marginRight="5dp"
android:layout_alignRight="@id/btn_msg"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/bg_red_point"
android:gravity="center"
android:includeFontPadding="false"
@ -224,8 +221,7 @@ PK"
android:textColor="#fff"
android:textSize="10sp"
android:translationY="-4dp"
android:visibility="invisible"
/>
android:visibility="invisible" />
</RelativeLayout>
</LinearLayout>