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
216c2c89
Commit
216c2c89
authored
Aug 31, 2023
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将ypk内的卡图显示提到最优先
parent
441218df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
41 deletions
+33
-41
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
...src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
+31
-39
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
...rc/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
+1
-1
mobile/src/main/res/layout/fragment_ex_card_log.xml
mobile/src/main/res/layout/fragment_ex_card_log.xml
+1
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
View file @
216c2c89
...
@@ -30,7 +30,6 @@ import cn.garymb.ygomobile.lite.BuildConfig;
...
@@ -30,7 +30,6 @@ import cn.garymb.ygomobile.lite.BuildConfig;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.NetUtils
;
import
cn.garymb.ygomobile.utils.glide.GlideCompat
;
import
cn.garymb.ygomobile.utils.glide.GlideCompat
;
import
cn.garymb.ygomobile.utils.glide.StringSignature
;
import
cn.garymb.ygomobile.utils.glide.StringSignature
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
...
@@ -47,7 +46,10 @@ public class ImageLoader implements Closeable {
...
@@ -47,7 +46,10 @@ public class ImageLoader implements Closeable {
//531x762
//531x762
middle
(
3
);
middle
(
3
);
private
final
int
id
;
private
final
int
id
;
Type
(
int
id
){
this
.
id
=
id
;}
Type
(
int
id
)
{
this
.
id
=
id
;
}
public
int
getId
()
{
public
int
getId
()
{
return
id
;
return
id
;
...
@@ -126,7 +128,7 @@ public class ImageLoader implements Closeable {
...
@@ -126,7 +128,7 @@ public class ImageLoader implements Closeable {
bindT
(
data
,
name
,
imageview
,
pre
,
type
);
bindT
(
data
,
name
,
imageview
,
pre
,
type
);
}
}
private
void
bind
(
final
Uri
uri
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
@NonNull
Type
type
)
{
private
void
bind
(
final
Uri
uri
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
@NonNull
Type
type
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
v
(
TAG
,
"bind uri:"
+
name
+
", type="
+
type
);
Log
.
v
(
TAG
,
"bind uri:"
+
name
+
", type="
+
type
);
}
}
...
@@ -228,7 +230,7 @@ public class ImageLoader implements Closeable {
...
@@ -228,7 +230,7 @@ public class ImageLoader implements Closeable {
}
}
public
void
bindImage
(
ImageView
imageview
,
Card
card
,
@NonNull
Type
type
)
{
public
void
bindImage
(
ImageView
imageview
,
Card
card
,
@NonNull
Type
type
)
{
if
(
card
==
null
)
{
if
(
card
==
null
)
{
imageview
.
setImageResource
(
R
.
drawable
.
unknown
);
imageview
.
setImageResource
(
R
.
drawable
.
unknown
);
}
else
{
}
else
{
bindImage
(
imageview
,
card
.
Code
,
null
,
type
);
bindImage
(
imageview
,
card
.
Code
,
null
,
type
);
...
@@ -240,14 +242,14 @@ public class ImageLoader implements Closeable {
...
@@ -240,14 +242,14 @@ public class ImageLoader implements Closeable {
bindImage
(
imageview
,
code
,
null
,
type
);
bindImage
(
imageview
,
code
,
null
,
type
);
}
}
public
static
File
getImageFile
(
long
code
)
{
public
File
getImageFile
(
long
code
)
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_IMAGE_PATH
+
"/"
+
code
+
ex
);
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_IMAGE_PATH
+
"/"
+
code
+
ex
);
if
(
file
.
exists
())
{
if
(
file
.
exists
())
{
return
file
;
return
file
;
}
}
File
file_ex
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
+
"/"
+
code
+
ex
);
File
file_ex
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
+
"/"
+
code
+
ex
);
if
(
file_ex
.
exists
())
{
if
(
file_ex
.
exists
())
{
return
file_ex
;
return
file_ex
;
}
}
}
}
...
@@ -260,18 +262,6 @@ public class ImageLoader implements Closeable {
...
@@ -260,18 +262,6 @@ public class ImageLoader implements Closeable {
}
}
String
name
=
Constants
.
CORE_IMAGE_PATH
+
"/"
+
code
;
String
name
=
Constants
.
CORE_IMAGE_PATH
+
"/"
+
code
;
String
name_ex
=
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
+
"/"
+
code
;
String
name_ex
=
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
+
"/"
+
code
;
//1.图片文件
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
name
+
ex
);
File
file_ex
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
name_ex
+
ex
);
if
(
file_ex
.
exists
())
{
bind
(
file_ex
,
imageview
,
pre
,
type
);
return
;
}
else
if
(
file
.
exists
())
{
bind
(
file
,
imageview
,
pre
,
type
);
return
;
}
}
//cache
//cache
if
(
useCache
)
{
if
(
useCache
)
{
Cache
cache
=
zipDataCache
.
get
(
code
);
Cache
cache
=
zipDataCache
.
get
(
code
);
...
@@ -280,23 +270,9 @@ public class ImageLoader implements Closeable {
...
@@ -280,23 +270,9 @@ public class ImageLoader implements Closeable {
return
;
return
;
}
}
}
}
//2.zip
//1.zips(包括ypk)
{
ZipFile
pics
=
openPicsZip
();
if
(
pics
!=
null
)
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
if
(
bindInZip
(
imageview
,
code
,
pre
,
pics
,
name
+
ex
,
type
))
{
return
;
}
}
}
}
//3.
//zips
File
[]
files
=
AppsSettings
.
get
().
getExpansionFiles
();
File
[]
files
=
AppsSettings
.
get
().
getExpansionFiles
();
cleanInValidZips
();
cleanInValidZips
();
if
(
files
!=
null
)
{
if
(
files
!=
null
)
{
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
if
(
file
.
isFile
())
{
if
(
file
.
isFile
())
{
...
@@ -322,12 +298,28 @@ public class ImageLoader implements Closeable {
...
@@ -322,12 +298,28 @@ public class ImageLoader implements Closeable {
}
}
}
}
}
}
//4 http
//2.图片文件pics文件夹
if
(
Constants
.
NETWORK_IMAGE
&&
NetUtils
.
isWifiConnected
(
imageview
.
getContext
()))
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
bind
(
Uri
.
parse
(
String
.
format
(
Constants
.
IMAGE_URL
,
""
+
code
)),
code
+
".jpg"
,
imageview
,
pre
,
type
);
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
name
+
ex
);
}
else
{
File
file_ex
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
name_ex
+
ex
);
imageview
.
setImageResource
(
R
.
drawable
.
unknown
);
if
(
file_ex
.
exists
())
{
bind
(
file_ex
,
imageview
,
pre
,
type
);
return
;
}
else
if
(
file
.
exists
())
{
bind
(
file
,
imageview
,
pre
,
type
);
return
;
}
}
}
//3.pics.zip
ZipFile
pics
=
openPicsZip
();
if
(
pics
!=
null
)
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
if
(
bindInZip
(
imageview
,
code
,
pre
,
pics
,
name
+
ex
,
type
))
{
return
;
}
}
}
}
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
View file @
216c2c89
...
@@ -427,7 +427,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -427,7 +427,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
//先显示普通卡片大图,判断如果没有高清图就下载
//先显示普通卡片大图,判断如果没有高清图就下载
imageLoader
.
bindImage
(
photoView
,
code
,
null
,
ImageLoader
.
Type
.
middle
);
imageLoader
.
bindImage
(
photoView
,
code
,
null
,
ImageLoader
.
Type
.
middle
);
if
(
null
==
I
mageLoader
.
getImageFile
(
code
))
{
if
(
null
==
i
mageLoader
.
getImageFile
(
code
))
{
downloadCardImage
(
code
,
false
);
downloadCardImage
(
code
,
false
);
}
}
...
...
mobile/src/main/res/layout/fragment_ex_card_log.xml
View file @
216c2c89
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
android:padding=
"10dp"
>
android:padding=
"10dp"
>
<
Button
<
ImageView
android:layout_width=
"60dp"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_height=
"60dp"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
...
...
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