mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-15 08:24:50 +02:00
Make it possible to turn the page with volume keys
This commit is contained in:
parent
584023380c
commit
8a6a2b8577
9 changed files with 84 additions and 1 deletions
|
@ -10,6 +10,7 @@ android {
|
||||||
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':byteowls-capacitor-filesharer')
|
implementation project(':byteowls-capacitor-filesharer')
|
||||||
|
implementation project(':capacitor-community-volume-buttons')
|
||||||
implementation project(':capacitor-app')
|
implementation project(':capacitor-app')
|
||||||
implementation project(':capacitor-browser')
|
implementation project(':capacitor-browser')
|
||||||
implementation project(':capacitor-clipboard')
|
implementation project(':capacitor-clipboard')
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
"pkg": "@byteowls/capacitor-filesharer",
|
"pkg": "@byteowls/capacitor-filesharer",
|
||||||
"classpath": "com.byteowls.capacitor.filesharer.FileSharerPlugin"
|
"classpath": "com.byteowls.capacitor.filesharer.FileSharerPlugin"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"pkg": "@capacitor-community/volume-buttons",
|
||||||
|
"classpath": "com.ryltsov.alex.plugins.volume.buttons.VolumeButtonsPlugin"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"pkg": "@capacitor/app",
|
"pkg": "@capacitor/app",
|
||||||
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
|
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
|
||||||
|
|
|
@ -5,6 +5,9 @@ project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/
|
||||||
include ':byteowls-capacitor-filesharer'
|
include ':byteowls-capacitor-filesharer'
|
||||||
project(':byteowls-capacitor-filesharer').projectDir = new File('../node_modules/@byteowls/capacitor-filesharer/android')
|
project(':byteowls-capacitor-filesharer').projectDir = new File('../node_modules/@byteowls/capacitor-filesharer/android')
|
||||||
|
|
||||||
|
include ':capacitor-community-volume-buttons'
|
||||||
|
project(':capacitor-community-volume-buttons').projectDir = new File('../node_modules/@capacitor-community/volume-buttons/android')
|
||||||
|
|
||||||
include ':capacitor-app'
|
include ':capacitor-app'
|
||||||
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
|
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,12 @@
|
||||||
</div>
|
</div>
|
||||||
<ui-toggle-btns v-model="ereaderSettings.spread" :items="spreadItems" @input="settingsUpdated" />
|
<ui-toggle-btns v-model="ereaderSettings.spread" :items="spreadItems" @input="settingsUpdated" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="w-32">
|
||||||
|
<p class="text-base">{{ $strings.LabelNavigateWithVolume }}:</p>
|
||||||
|
</div>
|
||||||
|
<ui-toggle-btns v-model="ereaderSettings.navigateWithVolume" :items="navigateWithVolumeItems" @input="settingsUpdated" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -103,6 +109,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Capacitor } from '@capacitor/core'
|
import { Capacitor } from '@capacitor/core'
|
||||||
|
import { VolumeButtons } from '@capacitor-community/volume-buttons';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -123,7 +131,8 @@ export default {
|
||||||
fontScale: 100,
|
fontScale: 100,
|
||||||
lineSpacing: 115,
|
lineSpacing: 115,
|
||||||
spread: 'auto',
|
spread: 'auto',
|
||||||
textStroke: 0
|
textStroke: 0,
|
||||||
|
navigateWithVolume: 'enabled'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -180,6 +189,22 @@ export default {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
navigateWithVolumeItems() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
text: this.$strings.LabelNavigateWithVolumeEnabled,
|
||||||
|
value: 'enabled'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: this.$strings.LabelNavigateWithVolumeMirrored,
|
||||||
|
value: 'mirrored'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: this.$strings.LabelNavigateWithVolumeDisabled,
|
||||||
|
value: 'none'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
themeItems() {
|
themeItems() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
@ -392,11 +417,38 @@ export default {
|
||||||
this.$eventBus.$on('close-ebook', this.closeEvt)
|
this.$eventBus.$on('close-ebook', this.closeEvt)
|
||||||
document.body.addEventListener('touchstart', this.touchstart)
|
document.body.addEventListener('touchstart', this.touchstart)
|
||||||
document.body.addEventListener('touchend', this.touchend)
|
document.body.addEventListener('touchend', this.touchend)
|
||||||
|
|
||||||
|
if (!this.isMobi && this.ereaderSettings.navigateWithVolume != 'none'){
|
||||||
|
const options = {
|
||||||
|
disableSystemVolumeHandler: true,
|
||||||
|
suppressVolumeIndicator: true
|
||||||
|
}
|
||||||
|
VolumeButtons.watchVolume(options, this.volumePressed);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
unregisterListeners() {
|
unregisterListeners() {
|
||||||
this.$eventBus.$on('close-ebook', this.closeEvt)
|
this.$eventBus.$on('close-ebook', this.closeEvt)
|
||||||
document.body.removeEventListener('touchstart', this.touchstart)
|
document.body.removeEventListener('touchstart', this.touchstart)
|
||||||
document.body.removeEventListener('touchend', this.touchend)
|
document.body.removeEventListener('touchend', this.touchend)
|
||||||
|
if (VolumeButtons.isWatching()) {
|
||||||
|
VolumeButtons.clearWatch();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
volumePressed(e) {
|
||||||
|
if (this.ereaderSettings.navigateWithVolume == 'enabled'){
|
||||||
|
if (e.direction == "up") {
|
||||||
|
this.prev()
|
||||||
|
} else {
|
||||||
|
this.next()
|
||||||
|
}
|
||||||
|
} else if (this.ereaderSettings.navigateWithVolume == 'mirrored') {
|
||||||
|
if (e.direction == "down") {
|
||||||
|
this.prev()
|
||||||
|
} else {
|
||||||
|
this.next()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|
|
@ -12,6 +12,7 @@ def capacitor_pods
|
||||||
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
|
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
|
||||||
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
|
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
|
||||||
pod 'ByteowlsCapacitorFilesharer', :path => '../../node_modules/@byteowls/capacitor-filesharer'
|
pod 'ByteowlsCapacitorFilesharer', :path => '../../node_modules/@byteowls/capacitor-filesharer'
|
||||||
|
pod 'CapacitorCommunityVolumeButtons', :path => '../../node_modules/@capacitor-community/volume-buttons'
|
||||||
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
|
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'
|
||||||
pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser'
|
pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser'
|
||||||
pod 'CapacitorClipboard', :path => '../../node_modules/@capacitor/clipboard'
|
pod 'CapacitorClipboard', :path => '../../node_modules/@capacitor/clipboard'
|
||||||
|
|
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -9,6 +9,7 @@
|
||||||
"version": "0.9.76-beta",
|
"version": "0.9.76-beta",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@byteowls/capacitor-filesharer": "^5.0.0",
|
"@byteowls/capacitor-filesharer": "^5.0.0",
|
||||||
|
"@capacitor-community/volume-buttons": "^1.0.2",
|
||||||
"@capacitor/android": "^5.0.0",
|
"@capacitor/android": "^5.0.0",
|
||||||
"@capacitor/app": "^5.0.6",
|
"@capacitor/app": "^5.0.6",
|
||||||
"@capacitor/browser": "^5.1.0",
|
"@capacitor/browser": "^5.1.0",
|
||||||
|
@ -1979,6 +1980,18 @@
|
||||||
"@capacitor/core": ">=5"
|
"@capacitor/core": ">=5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@capacitor-community/volume-buttons": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@capacitor-community/volume-buttons/-/volume-buttons-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-weEwVCgMEdkYF9uWOeZmA3kXltXSbiGlLPTmygF6NMcL1VUg1vBsiCIaikeI5XRne5V4q8UeEda83EfW7eb46g==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0",
|
||||||
|
"npm": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@capacitor/core": "^5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@capacitor/android": {
|
"node_modules/@capacitor/android": {
|
||||||
"version": "5.6.0",
|
"version": "5.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/@capacitor/android/-/android-5.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/@capacitor/android/-/android-5.6.0.tgz",
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@byteowls/capacitor-filesharer": "^5.0.0",
|
"@byteowls/capacitor-filesharer": "^5.0.0",
|
||||||
|
"@capacitor-community/volume-buttons": "^1.0.2",
|
||||||
"@capacitor/android": "^5.0.0",
|
"@capacitor/android": "^5.0.0",
|
||||||
"@capacitor/app": "^5.0.6",
|
"@capacitor/app": "^5.0.6",
|
||||||
"@capacitor/browser": "^5.1.0",
|
"@capacitor/browser": "^5.1.0",
|
||||||
|
|
|
@ -176,6 +176,10 @@
|
||||||
"LabelName": "Name",
|
"LabelName": "Name",
|
||||||
"LabelNarrator": "Erzähler",
|
"LabelNarrator": "Erzähler",
|
||||||
"LabelNarrators": "Erzähler",
|
"LabelNarrators": "Erzähler",
|
||||||
|
"LabelNavigateWithVolume": "Mit Lautstärke blättern",
|
||||||
|
"LabelNavigateWithVolumeDisabled": "Aus",
|
||||||
|
"LabelNavigateWithVolumeEnabled": "An",
|
||||||
|
"LabelNavigateWithVolumeMirrored": "Umgekehrt",
|
||||||
"LabelNever": "Nie",
|
"LabelNever": "Nie",
|
||||||
"LabelNewestAuthors": "Neueste Autoren",
|
"LabelNewestAuthors": "Neueste Autoren",
|
||||||
"LabelNewestEpisodes": "Neueste Episoden",
|
"LabelNewestEpisodes": "Neueste Episoden",
|
||||||
|
|
|
@ -176,6 +176,10 @@
|
||||||
"LabelName": "Name",
|
"LabelName": "Name",
|
||||||
"LabelNarrator": "Narrator",
|
"LabelNarrator": "Narrator",
|
||||||
"LabelNarrators": "Narrators",
|
"LabelNarrators": "Narrators",
|
||||||
|
"LabelNavigateWithVolume": "Navigate with volume keys",
|
||||||
|
"LabelNavigateWithVolumeDisabled": "Off",
|
||||||
|
"LabelNavigateWithVolumeEnabled": "On",
|
||||||
|
"LabelNavigateWithVolumeMirrored": "Mirrored",
|
||||||
"LabelNever": "Never",
|
"LabelNever": "Never",
|
||||||
"LabelNewestAuthors": "Newest Authors",
|
"LabelNewestAuthors": "Newest Authors",
|
||||||
"LabelNewestEpisodes": "Newest Episodes",
|
"LabelNewestEpisodes": "Newest Episodes",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue