Merge remote-tracking branch 'origin/master'

This commit is contained in:
zlzw 2022-10-06 17:43:43 +08:00
commit d7d980860c
10 changed files with 106 additions and 45 deletions

View File

@ -54,7 +54,7 @@ public class IMLoginManager extends BaseCacheManager {
* @return * @return
*/ */
public boolean isSlide() { public boolean isSlide() {
return getBoolean(IS_SLIDE, true); return getBoolean(IS_SLIDE, false);
} }
/** /**

View File

@ -201,9 +201,7 @@ public class LiveAudienceActivity extends LiveActivity {
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
} else { } else {
if (IMLoginManager.get(mContext).isSlide()){ verticalViewPager.setEnableScroll(IMLoginManager.get(mContext).isSlide());
verticalViewPager.setEnableScroll(true);
}
mCurrentItem = position; mCurrentItem = position;
Log.e(TAG, "mCurrentItem:" + mCurrentItem); Log.e(TAG, "mCurrentItem:" + mCurrentItem);
if (mCurrentItem == itemModelList.size() - 1) { if (mCurrentItem == itemModelList.size() - 1) {
@ -821,12 +819,10 @@ public class LiveAudienceActivity extends LiveActivity {
case SLIDE_SETTINGS: case SLIDE_SETTINGS:
SlideSettingsDialog slideSettingsDialog = new SlideSettingsDialog(); SlideSettingsDialog slideSettingsDialog = new SlideSettingsDialog();
slideSettingsDialog.show(getSupportFragmentManager(), "SlideSettingsDialog"); slideSettingsDialog.show(getSupportFragmentManager(), "SlideSettingsDialog");
slideSettingsDialog.setCallBack(new SlideSettingsDialog.SlideSettingsCallBack() { slideSettingsDialog.setCallBack(slide -> verticalViewPager.setEnableScroll(slide));
@Override break;
public void initSlide(boolean slide) { case NEW_MESSAGE_REMINDER:
verticalViewPager.setEnableScroll(slide); manager.showNewMessage();
}
});
break; break;
} }

View File

@ -1,5 +1,7 @@
package com.yunbao.live.adapter; package com.yunbao.live.adapter;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
@ -24,10 +26,13 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.bean.LiveChatBean; import com.yunbao.live.bean.LiveChatBean;
import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.utils.LiveTextRender; import com.yunbao.live.utils.LiveTextRender;
import com.yunbao.live.utils.LoadDian9TuUtil; import com.yunbao.live.utils.LoadDian9TuUtil;
import com.yunbao.live.views.LiveRoomViewHolder; import com.yunbao.live.views.LiveRoomViewHolder;
@ -37,8 +42,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
/** /**
* Created by cxf on 2018/10/10. * Created by cxf on 2018/10/10.
*/ */
@ -161,8 +164,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
void setData(final LiveChatBean bean, int position) { void setData(final LiveChatBean bean, int position) {
itemView.setTag(bean); itemView.setTag(bean);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(0, 0, 0, 12); params.setMargins(0, 0, DpUtil.dp2px(80), 12);
mBg.setLayoutParams(params); mBg.setLayoutParams(params);
if (bean.getType() == 6) {//大作战活动 if (bean.getType() == 6) {//大作战活动
view_action_game.setVisibility(View.VISIBLE); view_action_game.setVisibility(View.VISIBLE);
@ -359,7 +362,10 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
size = size - 1; size = size - 1;
} }
} }
//设置最大展示99条消息
if (size == 100) {
mList.remove(1);
}
mList.add(bean); mList.add(bean);
notifyItemChanged(size); notifyItemChanged(size);
@ -368,7 +374,27 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
mList.add(beanNull); mList.add(beanNull);
notifyItemChanged(size + 1); notifyItemChanged(size + 1);
if (isSlideToBottom(mRecyclerView)){
mRecyclerView.scrollToPosition(size + 1); mRecyclerView.scrollToPosition(size + 1);
}else {
Bus.get().post(new LiveAudienceEvent()
.setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));
}
}
/**
* 判断是否滚到底部
*
* @param recyclerView
* @return
*/
public static boolean isSlideToBottom(RecyclerView recyclerView) {
if (recyclerView == null) return false;
if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset()
>= recyclerView.computeVerticalScrollRange())
return true;
return false;
} }
public void removetItem(LiveChatBean bean) { public void removetItem(LiveChatBean bean) {

View File

@ -131,7 +131,8 @@ public class LiveAudienceEvent extends BaseModel {
ONLINE(19, "在线客服"), ONLINE(19, "在线客服"),
TRUMPET_NOTIFY(20, "全服喇叭"), TRUMPET_NOTIFY(20, "全服喇叭"),
RECOMMEND_CARD_NOTIFY(21, "贵族推荐通知"), RECOMMEND_CARD_NOTIFY(21, "贵族推荐通知"),
SLIDE_SETTINGS(22, "滑動設置") SLIDE_SETTINGS(22, "滑動設置"),
NEW_MESSAGE_REMINDER(23, "新消息提醒")
; ;
private int type; private int type;

View File

@ -1,5 +1,9 @@
package com.yunbao.live.views; package com.yunbao.live.views;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
@ -133,6 +137,7 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
@ -142,10 +147,6 @@ import io.rong.imlib.model.Conversation;
import io.rong.imlib.model.UserInfo; import io.rong.imlib.model.UserInfo;
import pl.droidsonroids.gif.GifImageView; import pl.droidsonroids.gif.GifImageView;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.bean.LiveChatBean.RECOMMEND_CARD_NOTIFY;
/** /**
* Created by cxf on 2018/10/9. * Created by cxf on 2018/10/9.
* 直播间公共逻辑 * 直播间公共逻辑
@ -204,7 +205,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public static String mNameText; public static String mNameText;
public static String mAvatarUrl; public static String mAvatarUrl;
public static FrameLayout ft_hot_add; public static FrameLayout ft_hot_add;
public static ImageView img_hot_gif; public static ImageView img_hot_gif, newMessage;
//多人PK //多人PK
static TextView time; static TextView time;
@ -670,9 +671,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mic_view2 = (RelativeLayout) findViewById(R.id.mic_view2); mic_view2 = (RelativeLayout) findViewById(R.id.mic_view2);
mic_ico = (ImageView) findViewById(R.id.mic_ico); mic_ico = (ImageView) findViewById(R.id.mic_ico);
newMessage = (ImageView) findViewById(R.id.new_message);
mic_ico1 = (RoundedImageView) findViewById(R.id.mic_ico1); mic_ico1 = (RoundedImageView) findViewById(R.id.mic_ico1);
mic_ico2 = (RoundedImageView) findViewById(R.id.mic_ico2); mic_ico2 = (RoundedImageView) findViewById(R.id.mic_ico2);
ViewClicksAntiShake.clicksAntiShake(newMessage, () -> {
chatScrollToBottom();
newMessage.setVisibility(View.GONE);
});
dr_pk_end_gif = (GifImageView) findViewById(R.id.dr_pk_end_gif); dr_pk_end_gif = (GifImageView) findViewById(R.id.dr_pk_end_gif);
msg = (LinearLayout) findViewById(R.id.room_msg); msg = (LinearLayout) findViewById(R.id.room_msg);
msg2 = (View) findViewById(R.id.room_msg_user); msg2 = (View) findViewById(R.id.room_msg_user);
@ -3043,4 +3048,22 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
} }
}); });
} }
/**
* 展示新消息提示
*/
public void showNewMessage() {
Locale locale = mContext.getResources().getConfiguration().locale;
String language = locale.getLanguage();
ImgLoader.display(mContext, TextUtils.equals(language, "zh") ? R.mipmap.new_message_cn : R.mipmap.new_message_en, newMessage);
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) newMessage.getLayoutParams();
if (fastMsgRecyclerView.getVisibility() == View.VISIBLE) {
params1.bottomMargin = DpUtil.dp2px(38);
} else {
params1.bottomMargin = DpUtil.dp2px(8);
}
newMessage.setLayoutParams(params1);
newMessage.setVisibility(View.VISIBLE);
}
} }

