Commit ddd3e405 authored by fallenstardust's avatar fallenstardust

设置收藏图标

parent d5c93e7e
...@@ -34,6 +34,8 @@ import cn.garymb.ygomobile.utils.DownloadUtil; ...@@ -34,6 +34,8 @@ import cn.garymb.ygomobile.utils.DownloadUtil;
import cn.garymb.ygomobile.utils.FileUtils; import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.YGOUtil; import cn.garymb.ygomobile.utils.YGOUtil;
import ocgcore.CardManager; import ocgcore.CardManager;
import ocgcore.ConfigManager;
import ocgcore.DataManager;
import ocgcore.StringManager; import ocgcore.StringManager;
import ocgcore.data.Card; import ocgcore.data.Card;
import ocgcore.enums.CardType; import ocgcore.enums.CardType;
...@@ -69,7 +71,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder { ...@@ -69,7 +71,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private TextView cardcode; private TextView cardcode;
private View lb_setcode; private View lb_setcode;
private ImageLoader imageLoader; private ImageLoader imageLoader;
private View mImageOpen, atkdefView; private View mImageFav, atkdefView;
private BaseActivity mContext; private BaseActivity mContext;
private StringManager mStringManager; private StringManager mStringManager;
...@@ -130,7 +132,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder { ...@@ -130,7 +132,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
cardAtk = bind(R.id.card_atk); cardAtk = bind(R.id.card_atk);
cardDef = bind(R.id.card_def); cardDef = bind(R.id.card_def);
atkdefView = bind(R.id.layout_atkdef2); atkdefView = bind(R.id.layout_atkdef2);
mImageOpen = bind(R.id.image_control); mImageFav = bind(R.id.image_fav);
monsterlayout = bind(R.id.layout_monster); monsterlayout = bind(R.id.layout_monster);
race = bind(R.id.card_race); race = bind(R.id.card_race);
...@@ -142,7 +144,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder { ...@@ -142,7 +144,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
lb_setcode = bind(R.id.label_setcode); lb_setcode = bind(R.id.label_setcode);
if (cardManager == null) { if (cardManager == null) {
Log.e("CardDetail","加载卡片信息"); Log.e("CardDetail", "加载卡片信息");
cardManager = new CardManager(AppsSettings.get().getDataBaseFile().getAbsolutePath(), null); cardManager = new CardManager(AppsSettings.get().getDataBaseFile().getAbsolutePath(), null);
//加载数据库中所有卡片卡片 //加载数据库中所有卡片卡片
cardManager.loadCards(); cardManager.loadCards();
...@@ -248,6 +250,13 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder { ...@@ -248,6 +250,13 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
} else { } else {
cardcode.setText(String.format("%08d", cardInfo.Alias)); cardcode.setText(String.format("%08d", cardInfo.Alias));
} }
//按是否存在于收藏夹切换显示图标
if (ConfigManager.mLines.contains(cardInfo.Code)) {
mImageFav.setBackgroundResource(R.drawable.ic_fav);
} else {
mImageFav.setBackgroundResource(R.drawable.ic_control_point);
}
type.setText(CardUtils.getAllTypeString(cardInfo, mStringManager).replace("/", "|")); type.setText(CardUtils.getAllTypeString(cardInfo, mStringManager).replace("/", "|"));
attrView.setText(mStringManager.getAttributeString(cardInfo.Attribute)); attrView.setText(mStringManager.getAttributeString(cardInfo.Attribute));
otView.setText(mStringManager.getOtString(cardInfo.Ot, "" + cardInfo.Ot)); otView.setText(mStringManager.getOtString(cardInfo.Ot, "" + cardInfo.Ot));
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/title_height_small" android:layout_height="@dimen/title_height_small"
android:background="@android:color/transparent"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -111,18 +110,32 @@ ...@@ -111,18 +110,32 @@
android:textColor="@color/item_title" android:textColor="@color/item_title"
android:textIsSelectable="true" android:textIsSelectable="true"
tools:text="name" /> tools:text="name" />
<FrameLayout
<TextView
android:id="@+id/card_level"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:gravity="center_vertical" android:orientation="horizontal">
android:maxLines="1"
android:paddingLeft="4dp" <TextView
android:singleLine="true" android:id="@+id/card_level"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:layout_width="match_parent"
android:textColor="@color/star" android:layout_height="wrap_content"
tools:text="★★★★" /> android:gravity="center_vertical"
android:maxLines="1"
android:paddingLeft="4dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/star"
tools:text="★4" />
<ImageView
android:id="@+id/image_fav"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="bottom|right"
android:paddingRight="5dp"
android:scaleType="center"
android:background="@drawable/ic_control_point" />
</FrameLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -141,15 +154,6 @@ ...@@ -141,15 +154,6 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:scaleType="fitXY" android:scaleType="fitXY"
android:src="@drawable/unknown" /> android:src="@drawable/unknown" />
<ImageView
android:id="@+id/image_control"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:scaleType="center"
android:visibility="invisible"
app:srcCompat="@drawable/ic_control_point" />
</FrameLayout> </FrameLayout>
<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