Commit 5df16924 authored by fallenstardust's avatar fallenstardust

根据是否是卡包展示动态变更extralabel的位置

微调布局
给卡组最后一行增加透明卡方便划动到底部不和底部按钮重叠
parent 4643a8a1
......@@ -181,12 +181,15 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(), 0, mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingBottom());
mRecyclerView.setAdapter((mDeckAdapater = new DeckAdapater(getContext(), mRecyclerView, getImageLoader())));
mRecyclerView.setLayoutManager(new DeckLayoutManager(getContext(), Constants.DECK_WIDTH_COUNT));
mDeckItemTouchHelper = new DeckItemTouchHelper(mDeckAdapater);
ItemTouchHelperPlus touchHelper = new ItemTouchHelperPlus(getContext(), mDeckItemTouchHelper);
touchHelper.setItemDragListener(this);
touchHelper.setEnableClickDrag(Constants.DECK_SINGLE_PRESS_DRAG);
touchHelper.attachToRecyclerView(mRecyclerView);
mRecyclerView.addOnItemTouchListener(new RecyclerViewItemListener(mRecyclerView, this));
initBoomMenuButton(layoutView.findViewById(R.id.bmb));
layoutView.findViewById(R.id.btn_nav_search).setOnClickListener((v) -> doMenu(R.id.action_search));
layoutView.findViewById(R.id.btn_nav_list).setOnClickListener((v) -> doMenu(R.id.action_card_list));
......
package cn.garymb.ygomobile.ui.cards.deck;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.bean.DeckInfo;
import ocgcore.data.Card;
public class DeckItem {
// public final static int HeadView = 0;
// public final static int HeadView = 0;
public final static int MainLabel = 0;
public final static int MainStart = MainLabel + 1;
public final static int MainEnd = MainStart + Constants.DECK_MAIN_MAX - 1;
public final static int ExtraLabel = MainEnd + 1;
public final static int ExtraStart = ExtraLabel + 1;
public final static int ExtraEnd = ExtraStart + Constants.DECK_EXTRA_COUNT - 1;
public final static int SideLabel = ExtraEnd + 1;
public final static int SideStart = SideLabel + 1;
public final static int SideEnd = SideStart + Constants.DECK_SIDE_COUNT - 1;
public static int MainEnd = MainStart + Constants.DECK_MAIN_MAX - 1;
public static int ExtraLabel = MainEnd + 1;
public static int ExtraStart = ExtraLabel + 1;
public static int ExtraEnd = ExtraStart + Constants.DECK_EXTRA_COUNT - 1;
public static int SideLabel = ExtraEnd + 1;
public static int SideStart = SideLabel + 1;
public static int SideEnd = SideStart + Constants.DECK_SIDE_COUNT - 1;
public static void resetLabel(DeckInfo deckInfo, boolean isPack) {
if (!isPack) {
MainEnd = MainStart + Constants.DECK_MAIN_MAX - 1;
} else {
if(deckInfo.getMainCount() <= Constants.DECK_MAIN_MAX) {
MainEnd = MainStart + Constants.DECK_MAIN_MAX - 1;
} else {
MainEnd = MainStart + deckInfo.getMainCount() - 1;
}
}
ExtraLabel = MainEnd + 1;
ExtraStart = ExtraLabel + 1;
ExtraEnd = ExtraStart + Constants.DECK_EXTRA_COUNT - 1;
SideLabel = ExtraEnd + 1;
SideStart = SideLabel + 1;
SideEnd = SideStart + Constants.DECK_SIDE_COUNT - 1;
}
private DeckItemType mType;
private Card mCardInfo;
......
......@@ -169,6 +169,7 @@ class DeckItemUtils {
public static void makeItems(DeckInfo deckInfo, boolean isPack, DeckAdapater adapater) {
if (deckInfo != null) {
DeckItem.resetLabel(deckInfo, isPack);
adapater.addItem(new DeckItem(DeckItemType.MainLabel));
List<Card> main = deckInfo.getMainCards();
if (main == null) {
......@@ -183,6 +184,12 @@ class DeckItemUtils {
for (int i = main.size(); i < Constants.DECK_MAIN_MAX; i++) {
adapater.addItem(new DeckItem());
}
} else {
//填充空舍的位置便于滚动到底部时不和底部功能按钮重叠
int emty = Constants.DECK_WIDTH_COUNT - deckInfo.getMainCount() % Constants.DECK_WIDTH_COUNT;
for (int i = main.size(); i < emty + deckInfo.getMainCount(); i++) {
adapater.addItem(new DeckItem());
}
}
}
List<Card> extra = deckInfo.getExtraCards();
......@@ -216,6 +223,7 @@ class DeckItemUtils {
adapater.addItem(new DeckItem());
}
}
adapater.addItem(new DeckItem(deckInfo.getMainCard(1),DeckItemType.Space));
}
}
}
......@@ -233,7 +241,7 @@ class DeckItemUtils {
}
public static boolean isLabel(int position) {
if (position == DeckItem.MainLabel || position == DeckItem.SideLabel || position == DeckItem.ExtraLabel) {
if (position == DeckItem.MainLabel || position == DeckItem.ExtraLabel || position == DeckItem.SideLabel) {
return true;
}
return false;
......
......@@ -42,6 +42,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/deck_name"
android:textStyle="bold"
android:shadowColor="@color/black"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:textColor="@color/holo_blue_light" />
<androidx.appcompat.widget.AppCompatTextView
......@@ -54,6 +59,10 @@
android:text="@string/select_deck"
android:textColor="@color/white"
android:textSize="18sp"
android:shadowColor="@color/black"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:textStyle="bold" />
</LinearLayout>
......@@ -83,7 +92,13 @@
android:layout_width="60dp"
android:layout_height="20dp"
android:gravity="bottom|center_horizontal"
android:text="@string/searchresult" />
android:text="@string/searchresult"
android:textColor="@color/white"
android:textStyle="bold"
android:shadowColor="@color/black"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"/>
</LinearLayout>
<LinearLayout
......@@ -104,7 +119,13 @@
android:layout_width="60dp"
android:layout_height="20dp"
android:gravity="bottom|center_horizontal"
android:text="@string/card_search" />
android:text="@string/card_search"
android:textColor="@color/white"
android:textStyle="bold"
android:shadowColor="@color/black"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"/>
</LinearLayout>
<LinearLayout
......@@ -139,7 +160,13 @@
android:layout_width="60dp"
android:layout_height="20dp"
android:gravity="bottom|center_horizontal"
android:text="@string/Function_Menu" />
android:text="@string/Function_Menu"
android:textColor="@color/white"
android:textStyle="bold"
android:shadowColor="@color/black"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
......
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