View File

@ -1,5 +1,10 @@
package com.yunbao.live.views; package com.yunbao.live.views;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent; import android.content.Intent;
@ -98,11 +103,6 @@ import io.rong.imlib.chatroom.base.RongChatRoomClient;
import io.rong.imlib.model.Conversation; import io.rong.imlib.model.Conversation;
import io.rong.message.TextMessage; import io.rong.message.TextMessage;
import static com.yunbao.common.CommonAppContext.logger;
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
import static com.yunbao.live.views.LivePlayRyViewHolder.Micing;
import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive;
/** /**
* 竖屏直播间UI逻辑 * 竖屏直播间UI逻辑
*/ */
@ -240,7 +240,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null); mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
//直播间背景 //直播间背景
ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack,400,600); ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack, 400, 600);
//ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack); //ImageLoadUtils.loadUrlToBlur(mContext,mLiveBean.getAvatar(),400,600,liveBack);
mask.setVisibility(View.VISIBLE); mask.setVisibility(View.VISIBLE);
mLivePlayViewHolder.setCover(data.getThumb()); mLivePlayViewHolder.setCover(data.getThumb());
@ -1526,4 +1526,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.showFullScreen(msgModel); mLiveRoomViewHolder.showFullScreen(msgModel);
} }
/**
* 展示新消息提示
*/
public void showNewMessage() {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.showNewMessage();
}
}
} }

