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
c52dd29f
Commit
c52dd29f
authored
Jun 10, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理
parent
204a7f8d
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
786 additions
and
1004 deletions
+786
-1004
mobile/assets/changelog.html
mobile/assets/changelog.html
+14
-4
mobile/src/main/java/cn/garymb/ygomobile/App.java
mobile/src/main/java/cn/garymb/ygomobile/App.java
+7
-4
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+1
-4
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/GameUriManager.java
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
+5
-14
mobile/src/main/java/cn/garymb/ygomobile/bean/Deck.java
mobile/src/main/java/cn/garymb/ygomobile/bean/Deck.java
+3
-3
mobile/src/main/java/cn/garymb/ygomobile/bean/ServerList.java
...le/src/main/java/cn/garymb/ygomobile/bean/ServerList.java
+3
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/ServerListAdapter.java
...va/cn/garymb/ygomobile/ui/adapters/ServerListAdapter.java
+3
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+7
-7
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
...c/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
+1
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
...c/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
+36
-34
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ServerListManager.java
...n/java/cn/garymb/ygomobile/ui/home/ServerListManager.java
+1
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DefWebChromeClient.java
.../java/cn/garymb/ygomobile/ui/plus/DefWebChromeClient.java
+0
-5
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DialogPlus.java
...src/main/java/cn/garymb/ygomobile/ui/plus/DialogPlus.java
+3
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
...ava/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
+208
-204
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/VUiKit.java
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/VUiKit.java
+3
-3
mobile/src/main/java/cn/garymb/ygomobile/utils/AlipayPayUtils.java
...c/main/java/cn/garymb/ygomobile/utils/AlipayPayUtils.java
+27
-27
mobile/src/main/java/cn/garymb/ygomobile/utils/StringUtils.java
.../src/main/java/cn/garymb/ygomobile/utils/StringUtils.java
+2
-0
mobile/src/main/java/cn/garymb/ygomobile/utils/ToastUtil.java
...le/src/main/java/cn/garymb/ygomobile/utils/ToastUtil.java
+0
-193
mobile/src/main/java/cn/garymb/ygomobile/utils/XmlUtils.java
mobile/src/main/java/cn/garymb/ygomobile/utils/XmlUtils.java
+0
-4
mobile/src/main/res/values-ko/arrays.xml
mobile/src/main/res/values-ko/arrays.xml
+17
-17
mobile/src/main/res/values-zh/arrays.xml
mobile/src/main/res/values-zh/arrays.xml
+3
-3
mobile/src/main/res/values/arrays.xml
mobile/src/main/res/values/arrays.xml
+2
-2
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
...src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
+32
-32
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
...rd/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
+6
-7
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/ChatMessage.java
...ava/cn/garymb/ygomobile/ui/online/mcchat/ChatMessage.java
+73
-81
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/McchatActivity.java
.../cn/garymb/ygomobile/ui/online/mcchat/McchatActivity.java
+120
-128
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/SplashActivity.java
.../cn/garymb/ygomobile/ui/online/mcchat/SplashActivity.java
+148
-154
mobile/src/mycard/java/cn/garymb/ygomobile/ui/plus/X5WebView.java
...rc/mycard/java/cn/garymb/ygomobile/ui/plus/X5WebView.java
+58
-57
No files found.
mobile/assets/changelog.html
View file @
c52dd29f
<html>
<html>
<head>
<head>
<meta
http-equiv=
Content-Type
content=
"text/html;charset=utf-8"
>
<meta
http-equiv=
Content-Type
content=
"text/html;charset=utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<style
type=
"text/css"
>
<style
type=
"text/css"
>
pre
{
color
:
#01fcf3
;
padding
:
0.2em
;
white-space
:
pre-wrap
;
}
pre
{
color
:
#01fcf3
;
padding
:
0.2em
;
white-space
:
pre-wrap
;
}
</style>
</style>
</head>
</head>
<body
style=
"font-family: Droid Sans;background-color:transparent;"
>
<body
style=
"font-family: Droid Sans;background-color:transparent;"
>
...
@@ -16,7 +17,16 @@
...
@@ -16,7 +17,16 @@
特别感谢: 菜菜,尸体,废话多,大毛,龙道香姐,晓L,幻兽L 的支持与努力.
特别感谢: 菜菜,尸体,废话多,大毛,龙道香姐,晓L,幻兽L 的支持与努力.
</pre>
</pre>
<ul>
<ul>
<li
style=
"color:#ffff00"
>
3.3.1
</li>
<li
style=
"color:#ffff00"
>
3.3.2
</li>
</ul>
<pre>
更新:
1.更新ygo内核;
优化:
1.启动ygo时增加tips
</pre>
<ul>
<li
style=
"color:#ffffff"
>
3.3.1
</li>
</ul>
</ul>
<pre>
<pre>
更新:
更新:
...
@@ -179,14 +189,14 @@
...
@@ -179,14 +189,14 @@
3.残局录像中一些连锁中出现的闪退问题.
3.残局录像中一些连锁中出现的闪退问题.
</pre>
</pre>
<ul>
<ul>
<li
style=
"color:#ffffff"
>
3.1.2
</li>
<li
style=
"color:#ffffff"
>
3.1.2
</li>
</ul>
</ul>
<pre>
<pre>
更新:
更新:
1.更新ygo内核;
1.更新ygo内核;
2.更新LEDD+17PR+YS+YA新卡;
2.更新LEDD+17PR+YS+YA新卡;
</pre>
</pre>
<li
style=
"color:#ffffff"
>
3.1.1
</li>
<li
style=
"color:#ffffff"
>
3.1.1
</li>
</ul>
</ul>
<pre>
<pre>
更新:
更新:
...
...
mobile/src/main/java/cn/garymb/ygomobile/App.java
View file @
c52dd29f
...
@@ -18,7 +18,7 @@ public class App extends GameApplication {
...
@@ -18,7 +18,7 @@ public class App extends GameApplication {
@Override
@Override
public
NativeInitOptions
getNativeInitOptions
()
{
public
NativeInitOptions
getNativeInitOptions
()
{
NativeInitOptions
options
=
AppsSettings
.
get
().
getNativeInitOptions
();
NativeInitOptions
options
=
AppsSettings
.
get
().
getNativeInitOptions
();
return
options
;
return
options
;
}
}
...
@@ -88,23 +88,26 @@ public class App extends GameApplication {
...
@@ -88,23 +88,26 @@ public class App extends GameApplication {
public
boolean
canNdkCash
()
{
public
boolean
canNdkCash
()
{
return
false
;
return
false
;
}
}
@Override
@Override
public
boolean
isImmerSiveMode
()
{
public
boolean
isImmerSiveMode
()
{
return
AppsSettings
.
get
().
isImmerSiveMode
();
return
AppsSettings
.
get
().
isImmerSiveMode
();
}
}
public
boolean
isSensorRefresh
(){
public
boolean
isSensorRefresh
()
{
return
AppsSettings
.
get
().
isSensorRefresh
();
return
AppsSettings
.
get
().
isSensorRefresh
();
}
}
@Override
@Override
public
float
getScreenHeight
()
{
public
float
getScreenHeight
()
{
return
AppsSettings
.
get
().
getScreenHeight
();
return
AppsSettings
.
get
().
getScreenHeight
();
}
}
@Override
@Override
public
void
runWindbot
(
String
args
)
{
public
void
runWindbot
(
String
args
)
{
Intent
intent
=
new
Intent
();
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"args"
,
args
);
intent
.
putExtra
(
"args"
,
args
);
intent
.
setAction
(
"RUN_WINDBOT"
);
intent
.
setAction
(
"RUN_WINDBOT"
);
getBaseContext
().
sendBroadcast
(
intent
);
getBaseContext
().
sendBroadcast
(
intent
);
}
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
c52dd29f
...
@@ -13,11 +13,9 @@ import java.io.File;
...
@@ -13,11 +13,9 @@ import java.io.File;
import
java.io.FileFilter
;
import
java.io.FileFilter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
import
cn.garymb.ygomobile.core.GameConfig
;
import
cn.garymb.ygomobile.ui.preference.PreferenceFragmentPlus
;
import
cn.garymb.ygomobile.ui.preference.PreferenceFragmentPlus
;
import
cn.garymb.ygomobile.utils.SystemUtils
;
import
cn.garymb.ygomobile.utils.SystemUtils
;
import
ocgcore.handler.CardManager
;
import
ocgcore.handler.CardManager
;
...
@@ -35,7 +33,6 @@ import static cn.garymb.ygomobile.Constants.PREF_LOCK_SCREEN;
...
@@ -35,7 +33,6 @@ import static cn.garymb.ygomobile.Constants.PREF_LOCK_SCREEN;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_ONLY_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_ONLY_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_READ_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_READ_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_SENSOR_REFRESH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_SENSOR_REFRESH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_CHECK_UPDATE
;
public
class
AppsSettings
{
public
class
AppsSettings
{
private
static
AppsSettings
sAppsSettings
;
private
static
AppsSettings
sAppsSettings
;
...
@@ -171,7 +168,7 @@ public class AppsSettings {
...
@@ -171,7 +168,7 @@ public class AppsSettings {
Arrays
.
sort
(
cdbs
,
(
file
,
t1
)
->
{
Arrays
.
sort
(
cdbs
,
(
file
,
t1
)
->
{
return
file
.
getName
().
compareTo
(
t1
.
getName
());
return
file
.
getName
().
compareTo
(
t1
.
getName
());
});
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
//
//
}
}
for
(
File
file
:
cdbs
)
{
for
(
File
file
:
cdbs
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
c52dd29f
...
@@ -59,7 +59,7 @@ public interface Constants {
...
@@ -59,7 +59,7 @@ public interface Constants {
String
CORE_SKIN_PATH
=
"textures"
;
String
CORE_SKIN_PATH
=
"textures"
;
String
CORE_SKIN_PENDULUM_PATH
=
CORE_SKIN_PATH
+
"/extra"
;
String
CORE_SKIN_PENDULUM_PATH
=
CORE_SKIN_PATH
+
"/extra"
;
String
CORE_DECK_PATH
=
"deck"
;
String
CORE_DECK_PATH
=
"deck"
;
String
CORE_EXPANSIONS
=
"expansions"
;
String
CORE_EXPANSIONS
=
"expansions"
;
String
CORE_SINGLE_PATH
=
"single"
;
String
CORE_SINGLE_PATH
=
"single"
;
String
CORE_IMAGE_PATH
=
"pics"
;
String
CORE_IMAGE_PATH
=
"pics"
;
String
CORE_IMAGE_FIELD_PATH
=
"field"
;
String
CORE_IMAGE_FIELD_PATH
=
"field"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
c52dd29f
...
@@ -10,9 +10,9 @@ import android.widget.Toast;
...
@@ -10,9 +10,9 @@ import android.widget.Toast;
import
java.io.File
;
import
java.io.File
;
import
cn.garymb.ygodata.YGOGameOptions
;
import
cn.garymb.ygodata.YGOGameOptions
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.bean.Deck
;
import
cn.garymb.ygomobile.bean.Deck
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_DECK
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_DECK
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_GAME
;
...
@@ -54,7 +54,7 @@ public class GameUriManager {
...
@@ -54,7 +54,7 @@ public class GameUriManager {
Toast
.
makeText
(
getActivity
(),
R
.
string
.
start_game_error
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getActivity
(),
R
.
string
.
start_game_error
,
Toast
.
LENGTH_SHORT
).
show
();
activity
.
finish
();
activity
.
finish
();
}
}
}
else
{
}
else
{
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
View file @
c52dd29f
...
@@ -3,16 +3,13 @@ package cn.garymb.ygomobile;
...
@@ -3,16 +3,13 @@ package cn.garymb.ygomobile;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.pm.ActivityInfo
;
import
android.content.pm.ActivityInfo
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
android.graphics.Color
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.os.Build
;
import
android.os.Build
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -26,13 +23,9 @@ import java.io.File;
...
@@ -26,13 +23,9 @@ import java.io.File;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
cn.garymb.ygodata.YGOGameOptions
;
import
cn.garymb.ygodata.YGOGameOptions
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.YGOMobileActivity
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.plus.ViewTargetPlus
;
import
cn.garymb.ygomobile.ui.plus.ViewTargetPlus
;
import
cn.garymb.ygomobile.utils.ComponentUtils
;
import
cn.garymb.ygomobile.utils.ComponentUtils
;
import
cn.garymb.ygomobile.utils.ToastUtil
;
public
class
YGOStarter
{
public
class
YGOStarter
{
...
@@ -117,7 +110,7 @@ public class YGOStarter {
...
@@ -117,7 +110,7 @@ public class YGOStarter {
}
}
activityShowInfo
.
oldRequestedOrientation
=
activity
.
getRequestedOrientation
();
activityShowInfo
.
oldRequestedOrientation
=
activity
.
getRequestedOrientation
();
// Log.w("checker", "activityShowInfo.oldRequestedOrientation=" + activityShowInfo.oldRequestedOrientation);
// Log.w("checker", "activityShowInfo.oldRequestedOrientation=" + activityShowInfo.oldRequestedOrientation);
if
(
activityShowInfo
.
oldRequestedOrientation
==
ActivityInfo
.
SCREEN_ORIENTATION_UNSPECIFIED
)
{
if
(
activityShowInfo
.
oldRequestedOrientation
==
ActivityInfo
.
SCREEN_ORIENTATION_UNSPECIFIED
)
{
activityShowInfo
.
oldRequestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
;
activityShowInfo
.
oldRequestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_PORTRAIT
;
}
}
activityShowInfo
.
mRoot
=
activity
.
getWindow
().
getDecorView
();
activityShowInfo
.
mRoot
=
activity
.
getWindow
().
getDecorView
();
...
@@ -161,13 +154,11 @@ public class YGOStarter {
...
@@ -161,13 +154,11 @@ public class YGOStarter {
if
(
System
.
currentTimeMillis
()
-
lasttime
>=
1000
)
{
if
(
System
.
currentTimeMillis
()
-
lasttime
>=
1000
)
{
lasttime
=
System
.
currentTimeMillis
();
lasttime
=
System
.
currentTimeMillis
();
showLoadingBg
(
activity
);
showLoadingBg
(
activity
);
if
(!
ComponentUtils
.
isActivityRunning
(
activity
,
new
ComponentName
(
activity
,
YGOMobileActivity
.
class
)))
{
if
(!
ComponentUtils
.
isActivityRunning
(
activity
,
new
ComponentName
(
activity
,
YGOMobileActivity
.
class
)))
{
String
[]
tipsList
=
activity
.
getResources
().
getStringArray
(
R
.
array
.
tips
);
String
[]
tipsList
=
activity
.
getResources
().
getStringArray
(
R
.
array
.
tips
);
int
x
=(
int
)(
Math
.
random
()
*
tipsList
.
length
);
int
x
=
(
int
)
(
Math
.
random
()
*
tipsList
.
length
);
String
tips
=
tipsList
[
x
];
String
tips
=
tipsList
[
x
];
//Toast.makeText(activity, tips, Toast.LENGTH_LONG).show();
Toast
.
makeText
(
activity
,
tips
,
Toast
.
LENGTH_LONG
).
show
();
ToastUtil
toastUtil
=
new
ToastUtil
();
toastUtil
.
Short
(
activity
,
tips
).
setToastColor
(
Color
.
RED
,
activity
.
getResources
().
getColor
(
R
.
color
.
colorAccent
)).
show
();
}
}
Intent
intent
=
new
Intent
(
activity
,
YGOMobileActivity
.
class
);
Intent
intent
=
new
Intent
(
activity
,
YGOMobileActivity
.
class
);
if
(
options
!=
null
)
{
if
(
options
!=
null
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/bean/Deck.java
View file @
c52dd29f
...
@@ -161,21 +161,21 @@ public class Deck implements Parcelable {
...
@@ -161,21 +161,21 @@ public class Deck implements Parcelable {
}
}
public
void
addMain
(
Integer
id
)
{
public
void
addMain
(
Integer
id
)
{
if
(
mainlist
.
size
()>=
Constants
.
DECK_MAIN_MAX
)
{
if
(
mainlist
.
size
()
>=
Constants
.
DECK_MAIN_MAX
)
{
return
;
return
;
}
}
mainlist
.
add
(
id
);
mainlist
.
add
(
id
);
}
}
public
void
addExtra
(
Integer
id
)
{
public
void
addExtra
(
Integer
id
)
{
if
(
extraList
.
size
()>=
Constants
.
DECK_EXTRA_MAX
)
{
if
(
extraList
.
size
()
>=
Constants
.
DECK_EXTRA_MAX
)
{
return
;
return
;
}
}
extraList
.
add
(
id
);
extraList
.
add
(
id
);
}
}
public
void
addSide
(
Integer
id
)
{
public
void
addSide
(
Integer
id
)
{
if
(
sideList
.
size
()>=
Constants
.
DECK_SIDE_MAX
)
{
if
(
sideList
.
size
()
>=
Constants
.
DECK_SIDE_MAX
)
{
return
;
return
;
}
}
sideList
.
add
(
id
);
sideList
.
add
(
id
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/bean/ServerList.java
View file @
c52dd29f
...
@@ -7,7 +7,7 @@ import java.util.List;
...
@@ -7,7 +7,7 @@ import java.util.List;
@XmlElement
(
"servers"
)
@XmlElement
(
"servers"
)
public
class
ServerList
{
public
class
ServerList
{
@XmlElement
(
"version"
)
@XmlElement
(
"version"
)
private
int
vercode
=
0
;
private
int
vercode
=
0
;
@XmlElement
(
"server"
)
@XmlElement
(
"server"
)
private
List
<
ServerInfo
>
mServerInfoList
;
private
List
<
ServerInfo
>
mServerInfoList
;
...
@@ -19,9 +19,9 @@ public class ServerList {
...
@@ -19,9 +19,9 @@ public class ServerList {
return
vercode
;
return
vercode
;
}
}
public
ServerList
(
int
version
,
List
<
ServerInfo
>
serverInfoList
)
{
public
ServerList
(
int
version
,
List
<
ServerInfo
>
serverInfoList
)
{
mServerInfoList
=
serverInfoList
;
mServerInfoList
=
serverInfoList
;
this
.
vercode
=
version
;
this
.
vercode
=
version
;
}
}
public
List
<
ServerInfo
>
getServerInfoList
()
{
public
List
<
ServerInfo
>
getServerInfoList
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/adapters/ServerListAdapter.java
View file @
c52dd29f
...
@@ -3,14 +3,13 @@ package cn.garymb.ygomobile.ui.adapters;
...
@@ -3,14 +3,13 @@ package cn.garymb.ygomobile.ui.adapters;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.provider.Settings
;
import
android.provider.Settings
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.EventBus
;
import
cn.garymb.ygomobile.bean.ServerInfo
;
import
cn.garymb.ygomobile.bean.ServerInfo
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.bean.events.ServerInfoEvent
;
import
cn.garymb.ygomobile.bean.events.ServerInfoEvent
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.home.ServerInfoViewHolder
;
import
cn.garymb.ygomobile.ui.home.ServerInfoViewHolder
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
...
@@ -42,9 +41,9 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, Serve
...
@@ -42,9 +41,9 @@ public class ServerListAdapter extends BaseRecyclerAdapterPlus<ServerInfo, Serve
});
});
builder
.
show
();
builder
.
show
();
});
});
if
(
position
==
0
)
{
if
(
position
==
0
)
{
holder
.
iv_fond
.
setBackgroundResource
(
R
.
drawable
.
cube
);
holder
.
iv_fond
.
setBackgroundResource
(
R
.
drawable
.
cube
);
}
else
{
}
else
{
holder
.
iv_fond
.
setBackgroundResource
(
R
.
drawable
.
cube2
);
holder
.
iv_fond
.
setBackgroundResource
(
R
.
drawable
.
cube2
);
}
}
bindMenu
(
holder
,
position
);
bindMenu
(
holder
,
position
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
c52dd29f
...
@@ -56,8 +56,9 @@ import cn.garymb.ygomobile.ui.plus.ServiceDuelAssistant;
...
@@ -56,8 +56,9 @@ import cn.garymb.ygomobile.ui.plus.ServiceDuelAssistant;
import
cn.garymb.ygomobile.ui.preference.SettingsActivity
;
import
cn.garymb.ygomobile.ui.preference.SettingsActivity
;
import
cn.garymb.ygomobile.utils.AlipayPayUtils
;
import
cn.garymb.ygomobile.utils.AlipayPayUtils
;
abstract
class
HomeActivity
extends
BaseActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
{
abstract
class
HomeActivity
extends
BaseActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
{
protected
SwipeMenuRecyclerView
mServerList
;
protected
SwipeMenuRecyclerView
mServerList
;
long
exitLasttime
=
0
;
private
ServerListAdapter
mServerListAdapter
;
private
ServerListAdapter
mServerListAdapter
;
private
ServerListManager
mServerListManager
;
private
ServerListManager
mServerListManager
;
...
@@ -83,11 +84,11 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
...
@@ -83,11 +84,11 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
initBoomMenuButton
(
$
(
R
.
id
.
bmb
));
initBoomMenuButton
(
$
(
R
.
id
.
bmb
));
AnimationShake
();
AnimationShake
();
//trpay
//trpay
TrPay
.
getInstance
(
HomeActivity
.
this
).
initPaySdk
(
"e1014da420ea4405898c01273d6731b6"
,
"YGOMobile"
);
TrPay
.
getInstance
(
HomeActivity
.
this
).
initPaySdk
(
"e1014da420ea4405898c01273d6731b6"
,
"YGOMobile"
);
//autoupadte checking
//autoupadte checking
checkForceUpdateSilent
();
checkForceUpdateSilent
();
//ServiceDuelAssistant
//ServiceDuelAssistant
startService
(
new
Intent
(
this
,
ServiceDuelAssistant
.
class
));
startService
(
new
Intent
(
this
,
ServiceDuelAssistant
.
class
));
BtnJoinQQGroup
();
BtnJoinQQGroup
();
}
}
...
@@ -230,8 +231,6 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
...
@@ -230,8 +231,6 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
return
true
;
return
true
;
}
}
long
exitLasttime
=
0
;
@Override
@Override
public
void
onBackPressed
()
{
public
void
onBackPressed
()
{
if
(
System
.
currentTimeMillis
()
-
exitLasttime
<=
3000
)
{
if
(
System
.
currentTimeMillis
()
-
exitLasttime
<=
3000
)
{
...
@@ -378,17 +377,18 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
...
@@ -378,17 +377,18 @@ abstract class HomeActivity extends BaseActivity implements NavigationView.OnNav
UpdateHelper
.
getInstance
().
autoUpdate
(
getPackageName
(),
false
,
intervalMillis
);
UpdateHelper
.
getInstance
().
autoUpdate
(
getPackageName
(),
false
,
intervalMillis
);
}
}
public
void
AnimationShake
(){
public
void
AnimationShake
()
{
Animation
shake
=
AnimationUtils
.
loadAnimation
(
this
,
R
.
anim
.
shake
);
//加载动画资源文件
Animation
shake
=
AnimationUtils
.
loadAnimation
(
this
,
R
.
anim
.
shake
);
//加载动画资源文件
findViewById
(
R
.
id
.
cube
).
startAnimation
(
shake
);
//给组件播放动画效果
findViewById
(
R
.
id
.
cube
).
startAnimation
(
shake
);
//给组件播放动画效果
}
}
public
void
BtnJoinQQGroup
()
{
public
void
BtnJoinQQGroup
()
{
$
(
R
.
id
.
btn_join_qq_group
).
setOnClickListener
((
v
)
->
{
$
(
R
.
id
.
btn_join_qq_group
).
setOnClickListener
((
v
)
->
{
String
key
=
"dRkD2L9QgYiYmQoqJUgkR4QUth9UhuT4"
;
String
key
=
"dRkD2L9QgYiYmQoqJUgkR4QUth9UhuT4"
;
joinQQGroup
(
key
);
joinQQGroup
(
key
);
});
});
}
}
public
boolean
joinQQGroup
(
String
key
)
{
public
boolean
joinQQGroup
(
String
key
)
{
Intent
intent
=
new
Intent
();
Intent
intent
=
new
Intent
();
intent
.
setData
(
Uri
.
parse
(
"mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D"
+
key
));
intent
.
setData
(
Uri
.
parse
(
"mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D"
+
key
));
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ImageUpdater.java
View file @
c52dd29f
...
@@ -20,7 +20,6 @@ import java.util.zip.ZipFile;
...
@@ -20,7 +20,6 @@ import java.util.zip.ZipFile;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.CardLoader
;
import
cn.garymb.ygomobile.loader.CardLoader
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
...
@@ -355,7 +354,7 @@ public class ImageUpdater implements DialogInterface.OnCancelListener {
...
@@ -355,7 +354,7 @@ public class ImageUpdater implements DialogInterface.OnCancelListener {
}
}
String
jpg
=
new
File
(
picsPath
,
code
+
Constants
.
IMAGE_URL_EX
).
getAbsolutePath
();
String
jpg
=
new
File
(
picsPath
,
code
+
Constants
.
IMAGE_URL_EX
).
getAbsolutePath
();
String
jpgUrl
=
String
.
format
(
Constants
.
IMAGE_URL
,
code
+
""
);
String
jpgUrl
=
String
.
format
(
Constants
.
IMAGE_URL
,
code
+
""
);
mCardStatus
.
add
(
new
Item
(
jpgUrl
,
jpg
,
code
,
false
));
mCardStatus
.
add
(
new
Item
(
jpgUrl
,
jpg
,
code
,
false
));
}
}
mCount
=
mCardStatus
.
size
();
mCount
=
mCardStatus
.
size
();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
View file @
c52dd29f
...
@@ -120,11 +120,11 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -120,11 +120,11 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
AppsSettings
.
get
().
setUseExtraCards
(
false
);
AppsSettings
.
get
().
setUseExtraCards
(
false
);
}
}
}
}
/* if (needsUpdate) {
/* if (needsUpdate) {
* if(AppsSettings.get().resetGameVersion() == 0){
* if(AppsSettings.get().resetGameVersion() == 0){
* VUiKit.show(mContext, mContext.getString(R.string.reset_game_ver_fail));
* VUiKit.show(mContext, mContext.getString(R.string.reset_game_ver_fail));
* }
* }
* }*/
* }*/
//设置字体
//设置字体
new
ConfigManager
(
mSettings
.
getSystemConfig
()).
setFontSize
(
mSettings
.
getFontSize
());
new
ConfigManager
(
mSettings
.
getSystemConfig
()).
setFontSize
(
mSettings
.
getFontSize
());
// copyCoreConfig(new File(mSettings.getResourcePath(), GameSettings.CORE_CONFIG_PATH).getAbsolutePath());
// copyCoreConfig(new File(mSettings.getResourcePath(), GameSettings.CORE_CONFIG_PATH).getAbsolutePath());
...
@@ -153,17 +153,17 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -153,17 +153,17 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
}
}
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
cards_cdb
)));
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
cards_cdb
)));
copyCdbFile
(
needsUpdate
);
copyCdbFile
(
needsUpdate
);
if
(
IOUtils
.
hasAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
)))
{
if
(
IOUtils
.
hasAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
)))
{
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
images
)));
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
images
)));
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
),
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_PICS_ZIP
),
resPath
,
needsUpdate
);
resPath
,
needsUpdate
);
}
}
//if (needsUpdate) {
//if (needsUpdate) {
File
filesDir
=
mContext
.
getFilesDir
();
File
filesDir
=
mContext
.
getFilesDir
();
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
filesDir
.
getPath
(),
needsUpdate
);
filesDir
.
getPath
(),
needsUpdate
);
// }
// }
if
(
needsUpdate
)
{
if
(
needsUpdate
)
{
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
ex_pack
)));
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
ex_pack
)));
...
@@ -325,39 +325,41 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -325,39 +325,41 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
void
onResCheckFinished
(
int
result
,
boolean
isNewVersion
);
void
onResCheckFinished
(
int
result
,
boolean
isNewVersion
);
}
}
public
void
checkWindbot
(){
public
void
checkWindbot
()
{
Log
.
i
(
"路径"
,
mContext
.
getFilesDir
().
getPath
());
Log
.
i
(
"路径"
,
mContext
.
getFilesDir
().
getPath
());
Log
.
i
(
"路径2"
,
mSettings
.
getDataBasePath
()
+
"/"
+
DATABASE_NAME
);
Log
.
i
(
"路径2"
,
mSettings
.
getDataBasePath
()
+
"/"
+
DATABASE_NAME
);
WindBot
.
initAndroid
(
mContext
.
getFilesDir
().
getPath
(),
mSettings
.
getDataBasePath
()+
"/"
+
DATABASE_NAME
);
WindBot
.
initAndroid
(
mContext
.
getFilesDir
().
getPath
(),
mSettings
.
getDataBasePath
()
+
"/"
+
DATABASE_NAME
);
ResCheckTask
.
MessageReceiver
mReceiver
=
new
ResCheckTask
.
MessageReceiver
();
ResCheckTask
.
MessageReceiver
mReceiver
=
new
ResCheckTask
.
MessageReceiver
();
IntentFilter
filter
=
new
IntentFilter
();
IntentFilter
filter
=
new
IntentFilter
();
filter
.
addAction
(
"RUN_WINDBOT"
);
filter
.
addAction
(
"RUN_WINDBOT"
);
mContext
.
registerReceiver
(
mReceiver
,
filter
);
mContext
.
registerReceiver
(
mReceiver
,
filter
);
}
}
public
class
MessageReceiver
extends
BroadcastReceiver
{
public
class
MessageReceiver
extends
BroadcastReceiver
{
@Override
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
String
action
=
intent
.
getAction
();
if
(
action
.
equals
(
"RUN_WINDBOT"
))
{
if
(
action
.
equals
(
"RUN_WINDBOT"
))
{
String
args
=
intent
.
getStringExtra
(
"args"
);
String
args
=
intent
.
getStringExtra
(
"args"
);
WindBot
.
runAndroid
(
args
);
WindBot
.
runAndroid
(
args
);
}
}
}
}
};
Handler
han
=
new
Handler
(){
@Override
public
void
handleMessage
(
Message
msg
)
{
// TODO: Implement this method
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
){
case
0
:
checkWindbot
();
break
;
}
}
}
;
Handler
han
=
new
Handler
()
{
@Override
public
void
handleMessage
(
Message
msg
)
{
// TODO: Implement this method
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
)
{
case
0
:
checkWindbot
();
break
;
}
}
};
};
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ServerListManager.java
View file @
c52dd29f
package
cn.garymb.ygomobile.ui.home
;
package
cn.garymb.ygomobile.ui.home
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Context
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.helper.ItemTouchHelper
;
import
android.support.v7.widget.helper.ItemTouchHelper
;
...
@@ -100,7 +99,7 @@ public class ServerListManager {
...
@@ -100,7 +99,7 @@ public class ServerListManager {
public
void
showEditDialog
(
int
position
)
{
public
void
showEditDialog
(
int
position
)
{
final
boolean
isAdd
=
position
<
0
;
final
boolean
isAdd
=
position
<
0
;
final
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
final
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
dialog
.
setContentView
(
R
.
layout
.
dialog_server_edit
);
dialog
.
setContentView
(
R
.
layout
.
dialog_server_edit
);
dialog
.
show
();
dialog
.
show
();
ServerInfoViewHolder
editViewHolder
=
new
ServerInfoViewHolder
(
dialog
.
getContentView
());
ServerInfoViewHolder
editViewHolder
=
new
ServerInfoViewHolder
(
dialog
.
getContentView
());
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DefWebChromeClient.java
View file @
c52dd29f
package
cn.garymb.ygomobile.ui.plus
;
package
cn.garymb.ygomobile.ui.plus
;
import
android.util.Log
;
import
com.tencent.smtt.export.external.interfaces.ConsoleMessage
;
import
com.tencent.smtt.sdk.WebChromeClient
;
import
com.tencent.smtt.sdk.WebChromeClient
;
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) {
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DialogPlus.java
View file @
c52dd29f
...
@@ -23,7 +23,7 @@ import cn.garymb.ygomobile.ui.widget.WebViewPlus;
...
@@ -23,7 +23,7 @@ import cn.garymb.ygomobile.ui.widget.WebViewPlus;
import
static
android
.
view
.
WindowManager
.
LayoutParams
.
FIRST_SYSTEM_WINDOW
;
import
static
android
.
view
.
WindowManager
.
LayoutParams
.
FIRST_SYSTEM_WINDOW
;
public
class
DialogPlus
extends
Dialog
{
public
class
DialogPlus
extends
Dialog
{
public
static
final
int
TYPE_KEYGUARD
=
FIRST_SYSTEM_WINDOW
+
4
;
public
static
final
int
TYPE_KEYGUARD
=
FIRST_SYSTEM_WINDOW
+
4
;
private
Context
context
;
private
Context
context
;
private
LayoutInflater
mLayoutInflater
;
private
LayoutInflater
mLayoutInflater
;
private
View
mView
;
private
View
mView
;
...
@@ -163,7 +163,7 @@ public class DialogPlus extends Dialog {
...
@@ -163,7 +163,7 @@ public class DialogPlus extends Dialog {
@Override
@Override
public
void
setCancelable
(
boolean
flag
)
{
public
void
setCancelable
(
boolean
flag
)
{
super
.
setCancelable
(
flag
);
super
.
setCancelable
(
flag
);
if
(!
flag
)
{
if
(!
flag
)
{
closeView
.
setVisibility
(
View
.
INVISIBLE
);
closeView
.
setVisibility
(
View
.
INVISIBLE
);
}
}
}
}
...
@@ -183,7 +183,7 @@ public class DialogPlus extends Dialog {
...
@@ -183,7 +183,7 @@ public class DialogPlus extends Dialog {
@Override
@Override
public
void
setTitle
(
@Nullable
CharSequence
title
)
{
public
void
setTitle
(
@Nullable
CharSequence
title
)
{
setTitleText
(
title
==
null
?
null
:
title
.
toString
());
setTitleText
(
title
==
null
?
null
:
title
.
toString
());
if
(
TextUtils
.
isEmpty
(
title
))
{
if
(
TextUtils
.
isEmpty
(
title
))
{
hideTitleBar
();
hideTitleBar
();
}
}
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
View file @
c52dd29f
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/VUiKit.java
View file @
c52dd29f
...
@@ -2,7 +2,6 @@ package cn.garymb.ygomobile.ui.plus;
...
@@ -2,7 +2,6 @@ package cn.garymb.ygomobile.ui.plus;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.content.res.Resources
;
import
android.net.Uri
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Looper
;
import
android.util.TypedValue
;
import
android.util.TypedValue
;
...
@@ -12,8 +11,8 @@ import org.jdeferred.android.AndroidDeferredManager;
...
@@ -12,8 +11,8 @@ import org.jdeferred.android.AndroidDeferredManager;
/**
/**
* @author Lody
* @author Lody
*
<p>
* <p>
*
A set of tools for UI.
* A set of tools for UI.
*/
*/
public
class
VUiKit
{
public
class
VUiKit
{
private
static
final
AndroidDeferredManager
gDM
=
new
AndroidDeferredManager
();
private
static
final
AndroidDeferredManager
gDM
=
new
AndroidDeferredManager
();
...
@@ -23,6 +22,7 @@ public class VUiKit {
...
@@ -23,6 +22,7 @@ public class VUiKit {
public
static
AndroidDeferredManager
defer
()
{
public
static
AndroidDeferredManager
defer
()
{
return
gDM
;
return
gDM
;
}
}
public
static
int
dpToPx
(
Context
context
,
int
dp
)
{
public
static
int
dpToPx
(
Context
context
,
int
dp
)
{
return
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
dp
,
return
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
dp
,
context
.
getResources
().
getDisplayMetrics
());
context
.
getResources
().
getDisplayMetrics
());
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/AlipayPayUtils.java
View file @
c52dd29f
...
@@ -24,19 +24,19 @@ public class AlipayPayUtils {
...
@@ -24,19 +24,19 @@ public class AlipayPayUtils {
/***
/***
*支付宝
*支付宝
*/
*/
public
static
boolean
openAlipayPayPage
(
Context
context
,
String
qrcode
)
{
public
static
boolean
openAlipayPayPage
(
Context
context
,
String
qrcode
)
{
try
{
try
{
qrcode
=
URLEncoder
.
encode
(
ALIPAY_URL
,
"utf-8"
);
qrcode
=
URLEncoder
.
encode
(
ALIPAY_URL
,
"utf-8"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
}
}
try
{
try
{
final
String
alipayqr
=
"alipayqr://platformapi/startapp?saId=10000007&clientVersion=3.7.0.0718&qrcode="
+
qrcode
;
final
String
alipayqr
=
"alipayqr://platformapi/startapp?saId=10000007&clientVersion=3.7.0.0718&qrcode="
+
qrcode
;
openUri
(
context
,
alipayqr
+
"%3F_s%3Dweb-other&_t="
+
System
.
currentTimeMillis
());
openUri
(
context
,
alipayqr
+
"%3F_s%3Dweb-other&_t="
+
System
.
currentTimeMillis
());
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
false
;
return
false
;
}
}
private
static
void
openUri
(
Context
context
,
String
s
)
{
private
static
void
openUri
(
Context
context
,
String
s
)
{
...
@@ -48,7 +48,7 @@ public class AlipayPayUtils {
...
@@ -48,7 +48,7 @@ public class AlipayPayUtils {
/***
/***
*微信支付(图灵trpay)
*微信支付(图灵trpay)
*/
*/
public
static
void
inputMoney
(
Activity
activity
){
public
static
void
inputMoney
(
Activity
activity
)
{
DialogPlus
dialog
=
new
DialogPlus
(
activity
);
DialogPlus
dialog
=
new
DialogPlus
(
activity
);
dialog
.
setTitle
(
"输入微信捐赠金额(元)"
);
dialog
.
setTitle
(
"输入微信捐赠金额(元)"
);
EditText
editText
=
new
EditText
(
activity
);
EditText
editText
=
new
EditText
(
activity
);
...
@@ -61,12 +61,12 @@ public class AlipayPayUtils {
...
@@ -61,12 +61,12 @@ public class AlipayPayUtils {
dlg
.
dismiss
();
dlg
.
dismiss
();
});
});
dialog
.
setLeftButtonListener
((
dlg
,
s
)
->
{
dialog
.
setLeftButtonListener
((
dlg
,
s
)
->
{
String
message
=
editText
.
getText
().
toString
().
trim
();
String
message
=
editText
.
getText
().
toString
().
trim
();
if
(!
message
.
equals
(
""
))
{
if
(!
message
.
equals
(
""
))
{
long
money
=
Long
.
parseLong
(
message
);
long
money
=
Long
.
parseLong
(
message
);
if
(
money
!=
0
)
{
if
(
money
!=
0
)
{
money
=
money
*
100
;
money
=
money
*
100
;
WeChatPay
(
activity
,
money
);
WeChatPay
(
activity
,
money
);
dlg
.
dismiss
();
dlg
.
dismiss
();
}
}
}
}
...
@@ -74,16 +74,16 @@ public class AlipayPayUtils {
...
@@ -74,16 +74,16 @@ public class AlipayPayUtils {
}
}
public
static
void
WeChatPay
(
Activity
activity
,
Long
money
)
{
public
static
void
WeChatPay
(
Activity
activity
,
Long
money
)
{
String
id
=
UUID
.
randomUUID
()
+
""
;
String
id
=
UUID
.
randomUUID
()
+
""
;
String
notifyurl
=
"192.168.1.1"
;
String
notifyurl
=
"192.168.1.1"
;
TrPay
.
getInstance
(
activity
).
callWxPay
(
"感谢您对YGOMobile的支持"
,
id
,
money
,
""
,
notifyurl
,
AlipayPayUtils
.
getIMEI
(
activity
),
new
PayResultListener
()
{
TrPay
.
getInstance
(
activity
).
callWxPay
(
"感谢您对YGOMobile的支持"
,
id
,
money
,
""
,
notifyurl
,
AlipayPayUtils
.
getIMEI
(
activity
),
new
PayResultListener
()
{
public
void
onPayFinish
(
Context
context
,
String
outtradeno
,
int
resultCode
,
String
resultString
,
int
payType
,
Long
amount
,
String
tradename
){
public
void
onPayFinish
(
Context
context
,
String
outtradeno
,
int
resultCode
,
String
resultString
,
int
payType
,
Long
amount
,
String
tradename
)
{
if
(
resultCode
==
TrPayResult
.
RESULT_CODE_SUCC
.
getId
())
{
if
(
resultCode
==
TrPayResult
.
RESULT_CODE_SUCC
.
getId
())
{
}
else
if
(
resultCode
==
TrPayResult
.
RESULT_CODE_FAIL
.
getId
())
{
}
else
if
(
resultCode
==
TrPayResult
.
RESULT_CODE_FAIL
.
getId
())
{
}
}
}
}
});
});
}
}
public
static
String
getIMEI
(
Context
context
)
{
public
static
String
getIMEI
(
Context
context
)
{
...
@@ -91,5 +91,5 @@ public class AlipayPayUtils {
...
@@ -91,5 +91,5 @@ public class AlipayPayUtils {
String
imei
=
telephonyManager
.
getDeviceId
();
String
imei
=
telephonyManager
.
getDeviceId
();
return
imei
;
return
imei
;
}
}
}
}
mobile/src/main/java/cn/garymb/ygomobile/utils/StringUtils.java
View file @
c52dd29f
...
@@ -4,6 +4,7 @@ package cn.garymb.ygomobile.utils;
...
@@ -4,6 +4,7 @@ package cn.garymb.ygomobile.utils;
public
class
StringUtils
{
public
class
StringUtils
{
/**
/**
* 半角转全角
* 半角转全角
*
* @param input String.
* @param input String.
* @return 全角字符串.
* @return 全角字符串.
*/
*/
...
@@ -22,6 +23,7 @@ public class StringUtils {
...
@@ -22,6 +23,7 @@ public class StringUtils {
/**
/**
* 全角转半角
* 全角转半角
*
* @param input String.
* @param input String.
* @return 半角字符串
* @return 半角字符串
*/
*/
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/ToastUtil.java
deleted
100644 → 0
View file @
204a7f8d
package
cn.garymb.ygomobile.utils
;
import
android.content.Context
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
android.widget.Toast
;
/*ToastUtil toastUtil=new ToastUtil();
toastUtil.Short(MainActivity.this,"自定义message字体、背景色").setToastColor(Color.WHITE, getResources().getColor(R.color.colorAccent)).show();
*/
public
class
ToastUtil
{
private
Toast
toast
;
private
LinearLayout
toastView
;
/**
* 修改原布局的Toast
*/
public
ToastUtil
()
{
}
/**
* 完全自定义布局Toast
* @param context
* @param view
*/
public
ToastUtil
(
Context
context
,
View
view
,
int
duration
){
toast
=
new
Toast
(
context
);
toast
.
setView
(
view
);
toast
.
setDuration
(
duration
);
}
/**
* 向Toast中添加自定义view
* @param view
* @param postion
* @return
*/
public
ToastUtil
addView
(
View
view
,
int
postion
)
{
toastView
=
(
LinearLayout
)
toast
.
getView
();
toastView
.
addView
(
view
,
postion
);
return
this
;
}
/**
* 设置Toast字体及背景颜色
* @param messageColor
* @param backgroundColor
* @return
*/
public
ToastUtil
setToastColor
(
int
messageColor
,
int
backgroundColor
)
{
View
view
=
toast
.
getView
();
if
(
view
!=
null
){
TextView
message
=((
TextView
)
view
.
findViewById
(
android
.
R
.
id
.
message
));
message
.
setBackgroundColor
(
backgroundColor
);
message
.
setTextColor
(
messageColor
);
}
return
this
;
}
/**
* 设置Toast字体及背景
* @param messageColor
* @param background
* @return
*/
public
ToastUtil
setToastBackground
(
int
messageColor
,
int
background
)
{
View
view
=
toast
.
getView
();
if
(
view
!=
null
){
TextView
message
=((
TextView
)
view
.
findViewById
(
android
.
R
.
id
.
message
));
message
.
setBackgroundResource
(
background
);
message
.
setTextColor
(
messageColor
);
}
return
this
;
}
/**
* 短时间显示Toast
*/
public
ToastUtil
Short
(
Context
context
,
CharSequence
message
){
if
(
toast
==
null
||(
toastView
!=
null
&&
toastView
.
getChildCount
()>
1
)){
toast
=
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_SHORT
);
toastView
=
null
;
}
else
{
toast
.
setText
(
message
);
toast
.
setDuration
(
Toast
.
LENGTH_SHORT
);
}
return
this
;
}
/**
* 短时间显示Toast
*/
public
ToastUtil
Short
(
Context
context
,
int
message
)
{
if
(
toast
==
null
||(
toastView
!=
null
&&
toastView
.
getChildCount
()>
1
)){
toast
=
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_SHORT
);
toastView
=
null
;
}
else
{
toast
.
setText
(
message
);
toast
.
setDuration
(
Toast
.
LENGTH_SHORT
);
}
return
this
;
}
/**
* 长时间显示Toast
*/
public
ToastUtil
Long
(
Context
context
,
CharSequence
message
){
if
(
toast
==
null
||(
toastView
!=
null
&&
toastView
.
getChildCount
()>
1
)){
toast
=
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_LONG
);
toastView
=
null
;
}
else
{
toast
.
setText
(
message
);
toast
.
setDuration
(
Toast
.
LENGTH_LONG
);
}
return
this
;
}
/**
* 长时间显示Toast
*
* @param context
* @param message
*/
public
ToastUtil
Long
(
Context
context
,
int
message
)
{
if
(
toast
==
null
||(
toastView
!=
null
&&
toastView
.
getChildCount
()>
1
)){
toast
=
Toast
.
makeText
(
context
,
message
,
Toast
.
LENGTH_LONG
);
toastView
=
null
;
}
else
{
toast
.
setText
(
message
);
toast
.
setDuration
(
Toast
.
LENGTH_LONG
);
}
return
this
;
}
/**
* 自定义显示Toast时间
*
* @param context
* @param message
* @param duration
*/
public
ToastUtil
Indefinite
(
Context
context
,
CharSequence
message
,
int
duration
)
{
if
(
toast
==
null
||(
toastView
!=
null
&&
toastView
.
getChildCount
()>
1
)){
toast
=
Toast
.
makeText
(
context
,
message
,
duration
);
toastView
=
null
;
}
else
{
toast
.
setText
(
message
);
toast
.
setDuration
(
duration
);
}
return
this
;
}
/**
* 自定义显示Toast时间
*
* @param context
* @param message
* @param duration
*/
public
ToastUtil
Indefinite
(
Context
context
,
int
message
,
int
duration
)
{
if
(
toast
==
null
||(
toastView
!=
null
&&
toastView
.
getChildCount
()>
1
)){
toast
=
Toast
.
makeText
(
context
,
message
,
duration
);
toastView
=
null
;
}
else
{
toast
.
setText
(
message
);
toast
.
setDuration
(
duration
);
}
return
this
;
}
/**
* 显示Toast
* @return
*/
public
ToastUtil
show
(){
toast
.
show
();
return
this
;
}
/**
* 获取Toast
* @return
*/
public
Toast
getToast
(){
return
toast
;
}
}
mobile/src/main/java/cn/garymb/ygomobile/utils/XmlUtils.java
View file @
c52dd29f
package
cn.garymb.ygomobile.utils
;
package
cn.garymb.ygomobile.utils
;
import
android.util.Log
;
import
net.kk.xml.XmlOptions
;
import
net.kk.xml.XmlOptions
;
import
net.kk.xml.XmlReader
;
import
net.kk.xml.XmlReader
;
import
net.kk.xml.XmlWriter
;
import
net.kk.xml.XmlWriter
;
...
@@ -15,8 +13,6 @@ import java.io.File;
...
@@ -15,8 +13,6 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
public
class
XmlUtils
{
public
class
XmlUtils
{
public
static
boolean
DEBUG
=
false
;
public
static
boolean
DEBUG
=
false
;
...
...
mobile/src/main/res/values-ko/arrays.xml
View file @
c52dd29f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<string-array
name=
"opengl_version_value"
translatable=
"false"
>
<string-array
name=
"opengl_version_value"
translatable=
"false"
>
<item>
0
</item>
<item>
0
</item>
<item>
1
</item>
<item>
1
</item>
<item>
2
</item>
<item>
2
</item>
</string-array>
</string-array>
<string-array
name=
"card_quality_value"
translatable=
"false"
>
<string-array
name=
"card_quality_value"
translatable=
"false"
>
<item>
0
</item>
<item>
0
</item>
<item>
1
</item>
<item>
1
</item>
</string-array>
</string-array>
<string-array
name=
"tips"
>
<string-array
name=
"tips"
>
<item>
游戏王圈子不大,珍惜一起玩的人
</item>
<item>
상대에 대한 예의를 지켜 게임을 즐기십시오.
</item>
<item>
点击卡片却偏到另一张?试试去「设置」→打勾/取消「在游戏隐藏虚拟键」
</item>
<item>
설정에서 가상키를 끄고 킬 수 있습니다.
</item>
<item>
主页每个服务器按住左划就会出现「编辑」和「删除」哦
</item>
<item>
메인화면의 각 서버들은 좌측으로 밀어줄 경우 수정과 삭제가 가능합니다.
</item>
<item>
试试点击左下角浮动的「贤者之石」会有更多功能
</item>
<item>
좌측 하단의 마크를 눌러줄 경우 더 많은 설정들을 확인할 수 있습니다.
</item>
<item>
想不联网也打人机?左下角→「单人游戏」→「人机模式」
</item>
<item>
ai대전을 원할 경우 각 서버의 비밀번호에 ai를 입력후 참여 하십시오.
</item>
<item>
卡图怎么没了?点击左下角→「重置资源」
</item>
<item>
이미지 파일이 없어졌을 경우 리소스 리셋 기능을 사용하십시오.
</item>
<item>
卡组自己组更能享受游戏乐趣,自己组也更容易神抽哦
</item>
<item>
주변에서 같이 게임을 즐길 오프라인 친구들을 찾아 그룹을 만들어 보세요.
</item>
<item>
看到每个服务器右下的宝石了吗?点点看吧
</item>
<item>
서버들의 오른쪽에 있는 마크를 통해 서버 우선순위를 확인할 수 있습니다.
</item>
<item>
先行卡和正式卡密码不同,打了补丁要注意区分哦
</item>
<item>
몇몇 특수한 카드들을 제외하고 8자리 코드번호를 초과하는 카드들은 프리릴리즈 카드로, 프리릴리즈카드를 허용하는 서버 에서만 사용이 가능합니다.
</item>
<item>
觉得遇到BUG先确定是否真的是BUG再进行反馈哈
</item>
<item>
bug제보를 하기 전에 게임 진행 상황을 살펴보십시오. bug가 아닐 수 있습니다.
</item>
<item>
不懂怎么更新?去设置-「检查更新」看看
</item>
<item>
최신버전은 유무는 실탄은땅콩님에게 문의하십시오.
</item>
<item>
不知道怎么用,可以点开左下-「教程」查看使用方法
</item>
<item>
좌측 하단의 도움말을 통해 사용법을 알 수 있습니다.
</item>
<item>
维护开发不容易,欢迎前往左下角→「支持我们」留下您的心意
</item>
<item>
앱의 유지 보수를 위해 많은 시간과 노력이 필요합니다. 좌측하단의 마크를 통해 기부를 해주시면 감사하겠습니다.
</item>
<item>
没有所谓的“大师规则4”只有「新大师规则」哦
</item>
<item>
"마스터룰4"가 아니라 "뉴마스터룰"입니다.
</item>
<item>
录像出错就删了吧,暂时还没有解决办法
</item>
<item>
리플레이 오류는 보통 서버와 클라이언트의 스크립트 차이로 발생하며 마땅한 해결법은 아직 없습니다. 가능한 클라우드 리플레이를 이용해주십시오.
</item>
</string-array>
</string-array>
</resources>
</resources>
\ No newline at end of file
mobile/src/main/res/values-zh/arrays.xml
View file @
c52dd29f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<string-array
name=
"opengl_version_value"
translatable=
"false"
>
<string-array
name=
"opengl_version_value"
translatable=
"false"
>
<item>
0
</item>
<item>
0
</item>
<item>
1
</item>
<item>
1
</item>
<item>
2
</item>
<item>
2
</item>
</string-array>
</string-array>
<string-array
name=
"card_quality_value"
translatable=
"false"
>
<string-array
name=
"card_quality_value"
translatable=
"false"
>
<item>
0
</item>
<item>
0
</item>
<item>
1
</item>
<item>
1
</item>
</string-array>
</string-array>
<string-array
name=
"tips"
>
<string-array
name=
"tips"
>
<item>
游戏王圈子不大,珍惜一起玩的人
</item>
<item>
游戏王圈子不大,珍惜一起玩的人
</item>
<item>
点击卡片却偏到另一张
?试试去「设置」→打勾/取消「在游戏隐藏虚拟键」
</item>
<item>
界面偏了还点不准
?试试去「设置」→打勾/取消「在游戏隐藏虚拟键」
</item>
<item>
主页每个服务器按住左划就会出现「编辑」和「删除」哦
</item>
<item>
主页每个服务器按住左划就会出现「编辑」和「删除」哦
</item>
<item>
试试点击左下角浮动的「贤者之石」会有更多功能
</item>
<item>
试试点击左下角浮动的「贤者之石」会有更多功能
</item>
<item>
想不联网也打人机?左下角→「单人游戏」→「人机模式」
</item>
<item>
想不联网也打人机?左下角→「单人游戏」→「人机模式」
</item>
...
...
mobile/src/main/res/values/arrays.xml
View file @
c52dd29f
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<string-array
name=
"opengl_version_value"
translatable=
"false"
>
<string-array
name=
"opengl_version_value"
translatable=
"false"
>
<item>
0
</item>
<item>
0
</item>
<item>
1
</item>
<item>
1
</item>
<item>
2
</item>
<item>
2
</item>
</string-array>
</string-array>
<string-array
name=
"card_quality_value"
translatable=
"false"
>
<string-array
name=
"card_quality_value"
translatable=
"false"
>
<item>
0
</item>
<item>
0
</item>
<item>
1
</item>
<item>
1
</item>
</string-array>
</string-array>
...
...
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCard.java
View file @
c52dd29f
...
@@ -11,6 +11,8 @@ import android.util.Base64;
...
@@ -11,6 +11,8 @@ import android.util.Base64;
import
android.util.Log
;
import
android.util.Log
;
import
android.webkit.JavascriptInterface
;
import
android.webkit.JavascriptInterface
;
import
com.tencent.smtt.sdk.WebView
;
import
org.json.JSONArray
;
import
org.json.JSONArray
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
...
@@ -27,8 +29,6 @@ import cn.garymb.ygomobile.YGOStarter;
...
@@ -27,8 +29,6 @@ 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
com.tencent.smtt.sdk.*
;
import
static
junit
.
framework
.
Assert
.
assertEquals
;
import
static
junit
.
framework
.
Assert
.
assertEquals
;
public
class
MyCard
{
public
class
MyCard
{
...
@@ -79,10 +79,10 @@ public class MyCard {
...
@@ -79,10 +79,10 @@ public class MyCard {
mUser
.
avatar_url
=
info
.
getQueryParameter
(
"avatar_url"
);
mUser
.
avatar_url
=
info
.
getQueryParameter
(
"avatar_url"
);
mUser
.
admin
=
info
.
getBooleanQueryParameter
(
"admin"
,
false
);
mUser
.
admin
=
info
.
getBooleanQueryParameter
(
"admin"
,
false
);
mUser
.
moderator
=
info
.
getBooleanQueryParameter
(
"moderator"
,
false
);
mUser
.
moderator
=
info
.
getBooleanQueryParameter
(
"moderator"
,
false
);
lastModified
.
edit
().
putString
(
"user_external_id"
,
mUser
.
external_id
+
""
).
apply
();
lastModified
.
edit
().
putString
(
"user_external_id"
,
mUser
.
external_id
+
""
).
apply
();
lastModified
.
edit
().
putString
(
"user_name"
,
mUser
.
username
).
apply
();
lastModified
.
edit
().
putString
(
"user_name"
,
mUser
.
username
).
apply
();
//UserManagement.setUserName(mUser.username);
//UserManagement.setUserName(mUser.username);
//UserManagement.setUserPassword(mUser.external_id+"");
//UserManagement.setUserPassword(mUser.external_id+"");
mUser
.
login
=
true
;
mUser
.
login
=
true
;
if
(
getMyCardListener
()
!=
null
)
{
if
(
getMyCardListener
()
!=
null
)
{
getMyCardListener
().
onLogin
(
mUser
.
name
,
mUser
.
avatar_url
,
null
);
getMyCardListener
().
onLogin
(
mUser
.
name
,
mUser
.
avatar_url
,
null
);
...
@@ -262,11 +262,11 @@ public class MyCard {
...
@@ -262,11 +262,11 @@ public class MyCard {
}
}
/*
/*
* 列目录
* 列目录
* path: 文件夹路径
* path: 文件夹路径
* return: 文件名数组的 JSON 字符串
* return: 文件名数组的 JSON 字符串
* 失败抛异常或返回空数组
* 失败抛异常或返回空数组
*/
*/
@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
);
...
@@ -275,11 +275,11 @@ public class MyCard {
...
@@ -275,11 +275,11 @@ public class MyCard {
}
}
/*
/*
* 读取文件内容
* 读取文件内容
* path: 文件绝对路径
* path: 文件绝对路径
* return: 文件内容的 base64
* return: 文件内容的 base64
* 读取失败抛异常
* 读取失败抛异常
*/
*/
@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
);
...
@@ -291,11 +291,11 @@ public class MyCard {
...
@@ -291,11 +291,11 @@ public class MyCard {
}
}
/*
/*
* 写入内容到指定文件
* 写入内容到指定文件
* path: 文件路径
* path: 文件路径
* data: 文件内容的 base64
* data: 文件内容的 base64
* 写入失败抛异常
* 写入失败抛异常
*/
*/
@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
);
...
@@ -305,9 +305,9 @@ public class MyCard {
...
@@ -305,9 +305,9 @@ public class MyCard {
}
}
/*
/*
* 删除文件
* 删除文件
* 删除失败返回 false
* 删除失败返回 false
*/
*/
@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
);
...
@@ -316,11 +316,11 @@ public class MyCard {
...
@@ -316,11 +316,11 @@ public class MyCard {
}
}
/*
/*
* 获取文件修改时间
* 获取文件修改时间
* path: 文件绝对路径
* path: 文件绝对路径
* return: 修改时间
* return: 修改时间
* 文件不存在返回 0
* 文件不存在返回 0
*/
*/
@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
);
...
@@ -342,10 +342,10 @@ public class MyCard {
...
@@ -342,10 +342,10 @@ public class MyCard {
}
}
/*
/*
* 设置文件修改时间
* 设置文件修改时间
* path: 文件绝对路径
* path: 文件绝对路径
* time: 时间
* time: 时间
*/
*/
@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
);
...
...
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/MyCardActivity.java
View file @
c52dd29f
...
@@ -9,7 +9,6 @@ import android.support.annotation.Nullable;
...
@@ -9,7 +9,6 @@ import android.support.annotation.Nullable;
import
android.support.design.widget.NavigationView
;
import
android.support.design.widget.NavigationView
;
import
android.support.v4.widget.DrawerLayout
;
import
android.support.v4.widget.DrawerLayout
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.Gravity
;
import
android.view.Gravity
;
import
android.view.MenuItem
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.View
;
...
@@ -20,8 +19,9 @@ import android.widget.ProgressBar;
...
@@ -20,8 +19,9 @@ import android.widget.ProgressBar;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Glide
;
import
com.tencent.smtt.sdk.WebChromeClient
;
import
com.tencent.smtt.sdk.*
;
import
com.tencent.smtt.sdk.WebSettings
;
import
com.tencent.smtt.sdk.WebView
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
...
@@ -31,7 +31,6 @@ import cn.garymb.ygomobile.lite.R;
...
@@ -31,7 +31,6 @@ 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
{
...
@@ -189,7 +188,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -189,7 +188,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
mWebViewPlus
.
loadUrl
(
mMyCard
.
getBBSUrl
());
mWebViewPlus
.
loadUrl
(
mMyCard
.
getBBSUrl
());
break
;
break
;
case
R
.
id
.
action_chat
:
case
R
.
id
.
action_chat
:
startActivity
(
new
Intent
(
MyCardActivity
.
this
,
SplashActivity
.
class
));
startActivity
(
new
Intent
(
MyCardActivity
.
this
,
SplashActivity
.
class
));
break
;
break
;
default
:
default
:
return
false
;
return
false
;
...
@@ -200,7 +199,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -200,7 +199,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
@Override
@Override
public
void
onLogin
(
String
name
,
String
icon
,
String
statu
)
{
public
void
onLogin
(
String
name
,
String
icon
,
String
statu
)
{
if
(!
TextUtils
.
isEmpty
(
icon
))
{
if
(!
TextUtils
.
isEmpty
(
icon
))
{
Glide
.
with
(
this
).
load
(
Uri
.
parse
(
icon
)).
into
(
mHeadView
);
Glide
.
with
(
this
).
load
(
Uri
.
parse
(
icon
)).
into
(
mHeadView
);
}
}
mNameView
.
setText
(
name
);
mNameView
.
setText
(
name
);
...
@@ -260,7 +259,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
...
@@ -260,7 +259,7 @@ public class MyCardActivity extends BaseActivity implements MyCard.MyCardListene
return
false
;
return
false
;
}
}
public
void
ProgressBar
(){
public
void
ProgressBar
()
{
}
}
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/ChatMessage.java
View file @
c52dd29f
package
cn.garymb.ygomobile.ui.online.mcchat
;
package
cn.garymb.ygomobile.ui.online.mcchat
;
import
org.jivesoftware.smack.packet.Message
;
import
org.jivesoftware.smack.packet.Message
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.ServiceManagement
;
public
class
ChatMessage
{
public
class
ChatMessage
{
private
String
name
;
private
String
name
;
//private String time;
//private String time;
private
String
message
;
private
String
message
;
private
String
avatar
;
private
String
avatar
;
public
void
setAvatar
(
String
avatar
)
/*
{
public void setTime(String time)
this
.
avatar
=
avatar
;
{
}
this.time = time;
}
public
String
getAvatar
()
{
public String getTime()
return
avatar
;
{
}
return time;
}
public
void
setMessage
(
String
message
)
*/
{
public
static
ChatMessage
toChatMessage
(
Message
message
)
{
this
.
message
=
message
;
}
if
(
message
.
getBody
()
!=
null
)
{
String
xs
=
message
.
toXML
().
toString
();
public
String
getMessage
()
{
int
cc
=
xs
.
indexOf
(
"stamp='"
);
return
message
;
if
(
cc
!=
-
1
)
{
}
String
ss
=
xs
.
substring
(
cc
+
7
,
xs
.
indexOf
(
"'"
,
cc
+
7
));
}
else
{
public
void
setName
(
String
name
)
{
}
this
.
name
=
name
;
String
names
=
message
.
getFrom
().
toString
();
this
.
avatar
=
getAvatarUrl
(
name
);
String
name
=
names
.
substring
(
names
.
indexOf
(
ServiceManagement
.
GROUP_ADDRESS
)
+
ServiceManagement
.
GROUP_ADDRESS
.
length
()
+
1
,
names
.
length
());
}
ChatMessage
cm
=
new
ChatMessage
();
cm
.
setName
(
name
);
public
String
getName
()
//cm.setTime(ss);
{
cm
.
setMessage
(
message
.
getBody
());
return
name
;
return
cm
;
}
}
/*
return
null
;
public void setTime(String time)
}
{
this.time = time;
public
String
getAvatar
()
{
}
return
avatar
;
}
public String getTime()
{
public
void
setAvatar
(
String
avatar
)
{
return time;
this
.
avatar
=
avatar
;
}
}
*/
public
static
ChatMessage
toChatMessage
(
Message
message
){
public
String
getMessage
()
{
return
message
;
if
(
message
.
getBody
()!=
null
)
}
{
String
xs
=
message
.
toXML
().
toString
();
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
int
cc
=
xs
.
indexOf
(
"stamp='"
);
}
if
(
cc
!=-
1
){
String
ss
=
xs
.
substring
(
cc
+
7
,
xs
.
indexOf
(
"'"
,
cc
+
7
));
public
String
getName
()
{
}
else
{
return
name
;
}
}
String
names
=
message
.
getFrom
().
toString
();
public
void
setName
(
String
name
)
{
String
name
=
names
.
substring
(
names
.
indexOf
(
ServiceManagement
.
GROUP_ADDRESS
)+
ServiceManagement
.
GROUP_ADDRESS
.
length
()+
1
,
names
.
length
());
this
.
name
=
name
;
ChatMessage
cm
=
new
ChatMessage
();
this
.
avatar
=
getAvatarUrl
(
name
);
cm
.
setName
(
name
);
}
//cm.setTime(ss);
cm
.
setMessage
(
message
.
getBody
());
public
String
getAvatarUrl
(
String
userName
)
{
return
cm
;
return
"https://api.moecube.com/accounts/users/"
+
userName
+
".png"
;
}
}
return
null
;
}
}
public
String
getAvatarUrl
(
String
userName
){
return
"https://api.moecube.com/accounts/users/"
+
userName
+
".png"
;
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/McchatActivity.java
View file @
c52dd29f
package
cn.garymb.ygomobile.ui.online.mcchat
;
package
cn.garymb.ygomobile.ui.online.mcchat
;
import
android.app.*
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.os.*
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
org.jivesoftware.smack.packet.Message
;
import
org.jivesoftware.smack.packet.Message
;
import
android.widget.*
;
import
android.support.v7.widget.*
;
import
android.view.View.*
;
import
android.view.*
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.online.mcchat.adapter.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.adapter.ChatAdapter
;
import
cn.garymb.ygomobile.ui.online.mcchat.util.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.ServiceManagement
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.UserManagement
;
import
cn.garymb.ygomobile.ui.online.mcchat.util.Util
;
public
class
McchatActivity
extends
Activity
implements
ChatListener
{
public
class
McchatActivity
extends
Activity
implements
ChatListener
{
@Override
@Override
public
void
reLogin
(
boolean
state
)
public
void
reLogin
(
boolean
state
)
{
{
main_bottom_bar
.
setVisibility
(
View
.
GONE
);
main_bottom_bar
.
setVisibility
(
View
.
GONE
);
if
(
state
)
{
if
(
state
){
main_title
.
setText
(
"登录成功"
);
main_title
.
setText
(
"登录成功"
);
}
else
{
}
else
{
main_title
.
setText
(
"连接断开,重新登录中……"
);
main_title
.
setText
(
"连接断开,重新登录中……"
);
}
}
// TODO: Implement this method
// TODO: Implement this method
}
}
@Override
@Override
public
void
reJoin
(
boolean
state
)
{
public
void
reJoin
(
boolean
state
)
if
(
state
)
{
{
main_bottom_bar
.
setVisibility
(
View
.
VISIBLE
);
if
(
state
){
main_title
.
setText
(
getResources
().
getString
(
R
.
string
.
app_name
));
main_bottom_bar
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
main_title
.
setText
(
getResources
().
getString
(
R
.
string
.
app_name
));
main_bottom_bar
.
setVisibility
(
View
.
GONE
);
}
else
{
main_title
.
setText
(
"重新加入聊天室中……"
);
main_bottom_bar
.
setVisibility
(
View
.
GONE
);
}
main_title
.
setText
(
"重新加入聊天室中……"
);
// TODO: Implement this method
}
}
// TODO: Implement this method
}
@Override
public
void
addMessage
(
Message
message
)
{
@Override
cadp
.
sx
();
public
void
addMessage
(
Message
message
)
main_rec
.
smoothScrollToPosition
(
su
.
getData
().
size
()
-
1
);
{
cadp
.
sx
();
// TODO: Implement this method
main_rec
.
smoothScrollToPosition
(
su
.
getData
().
size
()-
1
);
}
// TODO: Implement this method
@Override
}
public
void
removeMessage
(
Message
message
)
{
// TODO: Implement this method
@Override
}
public
void
removeMessage
(
Message
message
)
{
// TODO: Implement this method
private
EditText
main_send_message
;
}
private
ImageButton
main_send
;
private
RecyclerView
main_rec
;
private
TextView
main_title
;
private
EditText
main_send_message
;
private
LinearLayout
main_bottom_bar
;
private
ImageButton
main_send
;
private
RecyclerView
main_rec
;
private
ChatAdapter
cadp
;
private
TextView
main_title
;
private
ServiceManagement
su
;
private
LinearLayout
main_bottom_bar
;
private
ChatAdapter
cadp
;
private
ServiceManagement
su
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
main
);
setContentView
(
R
.
layout
.
main
);
initView
();
initView
();
}
private
void
initView
()
{
main_rec
=
(
RecyclerView
)
findViewById
(
R
.
id
.
main_rec
);
main_send
=
(
ImageButton
)
findViewById
(
R
.
id
.
main_send
);
main_send_message
=
(
EditText
)
findViewById
(
R
.
id
.
main_send_message
);
main_title
=
(
TextView
)
findViewById
(
R
.
id
.
main_title
);
main_bottom_bar
=
(
LinearLayout
)
findViewById
(
R
.
id
.
main_bottom_bar
);
su
=
ServiceManagement
.
getDx
();
cadp
=
new
ChatAdapter
(
this
,
su
.
getData
());
su
.
addListener
(
this
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
McchatActivity
.
this
,
LinearLayoutManager
.
VERTICAL
,
false
);
linearLayoutManager
.
setStackFromEnd
(
true
);
//关键 设置此项,当软键盘弹出时,布局会自动顶上去,在结合AndroidManifest.xml设置属性
main_rec
.
setLayoutManager
(
linearLayoutManager
);
main_rec
.
setAdapter
(
cadp
);
initListener
();
// TODO: Implement this method
}
private
void
initListener
()
{
main_send
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
p1
)
{
String
message
=
main_send_message
.
getText
().
toString
().
trim
();
if
(
message
.
equals
(
""
))
{
Util
.
show
(
McchatActivity
.
this
,
getString
(
R
.
string
.
noting_to_send
));
}
else
{
try
{
su
.
sendMessage
(
message
);
main_send_message
.
setText
(
""
);
}
catch
(
Exception
e
)
{
Util
.
show
(
McchatActivity
.
this
,
getString
(
R
.
string
.
sending_failed
));
}
}
// TODO: Implement this method
}
});
// TODO: Implement this method
}
@Override
protected
void
onDestroy
()
{
// TODO: Implement this method
super
.
onDestroy
();
su
.
disClass
();
UserManagement
.
setUserName
(
null
);
UserManagement
.
setUserPassword
(
null
);
finish
();
}
}
private
void
initView
()
{
main_rec
=(
RecyclerView
)
findViewById
(
R
.
id
.
main_rec
);
main_send
=(
ImageButton
)
findViewById
(
R
.
id
.
main_send
);
main_send_message
=(
EditText
)
findViewById
(
R
.
id
.
main_send_message
);
main_title
=(
TextView
)
findViewById
(
R
.
id
.
main_title
);
main_bottom_bar
=(
LinearLayout
)
findViewById
(
R
.
id
.
main_bottom_bar
);
su
=
ServiceManagement
.
getDx
();
cadp
=
new
ChatAdapter
(
this
,
su
.
getData
());
su
.
addListener
(
this
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
McchatActivity
.
this
,
LinearLayoutManager
.
VERTICAL
,
false
);
linearLayoutManager
.
setStackFromEnd
(
true
);
//关键 设置此项,当软键盘弹出时,布局会自动顶上去,在结合AndroidManifest.xml设置属性
main_rec
.
setLayoutManager
(
linearLayoutManager
);
main_rec
.
setAdapter
(
cadp
);
initListener
();
// TODO: Implement this method
}
private
void
initListener
()
{
main_send
.
setOnClickListener
(
new
OnClickListener
(){
@Override
public
void
onClick
(
View
p1
)
{
String
message
=
main_send_message
.
getText
().
toString
().
trim
();
if
(
message
.
equals
(
""
)){
Util
.
show
(
McchatActivity
.
this
,
getString
(
R
.
string
.
noting_to_send
));
}
else
{
try
{
su
.
sendMessage
(
message
);
main_send_message
.
setText
(
""
);
}
catch
(
Exception
e
){
Util
.
show
(
McchatActivity
.
this
,
getString
(
R
.
string
.
sending_failed
));
}
}
// TODO: Implement this method
}
});
// TODO: Implement this method
}
@Override
protected
void
onDestroy
()
{
// TODO: Implement this method
super
.
onDestroy
();
su
.
disClass
();
UserManagement
.
setUserName
(
null
);
UserManagement
.
setUserPassword
(
null
);
finish
();
}
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/online/mcchat/SplashActivity.java
View file @
c52dd29f
package
cn.garymb.ygomobile.ui.online.mcchat
;
package
cn.garymb.ygomobile.ui.online.mcchat
;
import
android.app.*
;
import
android.os.*
;
import
android.app.Activity
;
import
android.content.*
;
import
android.content.Context
;
import
android.widget.*
;
import
android.content.Intent
;
import
android.view.*
;
import
android.content.SharedPreferences
;
import
android.view.View.*
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.widget.LinearLayout
;
import
android.widget.ProgressBar
;
import
android.widget.TextView
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.online.MyCardActivity
;
import
cn.garymb.ygomobile.ui.online.MyCardActivity
;
import
cn.garymb.ygomobile.ui.online.mcchat.util.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.ServiceManagement
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.*
;
import
cn.garymb.ygomobile.ui.online.mcchat.management.UserManagement
;
import
cn.garymb.ygomobile.ui.online.mcchat.util.Util
;
public
class
SplashActivity
extends
Activity
{
public
class
SplashActivity
extends
Activity
{
ServiceManagement
su
;
ServiceManagement
su
;
ProgressBar
sp_jz
;
ProgressBar
sp_jz
;
TextView
sp_tv
;
TextView
sp_tv
;
LinearLayout
sp_li
;
LinearLayout
sp_li
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
{
// TODO: Implement this method
// TODO: Implement this method
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_splash
);
setContentView
(
R
.
layout
.
activity_splash
);
initView
();
initView
();
/*String name=getIntent().getStringExtra("name");
/*String name=getIntent().getStringExtra("name");
String password=getIntent().getStringExtra("password");
String password=getIntent().getStringExtra("password");
UserManagement.setUserName(name);
UserManagement.setUserName(name);
UserManagement.setUserPassword(password);*/
UserManagement.setUserPassword(password);*/
//UserManagement.setUserName("废话多");
//UserManagement.setUserName("废话多");
//UserManagement.setUserPassword("19709");
//UserManagement.setUserPassword("19709");
SharedPreferences
lastModified
=
getSharedPreferences
(
"lastModified"
,
Context
.
MODE_PRIVATE
);
SharedPreferences
lastModified
=
getSharedPreferences
(
"lastModified"
,
Context
.
MODE_PRIVATE
);
UserManagement
.
setUserName
(
lastModified
.
getString
(
"user_name"
,
null
));
UserManagement
.
setUserName
(
lastModified
.
getString
(
"user_name"
,
null
));
UserManagement
.
setUserPassword
(
lastModified
.
getString
(
"user_external_id"
,
null
));
UserManagement
.
setUserPassword
(
lastModified
.
getString
(
"user_external_id"
,
null
));
su
=
ServiceManagement
.
getDx
();
su
=
ServiceManagement
.
getDx
();
join
();
join
();
}
}
private
void
join
()
private
void
join
()
{
{
if
(!
su
.
isListener
())
{
if
(!
su
.
isListener
())
new
Thread
(
new
Runnable
()
{
{
new
Thread
(
new
Runnable
(){
@Override
public
void
run
()
{
@Override
if
(!
su
.
isConnected
())
{
public
void
run
()
han
.
sendEmptyMessage
(
4
);
{
login
();
if
(!
su
.
isConnected
()){
}
han
.
sendEmptyMessage
(
4
);
if
(
su
.
isConnected
())
{
login
();
han
.
sendEmptyMessage
(
3
);
}
try
{
if
(
su
.
isConnected
()){
su
.
joinChat
();
han
.
sendEmptyMessage
(
3
);
han
.
sendEmptyMessage
(
1
);
try
}
catch
(
Exception
e
)
{
{
han
.
sendEmptyMessage
(
2
);
su
.
joinChat
();
}
han
.
sendEmptyMessage
(
1
);
}
}
// TODO: Implement this method
catch
(
Exception
e
)
}
{
}).
start
();
han
.
sendEmptyMessage
(
2
);
}
else
{
}
han
.
sendEmptyMessage
(
1
);
}
}
// TODO: Implement this method
// TODO: Implement this method
}
}
}).
start
();
}
else
{
private
void
initView
()
{
han
.
sendEmptyMessage
(
1
);
sp_jz
=
findViewById
(
R
.
id
.
sp_jz
);
}
sp_tv
=
findViewById
(
R
.
id
.
sp_tv
);
// TODO: Implement this method
sp_li
=
findViewById
(
R
.
id
.
sp_li
);
}
sp_li
.
setOnClickListener
(
new
OnClickListener
()
{
private
void
initView
()
{
@Override
sp_jz
=
findViewById
(
R
.
id
.
sp_jz
);
public
void
onClick
(
View
p1
)
{
sp_tv
=
findViewById
(
R
.
id
.
sp_tv
);
join
();
sp_li
=
findViewById
(
R
.
id
.
sp_li
);
// TODO: Implement this method
}
sp_li
.
setOnClickListener
(
new
OnClickListener
(){
});
@Override
// TODO: Implement this method
public
void
onClick
(
View
p1
)
}
{
join
();
private
void
login
()
{
// TODO: Implement this method
}
String
name
=
UserManagement
.
getUserName
();
});
String
password
=
UserManagement
.
getUserPassword
();
if
(
name
!=
null
&&
password
!=
null
)
{
// TODO: Implement this method
try
{
}
su
.
login
(
name
,
password
);
}
catch
(
Exception
e
)
{
private
void
login
()
Message
me
=
new
Message
();
{
me
.
obj
=
e
;
me
.
what
=
0
;
String
name
=
UserManagement
.
getUserName
();
han
.
sendMessage
(
me
);
String
password
=
UserManagement
.
getUserPassword
();
}
if
(
name
!=
null
&&
password
!=
null
)
}
else
{
{
han
.
sendEmptyMessage
(
5
);
try
}
{
su
.
login
(
name
,
password
);
// TODO: Implement this method
}
catch
(
Exception
e
){
}
Message
me
=
new
Message
();
me
.
obj
=
e
;
Handler
han
=
new
Handler
()
{
me
.
what
=
0
;
han
.
sendMessage
(
me
);
@Override
}
public
void
handleMessage
(
Message
msg
)
{
}
else
{
// TODO: Implement this method
han
.
sendEmptyMessage
(
5
);
super
.
handleMessage
(
msg
);
}
switch
(
msg
.
what
)
{
case
0
:
// TODO: Implement this method
su
.
setIsConnected
(
false
);
}
sp_jz
.
setVisibility
(
View
.
GONE
);
sp_tv
.
setText
(
getString
(
R
.
string
.
logining_failed
));
Handler
han
=
new
Handler
(){
Util
.
show
(
SplashActivity
.
this
,
getString
(
R
.
string
.
failed_reason
)
+
msg
.
obj
);
break
;
@Override
case
1
:
public
void
handleMessage
(
Message
msg
)
startActivity
(
new
Intent
(
SplashActivity
.
this
,
McchatActivity
.
class
));
{
finish
();
// TODO: Implement this method
break
;
super
.
handleMessage
(
msg
);
case
2
:
switch
(
msg
.
what
){
su
.
setIsListener
(
false
);
case
0
:
sp_jz
.
setVisibility
(
View
.
GONE
);
su
.
setIsConnected
(
false
);
sp_tv
.
setText
(
getString
(
R
.
string
.
logining_failed
));
sp_jz
.
setVisibility
(
View
.
GONE
);
break
;
sp_tv
.
setText
(
getString
(
R
.
string
.
logining_failed
));
case
3
:
Util
.
show
(
SplashActivity
.
this
,
getString
(
R
.
string
.
failed_reason
)+
msg
.
obj
);
sp_jz
.
setVisibility
(
View
.
VISIBLE
);
break
;
sp_tv
.
setText
(
getString
(
R
.
string
.
logining_in
));
case
1
:
break
;
startActivity
(
new
Intent
(
SplashActivity
.
this
,
McchatActivity
.
class
));
case
4
:
finish
();
sp_jz
.
setVisibility
(
View
.
VISIBLE
);
break
;
sp_tv
.
setText
(
getString
(
R
.
string
.
logining_in
));
case
2
:
break
;
su
.
setIsListener
(
false
);
case
5
:
sp_jz
.
setVisibility
(
View
.
GONE
);
sp_tv
.
setText
(
getString
(
R
.
string
.
logining_failed
));
break
;
case
3
:
sp_jz
.
setVisibility
(
View
.
VISIBLE
);
sp_tv
.
setText
(
getString
(
R
.
string
.
logining_in
));
break
;
case
4
:
sp_jz
.
setVisibility
(
View
.
VISIBLE
);
sp_tv
.
setText
(
getString
(
R
.
string
.
logining_in
));
break
;
case
5
:
/*sp_jz.setVisibility(View.GONE);
/*sp_jz.setVisibility(View.GONE);
sp_tv.setText("用户名或密码为空");*/
sp_tv.setText("用户名或密码为空");*/
startActivity
(
new
Intent
(
SplashActivity
.
this
,
MyCardActivity
.
class
));
startActivity
(
new
Intent
(
SplashActivity
.
this
,
MyCardActivity
.
class
));
finish
();
finish
();
break
;
break
;
}
}
}
}
};
};
}
}
mobile/src/mycard/java/cn/garymb/ygomobile/ui/plus/X5WebView.java
View file @
c52dd29f
package
cn.garymb.ygomobile.ui.plus
;
package
cn.garymb.ygomobile.ui.plus
;
import
android.annotation.*
;
import
android.annotation.SuppressLint
;
import
android.content.*
;
import
android.content.Context
;
import
android.graphics.*
;
import
android.graphics.Canvas
;
import
android.os.*
;
import
android.util.AttributeSet
;
import
android.util.*
;
import
android.view.View
;
import
android.view.*
;
import
android.widget.*
;
import
com.tencent.smtt.sdk.WebSettings
;
import
com.tencent.smtt.sdk.*
;
import
com.tencent.smtt.sdk.WebView
;
import
com.tencent.smtt.sdk.WebViewClient
;
public
class
X5WebView
extends
WebView
{
public
class
X5WebView
extends
WebView
{
private
WebViewClient
client
=
new
WebViewClient
()
{
private
WebViewClient
client
=
new
WebViewClient
()
{
/**
/**
* 防止加载网页时调起系统浏览器
* 防止加载网页时调起系统浏览器
*/
*/
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
view
.
loadUrl
(
url
);
view
.
loadUrl
(
url
);
return
true
;
return
true
;
}
}
};
};
@SuppressLint
(
"SetJavaScriptEnabled"
)
@SuppressLint
(
"SetJavaScriptEnabled"
)
public
X5WebView
(
Context
arg0
,
AttributeSet
arg1
)
{
public
X5WebView
(
Context
arg0
,
AttributeSet
arg1
)
{
super
(
arg0
,
arg1
);
super
(
arg0
,
arg1
);
this
.
setWebViewClient
(
client
);
this
.
setWebViewClient
(
client
);
// this.setWebChromeClient(chromeClient);
// this.setWebChromeClient(chromeClient);
// WebStorage webStorage = WebStorage.getInstance();
// WebStorage webStorage = WebStorage.getInstance();
initWebViewSettings
();
initWebViewSettings
();
this
.
getView
().
setClickable
(
true
);
this
.
getView
().
setClickable
(
true
);
}
}
private
void
initWebViewSettings
()
{
private
void
initWebViewSettings
()
{
WebSettings
webSetting
=
this
.
getSettings
();
WebSettings
webSetting
=
this
.
getSettings
();
webSetting
.
setJavaScriptEnabled
(
true
);
webSetting
.
setJavaScriptEnabled
(
true
);
webSetting
.
setJavaScriptCanOpenWindowsAutomatically
(
true
);
webSetting
.
setJavaScriptCanOpenWindowsAutomatically
(
true
);
webSetting
.
setAllowFileAccess
(
true
);
webSetting
.
setAllowFileAccess
(
true
);
//webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
//webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
webSetting
.
setSupportZoom
(
true
);
webSetting
.
setSupportZoom
(
true
);
webSetting
.
setBuiltInZoomControls
(
true
);
webSetting
.
setBuiltInZoomControls
(
true
);
webSetting
.
setUseWideViewPort
(
true
);
webSetting
.
setUseWideViewPort
(
true
);
webSetting
.
setSupportMultipleWindows
(
false
);
webSetting
.
setSupportMultipleWindows
(
false
);
// webSetting.setLoadWithOverviewMode(true);
// webSetting.setLoadWithOverviewMode(true);
webSetting
.
setAppCacheEnabled
(
true
);
webSetting
.
setAppCacheEnabled
(
true
);
// webSetting.setDatabaseEnabled(true);
// webSetting.setDatabaseEnabled(true);
webSetting
.
setDomStorageEnabled
(
true
);
webSetting
.
setDomStorageEnabled
(
true
);
webSetting
.
setGeolocationEnabled
(
true
);
webSetting
.
setGeolocationEnabled
(
true
);
webSetting
.
setAppCacheMaxSize
(
Long
.
MAX_VALUE
);
webSetting
.
setAppCacheMaxSize
(
Long
.
MAX_VALUE
);
// webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
// webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
webSetting
.
setPluginState
(
WebSettings
.
PluginState
.
ON_DEMAND
);
webSetting
.
setPluginState
(
WebSettings
.
PluginState
.
ON_DEMAND
);
// webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
// webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
webSetting
.
setCacheMode
(
WebSettings
.
LOAD_NO_CACHE
);
webSetting
.
setCacheMode
(
WebSettings
.
LOAD_NO_CACHE
);
webSetting
.
setDatabaseEnabled
(
true
);
webSetting
.
setDatabaseEnabled
(
true
);
webSetting
.
setPluginState
(
WebSettings
.
PluginState
.
ON_DEMAND
);
webSetting
.
setPluginState
(
WebSettings
.
PluginState
.
ON_DEMAND
);
}
}
@Override
@Override
protected
boolean
drawChild
(
Canvas
canvas
,
View
child
,
long
drawingTime
)
{
protected
boolean
drawChild
(
Canvas
canvas
,
View
child
,
long
drawingTime
)
{
/*boolean ret = super.drawChild(canvas, child, drawingTime);
/*boolean ret = super.drawChild(canvas, child, drawingTime);
canvas.save();
canvas.save();
Paint paint = new Paint();
Paint paint = new Paint();
...
@@ -77,13 +78,13 @@ public class X5WebView extends WebView {
...
@@ -77,13 +78,13 @@ public class X5WebView extends WebView {
canvas.drawText(Build.MODEL, 10, 200, paint);
canvas.drawText(Build.MODEL, 10, 200, paint);
canvas.restore();
canvas.restore();
return ret;*/
return ret;*/
return
super
.
drawChild
(
canvas
,
child
,
drawingTime
);
return
super
.
drawChild
(
canvas
,
child
,
drawingTime
);
}
}
public
X5WebView
(
Context
arg0
)
{
public
X5WebView
(
Context
arg0
)
{
super
(
arg0
);
super
(
arg0
);
setBackgroundColor
(
85621
);
setBackgroundColor
(
85621
);
}
}
}
}
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