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 toPrevPage();
|
||||||
|
|
||||||
|
bool toNextChapter();
|
||||||
|
|
||||||
|
bool toPrevChapter();
|
||||||
|
|
||||||
VolumeListener? volumeListener;
|
VolumeListener? volumeListener;
|
||||||
|
|
||||||
|
void onDown() {
|
||||||
|
if (!toNextPage()) {
|
||||||
|
toNextChapter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onUp() {
|
||||||
|
if (!toPrevPage()) {
|
||||||
|
toPrevChapter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void handleVolumeEvent() {
|
void handleVolumeEvent() {
|
||||||
if (!App.isAndroid) {
|
if (!App.isAndroid) {
|
||||||
// Currently only support Android
|
// Currently only support Android
|
||||||
@@ -381,8 +397,8 @@ abstract mixin class _VolumeListener {
|
|||||||
volumeListener?.cancel();
|
volumeListener?.cancel();
|
||||||
}
|
}
|
||||||
volumeListener = VolumeListener(
|
volumeListener = VolumeListener(
|
||||||
onDown: toNextPage,
|
onDown: onDown,
|
||||||
onUp: toPrevPage,
|
onUp: onUp,
|
||||||
)..listen();
|
)..listen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user