View File

@ -3,14 +3,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bg" android:id="@+id/bg"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="6dp" android:layout_marginBottom="6dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/text_txt" android:id="@+id/text_txt"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="left" android:layout_gravity="left"
android:layout_marginLeft="9dp" android:layout_marginLeft="9dp"

View File

@ -835,7 +835,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="80dp"
android:gravity="top" android:gravity="top"
android:orientation="vertical"> android:orientation="vertical">
@ -948,7 +947,6 @@
<LinearLayout <LinearLayout
android:id="@+id/gif_gift_tip_group" android:id="@+id/gif_gift_tip_group"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:visibility="invisible"
android:layout_height="26dp" android:layout_height="26dp"
android:layout_below="@id/hour_rank_layout" android:layout_below="@id/hour_rank_layout"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
@ -958,7 +956,8 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:paddingRight="10dp"
android:translationX="500dp"> android:translationX="500dp"
android:visibility="invisible">
<ImageView <ImageView
android:layout_width="20dp" android:layout_width="20dp"
@ -987,8 +986,8 @@
android:id="@+id/gif_gift_tip_group_all_server" android:id="@+id/gif_gift_tip_group_all_server"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="36dp" android:layout_height="36dp"
android:visibility="invisible" android:translationX="500dp"
android:translationX="500dp"> android:visibility="invisible">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -1060,9 +1059,9 @@
<FrameLayout <FrameLayout
android:id="@+id/gif_gift_tip_group_buy_guard" android:id="@+id/gif_gift_tip_group_buy_guard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:visibility="invisible"
android:layout_height="36dp" android:layout_height="36dp"
android:translationX="500dp"> android:translationX="500dp"
android:visibility="invisible">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -1135,10 +1134,10 @@
android:id="@+id/gif_gift_tip_group_buy_zuoji" android:id="@+id/gif_gift_tip_group_buy_zuoji"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_height="30dp"
android:visibility="invisible"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="100dp" android:layout_marginTop="100dp"
android:translationX="500dp"> android:translationX="500dp"
android:visibility="invisible">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -1187,10 +1186,10 @@
android:id="@+id/gif_gift_tip_group_buy_liang_name" android:id="@+id/gif_gift_tip_group_buy_liang_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_height="30dp"
android:visibility="invisible"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="135dp" android:layout_marginTop="135dp"
android:translationX="500dp"> android:translationX="500dp"
android:visibility="invisible">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -1238,9 +1237,9 @@
<FrameLayout <FrameLayout
android:id="@+id/gif_gift_tip_group_buy_vip" android:id="@+id/gif_gift_tip_group_buy_vip"
android:layout_width="match_parent" android:layout_width="match_parent"
android:visibility="invisible"
android:layout_height="36dp" android:layout_height="36dp"
android:translationX="500dp"> android:translationX="500dp"
android:visibility="invisible">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -1996,6 +1995,14 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_centerVertical="true" /> android:layout_centerVertical="true" />
<!-- SVG 座骑--> <!-- SVG 座骑-->
<ImageView
android:id="@+id/new_message"
android:layout_width="106.67dp"
android:layout_height="27.33dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/room_fast_msg" android:id="@+id/room_fast_msg"
android:layout_width="match_parent" android:layout_width="match_parent"

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB