Commit 38f8af59 authored by fallenstardust's avatar fallenstardust

判断是否含有先行卡

parent 398b799e
......@@ -46,7 +46,7 @@ public class Deck implements Parcelable {
private static final String CARD_DIVIDE_ID = "_";
private static final String CARD_DIVIDE_NUM = "*";
private ArrayList<Integer> allList;
private final ArrayList<Integer> mainlist;
private final ArrayList<Integer> extraList;
private final ArrayList<Integer> sideList;
......@@ -57,6 +57,7 @@ public class Deck implements Parcelable {
mainlist = new ArrayList<>();
extraList = new ArrayList<>();
sideList = new ArrayList<>();
allList = new ArrayList<>();
}
public Deck(String name, Uri uri) {
......@@ -466,7 +467,7 @@ public class Deck implements Parcelable {
}
public int getDeckCount() {
return getMainCount() + getExtraCount();
return getMainCount() + getExtraCount() + getSideCount();
}
public File saveTemp(String dir) {
......@@ -510,6 +511,15 @@ public class Deck implements Parcelable {
return extraList;
}
public List<Integer> getAlllist() {
if (allList.size() == 0) {
allList.addAll(mainlist);
allList.addAll(extraList);
allList.addAll(sideList);
}
return allList;
}
public void addMain(Integer id) {
if (mainlist.size() >= Constants.DECK_MAIN_MAX) {
return;
......
......@@ -334,9 +334,11 @@ public class DeckInfo {
public List<Card> getAllCards() {
if (allCards.size() == 0) {
allCards.addAll(mainCards);
allCards.addAll(extraCards);
allCards.addAll(sideCards);
allCards.addAll(mainCards);
allCards.addAll(extraCards);
allCards.addAll(sideCards);
}
return allCards;
}
}
......@@ -27,6 +27,9 @@ import cn.garymb.ygomobile.ui.cards.deck.DeckAdapater;
import cn.garymb.ygomobile.ui.cards.deck.DeckItem;
import cn.garymb.ygomobile.ui.cards.deck.ImageTop;
import cn.garymb.ygomobile.utils.YGOUtil;
import ocgcore.DataManager;
import ocgcore.LimitManager;
import ocgcore.data.Card;
import ocgcore.data.LimitList;
public class DeckListAdapter<T extends TextSelect> extends BaseQuickAdapter<T, DeckViewHolder> {
......@@ -63,7 +66,8 @@ public class DeckListAdapter<T extends TextSelect> extends BaseQuickAdapter<T, D
onItemSelectListener.onItemSelect(position, data.get(position).getObject());
}
});
mCardLoader = new CardLoader(context);
//初始化
mCardLoader = new CardLoader(context);
imageLoader = new ImageLoader();
mLimitList = new LimitList();
mDeckLoader = new DeckLoader();
......@@ -77,7 +81,6 @@ public class DeckListAdapter<T extends TextSelect> extends BaseQuickAdapter<T, D
//item是deckFile类型
this.deckFile = (DeckFile) item;
this.deckInfo = mDeckLoader.readDeck(mCardLoader, deckFile.getPathFile(), mLimitList);
Log.i("看看3.9.7", deckInfo +"");
//填入内容
imageLoader.bindImage(holder.cardImage, deckFile.getFirstCode(), ImageLoader.Type.small);
holder.deckName.setText(item.getName());
......@@ -96,9 +99,24 @@ public class DeckListAdapter<T extends TextSelect> extends BaseQuickAdapter<T, D
} else {
holder.item_deck_list.setBackgroundResource(Color.TRANSPARENT);
}
}else {
} else {
holder.item_deck_list.setBackgroundResource(Color.TRANSPARENT);
}
//判断是否含有先行卡
Deck deck = this.deckInfo.toDeck();
List<Integer> intList = new ArrayList<>();
intList.addAll(deck.getAlllist());
int len;
for (int i = 0; i < deck.getDeckCount(); i++) {
len = intList.get(i).toString().length();
if (len > 8) {
holder.prerelease_star.setVisibility(View.VISIBLE);
break;
} else {
holder.prerelease_star.setVisibility(View.GONE);
continue;
}
}
}
......
......@@ -2,9 +2,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_deck_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/item_deck_list">
android:layout_height="wrap_content">
<RelativeLayout
......@@ -14,6 +14,7 @@
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp">
<ImageView
android:id="@+id/card_image"
android:layout_width="match_parent"
......@@ -47,12 +48,20 @@
android:layout_marginTop="3dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/prerelease_star"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginRight="@dimen/dp_10"
android:visibility="visible"
android:background="@drawable/ic_fav"/>
<TextView
android:id="@+id/count_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:textColor="@color/holo_blue_bright"
android:textSize="10sp"
tools:text="40" />
<TextView
......@@ -60,8 +69,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/"
android:textSize="10sp"
android:textColor="@android:color/holo_green_light" />
android:textColor="@android:color/holo_green_light"
android:textSize="10sp" />
<TextView
android:id="@+id/count_ex"
......@@ -76,8 +85,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/"
android:textSize="10sp"
android:textColor="@android:color/holo_green_light" />
android:textColor="@android:color/holo_green_light"
android:textSize="10sp" />
<TextView
android:id="@+id/count_side"
......@@ -89,19 +98,6 @@
android:textSize="10sp"
tools:text="15" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/prerelease_star"
android:layout_width="@dimen/right_size"
android:layout_height="@dimen/right_size"
android:layout_marginRight="@dimen/dp_10"
android:visibility="visible"
tools:src="@drawable/ic_close_black_24dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ 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