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
8a4e09d8
Commit
8a4e09d8
authored
Sep 27, 2021
by
qq247321453
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ImageLoader
parent
d3ef672c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
69 deletions
+75
-69
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+5
-1
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
...src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
+60
-58
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/CardListAdapter.java
...java/cn/garymb/ygomobile/ui/adapters/CardListAdapter.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
...rc/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
+5
-5
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
...n/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck/DeckAdapater.java
.../java/cn/garymb/ygomobile/ui/cards/deck/DeckAdapater.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
...ain/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
...src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
+1
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
8a4e09d8
...
@@ -92,7 +92,11 @@ public interface Constants {
...
@@ -92,7 +92,11 @@ public interface Constants {
String
UNKNOWN_IMAGE
=
"unknown.jpg"
;
String
UNKNOWN_IMAGE
=
"unknown.jpg"
;
String
YDK_FILE_EX
=
".ydk"
;
String
YDK_FILE_EX
=
".ydk"
;
int
[]
CORE_SKIN_BG_SIZE
=
new
int
[]{
1280
,
720
};
int
[]
CORE_SKIN_BG_SIZE
=
new
int
[]{
1280
,
720
};
int
[]
CORE_SKIN_CARD_MINI_SIZE
=
new
int
[]{
177
,
254
};
int
[]
CORE_SKIN_CARD_DECK_SIZE
=
new
int
[]{
44
,
64
};
int
[]
CORE_SKIN_CARD_LIST_SIZE
=
new
int
[]{
177
,
254
};
int
[]
CORE_SKIN_CARD_DETAIL_SIZE
=
new
int
[]{
354
,
508
};
int
[]
CORE_SKIN_CARD_COVER_SIZE
=
new
int
[]{
177
,
254
};
int
[]
CORE_SKIN_CARD_COVER_SIZE
=
new
int
[]{
177
,
254
};
int
[]
CORE_SKIN_AVATAR_SIZE
=
new
int
[]{
128
,
128
};
int
[]
CORE_SKIN_AVATAR_SIZE
=
new
int
[]{
128
,
128
};
boolean
SUPPORT_BPG
=
true
;
boolean
SUPPORT_BPG
=
true
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
View file @
8a4e09d8
...
@@ -44,13 +44,18 @@ import cn.garymb.ygomobile.utils.NetUtils;
...
@@ -44,13 +44,18 @@ import cn.garymb.ygomobile.utils.NetUtils;
import
static
com
.
bumptech
.
glide
.
Glide
.
with
;
import
static
com
.
bumptech
.
glide
.
Glide
.
with
;
public
class
ImageLoader
implements
Closeable
{
public
class
ImageLoader
implements
Closeable
{
public
static
final
ImageLoader
sImageLoader
=
new
ImageLoader
();
public
enum
Type
{
//origin size
public
static
ImageLoader
get
()
{
origin
,
return
sImageLoader
;
//44x64
deck
,
//177x254
list
,
//354x508
detail
}
}
private
static
class
Cache
{
private
static
class
Cache
{
private
final
byte
[]
data
;
private
final
byte
[]
data
;
private
final
String
name
;
private
final
String
name
;
...
@@ -67,7 +72,8 @@ public class ImageLoader implements Closeable {
...
@@ -67,7 +72,8 @@ public class ImageLoader implements Closeable {
private
final
Map
<
Long
,
Cache
>
zipDataCache
=
new
ConcurrentHashMap
<>();
private
final
Map
<
Long
,
Cache
>
zipDataCache
=
new
ConcurrentHashMap
<>();
private
ZipFile
mDefaultZipFile
;
private
ZipFile
mDefaultZipFile
;
private
File
mPicsFile
;
private
File
mPicsFile
;
public
ImageLoader
(){
public
ImageLoader
()
{
this
(
false
);
this
(
false
);
}
}
...
@@ -76,7 +82,7 @@ public class ImageLoader implements Closeable {
...
@@ -76,7 +82,7 @@ public class ImageLoader implements Closeable {
}
}
private
ZipFile
openPicsZip
()
{
private
ZipFile
openPicsZip
()
{
if
(
mPicsFile
==
null
)
{
if
(
mPicsFile
==
null
)
{
mPicsFile
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_PICS_ZIP
);
mPicsFile
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_PICS_ZIP
);
}
}
if
(
mDefaultZipFile
==
null
)
{
if
(
mDefaultZipFile
==
null
)
{
...
@@ -91,11 +97,11 @@ public class ImageLoader implements Closeable {
...
@@ -91,11 +97,11 @@ public class ImageLoader implements Closeable {
return
mDefaultZipFile
;
return
mDefaultZipFile
;
}
}
public
void
resume
(){
public
void
resume
()
{
}
}
public
void
clearZipCache
(){
public
void
clearZipCache
()
{
//关闭zip
//关闭zip
for
(
ZipFile
zipFile
:
zipFileCache
.
values
())
{
for
(
ZipFile
zipFile
:
zipFileCache
.
values
())
{
IOUtils
.
closeZip
(
zipFile
);
IOUtils
.
closeZip
(
zipFile
);
...
@@ -115,24 +121,24 @@ public class ImageLoader implements Closeable {
...
@@ -115,24 +121,24 @@ public class ImageLoader implements Closeable {
zipDataCache
.
clear
();
zipDataCache
.
clear
();
}
}
private
void
bind
(
final
byte
[]
data
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
int
[]
siz
e
)
{
private
void
bind
(
final
byte
[]
data
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
@NonNull
Type
typ
e
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
v
(
TAG
,
"bind data:"
+
name
+
",
size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
])
);
Log
.
v
(
TAG
,
"bind data:"
+
name
+
",
type="
+
type
);
}
}
bindT
(
data
,
name
,
imageview
,
pre
,
siz
e
);
bindT
(
data
,
name
,
imageview
,
pre
,
typ
e
);
}
}
private
void
bind
(
final
Uri
uri
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
int
[]
siz
e
)
{
private
void
bind
(
final
Uri
uri
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
@NonNull
Type
typ
e
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
v
(
TAG
,
"bind uri:"
+
name
+
",
size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
])
);
Log
.
v
(
TAG
,
"bind uri:"
+
name
+
",
type="
+
type
);
}
}
bindT
(
uri
,
name
,
imageview
,
pre
,
siz
e
);
bindT
(
uri
,
name
,
imageview
,
pre
,
typ
e
);
}
}
private
<
T
>
void
setDefaults
(
@NonNull
DrawableTypeRequest
<
T
>
resource
,
String
name
,
private
<
T
>
void
setDefaults
(
@NonNull
DrawableTypeRequest
<
T
>
resource
,
String
name
,
@Nullable
com
.
bumptech
.
glide
.
load
.
Key
signature
,
@Nullable
com
.
bumptech
.
glide
.
load
.
Key
signature
,
@Nullable
Drawable
pre
,
@Nullable
Drawable
pre
,
@N
ullable
int
[]
siz
e
)
{
@N
onNull
Type
typ
e
)
{
if
(
pre
!=
null
)
{
if
(
pre
!=
null
)
{
resource
.
placeholder
(
pre
);
resource
.
placeholder
(
pre
);
}
else
{
}
else
{
...
@@ -140,10 +146,24 @@ public class ImageLoader implements Closeable {
...
@@ -140,10 +146,24 @@ public class ImageLoader implements Closeable {
}
}
resource
.
error
(
R
.
drawable
.
unknown
);
resource
.
error
(
R
.
drawable
.
unknown
);
resource
.
animate
(
R
.
anim
.
push_in
);
resource
.
animate
(
R
.
anim
.
push_in
);
if
(
size
!=
null
)
{
if
(
type
!=
Type
.
origin
)
{
resource
.
override
(
size
[
0
],
size
[
1
]);
int
[]
size
=
null
;
switch
(
type
)
{
case
deck:
size
=
Constants
.
CORE_SKIN_CARD_DECK_SIZE
;
break
;
case
list:
size
=
Constants
.
CORE_SKIN_CARD_LIST_SIZE
;
break
;
case
detail:
size
=
Constants
.
CORE_SKIN_CARD_DETAIL_SIZE
;
break
;
}
if
(
size
!=
null
)
{
resource
.
override
(
size
[
0
],
size
[
1
]);
}
}
}
if
(
signature
!=
null
)
{
if
(
signature
!=
null
)
{
resource
.
signature
(
signature
);
resource
.
signature
(
signature
);
}
}
String
ex
=
FileUtils
.
getFileExpansion
(
name
);
String
ex
=
FileUtils
.
getFileExpansion
(
name
);
...
@@ -152,38 +172,32 @@ public class ImageLoader implements Closeable {
...
@@ -152,38 +172,32 @@ public class ImageLoader implements Closeable {
}
}
}
}
private
<
T
>
void
bindT
(
final
T
data
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
int
[]
siz
e
)
{
private
<
T
>
void
bindT
(
final
T
data
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
@NonNull
Type
typ
e
)
{
try
{
try
{
DrawableTypeRequest
<
T
>
resource
=
with
(
imageview
.
getContext
()).
load
(
data
);
DrawableTypeRequest
<
T
>
resource
=
with
(
imageview
.
getContext
()).
load
(
data
);
if
(
size
==
null
)
{
setDefaults
(
resource
,
name
,
new
StringSignature
(
name
+
":"
+
type
),
pre
,
type
);
setDefaults
(
resource
,
name
,
new
StringSignature
(
name
),
pre
,
size
);
resource
.
signature
(
new
StringSignature
(
name
));
}
else
{
setDefaults
(
resource
,
name
,
new
StringSignature
(
name
+
":"
+
size
[
0
]
+
"x"
+
size
[
1
]),
pre
,
size
);
}
resource
.
into
(
imageview
);
resource
.
into
(
imageview
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"$"
,
e
);
Log
.
e
(
TAG
,
"$"
,
e
);
}
}
}
}
private
void
bind
(
final
File
file
,
ImageView
imageview
,
Drawable
pre
,
int
[]
siz
e
)
{
private
void
bind
(
final
File
file
,
ImageView
imageview
,
Drawable
pre
,
@NonNull
Type
typ
e
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
v
(
TAG
,
"bind file:"
+
file
.
getPath
()
+
",
size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
])
);
Log
.
v
(
TAG
,
"bind file:"
+
file
.
getPath
()
+
",
type="
+
type
);
}
}
try
{
try
{
DrawableTypeRequest
<
File
>
resource
=
with
(
imageview
.
getContext
()).
load
(
file
);
DrawableTypeRequest
<
File
>
resource
=
with
(
imageview
.
getContext
()).
load
(
file
);
long
key
=
size
==
null
?
0
:(
size
[
0
]
*
size
[
1
]);
setDefaults
(
resource
,
file
.
getName
(),
setDefaults
(
resource
,
file
.
getName
(),
new
MediaStoreSignature
(
"image/*"
,
new
MediaStoreSignature
(
"image/*"
,
file
.
lastModified
()
+
key
,
0
),
pre
,
siz
e
);
file
.
lastModified
()
,
type
.
ordinal
()),
pre
,
typ
e
);
resource
.
into
(
imageview
);
resource
.
into
(
imageview
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"$"
,
e
);
Log
.
e
(
TAG
,
"$"
,
e
);
}
}
}
}
private
boolean
bindInZip
(
ImageView
imageView
,
long
code
,
Drawable
pre
,
ZipFile
zipFile
,
String
nameWithEx
,
int
[]
siz
e
)
{
private
boolean
bindInZip
(
ImageView
imageView
,
long
code
,
Drawable
pre
,
ZipFile
zipFile
,
String
nameWithEx
,
@NonNull
Type
typ
e
)
{
ZipEntry
entry
;
ZipEntry
entry
;
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
ByteArrayOutputStream
outputStream
;
ByteArrayOutputStream
outputStream
;
...
@@ -195,10 +209,10 @@ public class ImageLoader implements Closeable {
...
@@ -195,10 +209,10 @@ public class ImageLoader implements Closeable {
outputStream
=
new
ByteArrayOutputStream
();
outputStream
=
new
ByteArrayOutputStream
();
IOUtils
.
copy
(
inputStream
,
outputStream
);
IOUtils
.
copy
(
inputStream
,
outputStream
);
byte
[]
data
=
outputStream
.
toByteArray
();
byte
[]
data
=
outputStream
.
toByteArray
();
if
(
useCache
)
{
if
(
useCache
)
{
zipDataCache
.
put
(
code
,
new
Cache
(
data
,
nameWithEx
));
zipDataCache
.
put
(
code
,
new
Cache
(
data
,
nameWithEx
));
}
}
bind
(
data
,
nameWithEx
,
imageView
,
pre
,
siz
e
);
bind
(
data
,
nameWithEx
,
imageView
,
pre
,
typ
e
);
bind
=
true
;
bind
=
true
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -221,25 +235,13 @@ public class ImageLoader implements Closeable {
...
@@ -221,25 +235,13 @@ public class ImageLoader implements Closeable {
}
}
}
}
public
void
bindImage
(
ImageView
imageview
,
long
code
,
@NonNull
Type
type
)
{
/**
bindImage
(
imageview
,
code
,
null
,
type
);
* 177x254
*/
public
void
bindImage
(
ImageView
imageview
,
long
code
)
{
bindImage
(
imageview
,
code
,
null
,
Constants
.
CORE_SKIN_CARD_MINI_SIZE
);
}
/**
* @param big true则是原始大小
*/
@Deprecated
public
void
bindImage
(
ImageView
imageview
,
long
code
,
Drawable
pre
,
boolean
big
)
{
bindImage
(
imageview
,
code
,
pre
,
big
?
null
:
Constants
.
CORE_SKIN_CARD_MINI_SIZE
);
}
}
public
void
bindImage
(
ImageView
imageview
,
long
code
,
Drawable
pre
,
int
[]
siz
e
)
{
public
void
bindImage
(
ImageView
imageview
,
long
code
,
Drawable
pre
,
@NonNull
Type
typ
e
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
v
(
TAG
,
"bind image:"
+
code
+
",
size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
])
);
Log
.
v
(
TAG
,
"bind image:"
+
code
+
",
type="
+
type
);
}
}
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
;
...
@@ -248,18 +250,18 @@ public class ImageLoader implements Closeable {
...
@@ -248,18 +250,18 @@ public class ImageLoader implements Closeable {
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
name
+
ex
);
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
name
+
ex
);
File
file_ex
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
name_ex
+
ex
);
File
file_ex
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
name_ex
+
ex
);
if
(
file_ex
.
exists
())
{
if
(
file_ex
.
exists
())
{
bind
(
file_ex
,
imageview
,
pre
,
siz
e
);
bind
(
file_ex
,
imageview
,
pre
,
typ
e
);
return
;
return
;
}
else
if
(
file
.
exists
())
{
}
else
if
(
file
.
exists
())
{
bind
(
file
,
imageview
,
pre
,
siz
e
);
bind
(
file
,
imageview
,
pre
,
typ
e
);
return
;
return
;
}
}
}
}
//cache
//cache
if
(
useCache
)
{
if
(
useCache
)
{
Cache
cache
=
zipDataCache
.
get
(
code
);
Cache
cache
=
zipDataCache
.
get
(
code
);
if
(
cache
!=
null
)
{
if
(
cache
!=
null
)
{
bind
(
cache
.
data
,
cache
.
name
,
imageview
,
pre
,
siz
e
);
bind
(
cache
.
data
,
cache
.
name
,
imageview
,
pre
,
typ
e
);
return
;
return
;
}
}
}
}
...
@@ -268,7 +270,7 @@ public class ImageLoader implements Closeable {
...
@@ -268,7 +270,7 @@ public class ImageLoader implements Closeable {
ZipFile
pics
=
openPicsZip
();
ZipFile
pics
=
openPicsZip
();
if
(
pics
!=
null
)
{
if
(
pics
!=
null
)
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
if
(
bindInZip
(
imageview
,
code
,
pre
,
pics
,
name
+
ex
,
siz
e
))
{
if
(
bindInZip
(
imageview
,
code
,
pre
,
pics
,
name
+
ex
,
typ
e
))
{
return
;
return
;
}
}
}
}
...
@@ -284,11 +286,11 @@ public class ImageLoader implements Closeable {
...
@@ -284,11 +286,11 @@ public class ImageLoader implements Closeable {
if
(
files
!=
null
)
{
if
(
files
!=
null
)
{
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
if
(
file
.
isFile
())
{
if
(
file
.
isFile
())
{
ZipFile
zipFile
=
useCache
?
zipFileCache
.
get
(
file
.
getAbsolutePath
())
:
null
;
ZipFile
zipFile
=
useCache
?
zipFileCache
.
get
(
file
.
getAbsolutePath
())
:
null
;
if
(
zipFile
==
null
)
{
if
(
zipFile
==
null
)
{
try
{
try
{
zipFile
=
new
ZipFile
(
file
);
zipFile
=
new
ZipFile
(
file
);
if
(
useCache
)
{
if
(
useCache
)
{
zipFileCache
.
put
(
file
.
getAbsolutePath
(),
zipFile
);
zipFileCache
.
put
(
file
.
getAbsolutePath
(),
zipFile
);
}
}
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
...
@@ -299,7 +301,7 @@ public class ImageLoader implements Closeable {
...
@@ -299,7 +301,7 @@ public class ImageLoader implements Closeable {
continue
;
continue
;
}
}
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
for
(
String
ex
:
Constants
.
IMAGE_EX
)
{
if
(
bindInZip
(
imageview
,
code
,
pre
,
zipFile
,
name
+
ex
,
siz
e
))
{
if
(
bindInZip
(
imageview
,
code
,
pre
,
zipFile
,
name
+
ex
,
typ
e
))
{
return
;
return
;
}
}
}
}
...
@@ -308,7 +310,7 @@ public class ImageLoader implements Closeable {
...
@@ -308,7 +310,7 @@ public class ImageLoader implements Closeable {
}
}
//4 http
//4 http
if
(
Constants
.
NETWORK_IMAGE
&&
NetUtils
.
isWifiConnected
(
imageview
.
getContext
()))
{
if
(
Constants
.
NETWORK_IMAGE
&&
NetUtils
.
isWifiConnected
(
imageview
.
getContext
()))
{
bind
(
Uri
.
parse
(
String
.
format
(
Constants
.
IMAGE_URL
,
""
+
code
)),
code
+
".jpg"
,
imageview
,
pre
,
siz
e
);
bind
(
Uri
.
parse
(
String
.
format
(
Constants
.
IMAGE_URL
,
""
+
code
)),
code
+
".jpg"
,
imageview
,
pre
,
typ
e
);
}
else
{
}
else
{
imageview
.
setImageResource
(
R
.
drawable
.
unknown
);
imageview
.
setImageResource
(
R
.
drawable
.
unknown
);
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/CardListAdapter.java
View file @
8a4e09d8
...
@@ -105,7 +105,7 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, ViewHolder> i
...
@@ -105,7 +105,7 @@ public class CardListAdapter extends BaseRecyclerAdapterPlus<Card, ViewHolder> i
if
(
item
==
null
){
if
(
item
==
null
){
return
;
return
;
}
}
imageLoader
.
bindImage
(
holder
.
cardImage
,
item
.
Code
);
imageLoader
.
bindImage
(
holder
.
cardImage
,
item
.
Code
,
ImageLoader
.
Type
.
list
);
holder
.
cardName
.
setText
(
item
.
Name
);
holder
.
cardName
.
setText
(
item
.
Name
);
if
(
item
.
isType
(
CardType
.
Monster
))
{
if
(
item
.
isType
(
CardType
.
Monster
))
{
holder
.
layout_atk
.
setVisibility
(
View
.
VISIBLE
);
holder
.
layout_atk
.
setVisibility
(
View
.
VISIBLE
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
View file @
8a4e09d8
...
@@ -103,8 +103,8 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -103,8 +103,8 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
isDownloadCardImage
=
true
;
isDownloadCardImage
=
true
;
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
out_from_bottom
));
ll_bar
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
context
,
R
.
anim
.
out_from_bottom
));
ll_bar
.
setVisibility
(
View
.
GONE
);
ll_bar
.
setVisibility
(
View
.
GONE
);
imageLoader
.
bindImage
(
photoView
,
msg
.
arg1
,
null
,
true
);
imageLoader
.
bindImage
(
photoView
,
msg
.
arg1
,
null
,
ImageLoader
.
Type
.
origin
);
imageLoader
.
bindImage
(
cardImage
,
msg
.
arg1
,
null
,
true
);
imageLoader
.
bindImage
(
cardImage
,
msg
.
arg1
,
null
,
ImageLoader
.
Type
.
detail
);
break
;
break
;
case
TYPE_DOWNLOAD_CARD_IMAGE_ING:
case
TYPE_DOWNLOAD_CARD_IMAGE_ING:
tv_loading
.
setText
(
msg
.
arg1
+
"%"
);
tv_loading
.
setText
(
msg
.
arg1
+
"%"
);
...
@@ -259,7 +259,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -259,7 +259,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private
void
setCardInfo
(
Card
cardInfo
,
View
view
)
{
private
void
setCardInfo
(
Card
cardInfo
,
View
view
)
{
if
(
cardInfo
==
null
)
return
;
if
(
cardInfo
==
null
)
return
;
mCardInfo
=
cardInfo
;
mCardInfo
=
cardInfo
;
imageLoader
.
bindImage
(
cardImage
,
cardInfo
.
Code
,
null
,
true
);
imageLoader
.
bindImage
(
cardImage
,
cardInfo
.
Code
,
ImageLoader
.
Type
.
detail
);
dialog
=
DialogUtils
.
getdx
(
context
);
dialog
=
DialogUtils
.
getdx
(
context
);
cardImage
.
setOnClickListener
((
v
)
->
{
cardImage
.
setOnClickListener
((
v
)
->
{
showCardImageDetail
(
cardInfo
.
Code
);
showCardImageDetail
(
cardInfo
.
Code
);
...
@@ -405,13 +405,13 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
...
@@ -405,13 +405,13 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
});
});
imageLoader
.
bindImage
(
cardImage
,
code
,
null
,
true
);
imageLoader
.
bindImage
(
cardImage
,
code
,
null
,
ImageLoader
.
Type
.
origin
);
return
true
;
return
true
;
}
}
});
});
//先显示普通卡片大图,判断如果没有高清图就下载
//先显示普通卡片大图,判断如果没有高清图就下载
imageLoader
.
bindImage
(
photoView
,
code
,
null
,
true
);
imageLoader
.
bindImage
(
photoView
,
code
,
null
,
ImageLoader
.
Type
.
detail
);
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
downloadCardImage
(
code
,
file
);
downloadCardImage
(
code
,
file
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
View file @
8a4e09d8
...
@@ -98,7 +98,7 @@ public class CardDetailRandom {
...
@@ -98,7 +98,7 @@ public class CardDetailRandom {
}
}
public
void
bindCardImage
(
ImageLoader
imageLoader
,
long
code
)
{
public
void
bindCardImage
(
ImageLoader
imageLoader
,
long
code
)
{
imageLoader
.
bindImage
(
cardImage
,
code
,
null
,
true
);
imageLoader
.
bindImage
(
cardImage
,
code
,
ImageLoader
.
Type
.
origin
);
}
}
public
View
getView
()
{
public
View
getView
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck/DeckAdapater.java
View file @
8a4e09d8
...
@@ -596,7 +596,7 @@ public class DeckAdapater extends RecyclerView.Adapter<DeckViewHolder> implement
...
@@ -596,7 +596,7 @@ public class DeckAdapater extends RecyclerView.Adapter<DeckViewHolder> implement
holder
.
setRightImage
(
null
);
holder
.
setRightImage
(
null
);
}
}
// holder.useDefault();
// holder.useDefault();
imageLoader
.
bindImage
(
holder
.
cardImage
,
cardInfo
.
Code
);
imageLoader
.
bindImage
(
holder
.
cardImage
,
cardInfo
.
Code
,
ImageLoader
.
Type
.
deck
);
}
else
{
}
else
{
holder
.
setCardType
(
0
);
holder
.
setCardType
(
0
);
holder
.
setRightImage
(
null
);
holder
.
setRightImage
(
null
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
View file @
8a4e09d8
...
@@ -25,7 +25,7 @@ public class CardGroupView extends FrameLayout {
...
@@ -25,7 +25,7 @@ public class CardGroupView extends FrameLayout {
private
int
mLineLimit
=
10
;
private
int
mLineLimit
=
10
;
private
int
mOrgLineLimit
=
10
;
private
int
mOrgLineLimit
=
10
;
private
int
mLineMaxCount
=
15
;
private
int
mLineMaxCount
=
15
;
private
int
mCardWidth
=
Constants
.
CORE_SKIN_CARD_
MINI_SIZE
[
0
],
mCardHeight
=
Constants
.
CORE_SKIN_CARD_MINI
_SIZE
[
1
];
private
int
mCardWidth
=
Constants
.
CORE_SKIN_CARD_
DECK_SIZE
[
0
],
mCardHeight
=
Constants
.
CORE_SKIN_CARD_DECK
_SIZE
[
1
];
private
boolean
mPausePadding
;
private
boolean
mPausePadding
;
private
ImageLoader
mImageLoader
;
private
ImageLoader
mImageLoader
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
View file @
8a4e09d8
...
@@ -95,7 +95,7 @@ public class CardView extends FrameLayout {
...
@@ -95,7 +95,7 @@ public class CardView extends FrameLayout {
if
(
mCard
!=
null
&&
mCard
.
equals
(
cardInfo
))
return
;
if
(
mCard
!=
null
&&
mCard
.
equals
(
cardInfo
))
return
;
mCard
=
cardInfo
;
mCard
=
cardInfo
;
if
(
cardInfo
!=
null
&&
imageLoader
!=
null
)
{
if
(
cardInfo
!=
null
&&
imageLoader
!=
null
)
{
imageLoader
.
bindImage
(
mCardView
,
cardInfo
.
Code
,
null
,
true
);
imageLoader
.
bindImage
(
mCardView
,
cardInfo
.
Code
,
ImageLoader
.
Type
.
deck
);
}
else
{
}
else
{
mTopImage
.
setVisibility
(
View
.
GONE
);
mTopImage
.
setVisibility
(
View
.
GONE
);
mCardView
.
setImageBitmap
(
null
);
mCardView
.
setImageBitmap
(
null
);
...
...
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