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
0eb9fc31
Commit
0eb9fc31
authored
Sep 27, 2021
by
qq247321453
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CardKeyWord搜索
parent
7a92d476
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
36 deletions
+25
-36
mobile/src/main/java/cn/garymb/ygomobile/loader/CardKeyWord.java
...src/main/java/cn/garymb/ygomobile/loader/CardKeyWord.java
+12
-31
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
...src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
+4
-4
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/ocgcore/data/Card.java
mobile/src/main/java/ocgcore/data/Card.java
+8
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/loader/CardKeyWord.java
View file @
0eb9fc31
...
...
@@ -6,11 +6,11 @@ import android.util.Log;
import
java.util.ArrayList
;
import
java.util.List
;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
ocgcore.DataManager
;
import
ocgcore.data.Card
;
public
class
CardKeyWord
{
private
static
final
String
TAG
=
"CardKeyWord"
;
private
final
String
word
;
private
final
List
<
ICardFilter
>
filterList
=
new
ArrayList
<>();
private
final
boolean
empty
;
...
...
@@ -42,15 +42,8 @@ public class CardKeyWord {
w
=
w
.
substring
(
1
);
}
}
if
(!
onlyText
)
{
long
setcode
=
DataManager
.
get
().
getStringManager
().
getSetCode
(
w
);
if
(
setcode
!=
0
)
{
//如果是系列名
filterList
.
add
(
new
SetcodeFilter
(
setcode
,
exclude
));
}
}
// Log.d(IrrlichtBridge.TAG, "filter:word=" + w + ", exclude=" + exclude + ", onlyText=" + onlyText);
filterList
.
add
(
new
NameFilter
(
w
,
exclude
));
Log
.
d
(
TAG
,
"filter:word="
+
w
+
", exclude="
+
exclude
+
", onlyText="
+
onlyText
);
filterList
.
add
(
new
NameFilter
(
w
,
exclude
,
onlyText
));
}
}
}
...
...
@@ -76,37 +69,25 @@ public class CardKeyWord {
private
static
class
NameFilter
implements
ICardFilter
{
private
final
boolean
exclude
;
private
final
String
word
;
private
final
long
setcode
;
public
NameFilter
(
String
word
,
boolean
exclude
)
{
//包含系列,或者包含名字、描述
public
NameFilter
(
String
word
,
boolean
exclude
,
boolean
onlyText
)
{
this
.
setcode
=
onlyText
?
0
:
DataManager
.
get
().
getStringManager
().
getSetCode
(
word
);
this
.
exclude
=
exclude
;
this
.
word
=
word
;
}
@Override
public
boolean
isValid
(
Card
card
)
{
if
(
exclude
)
{
return
!
card
.
Name
.
contains
(
word
);
}
else
{
return
card
.
Name
.
contains
(
word
);
if
(
this
.
setcode
>
0
){
Log
.
d
(
TAG
,
"filter:setcode="
+
setcode
+
", exclude="
+
exclude
+
", word="
+
word
);
}
}
}
private
static
class
SetcodeFilter
implements
ICardFilter
{
private
final
boolean
exclude
;
private
final
long
setcode
;
public
SetcodeFilter
(
long
setcode
,
boolean
exclude
)
{
this
.
exclude
=
exclude
;
this
.
setcode
=
setcode
;
}
@Override
public
boolean
isValid
(
Card
card
)
{
boolean
ret
=
(
setcode
!=
0
&&
card
.
isSetCode
(
setcode
))
||
card
.
containsName
(
word
)
||
card
.
containsDesc
(
word
);
if
(
exclude
)
{
return
!
card
.
isSetCode
(
setcode
)
;
return
!
ret
;
}
else
{
return
card
.
isSetCode
(
setcode
)
;
return
ret
;
}
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
View file @
0eb9fc31
...
...
@@ -117,14 +117,14 @@ public class ImageLoader implements Closeable {
private
void
bind
(
final
byte
[]
data
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
int
[]
size
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
d
(
TAG
,
"bind data:"
+
name
+
", size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
]));
Log
.
v
(
TAG
,
"bind data:"
+
name
+
", size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
]));
}
bindT
(
data
,
name
,
imageview
,
pre
,
size
);
}
private
void
bind
(
final
Uri
uri
,
String
name
,
ImageView
imageview
,
Drawable
pre
,
int
[]
size
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
d
(
TAG
,
"bind uri:"
+
name
+
", size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
]));
Log
.
v
(
TAG
,
"bind uri:"
+
name
+
", size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
]));
}
bindT
(
uri
,
name
,
imageview
,
pre
,
size
);
}
...
...
@@ -169,7 +169,7 @@ public class ImageLoader implements Closeable {
private
void
bind
(
final
File
file
,
ImageView
imageview
,
Drawable
pre
,
int
[]
size
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
d
(
TAG
,
"bind file:"
+
file
.
getPath
()
+
", size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
]));
Log
.
v
(
TAG
,
"bind file:"
+
file
.
getPath
()
+
", size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
]));
}
try
{
DrawableTypeRequest
<
File
>
resource
=
with
(
imageview
.
getContext
()).
load
(
file
);
...
...
@@ -239,7 +239,7 @@ public class ImageLoader implements Closeable {
public
void
bindImage
(
ImageView
imageview
,
long
code
,
Drawable
pre
,
int
[]
size
)
{
if
(
BuildConfig
.
DEBUG_MODE
)
{
Log
.
d
(
TAG
,
"bind image:"
+
code
+
", size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
]));
Log
.
v
(
TAG
,
"bind image:"
+
code
+
", size="
+
(
size
==
null
?
"null"
:
size
[
0
]
+
"x"
+
size
[
1
]));
}
String
name
=
Constants
.
CORE_IMAGE_PATH
+
"/"
+
code
;
String
name_ex
=
Constants
.
CORE_EXPANSIONS_IMAGE_PATH
+
"/"
+
code
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
View file @
0eb9fc31
...
...
@@ -92,7 +92,7 @@ public class CardDetailRandom {
public
static
CardDetailRandom
genRandomCardDetail
(
Context
context
,
ImageLoader
imageLoader
,
Card
cardInfo
)
{
if
(
cardInfo
==
null
)
return
null
;
CardDetailRandom
cardDetailRandom
=
new
CardDetailRandom
(
context
,
cardInfo
);
cardDetailRandom
.
bindCardImage
(
imageLoader
,
cardInfo
.
Alias
!=
0
?
cardInfo
.
Alias
:
cardInfo
.
Code
);
cardDetailRandom
.
bindCardImage
(
imageLoader
,
cardInfo
.
Code
);
sCardDetailRandom
=
cardDetailRandom
;
return
cardDetailRandom
;
}
...
...
mobile/src/main/java/ocgcore/data/Card.java
View file @
0eb9fc31
...
...
@@ -139,6 +139,14 @@ public class Card extends CardData implements Parcelable {
return
c
.
Code
==
this
.
Code
||
c
.
Alias
==
this
.
Code
||
c
.
Code
==
this
.
Alias
;
}
public
boolean
containsName
(
String
key
){
return
Name
!=
null
&&
Name
.
contains
(
key
);
}
public
boolean
containsDesc
(
String
key
){
return
Desc
!=
null
&&
Desc
.
contains
(
key
);
}
@NonNull
@Override
public
String
toString
()
{
...
...
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