Skip to content

Commit 7afd219

Browse files
committed
add build.py --window options to not doing fullscreen app. This is storing a fullscreen metadata attribute in the AndroidManifest.xml.
1 parent a21176d commit 7afd219

File tree

4 files changed

+35
-12
lines changed

4 files changed

+35
-12
lines changed

docs/source/usage.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ Usage
44
Step 1: compile the toolchain
55
-----------------------------
66

7-
If you want to compile the toolchain with only kivy and pyjnius module ::
7+
If you want to compile the toolchain with only kivy module::
88

9-
./distribute.sh -m "pyjnius kivy"
9+
./distribute.sh -m "kivy"
1010

1111
After a long time, you'll get a "dist/default" directory containing all the compiled
1212
libraries and build.py script to package your application using thoses
1313
libraries.
1414

15-
You can include other modules (or "recipes") to compile using `-m`::
15+
You can include other modules (or "recipes") to compile using `-m`. Put the C
16+
libraries to compile before any Python module, order is important.
17+
18+
./distribute.sh -m "openssl kivy"
19+
./distribute.sh -m "pil ffmpeg kivy"
1620

17-
./distribute.sh -m "openssl pyjnius kivy"
18-
./distribute.sh -m "pil ffmpeg pyjnius kivy"
1921

2022
For a full list, refer to :ref:`recipes`
2123

@@ -94,11 +96,13 @@ Available options to `build.py`::
9496
"preferExternal" or "internalOnly".
9597
--compile-pyo Compile all .py files to .pyo, and only distribute the
9698
compiled bytecode.
99+
--intent-filters INTENT_FILTERS
100+
Add intent-filters xml rules to AndroidManifest.xml
97101
--blacklist BLACKLIST
98102
Use a blacklist file to match unwanted file in the
99103
final APK
100-
101-
--intent-filters FILE
102-
Inject the content of FILE into the activity
103-
definition in the AndroidManifest.xml
104+
--sdk SDK_VERSION Android SDK version to use. Default to 8
105+
--minsdk MIN_SDK_VERSION
106+
Minimum Android SDK version to use. Default to 8
107+
--window Indicate if the application will be windowed
104108

src/build.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ def make_package(args):
335335
help='Use a blacklist file to match unwanted file in the final APK')
336336
ap.add_argument('--sdk', dest='sdk_version', default='8', help='Android SDK version to use. Default to 8')
337337
ap.add_argument('--minsdk', dest='min_sdk_version', default='8', help='Minimum Android SDK version to use. Default to 8')
338+
ap.add_argument('--window', dest='window', action='store_true',
339+
help='Indicate if the application will be windowed')
338340
ap.add_argument('command', nargs='*', help='The command to pass to ant (debug, release, installd, installr)')
339341

340342
args = ap.parse_args()

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import android.util.Log;
2323
import android.util.DisplayMetrics;
2424
import android.os.Debug;
25+
import android.content.pm.PackageManager;
26+
import android.content.pm.ApplicationInfo;
2527

2628
import java.io.InputStream;
2729
import java.io.FileInputStream;
@@ -105,10 +107,19 @@ protected void onCreate(Bundle savedInstanceState) {
105107
mPath = getFilesDir();
106108
}
107109

108-
// go to fullscreen mode
109110
requestWindowFeature(Window.FEATURE_NO_TITLE);
110-
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
111-
WindowManager.LayoutParams.FLAG_FULLSCREEN);
111+
112+
// go to fullscreen mode if requested
113+
try {
114+
ApplicationInfo ai = this.getPackageManager().getApplicationInfo(
115+
this.getPackageName(), PackageManager.GET_META_DATA);
116+
Log.v("python", "metadata fullscreen is" + ai.metaData.get("fullscreen"));
117+
if ( (Integer)ai.metaData.get("fullscreen") == 1 ) {
118+
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
119+
WindowManager.LayoutParams.FLAG_FULLSCREEN);
120+
}
121+
} catch (PackageManager.NameNotFoundException e) {
122+
}
112123

113124
// Start showing an SDLSurfaceView.
114125
mView = new SDLSurfaceView(

src/templates/AndroidManifest.tmpl.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
android:icon="@drawable/icon"
1111
>
1212

13+
{% if args.window %}
14+
<meta-data android:name="fullscreen" android:value="0"/>
15+
{% else %}
16+
<meta-data android:name="fullscreen" android:value="1"/>
17+
{% endif %}
18+
1319
<activity android:name="org.renpy.android.PythonActivity"
1420
android:label="@string/iconName"
1521
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode"

0 commit comments

Comments
 (0)