修改直播间聊天界面(横竖屏聊天框高度,关注消息修改)直播间头部布局样式修改

This commit is contained in:
18401019693 2023-03-23 16:36:16 +08:00
parent 95429402c7
commit 085f19c3ca
18 changed files with 137 additions and 76 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -373,13 +373,13 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
ImgLoader.display(mContext, bean.getId(), clipImage2);
attentionLayout.setVisibility(View.VISIBLE);
btnAttention.setVisibility(bean.isAttention() ? View.GONE : View.VISIBLE);
btnAttention.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LiveRoomViewHolder.follow();
btnAttention.setVisibility(View.GONE);
}
});
// btnAttention.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// LiveRoomViewHolder.follow();
// btnAttention.setVisibility(View.GONE);
// }
// });
} else if (bean.getType() == MSG_HOUR_RANK_CHANGE) {
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
mTextView.setText(bean.getContent());

View File

@ -89,7 +89,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
@Override
public int getItemCount() {
return Math.min(mList.size(), 5);
return Math.min(mList.size(), 3);
}
class Vh extends RecyclerView.ViewHolder {

View File

@ -70,6 +70,12 @@ public class LoadDian9TuUtil {
setNinePathImage(context, imageView, bitmap, position);
}
public void loadDian9TuAssets2(Context context, View imageView, String fileName, int position) {
Bitmap bitmap = getImageFromAssetsFile(context, fileName);
BITMAP_CACHE.add(bitmap);
setNinePathImage(context, imageView, bitmap, position);
}
/**
* 从Assets中读取图片
*

View File

@ -148,6 +148,7 @@ import com.yunbao.live.presenter.LiveEnterRoomAnimPresenter;
import com.yunbao.live.presenter.LiveGiftAnimPresenter;
import com.yunbao.live.presenter.LiveLightAnimPresenter;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.utils.LoadDian9TuUtil;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -219,7 +220,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
public TextView room_hot;
public String touid, gotoroom;
public static TextView fans;
public LinearLayout fans_btn, wishListLayout;
public LinearLayout fans_btn, wishListLayout, wishListLayout2, liveWksLayout;
public static View d_pk_view;
public static int isAttention = 0;//是否关注 0=没关注,
public static String mNameText;
@ -309,7 +310,7 @@ 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 LinearLayout mAnchorLayout, hourRankLayout, liveRankPk2;
private ImageView mGoodNumberIcon;
private View msg2; //悬浮窗来私信的布局
private ConstraintLayout msgLayout; //悬浮窗
@ -318,7 +319,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private FullServiceNotificationView fullScreen;//全副喇叭
private NobleNoticeView noble;//全副喇叭
private FaceManager manager;
private LinearLayout pkRankLayout;
private FrameLayout pkRankLayout;
private ViewFlipper pkRankVf;
private ImageView mPkRankIcon;
private TextView mPkRankText;
@ -815,9 +816,13 @@ 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);
wishListLayout2 = (LinearLayout) findViewById(R.id.wish_list_layout2);
liveWksLayout = (LinearLayout) findViewById(R.id.live_wks_layout2);
mAnchorLayout = (LinearLayout) findViewById(R.id.group_1);
hourRankLayout = (LinearLayout) findViewById(R.id.hour_rank_layout2);
liveRankPk2 = (LinearLayout) findViewById(R.id.live_rank_pk2);
mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico);
pkRankLayout = (LinearLayout) findViewById(R.id.live_rank_pk);
pkRankLayout = (FrameLayout) findViewById(R.id.live_rank_pk);
pkRankVf = (ViewFlipper) findViewById(R.id.rank_pk_vf);
mPkRankTopIcon = (ImageView) findViewById(R.id.icon_pk_top);
mRedVal = (TextView) findViewById(R.id.pk_rank_red_val);
@ -940,6 +945,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
LiveRoomViewHolder.follow();
mLiveChatAdapter.removetItem(bean);
} else if (bean.getType() == -2) {
if (!bean.isAttention()) {
LiveRoomViewHolder.follow();
}
mLiveChatAdapter.removetItem(bean);
((LiveActivity) mContext).sendChatMessage("Hi~", null, null);
} else if (bean.getType() == -5) {
@ -1168,6 +1176,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
customFullServiceNotify = (ImageView) findViewById(R.id.custom_full_service_notify);
reloadIM();
initStarChallengeStatus();
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveWksLayout, "rectangle_new.png", 1);
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, wishListLayout2, "rectangle_new.png", 1);
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, liveRankPk2, "rectangle_new.png", 1);
}
/**
@ -1630,9 +1642,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (flipper.getChildCount() > 0) {
flipper.removeAllViews();
}
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(44), DpUtil.dp2px(16));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(13), DpUtil.dp2px(13));
params.leftMargin = DpUtil.dp2px(6);
params.rightMargin = DpUtil.dp2px(2);
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
textParams.leftMargin = DpUtil.dp2px(5);
textParams.leftMargin = DpUtil.dp2px(2);
View hotView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
ImageView hotPic = hotView.findViewById(R.id.wish_pic);
@ -1645,8 +1659,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mHotText.setGravity(Gravity.CENTER);
mHourRank.setGravity(Gravity.CENTER);
setHourRankData(Long.parseLong(model.getRank()));
hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en);
hourPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hour_list : R.drawable.live_tags_hour_list_en);
hotPic.setImageResource(R.drawable.icon_time_new);
hourPic.setImageResource(R.drawable.icon_heat_new);
hotPic.setLayoutParams(params);
hourPic.setLayoutParams(params);
flipper.addView(hotView);
@ -1669,6 +1683,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
liveHDDialogFragment.setArguments(bundle);
liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
});
new LoadDian9TuUtil().loadDian9TuAssets2(mContext, hourRankLayout, "rectangle_new.png", 1);
}
/**
@ -1700,7 +1715,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
mHourRank.setGravity(Gravity.CENTER);
setHourRankData(info.get(0).getRank());
hotPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hot : R.drawable.live_tags_hot_en);
hourPic.setImageResource(WordUtil.isZh() ? R.drawable.live_tags_hour_list : R.drawable.live_tags_hour_list_en);
hourPic.setImageResource(R.drawable.icon_heat_new);
hotPic.setLayoutParams(params);
hourPic.setLayoutParams(params);
flipper.addView(hotView);
@ -1825,7 +1840,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
@Override
public void onError(String error) {
ToastUtil.show( R.string.net_error);
ToastUtil.show(R.string.net_error);
}
});
@ -4188,4 +4203,22 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
}
/**
* 横竖屏聊天框的高度
*
* @param landscape
*/
public void changeMessageLandscape(int landscape) {
RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)
mChatRecyclerView.getLayoutParams();
if (landscape == 2) {
params1.height = DpUtil.dp2px(180);
} else {
params1.height = DpUtil.dp2px(300);
}
mChatRecyclerView.setLayoutParams(params1);
}
}

