Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
7afcada0
Commit
7afcada0
authored
May 19, 2025
by
wangfugui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除旧版本:本地卡组列表中显示在线卡组
parent
e3fab5c8
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
439 additions
and
286 deletions
+439
-286
README_backend.md
README_backend.md
+47
-0
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckManageDialog.java
...ava/cn/garymb/ygomobile/deck_square/DeckManageDialog.java
+18
-2
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSelectFragment.java
...a/cn/garymb/ygomobile/deck_square/DeckSelectFragment.java
+20
-70
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareFragment.java
...a/cn/garymb/ygomobile/deck_square/DeckSquareFragment.java
+23
-4
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
...arymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
+24
-4
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckDetailDialog.java
...a/cn/garymb/ygomobile/deck_square/MyDeckDetailDialog.java
+29
-12
mobile/src/main/java/cn/garymb/ygomobile/deck_square/SquareDeckDetailDialog.java
.../garymb/ygomobile/deck_square/SquareDeckDetailDialog.java
+15
-14
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/DeleteCardJson.java
...mb/ygomobile/deck_square/api_response/DeleteCardJson.java
+46
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/DeckListAdapter.java
...java/cn/garymb/ygomobile/ui/adapters/DeckListAdapter.java
+130
-100
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
+1
-2
mobile/src/main/res/layout/dialog_square_deck_detail.xml
mobile/src/main/res/layout/dialog_square_deck_detail.xml
+3
-1
mobile/src/main/res/layout/dialog_square_my_deck_detail.xml
mobile/src/main/res/layout/dialog_square_my_deck_detail.xml
+1
-1
mobile/src/main/res/layout/fragment_deck_cards.xml
mobile/src/main/res/layout/fragment_deck_cards.xml
+0
-9
mobile/src/main/res/layout/item_deck_list_swipe.xml
mobile/src/main/res/layout/item_deck_list_swipe.xml
+82
-67
No files found.
README_backend.md
0 → 100644
View file @
7afcada0
上传新卡组调用api:
首先获得卡组id:
【get] http://rarnu.xyz:38383/api/mdpro3/deck/deckId
将获得的卡组id作为json body的一部分,上传到服务器:
http://rarnu.xyz:38383/api/mdpro3/sync/single
json body格式如下:
{
"deckContributor": "zhb_con",
"userId": 795610,
"deck": {
"deckId": "0007b1ad19",
"deckName": "zhb_test_deck2",
"deckCoverCard1": 0,
"deckCoverCard2": 0,
"deckCoverCard3": 0,
"deckCase": 0,
"deckProtector": 0,
"deckYdk": "#created by
mdpro3
\r\n
#main
\r\n
89943723
\r\n
89943724
\r\n
89943724
\r\n
79856792
\r\n
58153103
\r\n
83965310
\r\n
14124483
\r\n
13256226
\r\n
13256226
\r\n
9411399
\r\n
9411399
\r\n
18094166
\r\n
18094166
\r\n
40044918
\r\n
40044918
\r\n
59392529
\r\n
63060238
\r\n
50720316
\r\n
50720316
\r\n
27780618
\r\n
27780618
\r\n
16605586
\r\n
16605586
\r\n
43237273
\r\n
80344569
\r\n
22865492
\r\n
22865492
\r\n
17955766
\r\n
14558127
\r\n
14558127
\r\n
14558127
\r\n
23434538
\r\n
23434538
\r\n
23434538
\r\n
40740224
\r\n
6186304
\r\n
18144506
\r\n
213326
\r\n
213326
\r\n
8949584
\r\n
8949584
\r\n
10186633
\r\n
32807848
\r\n
21143940
\r\n
21143940
\r\n
80170678
\r\n
52947044
\r\n
45906428
\r\n
45906428
\r\n
24094653
\r\n
24094653
\r\n
14088859
\r\n
14088859
\r\n
24224830
\r\n
24224830
\r\n
65681983
\r\n
24299458
\r\n
75047173
\r\n
10045474
\r\n
75047173
\r\n
#extra
\r\n
90050480
\r\n
86346643
\r\n
31817415
\r\n
32828466
\r\n
40080312
\r\n
56733747
\r\n
29095552
\r\n
40854197
\r\n
46759931
\r\n
60461804
\r\n
93347961
\r\n
64655485
\r\n
22908820
\r\n
58481572
\r\n
58004362
\r\n
!
side
\r\n
27204311
\r\n
27204311
\r\n
83965311
\r\n
59438930
\r\n
59438930
\r\n
24508238
\r\n
24508238
\r\n
94145021
\r\n
94145021
\r\n
26964762
\r\n
90846359
\r\n
83326048
\r\n
83326048
\r\n
83326048
\r\n
#pickup
\r\n
#case
\r\n
1081008#
\r\n
#protector
\r\n
1070008#
\r\n
#field
\r\n
1090009#
\r\n
#grave
\r\n
1100009#
\r\n
#stand
\r\n
1110001#
\r\n
#mate
\r\n
1000007#
\r\n
##
\r\n
###",
"isDelete": false
}
}
注意:deckId字段为[get]方法获得的id,deckName字段对应于卡组名称,服务端会检查该字段,不允许同一卡组名称上传多次(如果第二次上传某个卡组名,会返回false,上传失败)
上传成功后,服务器响应为:
{
"code": 0,
"message": "",
"data": true
}
上传失败后,服务器响应为:
更新已在云上存在的卡组:
仍然用上述body,但是其中deckId、deckName必须与云上的记录严格对应。
示例:
[1]云上存在卡组deckId=111,deckName=双打水产。
上传json中,deckId=111,deckName=双打水产,代表更新云上的该卡组的内容。
[2]云上存在卡组deckId=111,deckName=双打水产,
上传json中,deckId=110,deckName=双打水产,服务端会返回错误,本次上传失败。
即,如果服务器上已存在卡组名称XXX,则再上传“卡组名为XXX,卡组id不同”的卡组,会返回错误
[3]云上存在卡组deckId=111,deckName=双打水产,
上传json中,deckId=111,deckName=双打水产B,代表更新卡组名称,本次上传成功。
总结:
将对应于deckId、deckName的卡组内容json推送到服务器。
如果在服务器上不存在deckId、deckName对应的记录,则创建新卡组
如果在服务器存在deckId相同的记录,则更新卡组,deckName会覆盖服务器上的卡组名
如果在服务器存在deckName相同、deckId不同的记录,则更新失败
\ No newline at end of file
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckManageDialog.java
View file @
7afcada0
...
...
@@ -64,6 +64,22 @@ public class DeckManageDialog extends DialogFragment implements YGODeckDialogUti
@Override
public
void
onConfigureTab
(
@NonNull
TabLayout
.
Tab
tab
,
int
position
)
{
tab
.
setText
(
"Tab "
+
(
position
+
1
));
switch
(
position
)
{
case
0
:
tab
.
setText
(
"本地卡组"
);
break
;
case
1
:
tab
.
setText
(
"卡组广场"
);
break
;
case
2
:
tab
.
setText
(
"我的在线卡组"
);
break
;
case
3
:
tab
.
setText
(
"登录"
);
break
;
}
}
}).
attach
();
}
...
...
@@ -99,9 +115,9 @@ public class DeckManageDialog extends DialogFragment implements YGODeckDialogUti
case
0
:
return
new
DeckSelectFragment
(
mOnDeckMenuListener
,
onDeckDialogListener
);
case
1
:
return
new
DeckSquareFragment
();
return
new
DeckSquareFragment
(
mOnDeckMenuListener
,
onDeckDialogListener
);
case
2
:
return
new
DeckSquareMyDeckFragment
();
return
new
DeckSquareMyDeckFragment
(
mOnDeckMenuListener
,
onDeckDialogListener
);
case
3
:
return
new
MCOnlineManageFragment
();
default
:
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSelectFragment.java
View file @
7afcada0
...
...
@@ -34,10 +34,6 @@ import cn.garymb.ygomobile.AppsSettings;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.bean.DeckType
;
import
cn.garymb.ygomobile.bean.events.DeckFile
;
import
cn.garymb.ygomobile.deck_square.api_response.MyDeckResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.MyOnlineDeckDetail
;
import
cn.garymb.ygomobile.deck_square.api_response.OnlineDeckDetail
;
import
cn.garymb.ygomobile.deck_square.api_response.SquareDeckResponse
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.databinding.FragmentDeckSelectBinding
;
import
cn.garymb.ygomobile.ui.adapters.DeckListAdapter
;
...
...
@@ -45,16 +41,13 @@ import cn.garymb.ygomobile.ui.adapters.SimpleListAdapter;
import
cn.garymb.ygomobile.ui.adapters.TextSelectAdapter
;
import
cn.garymb.ygomobile.ui.mycard.mcchat.util.ImageUtil
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.DeckUtil
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.LogUtil
;
import
cn.garymb.ygomobile.utils.SharedPreferenceUtil
;
import
cn.garymb.ygomobile.utils.YGODeckDialogUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
//
卡组选择的Fragment,选择后
在卡组编辑页面中显示卡片
//
在dialog中卡组选择的Fragment,选中页面中某项后,
在卡组编辑页面中显示卡片
public
class
DeckSelectFragment
extends
Fragment
{
private
FragmentDeckSelectBinding
binding
;
...
...
@@ -70,9 +63,14 @@ public class DeckSelectFragment extends Fragment {
List
<
DeckType
>
typeList
=
null
;
List
<
DeckFile
>
deckList
=
null
;
//存储当前卡组分类下的所有卡组
private
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
;
private
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
;
//通知外部调用方,(如调用本fragment的activity)
private
YGODeckDialogUtil
.
OnDeckDialogListener
mDialogListener
;
/**
*
* @param onDeckMenuListener 通知容纳dialog的外部页面,已选中了某项卡组
* @param dialogListener 通知容纳本fragment的dialog,调用dismiss()方法,关闭dialog显示
*/
DeckSelectFragment
(
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
,
YGODeckDialogUtil
.
OnDeckDialogListener
dialogListener
)
{
super
();
this
.
onDeckMenuListener
=
onDeckMenuListener
;
...
...
@@ -102,71 +100,21 @@ public class DeckSelectFragment extends Fragment {
public
void
onItemSelect
(
int
position
,
DeckType
item
)
{
clearDeckSelect
();
deckList
.
clear
();
if
(
item
.
getOnServer
()
==
DeckType
.
ServerType
.
SQUARE_DECK
)
{
VUiKit
.
defer
().
when
(()
->
{
SquareDeckResponse
result
=
DeckSquareApiUtil
.
getSquareDecks
();
if
(
result
==
null
)
{
return
null
;
}
else
{
return
result
.
getData
().
getRecords
();
}
}).
fail
(
e
->
{
YGOUtil
.
showTextToast
(
"Fetch square deck fail"
);
}).
done
(
exCardDataList
->
{
if
(
exCardDataList
!=
null
)
{
LogUtil
.
i
(
TAG
,
"Get square deck success"
);
for
(
OnlineDeckDetail
deckRecord
:
exCardDataList
)
{
DeckFile
deckFile
=
new
DeckFile
(
deckRecord
.
getDeckName
(),
""
,
DeckType
.
ServerType
.
SQUARE_DECK
,
deckRecord
.
getDeckId
());
deckList
.
add
(
deckFile
);
}
deckAdp
.
notifyDataSetChanged
();
}
});
}
else
if
(
item
.
getOnServer
()
==
DeckType
.
ServerType
.
MY_SQUARE
)
{
VUiKit
.
defer
().
when
(()
->
{
String
serverToken
=
SharedPreferenceUtil
.
getServerToken
();
Integer
serverUserId
=
SharedPreferenceUtil
.
getServerUserId
();
MyDeckResponse
result
=
DeckSquareApiUtil
.
getUserDecks
(
serverUserId
,
serverToken
);
if
(
result
==
null
)
{
return
null
;
}
else
{
return
result
.
getData
();
}
}).
fail
(
e
->
{
YGOUtil
.
showTextToast
(
"Fetch square deck fail"
);
}).
done
(
exCardDataList
->
{
if
(
exCardDataList
!=
null
)
{
LogUtil
.
i
(
TAG
,
"Get square deck success"
);
for
(
MyOnlineDeckDetail
deckRecord
:
exCardDataList
)
{
DeckFile
deckFile
=
new
DeckFile
(
deckRecord
.
getDeckName
(),
""
,
DeckType
.
ServerType
.
MY_SQUARE
,
deckRecord
.
getDeckId
());
deckList
.
add
(
deckFile
);
}
deckAdp
.
notifyDataSetChanged
();
}
});
}
else
{
deckList
.
addAll
(
DeckUtil
.
getDeckList
(
item
.
getPath
()));
if
(
position
==
0
)
{
if
(
AppsSettings
.
get
().
isReadExpansions
())
{
try
{
if
(!
DeckUtil
.
getExpansionsDeckList
().
isEmpty
())
{
deckList
.
addAll
(
0
,
DeckUtil
.
getExpansionsDeckList
());
}
}
catch
(
IOException
e
)
{
YGOUtil
.
showTextToast
(
"额外卡库加载失败,原因为"
+
e
);
deckList
.
addAll
(
DeckUtil
.
getDeckList
(
item
.
getPath
()));
if
(
position
==
0
)
{
if
(
AppsSettings
.
get
().
isReadExpansions
())
{
try
{
if
(!
DeckUtil
.
getExpansionsDeckList
().
isEmpty
())
{
deckList
.
addAll
(
0
,
DeckUtil
.
getExpansionsDeckList
());
}
}
catch
(
IOException
e
)
{
YGOUtil
.
showTextToast
(
"额外卡库加载失败,原因为"
+
e
);
}
}
deckAdp
.
notifyDataSetChanged
();
}
deckAdp
.
notifyDataSetChanged
();
}
});
deckAdp
.
setOnItemSelectListener
(
new
DeckListAdapter
.
OnItemSelectListener
<
DeckFile
>()
{
...
...
@@ -186,13 +134,15 @@ public class DeckSelectFragment extends Fragment {
}
}
});
//对话框中长点击某一卡组名称后,触发该事件
deckAdp
.
setOnItemLongClickListener
(
new
OnItemLongClickListener
()
{
@Override
public
boolean
onItemLongClick
(
@NonNull
BaseQuickAdapter
adapter
,
@NonNull
View
view
,
int
position
)
{
DeckFile
item
=
(
DeckFile
)
adapter
.
getItem
(
position
);
//即使为local,也有可能为卡包预览,因此过滤掉selectposition==0
if
(
deckAdp
.
isSelect
()
||
!
item
.
isLocal
()
||
typeAdp
.
getSelectPosition
()
==
0
)
if
(
deckAdp
.
isSelect
()
||
typeAdp
.
getSelectPosition
()
==
0
)
return
true
;
deckAdp
.
setManySelect
(
true
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareFragment.java
View file @
7afcada0
...
...
@@ -9,14 +9,24 @@ import androidx.annotation.NonNull;
import
androidx.fragment.app.Fragment
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
cn.garymb.ygomobile.bean.DeckType
;
import
cn.garymb.ygomobile.bean.events.DeckFile
;
import
cn.garymb.ygomobile.deck_square.api_response.OnlineDeckDetail
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.databinding.FragmentDeckSquareBinding
;
import
cn.garymb.ygomobile.utils.YGODeckDialogUtil
;
public
class
DeckSquareFragment
extends
Fragment
{
private
FragmentDeckSquareBinding
binding
;
private
DeckSquareListAdapter
deckSquareListAdapter
;
private
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
;
//通知外部调用方,(如调用本fragment的activity)
private
YGODeckDialogUtil
.
OnDeckDialogListener
mDialogListener
;
public
DeckSquareFragment
(
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
,
YGODeckDialogUtil
.
OnDeckDialogListener
mDialogListener
)
{
this
.
onDeckMenuListener
=
onDeckMenuListener
;
this
.
mDialogListener
=
mDialogListener
;
}
@Override
public
View
onCreateView
(
...
...
@@ -33,16 +43,25 @@ public class DeckSquareFragment extends Fragment {
deckSquareListAdapter
.
loadData
();
// Set click listener in your adapter
deckSquareListAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
// Handle item click
OnlineDeckDetail
item
=
(
OnlineDeckDetail
)
adapter
.
getItem
(
position
);
deckSquareListAdapter
.
setOnItemLongClickListener
((
adapter
,
view
,
position
)
->
{
OnlineDeckDetail
item
=
(
OnlineDeckDetail
)
adapter
.
getItem
(
position
);
// Show the dialog
SquareDeckDetailDialog
dialog
=
new
SquareDeckDetailDialog
(
getContext
(),
item
);
dialog
.
show
();
return
true
;
});
// Set click listener in your adapter
deckSquareListAdapter
.
setOnItemClickListener
((
adapter
,
view
,
position
)
->
{
OnlineDeckDetail
item
=
(
OnlineDeckDetail
)
adapter
.
getItem
(
position
);
//调用
mDialogListener
.
onDismiss
();
DeckFile
deckFile
=
new
DeckFile
(
item
.
getDeckId
(),
DeckType
.
ServerType
.
SQUARE_DECK
);
onDeckMenuListener
.
onDeckSelect
(
deckFile
);
});
return
binding
.
getRoot
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
View file @
7afcada0
...
...
@@ -9,8 +9,12 @@ import androidx.annotation.NonNull;
import
androidx.fragment.app.Fragment
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
cn.garymb.ygomobile.bean.DeckType
;
import
cn.garymb.ygomobile.bean.events.DeckFile
;
import
cn.garymb.ygomobile.deck_square.api_response.OnlineDeckDetail
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.databinding.FragmentDeckSquareMyDeckBinding
;
import
cn.garymb.ygomobile.utils.YGODeckDialogUtil
;
//打开页面后,先扫描本地的卡组,读取其是否包含deckId,是的话代表平台上可能有
//之后读取平台上的卡组,与本地卡组列表做比较。
...
...
@@ -20,6 +24,14 @@ public class DeckSquareMyDeckFragment extends Fragment {
private
FragmentDeckSquareMyDeckBinding
binding
;
private
MyDeckListAdapter
deckListAdapter
;
private
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
;
//通知外部调用方,(如调用本fragment的activity)
private
YGODeckDialogUtil
.
OnDeckDialogListener
mDialogListener
;
public
DeckSquareMyDeckFragment
(
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
,
YGODeckDialogUtil
.
OnDeckDialogListener
mDialogListener
)
{
this
.
onDeckMenuListener
=
onDeckMenuListener
;
this
.
mDialogListener
=
mDialogListener
;
}
@Override
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
ViewGroup
container
,
...
...
@@ -42,16 +54,24 @@ public class DeckSquareMyDeckFragment extends Fragment {
}
});
deckListAdapter
.
setOnItemLongClickListener
((
adapter
,
view
,
position
)
->
{
MyDeckItem
item
=
(
MyDeckItem
)
adapter
.
getItem
(
position
);
MyDeckDetailDialog
dialog
=
new
MyDeckDetailDialog
(
getContext
(),
item
);
dialog
.
show
();
return
true
;
});
//点击“我的卡组”中的某个卡组后,弹出dialog,dialog根据卡组的同步情况自动显示对应的下载/上传按钮
deckListAdapter
.
setOnItemClickListener
(
(
adapter
,
view
,
position
)
->
{
// Handle item click
MyDeckItem
item
=
(
MyDeckItem
)
adapter
.
getItem
(
position
);
MyDeckDetailDialog
dialog
=
new
MyDeckDetailDialog
(
getContext
(),
item
);
MyDeckItem
item
=
(
MyDeckItem
)
adapter
.
getItem
(
position
);
mDialogListener
.
onDismiss
();
DeckFile
deckFile
=
new
DeckFile
(
item
.
getDeckId
(),
DeckType
.
ServerType
.
MY_SQUARE
);
onDeckMenuListener
.
onDeckSelect
(
deckFile
);
dialog
.
show
();
}
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckDetailDialog.java
View file @
7afcada0
...
...
@@ -13,9 +13,9 @@ import androidx.recyclerview.widget.RecyclerView;
import
java.util.List
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.deck_square.api_response.MyOnlineDeckDetail
;
import
cn.garymb.ygomobile.deck_square.api_response.DownloadDeckResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.LoginToken
;
import
cn.garymb.ygomobile.deck_square.api_response.MyOnlineDeckDetail
;
import
cn.garymb.ygomobile.deck_square.api_response.PushDeckResponse
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.adapters.DeckPreviewListAdapter
;
...
...
@@ -47,7 +47,7 @@ public class MyDeckDetailDialog extends Dialog {
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
setContentView
(
R
.
layout
.
dialog_square_my_deck_detail
);
Button
btnDownload
=
findViewById
(
R
.
id
.
dialog_my_deck_btn_download
);
Button
deleteMyOnlineDeckBtn
=
findViewById
(
R
.
id
.
delete_my_online_deck_btn
);
Button
btnPush
=
findViewById
(
R
.
id
.
dialog_my_deck_btn_push
);
LinearLayout
downloadLayout
=
findViewById
(
R
.
id
.
server_download_layout
);
...
...
@@ -77,15 +77,13 @@ public class MyDeckDetailDialog extends Dialog {
//上传卡组
btnPush
.
setOnClickListener
(
v
->
{
Integer
userId
=
SharedPreferenceUtil
.
getServerUserId
();
String
serverToken
=
SharedPreferenceUtil
.
getServerToken
();
//todo serverToken要外部传入还是此处获取?考虑
if
(
userId
==
null
||
serverToken
==
null
)
{
YGOUtil
.
showTextToast
(
"Please login first!"
);
LoginToken
loginToken
=
DeckSquareApiUtil
.
getLoginData
();
if
(
loginToken
==
null
)
{
return
;
}
VUiKit
.
defer
().
when
(()
->
{
PushDeckResponse
result
=
DeckSquareApiUtil
.
pushDeck
(
mItem
.
getDeckPath
(),
mItem
.
getDeckName
(),
userId
,
server
Token
);
PushDeckResponse
result
=
DeckSquareApiUtil
.
requestIdAndPushDeck
(
mItem
.
getDeckPath
(),
mItem
.
getDeckName
(),
login
Token
);
return
result
;
}).
fail
(
e
->
{
...
...
@@ -102,11 +100,30 @@ public class MyDeckDetailDialog extends Dialog {
});
//下载用户在平台上的卡组
btnDownload
.
setOnClickListener
(
v
->
{
deleteMyOnlineDeckBtn
.
setOnClickListener
(
v
->
{
if
(
mItem
!=
null
)
{
mItem
.
getDeckId
();
LoginToken
loginToken
=
DeckSquareApiUtil
.
getLoginData
();
if
(
loginToken
==
null
)
{
return
;
}
VUiKit
.
defer
().
when
(()
->
{
PushDeckResponse
result
=
DeckSquareApiUtil
.
deleteDeck
(
mItem
.
getDeckId
(),
loginToken
);
return
result
;
}).
fail
(
e
->
{
LogUtil
.
i
(
TAG
,
"square deck detail fail"
+
e
.
getMessage
());
}).
done
(
data
->
{
if
(
data
.
isData
())
{
YGOUtil
.
showTextToast
(
"delete success!"
);
}
else
{
if
(
mMyOnlineDeckDetail
!=
null
)
{
String
path
=
AppsSettings
.
get
().
getDeckDir
();
DeckSquareFileUtil
.
saveFileToPath
(
path
,
mMyOnlineDeckDetail
.
getDeckName
()
+
".ydk"
,
mMyOnlineDeckDetail
.
getDeckYdk
()
);
YGOUtil
.
showTextToast
(
"delete fail "
+
data
.
getMessage
());
}
}
);
}
});
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/SquareDeckDetailDialog.java
View file @
7afcada0
...
...
@@ -46,7 +46,7 @@ public class SquareDeckDetailDialog extends Dialog {
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
setContentView
(
R
.
layout
.
dialog_square_deck_detail
);
Button
btnDownload
=
findViewById
(
R
.
id
.
dialog_square_deck_btn_download
);
//
Button btnDownload = findViewById(R.id.dialog_square_deck_btn_download);
Button
btnLike
=
findViewById
(
R
.
id
.
btnLike
);
previewDeckCard
();
...
...
@@ -59,19 +59,20 @@ public class SquareDeckDetailDialog extends Dialog {
mListView
.
setAdapter
(
mListAdapter
);
//下载卡组广场的卡组
btnDownload
.
setOnClickListener
(
v
->
{
if
(
mMyOnlineDeckDetail
!=
null
)
{
String
path
=
AppsSettings
.
get
().
getDeckDir
();
boolean
result
=
DeckSquareFileUtil
.
saveFileToPath
(
path
,
mMyOnlineDeckDetail
.
getDeckName
()
+
".ydk"
,
mMyOnlineDeckDetail
.
getDeckYdk
());
if
(
result
)
{
YGOUtil
.
showTextToast
(
"Download deck success!"
);
}
else
{
YGOUtil
.
showTextToast
(
"Download deck fail!"
);
}
}
});
// btnDownload.setOnClickListener(v -> {
// if (mMyOnlineDeckDetail != null) {
// //todo 删除云上的卡组
// String path = AppsSettings.get().getDeckDir();
// boolean result = DeckSquareFileUtil.saveFileToPath(path, mMyOnlineDeckDetail.getDeckName() + ".ydk", mMyOnlineDeckDetail.getDeckYdk());
// if (result) {
//
// YGOUtil.showTextToast("Download deck success!");
// } else {
//
// YGOUtil.showTextToast("Download deck fail!");
// }
// }
// });
//给卡组点赞
btnLike
.
setOnClickListener
(
v
->
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/DeleteCardJson.java
0 → 100644
View file @
7afcada0
package
cn.garymb.ygomobile.deck_square.api_response
;
public
class
DeleteCardJson
{
private
String
deckContributor
;
private
Integer
userId
;
private
DeckData
deck
;
public
String
getDeckContributor
()
{
return
deckContributor
;
}
public
void
setDeckContributor
(
String
deckContributor
)
{
this
.
deckContributor
=
deckContributor
;
}
public
Integer
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Integer
userId
)
{
this
.
userId
=
userId
;
}
public
DeckData
getDeck
()
{
return
deck
;
}
public
void
setDeck
(
DeckData
deck
)
{
this
.
deck
=
deck
;
}
public
static
class
DeckData
{
private
boolean
isDelete
=
false
;
public
boolean
isDelete
()
{
return
isDelete
;
}
public
void
setDelete
(
boolean
delete
)
{
isDelete
=
delete
;
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/DeckListAdapter.java
View file @
7afcada0
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
View file @
7afcada0
...
...
@@ -79,8 +79,7 @@ public class DeckUtil {
deckTypeList
.
add
(
new
DeckType
(
YGOUtil
.
s
(
R
.
string
.
category_pack
),
AppsSettings
.
get
().
getPackDeckDir
(),
DeckType
.
ServerType
.
LOCAL
));
deckTypeList
.
add
(
new
DeckType
(
YGOUtil
.
s
(
R
.
string
.
category_windbot_deck
),
AppsSettings
.
get
().
getAiDeckDir
(),
DeckType
.
ServerType
.
LOCAL
));
deckTypeList
.
add
(
new
DeckType
(
YGOUtil
.
s
(
R
.
string
.
category_Uncategorized
),
AppsSettings
.
get
().
getDeckDir
(),
DeckType
.
ServerType
.
LOCAL
));
deckTypeList
.
add
(
new
DeckType
(
YGOUtil
.
s
(
R
.
string
.
category_online_deck
),
""
,
DeckType
.
ServerType
.
SQUARE_DECK
));
deckTypeList
.
add
(
new
DeckType
(
YGOUtil
.
s
(
R
.
string
.
category_my_online_deck
),
""
,
DeckType
.
ServerType
.
MY_SQUARE
));
File
[]
files
=
new
File
(
AppsSettings
.
get
().
getDeckDir
()).
listFiles
();
if
(
files
!=
null
)
{
...
...
mobile/src/main/res/layout/dialog_square_deck_detail.xml
View file @
7afcada0
...
...
@@ -5,6 +5,7 @@
android:orientation=
"vertical"
android:padding=
"16dp"
>
<!--
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
...
...
@@ -19,9 +20,10 @@
android:id="@+id/dialog_square_deck_btn_download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=
"@string/
Download
"
/>
android:text="@string/
delete
" />
</LinearLayout>
-->
<LinearLayout
android:layout_width=
"match_parent"
...
...
mobile/src/main/res/layout/dialog_square_my_deck_detail.xml
View file @
7afcada0
...
...
@@ -17,7 +17,7 @@
android:src=
"@drawable/ic_server_download"
/>
<Button
android:id=
"@+id/d
ialog_my_deck_btn_download
"
android:id=
"@+id/d
elete_my_online_deck_btn
"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/Download"
/>
...
...
mobile/src/main/res/layout/fragment_deck_cards.xml
View file @
7afcada0
...
...
@@ -22,15 +22,6 @@
android:layout_height=
"match_parent"
/>
<TextView
android:id=
"@+id/open_deck_square"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_gravity=
"bottom|right"
android:layout_marginBottom=
"100dp"
android:background=
"@drawable/ic_deck_square"
android:text=
"卡组广场"
android:textAlignment=
"center"
/>
<LinearLayout
android:layout_width=
"match_parent"
...
...
mobile/src/main/res/layout/item_deck_list_swipe.xml
View file @
7afcada0
...
...
@@ -27,52 +27,27 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginLeft=
"10dp"
android:orientation=
"vertical"
>
<cn.garymb.ygomobile.ui.widget.AlwaysMarqueeTextView
android:id=
"@+id/deck_name"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:maxLines=
"1"
android:singleLine=
"true"
android:textColor=
"@color/white"
tools:text=
"Deck Name"
/>
<TextView
android:id=
"@+id/onlie_deck_id"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/holo_blue_bright"
android:textSize=
"10sp"
tools:text=
"40"
/>
android:orientation=
"horizontal"
>
<LinearLayout
android:id=
"@+id/deck_info"
android:layout_width=
"match_parent"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"3dp"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/prerelease_star"
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:layout_marginRight=
"5dp"
android:background=
"@drawable/ic_expansions"
android:visibility=
"visible"
/>
<ImageView
android:id=
"@+id/banned_mark"
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:layout_marginRight=
"@dimen/dp_10"
android:background=
"@drawable/ic_banned"
android:visibility=
"visible"
/>
android:layout_gravity=
"center"
android:layout_marginLeft=
"10dp"
android:layout_weight=
"4"
android:orientation=
"vertical"
>
<cn.garymb.ygomobile.ui.widget.AlwaysMarqueeTextView
android:id=
"@+id/deck_name"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:maxLines=
"1"
android:singleLine=
"true"
android:textColor=
"@color/white"
tools:text=
"Deck Name"
/>
<TextView
android:id=
"@+id/
count_main
"
android:id=
"@+id/
onlie_deck_id
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/holo_blue_bright"
...
...
@@ -80,45 +55,85 @@
tools:text=
"40"
/>
<LinearLayout
android:id=
"@+id/
ll_extra_n_side
"
android:id=
"@+id/
deck_info
"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"3dp"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/TextExtra"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"/"
android:textColor=
"@android:color/holo_green_light"
android:textSize=
"10sp"
/>
<ImageView
android:id=
"@+id/prerelease_star"
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:layout_marginRight=
"5dp"
android:background=
"@drawable/ic_expansions"
android:visibility=
"visible"
/>
<ImageView
android:id=
"@+id/banned_mark"
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:layout_marginRight=
"@dimen/dp_10"
android:background=
"@drawable/ic_banned"
android:visibility=
"visible"
/>
<TextView
android:id=
"@+id/count_
ex
"
android:id=
"@+id/count_
main
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/holo_blue_bright"
android:textSize=
"10sp"
tools:text=
"
15
"
/>
tools:text=
"
40
"
/>
<TextView
android:id=
"@+id/TextSide"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"/"
android:textColor=
"@android:color/holo_green_light"
android:textSize=
"10sp"
/>
<TextView
android:id=
"@+id/count_side"
android:layout_width=
"wrap_content"
<LinearLayout
android:id=
"@+id/ll_extra_n_side"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:maxLines=
"1"
android:singleLine=
"true"
android:textColor=
"@color/holo_blue_bright"
android:textSize=
"10sp"
tools:text=
"15"
/>
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/TextExtra"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"/"
android:textColor=
"@android:color/holo_green_light"
android:textSize=
"10sp"
/>
<TextView
android:id=
"@+id/count_ex"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/holo_blue_bright"
android:textSize=
"10sp"
tools:text=
"15"
/>
<TextView
android:id=
"@+id/TextSide"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"/"
android:textColor=
"@android:color/holo_green_light"
android:textSize=
"10sp"
/>
<TextView
android:id=
"@+id/count_side"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:maxLines=
"1"
android:singleLine=
"true"
android:textColor=
"@color/holo_blue_bright"
android:textSize=
"10sp"
tools:text=
"15"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<Button
android:id=
"@+id/local_deck_upload_btn"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:text=
"上传"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment