Skip to content

Commit f1b9b9e

Browse files
committed
wip
1 parent e4ed946 commit f1b9b9e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,18 @@ protected void onPostExecute(String result) {
151151
File path = new File(getIntent().getData().getSchemeSpecificPart());
152152

153153
Project p = Project.scanDirectory(path);
154+
String custom_orientation = this.getExtra("orientation");
155+
154156
String entry_point = getEntryPoint(p.dir);
155157
SDLActivity.nativeSetenv("ANDROID_ENTRYPOINT", p.dir + "/" + entry_point);
156158
SDLActivity.nativeSetenv("ANDROID_ARGUMENT", p.dir);
157159
SDLActivity.nativeSetenv("ANDROID_APP_PATH", p.dir);
158160

159-
if (p != null) {
161+
if (custom_orientation == "landscape")
162+
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
163+
else if (custom_orientation == "portrait")
164+
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
165+
else if (p != null) {
160166
if (p.landscape) {
161167
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
162168
} else {
@@ -499,9 +505,15 @@ public String getEntryPoint(String search_dir) {
499505
* have a compiled version or not.
500506
*/
501507
List<String> entryPoints = new ArrayList<String>();
502-
entryPoints.add("main.pyo"); // python 2 compiled files
503-
entryPoints.add("main.pyc"); // python 3 compiled files
504-
for (String value : entryPoints) {
508+
String extra = this.getExtra("entrypoint");
509+
if (extra != "")
510+
entryPoints.add(extra); // custom entrypoint
511+
512+
else {
513+
entryPoints.add("main.pyo"); // python 2 compiled files
514+
entryPoints.add("main.pyc"); // python 3 compiled files
515+
}
516+
for (String value : entryPoints) {
505517
File mainFile = new File(search_dir + "/" + value);
506518
if (mainFile.exists()) {
507519
return value;

0 commit comments

Comments
 (0)