全站喇叭

This commit is contained in:
18401019693 2022-09-14 18:05:42 +08:00
parent 5bd0f455bb
commit ad1599ccce
28 changed files with 546 additions and 247 deletions

View File

@ -1,6 +1,9 @@
package com.yunbao.common.bean;
import android.text.TextUtils;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.views.weight.FullServiceNotificationView;
public class MsgModel extends BaseModel {
/**
@ -19,7 +22,7 @@ public class MsgModel extends BaseModel {
@SerializedName("user_name")
private String userName = "";
@SerializedName("noble_id")
private long nobleId = 0;
private String nobleId = "";
@SerializedName("trumpet_msg")
private String trumpetMsg = "";
@SerializedName("anchor_id")
@ -52,11 +55,11 @@ public class MsgModel extends BaseModel {
return this;
}
public long getNobleId() {
public String getNobleId() {
return nobleId;
}
public MsgModel setNobleId(long nobleId) {
public MsgModel setNobleId(String nobleId) {
this.nobleId = nobleId;
return this;
}
@ -78,4 +81,27 @@ public class MsgModel extends BaseModel {
this.anchorId = anchorId;
return this;
}
/**
* 获取贵族等级
*
* @return
*/
public FullServiceNotificationView.RoleType getRoleType() {
if (TextUtils.isEmpty(nobleId)) {
return null;
} else {
FullServiceNotificationView.RoleType roleType = null;
if (TextUtils.equals(nobleId, "5")) {
roleType = FullServiceNotificationView.RoleType.KING;
} else if (TextUtils.equals(nobleId, "6")) {
roleType = FullServiceNotificationView.RoleType.EMPEROR;
} else if (TextUtils.equals(nobleId, "7")) {
roleType = FullServiceNotificationView.RoleType.BETTER_EMPEROR;
} else {
}
return roleType;
}
}
}

View File

