mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
use android config interface to detect device keyboard and screen dpi
This commit is contained in:
parent
a33ab1fb8c
commit
f9215a3a04
@ -1 +1 @@
|
||||
Subproject commit 3cee0cff606e0fba035c651ed5306fc27f0402bc
|
||||
Subproject commit 7a87eeb5f9ecab9fca1544f1b1b6cd3c5d45baec
|
@ -3,6 +3,8 @@ local KoboPowerD = require("ui/device/kobopowerd")
|
||||
local BasePowerD = require("ui/device/basepowerd")
|
||||
local Screen = require("ui/device/screen")
|
||||
local util = require("ffi/util")
|
||||
local ffi = require("ffi")
|
||||
local isAndroid, android = pcall(require, "android")
|
||||
-- lfs
|
||||
|
||||
local Device = {
|
||||
@ -104,9 +106,14 @@ Device.isAndroid = util.isAndroid
|
||||
|
||||
function Device:hasNoKeyboard()
|
||||
if self.has_no_keyboard ~= nil then return self.has_no_keyboard end
|
||||
if not isAndroid then
|
||||
local model = self:getModel()
|
||||
self.has_no_keyboard = (model == "KindlePaperWhite") or (model == "KindlePaperWhite2")
|
||||
or (model == "KindleTouch") or self:isKobo() or self:isAndroid()
|
||||
or (model == "KindleTouch") or self:isKobo()
|
||||
else
|
||||
self.has_no_keyboard = ffi.C.AConfiguration_getKeyboard(android.app.config)
|
||||
~= ffi.C.ACONFIGURATION_KEYBOARD_QWERTY
|
||||
end
|
||||
return self.has_no_keyboard
|
||||
end
|
||||
|
||||
@ -116,10 +123,14 @@ end
|
||||
|
||||
function Device:isTouchDevice()
|
||||
if self.is_touch_device ~= nil then return self.is_touch_device end
|
||||
if not isAndroid then
|
||||
local model = self:getModel()
|
||||
self.is_touch_device = (model == "KindlePaperWhite") or (model == "KindlePaperWhite2")
|
||||
or (model == "KindleTouch") or self:isKobo() or util.isEmulated()
|
||||
or util.isAndroid()
|
||||
else
|
||||
self.is_touch_device = ffi.C.AConfiguration_getTouchscreen(android.app.config)
|
||||
~= ffi.C.ACONFIGURATION_TOUCHSCREEN_NOTOUCH
|
||||
end
|
||||
return self.is_touch_device
|
||||
end
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 271d3dcede9f9bcc7f5613c7f81f28f17271a0d5
|
||||
Subproject commit dc61f9e2cabafed25ae7fbb3f0b13122c6074400
|
Loading…
Reference in New Issue
Block a user