From b5aa768f5b10a924d6958da805ff7cb9069ca392 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Fri, 19 Aug 2022 10:04:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/views/weight/MarqueeTextView.java | 27 ++++++ .../main/res/layout/item_sidebar_lives.xml | 39 +++++++++ .../res/layout/view_home_float_banner.xml | 1 + .../live/activity/LiveAudienceActivity.java | 3 +- .../yunbao/live/adapter/SidebarAdapter.java | 2 +- .../live/views/SidebarLiveItemViewHolder.java | 85 +++---------------- live/src/main/res/anim/anim_marquee_in.xml | 1 + live/src/main/res/anim/anim_marquee_out.xml | 1 + .../res/layout/activity_live_audience.xml | 9 +- live/src/main/res/layout/view_live_room.xml | 14 +-- live/src/main/res/layout/view_wish_list.xml | 8 +- .../yunbao/main/views/FloatBannerView.java | 6 +- 12 files changed, 106 insertions(+), 90 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/views/weight/MarqueeTextView.java create mode 100644 common/src/main/res/layout/item_sidebar_lives.xml diff --git a/common/src/main/java/com/yunbao/common/views/weight/MarqueeTextView.java b/common/src/main/java/com/yunbao/common/views/weight/MarqueeTextView.java new file mode 100644 index 000000000..d948d3ffc --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/weight/MarqueeTextView.java @@ -0,0 +1,27 @@ +package com.yunbao.common.views.weight; + +import android.content.Context; +import android.util.AttributeSet; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatTextView; + +public class MarqueeTextView extends AppCompatTextView { + public MarqueeTextView(@NonNull Context context) { + super(context); + } + + public MarqueeTextView(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public MarqueeTextView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + public boolean isFocused() { + return true; + } +} diff --git a/common/src/main/res/layout/item_sidebar_lives.xml b/common/src/main/res/layout/item_sidebar_lives.xml new file mode 100644 index 000000000..582388b5e --- /dev/null +++ b/common/src/main/res/layout/item_sidebar_lives.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/view_home_float_banner.xml b/common/src/main/res/layout/view_home_float_banner.xml index e92c02a28..ced9fc7f1 100644 --- a/common/src/main/res/layout/view_home_float_banner.xml +++ b/common/src/main/res/layout/view_home_float_banner.xml @@ -98,6 +98,7 @@ android:layout_gravity="center" /> + { @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new SidebarLiveItemViewHolder(mInflater.inflate(R.layout.item_main_home_lives, parent, false)); + return new SidebarLiveItemViewHolder(mInflater.inflate(R.layout.item_sidebar_lives, parent, false)); } @Override diff --git a/live/src/main/java/com/yunbao/live/views/SidebarLiveItemViewHolder.java b/live/src/main/java/com/yunbao/live/views/SidebarLiveItemViewHolder.java index 8bf25a176..64af88fe8 100644 --- a/live/src/main/java/com/yunbao/live/views/SidebarLiveItemViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/SidebarLiveItemViewHolder.java @@ -1,7 +1,6 @@ package com.yunbao.live.views; import android.content.Context; -import android.text.TextUtils; import android.view.View; import android.widget.ImageView; import android.widget.TextView; @@ -9,15 +8,14 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.resource.bitmap.CircleCrop; +import com.bumptech.glide.request.RequestOptions; import com.jakewharton.rxbinding3.view.RxView; import com.squareup.picasso.Picasso; -import com.yunbao.common.Constants; import com.yunbao.common.bean.AnchorRecommendItemModel; -import com.yunbao.common.custom.RatioRoundImageView; import com.yunbao.common.glide.ImgLoader; -import com.yunbao.common.utils.formatBigNum; import com.yunbao.live.R; -import com.yunbao.live.utils.MainIconUtil; import java.util.concurrent.TimeUnit; @@ -29,29 +27,16 @@ import kotlin.Unit; * 直播页面布局 */ public class SidebarLiveItemViewHolder extends RecyclerView.ViewHolder { - private ImageView mCover, liveType, mLiveIco, mType, pkico, drPkIco, pkAvatar; - private RatioRoundImageView bgs; - private View views; - private TextView mLiveState, mTitle, mName, mNum; + private ImageView mCover, liveType; + private TextView mName; public SidebarLiveItemViewHolder(@NonNull View itemView) { super(itemView); //展示普通布局,隐藏周星榜布局 - itemView.findViewById(R.id.live_info_view).setVisibility(View.VISIBLE); - itemView.findViewById(R.id.lt_week_list).setVisibility(View.GONE); + mCover = itemView.findViewById(R.id.cover); - bgs = itemView.findViewById(R.id.bgs); liveType = itemView.findViewById(R.id.live_type); - views = itemView.findViewById(R.id.views); - mLiveIco = (ImageView) itemView.findViewById(R.id.tv_live_ico); - mLiveState = (TextView) itemView.findViewById(R.id.tv_live_state); - mType = (ImageView) itemView.findViewById(R.id.type); - mTitle = (TextView) itemView.findViewById(R.id.title); - mName = (TextView) itemView.findViewById(R.id.name); - mNum = (TextView) itemView.findViewById(R.id.num); - pkico = (ImageView) itemView.findViewById(R.id.pk_ico); - drPkIco = (ImageView) itemView.findViewById(R.id.dr_pk_ico); - pkAvatar = (ImageView) itemView.findViewById(R.id.pk_avatar); + mName = itemView.findViewById(R.id.name); } /** @@ -73,51 +58,10 @@ public class SidebarLiveItemViewHolder extends RecyclerView.ViewHolder { .load(bean.getContentPicSizeThree()) .into(liveType); } - ImgLoader.display(itemView.getContext(), bean.getThumb(), mCover); - bgs.setVisibility(View.VISIBLE); - pkico.setVisibility(View.GONE); - pkAvatar.setVisibility(View.GONE); - drPkIco.setVisibility(View.GONE); - if (bean.getDrpkStatus() != null && bean.getDrpkStatus().equals("1")) { - drPkIco.setVisibility(View.VISIBLE); - } - if (bean.getPkAvatarThumb() != null && !bean.getPkAvatarThumb().equals("")) { - ImgLoader.display(mContext, bean.getPkAvatarThumb(), pkAvatar); - pkico.setVisibility(View.VISIBLE); - pkAvatar.setVisibility(View.VISIBLE); - } + ImgLoader.display(itemView.getContext(),bean.getThumb(),mCover); + mName.setText(bean.getUserNicename()); - if (TextUtils.isEmpty(bean.getTitle())) { - if (mTitle.getVisibility() == View.VISIBLE) { - mTitle.setVisibility(View.GONE); - } - } else { - if (mTitle.getVisibility() != View.VISIBLE) { - mTitle.setVisibility(View.VISIBLE); - } - mTitle.setText(bean.getTitle()); - } - mNum.setText(formatBigNum.formatBigNum(bean.getHotNum())); - views.setVisibility(View.GONE); - if ("1".equals(bean.getIslive())) { - views.setVisibility(View.VISIBLE); - //直播中 - mType.setImageResource(MainIconUtil.getLiveTypeIcon(Integer.parseInt(bean.getType()))); - mType.setVisibility(View.VISIBLE); - mLiveIco.setImageResource(R.mipmap.icon_main_rest_work); - mNum.setVisibility(View.VISIBLE); - liveType.setVisibility(View.VISIBLE); - mLiveState.setText(R.string.lives_state); - } else { - views.setVisibility(View.VISIBLE); - //休息中 - mType.setImageResource(MainIconUtil.getLiveTypeIcon(Constants.LIVE_TYPE_RESTING)); - mType.setVisibility(View.GONE); - mLiveIco.setImageResource(R.mipmap.icon_main_rest_spot); - mLiveState.setText(R.string.rest_state); - liveType.setVisibility(View.GONE); - mNum.setVisibility(View.GONE); - } + RxView.clicks(itemView) .throttleFirst(2, TimeUnit.SECONDS) // 才发送 2s内第1次点击按钮的事件 .subscribe(new Observer() { @@ -143,14 +87,7 @@ public class SidebarLiveItemViewHolder extends RecyclerView.ViewHolder { } }); - views.setVisibility(View.GONE); - mLiveIco.setVisibility(View.GONE); - mLiveState.setVisibility(View.GONE); - mNum.setVisibility(View.GONE); - pkAvatar.setVisibility(View.GONE); - pkico.setVisibility(View.GONE); - mTitle.setVisibility(View.GONE); - drPkIco.setVisibility(View.GONE); + } public interface OnItemClickListener { diff --git a/live/src/main/res/anim/anim_marquee_in.xml b/live/src/main/res/anim/anim_marquee_in.xml index 9fded3ca9..e53ede69f 100644 --- a/live/src/main/res/anim/anim_marquee_in.xml +++ b/live/src/main/res/anim/anim_marquee_in.xml @@ -1,6 +1,7 @@ \ No newline at end of file diff --git a/live/src/main/res/anim/anim_marquee_out.xml b/live/src/main/res/anim/anim_marquee_out.xml index b8d9cc11c..2db5a425b 100644 --- a/live/src/main/res/anim/anim_marquee_out.xml +++ b/live/src/main/res/anim/anim_marquee_out.xml @@ -1,6 +1,7 @@ ; \ No newline at end of file diff --git a/live/src/main/res/layout/activity_live_audience.xml b/live/src/main/res/layout/activity_live_audience.xml index 9a6b5d465..bf8340dfe 100644 --- a/live/src/main/res/layout/activity_live_audience.xml +++ b/live/src/main/res/layout/activity_live_audience.xml @@ -72,20 +72,21 @@ + android:background="#90000000" /> + android:paddingEnd="8dp" + android:paddingTop="56dp" + > diff --git a/live/src/main/res/layout/view_wish_list.xml b/live/src/main/res/layout/view_wish_list.xml index 432c7212a..947d56c08 100644 --- a/live/src/main/res/layout/view_wish_list.xml +++ b/live/src/main/res/layout/view_wish_list.xml @@ -10,12 +10,18 @@ android:layout_width="20dp" android:layout_height="20dp" /> - \ No newline at end of file diff --git a/main/src/main/java/com/yunbao/main/views/FloatBannerView.java b/main/src/main/java/com/yunbao/main/views/FloatBannerView.java index 6a1b9af37..8c9230469 100644 --- a/main/src/main/java/com/yunbao/main/views/FloatBannerView.java +++ b/main/src/main/java/com/yunbao/main/views/FloatBannerView.java @@ -137,13 +137,15 @@ public class FloatBannerView extends FrameLayout { } }); - TranslateAnimation animationTranslate2 = new TranslateAnimation(0, -targetX / 1.2f, 0, -targetY / 1.2f); + ScaleAnimation scaleAnimation2 = new ScaleAnimation(1f, 0.8f, 1f, 0.8f); + TranslateAnimation animationTranslate2 = new TranslateAnimation(0, -bannerLayout4.getX()/0.8f, 0, bannerLayout4.getY()*0.8f); AlphaAnimation animationAlpha = new AlphaAnimation(1, 0); AnimationSet animationSet2 = new AnimationSet(true); animationSet2.setFillAfter(true); - animationSet2.setDuration(700); + animationSet2.setDuration(800); animationSet2.addAnimation(animationTranslate2); animationSet2.addAnimation(animationAlpha); + animationSet2.addAnimation(scaleAnimation2); animationSet2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {