This commit is contained in:
18401019693 2024-03-26 15:03:08 +08:00
parent 5b0f5f03ab
commit de11b5123d
17 changed files with 72 additions and 29 deletions

View File

@ -16,9 +16,11 @@ import java.util.List;
public class LiveBuyGuardSelectAdapter extends RecyclerView.Adapter { public class LiveBuyGuardSelectAdapter extends RecyclerView.Adapter {
List<GuardPriceModel> price = new ArrayList<>(); List<GuardPriceModel> price = new ArrayList<>();
GuardPriceModel model;
public LiveBuyGuardSelectAdapter(List<GuardPriceModel> price) { public LiveBuyGuardSelectAdapter(List<GuardPriceModel> price, GuardPriceModel mModel) {
this.price = price; this.price = price;
model = mModel;
} }
@NonNull @NonNull
@ -31,7 +33,7 @@ public class LiveBuyGuardSelectAdapter extends RecyclerView.Adapter {
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
LiveBuyGuardSelectViewHolder buyGuardSelectViewHolder = (LiveBuyGuardSelectViewHolder) holder; LiveBuyGuardSelectViewHolder buyGuardSelectViewHolder = (LiveBuyGuardSelectViewHolder) holder;
buyGuardSelectViewHolder.setData(price.get(position), liveBuyGuardSelectClickListener); buyGuardSelectViewHolder.setData(price.get(position), liveBuyGuardSelectClickListener,model);
} }
@Override @Override

View File

@ -24,10 +24,12 @@ public class LiveBuyGuardSelectPopup extends AttachPopupView {
List<GuardPriceModel> price = new ArrayList<>(); List<GuardPriceModel> price = new ArrayList<>();
LiveBuyGuardSelectAdapter liveBuyGuardSelectAdapter; LiveBuyGuardSelectAdapter liveBuyGuardSelectAdapter;
RecyclerView live_buy_guard_list; RecyclerView live_buy_guard_list;
GuardPriceModel model;
public LiveBuyGuardSelectPopup(@NonNull Context context, List<GuardPriceModel> mPrice) { public LiveBuyGuardSelectPopup(@NonNull Context context, List<GuardPriceModel> mPrice, GuardPriceModel mModel) {
super(context); super(context);
price = mPrice; price = mPrice;
model = mModel;
} }
protected int getImplLayoutId() { protected int getImplLayoutId() {
@ -37,7 +39,7 @@ public class LiveBuyGuardSelectPopup extends AttachPopupView {
@Override @Override
protected void onCreate() { protected void onCreate() {
live_buy_guard_list = findViewById(R.id.live_buy_guard_list); live_buy_guard_list = findViewById(R.id.live_buy_guard_list);
liveBuyGuardSelectAdapter = new LiveBuyGuardSelectAdapter(price); liveBuyGuardSelectAdapter = new LiveBuyGuardSelectAdapter(price,model);
live_buy_guard_list.setAdapter(liveBuyGuardSelectAdapter); live_buy_guard_list.setAdapter(liveBuyGuardSelectAdapter);
live_buy_guard_list.setLayoutManager(new LinearLayoutManager(getContext())); live_buy_guard_list.setLayoutManager(new LinearLayoutManager(getContext()));
liveBuyGuardSelectAdapter.setLiveBuyGuardSelectClickListener(new LiveBuyGuardSelectViewHolder.LiveBuyGuardSelectClickListener() { liveBuyGuardSelectAdapter.setLiveBuyGuardSelectClickListener(new LiveBuyGuardSelectViewHolder.LiveBuyGuardSelectClickListener() {
@ -101,6 +103,11 @@ public class LiveBuyGuardSelectPopup extends AttachPopupView {
// } // }
// }); // });
if (model == null) {
} else {
}
} }
public LiveBuyGuardSelectPopup setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) { public LiveBuyGuardSelectPopup setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {

View File

@ -1,5 +1,6 @@
package com.yunbao.common.views; package com.yunbao.common.views;
import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
@ -11,14 +12,19 @@ import com.yunbao.common.bean.GuardPriceModel;
public class LiveBuyGuardSelectViewHolder extends RecyclerView.ViewHolder { public class LiveBuyGuardSelectViewHolder extends RecyclerView.ViewHolder {
TextView opening_time, discount; TextView opening_time, discount;
View layout;
public LiveBuyGuardSelectViewHolder(@NonNull View itemView) { public LiveBuyGuardSelectViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
opening_time = itemView.findViewById(R.id.opening_time); opening_time = itemView.findViewById(R.id.opening_time);
discount = itemView.findViewById(R.id.discount); discount = itemView.findViewById(R.id.discount);
layout = itemView.findViewById(R.id.layout);
} }
public void setData(GuardPriceModel guardPriceModel,LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener) { public void setData(GuardPriceModel guardPriceModel, LiveBuyGuardSelectClickListener liveBuyGuardSelectClickListener, GuardPriceModel mModel) {
if (mModel != null && TextUtils.equals(String.valueOf(guardPriceModel.getPriceKey()), String.valueOf(mModel.getPriceKey()))) {
layout.setSelected(true);
}
opening_time.setText(String.valueOf(guardPriceModel.getOpeningTime())); opening_time.setText(String.valueOf(guardPriceModel.getOpeningTime()));
discount.setText(String.valueOf(guardPriceModel.getDiscount())); discount.setText(String.valueOf(guardPriceModel.getDiscount()));
itemView.setOnClickListener(new View.OnClickListener() { itemView.setOnClickListener(new View.OnClickListener() {
@ -31,6 +37,7 @@ public class LiveBuyGuardSelectViewHolder extends RecyclerView.ViewHolder {
}); });
} }
public interface LiveBuyGuardSelectClickListener { public interface LiveBuyGuardSelectClickListener {
void onClickListener(GuardPriceModel guardPriceModel); void onClickListener(GuardPriceModel guardPriceModel);
} }

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/background_live_buy_guard_slelect_item1" android:state_selected="false" />
<item android:drawable="@drawable/background_live_buy_guard_slelect_item2" android:state_selected="true" />
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00000000" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#2D3271" />
</shape>

View File

@ -2,15 +2,19 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="120dp" android:layout_height="130dp"
android:background="@drawable/bg_live_buy_guard_select" android:background="@drawable/bg_live_buy_guard_select"
android:orientation="vertical"> android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/live_buy_guard_list" android:id="@+id/live_buy_guard_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
tools:itemCount="4" tools:itemCount="4"
android:layout_marginBottom="5dp"
tools:listitem="@layout/view_live_buy_guard_slelect_item" /> tools:listitem="@layout/view_live_buy_guard_slelect_item" />
</LinearLayout> </LinearLayout>

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="30dp" android:layout_height="30dp"
android:background="@drawable/background_live_buy_guard_slelect_item"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">

View File

@ -1455,9 +1455,9 @@ Limited ride And limited avatar frame</string>
<string name="guard_buy_type_1">【Star Guardian】</string> <string name="guard_buy_type_1">【Star Guardian】</string>
<string name="guardian_privilege">Guardianship privileges</string> <string name="guardian_privilege">Guardianship privileges</string>
<string name="be_their_exclusive_guardian">Becoming the exclusive guardian of the anchor\n</string> <string name="be_their_exclusive_guardian">Be the anchors guardian</string>
<string name="not_yet_open">Not opened</string> <string name="not_yet_open">Not opened</string>
<string name="tas_guardian_group">The anchor\'s guardian group</string> <string name="tas_guardian_group">guardian group</string>
<string name="open_the_kings_guard">Activate King Guardian</string> <string name="open_the_kings_guard">Activate King Guardian</string>
<string name="open_the_start_guard">Activate Star Guardian</string> <string name="open_the_start_guard">Activate Star Guardian</string>
<string name="open_the_god_guard">Activate God Guardian</string> <string name="open_the_god_guard">Activate God Guardian</string>

View File

@ -1454,9 +1454,9 @@
<string name="guard_buy_type_1">【星之守护】</string> <string name="guard_buy_type_1">【星之守护】</string>
<string name="guardian_privilege">守護團特權</string> <string name="guardian_privilege">守護團特權</string>
<string name="be_their_exclusive_guardian">爲TA的專屬守護 為TA保駕護航</string> <string name="be_their_exclusive_guardian">為TA的專屬守護</string>
<string name="not_yet_open">暫未開通</string> <string name="not_yet_open">暫未開通</string>
<string name="tas_guardian_group">TA的守護團 ></string> <string name="tas_guardian_group">守護團 ></string>
<string name="open_the_kings_guard">開通王之守護</string> <string name="open_the_kings_guard">開通王之守護</string>
<string name="open_the_start_guard">開通星之守護</string> <string name="open_the_start_guard">開通星之守護</string>
<string name="open_the_god_guard">開通神之守護</string> <string name="open_the_god_guard">開通神之守護</string>

View File

@ -1453,9 +1453,9 @@
<string name="guard_buy_type_1">【星之守护】</string> <string name="guard_buy_type_1">【星之守护】</string>
<string name="guardian_privilege">守護團特權</string> <string name="guardian_privilege">守護團特權</string>
<string name="be_their_exclusive_guardian">爲TA的專屬守護 為TA保駕護航</string> <string name="be_their_exclusive_guardian">為TA的專屬守護</string>
<string name="not_yet_open">暫未開通</string> <string name="not_yet_open">暫未開通</string>
<string name="tas_guardian_group">TA的守護團 ></string> <string name="tas_guardian_group">守護團 ></string>
<string name="open_the_kings_guard">開通王之守護</string> <string name="open_the_kings_guard">開通王之守護</string>
<string name="open_the_start_guard">開通星之守護</string> <string name="open_the_start_guard">開通星之守護</string>
<string name="open_the_god_guard">開通神之守護</string> <string name="open_the_god_guard">開通神之守護</string>

View File

@ -1450,9 +1450,9 @@
<string name="guard_buy_type_1">【星之守护】</string> <string name="guard_buy_type_1">【星之守护】</string>
<string name="guardian_privilege">守護團特權</string> <string name="guardian_privilege">守護團特權</string>
<string name="be_their_exclusive_guardian">爲TA的專屬守護 為TA保駕護航</string> <string name="be_their_exclusive_guardian">為TA的專屬守護</string>
<string name="not_yet_open">暫未開通</string> <string name="not_yet_open">暫未開通</string>
<string name="tas_guardian_group">TA的守護團 ></string> <string name="tas_guardian_group">守護團 ></string>
<string name="open_the_kings_guard">開通王之守護</string> <string name="open_the_kings_guard">開通王之守護</string>
<string name="open_the_start_guard">開通星之守護</string> <string name="open_the_start_guard">開通星之守護</string>
<string name="open_the_god_guard">開通神之守護</string> <string name="open_the_god_guard">開通神之守護</string>

View File

@ -1458,9 +1458,9 @@ Limited ride And limited avatar frame</string>
<string name="guard_buy_type_1">【Star Guardian】</string> <string name="guard_buy_type_1">【Star Guardian】</string>
<string name="guardian_privilege">Guardianship privileges</string> <string name="guardian_privilege">Guardianship privileges</string>
<string name="be_their_exclusive_guardian">Becoming the exclusive guardian of the anchor\n</string> <string name="be_their_exclusive_guardian">Be the anchors guardian</string>
<string name="not_yet_open">Not opened</string> <string name="not_yet_open">Not opened</string>
<string name="tas_guardian_group">The anchor\'s guardian group</string> <string name="tas_guardian_group">guardian group</string>
<string name="open_the_kings_guard">Activate King Guardian</string> <string name="open_the_kings_guard">Activate King Guardian</string>
<string name="open_the_start_guard">Activate Star Guardian</string> <string name="open_the_start_guard">Activate Star Guardian</string>
<string name="open_the_god_guard">Activate God Guardian</string> <string name="open_the_god_guard">Activate God Guardian</string>

View File

@ -286,7 +286,7 @@ public class LiveBuyGuardDialog extends AbsDialogPopupWindow {
.isDestroyOnDismiss(true) .isDestroyOnDismiss(true)
.isLightStatusBar(false) .isLightStatusBar(false)
.popupPosition(PopupPosition.Top) .popupPosition(PopupPosition.Top)
.asCustom(new LiveBuyGuardSelectPopup(getContext(), price) .asCustom(new LiveBuyGuardSelectPopup(getContext(), price,guardPriceModel)
.setOnDismissListener(new DialogInterface.OnDismissListener() { .setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override @Override
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {

View File

@ -8,7 +8,7 @@
<ImageView <ImageView
android:id="@+id/bg" android:id="@+id/bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="160dp" android:layout_height="180dp"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:scaleType="fitXY" android:scaleType="fitXY"
android:src="@mipmap/bg_star_guard" /> android:src="@mipmap/bg_star_guard" />
@ -38,6 +38,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginBottom="10dp"
android:orientation="horizontal"> android:orientation="horizontal">
@ -55,8 +56,8 @@
<com.makeramen.roundedimageview.RoundedImageView <com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/user_avatar" android:id="@+id/user_avatar"
android:layout_width="51dp" android:layout_width="45dp"
android:layout_height="51dp" android:layout_height="45dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="35dp" android:layout_marginStart="35dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
@ -65,8 +66,8 @@
<com.makeramen.roundedimageview.RoundedImageView <com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/live_avatar" android:id="@+id/live_avatar"
android:layout_width="51dp" android:layout_width="45dp"
android:layout_height="51dp" android:layout_height="45dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@mipmap/icon_male_default" android:src="@mipmap/icon_male_default"
@ -84,7 +85,7 @@
</LinearLayout> </LinearLayout>
<FrameLayout <FrameLayout
android:layout_width="93dp" android:layout_width="120dp"
android:layout_height="28dp" android:layout_height="28dp"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
@ -92,7 +93,8 @@
<ImageView <ImageView
android:id="@+id/guard_open" android:id="@+id/guard_open"
android:layout_width="match_parent" android:layout_width="93dp"
android:layout_gravity="center"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@mipmap/icon_bg_star_guard_open" /> android:src="@mipmap/icon_bg_star_guard_open" />

View File

@ -20,12 +20,14 @@
<com.stx.xhb.androidx.XBanner <com.stx.xhb.androidx.XBanner
android:id="@+id/buy_guard_banner" android:id="@+id/buy_guard_banner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp" android:layout_height="220dp"
android:layout_marginTop="40dp" android:layout_marginTop="20dp"
app:isAutoPlay="false" app:isAutoPlay="false"
app:isClipChildrenMode="true" app:isClipChildrenMode="true"
app:isClipChildrenModeLessThree="true" app:isClipChildrenModeLessThree="true"
app:isHandLoop="true" app:isHandLoop="true"
app:clipChildrenLeftMargin="20dp"
app:clipChildrenRightMargin="20dp"
app:isShowIndicatorOnlyOne="true" app:isShowIndicatorOnlyOne="true"
app:isShowNumberIndicator="false" app:isShowNumberIndicator="false"
app:showIndicatorInCenter="false" /> app:showIndicatorInCenter="false" />
@ -169,6 +171,7 @@
<TextView <TextView
android:id="@+id/guard_month" android:id="@+id/guard_month"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginStart="10dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="@string/one_month" android:text="@string/one_month"

View File

@ -14,6 +14,7 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="50dp" android:layout_marginTop="50dp"
android:orientation="vertical"> android:orientation="vertical">