mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add support for physical button for page crop (#6091)
See: #2003 In page crop: physical press button = OK physical back button = Cancel
This commit is contained in:
@@ -13,10 +13,11 @@ local RightContainer = require("ui/widget/container/rightcontainer")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local VerticalGroup = require("ui/widget/verticalgroup")
|
||||
local Screen = require("device").screen
|
||||
local _ = require("gettext")
|
||||
|
||||
local PageCropDialog = VerticalGroup:new{
|
||||
ok_text = "OK",
|
||||
cancel_text = "Cancel",
|
||||
ok_text = _("OK"),
|
||||
cancel_text = _("Cancel"),
|
||||
ok_callback = function() end,
|
||||
cancel_callback = function() end,
|
||||
button_width = math.floor(Screen:scaleBySize(70)),
|
||||
@@ -73,7 +74,6 @@ function PageCropDialog:onShow()
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
local ReaderCropping = InputContainer:new{}
|
||||
|
||||
function ReaderCropping:onPageCrop(mode)
|
||||
|
||||
@@ -49,6 +49,10 @@ function BBoxWidget:init()
|
||||
}
|
||||
}
|
||||
end
|
||||
if Device:hasKeys() then
|
||||
self.key_events.Close = { {"Back"}, doc = "close windows" }
|
||||
self.key_events.Select = { {"Press"}, doc = "confirm adjust" }
|
||||
end
|
||||
end
|
||||
|
||||
function BBoxWidget:getSize()
|
||||
@@ -222,4 +226,13 @@ function BBoxWidget:onConfirmAdjust(arg, ges)
|
||||
return true
|
||||
end
|
||||
|
||||
function BBoxWidget:onClose()
|
||||
self.ui:handleEvent(Event:new("CancelPageCrop"))
|
||||
end
|
||||
|
||||
function BBoxWidget:onSelect()
|
||||
self.ui:handleEvent(Event:new("ConfirmPageCrop"))
|
||||
end
|
||||
|
||||
|
||||
return BBoxWidget
|
||||
|
||||
Reference in New Issue
Block a user