调整女神说banner布局

This commit is contained in:
zlzw 2023-04-13 17:23:29 +08:00
parent 974546697b
commit 4b7469d9d4
3 changed files with 58 additions and 2 deletions

View File

@ -4884,7 +4884,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}) })
.start(); .start();
topBanner2.setAutoPlay(true) topBanner2.setAutoPlay(true)
.setPages(mTopBannerList, new TopBannerCustomViewHolder()) .setPages(mTopBannerList, new TopBannerCustomViewHolder(false))
.setDelayTime(3000) .setDelayTime(3000)
.setBannerStyle(BannerConfig.NOT_INDICATOR) .setBannerStyle(BannerConfig.NOT_INDICATOR)
.setOnBannerClickListener(new OnBannerClickListener() { .setOnBannerClickListener(new OnBannerClickListener() {

View File

@ -20,6 +20,14 @@ import com.yunbao.live.R;
public class TopBannerCustomViewHolder implements BannerViewHolder<BannerBean> { public class TopBannerCustomViewHolder implements BannerViewHolder<BannerBean> {
public static final int TYPE_CALL_ANCHOR = 0;//联系主播 public static final int TYPE_CALL_ANCHOR = 0;//联系主播
public static final int TYPE_IMAGE = 1; public static final int TYPE_IMAGE = 1;
private boolean isTop=true;
public TopBannerCustomViewHolder(boolean isTop) {
this.isTop = isTop;
}
public TopBannerCustomViewHolder() {
}
@Override @Override
public View createView(Context context, int position, BannerBean data) { public View createView(Context context, int position, BannerBean data) {
@ -33,7 +41,11 @@ public class TopBannerCustomViewHolder implements BannerViewHolder<BannerBean> {
wishlistName.setText(data.getWishlistName()); wishlistName.setText(data.getWishlistName());
wishlistProgress.setText(String.format("%s/%s", data.getWishlistProgress(), data.getWishlistNum())); wishlistProgress.setText(String.format("%s/%s", data.getWishlistProgress(), data.getWishlistNum()));
} else { } else {
view = LayoutInflater.from(context).inflate(R.layout.view_live_top_banner_call_me, null); if(isTop) {
view = LayoutInflater.from(context).inflate(R.layout.view_live_top_banner_call_me, null);
}else{
view = LayoutInflater.from(context).inflate(R.layout.view_live_top_banner_call_me2, null);
}
SVGAImageView svga = view.findViewById(R.id.svga); SVGAImageView svga = view.findViewById(R.id.svga);
new SVGAParser(context).decodeFromAssets("ic_live_anchor_call_me.svga", new SVGAParser.ParseCompletion() { new SVGAParser(context).decodeFromAssets("ic_live_anchor_call_me.svga", new SVGAParser.ParseCompletion() {
@Override @Override

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="52dp"
android:layout_height="66dp">
<ImageView
android:id="@+id/imageView7"
android:layout_width="52dp"
android:layout_height="56dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/bg_live_top_banner" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/svga"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginTop="12dp"
android:visibility="visible"
app:autoPlay="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:background="@drawable/bg_live_top_banner_text"
android:paddingStart="5dp"
android:paddingTop="2dp"
android:paddingEnd="5dp"
android:paddingBottom="2dp"
android:text="@string/live_ready_anchor_call_me"
android:textColor="@color/white"
android:textSize="8sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/svga" />
</androidx.constraintlayout.widget.ConstraintLayout>