Fixed Migration warnings under Kotlin header

This commit is contained in:
sonalyadav 2024-12-21 21:21:47 +05:30
parent 4dd16054ca
commit 406ebcabf0
13 changed files with 15 additions and 15 deletions

View file

@ -146,7 +146,7 @@ class LoginActivity : AccountAuthenticatorActivity() {
loginTwoFactor.removeTextChangedListener(textWatcher) loginTwoFactor.removeTextChangedListener(textWatcher)
} }
delegate.onDestroy() delegate.onDestroy()
loginClient?.cancel() loginClient.cancel()
binding = null binding = null
super.onDestroy() super.onDestroy()
} }

View file

@ -250,7 +250,7 @@ class CustomSelectorActivity :
val selectedImages: ArrayList<Image> = val selectedImages: ArrayList<Image> =
result.data!! result.data!!
.getParcelableArrayListExtra(CustomSelectorConstants.NEW_SELECTED_IMAGES)!! .getParcelableArrayListExtra(CustomSelectorConstants.NEW_SELECTED_IMAGES)!!
viewModel?.selectedImages?.value = selectedImages viewModel.selectedImages?.value = selectedImages
} }
} }

View file

@ -240,7 +240,7 @@ class DescriptionEditActivity :
applicationContext, applicationContext,
media, media,
updatedWikiText, updatedWikiText,
)?.subscribeOn(Schedulers.io()) ).subscribeOn(Schedulers.io())
?.observeOn(AndroidSchedulers.mainThread()) ?.observeOn(AndroidSchedulers.mainThread())
?.subscribe(Consumer<Boolean> { s: Boolean? -> Timber.d("Descriptions are added.") }) ?.subscribe(Consumer<Boolean> { s: Boolean? -> Timber.d("Descriptions are added.") })
?.let { ?.let {

View file

@ -175,7 +175,7 @@ class OkHttpJsonApiClient @Inject constructor(
.build() .build()
val response: Response = okHttpClient.newCall(request).execute() val response: Response = okHttpClient.newCall(request).execute()
if (response.body != null && response.isSuccessful) { if (response.body != null && response.isSuccessful) {
val json: String = response.body!!.string() ?: return@fromCallable null val json: String = response.body!!.string()
try { try {
return@fromCallable gson.fromJson<UpdateAvatarResponse>( return@fromCallable gson.fromJson<UpdateAvatarResponse>(
json, json,

View file

@ -86,7 +86,7 @@ class FileProcessor
*/ */
fun getExifTagsToRedact(): Set<String> { fun getExifTagsToRedact(): Set<String> {
val prefManageEXIFTags = val prefManageEXIFTags =
defaultKvStore.getStringSet(Prefs.MANAGED_EXIF_TAGS) ?: emptySet() defaultKvStore.getStringSet(Prefs.MANAGED_EXIF_TAGS)
val redactTags: Set<String> = val redactTags: Set<String> =
context.resources.getStringArray(R.array.pref_exifTag_values).toSet() context.resources.getStringArray(R.array.pref_exifTag_values).toSet()
return redactTags - prefManageEXIFTags return redactTags - prefManageEXIFTags

View file

@ -14,7 +14,7 @@ data class UploadResult(
constructor(parcel: Parcel) : this( constructor(parcel: Parcel) : this(
parcel.readString() ?: "", parcel.readString() ?: "",
parcel.readString() ?: "", parcel.readString() ?: "",
parcel.readInt() ?: 0, parcel.readInt(),
parcel.readString() ?: "", parcel.readString() ?: "",
) { ) {
} }

View file

@ -439,7 +439,7 @@ class UploadWorker(
username, username,
) )
CommonsApplication CommonsApplication
.instance!! .instance
.clearApplicationData(appContext, logoutListener) .clearApplicationData(appContext, logoutListener)
} }
} }

View file

@ -55,7 +55,7 @@ class CustomSelectorUtils {
val uploadableFile = PickedFiles.pickedExistingPicture(context, image.uri) val uploadableFile = PickedFiles.pickedExistingPicture(context, image.uri)
val exifInterface: ExifInterface? = val exifInterface: ExifInterface? =
try { try {
ExifInterface(uploadableFile.file!!) ExifInterface(uploadableFile.file)
} catch (e: IOException) { } catch (e: IOException) {
Timber.e(e) Timber.e(e)
null null

View file

@ -62,6 +62,6 @@ object DownloadUtils {
) { ) {
val systemService = val systemService =
activity.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager activity.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
systemService?.enqueue(req) systemService.enqueue(req)
} }
} }

View file

@ -176,7 +176,7 @@ class WikidataEditService @Inject constructor(
SnakPartial( SnakPartial(
"value", "value",
MEDIA_LEGENDS.propertyName, MonoLingualText( MEDIA_LEGENDS.propertyName, MonoLingualText(
WikiBaseMonolingualTextValue(value!!, key!!) WikiBaseMonolingualTextValue(value, key)
) )
) )
) )

View file

@ -68,7 +68,7 @@ class BookmarkLocationControllerTest {
@Test @Test
fun loadBookmarkedLocations() { fun loadBookmarkedLocations() {
val bookmarkedLocations = val bookmarkedLocations =
bookmarkLocationsController!!.loadFavoritesLocations() bookmarkLocationsController.loadFavoritesLocations()
Assert.assertEquals(2, bookmarkedLocations.size.toLong()) Assert.assertEquals(2, bookmarkedLocations.size.toLong())
} }
} }

View file

@ -50,7 +50,7 @@ class JsonKvStoreTest {
fun getJson() { fun getJson() {
whenever(prefs.getString("key", null)).thenReturn(expected) whenever(prefs.getString("key", null)).thenReturn(expected)
val result = store.getJson("key", Person::class.java) val result = store.getJson<Person>("key")
Assert.assertEquals(testData, result) Assert.assertEquals(testData, result)
} }
@ -70,7 +70,7 @@ class JsonKvStoreTest {
fun getJsonHandlesMalformedJson() { fun getJsonHandlesMalformedJson() {
whenever(prefs.getString("key", null)).thenReturn("junk") whenever(prefs.getString("key", null)).thenReturn("junk")
val result = store.getJson("key", Person::class.java) val result = store.getJson<Person>("key")
Assert.assertNull(result) Assert.assertNull(result)
} }

View file

@ -305,7 +305,7 @@ class NearbyParentFragmentPresenterTest {
whenever(nearbyParentFragmentView.mapFocus).thenReturn(LatLng(2.0, 1.0, 0.0F)) whenever(nearbyParentFragmentView.mapFocus).thenReturn(LatLng(2.0, 1.0, 0.0F))
// 111.19 km real distance, return false if 148306.444306 > currentLocationSearchRadius // 111.19 km real distance, return false if 148306.444306 > currentLocationSearchRadius
NearbyController.currentLocationSearchRadius = 148306.0 NearbyController.currentLocationSearchRadius = 148306.0
val isClose = nearbyPresenter?.searchCloseToCurrentLocation() val isClose = nearbyPresenter.searchCloseToCurrentLocation()
assertFalse(isClose!!.equals(false)) assertFalse(isClose!!.equals(false))
} }
@ -317,7 +317,7 @@ class NearbyParentFragmentPresenterTest {
whenever(nearbyParentFragmentView.getCameraTarget()).thenReturn(LatLng(2.0, 1.0, 0.0F)) whenever(nearbyParentFragmentView.getCameraTarget()).thenReturn(LatLng(2.0, 1.0, 0.0F))
// 111.19 km real distance, return false if 148253.333 > currentLocationSearchRadius // 111.19 km real distance, return false if 148253.333 > currentLocationSearchRadius
NearbyController.currentLocationSearchRadius = 148307.0 NearbyController.currentLocationSearchRadius = 148307.0
val isClose = nearbyPresenter?.searchCloseToCurrentLocation() val isClose = nearbyPresenter.searchCloseToCurrentLocation()
assertTrue(isClose!!) assertTrue(isClose!!)
} }