@ -35,9 +35,9 @@ import static com.yunbao.common.CommonAppContext.isReady;
*/
public class RongcloudIMManager {
//融云开发者平台注册app唯一识别符
public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
// public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
//测试环境
// public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
private static final String CLASSNAME = "RongcloudIMManager";

View File

@ -0,0 +1,238 @@
package com.yunbao.common.views.weight;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.opensource.svgaplayer.SVGACallback;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.R;
import com.yunbao.common.glide.ImgLoader;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Field;
/**
* 全服通知
*/
public class FullServiceNotificationView extends FrameLayout {
private Context mContext;
private View rootView;
private SVGAImageView svagaBc;
private ImageView iconImg;
private TextView gotoRoomView, rcUserText;
private GradientColorTextView rcUserName;
private RoleType type;
private RelativeLayout contextLayout;
private long animationTime = 8600;
private String userName = "熱度卡如何獲得?", userText = "前往「個人中心」-「我的包裹」中,即可使用熱度卡。";
public FullServiceNotificationView(@NonNull Context context) {
super(context);
init(context);
}
public FullServiceNotificationView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context);
}
public FullServiceNotificationView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
public FullServiceNotificationView setUserNameAndUserText(String userName, String userText) {
this.userName = userName;
this.userText = userText;
rcUserText.setText(":" + userText);
rcUserName.setGradientColor(Color.parseColor("#FFFFFF"), Color.parseColor("#FFEF00"));
return this;
}
private void init(Context context) {
mContext = context;
rootView = LayoutInflater.from(mContext).inflate(R.layout.view_full_service_notification, this, true);
svagaBc = rootView.findViewById(R.id.svaga_bc);
iconImg = rootView.findViewById(R.id.icon_img);
gotoRoomView = rootView.findViewById(R.id.goto_room_view);
iconImg = rootView.findViewById(R.id.icon_img);
rcUserName = rootView.findViewById(R.id.rc_user_name);
rcUserText = rootView.findViewById(R.id.rc_user_text);
contextLayout = rootView.findViewById(R.id.context_layout);
gotoRoomView.setVisibility(GONE);
contextLayout.setVisibility(GONE);
}
public FullServiceNotificationView setType(RoleType type) {
this.type = type;
switch (type) {
case KING:
ImgLoader.display(mContext, R.mipmap.imng_guowang, iconImg);
setFullServiceStart("icon_livemsgbg_guowang.svga");
break;
case EMPEROR:
ImgLoader.display(mContext, R.mipmap.img_huangdi, iconImg);
setFullServiceStart("icon_livemsgbg_huangdi.svga");
break;
case BETTER_EMPEROR:
ImgLoader.display(mContext, R.mipmap.img_chaohuang, iconImg);
setFullServiceStart("icon_livemsgbg_chaohuang.svga");
break;
}
return this;
}
private void setFullServiceStart(String svgaName) {
svagaBc.setCallback(svgaCallback);
svagaBc.setLoops(1);
svagaBc.startAnimation();
new SVGAParser(mContext)
.decodeFromAssets(svgaName, new SVGAParser.ParseCompletion() {
@Override
public void onComplete(@NotNull SVGAVideoEntity svgaVideoEntity) {
svagaBc.setVisibility(VISIBLE);
SVGADrawable imageView = new SVGADrawable(svgaVideoEntity);
svagaBc.setImageDrawable(imageView);
try {
Field mAnimator = svagaBc.getClass().getDeclaredField("mAnimator");
mAnimator.setAccessible(true);
ValueAnimator animator = (ValueAnimator) mAnimator.get(svagaBc);
animationTime = animator.getDuration();
System.out.println("播放时间 = " + animator.getDuration());
} catch (Exception e) {
e.printStackTrace();
}
svagaBc.startAnimation();
}
@Override
public void onError() {
}
}, null);
}
private SVGACallback svgaCallback = new SVGACallback() {
@Override
public void onPause() {
}
@Override
public void onFinished() {
svagaBc.clear();
svagaBc.setVisibility(GONE);
gotoRoomView.setVisibility(GONE);
}
@Override
public void onRepeat() {
}
@Override
public void onStep(int frame, double v) {
System.out.println("frame = " + frame);
if (frame == 12) {
gotoRoomView.setVisibility(VISIBLE);
contextLayout.setVisibility(VISIBLE);
contextLayout.post(() -> {
TranslateAnimation animationTranslate = new TranslateAnimation(0, -contextLayout.getMeasuredWidth(), 0, 0);
AnimationSet animationSet1 = new AnimationSet(true);
animationSet1.addAnimation(animationTranslate);
animationSet1.setFillAfter(true);
animationSet1.setDuration((animationTime - 800) / 2);
animationSet1.setAnimationListener(animationListener);
contextLayout.startAnimation(animationSet1);
});
}
if (frame == 165) {
gotoRoomView.setVisibility(GONE);
contextLayout.setVisibility(GONE);
}
}
};
Animation.AnimationListener animationListener = new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
contextLayout.clearAnimation();
if (svagaBc.isAnimating()) {
TranslateAnimation animationTranslate = new TranslateAnimation(0, -contextLayout.getMeasuredWidth(), 0, 0);
AnimationSet animationSet1 = new AnimationSet(true);
animationSet1.addAnimation(animationTranslate);
animationSet1.setFillAfter(true);
animationSet1.setDuration((animationTime - 800) / 2);
animationSet1.setAnimationListener(animationListener);
contextLayout.startAnimation(animationSet1);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
};
/**
* 角色类型
*/
public enum RoleType {
KING("国王", 5),
EMPEROR("皇帝", 6),
BETTER_EMPEROR("超皇", 7);
private String name;
private int type;
RoleType(String name, int type) {
this.name = name;
this.type = type;
}
public String getName() {
return name;
}
public RoleType setName(String name) {
this.name = name;
return this;
}
public int getType() {
return type;
}
public RoleType setType(int type) {
this.type = type;
return this;
}
}
}

