喇叭,个人中心贵族添加中心

This commit is contained in:
18401019693 2022-08-03 18:24:52 +08:00
parent e5cf353597
commit 805ca91637
19 changed files with 739 additions and 432 deletions

View File

@ -46,7 +46,12 @@ public class ImgLoader {
}
Glide.with(context).asDrawable().load(url).placeholder(imageView.getDrawable()).dontAnimate().skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
}
public static void display2(Context context, int url, ImageView imageView) {
if (!contextIsExist(context)){
return;
}
Glide.with(context).asDrawable().load(url).placeholder(imageView.getDrawable()).dontAnimate().skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
}
public static void displayWithError(Context context, String url, ImageView imageView, int errorRes) {
if (!contextIsExist(context)){
return;

View File

@ -2,8 +2,11 @@ package com.yunbao.common.manager.imrongcloud;
import android.util.Log;
import java.util.List;
import io.rong.imkit.IMCenter;
import io.rong.imkit.MessageInterceptor;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.Message;
import io.rong.message.TextMessage;
@ -26,6 +29,30 @@ public class PDMessageInterceptor implements MessageInterceptor {
IMCenter.getInstance().clearMessagesUnreadStatus(Conversation.ConversationType.PRIVATE, message.getTargetId(), null);
// return true;
}
RongIMClient.getInstance().getHistoryMessages(Conversation.ConversationType.PRIVATE, message.getTargetId(), -1, 10,
new RongIMClient.ResultCallback<List<Message>>() {
/**
* 成功时回调
*
* @param messages 获取的消息列表
*/
@Override
public void onSuccess(List<Message> messages) {
if (messages.size() == 0||(messages.size()==1&&((TextMessage) messages.get(0).getContent()).getContent().contains("LivePK"))) {
IMCenter.getInstance().removeConversation(Conversation.ConversationType.PRIVATE, message.getTargetId(), null);
}
}
/**
* 错误时回调
*
* @param e 错误码
*/
@Override
public void onError(RongIMClient.ErrorCode e) {
}
});
}
return false;
}

View File

@ -865,4 +865,5 @@
<string name="back">返回</string>
<string name="go_nobility">前往贵族</string>
<string name="use_successfully">使用成功</string>
<string name="use_live">前往直播間</string>
</resources>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,6 +14,7 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.FansMedalBean;
import com.yunbao.common.bean.MsgModel;
import com.yunbao.common.bean.SocketModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.HttpCallback;
@ -441,8 +442,10 @@ public class SocketRyClient {
break;
case Constants.TRUMPET_NOTIFY://全站喇叭
SocketModel model = GsonUtils.fromJson(socketMsg, SocketModel.class);
Log.e(Constants.TRUMPET_NOTIFY,model.getMsg().get(0).getTrumpetMsg());
Log.e(Constants.TRUMPET_NOTIFY,model.getMsg().get(0).getUserName());
List<MsgModel> msg = model.getMsg();
if (msg.size() > 0) {
EventBus.getDefault().post(msg.get(0));
}
break;
}
}

View File

@ -1,28 +1,39 @@
package com.yunbao.live.views;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.ViewFlipper;
import com.alibaba.fastjson.JSONObject;
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.event.MessageIMEvent;
import com.yunbao.common.event.UpdateTablePoint;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
@ -41,11 +52,6 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.net.MalformedURLException;
import java.net.URL;
import static com.yunbao.live.views.LiveRoomViewHolder.mNameText;
/**
* Created by cxf on 2018/10/9.
* 观众直播间逻辑
@ -58,9 +64,13 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
private String url;
private LinearLayout lt_trickery;
private TextView tv_trickery_time;
private View v_msg_redpoint;
private View v_msg_redpoint, stationHornBanner;
private Activity context;
private SVGAImageView svga_new_user_gif,svga_new_user_double,svga_new_user_follow;
private SVGAImageView svga_new_user_gif, svga_new_user_double, svga_new_user_follow, svga_station_horn;
private ViewFlipper viewFlipper;
private TextView goToRomm;
private int icon = 0;
private String nobleName, nobleTtext;
public LiveAudienceViewHolder(Context context, ViewGroup parentView) {
super(context, parentView);
@ -117,6 +127,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
}
});
}
private void svga_new_user_double() {
new SVGAParser(mContext).decodeFromAssets("double_click_tip.svga", new SVGAParser.ParseCompletion() {
@Override
@ -133,6 +144,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
}
});
}
private void svga_new_user_follow() {
new SVGAParser(mContext).decodeFromAssets("live_follow_tip.svga", new SVGAParser.ParseCompletion() {
@Override
@ -149,6 +161,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
});
}
@Override
protected int getLayoutId() {
return R.layout.view_live_audience;
@ -166,8 +179,9 @@ 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);
svga_new_user_double.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -217,6 +231,65 @@ 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);
}
}
});
}
public static Handler handler = new Handler();
@ -503,4 +576,83 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
super.release();
EventBus.getDefault().unregister(this);
}
/**
* 绘制全站喇叭的样式
*
* @return
*/
@SuppressLint("SetTextI18n")
private Bitmap canvasBitmap(int icon, String name, String text) {
// Log.e("SVGADynamicEntity", "子布局宽度:" + name);
// Log.e("SVGADynamicEntity", "fu布局宽度" + text);
//计算设备分辨率
WindowManager manager = ((Activity) mContext).getWindowManager();
DisplayMetrics metrics = new DisplayMetrics();
manager.getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
int height = metrics.heightPixels;
View view = LayoutInflater.from(mContext).inflate(R.layout.view_whole_station_horn_layout, null, false);
ViewFlipper viewFlipper = view.findViewById(R.id.viewflipper_banner);
//展示内容子布局
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(name);
userText.setText(" : " + text);
ImgLoader.display2(mContext, icon, iconImg);
viewFlipper.addView(childrenView);
//测量使得view指定大小
int measureWidth = View.MeasureSpec.makeMeasureSpec(width / 3 * 2 - 30, View.MeasureSpec.AT_MOST);
int measureHeight = View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.AT_MOST);
view.measure(measureWidth, measureHeight);
//调用layout方法布局后可以得到view的尺寸
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
// Log.e("SVGADynamicEntity", "子布局宽度:" + childrenView.getWidth());
// Log.e("SVGADynamicEntity", "fu布局宽度" + (width / 3 * 2 - 30));
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas bitmapCanvas = new Canvas(bitmap);
bitmapCanvas.drawColor(Color.TRANSPARENT);
view.draw(bitmapCanvas);
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");
}
});
}
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromXDelta="100%p"
android:toXDelta="0%p" />
<translate
android:fromXDelta="100%p"
android:toXDelta="0%p" />
</set>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="1000"
android:fromXDelta="0%p"
android:toXDelta="-100%p" />
<translate
android:duration="1000"
android:fromXDelta="0%p"
android:toXDelta="-100%p" />
</set>

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="11dp" />
<gradient android:angle="360" android:endColor="#FFFBD040" android:startColor="#FFFF5655" />
</shape>
</item>
</selector>

