jimu-decompiled/sources/com/unity3d/player/UnityPlayerActivity.java
2025-05-13 19:24:51 +02:00

109 lines
3.2 KiB
Java

package com.unity3d.player;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
/* loaded from: classes2.dex */
public class UnityPlayerActivity extends Activity {
protected UnityPlayer mUnityPlayer;
@Override // android.app.Activity, android.view.Window.Callback
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
return keyEvent.getAction() == 2 ? this.mUnityPlayer.injectEvent(keyEvent) : super.dispatchKeyEvent(keyEvent);
}
@Override // android.app.Activity, android.content.ComponentCallbacks
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
this.mUnityPlayer.configurationChanged(configuration);
}
@Override // android.app.Activity
protected void onCreate(Bundle bundle) {
requestWindowFeature(1);
super.onCreate(bundle);
this.mUnityPlayer = new UnityPlayer(this);
setContentView(this.mUnityPlayer);
this.mUnityPlayer.requestFocus();
}
@Override // android.app.Activity
protected void onDestroy() {
this.mUnityPlayer.destroy();
super.onDestroy();
}
@Override // android.app.Activity
public boolean onGenericMotionEvent(MotionEvent motionEvent) {
return this.mUnityPlayer.injectEvent(motionEvent);
}
@Override // android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
return this.mUnityPlayer.injectEvent(keyEvent);
}
@Override // android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyUp(int i, KeyEvent keyEvent) {
return this.mUnityPlayer.injectEvent(keyEvent);
}
@Override // android.app.Activity, android.content.ComponentCallbacks
public void onLowMemory() {
super.onLowMemory();
this.mUnityPlayer.lowMemory();
}
@Override // android.app.Activity
protected void onNewIntent(Intent intent) {
setIntent(intent);
}
@Override // android.app.Activity
protected void onPause() {
super.onPause();
this.mUnityPlayer.pause();
}
@Override // android.app.Activity
protected void onResume() {
super.onResume();
this.mUnityPlayer.resume();
}
@Override // android.app.Activity
protected void onStart() {
super.onStart();
this.mUnityPlayer.start();
}
@Override // android.app.Activity
protected void onStop() {
super.onStop();
this.mUnityPlayer.stop();
}
@Override // android.app.Activity
public boolean onTouchEvent(MotionEvent motionEvent) {
return this.mUnityPlayer.injectEvent(motionEvent);
}
@Override // android.app.Activity, android.content.ComponentCallbacks2
public void onTrimMemory(int i) {
super.onTrimMemory(i);
if (i == 15) {
this.mUnityPlayer.lowMemory();
}
}
@Override // android.app.Activity, android.view.Window.Callback
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
this.mUnityPlayer.windowFocusChanged(z);
}
}