add Device:hasKeyboard to help initialize UI components

So that kindle4 won't have all the gesture event registered.
pull/2/merge
Qingping Hou 12 years ago
parent bf86cf7a93
commit 1b7357fc0f

@ -1,6 +1,7 @@
Device = { Device = {
screen_saver_mode = false, screen_saver_mode = false,
charging_mode = false, charging_mode = false,
model = nil,
} }
function Device:getModel() function Device:getModel()
@ -65,9 +66,18 @@ function Device:isKindle2()
end end
end end
function Device:hasNoKeyboard()
if not self.model then
self.model = self:getModel()
end
return self:isTouchDevice() or (self.model == "Kindle4")
end
function Device:isTouchDevice() function Device:isTouchDevice()
local model = self:getModel() if not self.model then
return (model == "Kindle4") or (model == "KindlePaperWhite") or (model == "KindleTouch") or util.isEmulated() self.model = self:getModel()
end
return (self.model == "KindlePaperWhite") or (self.model == "KindleTouch") or util.isEmulated()
end end
function Device:intoScreenSaver() function Device:intoScreenSaver()

@ -62,9 +62,6 @@ end
-- option parsing: -- option parsing:
longopts = { longopts = {
password = "p",
goto = "g",
gamma = "G",
debug = "d", debug = "d",
help = "h", help = "h",
} }
@ -97,7 +94,7 @@ else
DEBUG = function() end DEBUG = function() end
end end
if Device.isKindle4() or Device:isTouchDevice() then if Device:hasNoKeyboard() then
-- remove menu item shortcut for K4 -- remove menu item shortcut for K4
Menu.is_enable_shortcut = false Menu.is_enable_shortcut = false
end end

Loading…
Cancel
Save