Commit ddd3e405 authored by fallenstardust's avatar fallenstardust

设置收藏图标

parent d5c93e7e
......@@ -34,6 +34,8 @@ import cn.garymb.ygomobile.utils.DownloadUtil;
import cn.garymb.ygomobile.utils.FileUtils;
import cn.garymb.ygomobile.utils.YGOUtil;
import ocgcore.CardManager;
import ocgcore.ConfigManager;
import ocgcore.DataManager;
import ocgcore.StringManager;
import ocgcore.data.Card;
import ocgcore.enums.CardType;
......@@ -69,7 +71,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private TextView cardcode;
private View lb_setcode;
private ImageLoader imageLoader;
private View mImageOpen, atkdefView;
private View mImageFav, atkdefView;
private BaseActivity mContext;
private StringManager mStringManager;
......@@ -130,7 +132,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
cardAtk = bind(R.id.card_atk);
cardDef = bind(R.id.card_def);
atkdefView = bind(R.id.layout_atkdef2);
mImageOpen = bind(R.id.image_control);
mImageFav = bind(R.id.image_fav);
monsterlayout = bind(R.id.layout_monster);
race = bind(R.id.card_race);
......@@ -142,7 +144,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
lb_setcode = bind(R.id.label_setcode);
if (cardManager == null) {
Log.e("CardDetail","加载卡片信息");
Log.e("CardDetail", "加载卡片信息");
cardManager = new CardManager(AppsSettings.get().getDataBaseFile().getAbsolutePath(), null);
//加载数据库中所有卡片卡片
cardManager.loadCards();
......@@ -248,6 +250,13 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
} else {
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("/", "|"));
attrView.setText(mStringManager.getAttributeString(cardInfo.Attribute));
otView.setText(mStringManager.getOtString(cardInfo.Ot, "" + cardInfo.Ot));
......
......@@ -31,7 +31,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/title_height_small"
android:background="@android:color/transparent"
android:orientation="horizontal">
<TextView
......@@ -111,6 +110,10 @@
android:textColor="@color/item_title"
android:textIsSelectable="true"
tools:text="name" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/card_level"
......@@ -122,7 +125,17 @@
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="@color/star"
tools:text="★★★★" />
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
android:layout_width="match_parent"
......@@ -141,15 +154,6 @@
android:layout_gravity="center_vertical"
android:scaleType="fitXY"
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>
<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