switch between internal and external sdcard

pull/6927/head
Martín Fdez 3 years ago committed by Frans de Jonge
parent 1f16815f94
commit be2bcac28e

@ -641,7 +641,7 @@ function FileManager:tapPlus()
table.insert(buttons, 3, {
{
text = _("Import files here"),
enabled = Device.isValidPath(self.file_chooser.path),
enabled = Device:isValidPath(self.file_chooser.path),
callback = function()
local current_dir = self.file_chooser.path
UIManager:close(self.file_dialog)
@ -651,6 +651,32 @@ function FileManager:tapPlus()
})
end
if Device:hasExternalSD() then
table.insert(buttons, 4, {
{
text_func = function()
if Device:isValidPath(self.file_chooser.path) then
return _("Switch to SDCard")
else
return _("Switch to internal storage")
end
end,
callback = function()
if Device:isValidPath(self.file_chooser.path) then
local ok, sd_path = Device:hasExternalSD()
UIManager:close(self.file_dialog)
if ok then
self.file_chooser:changeToPath(sd_path)
end
else
UIManager:close(self.file_dialog)
self.file_chooser:changeToPath(Device.home_dir)
end
end,
},
})
end
self.file_dialog = ButtonDialogTitle:new{
title = BD.dirpath(filemanagerutil.abbreviate(self.file_chooser.path)),
title_align = "center",

@ -93,6 +93,7 @@ local Device = Generic:new{
return android.openLink(link) == 0
end,
canImportFiles = function() return android.app.activity.sdkVersion >= 19 end,
hasExternalSD = function() return android.getExternalSdPath() end,
importFile = function(path) android.importFile(path) end,
canShareText = yes,
doShareText = function(text) android.sendText(text) end,

@ -45,6 +45,7 @@ local Device = {
needsTouchScreenProbe = no,
hasClipboard = yes, -- generic internal clipboard on all devices
hasEinkScreen = yes,
hasExternalSD = no, -- or other storage volume that cannot be accessed using the File Manager
canHWDither = no,
canHWInvert = no,
canUseCBB = yes, -- The C BB maintains a 1:1 feature parity with the Lua BB, except that is has NO support for BB4, and limited support for BBRGB24

Loading…
Cancel
Save