View File

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

View File

@ -10,12 +10,14 @@
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/chart_room_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:orientation="vertical">
<LinearLayout
android:id="@+id/btn_turntable"
android:layout_width="76dp"
@ -65,18 +67,18 @@
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_marginBottom="18dp"
android:gravity="center_horizontal"
android:background="@mipmap/live_mission_box"
android:visibility="gone"
android:orientation="vertical">
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<com.ms.banner.Banner
android:id="@+id/banner3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
app:delay_time="5000"
app:indicator_height="8dp"
app:indicator_width="8dp" />
@ -104,16 +106,6 @@
</LinearLayout>
<!-- <ImageView-->
<!-- android:id="@+id/btn_event2"-->
<!-- android:layout_width="68dp"-->
<!-- android:layout_height="102dp"-->
<!-- android:layout_gravity="right"-->
<!-- android:layout_marginRight="10dp"-->
<!-- android:layout_marginBottom="20dp"-->
<!-- android:gravity="center_horizontal"-->
<!-- android:orientation="vertical"/>-->
<LinearLayout
android:id="@+id/btn_event2"
android:layout_width="58dp"
@ -433,7 +425,6 @@
</LinearLayout>
</RelativeLayout>
</LinearLayout>
@ -443,20 +434,20 @@
android:id="@+id/svga_new_user_gif"
android:layout_width="116dp"
android:layout_height="40dp"
android:layout_marginBottom="40dp"
android:layout_marginRight="5dp"
android:layout_gravity="center_vertical"
app:autoPlay="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" />
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:layout_marginBottom="40dp"
app:autoPlay="true" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga_new_user_double"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="40dp"
android:layout_gravity="center_vertical"
android:layout_marginBottom="40dp"
app:autoPlay="true" />
@ -464,9 +455,29 @@
android:id="@+id/svga_new_user_follow"
android:layout_width="116dp"
android:layout_height="40dp"
android:layout_marginTop="80dp"
android:layout_gravity="center_vertical"
android:layout_marginTop="80dp"
app:autoPlay="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="360dp">
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga_station_horn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical" />
<include
android:id="@+id/station_horn_banner"
android:visibility="gone"
layout="@layout/view_whole_station_horn_layout" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,35 @@
<?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

@ -0,0 +1,37 @@
<?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="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginTop="32dp"
android:orientation="horizontal">
<ViewFlipper
android:id="@+id/viewflipper_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:layout_marginTop="17dp"
android:inAnimation="@anim/vice_screen_come_in"
android:outAnimation="@anim/vice_screen_come_out" />
<TextView
android:id="@+id/goto_room_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
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"
android:paddingBottom="3dp"
android:text="@string/use_live"
android:textColor="#FFFEFEFE"
android:textSize="10dp" />
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -4,8 +4,6 @@ import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Outline;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@ -16,6 +14,9 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ms.banner.Banner;
@ -295,7 +296,11 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi
user_noble_text.setText(u.getNoble_name());
user_noble_time.setText(mContext.getResources().getString(R.string.open_noble_text));
}
signature.setText(u.getSignature());
String singnature = u.getSignature();
if (TextUtils.equals(singnature, "貴族") || TextUtils.equals(singnature, "贵族")) {
singnature = singnature + "中心";
}
signature.setText(singnature);
CommonAppConfig appConfig = CommonAppConfig.getInstance();
LevelBean anchorLevelBean = appConfig.getAnchorLevel(u.getLevelAnchor());