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
2631359a
Commit
2631359a
authored
Sep 19, 2023
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encode by UTF-8
parent
1520c6c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
.../java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
+16
-16
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
View file @
2631359a
...
...
@@ -70,7 +70,7 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
private
int
FailedCount
;
/**
*
用于标志当前下载状态,用于防止用户多次重复点击“下载按钮”
*
用于标志当前下载状态,用于防止用户多次重复点击“下载按钮”
* Mark the download state, which can prevent user from clicking the download button
* repeatedly.
*/
...
...
@@ -91,7 +91,7 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
this
.
context
=
getContext
();
initView
(
layoutView
);
if
(!
EventBus
.
getDefault
().
isRegistered
(
this
))
{
//
加上判断
if
(!
EventBus
.
getDefault
().
isRegistered
(
this
))
{
//
加上判断
EventBus
.
getDefault
().
register
(
this
);
}
return
layoutView
;
...
...
@@ -101,7 +101,7 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
public
void
onStop
()
{
super
.
onStop
();
LogUtil
.
i
(
TAG
,
"excard fragment on stop"
);
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
//
加上判断
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
//
加上判断
EventBus
.
getDefault
().
unregister
(
this
);
}
...
...
@@ -134,11 +134,11 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
}
/**
*
根据先行卡包状态改变按钮样式
*
根据先行卡包状态改变按钮样式
*/
public
void
changeDownloadText
()
{
if
(
ServerUtil
.
exCardState
==
ServerUtil
.
ExCardState
.
UPDATED
)
{
//btn_download
展示默认视图
//btn_download
展示默认视图
textDownload
.
setText
(
R
.
string
.
tip_redownload
);
}
else
if
(
ServerUtil
.
exCardState
==
ServerUtil
.
ExCardState
.
NEED_UPDATE
)
{
textDownload
.
setText
(
R
.
string
.
Download
);
...
...
@@ -172,21 +172,21 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
break
;
case
UnzipUtils
.
ZIP_UNZIP_OK
:
/*
将先行服务器信息添加到服务器列表中
*/
/*
将先行服务器信息添加到服务器列表中 */
String
servername
=
""
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
0
)
servername
=
"23333
先行服务器
"
;
servername
=
"23333
先行服务器"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
1
)
servername
=
"YGOPRO ?? ?? ????"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
2
)
servername
=
"Mercury23333 OCG/TCG Pre-release"
;
AddServer
(
getActivity
(),
servername
,
"s1.ygo233.com"
,
23333
,
"Knight of Hanoi"
);
//changeDownloadButton();
在下载完成后,通过EventBus通知下载完成(加入用户点击下载后临时切出本fragment,又在下载完成后切回,通过eventbus能保证按钮样式正确更新
//changeDownloadButton();
在下载完成后,通过EventBus通知下载完成(加入用户点击下载后临时切出本fragment,又在下载完成后切回,通过eventbus能保证按钮样式正确更新
/*
注意,要先更新版本号
*/
/*
注意,要先更新版本号 */
SharedPreferenceUtil
.
setExpansionDataVer
(
ServerUtil
.
serverExCardVersion
);
ServerUtil
.
exCardState
=
ServerUtil
.
ExCardState
.
UPDATED
;
EventBus
.
getDefault
().
postSticky
(
new
ExCardEvent
(
ExCardEvent
.
EventType
.
exCardPackageChange
));
//
安装后,通知UI做更新
EventBus
.
getDefault
().
postSticky
(
new
ExCardEvent
(
ExCardEvent
.
EventType
.
exCardPackageChange
));
//
安装后,通知UI做更新
DataManager
.
get
().
load
(
true
);
...
...
@@ -194,8 +194,8 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
LogUtil
.
i
(
"webCrawler"
,
"Ex-card package is installed"
);
/*
如果未开启先行卡设置,则跳转到设置页面
*/
if
(!
AppsSettings
.
get
().
isReadExpansions
())
{
//
解压完毕,但此时
/*
如果未开启先行卡设置,则跳转到设置页面 */
if
(!
AppsSettings
.
get
().
isReadExpansions
())
{
//
解压完毕,但此时
LogUtil
.
i
(
"webCrawler"
,
"Ex-card setting is not opened"
);
Intent
startSetting
=
new
Intent
(
context
,
MainActivity
.
class
);
startSetting
.
putExtra
(
"flag"
,
4
);
...
...
@@ -213,7 +213,7 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
// String oldVer = SharedPreferenceUtil.getExpansionDataVer();
// if (!TextUtils.isEmpty(WebActivity.exCardVer)) {
// if (!WebActivity.exCardVer.equals(oldVer)) {
// //btn_download
展示默认视图
// //btn_download
展示默认视图
// } else {
// btnDownload.setText(R.string.tip_redownload);
// }
...
...
@@ -234,7 +234,7 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
}
}
private
void
downloadfromWeb
(
String
fileUrl
)
{
textDownload
.
setText
(
"0%"
);
//
点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本
textDownload
.
setText
(
"0%"
);
//
点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"-preRlease.zip"
);
if
(
file
.
exists
())
{
FileUtils
.
deleteFile
(
file
);
...
...
@@ -256,7 +256,7 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
}
catch
(
Exception
e
)
{
message
.
what
=
UnzipUtils
.
ZIP_UNZIP_EXCEPTION
;
}
finally
{
message
.
what
=
UnzipUtils
.
ZIP_UNZIP_OK
;
//TODO
不对吧,finally是一定执行,这样即使有exception也会发unzip_ok啊
message
.
what
=
UnzipUtils
.
ZIP_UNZIP_OK
;
//TODO
不对吧,finally是一定执行,这样即使有exception也会发unzip_ok啊
}
handler
.
sendMessage
(
message
);
}
...
...
@@ -272,7 +272,7 @@ public class ExCardListFragment extends Fragment implements View.OnClickListener
@Override
public
void
onDownloadFailed
(
Exception
e
)
{
//
下载失败后删除下载的文件
//
下载失败后删除下载的文件
FileUtils
.
deleteFile
(
file
);
Message
message
=
new
Message
();
message
.
what
=
TYPE_DOWNLOAD_EXCEPTION
;
...
...
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