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
786c3215
Commit
786c3215
authored
Jul 19, 2021
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open yrp
parent
4523dd9d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
52 deletions
+94
-52
libcore/android/android_tools.cpp
libcore/android/android_tools.cpp
+47
-29
libcore/android/android_tools.h
libcore/android/android_tools.h
+2
-0
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+37
-17
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
...rc/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
+2
-0
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
+6
-6
No files found.
libcore/android/android_tools.cpp
View file @
786c3215
...
...
@@ -63,7 +63,7 @@ irr::io::path getExternalStorageDir(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -95,7 +95,7 @@ irr::io::path getExternalFilesDir(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -125,7 +125,7 @@ float getScreenHeight(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -150,7 +150,7 @@ float getScreenWidth(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -175,7 +175,7 @@ irr::io::path getDBDir(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -204,7 +204,7 @@ irr::io::path getCardImagePath(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -233,7 +233,7 @@ irr::io::path getCoreConfigVersion(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -261,7 +261,7 @@ int getOpenglVersion(ANDROID_APP app) {
int
ret
=
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -285,7 +285,7 @@ int getCardQuality(ANDROID_APP app) {
int
ret
=
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -310,7 +310,7 @@ irr::io::path getFontPath(ANDROID_APP app) {
irr
::
io
::
path
ret
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -338,7 +338,7 @@ irr::io::path getResourcePath(ANDROID_APP app) {
irr
::
io
::
path
ret
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -366,7 +366,7 @@ float getXScale(ANDROID_APP app){
float
ret
=
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -390,7 +390,7 @@ float getYScale(ANDROID_APP app){
float
ret
=
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -424,7 +424,7 @@ irr::io::path getSetting(ANDROID_APP app, const char* key) {
irr
::
io
::
path
ret
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -468,7 +468,7 @@ void setLastCategory(ANDROID_APP app, const char* catename) {
int
getIntSetting
(
ANDROID_APP
app
,
const
char
*
key
,
int
defvalue
){
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
defvalue
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
defvalue
;
...
...
@@ -496,7 +496,7 @@ int getIntSetting(ANDROID_APP app, const char* key,int defvalue){
void
saveIntSetting
(
ANDROID_APP
app
,
const
char
*
key
,
int
value
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
;
...
...
@@ -522,7 +522,7 @@ void saveIntSetting(ANDROID_APP app, const char* key, int value) {
void
saveSetting
(
ANDROID_APP
app
,
const
char
*
key
,
const
char
*
value
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
;
...
...
@@ -553,7 +553,7 @@ bool perfromTrick(ANDROID_APP app) {
bool
ret
=
true
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
false
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
false
;
...
...
@@ -582,7 +582,7 @@ bool getFontAntiAlias(ANDROID_APP app) {
bool
ret
=
true
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
true
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
true
;
...
...
@@ -611,7 +611,7 @@ bool getFontAntiAlias(ANDROID_APP app) {
void
perfromHapticFeedback
(
ANDROID_APP
app
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
;
...
...
@@ -629,7 +629,7 @@ irr::io::path getCacheDir(ANDROID_APP app) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
ret
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
ret
;
...
...
@@ -662,7 +662,7 @@ irr::io::path getCacheDir(ANDROID_APP app) {
void
toggleIME
(
ANDROID_APP
app
,
bool
pShow
,
const
char
*
hint
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
// Retrieves NativeActivity.
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
...
...
@@ -686,7 +686,7 @@ void toggleGlobalIME(ANDROID_APP app, bool pShow) {
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jint
lFlags
=
2
;
...
...
@@ -752,7 +752,7 @@ void toggleGlobalIME(ANDROID_APP app, bool pShow) {
core
::
position2di
initJavaBridge
(
ANDROID_APP
app
,
void
*
handle
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
core
::
position2di
(
0
,
0
);
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
...
@@ -777,7 +777,7 @@ core::position2di initJavaBridge(ANDROID_APP app, void* handle) {
InitOptions
*
getInitOptions
(
ANDROID_APP
app
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
NULL
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
...
@@ -795,7 +795,7 @@ int getLocalAddr(ANDROID_APP app) {
int
addr
=
-
1
;
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
addr
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
...
@@ -807,11 +807,29 @@ int getLocalAddr(ANDROID_APP app) {
return
addr
;
}
void
OnShareFile
(
ANDROID_APP
app
,
char
*
title
,
char
*
path
){
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
nullptr
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
jmethodID
MethodGetAddr
=
jni
->
GetMethodID
(
ClassNativeActivity
,
"shareFile"
,
"(Ljava/lang/String;Ljava/lang/String;)V"
);
jstring
s_title
=
jni
->
NewStringUTF
(
title
);
jstring
s_path
=
jni
->
NewStringUTF
(
path
);
jni
->
CallVoidMethod
(
lNativeActivity
,
MethodGetAddr
,
s_title
,
s_path
);
jni
->
ReleaseStringUTFChars
(
s_title
,
title
);
jni
->
ReleaseStringUTFChars
(
s_path
,
path
);
jni
->
DeleteLocalRef
(
ClassNativeActivity
);
app
->
activity
->
vm
->
DetachCurrentThread
();
}
void
showAndroidComboBoxCompat
(
ANDROID_APP
app
,
bool
pShow
,
char
**
pContents
,
int
count
,
int
mode
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
...
@@ -834,7 +852,7 @@ void showAndroidComboBoxCompat(ANDROID_APP app, bool pShow, char** pContents,
void
toggleOverlayView
(
ANDROID_APP
app
,
bool
pShow
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
jobject
lNativeActivity
=
app
->
activity
->
clazz
;
jclass
ClassNativeActivity
=
jni
->
GetObjectClass
(
lNativeActivity
);
...
...
@@ -956,7 +974,7 @@ bool android_deck_delete(const char* deck_name) {
void
runWindbot
(
ANDROID_APP
app
,
const
char
*
args
)
{
if
(
!
app
||
!
app
->
activity
||
!
app
->
activity
->
vm
)
return
;
JNIEnv
*
jni
=
0
;
JNIEnv
*
jni
=
nullptr
;
app
->
activity
->
vm
->
AttachCurrentThread
(
&
jni
,
NULL
);
if
(
!
jni
)
return
;
...
...
libcore/android/android_tools.h
View file @
786c3215
...
...
@@ -98,6 +98,8 @@ extern float getScreenWidth(ANDROID_APP app);
extern
float
getScreenHeight
(
ANDROID_APP
app
);
extern
void
OnShareFile
(
ANDROID_APP
app
,
char
*
title
,
char
*
path
);
// Get SDCard path.
extern
irr
::
io
::
path
getExternalStorageDir
(
ANDROID_APP
app
);
...
...
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
786c3215
...
...
@@ -6,8 +6,10 @@
*/
package
cn.garymb.ygomobile
;
import
android.app.AlertDialog
;
import
android.app.NativeActivity
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.pm.ActivityInfo
;
import
android.content.res.Resources
;
...
...
@@ -58,6 +60,9 @@ public class YGOMobileActivity extends NativeActivity implements
private
static
final
int
CHAIN_CONTROL_PANEL_X_POSITION_LEFT_EDGE
=
205
;
private
static
final
int
CHAIN_CONTROL_PANEL_Y_REVERT_POSITION
=
100
;
private
static
final
int
MAX_REFRESH
=
30
*
1000
;
private
static
int
sChainControlXPostion
=
-
1
;
private
static
int
sChainControlYPostion
=
-
1
;
private
static
boolean
USE_SURFACE
=
true
;
protected
final
int
windowsFlags
=
Build
.
VERSION
.
SDK_INT
>=
19
?
(
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
...
...
@@ -66,7 +71,6 @@ public class YGOMobileActivity extends NativeActivity implements
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_IMMERSIVE_STICKY
)
:
View
.
SYSTEM_UI_FLAG_LOW_PROFILE
;
protected
View
mContentView
;
protected
ComboBoxCompat
mGlobalComboBox
;
protected
EditWindowCompat
mGlobalEditText
;
...
...
@@ -76,8 +80,6 @@ public class YGOMobileActivity extends NativeActivity implements
private
NetworkController
mNetController
;
private
volatile
boolean
mOverlayShowRequest
=
false
;
private
volatile
int
mCompatGUIMode
;
private
static
int
sChainControlXPostion
=
-
1
;
private
static
int
sChainControlYPostion
=
-
1
;
private
GameApplication
mApp
;
private
Handler
handler
=
new
Handler
();
private
FullScreenUtils
mFullScreenUtils
;
...
...
@@ -85,10 +87,12 @@ public class YGOMobileActivity extends NativeActivity implements
private
FrameLayout
mLayout
;
private
SurfaceView
mSurfaceView
;
private
boolean
replaced
=
false
;
private
static
boolean
USE_SURFACE
=
true
;
private
String
[]
mArgV
;
// public static int notchHeight;
//电池管理
private
PowerManager
mPM
;
private
PowerManager
.
WakeLock
mLock
;
private
GameApplication
app
()
{
if
(
mApp
==
null
)
{
...
...
@@ -108,14 +112,14 @@ public class YGOMobileActivity extends NativeActivity implements
@SuppressWarnings
(
"WrongConstant"
)
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
if
(
USE_SURFACE
)
{
if
(
USE_SURFACE
)
{
mSurfaceView
=
new
SurfaceView
(
this
);
}
mFullScreenUtils
=
new
FullScreenUtils
(
this
,
app
().
isImmerSiveMode
());
mFullScreenUtils
.
fullscreen
();
mFullScreenUtils
.
onCreate
();
super
.
onCreate
(
savedInstanceState
);
Log
.
e
(
"YGOStarter"
,
"跳转完成"
+
System
.
currentTimeMillis
());
Log
.
e
(
"YGOStarter"
,
"跳转完成"
+
System
.
currentTimeMillis
());
if
(
sChainControlXPostion
<
0
)
{
initPostion
();
}
...
...
@@ -131,14 +135,10 @@ public class YGOMobileActivity extends NativeActivity implements
.
setPackage
(
getPackageName
()));
}
//电池管理
private
PowerManager
mPM
;
private
PowerManager
.
WakeLock
mLock
;
@Override
protected
void
onResume
()
{
super
.
onResume
();
Log
.
e
(
"YGOStarter"
,
"ygo显示"
+
System
.
currentTimeMillis
());
Log
.
e
(
"YGOStarter"
,
"ygo显示"
+
System
.
currentTimeMillis
());
if
(
mLock
==
null
)
{
if
(
mPM
==
null
)
{
mPM
=
(
PowerManager
)
getSystemService
(
POWER_SERVICE
);
...
...
@@ -232,7 +232,7 @@ public class YGOMobileActivity extends NativeActivity implements
}
}
private
int
[]
getGameSize
(){
private
int
[]
getGameSize
()
{
//调整padding
float
xScale
=
app
().
getXScale
();
float
yScale
=
app
().
getYScale
();
...
...
@@ -282,7 +282,7 @@ public class YGOMobileActivity extends NativeActivity implements
}
}
private
void
changeGameSize
(){
private
void
changeGameSize
()
{
//游戏大小
int
[]
size
=
getGameSize
();
int
w
=
(
int
)
app
().
getScreenHeight
();
...
...
@@ -485,7 +485,7 @@ public class YGOMobileActivity extends NativeActivity implements
@Override
public
void
surfaceCreated
(
SurfaceHolder
holder
)
{
if
(
USE_SURFACE
)
{
if
(
USE_SURFACE
)
{
if
(!
replaced
)
{
return
;
}
...
...
@@ -495,7 +495,7 @@ public class YGOMobileActivity extends NativeActivity implements
@Override
public
void
surfaceChanged
(
SurfaceHolder
holder
,
int
format
,
int
width
,
int
height
)
{
if
(
USE_SURFACE
)
{
if
(
USE_SURFACE
)
{
if
(!
replaced
)
{
return
;
}
...
...
@@ -505,7 +505,7 @@ public class YGOMobileActivity extends NativeActivity implements
@Override
public
void
surfaceDestroyed
(
SurfaceHolder
holder
)
{
if
(
USE_SURFACE
)
{
if
(
USE_SURFACE
)
{
if
(!
replaced
)
{
return
;
}
...
...
@@ -515,11 +515,31 @@ public class YGOMobileActivity extends NativeActivity implements
@Override
public
void
surfaceRedrawNeeded
(
SurfaceHolder
holder
)
{
if
(
USE_SURFACE
)
{
if
(
USE_SURFACE
)
{
if
(!
replaced
)
{
return
;
}
}
super
.
surfaceRedrawNeeded
(
holder
);
}
@Override
public
void
shareFile
(
final
String
title
,
final
String
path
)
{
//TODO 分享文件
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
YGOMobileActivity
.
this
);
builder
.
setTitle
(
title
);
builder
.
setMessage
(
path
);
builder
.
setNeutralButton
(
android
.
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
dismiss
();
}
});
builder
.
show
();
}
});
}
}
libcore/src/main/java/cn/garymb/ygomobile/core/IrrlichtBridge.java
View file @
786c3215
...
...
@@ -195,6 +195,8 @@ public final class IrrlichtBridge {
void
toggleIME
(
String
hint
,
boolean
isShow
);
void
shareFile
(
String
title
,
String
path
);
void
showComboBoxCompat
(
String
[]
items
,
boolean
isShow
,
int
mode
);
void
performHapticFeedback
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
786c3215
...
...
@@ -134,7 +134,7 @@ public class GameUriManager {
}
activity
.
startActivity
(
startdeck
);
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
file
.
getName
()
.
toLowerCase
(
Locale
.
US
)
);
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
file
.
getName
());
if
(
ypk
.
exists
()
&&
file
.
lastModified
()
==
ypk
.
lastModified
())
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
...
...
@@ -152,7 +152,7 @@ public class GameUriManager {
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_installed
,
Toast
.
LENGTH_LONG
).
show
();
}
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".yrp"
))
{
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
file
.
getName
()
.
toLowerCase
(
Locale
.
US
)
);
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
file
.
getName
());
if
(
yrp
.
exists
())
{
YGOStarter
.
startGame
(
getActivity
(),
null
,
"-r"
+
yrp
.
getName
());
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_LONG
).
show
();
...
...
@@ -164,7 +164,7 @@ public class GameUriManager {
}
if
(!
ComponentUtils
.
isActivityRunning
(
getActivity
(),
new
ComponentName
(
getActivity
(),
YGOMobileActivity
.
class
)))
{
YGOStarter
.
startGame
(
getActivity
(),
null
,
"-r"
+
yrp
.
getName
());
Toast
.
makeText
(
activity
,
""
+
yrp
.
getName
(),
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
""
+
yrp
.
getName
(),
Toast
.
LENGTH_LONG
).
show
();
}
}
}
...
...
@@ -194,7 +194,7 @@ public class GameUriManager {
}
}
else
if
(
urifile
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
try
{
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
urifile
.
getName
()
.
toLowerCase
(
Locale
.
US
)
);
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
urifile
.
getName
());
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
ypk
.
exists
()
&&
urifile
.
lastModified
()
==
ypk
.
lastModified
())
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_SHORT
).
show
();
...
...
@@ -222,8 +222,8 @@ public class GameUriManager {
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_installed
,
Toast
.
LENGTH_LONG
).
show
();
}
}
else
if
(
urifile
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".yrp"
))
{
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
urifile
.
getName
());
try
{
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
urifile
.
getName
().
toLowerCase
(
Locale
.
US
));
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
yrp
.
exists
())
{
YGOStarter
.
startGame
(
getActivity
(),
null
,
"-r "
+
urifile
.
getName
());
...
...
@@ -245,7 +245,7 @@ public class GameUriManager {
e
.
printStackTrace
();
}
if
(!
ComponentUtils
.
isActivityRunning
(
activity
,
new
ComponentName
(
activity
,
YGOMobileActivity
.
class
)))
{
YGOStarter
.
startGame
(
activity
,
null
,
"-r "
+
urifile
.
getName
());
YGOStarter
.
startGame
(
activity
,
null
,
"-r "
+
urifile
.
getName
());
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
yrp_installed
),
Toast
.
LENGTH_LONG
).
show
();
}
}
...
...
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