Commit 16e97eda authored by fallenstardust's avatar fallenstardust

完善显示

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