网页标题兼容,周星榜图片样式裁剪,推荐卡加标签

This commit is contained in:
18401019693 2022-09-22 13:30:24 +08:00
parent 6bc3019b02
commit ab2991a999
5 changed files with 83 additions and 34 deletions

View File

@ -79,6 +79,7 @@ public class RouteUtil {
public static void forwardZhuangBanActivity(String url) { public static void forwardZhuangBanActivity(String url) {
Constants.myPackageUrl = url; Constants.myPackageUrl = url;
ARouter.getInstance().build(PATH_ZHUANGBANACTIVITY) ARouter.getInstance().build(PATH_ZHUANGBANACTIVITY)
.withString("title","")
.navigation(); .navigation();
} }

View File

@ -51,6 +51,38 @@ public class LiveBean implements Parcelable {
//是否關注 1關注 2未關注 //是否關注 1關注 2未關注
private String isattention = ""; private String isattention = "";
private String recommendCardtype = ""; private String recommendCardtype = "";
private String recommendCardIconSizeTwo = "";
private String recommendCardIconSizeThree = "";
public String getRecommendCardIconSizeTwo() {
return recommendCardIconSizeTwo;
}
public LiveBean setRecommendCardIconSizeTwo(String recommendCardIconSizeTwo) {
this.recommendCardIconSizeTwo = recommendCardIconSizeTwo;
return this;
}
public String getRecommendCardIcon() {
if (TextUtils.isEmpty(recommendCardIconSizeTwo)) {
if (!TextUtils.isEmpty(recommendCardIconSizeThree)) {
return recommendCardIconSizeThree;
} else {
return null;
}
} else {
return recommendCardIconSizeTwo;
}
}
public String getRecommendCardIconSizeThree() {
return recommendCardIconSizeThree;
}
public LiveBean setRecommendCardIconSizeThree(String recommendCardIconSizeThree) {
this.recommendCardIconSizeThree = recommendCardIconSizeThree;
return this;
}
public String getRecommendcardtype() { public String getRecommendcardtype() {
return recommendCardtype; return recommendCardtype;

View File

@ -19,6 +19,7 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
@ -76,14 +77,14 @@ public class ZhuangBanActivity extends AbsActivity {
lt_title = (LinearLayout) findViewById(R.id.lt_title); lt_title = (LinearLayout) findViewById(R.id.lt_title);
LinearLayout rootView = (LinearLayout) findViewById(com.yunbao.live.R.id.rootView); LinearLayout rootView = (LinearLayout) findViewById(com.yunbao.live.R.id.rootView);
if (getIntent().hasExtra("title")) { if (getIntent().hasExtra("title")) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rootView.getLayoutParams();
params.topMargin = DpUtil.dp2px(34);
rootView.setLayoutParams(params);
if (TextUtils.isEmpty(titleString)){ if (TextUtils.isEmpty(titleString)){
lt_title.setVisibility(View.GONE); lt_title.setVisibility(View.GONE);
}else { }else {
if (TextUtils.equals(titleString, "blank")) { if (TextUtils.equals(titleString, "blank")) {
lt_title.setVisibility(View.GONE); lt_title.setVisibility(View.GONE);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) rootView.getLayoutParams();
params.topMargin = DpUtil.dp2px(24);
rootView.setLayoutParams(params);
} else { } else {
lt_title.setVisibility(View.VISIBLE); lt_title.setVisibility(View.VISIBLE);
} }

View File

@ -1,13 +1,14 @@
package com.yunbao.main.views; package com.yunbao.main.views;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.jakewharton.rxbinding3.view.RxView; import com.jakewharton.rxbinding3.view.RxView;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import com.yunbao.common.Constants; import com.yunbao.common.Constants;
@ -28,7 +29,7 @@ import kotlin.Unit;
* 直播页面布局 * 直播页面布局
*/ */
public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder { public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
private ImageView mCover, liveType, mLiveIco, mType, pkico, drPkIco, pkAvatar,viewBg; private ImageView mCover, liveType, mLiveIco, mType, pkico, drPkIco, pkAvatar, viewBg;
private RatioRoundImageView bgs; private RatioRoundImageView bgs;
private View views; private View views;
private TextView mLiveState, mTitle, mName, mNum; private TextView mLiveState, mTitle, mName, mNum;
@ -65,17 +66,7 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
itemView.setTag(position); itemView.setTag(position);
liveType.setImageDrawable(null); liveType.setImageDrawable(null);
viewBg.setVisibility(View.GONE); viewBg.setVisibility(View.GONE);
//皇帝
if(bean.getRecommendcardtype().equals("1")){
viewBg.setImageResource(R.mipmap.emperor_recommendation);
viewBg.setVisibility(View.VISIBLE);
//超皇
}else if(bean.getRecommendcardtype().equals("2")){
viewBg.setImageResource(R.mipmap.superemperor_recommendation);
viewBg.setVisibility(View.VISIBLE);
}else{
viewBg.setVisibility(View.GONE);
}
if (bean.getContent_pic_size_two() != null && !bean.getContent_pic_size_two().equals("") && height <= 1920) { if (bean.getContent_pic_size_two() != null && !bean.getContent_pic_size_two().equals("") && height <= 1920) {
Picasso.with(mContext) Picasso.with(mContext)
.load(bean.getContent_pic_size_two()) .load(bean.getContent_pic_size_two())
@ -130,31 +121,54 @@ public class MainHomeLiveItemViewHolder extends RecyclerView.ViewHolder {
liveType.setVisibility(View.GONE); liveType.setVisibility(View.GONE);
mNum.setVisibility(View.GONE); mNum.setVisibility(View.GONE);
} }
//皇帝
if (bean.getRecommendcardtype().equals("1")) {
if (!TextUtils.isEmpty(bean.getRecommendCardIcon())) {
liveType.setVisibility(View.VISIBLE);
Picasso.with(mContext)
.load(bean.getRecommendCardIcon())
.into(liveType);
}
viewBg.setImageResource(R.mipmap.emperor_recommendation);
viewBg.setVisibility(View.VISIBLE);
//超皇
} else if (bean.getRecommendcardtype().equals("2")) {
if (!TextUtils.isEmpty(bean.getRecommendCardIcon())) {
liveType.setVisibility(View.VISIBLE);
Picasso.with(mContext)
.load(bean.getRecommendCardIcon())
.into(liveType);
}
viewBg.setImageResource(R.mipmap.superemperor_recommendation);
viewBg.setVisibility(View.VISIBLE);
} else {
viewBg.setVisibility(View.GONE);
}
RxView.clicks(itemView) RxView.clicks(itemView)
.throttleFirst(2, TimeUnit.SECONDS) // 才发送 2s内第1次点击按钮的事件 .throttleFirst(2, TimeUnit.SECONDS) // 才发送 2s内第1次点击按钮的事件
.subscribe(new Observer<Unit>() { .subscribe(new Observer<Unit>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
} }
@Override @Override
public void onNext(Unit unit) { public void onNext(Unit unit) {
if (listener != null) { if (listener != null) {
listener.onItemClick(bean, position); listener.onItemClick(bean, position);
} }
} }
@Override @Override
public void onError(Throwable e) { public void onError(Throwable e) {
} }
@Override @Override
public void onComplete() { public void onComplete() {
} }
}); });
} }
public interface OnItemClickListener { public interface OnItemClickListener {

View File

@ -6,6 +6,7 @@
<ImageView <ImageView
android:id="@+id/week_live" android:id="@+id/week_live"
android:layout_width="match_parent" android:layout_width="match_parent"
android:scaleType="centerCrop"
android:layout_height="match_parent" /> android:layout_height="match_parent" />