Commit ae187ac6 authored by fallenstardust's avatar fallenstardust

优化清除

parent 6715374a
......@@ -200,7 +200,9 @@ E_DEVICE_TYPE CIrrDeviceAndroid::getType() const
void CIrrDeviceAndroid::handleAndroidCommand(ANDROID_APP app, int32_t cmd)
{
CIrrDeviceAndroid* device = (CIrrDeviceAndroid*)app->userData;
if(device->onAppCmd != nullptr){
device->onAppCmd(app, cmd);
}
switch (cmd)
{
case APP_CMD_SAVE_STATE:
......
......@@ -58,6 +58,19 @@ namespace irr
core::array<EKEY_CODE> KeyMap;
bool isPaused(){
return Paused;
}
bool isFocused(){
return Focused;
}
bool isDestroy(){
return !Initialized;
}
void (*onAppCmd)(struct android_app* app, int32_t cmd) = nullptr;
private:
static void handleAndroidCommand(ANDROID_APP app, int32_t cmd);
......
......@@ -8,6 +8,7 @@
#include <android_native_app_glue.h>
#include <signal.h>
#include <android/log.h>
#include <Android/CIrrDeviceAndroid.h>
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "ygomobile-native", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "ygomobile-native", __VA_ARGS__))
......
......@@ -297,7 +297,7 @@ static void* join_game_thread(void* param) {
JNIEXPORT void JNICALL Java_cn_garymb_ygomobile_core_IrrlichtBridge_nativeSetInputFix(
JNIEnv* env, jclass clazz, jlong handle, jint x, jint y) {
if(ygo::mainGame) {
__android_log_print(ANDROID_LOG_INFO, "ygo", "setInputFix posX=%d, posY=%d", x, y);
ALOGD("setInputFix posX=%d, posY=%d", x, y);
ygo::mainGame->setPositionFix(core::position2di(x, y));
}
}
......
......@@ -9,9 +9,7 @@
<application>
<activity
android:name="cn.garymb.ygomobile.YGOMobileActivity"
android:clearTaskOnLaunch="true"
android:configChanges="orientation|keyboardHidden|screenSize"
android:excludeFromRecents="true"
android:exported="true"
android:label="YGOMobile"
android:process=":game"
......
......@@ -60,9 +60,6 @@ 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
......@@ -80,6 +77,8 @@ 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;
......@@ -87,12 +86,11 @@ 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;
private boolean onGameExiting;
// public static int notchHeight;
//电池管理
private PowerManager mPM;
private PowerManager.WakeLock mLock;
private GameApplication app() {
if (mApp == null) {
......@@ -138,6 +136,10 @@ public class YGOMobileActivity extends NativeActivity implements
.setPackage(getPackageName()));
}
//电池管理
private PowerManager mPM;
private PowerManager.WakeLock mLock;
@Override
protected void onResume() {
super.onResume();
......@@ -547,17 +549,26 @@ public class YGOMobileActivity extends NativeActivity implements
@Override
public void onGameExit() {
if(onGameExiting){
return;
}
onGameExiting = true;
Log.e("ygomobile", "game exit");
Intent intent = new Intent("ygomobile.intent.action.GAME");
final Intent intent = new Intent("ygomobile.intent.action.GAME");
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
intent.putExtra("game_exit_time", System.currentTimeMillis());
intent.setPackage(getPackageName());
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
startActivity(intent);
} catch (Throwable ignore) {
}
} catch (Throwable ignore) {}
finishAndRemoveTask();
Process.killProcess(Process.myPid());
}
});
}
}
......@@ -15,12 +15,12 @@
android:usesCleartextTraffic="true"
android:extractNativeLibs="true"
android:requestLegacyExternalStorage="true"
android:taskAffinity="cn.garymb.ygomobile.task"
tools:replace="android:allowBackup,android:supportsRtl"
tools:targetApi="m">
<activity
android:name="cn.garymb.ygomobile.ui.activities.LogoActivity"
android:excludeFromRecents="false"
android:taskAffinity="cn.garymb.logo"
android:theme="@style/TranslucentTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -33,14 +33,18 @@
</activity>
<activity
android:name="com.tencent.bugly.beta.ui.BetaActivity"
android:launchMode="singleTop"
android:configChanges="keyboardHidden|orientation|screenSize|locale"
android:excludeFromRecents="true"/>
<activity
android:name="cn.garymb.ygomobile.ui.home.MainActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:excludeFromRecents="false"
android:exported="true"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:stateNotNeeded="true"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<intent-filter>
......@@ -119,6 +123,11 @@
android:name="cn.garymb.ygomobile.YGOMobileActivity"
android:theme="@style/AppTheme.Game"
tools:replace="android:theme" />
<receiver
android:name="cn.garymb.ygomobile.GameReceiver"
android:enabled="false" />
<activity
android:name="cn.garymb.ygomobile.ui.preference.SettingsActivity"
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
......@@ -187,11 +196,6 @@
<activity
android:name="cn.garymb.ygomobile.ui.activities.PermissionsActivity"
android:theme="@style/TranslucentTheme"/>
<activity
android:name="com.tencent.bugly.beta.ui.BetaActivity"
android:configChanges="keyboardHidden|orientation|screenSize|locale"
android:theme="@android:style/Theme.Translucent" />
<meta-data
android:name="BUGLY_APPID"
android:value="${APP_ID}" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment