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
a8d84944
Commit
a8d84944
authored
Jun 25, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
为mydecklistAdapter添加监听
parent
8336ab66
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
...va/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
+8
-9
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
...arymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
...va/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
+8
-2
No files found.
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
View file @
a8d84944
package
cn.garymb.ygomobile.deck_square
;
import
android.util.Log
;
import
android.widget.Toast
;
import
com.google.gson.Gson
;
...
...
@@ -156,7 +155,7 @@ public class DeckSquareApiUtil {
* 阻塞方法,用于推送新卡组。首先从服务器请求一个新的卡组id,之后将卡组上传到服务器
* 先同步推送,之后异步推送。首先调用服务端api获取卡组id,之后将卡组id设置到ydk中,之后调用服务器api将卡组上传
*
* @param deck
f
ile
* @param deck
F
ile
* @param loginToken
*/
public
static
PushDeckResponse
requestIdAndPushDeck
(
DeckFile
deckFile
,
LoginToken
loginToken
)
throws
IOException
{
...
...
@@ -174,13 +173,13 @@ public class DeckSquareApiUtil {
Gson
gson
=
new
Gson
();
DeckIdResponse
deckIdResult
=
null
;
{
Response
response
=
OkhttpUtil
.
synchronousGet
(
getDeckIdUrl
,
null
,
headers
);
String
responseBodyString
=
response
.
body
().
string
();
// Convert JSON to Java object using Gson
deckIdResult
=
gson
.
fromJson
(
responseBodyString
,
DeckIdResponse
.
class
);
LogUtil
.
i
(
TAG
,
"deck id result:"
+
deckIdResult
.
toString
());
}
if
(
deckIdResult
==
null
)
{
return
null
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
View file @
a8d84944
...
...
@@ -58,7 +58,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
}
binding
.
btnLogin
.
setOnClickListener
(
v
->
attemptLogin
());
binding
.
btnRegister
.
setOnClickListener
(
v
->
WebActivity
.
open
(
getContext
(),
getString
(
R
.
string
.
register
),
MyCard
.
URL_MC_SIGN_UP
));
deckListAdapter
=
new
MyDeckListAdapter
(
R
.
layout
.
item_my_deck
);
deckListAdapter
=
new
MyDeckListAdapter
(
R
.
layout
.
item_my_deck
,
onDeckMenuListener
,
mDialogListener
);
GridLayoutManager
linearLayoutManager
=
new
GridLayoutManager
(
getContext
(),
3
);
binding
.
listMyDeckInfo
.
setLayoutManager
(
linearLayoutManager
);
binding
.
listMyDeckInfo
.
setAdapter
(
deckListAdapter
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
View file @
a8d84944
...
...
@@ -21,18 +21,23 @@ import cn.garymb.ygomobile.loader.ImageLoader;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.LogUtil
;
import
cn.garymb.ygomobile.utils.YGODeckDialogUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
//提供“我的”卡组数据,打开后先从sharePreference查询,没有则从服务器查询,然后缓存到sharePreference
public
class
MyDeckListAdapter
extends
BaseQuickAdapter
<
MyDeckItem
,
BaseViewHolder
>
{
private
static
final
String
TAG
=
DeckSquareListAdapter
.
class
.
getSimpleName
();
private
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
;
//通知外部调用方,(如调用本fragment的activity)
private
YGODeckDialogUtil
.
OnDeckDialogListener
mDialogListener
;
private
ImageLoader
imageLoader
;
private
List
<
MyDeckItem
>
originalData
;
// 保存原始数据
public
MyDeckListAdapter
(
int
layoutResId
)
{
public
MyDeckListAdapter
(
int
layoutResId
,
YGODeckDialogUtil
.
OnDeckMenuListener
onDeckMenuListener
,
YGODeckDialogUtil
.
OnDeckDialogListener
mDialogListener
)
{
super
(
layoutResId
);
originalData
=
new
ArrayList
<>();
imageLoader
=
new
ImageLoader
();
this
.
onDeckMenuListener
=
onDeckMenuListener
;
this
.
mDialogListener
=
mDialogListener
;
}
public
void
loadData
()
{
...
...
@@ -203,7 +208,8 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
//TODO
//点击“我的卡组”中的某个卡组后,弹出dialog,dialog根据卡组的同步情况自动显示对应的下载/上传按钮
DeckFile
deckFile
=
new
DeckFile
(
item
.
getDeckId
(),
DeckType
.
ServerType
.
MY_SQUARE
);
mDialogListener
.
onDismiss
();
onDeckMenuListener
.
onDeckSelect
(
deckFile
);
});
}
...
...
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