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
ac5b34e8
Commit
ac5b34e8
authored
Jan 18, 2025
by
Dark Zane
Committed by
GitHub
Jan 18, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fallenstardust:master' into master
parents
e1c0cba2
123aaf1e
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
152 additions
and
41 deletions
+152
-41
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
.../java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/loader/CardLoader.java
.../src/main/java/cn/garymb/ygomobile/loader/CardLoader.java
+3
-3
mobile/src/main/java/cn/garymb/ygomobile/loader/CardSearchInfo.java
.../main/java/cn/garymb/ygomobile/loader/CardSearchInfo.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
...rc/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
+104
-5
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchFragment.java
...java/cn/garymb/ygomobile/ui/cards/CardSearchFragment.java
+11
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
.../main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
+10
-14
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
...ava/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
+11
-6
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/utils/ServerUtil.java
...e/src/main/java/cn/garymb/ygomobile/utils/ServerUtil.java
+2
-1
mobile/src/main/java/ocgcore/CardManager.java
mobile/src/main/java/ocgcore/CardManager.java
+3
-2
mobile/src/main/java/ocgcore/PackManager.java
mobile/src/main/java/ocgcore/PackManager.java
+2
-2
mobile/src/main/java/ocgcore/StringManager.java
mobile/src/main/java/ocgcore/StringManager.java
+1
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
ac5b34e8
...
...
@@ -252,7 +252,7 @@ public class AppsSettings {
return
false
;
}
String
s_name
=
file
.
getName
().
toLowerCase
();
return
s_name
.
endsWith
(
".zip"
)
||
s_name
.
endsWith
(
".ypk"
);
return
s_name
.
endsWith
(
".zip"
)
||
s_name
.
endsWith
(
Constants
.
YPK_FILE_EX
);
});
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
ac5b34e8
...
...
@@ -172,7 +172,7 @@ public class GameUriManager {
if
(
name
.
toLowerCase
(
Locale
.
US
).
endsWith
(
YDK_FILE_EX
))
{
File
dir
=
Constants
.
COPY_YDK_FILE
?
new
File
(
AppsSettings
.
get
().
getDeckDir
())
:
new
File
(
getActivity
().
getApplicationInfo
().
dataDir
,
"cache"
);
local
=
getDeckFile
(
dir
,
getPathName
(
path
,
true
));
}
else
if
(
name
.
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
}
else
if
(
name
.
toLowerCase
(
Locale
.
US
).
endsWith
(
YPK_FILE_EX
))
{
String
[]
words
=
name
.
trim
().
split
(
"[()() ]+"
);
File
[]
ypkList
=
AppsSettings
.
get
().
getExpansionFiles
();
for
(
int
i
=
0
;
i
<
ypkList
.
length
;
i
++)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
View file @
ac5b34e8
...
...
@@ -133,7 +133,7 @@ public class ExCardListFragment extends Fragment {
textDownload
.
setText
(
"0%"
);
//点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本
String
path
=
AppsSettings
.
get
().
getExpansionsPath
().
getAbsolutePath
();
String
fileName
=
Constants
.
officialExCardPackageName
;
File
file
=
new
File
(
path
+
"/"
+
fileName
+
".ypk"
);
File
file
=
new
File
(
path
+
"/"
+
fileName
+
Constants
.
YPK_FILE_EX
);
/* 删除旧的先行卡包 */
File
[]
files
=
AppsSettings
.
get
().
getExpansionsPath
().
listFiles
();
if
(
files
!=
null
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/CardLoader.java
View file @
ac5b34e8
...
...
@@ -131,7 +131,7 @@ public class CardLoader implements ICardSearcher {
if
(
mCallBack
!=
null
)
{
mCallBack
.
onSearchStart
();
}
Dialog
wait
=
DialogPlus
.
show
(
context
,
null
,
context
.
getString
(
R
.
string
.
searching
));
//
Dialog wait = DialogPlus.show(context, null, context.getString(R.string.searching));
VUiKit
.
defer
().
when
(()
->
{
SparseArray
<
Card
>
cards
=
mCardManager
.
getAllCards
();
List
<
Card
>
list
=
new
ArrayList
<>();
...
...
@@ -159,12 +159,12 @@ public class CardLoader implements ICardSearcher {
mCallBack
.
onSearchResult
(
noting
,
false
);
}
LogUtil
.
e
(
"kk"
,
"search"
,
e
);
wait
.
dismiss
();
//
wait.dismiss();
}).
done
((
tmp
)
->
{
if
(
mCallBack
!=
null
)
{
mCallBack
.
onSearchResult
(
tmp
,
false
);
}
wait
.
dismiss
();
//
wait.dismiss();
});
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/CardSearchInfo.java
View file @
ac5b34e8
...
...
@@ -23,7 +23,7 @@ public class CardSearchInfo implements ICardFilter{
private
int
limitType
;
private
String
limitName
;
p
rivate
CardSearchInfo
()
{
p
ublic
CardSearchInfo
()
{
}
public
int
getLimitType
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetail.java
View file @
ac5b34e8
package
cn.garymb.ygomobile.ui.cards
;
import
static
android
.
text
.
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
;
import
static
cn
.
garymb
.
ygomobile
.
core
.
IrrlichtBridge
.
ACTION_SHARE_FILE
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.graphics.Color
;
import
android.text.SpannableString
;
import
android.text.style.ForegroundColorSpan
;
import
android.text.TextUtils
;
import
android.text.style.ClickableSpan
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -26,11 +31,16 @@ import com.bm.library.PhotoView;
import
com.feihua.dialogutils.util.DialogUtils
;
import
java.io.File
;
import
java.util.Stack
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.CardKeyWord
;
import
cn.garymb.ygomobile.loader.CardSearchInfo
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.adapters.BaseAdapterPlus
;
...
...
@@ -100,7 +110,6 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
private
Button
btn_redownload
;
private
Button
btn_share
;
private
boolean
isDownloadCardImage
=
true
;
private
Shimmer
shimmer
;
@SuppressLint
(
"HandlerLeak"
)
Handler
handler
=
new
Handler
()
{
...
...
@@ -132,6 +141,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
};
private
Shimmer
shimmer
;
private
boolean
mShowAdd
=
false
;
private
OnFavoriteChangedListener
mOnFavoriteChangedListener
;
...
...
@@ -292,6 +302,84 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
return
mCardInfo
;
}
public
void
setHighlightTextWithClickableSpans
(
String
text
)
{
SpannableString
spannableString
=
new
SpannableString
(
text
);
// 解析器状态
QuoteType
currentQuoteType
=
QuoteType
.
NONE
;
Stack
<
Integer
>
stack
=
new
Stack
<>();
int
start
=
-
1
;
for
(
int
i
=
0
;
i
<
text
.
length
();
i
++)
{
char
c
=
text
.
charAt
(
i
);
switch
(
currentQuoteType
)
{
case
NONE:
if
(
c
==
'「'
)
{
currentQuoteType
=
QuoteType
.
ANGLE_QUOTE
;
start
=
i
+
1
;
stack
.
push
(
i
);
}
else
if
(
c
==
'"'
)
{
currentQuoteType
=
QuoteType
.
DOUBLE_QUOTE
;
start
=
i
+
1
;
stack
.
push
(
i
);
}
break
;
case
ANGLE_QUOTE:
if
(
c
==
'「'
)
{
stack
.
push
(
i
);
}
else
if
(
c
==
'」'
&&
!
stack
.
isEmpty
())
{
stack
.
pop
();
if
(
stack
.
isEmpty
())
{
applySpan
(
spannableString
,
start
,
i
,
YGOUtil
.
c
(
R
.
color
.
holo_blue_bright
));
currentQuoteType
=
QuoteType
.
NONE
;
}
}
break
;
case
DOUBLE_QUOTE:
if
(
c
==
'"'
&&
!
stack
.
isEmpty
())
{
stack
.
pop
();
if
(
stack
.
isEmpty
())
{
applySpan
(
spannableString
,
start
,
i
,
YGOUtil
.
c
(
R
.
color
.
holo_blue_bright
));
currentQuoteType
=
QuoteType
.
NONE
;
}
else
{
stack
.
push
(
i
);
// 对于嵌套的情况,只增加/减少栈中的元素而不应用样式
}
}
break
;
}
}
// 处理未关闭的引号对
if
(!
stack
.
isEmpty
())
{
// Handle unclosed quotes error, e.g., log a warning or throw an exception
}
desc
.
setText
(
spannableString
);
desc
.
setMovementMethod
(
android
.
text
.
method
.
LinkMovementMethod
.
getInstance
());
}
private
void
applySpan
(
SpannableString
spannableString
,
int
start
,
int
end
,
int
color
)
{
// 设置颜色
spannableString
.
setSpan
(
new
ForegroundColorSpan
(
color
),
start
,
end
,
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
// 设置点击监听
spannableString
.
setSpan
(
new
ClickableSpan
()
{
@Override
public
void
onClick
(
View
widget
)
{
// 获取被点击的文本内容
String
clickedText
=
((
TextView
)
widget
).
getText
().
subSequence
(
start
,
end
).
toString
();
mListener
.
onSearchKeyWord
(
clickedText
);
}
@Override
public
void
updateDrawState
(
android
.
text
.
TextPaint
ds
)
{
// 可以在这里自定义点击状态下的样式,如去掉下划线
ds
.
setUnderlineText
(
true
);
}
},
start
,
end
,
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
}
private
void
setCardInfo
(
Card
cardInfo
,
View
view
)
{
if
(
cardInfo
==
null
)
return
;
mCardInfo
=
cardInfo
;
...
...
@@ -300,7 +388,7 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
cardImage
.
setOnClickListener
((
v
)
->
{
showCardImageDetail
(
cardInfo
.
Code
);});
packName
.
setText
(
packManager
.
findPackNameById
(
cardInfo
.
Alias
!=
0
?
cardInfo
.
Alias
:
cardInfo
.
Code
));
name
.
setText
(
cardInfo
.
Name
);
desc
.
setText
(
cardInfo
.
Name
.
equals
(
"Unknown"
)
?
context
.
getString
(
R
.
string
.
tip_card_info_diff
)
:
cardInfo
.
Desc
);
setHighlightTextWithClickableSpans
(
cardInfo
.
Name
.
equals
(
"Unknown"
)
?
context
.
getString
(
R
.
string
.
tip_card_info_diff
)
:
cardInfo
.
Desc
);
cardCode
.
setText
(
String
.
format
(
"%08d"
,
cardInfo
.
getCode
()));
if
(
cardInfo
.
isType
(
CardType
.
Token
))
{
faq
.
setVisibility
(
View
.
INVISIBLE
);
...
...
@@ -573,16 +661,20 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
public
interface
OnFavoriteChangedListener
{
void
onFavoriteChange
(
Card
card
,
boolean
favorite
);
}
public
interface
OnShowPackListListener
{
void
onShowPackList
(
Card
card
);
}
public
interface
OnDeckManagerCardClickListener
{
void
onOpenUrl
(
Card
cardInfo
);
void
onAddMainCard
(
Card
cardInfo
);
void
onAddSideCard
(
Card
cardInfo
);
void
onImageUpdate
(
Card
cardInfo
);
void
onShowPackList
(
Card
cardInfo
);
void
onSearchKeyWord
(
String
keyword
);
void
onClose
();
}
...
...
@@ -609,6 +701,11 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
@Override
public
void
onSearchKeyWord
(
String
keyword
)
{
}
@Override
public
void
onAddSideCard
(
Card
cardInfo
)
{
...
...
@@ -620,4 +717,6 @@ public class CardDetail extends BaseAdapterPlus.BaseViewHolder {
}
}
// 定义引号类型
enum
QuoteType
{
NONE
,
DOUBLE_QUOTE
,
ANGLE_QUOTE
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchFragment.java
View file @
ac5b34e8
...
...
@@ -36,6 +36,7 @@ import cn.garymb.ygomobile.base.BaseFragemnt;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.CardLoader
;
import
cn.garymb.ygomobile.loader.CardSearchInfo
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.WebActivity
;
import
cn.garymb.ygomobile.ui.adapters.CardListAdapter
;
...
...
@@ -43,8 +44,6 @@ import cn.garymb.ygomobile.ui.home.HomeActivity;
import
cn.garymb.ygomobile.ui.plus.AOnGestureListener
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.ui.widget.Shimmer
;
import
cn.garymb.ygomobile.ui.widget.ShimmerTextView
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.garymb.ygomobile.utils.glide.GlideCompat
;
import
ocgcore.DataManager
;
...
...
@@ -304,6 +303,11 @@ public class CardSearchFragment extends BaseFragemnt implements CardLoader.CallB
showPackList
(
cardInfo
);
}
@Override
public
void
onSearchKeyWord
(
String
keyword
)
{
showSearchKeyWord
(
keyword
);
}
@Override
public
void
onImageUpdate
(
Card
cardInfo
)
{
mCardListAdapter
.
notifyItemChanged
(
cardInfo
);
...
...
@@ -341,6 +345,11 @@ public class CardSearchFragment extends BaseFragemnt implements CardLoader.CallB
}
}
private
void
showSearchKeyWord
(
String
keyword
)
{
CardSearchInfo
searchInfo
=
new
CardSearchInfo
.
Builder
().
keyword
(
keyword
).
types
(
new
long
[]{}).
build
();
//构建CardSearchInfo时type不能为null
mCardLoader
.
search
(
searchInfo
);
}
private
void
showPackList
(
Card
cardInfo
)
{
Integer
idToUse
=
cardInfo
.
Alias
!=
0
?
cardInfo
.
Alias
:
cardInfo
.
Code
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearcher.java
View file @
ac5b34e8
...
...
@@ -23,7 +23,6 @@ import java.util.List;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.CardLoader
;
import
cn.garymb.ygomobile.loader.CardSearchInfo
;
import
cn.garymb.ygomobile.loader.ICardSearcher
;
import
cn.garymb.ygomobile.ui.adapters.SimpleSpinnerAdapter
;
...
...
@@ -32,7 +31,6 @@ import cn.garymb.ygomobile.ui.plus.DialogPlus;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
ocgcore.DataManager
;
import
ocgcore.LimitManager
;
import
ocgcore.PackManager
;
import
ocgcore.StringManager
;
import
ocgcore.data.Card
;
import
ocgcore.data.CardSet
;
...
...
@@ -70,10 +68,9 @@ public class CardSearcher implements View.OnClickListener {
private
final
Button
resetButton
;
private
final
View
view
;
private
final
View
layout_monster
;
private
final
ICardSearcher
dataLoad
er
;
private
final
ICardSearcher
mICardSearch
er
;
private
final
Context
mContext
;
private
final
Button
myFavButton
;
private
final
ICardSearcher
mCardLoader
;
protected
StringManager
mStringManager
;
protected
LimitManager
mLimitManager
;
protected
AppsSettings
mSettings
;
...
...
@@ -81,10 +78,10 @@ public class CardSearcher implements View.OnClickListener {
private
CallBack
mCallBack
;
private
boolean
mShowFavorite
;
public
CardSearcher
(
View
view
,
ICardSearcher
dataLoad
er
)
{
public
CardSearcher
(
View
view
,
ICardSearcher
iCardSearch
er
)
{
this
.
view
=
view
;
this
.
mContext
=
view
.
getContext
();
this
.
dataLoader
=
dataLoad
er
;
this
.
mICardSearcher
=
iCardSearch
er
;
this
.
mSettings
=
AppsSettings
.
get
();
mStringManager
=
DataManager
.
get
().
getStringManager
();
mLimitManager
=
DataManager
.
get
().
getLimitManager
();
...
...
@@ -115,7 +112,6 @@ public class CardSearcher implements View.OnClickListener {
LinkMarkerButton
.
setOnClickListener
(
this
);
searchButton
.
setOnClickListener
(
this
);
resetButton
.
setOnClickListener
(
this
);
mCardLoader
=
dataLoader
;
//输入即时搜索
OnEditorActionListener
searchListener
=
(
v
,
actionId
,
event
)
->
{
...
...
@@ -289,7 +285,7 @@ public class CardSearcher implements View.OnClickListener {
}
if
(
mCallBack
!=
null
)
{
VUiKit
.
post
(()
->
{
mCallBack
.
onSearchResult
(
CardFavorites
.
get
().
getCards
(
m
CardLoad
er
),
!
showList
);
mCallBack
.
onSearchResult
(
CardFavorites
.
get
().
getCards
(
m
ICardSearch
er
),
!
showList
);
});
}
}
...
...
@@ -390,8 +386,8 @@ public class CardSearcher implements View.OnClickListener {
int
index
=
-
1
;
int
count
=
mLimitManager
.
getCount
();
LimitList
cur
=
null
;
if
(
dataLoad
er
!=
null
)
{
cur
=
dataLoad
er
.
getLimitList
();
if
(
mICardSearch
er
!=
null
)
{
cur
=
mICardSearch
er
.
getLimitList
();
}
items
.
add
(
new
SimpleSpinnerItem
(
0
,
getString
(
R
.
string
.
label_limitlist
)));
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
...
...
@@ -566,7 +562,7 @@ public class CardSearcher implements View.OnClickListener {
}
private
void
search
()
{
if
(
dataLoad
er
!=
null
)
{
if
(
mICardSearch
er
!=
null
)
{
CardSearchInfo
searchInfo
=
new
CardSearchInfo
.
Builder
()
.
keyword
(
text
(
keyWord
))
.
attribute
(
getIntSelect
(
attributeSpinner
))
...
...
@@ -590,14 +586,14 @@ public class CardSearcher implements View.OnClickListener {
.
linkKey
(
lineKey
)
.
build
();
Log
.
i
(
TAG
,
searchInfo
.
toString
());
dataLoad
er
.
search
(
searchInfo
);
mICardSearch
er
.
search
(
searchInfo
);
lineKey
=
0
;
}
}
private
void
resetAll
()
{
if
(
dataLoad
er
!=
null
)
{
dataLoad
er
.
onReset
();
if
(
mICardSearch
er
!=
null
)
{
mICardSearch
er
.
onReset
();
}
keyWord
.
setText
(
null
);
reset
(
otSpinner
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerFragment.java
View file @
ac5b34e8
...
...
@@ -78,6 +78,7 @@ import cn.garymb.ygomobile.bean.events.DeckFile;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.CardLoader
;
import
cn.garymb.ygomobile.loader.CardSearchInfo
;
import
cn.garymb.ygomobile.loader.ICardSearcher
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.WebActivity
;
...
...
@@ -562,6 +563,11 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
showPackList
(
cardInfo
);
}
@Override
public
void
onSearchKeyWord
(
String
keyword
)
{
showSearchKeyWord
(
keyword
);
//根据关键词搜索
}
@Override
public
void
onClose
()
{
mDialog
.
dismiss
();
...
...
@@ -610,19 +616,18 @@ public class DeckManagerFragment extends BaseFragemnt implements RecyclerViewIte
}
}
private
void
showSearchKeyWord
(
String
keyword
)
{
CardSearchInfo
searchInfo
=
new
CardSearchInfo
.
Builder
().
keyword
(
keyword
).
types
(
new
long
[]{}).
build
();
//构建CardSearchInfo时type不能为null
mCardLoader
.
search
(
searchInfo
);
}
private
void
showPackList
(
Card
cardInfo
)
{
Integer
idToUse
=
cardInfo
.
Alias
!=
0
?
cardInfo
.
Alias
:
cardInfo
.
Code
;
Log
.
d
(
"seesee"
,
"Looking for pack with ID/Alias: "
+
idToUse
);
// 确保再次检查 PackManager 是否已经加载完成
if
(
mPackManager
==
null
)
{
Log
.
w
(
"seesee"
,
"PackManager not loaded when showing pack list."
);
return
;
}
List
<
Card
>
packList
=
mPackManager
.
getCards
(
mCardLoader
,
idToUse
);
Log
.
d
(
"seesee"
,
"Retrieved pack list: "
+
(
packList
==
null
?
"null"
:
packList
.
toString
()));
if
(
packList
!=
null
)
{
onSearchResult
(
packList
,
false
);
}
else
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
ac5b34e8
...
...
@@ -117,7 +117,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On
});
dialog
.
setOnDismissListener
(
dialogInterface
->
{
DialogPlus
dialogplus
=
new
DialogPlus
(
this
);
File
oldypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
officialExCardPackageName
+
".ypk"
);
File
oldypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
officialExCardPackageName
+
Constants
.
YPK_FILE_EX
);
if
(
oldypk
.
exists
())
{
FileUtils
.
deleteFile
(
oldypk
);
dialogplus
.
setMessage
(
R
.
string
.
tip_ypk_is_deleted
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/ServerUtil.java
View file @
ac5b34e8
...
...
@@ -4,6 +4,7 @@ import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_CN_DATAVER
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_PRE_CARD
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_SUPERPRE_CN_FILE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
YDK_FILE_EX
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
StringUtils
.
isHost
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
StringUtils
.
isNumeric
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
WebParseUtil
.
isValidIP
;
...
...
@@ -108,7 +109,7 @@ public class ServerUtil {
* @param file
*/
public
static
void
loadServerInfoFromZipOrYpk
(
Context
context
,
File
file
)
{
if
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
".ypk"
))
{
if
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
YDK_FILE_EX
))
{
LogUtil
.
e
(
"GameUriManager"
,
"读取压缩包"
);
try
{
String
serverName
=
null
,
serverDesc
=
null
,
serverHost
=
null
,
serverPort
=
null
;
...
...
mobile/src/main/java/ocgcore/CardManager.java
View file @
ac5b34e8
...
...
@@ -26,6 +26,7 @@ import java.util.zip.ZipInputStream;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
ocgcore.data.Card
;
...
...
@@ -151,7 +152,7 @@ public class CardManager {
@Override
public
boolean
accept
(
File
dir
,
String
name
)
{
File
file
=
new
File
(
dir
,
name
);
return
file
.
isFile
()
&&
((
name
.
endsWith
(
".cdb"
)
||
(
name
.
endsWith
(
".zip"
)
||
name
.
endsWith
(
".ypk"
))));
return
file
.
isFile
()
&&
((
name
.
endsWith
(
".cdb"
)
||
(
name
.
endsWith
(
".zip"
)
||
name
.
endsWith
(
Constants
.
YPK_FILE_EX
))));
}
});
//读取全部卡片
...
...
@@ -159,7 +160,7 @@ public class CardManager {
for
(
File
file
:
files
)
{
if
(
file
.
getName
().
endsWith
(
".cdb"
))
{
count
=
readAllCards
(
file
,
cardDataHashMap
);
}
else
if
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
".ypk"
))
{
}
else
if
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
Constants
.
YPK_FILE_EX
))
{
Log
.
e
(
"CardManager"
,
"读取压缩包"
);
try
{
for
(
File
file1
:
readZipCdb
(
file
.
getAbsolutePath
()))
{
...
...
mobile/src/main/java/ocgcore/PackManager.java
View file @
ac5b34e8
...
...
@@ -72,8 +72,8 @@ public class PackManager implements Closeable {
}
return
packList
;
}).
done
((
list
)
->
{
Log
.
i
(
TAG
,
"Loaded "
+
list
.
size
()
+
" files."
);
Log
.
i
(
TAG
,
toString
());
// 在异步任务完成后打印packList
Log
.
i
(
TAG
,
"
pack:
Loaded "
+
list
.
size
()
+
" files."
);
//
Log.i(TAG, toString()); // 在异步任务完成后打印packList
}).
fail
((
error
)
->
{
Log
.
e
(
TAG
,
"Error loading files: "
+
error
.
getMessage
());
});
...
...
mobile/src/main/java/ocgcore/StringManager.java
View file @
ac5b34e8
...
...
@@ -61,7 +61,7 @@ public class StringManager implements Closeable {
File
[]
files
=
AppsSettings
.
get
().
getExpansionsPath
().
listFiles
();
if
(
files
!=
null
)
{
for
(
File
file
:
files
)
{
if
(
file
.
isFile
()
&&
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
".ypk"
)))
{
if
(
file
.
isFile
()
&&
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
Constants
.
YPK_FILE_EX
)))
{
Log
.
e
(
"StringManager"
,
"读取压缩包"
);
try
{
ZipFile
zipFile
=
new
ZipFile
(
file
.
getAbsoluteFile
(),
"GBK"
);
...
...
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