From 1de31b9184176bd34cc6fe3acd60a6e014715d42 Mon Sep 17 00:00:00 2001 From: WS64 Date: Thu, 3 Jul 2014 18:18:33 +0200 Subject: [PATCH] Added support for configurable swipes and jumping to next/previous chapter --- .../apps/reader/modules/readerrolling.lua | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/frontend/apps/reader/modules/readerrolling.lua b/frontend/apps/reader/modules/readerrolling.lua index 4de4d323e..45baae14c 100644 --- a/frontend/apps/reader/modules/readerrolling.lua +++ b/frontend/apps/reader/modules/readerrolling.lua @@ -121,6 +121,28 @@ function ReaderRolling:initGesListener() rate = 4.0, } }, + DoubleTapForward = { + GestureRange:new{ + ges = "double_tap", + range = Geom:new{ + x = Screen:getWidth()*DDOUBLE_TAP_ZONE_NEXT_CHAPTER.x, + y = Screen:getHeight()*DDOUBLE_TAP_ZONE_NEXT_CHAPTER.y, + w = Screen:getWidth()*DDOUBLE_TAP_ZONE_NEXT_CHAPTER.w, + h = Screen:getHeight()*DDOUBLE_TAP_ZONE_NEXT_CHAPTER.h, + } + } + }, + DoubleTapBackward = { + GestureRange:new{ + ges = "double_tap", + range = Geom:new{ + x = Screen:getWidth()*DDOUBLE_TAP_ZONE_PREV_CHAPTER.x, + y = Screen:getHeight()*DDOUBLE_TAP_ZONE_PREV_CHAPTER.y, + w = Screen:getWidth()*DDOUBLE_TAP_ZONE_PREV_CHAPTER.w, + h = Screen:getHeight()*DDOUBLE_TAP_ZONE_PREV_CHAPTER.h, + } + } + }, } end @@ -184,9 +206,17 @@ end function ReaderRolling:onSwipe(arg, ges) if ges.direction == "west" or ges.direction == "north" then - self:onGotoViewRel(1) + if DCHANGE_WEST_SWIPE_TO_EAST then + self:onGotoViewRel(-1) + else + self:onGotoViewRel(1) + end elseif ges.direction == "east" or ges.direction == "south" then - self:onGotoViewRel(-1) + if DCHANGE_EAST_SWIPE_TO_WEST then + self:onGotoViewRel(1) + else + self:onGotoViewRel(-1) + end end end @@ -215,6 +245,22 @@ function ReaderRolling:onResume() self:updateBatteryState() end +function ReaderRolling:onDoubleTapForward() + i = self.ui.toc:_getChapterPagesLeft(self.current_page,-1) + if i ~= "" then + self:onGotoViewRel(i+1) + end + return true +end + +function ReaderRolling:onDoubleTapBackward() + i = self.ui.toc:_getChapterPagesDone(self.current_page) + if i ~= "" then + self:onGotoViewRel(i) + end + return true +end + function ReaderRolling:onNotCharging() self:updateBatteryState() end