Merge pull request #1647 from chrox/fix_kv_refresh

fix some minor issues on Kindle Voyage
pull/1659/head
Qingping Hou 9 years ago
commit f2fa1c36ba

@ -4,10 +4,12 @@ local ffi = require("ffi")
local DEBUG = require("dbg") local DEBUG = require("dbg")
local function yes() return true end local function yes() return true end
local function no() return false end
local Device = Generic:new{ local Device = Generic:new{
model = "Android", model = "Android",
hasKeys = yes, hasKeys = yes,
hasDPad = no,
isAndroid = yes, isAndroid = yes,
firmware_rev = "none", firmware_rev = "none",
display_dpi = ffi.C.AConfiguration_getDensity(android.app.config), display_dpi = ffi.C.AConfiguration_getDensity(android.app.config),

@ -3,14 +3,17 @@ local util = require("ffi/util")
local DEBUG = require("dbg") local DEBUG = require("dbg")
local function yes() return true end local function yes() return true end
local function no() return false end
local Device = Generic:new{ local Device = Generic:new{
model = "Emulator", model = "Emulator",
isEmulator = yes, isEmulator = yes,
hasKeyboard = yes, hasKeyboard = yes,
hasKeys = yes, hasKeys = yes,
hasDPad = yes,
hasFrontlight = yes, hasFrontlight = yes,
isTouchDevice = yes, isTouchDevice = yes,
needsScreenRefreshAfterResume = no,
} }
function Device:init() function Device:init()

@ -2,6 +2,7 @@ local Event = require("ui/event")
local util = require("ffi/util") local util = require("ffi/util")
local DEBUG = require("dbg") local DEBUG = require("dbg")
local function yes() return true end
local function no() return false end local function no() return false end
local Device = { local Device = {
@ -16,6 +17,7 @@ local Device = {
-- hardware feature tests: (these are functions!) -- hardware feature tests: (these are functions!)
hasKeyboard = no, hasKeyboard = no,
hasKeys = no, hasKeys = no,
hasDPad = no,
isTouchDevice = no, isTouchDevice = no,
hasFrontlight = no, hasFrontlight = no,
@ -33,6 +35,8 @@ local Device = {
viewport = nil, viewport = nil,
-- enforce portrait orientation on display, no matter how configured at startup -- enforce portrait orientation on display, no matter how configured at startup
isAlwaysPortrait = no, isAlwaysPortrait = no,
-- needs full screen refresh when resumed from screensaver?
needsScreenRefreshAfterResume = yes,
} }
function Device:new(o) function Device:new(o)
@ -131,7 +135,9 @@ end
function Device:resume() function Device:resume()
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
UIManager:unschedule(self.suspend) UIManager:unschedule(self.suspend)
self.screen:refreshFull() if self:needsScreenRefreshAfterResume() then
self.screen:refreshFull()
end
self.screen_saver_mode = false self.screen_saver_mode = false
self.powerd:refreshCapacity() self.powerd:refreshCapacity()
end end

@ -2,6 +2,7 @@ local Generic = require("device/generic/device")
local DEBUG = require("dbg") local DEBUG = require("dbg")
local function yes() return true end local function yes() return true end
local function no() return false end
local Kindle = Generic:new{ local Kindle = Generic:new{
model = "Kindle", model = "Kindle",
@ -12,23 +13,27 @@ local Kindle2 = Kindle:new{
model = "Kindle2", model = "Kindle2",
hasKeyboard = yes, hasKeyboard = yes,
hasKeys = yes, hasKeys = yes,
hasDPad = yes,
} }
local KindleDXG = Kindle:new{ local KindleDXG = Kindle:new{
model = "KindleDXG", model = "KindleDXG",
hasKeyboard = yes, hasKeyboard = yes,
hasKeys = yes, hasKeys = yes,
hasDPad = yes,
} }
local Kindle3 = Kindle:new{ local Kindle3 = Kindle:new{
model = "Kindle3", model = "Kindle3",
hasKeyboard = yes, hasKeyboard = yes,
hasKeys = yes, hasKeys = yes,
hasDPad = yes,
} }
local Kindle4 = Kindle:new{ local Kindle4 = Kindle:new{
model = "Kindle4", model = "Kindle4",
hasKeys = yes, hasKeys = yes,
hasDPad = yes,
} }
local KindleTouch = Kindle:new{ local KindleTouch = Kindle:new{
@ -67,6 +72,7 @@ local KindleVoyage = Kindle:new{
hasKeys = yes, hasKeys = yes,
display_dpi = 300, display_dpi = 300,
touch_dev = "/dev/input/event1", touch_dev = "/dev/input/event1",
needsScreenRefreshAfterResume = no,
} }
local KindlePaperWhite3 = Kindle:new{ local KindlePaperWhite3 = Kindle:new{

@ -68,7 +68,7 @@ function ButtonTable:init()
self:addHorizontalSep() self:addHorizontalSep()
end end
end -- end for each button line end -- end for each button line
if Device:hasKeys() then if Device:hasDPad() then
self.layout = self.buttons self.layout = self.buttons
self.layout[1][1]:onFocus() self.layout[1][1]:onFocus()
self.key_events.SelectByKeyPress = { {{"Press", "Enter"}} } self.key_events.SelectByKeyPress = { {{"Press", "Enter"}} }

Loading…
Cancel
Save