kivy / kivy/python-for-android
Fix screen orientation of PythonActivity.java
- Langage dominant
- Python
- Étoiles
- 8.9k
- Forks
- 2k
- Merge moyen
- 12 h 20 min
- PR mergées (30 j)
- 9
Description
### Checklist
- [X] the issue is indeed a bug and not a support request
- [ ] issue doesn't already exist: https://github.com/kivy/python-for-android/issues
- [ ] I have a short, runnable example that reproduces the issue
- [X] I reproduced the problem with the latest development version (`p4a.branch = develop`)
- [ ] I used the grave accent (aka backticks) to format code or logs when appropriated
### Versions
- Python: 3.10
- OS: Android
- Kivy: 2.3.0
- Cython: 0.29.37
- OpenJDK: 17
### Description
Hi, could you please modify [PythonActivity.java](https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java#L140-L146) to either add additional options or to gracefully handle cases where the `android.manifest.orientation` parameter is already specified in the manifest? This adjustment would prevent conflicts and ensure smoother integration with buildozer.spec configurations.
Currently, users need to set it inside the app using `mActivity.setRequestedOrientation`. For example: `mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER)`, full minimal code:
```python
from android import mActivity
from jnius import autoclass
ActivityInfo = autoclass('android.content.pm.ActivityInfo')
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER)
```
Screenshot from app's ipykernel (part of my sample in [git repository](https://github.com/BlackCatDevel0per/p4adev_toolkit)):


Then everything works ok..
Spec file:
```
orientation = portrait
android.manifest.orientation = fullUser
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Start with pythonforandroid/bootstraps/sdl2/build/src/main/java/org/kivy/android/PythonActivity.java around lines 140-146, then compare the orientation and android.manifest.orientation settings shown in the buildozer.spec example. Check how the manifest value and runtime setRequestedOrientation call interact; done means the specified orientation is handled without a conflict.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- android, java, python
- Domaine
- build-system, mobile-dev
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100