Fix various lint warnings (#4409)
- Remove empty file `ExampleInstrumentedTest.java`. - Replace deprecated `MigrationTestHelper` constructor call. - Add reified inline extension methods for `Bundle` and `Intent` to retrieve `Parcelable` and `Serializable` objects by calling the core `BundleCompat` and `IntentCompat` methods, to allow shorter syntax and removing the need to pass the class explicitly. - Replace deprecated `drawable.setColorFilter()` with simpler `drawable.setTint()` (uses blend mode `SRC_IN` by default, has the same effect as `SRC_ATOP` when the source is a color). - Rename shadowed variables (mostly caught exceptions). - Remove unnecessary `.orEmpty()` on non-null fields. - Replace `.size() == 0` with `.isEmpty()`. - Prevent `NullPointerException` when `account.getDisplayName()` is `null` in `StatusBaseViewHolder.setDisplayName()`. - Declare `customEmojis` argument as non-null in `StatusBaseViewHolder.setDisplayName()` because it calls `CustomEmojiHelper.emojify()` which now requires it to be non-null. - Prevent `NullPointerException` when no matching filter is found in `StatusBaseViewHolder.setupFilterPlaceholder()`. - Remove deprecated call to `setTargetFragment()` (target fragment is not used anyway). - Remove deprecated call to `isUserVisibleHint()` and test if the view has been destroyed instead. - Remove some unused imports. - Remove unnecessary casts. - Rename arguments to supertype names when a warning is shown. - Prevent a potential memory leak by clearing the `toolbarVisibilityDisposable` reference in `onDestroyView()`.
This commit is contained in:
parent
7dc71a5888
commit
05c7e7b806
27 changed files with 108 additions and 106 deletions
|
|
@ -31,7 +31,6 @@ import android.util.Log
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.ServiceCompat
|
||||
import androidx.core.content.IntentCompat
|
||||
import at.connyduck.calladapter.networkresult.fold
|
||||
import com.keylesspalace.tusky.MainActivity
|
||||
import com.keylesspalace.tusky.R
|
||||
|
|
@ -52,6 +51,7 @@ import com.keylesspalace.tusky.entity.NewStatus
|
|||
import com.keylesspalace.tusky.entity.ScheduledStatus
|
||||
import com.keylesspalace.tusky.entity.Status
|
||||
import com.keylesspalace.tusky.network.MastodonApi
|
||||
import com.keylesspalace.tusky.util.getParcelableExtraCompat
|
||||
import com.keylesspalace.tusky.util.unsafeLazy
|
||||
import dagger.android.AndroidInjection
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
|
@ -102,7 +102,7 @@ class SendStatusService : Service(), Injectable {
|
|||
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
if (intent.hasExtra(KEY_STATUS)) {
|
||||
val statusToSend: StatusToSend = IntentCompat.getParcelableExtra(intent, KEY_STATUS, StatusToSend::class.java)
|
||||
val statusToSend: StatusToSend = intent.getParcelableExtraCompat(KEY_STATUS)
|
||||
?: throw IllegalStateException("SendStatusService started without $KEY_STATUS extra")
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
|
|
@ -247,11 +247,11 @@ class SendStatusService : Service(), Injectable {
|
|||
scheduledAt = statusToSend.scheduledAt,
|
||||
poll = statusToSend.poll,
|
||||
language = statusToSend.language,
|
||||
mediaAttributes = media.map { media ->
|
||||
mediaAttributes = media.map { mediaItem ->
|
||||
MediaAttribute(
|
||||
id = media.id!!,
|
||||
description = media.description,
|
||||
focus = media.focus?.toMastodonApiString(),
|
||||
id = mediaItem.id!!,
|
||||
description = mediaItem.description,
|
||||
focus = mediaItem.focus?.toMastodonApiString(),
|
||||
thumbnail = null
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue