mirror of https://github.com/tuskyapp/Tusky.git
Browse Source
- 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()`.pull/4422/head
27 changed files with 108 additions and 106 deletions
@ -0,0 +1,23 @@
|
||||
package com.keylesspalace.tusky.util |
||||
|
||||
import android.content.Intent |
||||
import android.os.Bundle |
||||
import android.os.Parcelable |
||||
import androidx.core.content.IntentCompat |
||||
import androidx.core.os.BundleCompat |
||||
import java.io.Serializable |
||||
|
||||
inline fun <reified T : Parcelable> Bundle.getParcelableCompat(key: String?): T? = |
||||
BundleCompat.getParcelable(this, key, T::class.java) |
||||
|
||||
inline fun <reified T : Serializable> Bundle.getSerializableCompat(key: String?): T? = |
||||
BundleCompat.getSerializable(this, key, T::class.java) |
||||
|
||||
inline fun <reified T : Parcelable> Intent.getParcelableExtraCompat(key: String?): T? = |
||||
IntentCompat.getParcelableExtra(this, key, T::class.java) |
||||
|
||||
inline fun <reified T : Serializable> Intent.getSerializableExtraCompat(key: String?): T? = |
||||
IntentCompat.getSerializableExtra(this, key, T::class.java) |
||||
|
||||
inline fun <reified T : Parcelable> Intent.getParcelableArrayListExtraCompat(key: String?): ArrayList<T>? = |
||||
IntentCompat.getParcelableArrayListExtra(this, key, T::class.java) |
||||
Loading…
Reference in new issue