From 5ef329c19c4683ccf4e651b2c8170c5f2bb6baea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Sun, 5 Jan 2020 12:56:01 +0100 Subject: [PATCH] android: share text (#5745) --- frontend/apps/reader/modules/readerhighlight.lua | 11 +++++++++++ frontend/device/android/device.lua | 2 ++ frontend/device/generic/device.lua | 1 + 3 files changed, 14 insertions(+) diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 6b4efa2e3..15046c160 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -498,6 +498,17 @@ function ReaderHighlight:onShowHighlightMenu() }, }) end + if Device:canShareText() then + table.insert(highlight_buttons, { + { + text = _("Share text"), + callback = function() + Device.doShareText(self.selected_text.text) + end, + }, + }) + end + self.highlight_dialog = ButtonDialog:new{ buttons = highlight_buttons, tap_close_callback = function() self:handleEvent(Event:new("Tap")) end, diff --git a/frontend/device/android/device.lua b/frontend/device/android/device.lua index 3fa8ba0c6..3cb3b0dc9 100644 --- a/frontend/device/android/device.lua +++ b/frontend/device/android/device.lua @@ -86,6 +86,8 @@ local Device = Generic:new{ canImportFiles = function() return android.app.activity.sdkVersion >= 19 end, importFile = function(path) android.importFile(path) end, isValidPath = function(path) return android.isPathInsideSandbox(path) end, + canShareText = yes, + doShareText = function(text) android.sendText(text) end, canExternalDictLookup = yes, getExternalDictLookupList = getExternalDicts, diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index e80c05a5f..0c66d5a17 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -46,6 +46,7 @@ local Device = { hasColorScreen = no, hasBGRFrameBuffer = no, canImportFiles = no, + canShareText = no, canToggleGSensor = no, canToggleMassStorage = no, canUseWAL = yes, -- requires mmap'ed I/O on the target FS