|
|
@ -94,15 +94,7 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea |
|
|
|
} |
|
|
|
} |
|
|
|
read_menu.setListener(object : ReadMenu.Callback { |
|
|
|
read_menu.setListener(object : ReadMenu.Callback { |
|
|
|
override fun setScreenBrightness(value: Int) { |
|
|
|
override fun setScreenBrightness(value: Int) { |
|
|
|
var brightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE |
|
|
|
this@ReadBookActivity.setScreenBrightness(value) |
|
|
|
if (this@ReadBookActivity.getPrefBoolean("brightnessAuto").not()) { |
|
|
|
|
|
|
|
brightness = value.toFloat() |
|
|
|
|
|
|
|
if (brightness < 1f) brightness = 1f |
|
|
|
|
|
|
|
brightness = brightness * 1.0f / 255f |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
val params = window.attributes |
|
|
|
|
|
|
|
params.screenBrightness = brightness |
|
|
|
|
|
|
|
window.attributes = params |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun autoPage() { |
|
|
|
override fun autoPage() { |
|
|
@ -295,6 +287,18 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_rea |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun setScreenBrightness(value: Int) { |
|
|
|
|
|
|
|
var brightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE |
|
|
|
|
|
|
|
if (this.getPrefBoolean("brightnessAuto").not()) { |
|
|
|
|
|
|
|
brightness = value.toFloat() |
|
|
|
|
|
|
|
if (brightness < 1f) brightness = 1f |
|
|
|
|
|
|
|
brightness = brightness * 1.0f / 255f |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
val params = window.attributes |
|
|
|
|
|
|
|
params.screenBrightness = brightness |
|
|
|
|
|
|
|
window.attributes = params |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
super.onActivityResult(requestCode, resultCode, data) |
|
|
|
super.onActivityResult(requestCode, resultCode, data) |
|
|
|
if (resultCode == Activity.RESULT_OK) { |
|
|
|
if (resultCode == Activity.RESULT_OK) { |
|
|
|