Fix some warnings & recreate lint-baseline.xml (#4278)

This commit is contained in:
Konrad Pozniak 2024-02-25 16:20:26 +01:00 committed by GitHub
commit 6249b53718
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 119 additions and 75 deletions

View file

@ -59,7 +59,7 @@ class AccountMediaRemoteMediator(
}
val attachments = statuses.flatMap { status ->
AttachmentViewData.list(status, activeAccount.alwaysShowSensitiveMedia ?: false)
AttachmentViewData.list(status, activeAccount.alwaysShowSensitiveMedia)
}
if (loadType == LoadType.REFRESH) {

View file

@ -27,7 +27,7 @@ import com.keylesspalace.tusky.viewdata.AttachmentViewData
import javax.inject.Inject
class AccountMediaViewModel @Inject constructor(
private val accountManager: AccountManager,
accountManager: AccountManager,
api: MastodonApi
) : ViewModel() {

View file

@ -966,7 +966,7 @@ class ComposeActivity :
private fun onMediaPick() {
addMediaBehavior.addBottomSheetCallback(
object : BottomSheetBehavior.BottomSheetCallback() {
object : BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
// Wait until bottom sheet is not collapsed and show next screen after
if (newState == BottomSheetBehavior.STATE_COLLAPSED) {

View file

@ -54,7 +54,7 @@ class CaptionDialog : DialogFragment() {
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
) = inflater.inflate(R.layout.dialog_image_description, container, false)
): View = inflater.inflate(R.layout.dialog_image_description, container, false)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val imageView = binding.imageDescriptionView

View file

@ -41,7 +41,7 @@ data class Links(val next: String?, val prev: String?) {
*
* Should only be called by a worker thread.
*
* @see NotificationWorker
* @see com.keylesspalace.tusky.worker.NotificationWorker
* @see <a href="https://developer.android.com/guide/background/persistent/threading/worker">Background worker</a>
*/
@WorkerThread

View file

@ -40,7 +40,6 @@ import org.xml.sax.XMLReader
class ViewEditsAdapter(
private val edits: List<StatusEdit>,
private val animateAvatars: Boolean,
private val animateEmojis: Boolean,
private val useBlurhash: Boolean,
private val listener: LinkListener

View file

@ -135,7 +135,6 @@ class ViewEditsFragment :
binding.recyclerView.adapter = ViewEditsAdapter(
edits = uiState.edits,
animateAvatars = animateAvatars,
animateEmojis = animateEmojis,
useBlurhash = useBlurhash,
listener = this@ViewEditsFragment

View file

@ -21,7 +21,7 @@ data class Filter(
HIDE("hide");
companion object {
fun from(action: String): Action = values().firstOrNull { it.action == action } ?: WARN
fun from(action: String): Action = entries.firstOrNull { it.action == action } ?: WARN
}
}
enum class Kind(val kind: String) {
@ -32,7 +32,7 @@ data class Filter(
ACCOUNT("account");
companion object {
fun from(kind: String): Kind = values().firstOrNull { it.kind == kind } ?: PUBLIC
fun from(kind: String): Kind = entries.firstOrNull { it.kind == kind } ?: PUBLIC
}
}

View file

@ -35,7 +35,7 @@ data class MastoList(
companion object {
fun from(policy: String?): ReplyPolicy =
values().firstOrNull { it.policy == policy } ?: LIST
entries.firstOrNull { it.policy == policy } ?: LIST
}
}
}

View file

@ -69,7 +69,7 @@ data class Notification(
companion object {
@JvmStatic
fun byString(s: String): Type {
values().forEach {
entries.forEach {
if (s == it.presentation) {
return it
}

View file

@ -15,6 +15,7 @@
package com.keylesspalace.tusky.service
import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Intent
import android.os.Build
@ -28,6 +29,8 @@ import com.keylesspalace.tusky.components.compose.ComposeActivity
*/
class TuskyTileService : TileService() {
@SuppressLint("StartActivityAndCollapseDeprecated")
@Suppress("DEPRECATION")
override fun onClick() {
val intent = MainActivity.composeIntent(this, ComposeActivity.ComposeOptions())
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
@ -36,7 +39,6 @@ class TuskyTileService : TileService() {
val pendingIntent = PendingIntent.getActivity(this, 1, intent, PendingIntent.FLAG_IMMUTABLE)
startActivityAndCollapse(pendingIntent)
} else {
@Suppress("DEPRECATION")
startActivityAndCollapse(intent)
}
}

View file

@ -9,7 +9,7 @@ enum class AppTheme(val value: String) {
AUTO_SYSTEM_BLACK("auto_system_black");
companion object {
fun stringValues() = values().map { it.value }.toTypedArray()
fun stringValues() = entries.map { it.value }.toTypedArray()
@JvmField
val DEFAULT = AUTO_SYSTEM

View file

@ -35,7 +35,7 @@ suspend fun AlertDialog.await(
positiveText: String,
negativeText: String? = null,
neutralText: String? = null
) = suspendCancellableCoroutine<Int> { cont ->
) = suspendCancellableCoroutine { cont ->
val listener = DialogInterface.OnClickListener { _, which ->
cont.resume(which) { dismiss() }
}

View file

@ -41,7 +41,6 @@ import androidx.appcompat.content.res.AppCompatResources
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.net.toUri
import androidx.core.text.getSpans
import androidx.preference.PreferenceManager
import at.connyduck.sparkbutton.helpers.Utils
import com.google.android.material.color.MaterialColors