Commit 467f17a3 authored by fallenstardust's avatar fallenstardust

美化toast view

parent 4366e5fd
...@@ -34,6 +34,7 @@ public class CardDetailRandom { ...@@ -34,6 +34,7 @@ public class CardDetailRandom {
private static StringManager mStringManager; private static StringManager mStringManager;
public static void RandomCardDetail(Context context, Card cardInfo) { public static void RandomCardDetail(Context context, Card cardInfo) {
if (cardInfo == null) return;
imageLoader = ImageLoader.get(context); imageLoader = ImageLoader.get(context);
viewCardDetail = inflate(context, R.layout.dialog_cardinfo_small, null); viewCardDetail = inflate(context, R.layout.dialog_cardinfo_small, null);
cardImage = viewCardDetail.findViewById(R.id.card_image_toast); cardImage = viewCardDetail.findViewById(R.id.card_image_toast);
...@@ -49,7 +50,6 @@ public class CardDetailRandom { ...@@ -49,7 +50,6 @@ public class CardDetailRandom {
textdefView = viewCardDetail.findViewById(R.id.TextDef_toast); textdefView = viewCardDetail.findViewById(R.id.TextDef_toast);
desc = viewCardDetail.findViewById(R.id.text_desc_toast); desc = viewCardDetail.findViewById(R.id.text_desc_toast);
if (cardInfo == null) return;
mStringManager = DataManager.get().getStringManager(); mStringManager = DataManager.get().getStringManager();
imageLoader.bindImage(cardImage, cardInfo.Code); imageLoader.bindImage(cardImage, cardInfo.Code);
name.setText(cardInfo.Name); name.setText(cardInfo.Name);
...@@ -89,7 +89,7 @@ public class CardDetailRandom { ...@@ -89,7 +89,7 @@ public class CardDetailRandom {
Toast toast = new Toast(context); Toast toast = new Toast(context);
toast.setView(viewCardDetail); toast.setView(viewCardDetail);
toast.setDuration(Toast.LENGTH_LONG); toast.setDuration(Toast.LENGTH_LONG);
toast.setGravity(Gravity.LEFT, 50, 0); toast.setGravity(Gravity.LEFT, 30, 0);
toast.show(); toast.show();
} }
} }
...@@ -665,9 +665,8 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie ...@@ -665,9 +665,8 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
cards = mCardManager.getAllCards(); cards = mCardManager.getAllCards();
int y = (int) (Math.random() * cards.size()); int y = (int) (Math.random() * cards.size());
Card cardInfo = cards.valueAt(y); Card cardInfo = cards.valueAt(y);
if (cardInfo == null) { if (cardInfo == null)
Toast.makeText(this, "code为空", Toast.LENGTH_LONG).show(); return;
}
CardDetailRandom.RandomCardDetail(this, cardInfo); CardDetailRandom.RandomCardDetail(this, cardInfo);
} }
} }
<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="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="170dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="10dp"
android:background="@drawable/window2"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
...@@ -90,7 +94,9 @@ ...@@ -90,7 +94,9 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="10dp" android:background="@drawable/window2"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"> android:orientation="vertical">
<cn.garymb.ygomobile.ui.widget.AlwaysMarqueeTextView <cn.garymb.ygomobile.ui.widget.AlwaysMarqueeTextView
...@@ -99,7 +105,7 @@ ...@@ -99,7 +105,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:shadowColor="@color/black" android:shadowColor="@color/black"
android:shadowDx="1" android:shadowDx="-2"
android:shadowDy="2" android:shadowDy="2"
android:shadowRadius="2" android:shadowRadius="2"
android:singleLine="true" android:singleLine="true"
...@@ -112,7 +118,6 @@ ...@@ -112,7 +118,6 @@
android:id="@+id/star_attr_race_toast" android:id="@+id/star_attr_race_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:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -175,11 +180,6 @@ ...@@ -175,11 +180,6 @@
android:textColor="@color/gray" android:textColor="@color/gray"
tools:text="SpellCaster" /> tools:text="SpellCaster" />
</LinearLayout> </LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
......
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