mirror of
https://github.com/jellyfin/jellyfin-android.git
synced 2024-11-23 13:59:42 +00:00
Fix or suppress various lint warnings
This commit is contained in:
parent
21667ea05f
commit
4f0e651a83
14
android-lint.xml
Normal file
14
android-lint.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<lint>
|
||||
<issue id="ExtraTranslation" severity="warning" />
|
||||
<issue id="MissingQuantity" severity="warning" />
|
||||
<issue id="MissingTranslation" severity="ignore" />
|
||||
<issue id="Typos">
|
||||
<!-- Translations are handled through Weblate -->
|
||||
<ignore regexp="app/src/main/res/values-.*" />
|
||||
</issue>
|
||||
<issue id="TypographyEllipsis">
|
||||
<!-- Weblate doesn't use ellipsis characters -->
|
||||
<ignore regexp="app/src/main/res/values-.*" />
|
||||
</issue>
|
||||
</lint>
|
@ -71,6 +71,12 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
bundle {
|
||||
language {
|
||||
enableSplit = false
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UnstableApiUsage")
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
@ -83,9 +89,9 @@ android {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
}
|
||||
lint {
|
||||
lintConfig = file("$rootDir/android-lint.xml")
|
||||
abortOnError = false
|
||||
sarifReport = true
|
||||
disable.addAll(setOf("MissingTranslation", "ExtraTranslation"))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
package org.jellyfin.mobile.player.interaction
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.media.session.MediaSession
|
||||
import org.jellyfin.mobile.player.PlayerViewModel
|
||||
|
||||
@SuppressLint("MissingOnPlayFromSearch")
|
||||
class PlayerMediaSessionCallback(private val viewModel: PlayerViewModel) : MediaSession.Callback() {
|
||||
override fun onPlay() {
|
||||
viewModel.play()
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.jellyfin.mobile.webapp
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Notification
|
||||
import android.app.NotificationManager
|
||||
import android.app.PendingIntent
|
||||
@ -31,9 +32,9 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jellyfin.mobile.app.AppPreferences
|
||||
import org.jellyfin.mobile.MainActivity
|
||||
import org.jellyfin.mobile.R
|
||||
import org.jellyfin.mobile.app.AppPreferences
|
||||
import org.jellyfin.mobile.utils.Constants
|
||||
import org.jellyfin.mobile.utils.Constants.EXTRA_ALBUM
|
||||
import org.jellyfin.mobile.utils.Constants.EXTRA_ARTIST
|
||||
@ -339,44 +340,47 @@ class RemotePlayerService : Service(), CoroutineScope {
|
||||
mediaController = MediaController(applicationContext, sessionToken)
|
||||
@Suppress("DEPRECATION")
|
||||
setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS or MediaSession.FLAG_HANDLES_MEDIA_BUTTONS)
|
||||
setCallback(object : MediaSession.Callback() {
|
||||
override fun onPlay() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_PLAY)
|
||||
}
|
||||
setCallback(
|
||||
@SuppressLint("MissingOnPlayFromSearch")
|
||||
object : MediaSession.Callback() {
|
||||
override fun onPlay() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_PLAY)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_PAUSE)
|
||||
}
|
||||
override fun onPause() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_PAUSE)
|
||||
}
|
||||
|
||||
override fun onSkipToPrevious() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_PREVIOUS)
|
||||
}
|
||||
override fun onSkipToPrevious() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_PREVIOUS)
|
||||
}
|
||||
|
||||
override fun onSkipToNext() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_NEXT)
|
||||
}
|
||||
override fun onSkipToNext() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_NEXT)
|
||||
}
|
||||
|
||||
override fun onRewind() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_REWIND)
|
||||
}
|
||||
override fun onRewind() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_REWIND)
|
||||
}
|
||||
|
||||
override fun onFastForward() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_FAST_FORWARD)
|
||||
}
|
||||
override fun onFastForward() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_FAST_FORWARD)
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_STOP)
|
||||
onStopped()
|
||||
}
|
||||
override fun onStop() {
|
||||
webappFunctionChannel.callPlaybackManagerAction(PLAYBACK_MANAGER_COMMAND_STOP)
|
||||
onStopped()
|
||||
}
|
||||
|
||||
override fun onSeekTo(pos: Long) {
|
||||
webappFunctionChannel.seekTo(pos)
|
||||
val currentState = playbackState ?: return
|
||||
val isPlaying = currentState.state == PlaybackState.STATE_PLAYING
|
||||
val canSeek = (currentState.actions and PlaybackState.ACTION_SEEK_TO) != 0L
|
||||
setPlaybackState(isPlaying, pos, canSeek)
|
||||
override fun onSeekTo(pos: Long) {
|
||||
webappFunctionChannel.seekTo(pos)
|
||||
val currentState = playbackState ?: return
|
||||
val isPlaying = currentState.state == PlaybackState.STATE_PLAYING
|
||||
val canSeek = (currentState.actions and PlaybackState.ACTION_SEEK_TO) != 0L
|
||||
setPlaybackState(isPlaying, pos, canSeek)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">Jellyfin</string>
|
||||
<string name="position_duration_divider" translatable="false">" / "</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user