View File

@ -0,0 +1,55 @@
package com.yunbao.common.views.weight;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Shader;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
/**
* 文字渐变
*/
public class GradientColorTextView extends AppCompatTextView {
private LinearGradient mLinearGradient;
private Paint mPaint;
private int mViewWidth = 0;
private Rect mTextBound = new Rect();
private int fromColor, toColor;
public GradientColorTextView(@NonNull Context context) {
super(context);
}
public GradientColorTextView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public GradientColorTextView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void setGradientColor(int fromColor, int toColor) {
this.fromColor = fromColor;
this.toColor = toColor;
}
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
mViewWidth = getMeasuredHeight();
mPaint = getPaint();
String mTipText = getText().toString();
mPaint.getTextBounds(mTipText, 0, mTipText.length(), mTextBound);
mLinearGradient = new LinearGradient(0, 0, 0, mViewWidth,
new int[]{fromColor, toColor},
null, Shader.TileMode.REPEAT);
mPaint.setShader(mLinearGradient);
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
}
}

View File

@ -1,6 +1,7 @@
package com.yunbao.common.views.weight;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
@ -24,4 +25,6 @@ public class MarqueeTextView extends AppCompatTextView {
public boolean isFocused() {
return true;
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="ring">
<gradient android:angle="90" android:endColor="#FFFFFF" android:startColor="#FFEF00" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="100dp">
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svaga_bc"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/goto_room_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="42dp"
android:layout_marginEnd="19dp"
android:background="@drawable/background_whole_station_horn"
android:paddingLeft="7dp"
android:paddingTop="3dp"
android:paddingRight="7dp"
android:paddingBottom="3dp"
android:text="@string/use_live"
android:textColor="#FFFEFEFE"
android:textSize="10dp" />
<ViewFlipper
android:id="@+id/viewflipper_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="19dp"
android:layout_marginTop="42dp"
android:layout_marginEnd="20dp"
android:layout_toStartOf="@+id/goto_room_view"
android:inAnimation="@anim/vice_screen_come_in"
android:outAnimation="@anim/vice_screen_come_out"
android:visibility="gone" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="19dp"
android:layout_marginTop="42dp"
android:layout_marginEnd="20dp"
android:layout_toStartOf="@+id/goto_room_view"
android:animateLayoutChanges="true"
android:gravity="center_vertical"
android:visibility="visible">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<RelativeLayout
android:id="@+id/context_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/icon_img"
android:layout_width="52dp"
android:layout_height="20.5dp"
android:layout_centerVertical="true"
android:layout_marginStart="7dp"
android:src="@mipmap/img_chaohuang" />
<com.yunbao.common.views.weight.GradientColorTextView
android:id="@+id/rc_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="7dp"
android:layout_toEndOf="@id/icon_img"
android:lines="1"
android:text="@string/live_hot_ruletext2"
android:textSize="12sp" />
<TextView
android:id="@+id/rc_user_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="3dp"
android:layout_toEndOf="@id/rc_user_name"
android:lines="1"
android:text="@string/live_hot_ruletext22"
android:textColor="#FFFFFFFF"
android:textSize="12sp" />
</RelativeLayout>
</HorizontalScrollView>
</RelativeLayout>
</RelativeLayout>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="19dp"
android:layout_marginTop="42dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/context_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:gravity="center_vertical"
android:visibility="visible">
<ImageView
android:id="@+id/icon_img"
android:layout_width="52dp"
android:layout_height="20.5dp"
android:layout_marginStart="7dp"
android:src="@mipmap/img_chaohuang" />
<TextView
android:id="@+id/rc_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:lines="1"
android:text="@string/live_hot_ruletext2"
android:textColor="#FFEF00"
android:textSize="12sp" />
<TextView
android:id="@+id/rc_user_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:lines="1"
android:text="@string/live_hot_ruletext22"
android:textColor="#FFFFFFFF"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -695,23 +695,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
@Override
public void onLinkMicPkStart(final String pkUid, final String pkhead, final String pkname) {
Log.e("ry", "pkUid" + pkUid + "pkhead" + pkhead + "pkname" + pkname);
// if (isRy == false) {
// if (mLiveLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkStart(pkUid, pkhead, pkname);
// Handler handler = new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// if (mLiveRoomViewHolder != null) {
// if (mIsAnchor == false) {
// mLiveRoomViewHolder.setOtherInfo(pkUid, pkhead, pkname);
// }
// }
// }
// }, 4000);//3秒后执行Runnable中的run方法
//
// }
// } else {
if (mLiveRyLinkMicPkPresenter != null && mLiveRoomViewHolder != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkStart(pkUid, 1);
Handler handler = new Handler();
@ -728,7 +711,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
}, 4000);//3秒后执行Runnable中的run方法
}
// }
}
@ -737,16 +719,10 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onLinkMicPkClose(int i) {
// if (isRy == false) {
// if (mLiveLinkMicPkPresenter != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
// }
// } else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkClose(i);
} else if (mLiveLinkMicPkPresenter != null) {
mLiveLinkMicPkPresenter.onLinkMicPkClose(i);
// }
}
}
@ -779,12 +755,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
@Override
public void onLinkMicPkEnd(String winUid) {
// if (isRy == false) {
// if (mLiveLinkMicPkPresenter != null) {
// mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
// mLiveRoomViewHolder.setDelOtherInfo();
// }
// } else {
if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo();
@ -792,7 +762,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mLiveLinkMicPkPresenter.onLinkMicPkEnd(winUid);
mLiveRoomViewHolder.setDelOtherInfo();
}
// }
}
@ -945,11 +914,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
onCoinChanged(coin);
}
String[] data = new String[]{obj.getString("barragetoken")};
// if (isRy == false) {
// SocketChatUtil.sendDanmuMessage(mLiveUid, contents);
// } else {
SocketRyChatUtil.sendDanmuMessage(mLiveUid, contents);
// }
} else {
ToastUtil.show(msg);
}
@ -969,22 +934,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
}
}
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
// if (isRy == false) {
// SocketChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
// } else {
SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType);
// }
}
/**
* 系统 消息
*/
public static void sendSystemMessage(String content) {
// if (isRy == false) {
// SocketChatUtil.sendSystemMessage(mLiveUid, content);
// } else {
SocketRyChatUtil.sendSystemMessage(mLiveUid, content);
// }
}
@ -993,12 +950,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
*/
public void sendGiftMessage(LiveGiftBean giftBean, String giftToken, String ancherName, String by) {
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
// if (isRy == false) {
// SocketChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
// } else {
SocketRyChatUtil.sendGiftMessage(giftBean.getType(), giftToken, mLiveUid, ancherName, guardType, by);
// }
}
@ -1006,33 +958,21 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 主播或管理员踢人
*/
public void kickUser(String toUid, String toName) {
// if (isRy == false) {
// SocketChatUtil.sendKickMessage(mLiveUid, toUid, toName);
// } else {
SocketRyChatUtil.sendKickMessage(mLiveUid, toUid, toName);
// }
}
/**
* 禁言
*/
public void setShutUp(String toUid, String toName, int type) {
// if (isRy == false) {
// SocketChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
// } else {
SocketRyChatUtil.sendShutUpMessage(mLiveUid, toUid, toName, type);
// }
}
/**
* 设置或取消管理员消息
*/
public void sendSetAdminMessage(int action, String toUid, String toName) {
// if (isRy == false) {
// SocketChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
// } else {
SocketRyChatUtil.sendSetAdminMessage(mLiveUid, action, toUid, toName);
// }
}
@ -1040,22 +980,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 超管关闭直播间
*/
public void superCloseRoom() {
// if (isRy == false) {
// SocketChatUtil.superCloseRoom(mLiveUid);
// } else {
SocketRyChatUtil.superCloseRoom(mLiveUid);
// }
}
/**
* 更新主播映票数
*/
public void sendUpdateVotesMessage(int deltaVal) {
// if (isRy == false) {
// SocketChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
// } else {
SocketRyChatUtil.sendUpdateVotesMessage(mLiveUid, deltaVal);
// }
}
@ -1063,20 +995,12 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 发送购买守护成功消息
*/
public void sendBuyGuardMessage(String votes, int guardNum, int guardType) {
// if (isRy == false) {
// SocketChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
// } else {
SocketRyChatUtil.sendBuyGuardMessage(mLiveUid, votes, guardNum, guardType);
// }
}
public void sendBuyGuardMessage2(String votes, int guardNum, int guardType, String ancherName, String liveId) {
if (guardType != 1) {
// if (isRy == false) {
// SocketChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
// } else {
SocketRyChatUtil.sendBuyGuardMessage2(mLiveUid, votes, guardNum, guardType, ancherName, liveId);
// }
}
}
@ -1084,11 +1008,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
* 发送发红包成功消息
*/
public void sendRedPackMessage() {
// if (isRy == false) {
// SocketChatUtil.sendRedPackMessage(mLiveUid);
// } else {
SocketRyChatUtil.sendRedPackMessage(mLiveUid);
// }
}
@ -1196,8 +1116,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
public void onItemClick(String type) {
if (Constants.LINK.equals(type)) {
copyLink();
} else {
// shareLive(type, null);
}
}
@ -1271,9 +1189,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
@Override
public void onSuccess(int code, String msg, String[] info) {
List<GuardUserBean> list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class);
if(list.isEmpty()){
if (list.isEmpty()) {
openNewBuyGuardWindow(true);
}else {
} else {
LiveNewGuardListDialogFragment fragment = new LiveNewGuardListDialogFragment();
fragment.setList(list);
fragment.setLiveGuardInfo(mLiveGuardInfo);
@ -1353,7 +1271,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
bundle.putString(Constants.STREAM, mStream);
bundle.putString(Constants.LIVE_ANCHER_ICON, mAncherIcon);
bundle.putString(Constants.USER_ICON, CommonAppConfig.getInstance().getUserBean().getAvatar());
bundle.putBoolean("guard",isEmpty);
bundle.putBoolean("guard", isEmpty);
fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment");
}

View File

@ -577,7 +577,6 @@ public class LiveAudienceActivity extends LiveActivity {
if (verticalViewPager.ismEnableScroll()) {
LiveBean liveBean = e.getLiveBean();
if (liveBean != null) {
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
@ -590,13 +589,10 @@ public class LiveAudienceActivity extends LiveActivity {
mAncherName = liveBean.getUserNiceName();
mAncherIcon = liveBean.getAvatar();
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
}
} else {
verticalViewPager.setEnableScroll(true);
}
}
@Override
@ -774,11 +770,6 @@ public class LiveAudienceActivity extends LiveActivity {
verticalViewPager.setCurrentItem(mCurrentPage + 1);
break;
case REFRESH_THE_LIVEl_PAGE:
// loadingView.show();
// AnchorRecommendItemModel model = event.getAnchorRecommendItemModel();
// itemModelList.add(0, model);
// mPagerAdapter.notifyDataSetChanged();
// verticalViewPager.setCurrentItem(0);
getDrawer();
break;
case REPORT:
@ -802,6 +793,9 @@ public class LiveAudienceActivity extends LiveActivity {
case ONLINE:
toSysMsgWeb("3");
break;
case TRUMPET_NOTIFY:
manager.showFullScreen(event.getMsgModel());
break;
}

View File

@ -171,7 +171,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
//单选选中监听
radioHornType.setOnCheckedChangeListener(changeListener);
radioHornType.getCheckedRadioButtonId();
// netHandler.post(getNobleTrumpetNumRunnable);
netHandler.post(getNobleTrumpetNumRunnable);
}
@Override

View File

@ -3,6 +3,7 @@ package com.yunbao.live.event;
import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.bean.OpenParametersModel;
@ -16,7 +17,16 @@ public class LiveAudienceEvent extends BaseModel {
private LiveBean bean;
private int liveType;
private int liveTypeVal;
private MsgModel msgModel;//全服消息
public MsgModel getMsgModel() {
return msgModel;
}
public LiveAudienceEvent setMsgModel(MsgModel msgModel) {
this.msgModel = msgModel;
return this;
}
public int getLiveType() {
return liveType;
@ -118,7 +128,8 @@ public class LiveAudienceEvent extends BaseModel {
REPORT(16, "舉報"),
POPULAR(17, "人气票任务"),
NOTICE(18, "系统通知"),
ONLINE(19, "在线客服");
ONLINE(19, "在线客服"),
TRUMPET_NOTIFY(20, "全服喇叭");
private int type;
private String name;

View File

@ -19,6 +19,7 @@ import com.yunbao.common.bean.SocketModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
@ -35,6 +36,7 @@ import com.yunbao.live.bean.LiveLuckGiftWinBean;
import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.bean.LiveUserGiftBean;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.views.LiveEndViewHolder;
import com.yunbao.live.views.LivePlayKsyViewHolder;
import com.yunbao.live.views.LivePlayRyViewHolder;
@ -369,7 +371,7 @@ public class SocketRyClient {
mListener.onPrizePoolUp(map.getString("uplevel"));
break;
case Constants.SOCKET_HOUR://小时榜
liveChatBean=new LiveChatBean();
liveChatBean = new LiveChatBean();
liveChatBean.setId("-1");
liveChatBean.setType(LiveChatAdapter.MSG_HOUR_RANK_CHANGE);
liveChatBean.setContent(map.getJSONObject("ct").getString("text"));
@ -451,7 +453,10 @@ public class SocketRyClient {
SocketModel model = GsonUtils.fromJson(socketMsg, SocketModel.class);
List<MsgModel> msg = model.getMsg();
if (msg.size() > 0) {
EventBus.getDefault().post(msg.get(0));
// EventBus.getDefault().post(msg.get(0));
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.TRUMPET_NOTIFY)
.setMsgModel(msg.get(0)));
}
break;
}

View File

@ -20,14 +20,12 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.ViewFlipper;
import com.opensource.svgaplayer.SVGACallback;
import com.opensource.svgaplayer.SVGADrawable;
import com.opensource.svgaplayer.SVGAImageView;
import com.opensource.svgaplayer.SVGAParser;
import com.opensource.svgaplayer.SVGAVideoEntity;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.NewPeopleInfo;
import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.glide.ImgLoader;
@ -70,7 +68,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
private String url;
private View v_msg_redpoint, stationHornBanner;
private Activity context;
private SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow, svga_station_horn;
private SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow;
private ViewFlipper viewFlipper;
private TextView goToRomm;
private int icon = 0;
@ -191,7 +189,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
svga_new_user_gif = (SVGAImageView) findViewById(R.id.svga_new_user_gif);
svga_new_user_double = (SVGAImageView) findViewById(R.id.svga_new_user_double);
svga_new_user_follow = (SVGAImageView) findViewById(R.id.svga_new_user_follow);
svga_station_horn = (SVGAImageView) findViewById(R.id.svga_station_horn);
viewFlipper = (ViewFlipper) findViewById(R.id.viewflipper_banner);
stationHornBanner = findViewById(R.id.station_horn_banner);
liveNewPeople.setOnClickListener(this);
@ -239,65 +236,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
v_msg_redpoint = (View) findViewById(R.id.v_msg_redpoint);
//获取系统未读消息
MessageIMManager.get(mContext).getSystemMessages();
//全站喇叭
svga_station_horn.setCallback(new SVGACallback() {
@Override
public void onPause() {
}
@Override
public void onFinished() {
}
@Override
public void onRepeat() {
}
@Override
public void onStep(int frame, double percentage) {
Log.e("SVGADynamicEntity", "frame" + frame);
Log.e("SVGADynamicEntity", "percentage" + percentage);
if ((int) (percentage * 100) == 5) {
viewFlipper.removeAllViews();
stationHornBanner.setVisibility(View.VISIBLE);
if ((nobleName + nobleTtext).length() > 15) {
for (int i = 0; i < 2; i++) {
//展示内容子布局
View childrenView = LayoutInflater.from(mContext).inflate(R.layout.view_whole_station_horn, null, false);
ImageView iconImg = childrenView.findViewById(R.id.icon_img);
TextView userName = childrenView.findViewById(R.id.rc_user_name);
TextView userText = childrenView.findViewById(R.id.rc_user_text);
userName.setText(nobleName);
userText.setText(" : " + nobleTtext);
ImgLoader.display2(mContext, icon, iconImg);
viewFlipper.addView(childrenView);
}
} else {
//展示内容子布局
View childrenView = LayoutInflater.from(mContext).inflate(R.layout.view_whole_station_horn, null, false);
ImageView iconImg = childrenView.findViewById(R.id.icon_img);
TextView userName = childrenView.findViewById(R.id.rc_user_name);
TextView userText = childrenView.findViewById(R.id.rc_user_text);
userName.setText(nobleName);
userText.setText(" : " + nobleTtext);
ImgLoader.display2(mContext, icon, iconImg);
viewFlipper.addView(childrenView);
}
}
if ((int) (percentage * 100) == 50 && viewFlipper.getChildCount() > 1) {
viewFlipper.showNext();
}
if ((int) (percentage * 100) == 92) {
stationHornBanner.setVisibility(View.GONE);
}
}
});
//底部改造
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.total_image), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
@ -440,7 +379,8 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
public void onMessageIMEvent(MessageIMEvent event) {
//判断消息中心红点是否已经展示如果已经展示并且未读消息大于0则不再执行之后的逻辑
int number = event.getMessage();
if (v_msg_redpoint.getVisibility() == View.VISIBLE && number > 0 || SpUtil.getInstance().getBooleanValue("private_chat_message_switch")) return;
if (v_msg_redpoint.getVisibility() == View.VISIBLE && number > 0 || SpUtil.getInstance().getBooleanValue("private_chat_message_switch"))
return;
if (number > 0) {
v_msg_redpoint.setVisibility(View.VISIBLE);
} else {
@ -520,41 +460,5 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
return bitmap;
}
/**
* 全站喇叭
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMsgModelEvent(MsgModel model) {
nobleName = model.getUserName();
nobleTtext = model.getTrumpetMsg();
if (!svga_station_horn.isAnimating()) {
svga_station_horn.setLoops(1);
String backPath = "";
if (model.getNobleId() == 5) {
backPath = "icon_livemsgbg_guowang.svga";
icon = R.mipmap.imng_guowang;
} else if (model.getNobleId() == 6) {
backPath = "icon_livemsgbg_huangdi.svga";
icon = R.mipmap.img_huangdi;
} else {
backPath = "icon_livemsgbg_chaohuang.svga";
icon = R.mipmap.img_chaohuang;
}
new SVGAParser(mContext).decodeFromAssets(backPath, new SVGAParser.ParseCompletion() {
@Override
public void onComplete(SVGAVideoEntity videoItem) {
SVGADrawable drawable = new SVGADrawable(videoItem);
svga_station_horn.setImageDrawable(drawable);
svga_station_horn.startAnimation();
}
@Override
public void onError() {
Log.e("errqs", "errl");
}
}, null);
}
}
}

View File

@ -58,6 +58,7 @@ import com.yunbao.common.bean.BannerBean;
import com.yunbao.common.bean.HourRank;
import com.yunbao.common.bean.LevelBean;
import com.yunbao.common.bean.LiveGiftBean;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API;
@ -78,6 +79,7 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.utils.formatBigNum;
import com.yunbao.common.views.AbsViewHolder;
import com.yunbao.common.views.weight.FullServiceNotificationView;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
@ -282,6 +284,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private ConstraintLayout msgLayout; //悬浮窗
private TextView msgNumber;//悬浮窗左上角数标
private RoundedImageView msgUserIcon; //悬浮窗icon
private FullServiceNotificationView fullScreen;//全副喇叭
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
super(context, parentView);
@ -605,6 +608,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public void init() {
EventBus.getDefault().register(this);
btnEvent = findViewById(R.id.btn_event);
fullScreen = (FullServiceNotificationView) findViewById(R.id.full_screen);
btnEvent3 = findViewById(R.id.btn_event3);
imgEvent = (ImageView) findViewById(R.id.img_event);
btn_event2 = (LinearLayout) findViewById(R.id.btn_event2);
@ -731,7 +735,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();
}
@ -1708,7 +1712,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();
}
@ -1800,7 +1805,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);
@ -1809,7 +1814,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
}
changeMsgView(msg2,msg);
changeMsgView(msg2, msg);
}
@Override
@ -2873,4 +2878,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
/**
* 全服喇叭
*
* @param msgModel
*/
public void showFullScreen(MsgModel msgModel) {
fullScreen.setUserNameAndUserText(msgModel.getUserName(), msgModel.getTrumpetMsg())
.setType(msgModel.getRoleType());
}
}

View File

@ -31,6 +31,7 @@ import com.tencent.imsdk.v2.V2TIMManager;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.custom.MyViewPager;
import com.yunbao.common.event.FollowEvent;
@ -535,7 +536,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
//是否处于返回键
//是否处于返回键 全服通知
private boolean isBackPressed = false;
@Override
@ -1514,4 +1515,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
/**
* 全服喇叭
*
* @param msgModel
*/
public void showFullScreen(MsgModel msgModel) {
mLiveRoomViewHolder.showFullScreen(msgModel);
}
}

View File

@ -58,7 +58,7 @@
android:drawableStart="@mipmap/icon_world_horn"
android:text="@string/whole_station_horn"
android:textColor="#FFB1B6C7"
android:visibility="gone"
android:visibility="visible"
android:textSize="12sp" />
<View

View File

@ -110,6 +110,7 @@
app:indicator_width="8dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_event"
android:layout_width="68dp"
@ -127,10 +128,10 @@
android:layout_height="match_parent"
android:src="@drawable/live_turntable" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp">
</LinearLayout>
android:layout_height="30dp"></LinearLayout>
</LinearLayout>
<LinearLayout
@ -865,6 +866,7 @@
</LinearLayout>
</RelativeLayout>
<com.yunbao.common.custom.MyFrameLayout2
@ -975,7 +977,7 @@
</LinearLayout>
<FrameLayout
android:id="@+id/live_video"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_below="@id/lin">
@ -2077,5 +2079,10 @@
</RelativeLayout>
</LinearLayout>
<com.yunbao.common.views.weight.FullServiceNotificationView
android:id="@+id/full_screen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/live_video" />
</RelativeLayout>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/icon_img"
android:layout_width="44dp"
android:layout_height="22dp"
android:layout_marginStart="7dp" />
<TextView
android:id="@+id/rc_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginBottom="1dp"
android:text="dasdas"
android:textColor="#FFFFEF00"
android:textSize="12dp" />
<TextView
android:id="@+id/rc_user_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="3dp"
android:layout_marginBottom="1dp"
android:text="dasdas"
android:textColor="#FFFFFFFF"
android:textSize="12dp" />
</LinearLayout>

View File

@ -24,7 +24,6 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="9dp"
android:layout_marginBottom="5dp"
android:background="@drawable/background_whole_station_horn"
android:paddingLeft="7dp"
android:paddingTop="3dp"
android:paddingRight="7dp"