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
753c2331
Commit
753c2331
authored
Jul 04, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
迁移工具函数到YGOUtil
parent
c101d738
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
30 deletions
+66
-30
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
...va/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
+0
-2
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/ui/adapters/DeckListAdapter.java
...java/cn/garymb/ygomobile/ui/adapters/DeckListAdapter.java
+12
-15
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
+29
-0
mobile/src/main/res/layout/item_deck_list_swipe.xml
mobile/src/main/res/layout/item_deck_list_swipe.xml
+24
-12
No files found.
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
View file @
753c2331
...
@@ -568,7 +568,6 @@ public class DeckSquareApiUtil {
...
@@ -568,7 +568,6 @@ public class DeckSquareApiUtil {
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LogUtil
.
e
(
TAG
,
"Error downloading missing deck: "
+
e
.
getMessage
());
LogUtil
.
e
(
TAG
,
"Error downloading missing deck: "
+
e
.
getMessage
());
e
.
printStackTrace
();
return
false
;
return
false
;
}
}
}
}
...
@@ -582,7 +581,6 @@ public class DeckSquareApiUtil {
...
@@ -582,7 +581,6 @@ public class DeckSquareApiUtil {
return
false
;
return
false
;
}
}
// 保存在线卡组到本地
// 保存在线卡组到本地
String
fileName
=
onlineDeck
.
getDeckName
()
+
Constants
.
YDK_FILE_EX
;
String
fileName
=
onlineDeck
.
getDeckName
()
+
Constants
.
YDK_FILE_EX
;
boolean
saved
=
DeckSquareFileUtil
.
saveFileToPath
(
localPath
,
fileName
,
deckResponse
.
getData
().
getDeckYdk
(),
onlineUpdateDate
);
boolean
saved
=
DeckSquareFileUtil
.
saveFileToPath
(
localPath
,
fileName
,
deckResponse
.
getData
().
getDeckYdk
(),
onlineUpdateDate
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareMyDeckFragment.java
View file @
753c2331
...
@@ -195,7 +195,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
...
@@ -195,7 +195,7 @@ public class DeckSquareMyDeckFragment extends Fragment {
});
});
/** 自动同步 */
/** 自动同步 */
VUiKit
.
defer
().
when
(()
->
{
return
DeckSquareApiUtil
.
synchronizeDecks
();}).
fail
((
e
)
->
{
VUiKit
.
defer
().
when
(()
->
{
return
DeckSquareApiUtil
.
synchronizeDecks
();}).
fail
((
e
)
->
{
LogUtil
.
i
(
TAG
,
"Sync deck fail"
+
e
.
getMessage
());
LogUtil
.
i
(
TAG
,
"Sync deck fail
:
"
+
e
.
getMessage
());
}).
done
((
result
)
->
{});
}).
done
((
result
)
->
{});
//DeckSquareApiUtil.synchronizeDecks();
//DeckSquareApiUtil.synchronizeDecks();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/DeckListAdapter.java
View file @
753c2331
package
cn.garymb.ygomobile.ui.adapters
;
package
cn.garymb.ygomobile.ui.adapters
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEBUG
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
YGOUtil
.
convertMillisToIsoString
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.Color
;
...
@@ -12,12 +15,8 @@ import android.widget.TextView;
...
@@ -12,12 +15,8 @@ import android.widget.TextView;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.listener.OnItemClickListener
;
import
com.chad.library.adapter.base.listener.OnItemClickListener
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.TimeZone
;
import
cn.garymb.ygomobile.bean.Deck
;
import
cn.garymb.ygomobile.bean.Deck
;
import
cn.garymb.ygomobile.bean.DeckInfo
;
import
cn.garymb.ygomobile.bean.DeckInfo
;
...
@@ -29,6 +28,7 @@ import cn.garymb.ygomobile.loader.CardLoader;
...
@@ -29,6 +28,7 @@ import cn.garymb.ygomobile.loader.CardLoader;
import
cn.garymb.ygomobile.loader.DeckLoader
;
import
cn.garymb.ygomobile.loader.DeckLoader
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.hutool.poi.excel.cell.CellSetter
;
import
ocgcore.DataManager
;
import
ocgcore.DataManager
;
import
ocgcore.data.LimitList
;
import
ocgcore.data.LimitList
;
...
@@ -74,16 +74,6 @@ public class DeckListAdapter<T extends TextSelect> extends BaseQuickAdapter<T, D
...
@@ -74,16 +74,6 @@ public class DeckListAdapter<T extends TextSelect> extends BaseQuickAdapter<T, D
mContext
=
context
;
mContext
=
context
;
}
}
/**
* 将时间戳转换为 ISO 8601 格式的时间字符串
*/
@SuppressLint
(
"SimpleDateFormat"
)
public
static
String
convertMillisToIsoString
(
long
timeMillis
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss"
,
Locale
.
CHINA
);
sdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
return
sdf
.
format
(
new
Date
(
timeMillis
));
}
@SuppressLint
(
"ResourceType"
)
@SuppressLint
(
"ResourceType"
)
@Override
@Override
protected
void
convert
(
DeckViewHolder
holder
,
T
item
)
{
protected
void
convert
(
DeckViewHolder
holder
,
T
item
)
{
...
@@ -123,6 +113,11 @@ public class DeckListAdapter<T extends TextSelect> extends BaseQuickAdapter<T, D
...
@@ -123,6 +113,11 @@ public class DeckListAdapter<T extends TextSelect> extends BaseQuickAdapter<T, D
holder
.
side
.
setTextColor
(
Color
.
RED
);
holder
.
side
.
setTextColor
(
Color
.
RED
);
}
}
holder
.
file_time
.
setText
(
convertMillisToIsoString
(
deckFile
.
getDate
()));
holder
.
file_time
.
setText
(
convertMillisToIsoString
(
deckFile
.
getDate
()));
if
(
DEBUG
)
{
holder
.
ll_deck_date
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
holder
.
ll_deck_date
.
setVisibility
(
View
.
GONE
);
}
if
(
deckFile
.
getTypeName
().
equals
(
YGOUtil
.
s
(
R
.
string
.
category_pack
))
||
deckFile
.
getPath
().
contains
(
"cacheDeck"
))
{
if
(
deckFile
.
getTypeName
().
equals
(
YGOUtil
.
s
(
R
.
string
.
category_pack
))
||
deckFile
.
getPath
().
contains
(
"cacheDeck"
))
{
//卡包展示时不显示额外和副卡组数量文本
//卡包展示时不显示额外和副卡组数量文本
holder
.
ll_extra_n_side
.
setVisibility
(
View
.
GONE
);
holder
.
ll_extra_n_side
.
setVisibility
(
View
.
GONE
);
...
@@ -260,6 +255,7 @@ class DeckViewHolder extends com.chad.library.adapter.base.viewholder.BaseViewHo
...
@@ -260,6 +255,7 @@ class DeckViewHolder extends com.chad.library.adapter.base.viewholder.BaseViewHo
TextView
extra
;
TextView
extra
;
TextView
side
;
TextView
side
;
TextView
file_time
;
TextView
file_time
;
LinearLayout
ll_deck_date
;
LinearLayout
ll_extra_n_side
;
LinearLayout
ll_extra_n_side
;
View
item_deck_list
;
View
item_deck_list
;
View
deck_info
;
View
deck_info
;
...
@@ -274,7 +270,8 @@ class DeckViewHolder extends com.chad.library.adapter.base.viewholder.BaseViewHo
...
@@ -274,7 +270,8 @@ class DeckViewHolder extends com.chad.library.adapter.base.viewholder.BaseViewHo
main
=
findView
(
R
.
id
.
count_main
);
main
=
findView
(
R
.
id
.
count_main
);
extra
=
findView
(
R
.
id
.
count_ex
);
extra
=
findView
(
R
.
id
.
count_ex
);
side
=
findView
(
R
.
id
.
count_side
);
side
=
findView
(
R
.
id
.
count_side
);
file_time
=
findView
(
R
.
id
.
file_time
);
ll_deck_date
=
findView
(
R
.
id
.
ll_deck_date
);
file_time
=
findView
(
R
.
id
.
file_time
);
ll_extra_n_side
=
findView
(
R
.
id
.
ll_extra_n_side
);
ll_extra_n_side
=
findView
(
R
.
id
.
ll_extra_n_side
);
prerelease_star
=
findView
(
R
.
id
.
prerelease_star
);
prerelease_star
=
findView
(
R
.
id
.
prerelease_star
);
banned_mark
=
findView
(
R
.
id
.
banned_mark
);
banned_mark
=
findView
(
R
.
id
.
banned_mark
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
View file @
753c2331
package
cn.garymb.ygomobile.utils
;
package
cn.garymb.ygomobile.utils
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.ClipData
;
import
android.content.ClipData
;
import
android.content.ClipboardManager
;
import
android.content.ClipboardManager
;
...
@@ -25,7 +26,12 @@ import com.ourygo.lib.duelassistant.util.Util;
...
@@ -25,7 +26,12 @@ import com.ourygo.lib.duelassistant.util.Util;
import
org.jdeferred.android.AndroidDeferredManager
;
import
org.jdeferred.android.AndroidDeferredManager
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.TimeZone
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
...
@@ -235,6 +241,29 @@ public class YGOUtil {
...
@@ -235,6 +241,29 @@ public class YGOUtil {
float
dp
=
px
/
density
;
float
dp
=
px
/
density
;
return
dp
;
return
dp
;
}
}
/**
* 将时间戳转换为 ISO 8601 格式的时间字符串
*/
@SuppressLint
(
"SimpleDateFormat"
)
public
static
String
convertMillisToIsoString
(
long
timeMillis
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss"
,
Locale
.
US
);
sdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
return
sdf
.
format
(
new
Date
(
timeMillis
));
}
// 方法1:使用SimpleDateFormat解析ISO 8601格式
public
static
long
parseIsoDateToTimestamp
(
String
isoDateString
)
{
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss"
,
Locale
.
US
);
sdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"UTC"
));
Date
date
=
sdf
.
parse
(
isoDateString
);
return
date
.
getTime
();
}
catch
(
ParseException
e
)
{
LogUtil
.
e
(
"parseIsoDateToTimestamp"
,
"解析失败: "
,
e
);
return
0
;
// 解析失败返回0
}
}
}
}
...
...
mobile/src/main/res/layout/item_deck_list_swipe.xml
View file @
753c2331
...
@@ -136,19 +136,31 @@
...
@@ -136,19 +136,31 @@
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_height=
"0dp"
android:layout_weight=
"1"
/>
android:layout_weight=
"1"
/>
<ImageView
android:layout_width=
"15dp"
<LinearLayout
android:layout_height=
"15dp"
android:id=
"@+id/ll_deck_date"
android:src=
"@drawable/baseline_more_time_24"
/>
<TextView
android:id=
"@+id/file_time"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
android:maxLines=
"1"
android:layout_gravity=
"bottom"
>
android:singleLine=
"true"
android:textColor=
"@color/holo_blue_bright"
<ImageView
android:textSize=
"7sp"
android:layout_width=
"10dp"
tools:text=
"2025-07-03T19:47:26"
/>
android:layout_height=
"10dp"
android:layout_gravity=
"center"
android:src=
"@drawable/baseline_more_time_24"
/>
<TextView
android:id=
"@+id/file_time"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:maxLines=
"1"
android:singleLine=
"true"
android:layout_gravity=
"center"
android:textColor=
"@color/holo_blue_bright"
android:textSize=
"7sp"
tools:text=
"2025-07-03T19:47:26"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
...
...
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