Commit 88f0ee88 authored by fallenstardust's avatar fallenstardust

添加genesys计分板

parent dd39a1bd
...@@ -28,7 +28,7 @@ public class CardKeyWord { ...@@ -28,7 +28,7 @@ public class CardKeyWord {
if (!TextUtils.isEmpty(word)) { if (!TextUtils.isEmpty(word)) {
// 判断是否为纯数字且长度大于等于5,若是则作为卡密搜索 // 判断是否为纯数字且长度大于等于5,若是则作为卡密搜索
if (TextUtils.isDigitsOnly(word) && word.length() >= 3) { if (TextUtils.isDigitsOnly(word) && word.length() >= 5) {
// 添加卡密过滤器 // 添加卡密过滤器
filterList.add(new CodeFilter(Long.parseLong(word))); filterList.add(new CodeFilter(Long.parseLong(word)));
} else { } else {
......
...@@ -163,7 +163,10 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte ...@@ -163,7 +163,10 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
private DeckItemTouchHelper mDeckItemTouchHelper; private DeckItemTouchHelper mDeckItemTouchHelper;
private TextView tv_deck; private TextView tv_deck;
private TextView tv_result_count; private TextView tv_result_count;
private LinearLayout ll_genesys_scoreboard;
private TextView tv_credit_count; private TextView tv_credit_count;
private TextView tv_credit_limit;
private TextView tv_credit_difference;
private AppCompatSpinner mLimitSpinner; private AppCompatSpinner mLimitSpinner;
private CardDetail mCardDetail; private CardDetail mCardDetail;
private DialogPlus mDialog; private DialogPlus mDialog;
...@@ -248,9 +251,14 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte ...@@ -248,9 +251,14 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
mCardSearcher = new CardSearcher(layoutView.findViewById(R.id.nav_view_list), mCardLoader); mCardSearcher = new CardSearcher(layoutView.findViewById(R.id.nav_view_list), mCardLoader);
mCardSearcher.setCallBack(this); mCardSearcher.setCallBack(this);
// 查找顶部展示区域的文本控件 //初始化genesys计分板
tv_deck = layoutView.findViewById(R.id.tv_deck); ll_genesys_scoreboard = layoutView.findViewById(R.id.ll_genesys_scoreboard);
tv_credit_count = layoutView.findViewById(R.id.tv_credit_count); tv_credit_count = layoutView.findViewById(R.id.tv_credit_count);
tv_credit_limit = layoutView.findViewById(R.id.tv_credit_limit);
tv_credit_difference = layoutView.findViewById(R.id.tv_credit_difference);
// 查找底部卡组名称展示区域的文本控件
tv_deck = layoutView.findViewById(R.id.tv_deck);
tv_result_count = layoutView.findViewById(R.id.result_count); tv_result_count = layoutView.findViewById(R.id.result_count);
// 初始化限制条件选择下拉框并设置背景颜色 // 初始化限制条件选择下拉框并设置背景颜色
...@@ -828,38 +836,41 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte ...@@ -828,38 +836,41 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
} }
private void refreshDeckCreditCount() { private void refreshDeckCreditCount() {
// 更新信用分显示 分三个部分判断和拼接文本 LimitList limitList = mDeckAdapater.getLimitList();
StringBuilder creditText = new StringBuilder(getString(R.string.deck_name) + ": "); int currentCredit = 0 ;
int creditLimit = 0;
try { int difference = 0;
LimitList limitList = mDeckAdapater.getLimitList(); // 检查是否有有效的信用分限制
// 检查是否有有效的信用分限制 if (limitList.getCreditLimits() != null && !limitList.getCreditLimits().isEmpty()) {
if (limitList.getCreditLimits() != null && !limitList.getCreditLimits().isEmpty()) { // 获取信用分上限值
// 获取信用分上限值 for (Integer limit : limitList.getCreditLimits().values()) {
Integer creditLimit = null; if (limit != null) {
for (Integer limit : limitList.getCreditLimits().values()) { creditLimit = limit;
if (limit != null) { ll_genesys_scoreboard.setVisibility(View.VISIBLE);
creditLimit = limit; } else {
break; ll_genesys_scoreboard.setVisibility(View.GONE);
}
} }
break;
}
// 仅当信用分上限不为null且不为0时显示信用分信息 // 仅当信用分上限不为null且不为0时显示信用分信息
if (creditLimit != null && creditLimit > 0) { if (creditLimit > 0) {
creditText.append("(") currentCredit = getCreditCount(mDeckAdapater.getCurrentState());
.append(getCreditCount(mDeckAdapater.getCurrentState())) // 当当前信用分超过限制时,设置文本为红色
.append("/") if (currentCredit > creditLimit) {
.append(creditLimit) tv_credit_count.setTextColor(Color.RED);
.append(")"); tv_credit_difference.setTextColor(Color.RED);
} else {
// 否则使用默认颜色
tv_credit_count.setTextColor(tv_credit_count.getCurrentTextColor());
tv_credit_difference.setTextColor(tv_credit_difference.getCurrentTextColor());
} }
} }
} catch (Exception e) {
// 记录异常日志
Log.e(TAG, "Error refreshing deck credit count", e);
} }
tv_credit_count.setText(creditText.toString()); tv_credit_count.setText(String.valueOf(currentCredit));
tv_credit_limit.setText(String.valueOf(creditLimit));
tv_credit_difference.setText(String.valueOf(creditLimit - currentCredit));
} }
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M515,958.3c-60.2,0 -118.6,-11.8 -173.6,-35.1 -53.1,-22.5 -100.8,-54.6 -141.8,-95.6 -40.9,-40.9 -73.1,-88.6 -95.6,-141.8 -23.2,-54.9 -35,-113.3 -35,-173.5s11.8,-118.6 35.1,-173.6c22.5,-53.1 54.6,-100.8 95.6,-141.8 40.9,-40.9 88.6,-73.1 141.8,-95.6 55,-23.3 113.4,-35.1 173.6,-35.1 60.2,0 118.6,11.8 173.6,35.1 53.1,22.5 100.8,54.6 141.8,95.6s73.1,88.6 95.6,141.8c23.3,55 35.1,113.4 35.1,173.6 0,60.2 -11.8,118.6 -35.1,173.6 -22.5,53.1 -54.6,100.8 -95.6,141.8s-88.6,73.1 -141.8,95.6c-55.1,23.2 -113.5,35 -173.7,35zM515,126.3c-212.8,0 -386,173.2 -386,386s173.2,386 386,386 386,-173.2 386,-386 -173.2,-386 -386,-386z"
android:fillColor="#ffffff"/>
<path
android:pathData="M265.7,696c20.8,-27.9 37.8,-77.8 45.5,-121.7l61.9,11.5c-6.6,48.2 -23,101.9 -46.6,137L265.7,696zM515.1,536.5L340.3,536.5L340.3,345.8h83.8c-10.4,-24.7 -29,-54.8 -47.1,-78.9l56.4,-26.3c23,26.9 47.1,63.6 55.9,90.4l-31.2,14.8h100.8c19.2,-32.3 38.9,-74 49.9,-106.9l68,27.9c-14.8,26.9 -31.2,54.3 -47.1,78.9h77.8v190.7L533.2,536.4c31.8,21.9 64.7,51.5 82.2,72.9l-47.7,41.6c-18.6,-25.8 -57.5,-61.4 -89.9,-84.4l37.3,-30zM596.2,687.2c25.2,0 30.1,-7.1 33.4,-49.3 14.2,10.4 42.7,20.3 61.4,24.1 -8.2,67.4 -27.4,84.4 -88.8,84.4L495.4,746.4c-80.6,0 -101.4,-18.6 -101.4,-78.4L394,566.7h69.6L463.6,667c0,17.5 6,20.3 38.4,20.3h94.2zM411.5,475.2h221.4v-68.5L411.5,406.7v68.5zM705.2,558.5c31.8,37.3 65.2,85.5 76.7,121.7l-54.8,32.3c-9.9,-35.1 -41.1,-86.6 -72.3,-124.9l50.4,-29.1z"
android:fillColor="#ffffff"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M512,0c282.8,0 512,229.2 512,512s-229.2,512 -512,512S0,794.8 0,512 229.2,0 512,0zM550.4,210.4c-79.8,19.5 -175.7,29.6 -287.4,30.6l-16.9,0.1 16.3,50.2a1951.2,1951.2 0,0 0,108.8 -2.9l16.9,-1v38.4h-152.5v53.4h152.5v187.7c-39.1,55.2 -93.2,103.3 -162.3,144.4l-11.7,6.8 36.5,54.1c48.1,-31.7 90.9,-69.8 128.3,-114.5l9.2,-11.3v166.8h58v-161.6c25.9,20.7 58.1,50.6 96.6,89.8l8.3,8.6 36.5,-54.7c-46.2,-37.5 -89.4,-69.8 -129.5,-96.9l-11.9,-8v-211.1h139.5v-53.4h-139.5L446.2,282.1c48.5,-5.2 89.8,-12.1 123.9,-20.6l8.4,-2.2 -28,-48.9zM796.1,216.9h-60v512.2c0,16.1 -9.8,24.1 -29.3,24.1 -13.5,0 -27.5,-0.8 -41.9,-2.5l-10.9,-1.4 13,58h60.6c43.9,0 66.7,-19.7 68.3,-59.2l0.1,-4.6L796.1,216.9zM687.3,286.6h-55.4v396.8h55.4L687.3,286.6zM356.9,400.7L303.5,400.7v33.9L229.2,434.5L229.2,484.1h74.3v33.2c-25.8,12.2 -49.9,22.3 -72.1,30.5l-9.4,3.4 15.6,52.1a918.7,918.7 0,0 0,52.3 -29l13.5,-8.2v24.8h53.4v-190.3zM525.7,400.7h-52.1v150.5c0,13 4.4,23.9 13,32.6 7,7.8 17.8,12.1 32.2,12.9l5,0.1h31.3c17.8,-0.4 30.4,-4.1 37.8,-11.1 7,-5.7 12.4,-26.8 16.3,-63.1l0.7,-6.6 -42.4,-13.7c-1.3,26.5 -4.4,41.1 -9.1,43.7a17.4,17.4 0,0 1,-9.8 3.7l-3.2,0.2h-5.2c-8.6,0 -13.3,-3 -14.2,-9l-0.1,-2.1v-47.6a428,428 0,0 0,71.2 -21.6l8.9,-3.8 -18.2,-49.5c-15.2,9.5 -32.9,17.5 -53.1,24l-8.8,2.7v-42.4z"
android:fillColor="#ffffff"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M332.8,428.8v-6.4c12.8,-38.4 32,-83.2 38.4,-128h-64v288h51.2c6.4,0 12.8,0 12.8,-6.4 0,0 6.4,-12.8 6.4,-32 0,-32 -12.8,-76.8 -44.8,-115.2zM332.8,428.8v-6.4c12.8,-38.4 32,-83.2 38.4,-128h-64v288h51.2c6.4,0 12.8,0 12.8,-6.4 0,0 6.4,-12.8 6.4,-32 0,-32 -12.8,-76.8 -44.8,-115.2zM960,339.2c-51.2,-128 -147.2,-230.4 -275.2,-275.2C627.2,44.8 569.6,32 512,32S396.8,44.8 339.2,64c-128,51.2 -224,147.2 -275.2,275.2C44.8,396.8 32,454.4 32,512s12.8,115.2 32,172.8c51.2,128 147.2,230.4 275.2,275.2 51.2,19.2 108.8,32 172.8,32s115.2,-12.8 172.8,-32c128,-51.2 230.4,-147.2 275.2,-275.2 19.2,-51.2 32,-108.8 32,-172.8s-12.8,-115.2 -32,-172.8zM339.2,652.8h-12.8v-6.4c0,-12.8 -6.4,-32 -12.8,-51.2l-6.4,-6.4v211.2h-64v-576h179.2l38.4,25.6L460.8,256c-25.6,57.6 -44.8,115.2 -64,160 44.8,57.6 51.2,108.8 51.2,140.8 0,38.4 -12.8,70.4 -32,83.2 -12.8,6.4 -25.6,12.8 -38.4,12.8h-38.4zM812.8,748.8c-12.8,12.8 -32,32 -38.4,51.2L768,800l-6.4,-6.4c-51.2,-25.6 -89.6,-64 -121.6,-115.2v64h-6.4c-121.6,32 -147.2,38.4 -160,51.2l-6.4,6.4 -6.4,-12.8c-6.4,-12.8 -19.2,-38.4 -25.6,-44.8l-6.4,-6.4 6.4,-6.4c6.4,0 25.6,-12.8 25.6,-44.8L460.8,230.4h300.8v300.8h-6.4l51.2,44.8 -6.4,6.4c-25.6,19.2 -57.6,44.8 -96,64 32,38.4 64,70.4 108.8,83.2l12.8,6.4 -12.8,12.8zM748.8,524.8h-102.4c6.4,25.6 12.8,44.8 25.6,64 32,-19.2 57.6,-44.8 76.8,-64zM691.2,409.6L537.6,409.6v51.2h153.6v-51.2zM691.2,294.4L537.6,294.4v51.2h153.6v-51.2zM537.6,524.8L537.6,704l102.4,-25.6c-25.6,-38.4 -51.2,-89.6 -64,-153.6h-38.4zM326.4,428.8c12.8,-44.8 32,-89.6 44.8,-134.4h-64v288h51.2c6.4,0 12.8,0 12.8,-6.4 0,0 6.4,-12.8 6.4,-32 0,-32 -12.8,-76.8 -51.2,-115.2z"
android:fillColor="#ffffff"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M512,1024a512,512 0,1 1,512 -512,512.7 512.7,0 0,1 -512,512zM40.4,512A471.9,471.9 0,1 0,512 40.4,472.3 472.3,0 0,0 40.4,512zM534.7,568.7v-90.3h204v288.9a569.4,569.4 0,0 1,-185.6 31.4c-269.7,0 -303.3,-196.1 -303.3,-278.7 0,-200.4 144.4,-297.9 318.5,-297.9a383.5,383.5 0,0 1,154.2 28.9l-24.9,92.1a313,313 0,0 0,-132.5 -23.8c-114.8,0 -197.1,68.2 -197.1,193.9s76.9,195.3 187.4,195.3a288.9,288.9 0,0 0,77.3 -8.7v-131.1z"
android:fillColor="#ffffff"/>
</vector>
...@@ -48,12 +48,11 @@ ...@@ -48,12 +48,11 @@
<ImageView <ImageView
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_marginEnd="5dp"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginEnd="5dp"
android:src="@drawable/box_deck" /> android:src="@drawable/box_deck" />
<TextView <TextView
android:id="@+id/tv_credit_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
...@@ -102,28 +101,106 @@ ...@@ -102,28 +101,106 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<androidx.appcompat.widget.AppCompatTextView <LinearLayout
android:id="@+id/tv_deck"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_marginTop="2dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/button_radius_black_transparents" android:background="@drawable/button_radius_black_transparents"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center|left" android:gravity="center|left"
android:maxLines="2" android:weightSum="1"
android:orientation="vertical"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp">
android:shadowColor="@color/black"
android:shadowDx="1" <LinearLayout
android:shadowDy="1" android:id="@+id/ll_genesys_scoreboard"
android:shadowRadius="2" android:layout_width="match_parent"
android:text="@string/select_deck" android:layout_height="0dp"
android:textColor="@color/white" android:layout_weight="0.2"
android:textSize="18sp" android:orientation="horizontal">
android:textStyle="bold" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:layout_gravity="center"
android:src="@drawable/ic_gs" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:layout_gravity="center"
android:src="@drawable/ic_credit_limit" />
<TextView
android:id="@+id/tv_credit_limit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="10sp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:textColor="@color/holo_blue_bright"
android:background="@drawable/button_radius_black_transparents"
android:gravity="center" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:layout_gravity="center"
android:src="@drawable/credit_count" />
<TextView
android:id="@+id/tv_credit_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="10sp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:textColor="@color/holo_blue_bright"
android:background="@drawable/button_radius_black_transparents"
android:gravity="center" />
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:layout_gravity="center"
android:src="@drawable/ic_credit_difference" />
<TextView
android:id="@+id/tv_credit_difference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="10sp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:textColor="@color/holo_blue_bright"
android:background="@drawable/button_radius_black_transparents"
android:gravity="center" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_deck"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="0.8"
android:layout_marginTop="2dp"
android:maxLines="2"
android:shadowColor="@color/black"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:text="@string/select_deck"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<androidx.appcompat.widget.AppCompatSpinner <androidx.appcompat.widget.AppCompatSpinner
......
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