Commit 16e97eda authored by fallenstardust's avatar fallenstardust

完善显示

parent 0feab90d
......@@ -67,29 +67,28 @@ public class YGOStarter {
private static ImageLoader imageLoader;
private static StringManager mStringManager;
private static SparseArray<Card> cards;
private static Context mContext;
private static View view;
public static void RandomCardDetail(Context context, Card cardInfo) {
mContext = context;
View viewCardDetail = inflate(mContext, R.layout.dialog_cardinfo_small, null);
cardImage = viewCardDetail.findViewById(R.id.card_image);
name = viewCardDetail.findViewById(R.id.text_name);
level = viewCardDetail.findViewById(R.id.card_level);
linkArrow = viewCardDetail.findViewById(R.id.detail_link_arrows);
race = viewCardDetail.findViewById(R.id.card_race);
attrView = viewCardDetail.findViewById(R.id.card_attribute);
type = viewCardDetail.findViewById(R.id.card_type);
cardAtk = viewCardDetail.findViewById(R.id.card_atk);
cardDef = viewCardDetail.findViewById(R.id.card_def);
atkdefView = viewCardDetail.findViewById(R.id.layout_atkdef2);
desc = viewCardDetail.findViewById(R.id.text_desc);
ThreeDLayoutUtil viewCardDetail = (ThreeDLayoutUtil) inflate(context, R.layout.dialog_cardinfo_small, null);
cardImage = viewCardDetail.findViewById(R.id.card_image_toast);
name = viewCardDetail.findViewById(R.id.card_name_toast);
level = viewCardDetail.findViewById(R.id.card_level_toast);
linkArrow = viewCardDetail.findViewById(R.id.link_arrows_toast);
race = viewCardDetail.findViewById(R.id.card_race_toast);
attrView = viewCardDetail.findViewById(R.id.card_attr_toast);
type = viewCardDetail.findViewById(R.id.card_type_toast);
cardAtk = viewCardDetail.findViewById(R.id.card_atk_toast);
cardDef = viewCardDetail.findViewById(R.id.card_def_toast);
atkdefView = viewCardDetail.findViewById(R.id.layout_atkdef2_toast);
desc = viewCardDetail.findViewById(R.id.text_desc_toast);
monsterlayout = viewCardDetail.findViewById(R.id.layout_monster);
layout_detail_p_scale = viewCardDetail.findViewById(R.id.detail_p_scale);
detail_cardscale = viewCardDetail.findViewById(R.id.detail_cardscale);
if (cardInfo == null) return;
mStringManager = DataManager.get().getStringManager();
imageLoader = ImageLoader.get(context);
imageLoader.bindImage(cardImage, cardInfo.Code, null, true);
name.setText(cardInfo.Name);
type.setText(CardUtils.getAllTypeString(cardInfo, mStringManager).replace("/", "|"));
......@@ -97,20 +96,13 @@ public class YGOStarter {
desc.setText(cardInfo.Desc);
if (cardInfo.isType(CardType.Monster)) {
atkdefView.setVisibility(View.VISIBLE);
monsterlayout.setVisibility(View.VISIBLE);
race.setVisibility(View.VISIBLE);
String star = "★" + cardInfo.getStar();
level.setText(star);
if (cardInfo.isType(CardType.Xyz)) {
level.setTextColor(mContext.getResources().getColor(R.color.star_rank));
} else {
level.setTextColor(mContext.getResources().getColor(R.color.star));
}
if (cardInfo.isType(CardType.Pendulum)) {
layout_detail_p_scale.setVisibility(View.VISIBLE);
detail_cardscale.setText(String.valueOf(cardInfo.LScale));
level.setTextColor(context.getResources().getColor(R.color.star_rank));
} else {
layout_detail_p_scale.setVisibility(View.GONE);
level.setTextColor(context.getResources().getColor(R.color.star));
}
cardAtk.setText((cardInfo.Attack < 0 ? "?" : String.valueOf(cardInfo.Attack)));
//连接怪兽设置
......@@ -128,11 +120,10 @@ public class YGOStarter {
} else {
atkdefView.setVisibility(View.GONE);
race.setVisibility(View.GONE);
monsterlayout.setVisibility(View.GONE);
level.setVisibility(View.GONE);
linkArrow.setVisibility(View.GONE);
}
Toast toast = new Toast(mContext);
Toast toast = new Toast(context);
toast.setView(viewCardDetail);
toast.setDuration(Toast.LENGTH_LONG);
toast.show();
......@@ -269,7 +260,6 @@ public class YGOStarter {
//random carddetail first
VUiKit.defer().when(() -> {
mCardManager = DataManager.get().getCardManager();
mStringManager = DataManager.get().getStringManager();
cards = mCardManager.getAllCards();
}).fail((e) -> {
//if failed, random tips second
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<cn.garymb.ygomobile.utils.ThreeDLayoutUtil xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<cn.garymb.ygomobile.utils.ThreeDLayoutUtil
android:id="@+id/td_cardinfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_height="wrap_content">
<LinearLayout
android:id="@id/smContentView"
......@@ -22,7 +15,7 @@
android:layout_height="203dp">
<ImageView
android:id="@+id/card_image"
android:id="@+id/card_image_toast"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
......@@ -39,7 +32,7 @@
android:orientation="vertical">
<cn.garymb.ygomobile.ui.widget.AlwaysMarqueeTextView
android:id="@+id/card_name"
android:id="@+id/card_name_toast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
......@@ -54,19 +47,19 @@
tools:text="Card Name" />
<LinearLayout
android:id="@+id/star_attr_race_scale"
android:id="@+id/star_attr_race_scale_toast"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="horizontal">
<include
android:id="@+id/search_link_arrows"
android:id="@+id/link_arrows_toast"
layout="@layout/item_linkmaker_small"
android:visibility="gone" />
<TextView
android:id="@+id/card_level"
android:id="@+id/card_level_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
......@@ -88,7 +81,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/card_attr"
android:id="@+id/card_attr_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
......@@ -111,7 +104,7 @@
android:textColor="@android:color/holo_green_light" />
<TextView
android:id="@+id/card_race"
android:id="@+id/card_race_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
......@@ -130,44 +123,6 @@
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/p_scale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:layout_width="15dp"
android:layout_height="10dp"
android:layout_gravity="center|left"
android:background="@drawable/p_left" />
<TextView
android:id="@+id/card_scale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:gravity="center"
android:maxLines="1"
android:shadowColor="@color/black"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@color/gray"
tools:text="13" />
<ImageView
android:layout_width="15dp"
android:layout_height="10dp"
android:layout_gravity="center|right"
android:background="@drawable/p_right" />
</LinearLayout>
</LinearLayout>
<LinearLayout
......@@ -177,7 +132,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/card_type"
android:id="@+id/card_type_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
......@@ -188,6 +143,7 @@
tools:text="[A/XYZ]" />
<LinearLayout
android:id="@+id/layout_atkdef2_toast"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
......@@ -195,7 +151,7 @@
android:orientation="horizontal">
<LinearLayout
android:id="@+id/layout_atk"
android:id="@+id/layout_atk_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
......@@ -209,7 +165,7 @@
android:textColor="@android:color/holo_green_light" />
<TextView
android:id="@+id/card_atk"
android:id="@+id/card_atk_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
......@@ -226,12 +182,12 @@
</LinearLayout>
<LinearLayout
android:id="@+id/layout_def"
android:id="@+id/layout_def_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/TextDef"
android:id="@+id/TextDef_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
......@@ -241,7 +197,7 @@
android:textColor="@android:color/holo_green_light" />
<TextView
android:id="@+id/card_def"
android:id="@+id/card_def_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
......@@ -256,7 +212,7 @@
</LinearLayout>
<TextView
android:id="@+id/text_desc"
android:id="@+id/text_desc_toast"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|top"
......@@ -268,5 +224,4 @@
tools:text="desc" />
</LinearLayout>
</LinearLayout>
</cn.garymb.ygomobile.utils.ThreeDLayoutUtil>
</LinearLayout>
\ No newline at end of file
</cn.garymb.ygomobile.utils.ThreeDLayoutUtil>
\ No newline at end of file
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