调整天梯排位赛UI位置

新增排位赛轮播点击事件
This commit is contained in:
zlzw 2022-11-16 16:31:48 +08:00
parent a4ab6df974
commit a664ff7464
4 changed files with 46 additions and 6 deletions

View File

@ -19,6 +19,8 @@ public class PkRankBean extends BaseModel {
public String blueVal; public String blueVal;
@SerializedName("pktt_img") @SerializedName("pktt_img")
public String pkTopImgUrl; public String pkTopImgUrl;
@SerializedName("link")
public String clickUrl;
public int getId() { public int getId() {
return id; return id;
@ -74,6 +76,14 @@ public class PkRankBean extends BaseModel {
this.pkTopImgUrl = pkTopImgUrl; this.pkTopImgUrl = pkTopImgUrl;
} }
public String getClickUrl() {
return clickUrl;
}
public void setClickUrl(String clickUrl) {
this.clickUrl = clickUrl;
}
@Override @Override
public String toString() { public String toString() {
return "PkRankBean{" + return "PkRankBean{" +
@ -83,6 +93,7 @@ public class PkRankBean extends BaseModel {
", redVal='" + redVal + '\'' + ", redVal='" + redVal + '\'' +
", blueVal='" + blueVal + '\'' + ", blueVal='" + blueVal + '\'' +
", pkTopImgUrl='" + pkTopImgUrl + '\'' + ", pkTopImgUrl='" + pkTopImgUrl + '\'' +
", clickUrl='" + clickUrl + '\'' +
'}'; '}';
} }
} }

View File

@ -21,7 +21,9 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
import com.adjust.sdk.Adjust; import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent; import com.adjust.sdk.AdjustEvent;
@ -268,6 +270,15 @@ public class LiveHDDialogFragment extends AbsDialogFragment {
} }
} }
@Override
public void show(@NonNull FragmentManager manager, @Nullable String tag) {
try {
super.show(manager, tag);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();

View File

@ -1533,27 +1533,44 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
initPkRank(); initPkRank();
} }
private void initPkRankView() { private void initPkRankView(PkRankBean bean) {
if (pkRankVf.getTag() != null) { if (pkRankVf.getTag() != null) {
return; return;
} }
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22)); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(DpUtil.dp2px(20), DpUtil.dp2px(22));
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.leftMargin = DpUtil.dp2px(2); params.leftMargin = DpUtil.dp2px(3);
textParams.setMarginStart(DpUtil.dp2px(1)); textParams.setMarginStart(DpUtil.dp2px(3));
View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); View hourView = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null);
ImageView titleIcon = new ImageView(mContext); ImageView titleIcon = new ImageView(mContext);
mPkRankIcon = hourView.findViewById(R.id.wish_pic); mPkRankIcon = hourView.findViewById(R.id.wish_pic);
mPkRankText = hourView.findViewById(R.id.wish_index); mPkRankText = hourView.findViewById(R.id.wish_index);
mPkRankText.setLayoutParams(textParams); mPkRankText.setLayoutParams(textParams);
mPkRankText.setGravity(Gravity.CENTER); mPkRankText.setGravity(Gravity.START);
titleIcon.setImageResource(R.mipmap.icon_pk_rank); titleIcon.setImageResource(R.mipmap.icon_pk_rank);
titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); titleIcon.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mPkRankIcon.setLayoutParams(params); mPkRankIcon.setLayoutParams(params);
pkRankVf.addView(titleIcon); pkRankVf.addView(titleIcon);
pkRankVf.addView(hourView); pkRankVf.addView(hourView);
pkRankVf.startFlipping(); pkRankVf.startFlipping();
pkRankVf.setOnClickListener(v -> {
Bundle bundle = new Bundle();
String path = bean.getClickUrl();
if (!path.startsWith("/")) {
path = "/" + path;
}
String url = CommonAppConfig.HOST + path;
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token="
+ CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid;
bundle.putString("url", url);
bundle.putInt("height", DpUtil.dp2px(500));
bundle.putInt("show_type", 0);
bundle.putString("roomId", mLiveUid);
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
liveHDDialogFragment.setArguments(bundle);
liveHDDialogFragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
});
pkRankVf.setTag("start"); pkRankVf.setTag("start");
} }
@ -1570,7 +1587,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
PkRankBean bean = listResponseModel.getData().getInfo(); PkRankBean bean = listResponseModel.getData().getInfo();
if (bean != null) { if (bean != null) {
Log.i("PK", bean.toString() + " | " + isLadders); Log.i("PK", bean.toString() + " | " + isLadders);
initPkRankView(); initPkRankView(bean);
mPkRankText.setText(bean.getName()); mPkRankText.setText(bean.getName());
ImgLoader.display(mContext, bean.getImg(), mPkRankIcon); ImgLoader.display(mContext, bean.getImg(), mPkRankIcon);

View File

@ -520,7 +520,8 @@
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_alignTop="@id/hour_rank_layout" android:layout_alignTop="@id/hour_rank_layout"
android:layout_alignParentRight="true" android:layout_alignParentEnd="true"
android:layout_marginEnd="15dp"
android:background="@drawable/bg_live_item_pk_rank" android:background="@drawable/bg_live_item_pk_rank"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"