mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Migrate location and language module from Java to Kotlin (#5988)
* Rename .java to .kt * Migrated location and language module from Java to Kotlin * Changed lastLocation visibility
This commit is contained in:
		
							parent
							
								
									771f370f9a
								
							
						
					
					
						commit
						8265cc6306
					
				
					 15 changed files with 773 additions and 827 deletions
				
			
		|  | @ -62,5 +62,5 @@ class LatLngTests { | |||
|     private fun assertPrettyCoordinateString( | ||||
|         expected: String, | ||||
|         place: LatLng, | ||||
|     ) = assertEquals(expected, place.prettyCoordinateString) | ||||
|     ) = assertEquals(expected, place.getPrettyCoordinateString()) | ||||
| } | ||||
|  |  | |||
|  | @ -248,11 +248,11 @@ class MediaDetailFragmentUnitTests { | |||
|     @Throws(Exception::class) | ||||
|     fun testOnUpdateCoordinatesClickedCurrentLocationNull() { | ||||
|         `when`(media.coordinates).thenReturn(null) | ||||
|         `when`(locationManager.lastLocation).thenReturn(null) | ||||
|         `when`(locationManager.getLastLocation()).thenReturn(null) | ||||
|         `when`(applicationKvStore.getString(lastLocation)).thenReturn("37.773972,-122.431297") | ||||
|         fragment.onUpdateCoordinatesClicked() | ||||
|         Mockito.verify(media, Mockito.times(1)).coordinates | ||||
|         Mockito.verify(locationManager, Mockito.times(1)).lastLocation | ||||
|         Mockito.verify(locationManager, Mockito.times(1)).getLastLocation() | ||||
|         val shadowActivity: ShadowActivity = shadowOf(activity) | ||||
|         val startedIntent = shadowActivity.nextStartedActivity | ||||
|         val shadowIntent: ShadowIntent = shadowOf(startedIntent) | ||||
|  | @ -276,11 +276,11 @@ class MediaDetailFragmentUnitTests { | |||
|     @Throws(Exception::class) | ||||
|     fun testOnUpdateCoordinatesClickedCurrentLocationNotNull() { | ||||
|         `when`(media.coordinates).thenReturn(null) | ||||
|         `when`(locationManager.lastLocation).thenReturn(LatLng(-0.000001, -0.999999, 0f)) | ||||
|         `when`(locationManager.getLastLocation()).thenReturn(LatLng(-0.000001, -0.999999, 0f)) | ||||
|         `when`(applicationKvStore.getString(lastLocation)).thenReturn("37.773972,-122.431297") | ||||
| 
 | ||||
|         fragment.onUpdateCoordinatesClicked() | ||||
|         Mockito.verify(locationManager, Mockito.times(3)).lastLocation | ||||
|         Mockito.verify(locationManager, Mockito.times(3)).getLastLocation() | ||||
|         val shadowActivity: ShadowActivity = shadowOf(activity) | ||||
|         val startedIntent = shadowActivity.nextStartedActivity | ||||
|         val shadowIntent: ShadowIntent = shadowOf(startedIntent) | ||||
|  |  | |||
|  | @ -54,8 +54,8 @@ class LanguagesAdapterTest { | |||
|                 .from(context) | ||||
|                 .inflate(R.layout.row_item_languages_spinner, null) as View | ||||
| 
 | ||||
|         languageNamesList = language.localizedNames | ||||
|         languageCodesList = language.codes | ||||
|         languageNamesList = language.getLocalizedNames() | ||||
|         languageCodesList = language.getCodes() | ||||
| 
 | ||||
|         languagesAdapter = LanguagesAdapter(context, selectedLanguages) | ||||
|     } | ||||
|  | @ -124,12 +124,12 @@ class LanguagesAdapterTest { | |||
|         var i = 0 | ||||
|         var s = 0 | ||||
|         while (i < length) { | ||||
|             val key: String = language.codes[i] | ||||
|             val value: String = language.localizedNames[i] | ||||
|             val key: String = language.getCodes()[i] | ||||
|             val value: String = language.getLocalizedNames()[i] | ||||
|             if (value.contains(constraint, true) || | ||||
|                 Locale(key) | ||||
|                     .getDisplayName( | ||||
|                         Locale(language.codes[defaultlanguagecode!!]), | ||||
|                         Locale(language.getCodes()[defaultlanguagecode!!]), | ||||
|                     ).contains(constraint, true) | ||||
|             ) { | ||||
|                 s++ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Saifuddin Adenwala
						Saifuddin Adenwala