Skip to content

Commit

Permalink
Fix or suppress various lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxr1998 authored and nielsvanvelzen committed Mar 28, 2022
1 parent 21667ea commit 4f0e651
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 33 deletions.
14 changes: 14 additions & 0 deletions android-lint.xml
Original file line number Diff line number Diff line change
@@ -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>
8 changes: 7 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ android {
}
}

bundle {
language {
enableSplit = false
}
}

@Suppress("UnstableApiUsage")
buildFeatures {
viewBinding = true
Expand All @@ -83,9 +89,9 @@ android {
isCoreLibraryDesugaringEnabled = true
}
lint {
lintConfig = file("$rootDir/android-lint.xml")
abortOnError = false
sarifReport = true
disable.addAll(setOf("MissingTranslation", "ExtraTranslation"))
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
66 changes: 35 additions & 31 deletions app/src/main/java/org/jellyfin/mobile/webapp/RemotePlayerService.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
})
)
}
}

Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings_donottranslate.xml
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 4f0e651

Please sign in to comment.