View File

@ -303,6 +303,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveLinkMicPresenter.setLiveSdk(mLiveSDK);
mLiveLinkMicAnchorPresenter.setLiveSdk(mLiveSDK);
}
if (mLiveRyLinkMicPkPresenter == null) {
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePlayViewHolder, false, null);
}
@ -323,6 +324,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLivePlayViewHolder.removeDetailView();
mLivePlayViewHolder.setCover(mLiveBean.getAvatar());
mLivePlayViewHolder.setLiveBeanLandscape(mLiveBean.getLandscape());
mLiveRoomViewHolder.changeMessageLandscape(mLiveBean.getLandscape());
//mLivePlayViewHolder.play(mLiveBean.getPull(), LiveRoomPlayViewHolder.PLAY_MODEL_DEF);
mLivePlayViewHolder.setOnMicCallback(new LiveRoomPlayViewHolder.OnMicCallback() {
@Override
@ -466,7 +468,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
//数据设置
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.setLiveInfo(mLiveBean.getUid(), mLiveBean.getStream(), Integer.parseInt(data.getEnterRoomInfo().getUserlistTime()) * 4000);
mLiveRoomViewHolder.setFastMessage(greetings);
// mLiveRoomViewHolder.setFastMessage(greetings);
mLiveRoomViewHolder.setVotes(data.getEnterRoomInfo().getVotestotal());
//真爱排行 数量
mLiveRoomViewHolder.setMedaRankNum(data.getEnterRoomInfo().getMedalRankNum());

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -211,8 +211,6 @@
android:layout_height="26dp"
android:layout_gravity="end"
android:layout_margin="11dp"
android:clickable="true"
android:focusable="true"
android:src="@mipmap/btn_attention" />
</FrameLayout>

View File

@ -2,9 +2,9 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/live_user_root_layout"
android:layout_width="38dp"
android:layout_marginEnd="3dp"
android:layout_height="38dp">
android:layout_width="32dp"
android:layout_marginEnd="1dp"
android:layout_height="32dp">
<!-- <ImageView-->
<!-- android:id="@+id/wrap"-->
@ -16,8 +16,8 @@
<!-- android:src="@mipmap/icon_live_user_list_1"/>-->
<RelativeLayout
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop">

View File

@ -19,7 +19,7 @@
<LinearLayout
android:id="@+id/group_1"
android:layout_width="138dp"
android:layout_width="142dp"
android:layout_height="34dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="4dp"
@ -118,8 +118,8 @@
</LinearLayout>
<RelativeLayout
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:scaleType="centerCrop">
@ -136,8 +136,8 @@
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/gift_svga"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_width="34dp"
android:layout_height="34dp"
android:src="@drawable/img_guardian_online"
android:visibility="gone"
app:autoPlay="true" />
@ -153,23 +153,23 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/user_recyclerView"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_height="32dp"
android:layout_gravity="end|center"
android:layout_marginRight="-3dp"
android:layout_marginEnd="4dp"
android:layout_weight="1"
android:overScrollMode="never"
android:visibility="visible" />
<ImageView
android:id="@+id/user_more"
android:layout_width="30dp"
android:layout_width="27dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:src="@mipmap/live_users_more" />
<ImageView
android:id="@+id/btn_close"
android:layout_width="30dp"
android:layout_width="27dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginStart="6dp"
@ -191,6 +191,7 @@
android:id="@+id/chat_recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_marginTop="370dp"
android:overScrollMode="never"
android:scrollbars="none" />
@ -217,18 +218,21 @@
</RelativeLayout>
<LinearLayout
<FrameLayout
android:id="@+id/hour_rank_layout"
android:layout_width="wrap_content"
android:layout_height="21dp"
android:layout_height="20dp"
android:layout_below="@id/lin"
android:layout_marginLeft="10dp"
android:layout_marginTop="8dp"
android:background="@drawable/bg_hour_rank_list"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="5dp">
android:orientation="horizontal">
<LinearLayout
android:id="@+id/hour_rank_layout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" />
<include
layout="@layout/view_wish_list"
@ -242,7 +246,7 @@
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginStart="0dp"
android:layout_marginEnd="4dp"
android:layout_marginEnd="14dp"
android:flipInterval="5000"
android:inAnimation="@anim/anim_marquee_in"
android:outAnimation="@anim/anim_marquee_out" />
@ -250,11 +254,12 @@
<ImageView
android:layout_width="4dp"
android:layout_height="8dp"
android:layout_gravity="center"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="6dp"
android:src="@drawable/live_icon_right_more" />
</LinearLayout>
</FrameLayout>
<!--贡献-->
<LinearLayout
android:id="@+id/btn_votes"
@ -337,35 +342,41 @@
</LinearLayout>
<!--周星榜-->
<LinearLayout
<FrameLayout
android:id="@+id/live_wks_layout"
android:layout_width="wrap_content"
android:layout_height="21dp"
android:layout_height="20dp"
android:layout_alignTop="@id/hour_rank_layout"
android:layout_marginLeft="10dp"
android:layout_marginStart="4dp"
android:layout_toRightOf="@id/hour_rank_layout"
android:background="@drawable/bg_live_item"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:visibility="visible">
<LinearLayout
android:id="@+id/live_wks_layout2"
android:layout_width="56dp"
android:layout_height="match_parent"
android:orientation="horizontal" />
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="6dp"
android:src="@mipmap/live_icon_zhouxing" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:layout_marginEnd="6dp"
android:text="@string/live_wks"
android:textColor="#FFFFFFFF"
android:textSize="10sp" />
</LinearLayout>
</FrameLayout>
<!--心愿单-->
<LinearLayout
android:id="@+id/wish_list_layout"
@ -404,7 +415,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/hour_rank_layout"
android:layout_marginStart="10dp"
android:layout_marginStart="4dp"
android:layout_toEndOf="@id/live_wks_layout"
android:visibility="visible">
@ -515,18 +526,22 @@
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
<FrameLayout
android:id="@+id/live_rank_pk"
android:layout_width="75dp"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_alignTop="@id/hour_rank_layout"
android:layout_alignParentEnd="true"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_live_item_pk_rank"
android:layout_marginEnd="10dp"
android:clickable="true"
android:focusable="true"
android:visibility="visible">
<LinearLayout
android:id="@+id/live_rank_pk2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" />
<ViewFlipper
android:id="@+id/rank_pk_vf"
@ -537,7 +552,7 @@
android:outAnimation="@anim/anim_marquee_out" />
</LinearLayout>
</FrameLayout>
<ImageView
@ -2006,6 +2021,7 @@
android:id="@+id/room_fast_msg"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:visibility="gone" />
@ -2307,7 +2323,7 @@
<com.yunbao.common.views.weight.NobleNoticeView
android:id="@+id/noble"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_marginTop="60dp" />
android:layout_marginTop="60dp"
android:visibility="gone" />
</RelativeLayout>

View File

@ -6,27 +6,32 @@
android:orientation="vertical"
tools:ignore="MissingDefaultResource">
<LinearLayout
<FrameLayout
android:id="@+id/wish_list_layout"
android:layout_width="80dp"
android:layout_height="21dp"
android:background="@drawable/bg_live_item"
android:gravity="center_vertical"
android:layout_width="66dp"
android:layout_height="20dp"
android:orientation="horizontal"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:visibility="visible">
<LinearLayout
android:id="@+id/wish_list_layout2"
android:layout_width="66dp"
android:layout_height="match_parent"
android:orientation="horizontal" />
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="6dp"
android:src="@mipmap/live_icon_seat" />
<TextView
android:id="@+id/wish_list"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginStart="6dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:layout_marginEnd="6dp"
android:ellipsize="end"
android:gravity="center"
@ -35,5 +40,5 @@
android:textColor="#FFFFFF"
android:textSize="10sp" />
</LinearLayout>
</FrameLayout>
</LinearLayout>

View File

@ -7,16 +7,17 @@
<ImageView
android:id="@+id/wish_pic"
android:layout_width="17dp"
android:layout_height="17dp" />
android:layout_width="12dp"
android:layout_height="12dp" />
<com.yunbao.common.views.weight.MarqueeTextView
android:id="@+id/wish_index"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:ellipsize="marquee"
android:focusable="true"
android:gravity="center"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 966 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1012 B