mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
Allow changing chapter by volume key. Close #250
This commit is contained in:
@@ -370,8 +370,24 @@ abstract mixin class _VolumeListener {
|
||||
|
||||
bool toPrevPage();
|
||||
|
||||
bool toNextChapter();
|
||||
|
||||
bool toPrevChapter();
|
||||
|
||||
VolumeListener? volumeListener;
|
||||
|
||||
void onDown() {
|
||||
if (!toNextPage()) {
|
||||
toNextChapter();
|
||||
}
|
||||
}
|
||||
|
||||
void onUp() {
|
||||
if (!toPrevPage()) {
|
||||
toPrevChapter();
|
||||
}
|
||||
}
|
||||
|
||||
void handleVolumeEvent() {
|
||||
if (!App.isAndroid) {
|
||||
// Currently only support Android
|
||||
@@ -381,8 +397,8 @@ abstract mixin class _VolumeListener {
|
||||
volumeListener?.cancel();
|
||||
}
|
||||
volumeListener = VolumeListener(
|
||||
onDown: toNextPage,
|
||||
onUp: toPrevPage,
|
||||
onDown: onDown,
|
||||
onUp: onUp,
|
||||
)..listen();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user