Commit 409e4acf authored by fallenstardust's avatar fallenstardust

卡片详情显示所属卡包名称

parent 1fb142a3
......@@ -63,7 +63,8 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private final TextView race;
private final TextView cardAtk;
private final TextView cardDef;
private final LinearLayout ll_pack;
private final TextView packName;
private final TextView setName;
private final TextView otView;
private final TextView attrView;
......@@ -81,6 +82,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private final View mImageFav, atkdefView;
private final StringManager mStringManager;
private final BaseActivity mContext;
private int curPosition;
private Card mCardInfo;
private CardListProvider mProvider;
......@@ -94,7 +96,6 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private Button btn_redownload;
private Button btn_share;
private boolean isDownloadCardImage = true;
private boolean mShowAdd = false;
@SuppressLint("HandlerLeak")
Handler handler = new Handler() {
......@@ -126,7 +127,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
};
private final BaseActivity mContext;
private boolean mShowAdd = false;
private OnFavoriteChangedListener mCallBack;
public CardDetail(BaseActivity context, ImageLoader imageLoader, StringManager stringManager) {
......@@ -135,6 +136,8 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
cardImage = findViewById(R.id.card_image);
this.imageLoader = imageLoader;
mStringManager = stringManager;
ll_pack = findViewById(R.id.ll_pack);
packName = findViewById(R.id.pack_name);
name = findViewById(R.id.text_name);
desc = findViewById(R.id.text_desc);
close = findViewById(R.id.btn_close);
......@@ -271,6 +274,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
cardImage.setOnClickListener((v) -> {
showCardImageDetail(cardInfo.Code);
});
packName.setText(getPackName());
name.setText(cardInfo.Name);
if (cardInfo.Name.equals("Unknown")) {
desc.setText(R.string.tip_card_info_diff);
......@@ -280,8 +284,10 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
cardCode.setText(String.format("%08d", cardInfo.getCode()));
if (cardInfo.isType(CardType.Token)) {
faq.setVisibility(View.INVISIBLE);
ll_pack.setVisibility(View.INVISIBLE);
} else {
faq.setVisibility(View.VISIBLE);
ll_pack.setVisibility(View.VISIBLE);
}
if (mShowAdd) {
if (cardInfo.isType(CardType.Token)) {
......@@ -361,8 +367,12 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
private String getPackName(Card cardInfo) {
String packname = "";
return packname;
}
private void showCardImageDetail(int code) {
AppsSettings appsSettings = AppsSettings.get();
View view = dialog.initDialog(context, R.layout.dialog_photo);
dialog.setDialogWidth(ViewGroup.LayoutParams.MATCH_PARENT);
......@@ -545,7 +555,6 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
public interface OnFavoriteChangedListener {
void onFavoriteChange(Card card, boolean favorite);
}
......
......@@ -145,9 +145,9 @@
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/selector_favorite"
android:paddingRight="5dp"
android:scaleType="fitCenter" />
android:scaleType="fitCenter"
android:src="@drawable/selector_favorite" />
</LinearLayout>
<LinearLayout
......@@ -175,6 +175,33 @@
android:orientation="vertical"
android:paddingLeft="5dp">
<LinearLayout
android:id="@+id/ll_pack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/category_pack"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textColor="@color/item_title" />
<TextView
android:id="@+id/pack_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:maxLines="1"
android:paddingLeft="4dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:textColor="@color/holo_blue_bright"
tools:text="2024-12-21 25PP" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment