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
cf4c3ac0
Commit
cf4c3ac0
authored
Aug 29, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
eb400ab3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
44 deletions
+50
-44
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+50
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
...c/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
+0
-44
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
cf4c3ac0
package
cn.garymb.ygomobile.ui.home
;
package
cn.garymb.ygomobile.ui.home
;
import
android.content.BroadcastReceiver
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
java.io.FileNotFoundException
;
import
java.io.FileNotFoundException
;
...
@@ -26,9 +31,11 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
...
@@ -26,9 +31,11 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
import
cn.garymb.ygomobile.utils.ComponentUtils
;
import
cn.garymb.ygomobile.utils.ComponentUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.NetUtils
;
import
cn.garymb.ygomobile.utils.NetUtils
;
import
libwindbot.windbot.WindBot
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_RELOAD
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_RELOAD
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_PICS_ZIP
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_PICS_ZIP
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DATABASE_NAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
NETWORK_IMAGE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
NETWORK_IMAGE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEF_GAME_DIR
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEF_GAME_DIR
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
ResCheckTask
.
getDatapath
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
ResCheckTask
.
getDatapath
;
...
@@ -42,6 +49,8 @@ public class MainActivity extends HomeActivity {
...
@@ -42,6 +49,8 @@ public class MainActivity extends HomeActivity {
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
YGOStarter
.
onCreated
(
this
);
YGOStarter
.
onCreated
(
this
);
//checkWindbot();
han
.
sendEmptyMessage
(
0
);
mImageUpdater
=
new
ImageUpdater
(
this
);
mImageUpdater
=
new
ImageUpdater
(
this
);
//资源复制
//资源复制
checkResourceDownload
((
error
,
isNew
)
->
{
checkResourceDownload
((
error
,
isNew
)
->
{
...
@@ -87,6 +96,7 @@ public class MainActivity extends HomeActivity {
...
@@ -87,6 +96,7 @@ public class MainActivity extends HomeActivity {
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
YGOStarter
.
onDestroy
(
this
);
YGOStarter
.
onDestroy
(
this
);
super
.
onDestroy
();
super
.
onDestroy
();
unregisterReceiver
(
mReceiver
);
}
}
@Override
@Override
...
@@ -152,4 +162,44 @@ public class MainActivity extends HomeActivity {
...
@@ -152,4 +162,44 @@ public class MainActivity extends HomeActivity {
/* checkResourceDownload((result, isNewVersion) -> {
/* checkResourceDownload((result, isNewVersion) -> {
Toast.makeText(this, R.string.tip_reset_game_res, Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.tip_reset_game_res, Toast.LENGTH_SHORT).show();
});*/
});*/
public
class
MessageReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
if
(
action
.
equals
(
"RUN_WINDBOT"
))
{
String
args
=
intent
.
getStringExtra
(
"args"
);
WindBot
.
runAndroid
(
args
);
}
}
}
public
void
checkWindbot
()
{
try
{
WindBot
.
initAndroid
(
getFilesDir
().
getPath
(),
AppsSettings
.
get
().
getDataBasePath
()
+
"/"
+
DATABASE_NAME
);
}
catch
(
Throwable
e
){
e
.
printStackTrace
();
}
MessageReceiver
mReceiver
=
new
MessageReceiver
();
IntentFilter
filter
=
new
IntentFilter
();
filter
.
addAction
(
"RUN_WINDBOT"
);
registerReceiver
(
mReceiver
,
filter
);
}
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/ResCheckTask.java
View file @
cf4c3ac0
...
@@ -170,10 +170,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -170,10 +170,6 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_EXPANSIONS
),
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_EXPANSIONS
),
mSettings
.
getExpansionsPath
().
getAbsolutePath
(),
true
,
needsUpdate
);
mSettings
.
getExpansionsPath
().
getAbsolutePath
(),
true
,
needsUpdate
);
}
}
//checkWindbot();
han
.
sendEmptyMessage
(
0
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
Constants
.
DEBUG
)
if
(
Constants
.
DEBUG
)
Log
.
e
(
TAG
,
"check"
,
e
);
Log
.
e
(
TAG
,
"check"
,
e
);
...
@@ -324,44 +320,4 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -324,44 +320,4 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
public
interface
ResCheckListener
{
public
interface
ResCheckListener
{
void
onResCheckFinished
(
int
result
,
boolean
isNewVersion
);
void
onResCheckFinished
(
int
result
,
boolean
isNewVersion
);
}
}
public
void
checkWindbot
()
{
Log
.
i
(
"路径"
,
mContext
.
getFilesDir
().
getPath
());
Log
.
i
(
"路径2"
,
mSettings
.
getDataBasePath
()
+
"/"
+
DATABASE_NAME
);
try
{
WindBot
.
initAndroid
(
mContext
.
getFilesDir
().
getPath
(),
mSettings
.
getDataBasePath
()
+
"/"
+
DATABASE_NAME
);
}
catch
(
Throwable
e
){
e
.
printStackTrace
();
}
ResCheckTask
.
MessageReceiver
mReceiver
=
new
ResCheckTask
.
MessageReceiver
();
IntentFilter
filter
=
new
IntentFilter
();
filter
.
addAction
(
"RUN_WINDBOT"
);
mContext
.
registerReceiver
(
mReceiver
,
filter
);
}
public
class
MessageReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
if
(
action
.
equals
(
"RUN_WINDBOT"
))
{
String
args
=
intent
.
getStringExtra
(
"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
;
}
}
};
}
}
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