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
9a67083a
Commit
9a67083a
authored
Sep 27, 2021
by
kenan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载完成再改名字
parent
845503aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
...rc/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
+11
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
...c/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
+15
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
View file @
9a67083a
...
...
@@ -5,6 +5,7 @@ import android.content.Intent;
import
android.os.Handler
;
import
android.os.Message
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
...
...
@@ -34,6 +35,7 @@ import cn.garymb.ygomobile.ui.adapters.BaseAdapterPlus;
import
cn.garymb.ygomobile.utils.CardUtils
;
import
cn.garymb.ygomobile.utils.DownloadUtil
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.NetUtils
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
ocgcore.CardManager
;
import
ocgcore.DataManager
;
...
...
@@ -424,18 +426,23 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
private
void
downloadCardImage
(
int
code
,
File
f
ile
)
{
private
void
downloadCardImage
(
int
code
,
File
imgF
ile
)
{
if
(
cardManager
.
getCard
(
code
)
==
null
)
{
YGOUtil
.
show
(
context
.
getString
(
R
.
string
.
tip_expansions_image
));
return
;
}
final
File
tmp
=
new
File
(
imgFile
.
getAbsolutePath
()
+
".tmp"
);
if
(
tmp
.
exists
())
{
return
;
}
isDownloadCardImage
=
false
;
ll_bar
.
setVisibility
(
View
.
VISIBLE
);
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
in_from_top
));
DownloadUtil
.
get
().
download
(
YGOUtil
.
getCardImageDetailUrl
(
code
),
file
.
getParent
(),
file
.
getName
(),
new
DownloadUtil
.
OnDownloadListener
()
{
DownloadUtil
.
get
().
download
(
YGOUtil
.
getCardImageDetailUrl
(
code
),
tmp
.
getParent
(),
tmp
.
getName
(),
new
DownloadUtil
.
OnDownloadListener
()
{
@Override
public
void
onDownloadSuccess
(
File
file
)
{
if
(
file
.
length
()
<
50
*
1024
)
{
boolean
bad
=
file
.
length
()
<
50
*
1024
;
if
(
bad
||
!
tmp
.
renameTo
(
imgFile
))
{
FileUtils
.
deleteFile
(
file
);
Message
message
=
new
Message
();
message
.
what
=
TYPE_DOWNLOAD_CARD_IMAGE_EXCEPTION
;
...
...
@@ -460,7 +467,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
@Override
public
void
onDownloadFailed
(
Exception
e
)
{
//下载失败后删除下载的文件
FileUtils
.
deleteFile
(
file
);
FileUtils
.
deleteFile
(
tmp
);
// downloadCardImage(code, file);
Message
message
=
new
Message
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
View file @
9a67083a
...
...
@@ -14,6 +14,8 @@ import android.text.TextUtils;
import
android.util.Log
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.io.FilenameFilter
;
import
java.io.IOException
;
import
java.util.List
;
...
...
@@ -187,6 +189,19 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
if
(
Constants
.
DEBUG
)
Log
.
d
(
TAG
,
"check start"
);
boolean
needsUpdate
=
isNewVersion
;
//清空下载缓存
File
imgDir
=
new
File
(
AppsSettings
.
get
().
getCardImagePath
());
File
[]
files
=
imgDir
.
listFiles
(
new
FilenameFilter
()
{
@Override
public
boolean
accept
(
File
dir
,
String
name
)
{
return
name
.
endsWith
(
".tmp"
);
}
});
if
(
files
!=
null
){
for
(
File
file
:
files
){
FileUtils
.
deleteFile
(
file
);
}
}
//core config
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
core_config
)));
//res
...
...
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