0
0
mirror of https://github.com/mediathekview/zapp.git synced 2024-09-19 11:52:15 +02:00

Fix linter warnings

This commit is contained in:
Christine Coenen 2023-07-22 12:42:38 +02:00
parent 732f6c5c2b
commit f66db0ea30
19 changed files with 32 additions and 41 deletions

1
.gitignore vendored
View File

@ -68,3 +68,4 @@ gradle-app.setting
/app/release
/app/releases
/prototype.txt

View File

@ -34,6 +34,7 @@ abstract class ZappApplicationBase : Application() {
private lateinit var koin: Koin
@Suppress("unused")
fun reportError(throwable: Throwable?) {
if (ACRA.isInitialised) {
ACRA.errorReporter.handleException(throwable)

View File

@ -3,7 +3,6 @@ package de.christinecoenen.code.zapp.app.livestream.api.model
import androidx.annotation.Keep
@Keep
@Suppress("unused")
enum class Channel(private val id: String) {
DAS_ERSTE("das_erste"),

View File

@ -11,5 +11,5 @@ class ShowResponse(
get() = shows!![0]
val isSuccess: Boolean
get() = shows != null && shows.isNotEmpty()
get() = !shows.isNullOrEmpty()
}

View File

@ -6,7 +6,6 @@ import android.os.Bundle
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import androidx.core.view.isVisible
import de.christinecoenen.code.zapp.R
import de.christinecoenen.code.zapp.app.livestream.ui.ProgramInfoViewModel
import de.christinecoenen.code.zapp.app.player.AbstractPlayerActivity

View File

@ -14,7 +14,6 @@ import androidx.core.view.MenuProvider
import androidx.core.view.isVisible
import androidx.navigation.NavController
import androidx.navigation.NavDestination
import androidx.navigation.NavGraph
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.*
import androidx.preference.PreferenceManager

View File

@ -8,13 +8,8 @@ import java.io.Serializable
@Keep
class QueryRequest : Serializable {
@Suppress("unused")
private val sortBy: String = "timestamp"
@Suppress("unused")
private val sortOrder: String = "desc"
@Suppress("unused")
private val future: Boolean = true
var offset: Int = 0

View File

@ -74,7 +74,6 @@ class DownloadFileInfoManager(
} else {
val resolver = applicationContext.contentResolver
@Suppress("NON_EXHAUSTIVE_WHEN")
when (status) {
DownloadStatus.DELETED,
DownloadStatus.FAILED -> try {

View File

@ -8,7 +8,6 @@ import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.fragment.app.setFragmentResultListener
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.google.android.material.snackbar.Snackbar
@ -29,7 +28,11 @@ import de.christinecoenen.code.zapp.utils.system.IntentHelper.openUrl
import de.christinecoenen.code.zapp.utils.system.LifecycleOwnerHelper.launchOnCreated
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.transform
import org.koin.android.ext.android.inject
import timber.log.Timber
import kotlin.time.Duration.Companion.milliseconds

View File

@ -1,7 +1,12 @@
package de.christinecoenen.code.zapp.app.mediathek.ui.list
import android.os.Bundle
import android.view.*
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.activity.OnBackPressedCallback
import androidx.core.view.MenuProvider
import androidx.core.view.isVisible
@ -19,9 +24,9 @@ import com.google.android.material.chip.Chip
import de.christinecoenen.code.zapp.R
import de.christinecoenen.code.zapp.app.mediathek.api.request.MediathekChannel
import de.christinecoenen.code.zapp.app.mediathek.api.result.QueryInfoResult
import de.christinecoenen.code.zapp.app.mediathek.ui.helper.ShowMenuHelper
import de.christinecoenen.code.zapp.app.mediathek.ui.list.adapter.FooterLoadStateAdapter
import de.christinecoenen.code.zapp.app.mediathek.ui.list.adapter.MediathekShowListItemListener
import de.christinecoenen.code.zapp.app.mediathek.ui.helper.ShowMenuHelper
import de.christinecoenen.code.zapp.app.mediathek.ui.list.adapter.PagedMediathekShowListAdapter
import de.christinecoenen.code.zapp.databinding.MediathekListFragmentBinding
import de.christinecoenen.code.zapp.databinding.ViewNoShowsBinding
@ -31,12 +36,12 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import org.koin.androidx.viewmodel.ext.android.viewModel
import java.net.UnknownServiceException
import java.text.DateFormat
import java.text.NumberFormat
import java.util.*
import java.util.Date
import java.util.Locale
import javax.net.ssl.SSLHandshakeException

View File

@ -8,7 +8,7 @@ sealed class UiModel {
class MediathekShowModel(
val show: MediathekShow,
val date: DateTime
date: DateTime
) : UiModel() {
val localDate = LocalDate(date)

View File

@ -3,7 +3,6 @@ package de.christinecoenen.code.zapp.app.player
import android.app.Notification
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.ServiceConnection
@ -87,7 +86,7 @@ class BackgroundPlayerService : LifecycleService(),
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
super.onStartCommand(intent, flags, startId)
handleIntent(intent)
return Service.START_STICKY
return START_STICKY
}
override fun onTaskRemoved(rootIntent: Intent) {
@ -169,7 +168,7 @@ class BackgroundPlayerService : LifecycleService(),
private fun movePlaybackToForeground() {
isPlaybackInBackground = false
stopForeground(Service.STOP_FOREGROUND_REMOVE)
stopForeground(STOP_FOREGROUND_REMOVE)
stopSelf()
playerNotificationManager?.apply {
@ -238,7 +237,7 @@ class BackgroundPlayerService : LifecycleService(),
if (ongoing) {
startForeground(notificationId, notification)
} else {
stopForeground(Service.STOP_FOREGROUND_REMOVE)
stopForeground(STOP_FOREGROUND_REMOVE)
}
}

View File

@ -2,6 +2,7 @@ package de.christinecoenen.code.zapp.app.settings.repository
import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import android.os.Build
import androidx.appcompat.app.AppCompatDelegate
import androidx.preference.PreferenceManager
@ -14,7 +15,7 @@ import kotlin.time.Duration.Companion.minutes
class SettingsRepository(context: Context) {
private val context = context.applicationContext
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
val lockVideosInLandcapeFormat: Boolean
get() = preferences.getBoolean(context.getString(R.string.pref_key_detail_landscape), true)

View File

@ -7,7 +7,6 @@ import androidx.core.os.LocaleListCompat
import androidx.navigation.fragment.findNavController
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import com.google.android.material.color.DynamicColors
import com.jakewharton.processphoenix.ProcessPhoenix

View File

@ -7,7 +7,12 @@ import de.christinecoenen.code.zapp.models.shows.PersistedMediathekShow
import de.christinecoenen.code.zapp.models.shows.SortableMediathekShow
import de.christinecoenen.code.zapp.persistence.Database
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.withContext
import org.joda.time.DateTime
@ -74,13 +79,6 @@ class MediathekRepository(private val database: Database) {
.update(show!!)
}
suspend fun updateDownloadStatus(downloadId: Int, downloadStatus: DownloadStatus?) =
withContext(Dispatchers.IO) {
database
.mediathekShowDao()
.updateDownloadStatus(downloadId, downloadStatus!!)
}
suspend fun updateDownloadProgress(downloadId: Int, progress: Int) =
withContext(Dispatchers.IO) {
database

View File

@ -17,7 +17,7 @@ class CrashFragment : ErrorSupportFragment() {
val dialogConfiguration =
helper.config.getPluginConfiguration(DialogConfiguration::class.java)
val iconResId = dialogConfiguration.resIcon ?: R.drawable.ic_zapp_tv_small;
val iconResId = dialogConfiguration.resIcon ?: R.drawable.ic_zapp_tv_small
title = dialogConfiguration.title
message = dialogConfiguration.text

View File

@ -22,6 +22,7 @@ object LifecycleOwnerHelper {
return launchOnLifecycle(Lifecycle.State.RESUMED, block)
}
@Suppress("MemberVisibilityCanBePrivate")
fun LifecycleOwner.launchOnLifecycle(
state: Lifecycle.State,
block: suspend CoroutineScope.() -> Unit

View File

@ -26,7 +26,7 @@ object NotificationHelper {
return ActivityCompat.checkSelfPermission(
context,
Manifest.permission.POST_NOTIFICATIONS
) == PackageManager.PERMISSION_GRANTED;
) == PackageManager.PERMISSION_GRANTED
}
@JvmStatic

View File

@ -92,14 +92,6 @@ class SwipeablePlayerView @JvmOverloads constructor(
subtitleView?.setUserDefaultTextSize()
}
fun toggleControls() {
if (isControllerFullyVisible) {
hideController()
} else {
showController()
}
}
private fun adjustBrightness(yPercent: Float) {
val lp = window.attributes
lp.screenBrightness = yPercent