Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
cc0cd259
Commit
cc0cd259
authored
Jul 06, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
复制一份synchroinzeDeck执行但不比较时间直接推送
parent
e3069d02
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
46 deletions
+141
-46
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
...ava/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareApiUtil.java
...ymb/ygomobile/ui/cards/deck_square/DeckSquareApiUtil.java
+115
-30
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareFileUtil.java
...mb/ygomobile/ui/cards/deck_square/DeckSquareFileUtil.java
+22
-12
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareMyDeckFragment.java
...mobile/ui/cards/deck_square/DeckSquareMyDeckFragment.java
+2
-2
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
View file @
cc0cd259
...
@@ -251,7 +251,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -251,7 +251,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
mContext
=
(
BaseActivity
)
getActivity
();
mContext
=
(
BaseActivity
)
getActivity
();
/** 自动同步 */
/** 自动同步 */
if
(
SharedPreferenceUtil
.
getServerToken
()
!=
null
)
{
if
(
SharedPreferenceUtil
.
getServerToken
()
!=
null
)
{
VUiKit
.
defer
().
when
(
DeckSquareApiUtil:
:
synchronizeDecks
V2
).
fail
((
e
)
->
{
VUiKit
.
defer
().
when
(
DeckSquareApiUtil:
:
synchronizeDecks
).
fail
((
e
)
->
{
LogUtil
.
i
(
TAG
,
"sync deck fail"
+
e
.
getMessage
());
LogUtil
.
i
(
TAG
,
"sync deck fail"
+
e
.
getMessage
());
}).
done
((
result
)
->
{
}).
done
((
result
)
->
{
});
});
...
@@ -1349,7 +1349,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
...
@@ -1349,7 +1349,7 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
if
(
deckData
!=
null
)
{
if
(
deckData
!=
null
)
{
mDeckId
=
deckData
.
getDeckId
();
mDeckId
=
deckData
.
getDeckId
();
deckData
.
getDeckYdk
();
deckData
.
getDeckYdk
();
String
fileFullName
=
deckData
.
getDeckName
()
+
".ydk"
;
String
fileFullName
=
deckData
.
getDeckName
()
+
YDK_FILE_EX
;
File
dir
=
new
File
(
getActivity
().
getApplicationInfo
().
dataDir
,
"cache"
);
File
dir
=
new
File
(
getActivity
().
getApplicationInfo
().
dataDir
,
"cache"
);
//将卡组存到cache缓存目录中
//将卡组存到cache缓存目录中
boolean
result
=
DeckSquareFileUtil
.
saveFileToPath
(
dir
.
getPath
(),
fileFullName
,
deckData
.
getDeckYdk
(),
convertToUnixTimestamp
(
deckData
.
getDeckUpdateDate
()));
boolean
result
=
DeckSquareFileUtil
.
saveFileToPath
(
dir
.
getPath
(),
fileFullName
,
deckData
.
getDeckYdk
(),
convertToUnixTimestamp
(
deckData
.
getDeckUpdateDate
()));
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareApiUtil.java
View file @
cc0cd259
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareFileUtil.java
View file @
cc0cd259
package
cn.garymb.ygomobile.ui.cards.deck_square
;
package
cn.garymb.ygomobile.ui.cards.deck_square
;
import
android.os.Build
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
...
@@ -9,6 +11,10 @@ import java.io.InputStreamReader;
...
@@ -9,6 +11,10 @@ import java.io.InputStreamReader;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -26,7 +32,7 @@ import ocgcore.data.Card;
...
@@ -26,7 +32,7 @@ import ocgcore.data.Card;
public
class
DeckSquareFileUtil
{
public
class
DeckSquareFileUtil
{
//
//
private
static
final
String
TAG
=
"
seesee
decksquareApiUtil"
;
private
static
final
String
TAG
=
"decksquareApiUtil"
;
//private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
//private static final String TAG = DeckSquareListAdapter.class.getSimpleName();
// public static List<String> readLastLinesWithNIO(File file, int numLines) {
// public static List<String> readLastLinesWithNIO(File file, int numLines) {
...
@@ -141,8 +147,6 @@ public class DeckSquareFileUtil {
...
@@ -141,8 +147,6 @@ public class DeckSquareFileUtil {
String
deckId
=
getId
(
file
);
String
deckId
=
getId
(
file
);
MyDeckItem
item
=
new
MyDeckItem
();
MyDeckItem
item
=
new
MyDeckItem
();
item
.
setDeckName
(
file
.
getName
());
item
.
setDeckName
(
file
.
getName
());
item
.
setUpdateTimestamp
(
file
.
lastModified
());
item
.
setUpdateTimestamp
(
file
.
lastModified
());
item
.
setDeckPath
(
file
.
getPath
());
item
.
setDeckPath
(
file
.
getPath
());
if
(
deckId
!=
null
)
{
if
(
deckId
!=
null
)
{
...
@@ -295,17 +299,23 @@ public class DeckSquareFileUtil {
...
@@ -295,17 +299,23 @@ public class DeckSquareFileUtil {
}
}
public
static
long
convertToUnixTimestamp
(
String
dateTimeStr
)
{
public
static
long
convertToUnixTimestamp
(
String
DateTime
)
{
try
{
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss"
);
//DateTime 格式为 ""yyyy-MM-dd'T'HH:mm:ss""
sdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
DateTimeFormatter
formatter
=
null
;
sdf
.
setLenient
(
false
);
// 解析为本地时间,再关联到 UTC+8 时区
Date
date
=
sdf
.
parse
(
dateTimeStr
);
LocalDateTime
localDateTime
=
null
;
return
date
.
getTime
();
ZonedDateTime
zonedDateTime
=
null
;
}
catch
(
ParseException
e
){
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd'T'HH:mm:ss"
);
localDateTime
=
LocalDateTime
.
parse
(
DateTime
,
formatter
);
zonedDateTime
=
localDateTime
.
atZone
(
ZoneId
.
of
(
"Asia/Shanghai"
));
return
zonedDateTime
.
toInstant
().
toEpochMilli
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
0
;
}
}
return
0
;
return
0
;
}
}
...
@@ -317,7 +327,7 @@ public class DeckSquareFileUtil {
...
@@ -317,7 +327,7 @@ public class DeckSquareFileUtil {
public
static
String
convertToGMTDate
(
long
timestamp
)
{
public
static
String
convertToGMTDate
(
long
timestamp
)
{
try
{
try
{
// 创建格式化器并设置时区为 GMT
// 创建格式化器并设置时区为 GMT
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss"
,
Locale
.
US
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss"
,
Locale
.
CHINA
);
sdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT"
));
sdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT"
));
// 格式化时间戳
// 格式化时间戳
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck_square/DeckSquareMyDeckFragment.java
View file @
cc0cd259
...
@@ -58,7 +58,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
...
@@ -58,7 +58,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
binding
.
tvMycardUserName
.
setText
(
SharedPreferenceUtil
.
getMyCardUserName
());
binding
.
tvMycardUserName
.
setText
(
SharedPreferenceUtil
.
getMyCardUserName
());
GlideCompat
.
with
(
getActivity
()).
load
(
ChatMessage
.
getAvatarUrl
(
SharedPreferenceUtil
.
getMyCardUserName
())).
into
(
binding
.
myDeckAvatar
);
//刷新头像图片
GlideCompat
.
with
(
getActivity
()).
load
(
ChatMessage
.
getAvatarUrl
(
SharedPreferenceUtil
.
getMyCardUserName
())).
into
(
binding
.
myDeckAvatar
);
//刷新头像图片
}
}
//DeckSquareApiUtil.synchronizeDecks();
binding
.
btnLogin
.
setOnClickListener
(
v
->
attemptLogin
());
binding
.
btnLogin
.
setOnClickListener
(
v
->
attemptLogin
());
binding
.
btnRegister
.
setOnClickListener
(
v
->
WebActivity
.
open
(
getContext
(),
getString
(
R
.
string
.
register
),
MyCard
.
URL_MC_SIGN_UP
));
binding
.
btnRegister
.
setOnClickListener
(
v
->
WebActivity
.
open
(
getContext
(),
getString
(
R
.
string
.
register
),
MyCard
.
URL_MC_SIGN_UP
));
deckListAdapter
=
new
MyDeckListAdapter
(
R
.
layout
.
item_my_deck
,
onDeckMenuListener
,
mDialogListener
);
deckListAdapter
=
new
MyDeckListAdapter
(
R
.
layout
.
item_my_deck
,
onDeckMenuListener
,
mDialogListener
);
...
@@ -197,7 +197,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
...
@@ -197,7 +197,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
/** 自动同步 */
/** 自动同步 */
VUiKit
.
defer
().
when
(()
->
{
VUiKit
.
defer
().
when
(()
->
{
return
DeckSquareApiUtil
.
synchronizeDecks
V2
();
return
DeckSquareApiUtil
.
synchronizeDecks
();
}).
fail
((
e
)
->
{
}).
fail
((
e
)
->
{
YGOUtil
.
showTextToast
(
"Sync decks fail"
,
Toast
.
LENGTH_LONG
);
YGOUtil
.
showTextToast
(
"Sync decks fail"
,
Toast
.
LENGTH_LONG
);
...
...
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