Merge pull request #1473 from chrox/swipe_go_back

Add option to disable swipe to go back and various other fixes
pull/1483/head v2015.04.07-nightly
Qingping Hou 9 years ago
commit ded6b89f4c

@ -70,6 +70,7 @@ To get and compile the source you must have `patch`, `wget`, `unzip`, `git`, `au
`subversion` and `cmake` installed, as well as a version of `autoconf` greater than 2.64.
You also need `nasm` and of course a compiler like `gcc` or `clang`. If you want to
cross-compile for other architectures, you need a proper cross-compile toolchain.
Your GCC should be at least of version 4.7 for both native and cross compiling.
Users of Debian and Ubuntu can install the required packages using:
```

@ -54,17 +54,42 @@ function ReaderLink:initGesListener()
end
end
local function is_follow_links_on()
return G_reader_settings:readSetting("follow_links") ~= false
end
local function swipe_to_go_back()
return G_reader_settings:readSetting("swipe_to_go_back") ~= false
end
function ReaderLink:addToMainMenu(tab_item_table)
-- insert table to main reader menu
table.insert(tab_item_table.navi, {
text = _("Follow links"),
checked_func = function()
return G_reader_settings:readSetting("follow_links") == true
sub_item_table = {
{
text_func = function()
return is_follow_links_on() and _("Disable") or _("Enable")
end,
callback = function()
local follow_links = G_reader_settings:readSetting("follow_links")
G_reader_settings:saveSetting("follow_links", not follow_links)
G_reader_settings:saveSetting("follow_links",
not is_follow_links_on())
end
},
{
text = _("Go back"),
enabled_func = function() return #self.link_states > 0 end,
callback = function() self:onGoBackLink() end,
},
{
text = _("Swipe to go back"),
checked_func = function() return swipe_to_go_back() end,
callback = function()
G_reader_settings:saveSetting("swipe_to_go_back",
not swipe_to_go_back())
end,
},
}
})
end
@ -76,7 +101,7 @@ function ReaderLink:onSetDimensions(dimen)
end
function ReaderLink:onTap(arg, ges)
if G_reader_settings:readSetting("follow_links") ~= true then return end
if not is_follow_links_on() then return end
if self.ui.document.info.has_pages then
local pos = self.view:screenToPageTransform(ges.pos)
if pos then
@ -115,21 +140,18 @@ function ReaderLink:onGotoLink(link)
return true
end
function ReaderLink:onSwipe(arg, ges)
if ges.direction == "east" then
if self.ui.document.info.has_pages then
local last_page = table.remove(self.link_states)
if last_page then
self.ui:handleEvent(Event:new("GotoPage", last_page))
return true
end
else
local last_xp = table.remove(self.link_states)
if last_xp then
self.ui:handleEvent(Event:new("GotoXPointer", last_xp))
function ReaderLink:onGoBackLink()
local last_page_or_xp = table.remove(self.link_states)
if last_page_or_xp then
local event = self.ui.document.info.has_pages and "GotoPage" or "GotoXPointer"
self.ui:handleEvent(Event:new(event, last_page_or_xp))
return true
end
end
function ReaderLink:onSwipe(arg, ges)
if ges.direction == "east" and swipe_to_go_back() then
return self:onGoBackLink()
end
end

@ -2,8 +2,8 @@ Installation instructions for Kobo:
Newer installation based on Start Menu:
- Install "Start Menu" (http://www.mobileread.com/forums/showthread.php?t=233259)
- Extract the koreader folder of the zip into the ".kobo" directory (both KoboRoot.tgz and the koreader.png file are only needed for the older installation based on Filemonitor. See below.).
- Install "Start Menu" (http://www.mobileread.com/forums/showthread.php?t=255978)
- Extract the koreader folder of the zip into the ".adds" directory (both KoboRoot.tgz and the koreader.png file are only needed for the older installation based on Filemonitor. See below.).
Select koreader from the Start Menu to start.

Loading…
Cancel
Save