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
dd39a1bd
Commit
dd39a1bd
authored
Dec 15, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关键词排除须"-"后有文本,单"-"不视为排除
添加注释
parent
a24faf25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
15 deletions
+40
-15
mobile/src/main/java/cn/garymb/ygomobile/loader/CardKeyWord.java
...src/main/java/cn/garymb/ygomobile/loader/CardKeyWord.java
+40
-15
No files found.
mobile/src/main/java/cn/garymb/ygomobile/loader/CardKeyWord.java
View file @
dd39a1bd
...
@@ -21,44 +21,69 @@ public class CardKeyWord {
...
@@ -21,44 +21,69 @@ public class CardKeyWord {
private
final
boolean
empty
;
private
final
boolean
empty
;
public
CardKeyWord
(
String
word
)
{
public
CardKeyWord
(
String
word
)
{
// 保存原始搜索关键词
this
.
word
=
word
;
this
.
word
=
word
;
// 如果关键词不为空,则进行解析和过滤器构建
if
(!
TextUtils
.
isEmpty
(
word
))
{
if
(!
TextUtils
.
isEmpty
(
word
))
{
if
(
TextUtils
.
isDigitsOnly
(
word
)
&&
word
.
length
()
>=
5
)
{
//搜索卡密
// 判断是否为纯数字且长度大于等于5,若是则作为卡密搜索
if
(
TextUtils
.
isDigitsOnly
(
word
)
&&
word
.
length
()
>=
3
)
{
// 添加卡密过滤器
filterList
.
add
(
new
CodeFilter
(
Long
.
parseLong
(
word
)));
filterList
.
add
(
new
CodeFilter
(
Long
.
parseLong
(
word
)));
}
else
{
}
else
{
// 按空格分割关键词
String
[]
ws
=
word
.
split
(
" "
);
String
[]
ws
=
word
.
split
(
" "
);
// 如果设置中的关键词分割符是"%%",则重新分割
if
(
AppsSettings
.
get
().
getKeyWordsSplit
()
==
AppsSettings
.
keyWordsSplitEnum
.
Percent
.
code
)
{
if
(
AppsSettings
.
get
().
getKeyWordsSplit
()
==
AppsSettings
.
keyWordsSplitEnum
.
Percent
.
code
)
{
ws
=
word
.
split
(
"%%"
);
ws
=
word
.
split
(
"%%"
);
}
}
// 遍历每个分割后的关键词
for
(
String
w
:
ws
)
{
for
(
String
w
:
ws
)
{
// 跳过空字符串
if
(
TextUtils
.
isEmpty
(
w
))
{
if
(
TextUtils
.
isEmpty
(
w
))
{
continue
;
continue
;
}
}
// 初始化排除标记为false
boolean
exclude
=
false
;
boolean
exclude
=
false
;
if
(
w
.
startsWith
(
"-"
))
{
// 如果关键词以"-"开头,则表示排除模式
if
(
w
.
startsWith
(
"-"
)
&&
w
.
length
()
>
1
)
{
exclude
=
true
;
exclude
=
true
;
// 去掉"-"前缀
w
=
w
.
substring
(
1
);
w
=
w
.
substring
(
1
);
}
}
// 初始化仅文本标记为false(当前被注释掉的功能)
boolean
onlyText
=
false
;
boolean
onlyText
=
false
;
/*
/*
if (w.startsWith("\"") || w.startsWith("“") || w.startsWith("”")) {
// 如果关键词以引号开头,则只搜索文本内容
//只搜索文字
if (w.startsWith("\"") || w.startsWith("“") || w.startsWith("”")) {
onlyText = true;
// 设置仅文本标志
if (w.endsWith("\"") || w.endsWith("“") || w.endsWith("”")) {
onlyText = true;
w = w.substring(1, w.length() - 1);
// 如果也以引号结尾,则去掉首尾引号
} else {
if (w.endsWith("\"") || w.endsWith("“") || w.endsWith("”")) {
w = w.substring(1);
w = w.substring(1, w.length() - 1);
}
} else {
}*/
// 否则只去掉开始的引号
w = w.substring(1);
}
}*/
// 记录当前过滤器参数的日志
Log
.
d
(
TAG
,
"filter:word="
+
w
+
", exclude="
+
exclude
+
", onlyText="
+
onlyText
);
Log
.
d
(
TAG
,
"filter:word="
+
w
+
", exclude="
+
exclude
+
", onlyText="
+
onlyText
);
// 添加名称过滤器
filterList
.
add
(
new
NameFilter
(
w
,
exclude
,
onlyText
));
filterList
.
add
(
new
NameFilter
(
w
,
exclude
,
onlyText
));
}
}
}
}
}
}
empty
=
filterList
.
size
()
==
0
;
// 判断是否有有效的过滤器
empty
=
filterList
.
isEmpty
();
}
}
public
String
getValue
()
{
public
String
getValue
()
{
return
word
;
return
word
;
}
}
...
@@ -85,7 +110,7 @@ public class CardKeyWord {
...
@@ -85,7 +110,7 @@ public class CardKeyWord {
this
.
setcode
=
onlyText
?
0
:
DataManager
.
get
().
getStringManager
().
getSetCode
(
word
,
true
);
this
.
setcode
=
onlyText
?
0
:
DataManager
.
get
().
getStringManager
().
getSetCode
(
word
,
true
);
this
.
exclude
=
exclude
;
this
.
exclude
=
exclude
;
this
.
word
=
word
.
toLowerCase
(
Locale
.
US
);
this
.
word
=
word
.
toLowerCase
(
Locale
.
US
);
if
(
this
.
setcode
>
0
)
{
if
(
this
.
setcode
>
0
)
{
Log
.
d
(
TAG
,
"filter:setcode="
+
setcode
+
", exclude="
+
exclude
+
", word="
+
word
);
Log
.
d
(
TAG
,
"filter:setcode="
+
setcode
+
", exclude="
+
exclude
+
", word="
+
word
);
}
}
}
}
...
...
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