Commit Graph

19 Commits (master)

Author SHA1 Message Date
greatyingzi a6f0c3a31c
ReadTimer: allow repeat when time is up (#9844) 1 year ago
zwim 192a243b4d Add datetime.lua
Move date and time related functions from util.lua
(and the statistics plugin) to a new datetime.lua.
1 year ago
zwim 4969811c08
Optimization: Use constant folding for divisions not a power of two (#9609) 2 years ago
NiLuJe fadee1f5dc
Clarify our OOP semantics across the codebase (#9586)
Basically:

* Use `extend` for class definitions
* Use `new` for object instantiations

That includes some minor code cleanups along the way:

* Updated `Widget`'s docs to make the semantics clearer.
* Removed `should_restrict_JIT` (it's been dead code since https://github.com/koreader/android-luajit-launcher/pull/283)
* Minor refactoring of LuaSettings/LuaData/LuaDefaults/DocSettings to behave (mostly, they are instantiated via `open` instead of `new`) like everything else and handle inheritance properly (i.e., DocSettings is now a proper LuaSettings subclass).
* Default to `WidgetContainer` instead of `InputContainer` for stuff that doesn't actually setup key/gesture events.
* Ditto for explicit `*Listener` only classes, make sure they're based on `EventListener` instead of something uselessly fancier.
* Unless absolutely necessary, do not store references in class objects, ever; only values. Instead, always store references in instances, to avoid both sneaky inheritance issues, and sneaky GC pinning of stale references.
  * ReaderUI: Fix one such issue with its `active_widgets` array, with critical implications, as it essentially pinned *all* of ReaderUI's modules, including their reference to the `Document` instance (i.e., that was a big-ass leak).
* Terminal: Make sure the shell is killed on plugin teardown.
* InputText: Fix Home/End/Del physical keys to behave sensibly.
* InputContainer/WidgetContainer: If necessary, compute self.dimen at paintTo time (previously, only InputContainers did, which might have had something to do with random widgets unconcerned about input using it as a baseclass instead of WidgetContainer...).
* OverlapGroup: Compute self.dimen at *init* time, because for some reason it needs to do that, but do it directly in OverlapGroup instead of going through a weird WidgetContainer method that it was the sole user of.
* ReaderCropping: Under no circumstances should a Document instance member (here, self.bbox) risk being `nil`ed!
* Kobo: Minor code cleanups.
2 years ago
zwim 13274d6212
datetimewidget: simpler usage, allows 2 to 6 numberpickers for date and time (#9070) 2 years ago
zwim 9ed22df03f
DateTimeWidget: replaces DateWidget and TimeWidget (#8240)
Deduplicate code by combining DateWidget and TimeWidget.
ReadTimer plugin: some rewording.
3 years ago
NiLuJe 1c739f1d54
ReadTimer: More QoL tweaks (#8107)
* Cleanup util.secondsFrom*Clock stuff (simpler maths, tail calls, meaningful printf tokens).
* Use util.secondsToClockDuration in ReadTimer instead of reinventing the wheel three different ways.
* Reschedule unexpired timers properly on resume (as best as we can, given the unreliable nature of REALTIME).
* Make clock timers tick on the dot, instead of at the same second as when being set.
* Speaking of clock timers, leave the math to os.date & os.time, don't reinvent the wheel yet again.
3 years ago
NiLuJe 056c03a262 ReadTimer: Small QoL fixes
* Never show negative relative time values.
* Make sure the alarm fires on resume if it expired during suspend.

Fix #8031
3 years ago
Robert 48f20b2153 [i18n, plugins] ReadTimer - better plural forms (#5315)
See: https://github.com/koreader/koreader/pull/3420#pullrequestreview-71776459
5 years ago
poire-z 850be52177
Keep some menus open when Tap or Hold (#4189)
TouchMenu: added options to menu items with the following defaults:
    keep_menu_open = false
    hold_keep_menu_open = true
So, default for Tap callback is to close menu, and for Hold callback
to keep menu open.
In both cases, provide the TouchMenu instance as the 1st argument to
the callback functions (instead of a refresh_menu_func I added in #3941)
so the callback can do more things, like closing, refreshing,
changing menu items text and re-ordering...

ReaderZooming: show symbol for default (like it was done for
ReaderFont, ReaderHyphenation...)
TextEditor plugin: update the previously opened files list in real
time, so the menu can be kept open and used as the TextEditor main
interface.
SSH plugin: keep menu open and update the Start/Stop state in real time
ReadTimer plugin: tried to do what feels right (but I don't use it)

Also remove forgotten cp in the move/paste file code
6 years ago
Robert 5344e0b672 [Fix] Don't load disabled plugins (#4169) 6 years ago
Robert 4428ecb422 Plugin manager (#4159)
Also adds descriptions to all plugins.
6 years ago
Robert 6fbb4e4ff4 [feat] Add default to the last value used in ReadTimer (#3963) 6 years ago
Robert e1019baf46 separate strings for singular and plural (#3420) 7 years ago
Robert ddf700043d [ReadTimer] Time from now (#3311) 7 years ago
Robert f45188fb9d Time reader with normal time format v2 (#3279) 7 years ago
Robert 019513f785 Prevent crash Timer in Filemanager (#3237) 7 years ago
Frans de Jonge b4167672fd Read timer: various improvements
* no timeout on alarm
* autoclose menu when starting timer
* show time in menu when active
7 years ago
Hzj_jie 0318a048b4 Read timer plugin (#2672)
A countdown timer to notify user.
7 years ago