Update kobolight plugin to support kindle (#2587)

This commit is contained in:
Hzj_jie
2017-02-26 02:19:20 -08:00
committed by Qingping Hou
parent 4fce69d18d
commit 7fb2dc8d5c
3 changed files with 57 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
local Device = require("device")
if not (Device:isKobo() and Device:hasFrontlight()) then
if not ((Device:isKindle() or Device:isKobo()) and Device:hasFrontlight()) then
return { disabled = true, }
end
@@ -17,10 +17,19 @@ local swipe_touch_zone_ratio = { x = 0, y = 1/8, w = 1/10, h = 7/8, }
local KoboLight = WidgetContainer:new{
name = 'kobolight',
steps = { 0, 1, 1, 1, 1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, },
steps = { 0.1, 0.1, 0.2, 0.4, 0.7, 1.1, 1.6, 2.2, 2.9, 3.7, 4.6, 5.6, 6.7, 7.9, 9.2, 10.6, },
gestureScale = nil, -- initialized in self:resetLayout()
}
function KoboLight:init()
local powerd = Device:getPowerDevice()
local scale = (powerd.fl_max - powerd.fl_min) / 2 / 10.6
for i = 1, #self.steps, 1
do
self.steps[i] = math.ceil(self.steps[i] * scale)
end
end
function KoboLight:onReaderReady()
self:setupTouchZones()
self:resetLayout()