mirror of
https://github.com/markqvist/Sideband.git
synced 2025-08-03 20:14:24 -04:00
Included local plyer
This commit is contained in:
parent
25f0d52260
commit
f23855fb68
166 changed files with 15862 additions and 0 deletions
34
sbapp/plyer/platforms/android/brightness.py
Executable file
34
sbapp/plyer/platforms/android/brightness.py
Executable file
|
@ -0,0 +1,34 @@
|
|||
'''
|
||||
Android Brightness
|
||||
------------------
|
||||
'''
|
||||
|
||||
from jnius import autoclass
|
||||
from plyer.facades import Brightness
|
||||
from android import mActivity
|
||||
|
||||
System = autoclass('android.provider.Settings$System')
|
||||
|
||||
|
||||
class AndroidBrightness(Brightness):
|
||||
|
||||
def _current_level(self):
|
||||
|
||||
System.putInt(
|
||||
mActivity.getContentResolver(),
|
||||
System.SCREEN_BRIGHTNESS_MODE,
|
||||
System.SCREEN_BRIGHTNESS_MODE_MANUAL)
|
||||
cr_level = System.getInt(
|
||||
mActivity.getContentResolver(),
|
||||
System.SCREEN_BRIGHTNESS)
|
||||
return (cr_level / 255.) * 100
|
||||
|
||||
def _set_level(self, level):
|
||||
System.putInt(
|
||||
mActivity.getContentResolver(),
|
||||
System.SCREEN_BRIGHTNESS,
|
||||
(level / 100.) * 255)
|
||||
|
||||
|
||||
def instance():
|
||||
return AndroidBrightness()
|
Loading…
Add table
Add a link
Reference in a new issue