Skip to content

Commit 78392de

Browse files
committed
fixes to reduce metadata import/usage in SDLSurfaceView
1 parent f578519 commit 78392de

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

src/src/org/renpy/android/PythonActivity.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
import android.app.Activity;
44
import android.content.Intent;
5-
import android.content.ActivityNotFoundException;
65
import android.content.pm.ActivityInfo;
76
import android.os.Bundle;
87
import android.os.Environment;
9-
import android.view.MotionEvent;
108
import android.view.KeyEvent;
119
import android.view.Window;
1210
import android.view.WindowManager;
@@ -24,8 +22,6 @@
2422
import java.util.Collections;
2523
import java.util.Iterator;
2624

27-
import java.util.zip.GZIPInputStream;
28-
2925
// Billing
3026
import org.renpy.android.Configuration;
3127
import org.renpy.android.billing.BillingService.RequestPurchase;

src/src/org/renpy/android/SDLSurfaceView.java

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,9 @@ private void printConfig(EGL10 egl, EGLDisplay display,
341341
// The resource manager we use.
342342
ResourceManager mResourceManager;
343343

344+
// Access to our meta-data
345+
private ApplicationInfo ai;
346+
344347
// Our own view
345348
static SDLSurfaceView instance = null;
346349

@@ -362,7 +365,7 @@ public SDLSurfaceView(PythonActivity act, String argument) {
362365

363366
wakeLock = null;
364367
try {
365-
ApplicationInfo ai = act.getPackageManager().getApplicationInfo(
368+
ai = act.getPackageManager().getApplicationInfo(
366369
act.getPackageName(), PackageManager.GET_META_DATA);
367370
if ( (Integer)ai.metaData.get("wakelock") == 1 ) {
368371
wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "Screen On");
@@ -596,22 +599,22 @@ public void run() {
596599
if (configToTest == 0) {
597600
Log.i(TAG, "Try to use graphics config R8G8B8A8S8");
598601
ConfigChooser chooser = new ConfigChooser(
599-
// rgba
600-
8, 8, 8, 8,
601-
// depth
602-
mActivity.mInfo.metaData.getInt("surface:depth", 0),
603-
// stencil
604-
mActivity.mInfo.metaData.getInt("surface:stencil", 8));
602+
// rgba
603+
8, 8, 8, 8,
604+
// depth
605+
ai.metaData.getInt("surface.depth", 0),
606+
// stencil
607+
ai.metaData.getInt("surface.stencil", 8));
605608
mEglConfig = chooser.chooseConfig(mEgl, mEglDisplay);
606609
} else if (configToTest == 1) {
607610
Log.i(TAG, "Try to use graphics config R5G6B5S8");
608611
ConfigChooser chooser = new ConfigChooser(
609-
// rgba
610-
5, 6, 5, 0,
611-
// depth
612-
mActivity.mInfo.metaData.getInt("surface:depth", 0),
613-
// stencil
614-
mActivity.mInfo.metaData.getInt("surface:stencil", 8));
612+
// rgba
613+
5, 6, 5, 0,
614+
// depth
615+
ai.metaData.getInt("surface.depth", 0),
616+
// stencil
617+
ai.metaData.getInt("surface.stencil", 8));
615618
mEglConfig = chooser.chooseConfig(mEgl, mEglDisplay);
616619
} else {
617620
Log.e(TAG, "Unable to find a correct surface for this device !");
@@ -650,8 +653,12 @@ public void run() {
650653
Log.w(TAG, "Done");
651654
waitForStart();
652655

653-
if ( mActivity.mInfo.metaData.getBoolean("surface:transluent") )
654-
getHolder().setFormat(PixelFormat.TRANSLUCENT);
656+
if ( ai.metaData.getInt("surface.transluent") != 0 ) {
657+
Log.i(TAG, "Surface will be transluent");
658+
getHolder().setFormat(PixelFormat.TRANSLUCENT);
659+
} else {
660+
Log.i(TAG, "Surface will NOT be transluent");
661+
}
655662

656663
nativeResize(mWidth, mHeight);
657664
nativeInitJavaCallbacks();

0 commit comments

Comments
 (0)