mirror of
https://github.com/markqvist/Sideband.git
synced 2025-08-03 12:06:07 -04:00
Included local plyer
This commit is contained in:
parent
25f0d52260
commit
f23855fb68
166 changed files with 15862 additions and 0 deletions
43
sbapp/plyer/platforms/android/orientation.py
Normal file
43
sbapp/plyer/platforms/android/orientation.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
from jnius import autoclass
|
||||
from plyer.platforms.android import activity
|
||||
from plyer.facades import Orientation
|
||||
|
||||
ActivityInfo = autoclass('android.content.pm.ActivityInfo')
|
||||
|
||||
|
||||
class AndroidOrientation(Orientation):
|
||||
|
||||
def _set_landscape(self, **kwargs):
|
||||
reverse = kwargs.get('reverse')
|
||||
if reverse:
|
||||
activity.setRequestedOrientation(
|
||||
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE)
|
||||
else:
|
||||
activity.setRequestedOrientation(
|
||||
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
|
||||
|
||||
def _set_portrait(self, **kwargs):
|
||||
reverse = kwargs.get('reverse')
|
||||
if reverse:
|
||||
activity.setRequestedOrientation(
|
||||
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT)
|
||||
else:
|
||||
activity.setRequestedOrientation(
|
||||
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
|
||||
|
||||
def _set_sensor(self, **kwargs):
|
||||
mode = kwargs.get('mode')
|
||||
|
||||
if mode == 'any':
|
||||
activity.setRequestedOrientation(
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR)
|
||||
elif mode == 'landscape':
|
||||
activity.setRequestedOrientation(
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)
|
||||
elif mode == 'portrait':
|
||||
activity.setRequestedOrientation(
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT)
|
||||
|
||||
|
||||
def instance():
|
||||
return AndroidOrientation()
|
Loading…
Add table
Add a link
Reference in a new issue