mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
android: support for native surface rotation
This commit is contained in:
committed by
Martín Fernández
parent
580b38e775
commit
7094519e1b
2
base
2
base
Submodule base updated: 62bb7955db...0c326d6eee
@@ -129,6 +129,7 @@ function Device:init()
|
||||
device = self,
|
||||
event_map = require("device/android/event_map"),
|
||||
handleMiscEv = function(this, ev)
|
||||
local UIManager = require("ui/uimanager")
|
||||
logger.dbg("Android application event", ev.code)
|
||||
if ev.code == C.APP_CMD_SAVE_STATE then
|
||||
return "SaveState"
|
||||
@@ -136,6 +137,19 @@ function Device:init()
|
||||
or ev.code == C.APP_CMD_INIT_WINDOW
|
||||
or ev.code == C.APP_CMD_WINDOW_REDRAW_NEEDED then
|
||||
this.device.screen:_updateWindow()
|
||||
elseif ev.code == C.APP_CMD_CONFIG_CHANGED then
|
||||
-- orientation and size changes
|
||||
if android.screen.width ~= android.getScreenWidth()
|
||||
or android.screen.height ~= android.getScreenHeight() then
|
||||
this.device.screen:resize()
|
||||
local new_size = this.device.screen:getSize()
|
||||
logger.info("Resizing screen to", new_size)
|
||||
local Event = require("ui/event")
|
||||
UIManager:broadcastEvent(Event:new("SetDimensions", new_size))
|
||||
UIManager:broadcastEvent(Event:new("ScreenResize", new_size))
|
||||
UIManager:broadcastEvent(Event:new("RedrawCurrentPage"))
|
||||
end
|
||||
-- to-do: keyboard connected, disconnected
|
||||
elseif ev.code == C.APP_CMD_RESUME then
|
||||
EXTERNAL_DICTS_AVAILABILITY_CHECKED = false
|
||||
if external_dict_when_back_callback then
|
||||
@@ -145,7 +159,6 @@ function Device:init()
|
||||
local new_file = android.getIntent()
|
||||
if new_file ~= nil and lfs.attributes(new_file, "mode") == "file" then
|
||||
-- we cannot blit to a window here since we have no focus yet.
|
||||
local UIManager = require("ui/uimanager")
|
||||
local InfoMessage = require("ui/widget/infomessage")
|
||||
local BD = require("ui/bidi")
|
||||
UIManager:scheduleIn(0.1, function()
|
||||
@@ -162,7 +175,6 @@ function Device:init()
|
||||
local content_path = android.getLastImportedPath()
|
||||
if content_path ~= nil then
|
||||
local FileManager = require("apps/filemanager/filemanager")
|
||||
local UIManager = require("ui/uimanager")
|
||||
UIManager:scheduleIn(0.5, function()
|
||||
if FileManager.instance then
|
||||
FileManager.instance:onRefresh()
|
||||
@@ -324,10 +336,16 @@ end
|
||||
|
||||
function Device:info()
|
||||
local is_eink, eink_platform = android.isEink()
|
||||
local product_type = android.getPlatformName()
|
||||
|
||||
local common_text = T(_("%1\n\nOS: Android %2, api %3\nBuild flavor: %4\n"),
|
||||
android.prop.product, getCodename(), Device.firmware_rev, android.prop.flavor)
|
||||
|
||||
local platform_text = ""
|
||||
if product_type ~= "android" then
|
||||
platform_text = T(_("\nDevice type: %1\n"), product_type)
|
||||
end
|
||||
|
||||
local eink_text = ""
|
||||
if is_eink then
|
||||
eink_text = T(_("\nE-ink display supported.\nPlatform: %1\n"), eink_platform)
|
||||
@@ -338,7 +356,7 @@ function Device:info()
|
||||
wakelocks_text = _("\nThis device needs CPU, screen and touchscreen always on.\nScreen timeout will be ignored while the app is in the foreground!\n")
|
||||
end
|
||||
|
||||
return common_text..eink_text..wakelocks_text
|
||||
return common_text..platform_text..eink_text..wakelocks_text
|
||||
end
|
||||
|
||||
function Device:epdTest()
|
||||
|
||||
Submodule platform/android/luajit-launcher updated: b6eaf1e50f...f73c343f20
Reference in New Issue
Block a user