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
c13e619e
Commit
c13e619e
authored
Jun 03, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更换浏览器
parent
03268629
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
184 additions
and
197 deletions
+184
-197
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+3
-0
mobile/build.gradle
mobile/build.gradle
+1
-2
mobile/libs/armeabi-v7a/liblbs.so
mobile/libs/armeabi-v7a/liblbs.so
+0
-0
mobile/libs/tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar
...1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar
+0
-0
mobile/libs/xwalk_core_library-22.52.561.4.aar
mobile/libs/xwalk_core_library-22.52.561.4.aar
+0
-0
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
...n/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
+5
-5
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+4
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DefWebChromeClient.java
.../java/cn/garymb/ygomobile/ui/plus/DefWebChromeClient.java
+5
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DefWebViewClient.java
...in/java/cn/garymb/ygomobile/ui/plus/DefWebViewClient.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/WebViewPlus.java
.../main/java/cn/garymb/ygomobile/ui/widget/WebViewPlus.java
+2
-2
mobile/src/main/res/layout/activity_deck_cards.xml
mobile/src/main/res/layout/activity_deck_cards.xml
+0
-1
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
...src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
+18
-17
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
...rd/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
+35
-11
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCardWebView.java
...ard/java/cn/garymb/ygomobile/ui/online/MyCardWebView.java
+2
-2
mobile/src/mycard/java/cn/garymb/ygomobile/ui/plus/X5WebView.java
...rc/mycard/java/cn/garymb/ygomobile/ui/plus/X5WebView.java
+89
-0
mobile/src/mycard/java/cn/garymb/ygomobile/ui/plus/XWebView.java
...src/mycard/java/cn/garymb/ygomobile/ui/plus/XWebView.java
+0
-144
mobile/src/mycard/res/layout/activity_online_mycard.xml
mobile/src/mycard/res/layout/activity_online_mycard.xml
+17
-3
No files found.
Classes/gframe/game.cpp
View file @
c13e619e
...
@@ -1867,6 +1867,9 @@ void Game::CloseDuelWindow() {
...
@@ -1867,6 +1867,9 @@ void Game::CloseDuelWindow() {
wReplaySave
->
setVisible
(
false
);
wReplaySave
->
setVisible
(
false
);
stHintMsg
->
setVisible
(
false
);
stHintMsg
->
setVisible
(
false
);
btnSideOK
->
setVisible
(
false
);
btnSideOK
->
setVisible
(
false
);
btnSideShuffle
->
setVisible
(
false
);
btnSideSort
->
setVisible
(
false
);
btnSideReload
->
setVisible
(
false
);
btnLeaveGame
->
setVisible
(
false
);
btnLeaveGame
->
setVisible
(
false
);
btnSpectatorSwap
->
setVisible
(
false
);
btnSpectatorSwap
->
setVisible
(
false
);
btnChainIgnore
->
setVisible
(
false
);
btnChainIgnore
->
setVisible
(
false
);
...
...
mobile/build.gradle
View file @
c13e619e
...
@@ -81,8 +81,7 @@ dependencies {
...
@@ -81,8 +81,7 @@ dependencies {
implementation
'com.tubb.smrv:swipemenu-recyclerview:5.4.0'
implementation
'com.tubb.smrv:swipemenu-recyclerview:5.4.0'
//
//
implementation
(
name:
'libWindbot'
,
ext:
'aar'
)
implementation
(
name:
'libWindbot'
,
ext:
'aar'
)
//
//mycardImplementation(name: 'xwalk_core_library-22.52.561.4', ext: 'aar')
mycardImplementation
(
name:
'xwalk_core_library-22.52.561.4'
,
ext:
'aar'
)
implementation
'com.nightonke:boommenu:2.1.0'
implementation
'com.nightonke:boommenu:2.1.0'
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
...
...
mobile/libs/armeabi-v7a/liblbs.so
0 → 100644
View file @
c13e619e
File added
mobile/libs/tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar
0 → 100644
View file @
c13e619e
File added
mobile/libs/xwalk_core_library-22.52.561.4.aar
deleted
100644 → 0
View file @
03268629
File deleted
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
c13e619e
...
@@ -24,7 +24,7 @@ public interface Constants {
...
@@ -24,7 +24,7 @@ public interface Constants {
String
PREF_OPENGL_VERSION
=
"pref_key_game_ogles_config"
;
String
PREF_OPENGL_VERSION
=
"pref_key_game_ogles_config"
;
int
PREF_DEF_OPENGL_VERSION
=
1
;
int
PREF_DEF_OPENGL_VERSION
=
1
;
String
PREF_PENDULUM_SCALE
=
"pref_key_game_lab_pendulum_scale"
;
String
PREF_PENDULUM_SCALE
=
"pref_key_game_lab_pendulum_scale"
;
boolean
PREF_DEF_PENDULUM_SCALE
=
fals
e
;
boolean
PREF_DEF_PENDULUM_SCALE
=
tru
e
;
String
PREF_SOUND_EFFECT
=
"pref_key_game_sound_effect"
;
String
PREF_SOUND_EFFECT
=
"pref_key_game_sound_effect"
;
boolean
PREF_DEF_SOUND_EFFECT
=
true
;
boolean
PREF_DEF_SOUND_EFFECT
=
true
;
String
PREF_LOCK_SCREEN
=
"pref_key_game_screen_orientation"
;
String
PREF_LOCK_SCREEN
=
"pref_key_game_screen_orientation"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
View file @
c13e619e
...
@@ -26,7 +26,7 @@ public class WebActivity extends BaseActivity {
...
@@ -26,7 +26,7 @@ public class WebActivity extends BaseActivity {
setSupportActionBar
(
toolbar
);
setSupportActionBar
(
toolbar
);
enableBackHome
();
enableBackHome
();
mWebViewPlus
=
$
(
R
.
id
.
webbrowser
);
mWebViewPlus
=
$
(
R
.
id
.
webbrowser
);
mWebViewPlus
.
enableHtml5
();
/*
mWebViewPlus.enableHtml5();
mWebViewPlus.setWebChromeClient(new DefWebChromeClient() {
mWebViewPlus.setWebChromeClient(new DefWebChromeClient() {
@Override
@Override
public void onReceivedTitle(WebView view, String title) {
public void onReceivedTitle(WebView view, String title) {
...
@@ -37,7 +37,7 @@ public class WebActivity extends BaseActivity {
...
@@ -37,7 +37,7 @@ public class WebActivity extends BaseActivity {
setTitle(title);
setTitle(title);
}
}
}
}
});
});
*/
if
(
doIntent
(
getIntent
()))
{
if
(
doIntent
(
getIntent
()))
{
mWebViewPlus
.
loadUrl
(
mUrl
);
mWebViewPlus
.
loadUrl
(
mUrl
);
}
}
...
@@ -93,14 +93,14 @@ public class WebActivity extends BaseActivity {
...
@@ -93,14 +93,14 @@ public class WebActivity extends BaseActivity {
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
mWebViewPlus
.
resumeTimers
();
mWebViewPlus
.
resumeTimers
();
mWebViewPlus
.
onShow
();
//
mWebViewPlus.onShow();
super
.
onResume
();
super
.
onResume
();
}
}
@Override
@Override
protected
void
onPause
()
{
protected
void
onPause
()
{
mWebViewPlus
.
pauseTimers
();
mWebViewPlus
.
pauseTimers
();
mWebViewPlus
.
onHide
();
//
mWebViewPlus.onHide();
super
.
onPause
();
super
.
onPause
();
}
}
...
@@ -109,7 +109,7 @@ public class WebActivity extends BaseActivity {
...
@@ -109,7 +109,7 @@ public class WebActivity extends BaseActivity {
mWebViewPlus
.
stopLoading
();
mWebViewPlus
.
stopLoading
();
mWebViewPlus
.
setWebChromeClient
(
null
);
mWebViewPlus
.
setWebChromeClient
(
null
);
mWebViewPlus
.
setWebViewClient
(
null
);
mWebViewPlus
.
setWebViewClient
(
null
);
mWebViewPlus
.
onDestroy
();
//
mWebViewPlus.onDestroy();
super
.
onDestroy
();
super
.
onDestroy
();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
c13e619e
...
@@ -372,10 +372,11 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
...
@@ -372,10 +372,11 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
}
}
private
void
checkForceUpdateSilent
()
{
private
void
checkForceUpdateSilent
()
{
UpdateHelper
.
getInstance
().
init
(
get
Application
Context
(),
Color
.
parseColor
(
"#0A93DB"
));
UpdateHelper
.
getInstance
().
init
(
getContext
(),
Color
.
parseColor
(
"#0A93DB"
));
UpdateHelper
.
getInstance
().
setDebugMode
(
false
);
UpdateHelper
.
getInstance
().
setDebugMode
(
false
);
long
intervalMillis
=
0
*
1000L
;
UpdateHelper
.
getInstance
().
manualUpdate
(
getPackageName
());
UpdateHelper
.
getInstance
().
autoUpdate
(
getPackageName
(),
false
,
intervalMillis
);
/*long intervalMillis = 0 * 1000L;
UpdateHelper.getInstance().autoUpdate(getPackageName(), false, intervalMillis);*/
}
}
public
void
AnimationShake
(){
public
void
AnimationShake
(){
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DefWebChromeClient.java
View file @
c13e619e
package
cn.garymb.ygomobile.ui.plus
;
package
cn.garymb.ygomobile.ui.plus
;
import
android.util.Log
;
import
android.util.Log
;
import
android.webkit.ConsoleMessage
;
import
android.webkit.WebChromeClient
;
import
com.tencent.smtt.export.external.interfaces.ConsoleMessage
;
import
com.tencent.smtt.sdk.WebChromeClient
;
import
cn.garymb.ygomobile.lite.BuildConfig
;
import
cn.garymb.ygomobile.lite.BuildConfig
;
public
class
DefWebChromeClient
extends
WebChromeClient
{
public
class
DefWebChromeClient
extends
WebChromeClient
{
@Override
/*
@Override
public void onConsoleMessage(String message, int lineNumber, String sourceID) {
public void onConsoleMessage(String message, int lineNumber, String sourceID) {
super.onConsoleMessage(message, lineNumber, sourceID);
super.onConsoleMessage(message, lineNumber, sourceID);
if (BuildConfig.DEBUG)
if (BuildConfig.DEBUG)
...
@@ -19,5 +20,5 @@ public class DefWebChromeClient extends WebChromeClient {
...
@@ -19,5 +20,5 @@ public class DefWebChromeClient extends WebChromeClient {
if (BuildConfig.DEBUG)
if (BuildConfig.DEBUG)
Log.i("webview", consoleMessage.sourceId() + ":" + consoleMessage.lineNumber() + "\n" + consoleMessage.message());
Log.i("webview", consoleMessage.sourceId() + ":" + consoleMessage.lineNumber() + "\n" + consoleMessage.message());
return true;
return true;
}
}
*/
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DefWebViewClient.java
View file @
c13e619e
package
cn.garymb.ygomobile.ui.plus
;
package
cn.garymb.ygomobile.ui.plus
;
import
android.webkit
.WebView
;
import
com.tencent.smtt.sdk
.WebView
;
import
android.webkit
.WebViewClient
;
import
com.tencent.smtt.sdk
.WebViewClient
;
public
class
DefWebViewClient
extends
WebViewClient
{
public
class
DefWebViewClient
extends
WebViewClient
{
@Override
@Override
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/WebViewPlus.java
View file @
c13e619e
...
@@ -3,10 +3,10 @@ package cn.garymb.ygomobile.ui.widget;
...
@@ -3,10 +3,10 @@ package cn.garymb.ygomobile.ui.widget;
import
android.content.Context
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
cn.garymb.ygomobile.ui.plus.XWebView
;
import
cn.garymb.ygomobile.ui.plus.X
5
WebView
;
public
class
WebViewPlus
extends
XWebView
{
public
class
WebViewPlus
extends
X
5
WebView
{
public
WebViewPlus
(
Context
context
)
{
public
WebViewPlus
(
Context
context
)
{
super
(
context
);
super
(
context
);
}
}
...
...
mobile/src/main/res/layout/activity_deck_cards.xml
View file @
c13e619e
...
@@ -81,7 +81,6 @@
...
@@ -81,7 +81,6 @@
app:bmb_piecePlaceEnum=
"piecePlace_dot_9_1"
>
app:bmb_piecePlaceEnum=
"piecePlace_dot_9_1"
>
<ImageView
<ImageView
android:id=
"@+id/cube2"
android:layout_width=
"35dp"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_height=
"35dp"
android:layout_gravity=
"center"
android:layout_gravity=
"center"
...
...
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
View file @
c13e619e
...
@@ -9,7 +9,7 @@ import android.net.Uri;
...
@@ -9,7 +9,7 @@ import android.net.Uri;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Base64
;
import
android.util.Base64
;
import
android.util.Log
;
import
android.util.Log
;
import
android.webkit.
WebView
;
import
android.webkit.
JavascriptInterface
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
...
@@ -26,7 +26,8 @@ import cn.garymb.ygomobile.AppsSettings;
...
@@ -26,7 +26,8 @@ import cn.garymb.ygomobile.AppsSettings;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.plus.DefWebViewClient
;
import
cn.garymb.ygomobile.ui.plus.DefWebViewClient
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.UserManagement
;
import
com.tencent.smtt.sdk.*
;
import
static
junit
.
framework
.
Assert
.
assertEquals
;
import
static
junit
.
framework
.
Assert
.
assertEquals
;
...
@@ -191,40 +192,40 @@ public class MyCard {
...
@@ -191,40 +192,40 @@ public class MyCard {
mListener
=
listener
;
mListener
=
listener
;
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
edit_deck
()
{
public
void
edit_deck
()
{
activity
.
startActivity
(
new
Intent
(
activity
,
DeckManagerActivity
.
class
));
activity
.
startActivity
(
new
Intent
(
activity
,
DeckManagerActivity
.
class
));
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
watch_replay
()
{
public
void
watch_replay
()
{
if
(
mListener
!=
null
)
{
if
(
mListener
!=
null
)
{
activity
.
runOnUiThread
(
mListener:
:
watchReplay
);
activity
.
runOnUiThread
(
mListener:
:
watchReplay
);
}
}
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
puzzle_mode
()
{
public
void
puzzle_mode
()
{
if
(
mListener
!=
null
)
{
if
(
mListener
!=
null
)
{
activity
.
runOnUiThread
(
mListener:
:
puzzleMode
);
activity
.
runOnUiThread
(
mListener:
:
puzzleMode
);
}
}
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
openDrawer
()
{
public
void
openDrawer
()
{
if
(
mListener
!=
null
)
{
if
(
mListener
!=
null
)
{
activity
.
runOnUiThread
(
mListener:
:
openDrawer
);
activity
.
runOnUiThread
(
mListener:
:
openDrawer
);
}
}
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
backHome
()
{
public
void
backHome
()
{
if
(
mListener
!=
null
)
{
if
(
mListener
!=
null
)
{
activity
.
runOnUiThread
(
mListener:
:
backHome
);
activity
.
runOnUiThread
(
mListener:
:
backHome
);
}
}
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
share
(
String
text
)
{
public
void
share
(
String
text
)
{
if
(
mListener
!=
null
)
{
if
(
mListener
!=
null
)
{
activity
.
runOnUiThread
(()
->
{
activity
.
runOnUiThread
(()
->
{
...
@@ -233,14 +234,14 @@ public class MyCard {
...
@@ -233,14 +234,14 @@ public class MyCard {
}
}
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
closeDrawer
()
{
public
void
closeDrawer
()
{
if
(
mListener
!=
null
)
{
if
(
mListener
!=
null
)
{
activity
.
runOnUiThread
(
mListener:
:
closeDrawer
);
activity
.
runOnUiThread
(
mListener:
:
closeDrawer
);
}
}
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
join
(
String
host
,
int
port
,
String
name
,
String
room
)
{
public
void
join
(
String
host
,
int
port
,
String
name
,
String
room
)
{
try
{
try
{
final
YGOGameOptions
options
=
new
YGOGameOptions
();
final
YGOGameOptions
options
=
new
YGOGameOptions
();
...
@@ -266,7 +267,7 @@ public class MyCard {
...
@@ -266,7 +267,7 @@ public class MyCard {
* return: 文件名数组的 JSON 字符串
* return: 文件名数组的 JSON 字符串
* 失败抛异常或返回空数组
* 失败抛异常或返回空数组
*/
*/
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
String
readdir
(
String
path
)
{
public
String
readdir
(
String
path
)
{
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
String
[]
result
=
file
.
list
();
String
[]
result
=
file
.
list
();
...
@@ -279,7 +280,7 @@ public class MyCard {
...
@@ -279,7 +280,7 @@ public class MyCard {
* return: 文件内容的 base64
* return: 文件内容的 base64
* 读取失败抛异常
* 读取失败抛异常
*/
*/
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
String
readFile
(
String
path
)
throws
IOException
{
public
String
readFile
(
String
path
)
throws
IOException
{
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
byte
[]
result
=
new
byte
[(
int
)
file
.
length
()];
byte
[]
result
=
new
byte
[(
int
)
file
.
length
()];
...
@@ -295,7 +296,7 @@ public class MyCard {
...
@@ -295,7 +296,7 @@ public class MyCard {
* data: 文件内容的 base64
* data: 文件内容的 base64
* 写入失败抛异常
* 写入失败抛异常
*/
*/
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
writeFile
(
String
path
,
String
data
)
throws
IOException
{
public
void
writeFile
(
String
path
,
String
data
)
throws
IOException
{
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
FileOutputStream
stream
=
new
FileOutputStream
(
file
);
FileOutputStream
stream
=
new
FileOutputStream
(
file
);
...
@@ -307,7 +308,7 @@ public class MyCard {
...
@@ -307,7 +308,7 @@ public class MyCard {
* 删除文件
* 删除文件
* 删除失败返回 false
* 删除失败返回 false
*/
*/
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
boolean
unlink
(
String
path
)
{
public
boolean
unlink
(
String
path
)
{
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
lastModified
.
edit
().
remove
(
path
).
apply
();
lastModified
.
edit
().
remove
(
path
).
apply
();
...
@@ -320,13 +321,13 @@ public class MyCard {
...
@@ -320,13 +321,13 @@ public class MyCard {
* return: 修改时间
* return: 修改时间
* 文件不存在返回 0
* 文件不存在返回 0
*/
*/
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
long
getFileLastModified
(
String
path
)
{
public
long
getFileLastModified
(
String
path
)
{
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
return
getWrappedLastModified
(
path
,
file
.
lastModified
());
return
getWrappedLastModified
(
path
,
file
.
lastModified
());
}
}
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
updateUser
(
String
name
,
String
headurl
,
String
status
)
{
public
void
updateUser
(
String
name
,
String
headurl
,
String
status
)
{
if
(
mListener
!=
null
)
{
if
(
mListener
!=
null
)
{
mUser
.
name
=
name
;
mUser
.
name
=
name
;
...
@@ -345,7 +346,7 @@ public class MyCard {
...
@@ -345,7 +346,7 @@ public class MyCard {
* path: 文件绝对路径
* path: 文件绝对路径
* time: 时间
* time: 时间
*/
*/
@
org
.
xwalk
.
core
.
JavascriptInterface
@JavascriptInterface
public
void
setFileLastModified
(
String
path
,
long
time
)
{
public
void
setFileLastModified
(
String
path
,
long
time
)
{
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
File
file
=
new
File
(
settings
.
getResourcePath
(),
path
);
if
(
file
.
setLastModified
(
time
))
{
if
(
file
.
setLastModified
(
time
))
{
...
...
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
View file @
c13e619e
...
@@ -16,13 +16,12 @@ import android.view.View;
...
@@ -16,13 +16,12 @@ import android.view.View;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Glide
;
import
org.xwalk.core.XWalkSettings
;
import
com.tencent.smtt.sdk.*
;
import
org.xwalk.core.XWalkUIClient
;
import
org.xwalk.core.XWalkView
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
...
@@ -32,6 +31,7 @@ import cn.garymb.ygomobile.lite.R;
...
@@ -32,6 +31,7 @@ import cn.garymb.ygomobile.lite.R;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.online.mcchat.SplashActivity
;
import
cn.garymb.ygomobile.ui.online.mcchat.SplashActivity
;
import
cn.garymb.ygomobile.ui.plus.X5WebView
;
public
class
MyCardActivity
extends
BaseActivity
implements
MyCard
.
MyCardListener
,
NavigationView
.
OnNavigationItemSelectedListener
{
public
class
MyCardActivity
extends
BaseActivity
implements
MyCard
.
MyCardListener
,
NavigationView
.
OnNavigationItemSelectedListener
{
...
@@ -41,6 +41,8 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -41,6 +41,8 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
private
ImageView
mHeadView
;
private
ImageView
mHeadView
;
private
TextView
mNameView
,
mStatusView
;
private
TextView
mNameView
,
mStatusView
;
private
ProgressBar
mProgressBar
;
@Override
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
...
@@ -56,6 +58,8 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -56,6 +58,8 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
mMyCard
=
new
MyCard
(
this
);
mMyCard
=
new
MyCard
(
this
);
mWebViewPlus
=
$
(
R
.
id
.
webbrowser
);
mWebViewPlus
=
$
(
R
.
id
.
webbrowser
);
mDrawerlayout
=
$
(
R
.
id
.
drawer_layout
);
mDrawerlayout
=
$
(
R
.
id
.
drawer_layout
);
mProgressBar
=
$
(
R
.
id
.
progressBar
);
mProgressBar
.
setMax
(
100
);
NavigationView
navigationView
=
$
(
R
.
id
.
nav_main
);
NavigationView
navigationView
=
$
(
R
.
id
.
nav_main
);
navigationView
.
setNavigationItemSelectedListener
(
this
);
navigationView
.
setNavigationItemSelectedListener
(
this
);
...
@@ -63,9 +67,9 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -63,9 +67,9 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
mHeadView
=
(
ImageView
)
navHead
.
findViewById
(
R
.
id
.
img_head
);
mHeadView
=
(
ImageView
)
navHead
.
findViewById
(
R
.
id
.
img_head
);
mNameView
=
(
TextView
)
navHead
.
findViewById
(
R
.
id
.
tv_name
);
mNameView
=
(
TextView
)
navHead
.
findViewById
(
R
.
id
.
tv_name
);
mStatusView
=
(
TextView
)
navHead
.
findViewById
(
R
.
id
.
tv_dp
);
mStatusView
=
(
TextView
)
navHead
.
findViewById
(
R
.
id
.
tv_dp
);
mWebViewPlus
.
enableHtml5
();
//
mWebViewPlus.enableHtml5();
XWalk
Settings
settings
=
mWebViewPlus
.
getSettings
();
Web
Settings
settings
=
mWebViewPlus
.
getSettings
();
settings
.
setUserAgentString
(
settings
.
getUserAgentString
()
+
MessageFormat
.
format
(
settings
.
setUserAgentString
(
settings
.
getUserAgentString
()
+
MessageFormat
.
format
(
" YGOMobile/{0} ({1} {2,number,#})"
,
" YGOMobile/{0} ({1} {2,number,#})"
,
BuildConfig
.
VERSION_NAME
,
BuildConfig
.
VERSION_NAME
,
...
@@ -73,7 +77,23 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -73,7 +77,23 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
BuildConfig
.
VERSION_CODE
BuildConfig
.
VERSION_CODE
));
));
mWebViewPlus
.
setUIClient
(
new
XWalkUIClient
(
mWebViewPlus
)
{
mWebViewPlus
.
setWebChromeClient
(
new
WebChromeClient
()
{
@Override
public
void
onProgressChanged
(
WebView
view
,
int
newProgress
)
{
if
(
newProgress
==
100
)
{
mProgressBar
.
setVisibility
(
View
.
GONE
);
}
else
{
if
(
View
.
GONE
==
mProgressBar
.
getVisibility
())
{
mProgressBar
.
setVisibility
(
View
.
VISIBLE
);
}
mProgressBar
.
setProgress
(
newProgress
);
}
super
.
onProgressChanged
(
view
,
newProgress
);
}
});
/*mWebViewPlus.setUIClient(new XWalkUIClient(mWebViewPlus) {
@Override
@Override
public void onReceivedTitle(XWalkView view, String title) {
public void onReceivedTitle(XWalkView view, String title) {
super.onReceivedTitle(view, title);
super.onReceivedTitle(view, title);
...
@@ -81,12 +101,12 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -81,12 +101,12 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
}
}
@Override
@Override
public
boolean
onConsoleMessage
(
X
Walk
View
view
,
String
message
,
int
lineNumber
,
String
sourceId
,
ConsoleMessageType
messageType
)
{
public boolean onConsoleMessage(X
5Web
View view, String message, int lineNumber, String sourceId, ConsoleMessageType messageType) {
if (BuildConfig.DEBUG)
if (BuildConfig.DEBUG)
Log.i("webview", sourceId + ":" + lineNumber + "\n" + message);
Log.i("webview", sourceId + ":" + lineNumber + "\n" + message);
return super.onConsoleMessage(view, message, lineNumber, sourceId, messageType);
return super.onConsoleMessage(view, message, lineNumber, sourceId, messageType);
}
}
});
});
*/
mMyCard
.
attachWeb
(
mWebViewPlus
,
this
);
mMyCard
.
attachWeb
(
mWebViewPlus
,
this
);
mWebViewPlus
.
loadUrl
(
mMyCard
.
getHomeUrl
());
mWebViewPlus
.
loadUrl
(
mMyCard
.
getHomeUrl
());
}
}
...
@@ -104,7 +124,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -104,7 +124,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
}
}
}
}
@Override
/*
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mWebViewPlus != null) {
if (mWebViewPlus != null) {
mWebViewPlus.onActivityResult(requestCode, resultCode, data);
mWebViewPlus.onActivityResult(requestCode, resultCode, data);
...
@@ -117,7 +137,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -117,7 +137,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
if (mWebViewPlus != null) {
if (mWebViewPlus != null) {
mWebViewPlus.onNewIntent(intent);
mWebViewPlus.onNewIntent(intent);
}
}
}
}
*/
@Override
@Override
public
void
onBackPressed
()
{
public
void
onBackPressed
()
{
...
@@ -133,7 +153,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -133,7 +153,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
mWebViewPlus
.
stopLoading
();
mWebViewPlus
.
stopLoading
();
mWebViewPlus
.
onDestroy
();
//
mWebViewPlus.onDestroy();
YGOStarter
.
onDestroy
(
this
);
YGOStarter
.
onDestroy
(
this
);
super
.
onDestroy
();
super
.
onDestroy
();
}
}
...
@@ -239,4 +259,8 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -239,4 +259,8 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
}
}
return
false
;
return
false
;
}
}
public
void
ProgressBar
(){
}
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCardWebView.java
View file @
c13e619e
...
@@ -3,9 +3,9 @@ package cn.garymb.ygomobile.ui.online;
...
@@ -3,9 +3,9 @@ package cn.garymb.ygomobile.ui.online;
import
android.content.Context
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
cn.garymb.ygomobile.ui.
widget.WebViewPlus
;
import
cn.garymb.ygomobile.ui.
plus.X5WebView
;
public
class
MyCardWebView
extends
WebViewPlus
{
public
class
MyCardWebView
extends
X5WebView
{
public
MyCardWebView
(
Context
context
)
{
public
MyCardWebView
(
Context
context
)
{
super
(
context
);
super
(
context
);
}
}
...
...
mobile/src/mycard/java/cn/garymb/ygomobile/ui/plus/X5WebView.java
0 → 100644
View file @
c13e619e
package
cn.garymb.ygomobile.ui.plus
;
import
android.annotation.*
;
import
android.content.*
;
import
android.graphics.*
;
import
android.os.*
;
import
android.util.*
;
import
android.view.*
;
import
android.widget.*
;
import
com.tencent.smtt.sdk.*
;
public
class
X5WebView
extends
WebView
{
private
WebViewClient
client
=
new
WebViewClient
()
{
/**
* 防止加载网页时调起系统浏览器
*/
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
view
.
loadUrl
(
url
);
return
true
;
}
};
@SuppressLint
(
"SetJavaScriptEnabled"
)
public
X5WebView
(
Context
arg0
,
AttributeSet
arg1
)
{
super
(
arg0
,
arg1
);
this
.
setWebViewClient
(
client
);
// this.setWebChromeClient(chromeClient);
// WebStorage webStorage = WebStorage.getInstance();
initWebViewSettings
();
this
.
getView
().
setClickable
(
true
);
}
private
void
initWebViewSettings
()
{
WebSettings
webSetting
=
this
.
getSettings
();
webSetting
.
setJavaScriptEnabled
(
true
);
webSetting
.
setJavaScriptCanOpenWindowsAutomatically
(
true
);
webSetting
.
setAllowFileAccess
(
true
);
//webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
webSetting
.
setSupportZoom
(
true
);
webSetting
.
setBuiltInZoomControls
(
true
);
webSetting
.
setUseWideViewPort
(
true
);
webSetting
.
setSupportMultipleWindows
(
false
);
// webSetting.setLoadWithOverviewMode(true);
webSetting
.
setAppCacheEnabled
(
true
);
// webSetting.setDatabaseEnabled(true);
webSetting
.
setDomStorageEnabled
(
true
);
webSetting
.
setGeolocationEnabled
(
true
);
webSetting
.
setAppCacheMaxSize
(
Long
.
MAX_VALUE
);
// webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
webSetting
.
setPluginState
(
WebSettings
.
PluginState
.
ON_DEMAND
);
// webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
webSetting
.
setCacheMode
(
WebSettings
.
LOAD_NO_CACHE
);
webSetting
.
setDatabaseEnabled
(
true
);
webSetting
.
setPluginState
(
WebSettings
.
PluginState
.
ON_DEMAND
);
}
@Override
protected
boolean
drawChild
(
Canvas
canvas
,
View
child
,
long
drawingTime
)
{
/*boolean ret = super.drawChild(canvas, child, drawingTime);
canvas.save();
Paint paint = new Paint();
paint.setColor(0x7fff0000);
paint.setTextSize(24.f);
paint.setAntiAlias(true);
if (getX5WebViewExtension() != null) {
canvas.drawText(this.getContext().getPackageName() + "-pid:"
+ android.os.Process.myPid(), 10, 50, paint);
canvas.drawText(
"X5 Core:" + QbSdk.getTbsVersion(this.getContext()), 10,
100, paint);
} else {
canvas.drawText(this.getContext().getPackageName() + "-pid:"
+ android.os.Process.myPid(), 10, 50, paint);
canvas.drawText("Sys Core", 10, 100, paint);
}
canvas.drawText(Build.MANUFACTURER, 10, 150, paint);
canvas.drawText(Build.MODEL, 10, 200, paint);
canvas.restore();
return ret;*/
return
super
.
drawChild
(
canvas
,
child
,
drawingTime
);
}
public
X5WebView
(
Context
arg0
)
{
super
(
arg0
);
setBackgroundColor
(
85621
);
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/plus/XWebView.java
deleted
100644 → 0
View file @
03268629
package
cn.garymb.ygomobile.ui.plus
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.webkit.GeolocationPermissions
;
import
android.webkit.WebChromeClient
;
import
android.webkit.WebView
;
import
android.webkit.WebViewClient
;
import
org.xwalk.core.XWalkDownloadListener
;
import
org.xwalk.core.XWalkNavigationItem
;
import
org.xwalk.core.XWalkPreferences
;
import
org.xwalk.core.XWalkResourceClient
;
import
org.xwalk.core.XWalkUIClient
;
import
org.xwalk.core.XWalkView
;
import
cn.garymb.ygomobile.lite.BuildConfig
;
public
class
XWebView
extends
XWalkView
{
static
{
XWalkPreferences
.
setValue
(
XWalkPreferences
.
REMOTE_DEBUGGING
,
BuildConfig
.
DEBUG
);
XWalkPreferences
.
setValue
(
XWalkPreferences
.
ENABLE_THEME_COLOR
,
true
);
XWalkPreferences
.
setValue
(
XWalkPreferences
.
ANIMATABLE_XWALK_VIEW
,
true
);
XWalkPreferences
.
setValue
(
XWalkPreferences
.
ALLOW_UNIVERSAL_ACCESS_FROM_FILE
,
true
);
}
public
XWebView
(
Context
context
)
{
super
(
context
);
}
public
XWebView
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
}
public
XWebView
(
Context
context
,
Activity
activity
)
{
super
(
context
,
activity
);
}
public
void
setWebViewClient
(
WebViewClient
webViewClient
)
{
if
(
webViewClient
==
null
)
return
;
setResourceClient
(
new
XWalkResourceClient
(
this
)
{
@Override
public
void
onLoadStarted
(
XWalkView
view
,
String
url
)
{
super
.
onLoadStarted
(
view
,
url
);
webViewClient
.
onPageStarted
(
null
,
url
,
null
);
}
@Override
public
void
onLoadFinished
(
XWalkView
view
,
String
url
)
{
super
.
onLoadFinished
(
view
,
url
);
webViewClient
.
onPageFinished
(
null
,
url
);
}
@Override
public
boolean
shouldOverrideUrlLoading
(
XWalkView
view
,
String
url
)
{
return
webViewClient
.
shouldOverrideUrlLoading
(
null
,
url
);
}
});
}
public
void
setWebChromeClient
(
final
WebChromeClient
webChromeClient
)
{
if
(
webChromeClient
==
null
)
return
;
setUIClient
(
new
XWalkUIClient
(
this
)
{
@Override
public
boolean
onConsoleMessage
(
XWalkView
view
,
String
message
,
int
lineNumber
,
String
sourceId
,
ConsoleMessageType
messageType
)
{
if
(
BuildConfig
.
DEBUG
)
{
Log
.
i
(
"webview"
,
sourceId
+
":"
+
lineNumber
+
"\n"
+
message
);
}
return
super
.
onConsoleMessage
(
view
,
message
,
lineNumber
,
sourceId
,
messageType
);
}
@Override
public
void
onReceivedTitle
(
XWalkView
view
,
String
title
)
{
super
.
onReceivedTitle
(
view
,
title
);
webChromeClient
.
onReceivedTitle
(
null
,
title
);
}
});
}
public
boolean
canGoBack
()
{
return
getNavigationHistory
().
canGoBack
();
}
public
void
enableHtml5
()
{
getSettings
().
setSaveFormData
(
true
);
getSettings
().
setDatabaseEnabled
(
true
);
getSettings
().
setDomStorageEnabled
(
true
);
// HTML5 configuration settings.
// getSettings().setAppCacheMaxSize(Long.MAX_VALUE);
// getSettings().setAppCachePath(context.getDir("appcache", Context.MODE_PRIVATE).getPath());
// getSettings().setDatabasePath(context.getDir("databases", Context.MODE_PRIVATE).getPath());
// getSettings().setGeolocationDatabasePath(context.getDir("geolocation", 0).getPath());
getSettings
().
setJavaScriptCanOpenWindowsAutomatically
(
true
);
setScrollBarStyle
(
WebView
.
SCROLLBARS_OUTSIDE_OVERLAY
);
setHorizontalScrollBarEnabled
(
false
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
ECLAIR_MR1
)
{
GeolocationPermissions
.
getInstance
();
}
getSettings
().
setAllowContentAccess
(
true
);
getSettings
().
setAllowFileAccess
(
true
);
setDownloadListener
(
new
XWalkDownloadListener
(
getContext
())
{
@Override
public
void
onDownloadStart
(
String
url
,
String
userAgent
,
String
contentDisposition
,
String
mimetype
,
long
contentLength
)
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
));
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
try
{
getContext
().
startActivity
(
intent
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
});
}
public
void
loadUrl
(
String
url
)
{
super
.
load
(
url
,
null
);
}
public
void
loadData
(
String
data
,
String
mimeType
,
String
encoding
)
{
super
.
load
(
null
,
data
);
}
public
void
goBack
()
{
int
index
=
getNavigationHistory
().
getCurrentIndex
();
if
(
getNavigationHistory
().
hasItemAt
(
index
-
1
))
{
XWalkNavigationItem
item
=
getNavigationHistory
().
getItemAt
(
index
-
1
);
// item.getUrl();
if
(
item
!=
null
)
{
loadUrl
(
item
.
getUrl
());
}
}
}
}
mobile/src/mycard/res/layout/activity_online_mycard.xml
View file @
c13e619e
...
@@ -10,15 +10,26 @@
...
@@ -10,15 +10,26 @@
android:fitsSystemWindows=
"true"
android:fitsSystemWindows=
"true"
tools:openDrawer=
"left"
>
tools:openDrawer=
"left"
>
<FrameLayout
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<cn.garymb.ygomobile.ui.online.MyCardWebView
<cn.garymb.ygomobile.ui.online.MyCardWebView
android:id=
"@+id/webbrowser"
android:id=
"@+id/webbrowser"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
>
</FrameLayout>
<ProgressBar
android:id=
"@+id/progressBar"
style=
"?android:attr/progressBarStyleHorizontal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
</cn.garymb.ygomobile.ui.online.MyCardWebView>
</RelativeLayout>
<android.support.design.widget.NavigationView
<android.support.design.widget.NavigationView
android:id=
"@+id/nav_main"
android:id=
"@+id/nav_main"
...
@@ -30,4 +41,7 @@
...
@@ -30,4 +41,7 @@
app:itemIconTint=
"@color/gold"
app:itemIconTint=
"@color/gold"
app:itemTextColor=
"@color/mediumPurple"
app:itemTextColor=
"@color/mediumPurple"
app:menu=
"@menu/nav_mycard_menu"
/>
app:menu=
"@menu/nav_mycard_menu"
/>
</android.support.v4.widget.DrawerLayout>
</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
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