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
817d2f2e
Commit
817d2f2e
authored
Sep 20, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化子线程与主线程通信
parent
fc270e13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
26 deletions
+27
-26
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
...n/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
+26
-25
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
View file @
817d2f2e
...
@@ -50,7 +50,7 @@ import ocgcore.DataManager;
...
@@ -50,7 +50,7 @@ import ocgcore.DataManager;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
public
class
WebActivity
extends
BaseActivity
{
public
class
WebActivity
extends
BaseActivity
{
public
static
String
dataVer
=
""
;
public
static
String
dataVer
;
private
WebViewPlus
mWebViewPlus
;
private
WebViewPlus
mWebViewPlus
;
private
String
mUrl
;
private
String
mUrl
;
private
String
mTitle
;
private
String
mTitle
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
View file @
817d2f2e
...
@@ -94,6 +94,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -94,6 +94,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
private
static
final
int
TYPE_BANNER_QUERY_OK
=
0
;
private
static
final
int
TYPE_BANNER_QUERY_OK
=
0
;
private
static
final
int
TYPE_BANNER_QUERY_EXCEPTION
=
1
;
private
static
final
int
TYPE_BANNER_QUERY_EXCEPTION
=
1
;
private
static
final
int
TYPE_RES_LOADING_OK
=
2
;
private
static
final
int
TYPE_RES_LOADING_OK
=
2
;
private
static
final
int
TYPE_GET_DATA_VER_OK
=
3
;
private
static
final
String
ARG_MC_NEWS_LIST
=
"mcNewsList"
;
private
static
final
String
ARG_MC_NEWS_LIST
=
"mcNewsList"
;
private
boolean
isMcNewsLoadException
=
false
;
private
boolean
isMcNewsLoadException
=
false
;
...
@@ -209,7 +210,6 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -209,7 +210,6 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
//轮播图
//轮播图
public
void
initBanner
(
View
view
,
Bundle
saveBundle
)
{
public
void
initBanner
(
View
view
,
Bundle
saveBundle
)
{
Log
.
i
(
"3.10.0看看saveBundle"
,
saveBundle
+
""
);
xb_banner
=
view
.
findViewById
(
R
.
id
.
xb_banner
);
xb_banner
=
view
.
findViewById
(
R
.
id
.
xb_banner
);
cv_banner
=
view
.
findViewById
(
R
.
id
.
cv_banner
);
cv_banner
=
view
.
findViewById
(
R
.
id
.
cv_banner
);
cv_banner
.
post
(()
->
{
cv_banner
.
post
(()
->
{
...
@@ -269,6 +269,15 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -269,6 +269,15 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
tv_banner_loading
.
setText
(
R
.
string
.
loading_failed
);
tv_banner_loading
.
setText
(
R
.
string
.
loading_failed
);
isMcNewsLoadException
=
true
;
isMcNewsLoadException
=
true
;
break
;
break
;
case
TYPE_GET_DATA_VER_OK:
WebActivity
.
dataVer
=
msg
.
obj
.
toString
();
String
oldVer
=
SharedPreferenceUtil
.
getExpansionDataVer
();
if
(!
TextUtils
.
isEmpty
(
WebActivity
.
dataVer
)
&&
!
WebActivity
.
dataVer
.
equals
(
oldVer
))
{
ll_new_notice
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
showExNew
();
ll_new_notice
.
setVisibility
(
View
.
GONE
);
}
}
}
}
}
...
@@ -276,31 +285,23 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -276,31 +285,23 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
private
void
showExNew
()
{
private
void
showExNew
()
{
if
(
AppsSettings
.
get
().
isReadExpansions
())
{
if
(
AppsSettings
.
get
().
isReadExpansions
())
{
String
oldVer
=
SharedPreferenceUtil
.
getExpansionDataVer
();
OkhttpUtil
.
get
(
URL_YGO233_DATAVER
,
new
Callback
()
{
findExPansionsDataVer
();
@Override
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
WebActivity
.
dataVer
);
public
void
onFailure
(
Call
call
,
IOException
e
)
{
if
(!
TextUtils
.
isEmpty
(
WebActivity
.
dataVer
)
&&
!
WebActivity
.
dataVer
.
equals
(
oldVer
))
{
showExNew
();
findExPansionsDataVer
();
}
ll_new_notice
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
ll_new_notice
.
setVisibility
(
View
.
GONE
);
}
}
}
private
static
void
findExPansionsDataVer
()
{
OkhttpUtil
.
get
(
URL_YGO233_DATAVER
,
new
Callback
()
{
@Override
public
void
onFailure
(
Call
call
,
IOException
e
)
{
findExPansionsDataVer
();
}
@Override
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
WebActivity
.
dataVer
=
response
.
body
().
string
();
}
});
@Override
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
String
json
=
response
.
body
().
string
();
Message
message
=
new
Message
();
message
.
what
=
TYPE_GET_DATA_VER_OK
;
message
.
obj
=
json
;
handler
.
sendMessage
(
message
);
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
WebActivity
.
dataVer
+
"dataver内"
);
}
});
}
}
}
private
void
findMcNews
()
{
private
void
findMcNews
()
{
...
...
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