[feat] Add ReaderBack (#3821)

This implements a reasonable facsimile of going back on Android.

The back button first goes back in a history of visited pages.
When there's no history left, it closes the app.

Fixes #3816.
This commit is contained in:
Frans de Jonge
2018-03-31 21:19:31 +02:00
committed by GitHub
parent c332d517f7
commit 2c1178896c
4 changed files with 128 additions and 36 deletions

View File

@@ -5,37 +5,7 @@ describe("InputText widget module", function()
require("commonrequire")
InputText = require("ui/widget/inputtext")
-- thanks to https://stackoverflow.com/a/32660766/2470572
equals = function(o1, o2, ignore_mt)
if o1 == o2 then return true end
local o1Type = type(o1)
local o2Type = type(o2)
if o1Type ~= o2Type then return false end
if o1Type ~= 'table' then return false end
if not ignore_mt then
local mt1 = getmetatable(o1)
if mt1 and mt1.__eq then
--compare using built in method
return o1 == o2
end
end
local keySet = {}
for key1, value1 in pairs(o1) do
local value2 = o2[key1]
if value2 == nil or equals(value1, value2, ignore_mt) == false then
return false
end
keySet[key1] = true
end
for key2, _ in pairs(o2) do
if not keySet[key2] then return false end
end
return true
end
equals = require("util").tableEquals
end)
describe("addChars()", function()