mirror of
https://github.com/liberatedsystems/Sideband_CE.git
synced 2024-09-03 04:13:27 +02:00
35 lines
806 B
Python
35 lines
806 B
Python
|
'''
|
||
|
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()
|