mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Merge branch 'main' into fix-for-5808
This commit is contained in:
		
						commit
						1038cb2d19
					
				
					 20 changed files with 97 additions and 75 deletions
				
			
		|  | @ -174,7 +174,7 @@ dependencies { | ||||||
|     kaptTest "androidx.databinding:databinding-compiler:8.0.2" |     kaptTest "androidx.databinding:databinding-compiler:8.0.2" | ||||||
|     kaptAndroidTest "androidx.databinding:databinding-compiler:8.0.2" |     kaptAndroidTest "androidx.databinding:databinding-compiler:8.0.2" | ||||||
| 
 | 
 | ||||||
|     implementation("io.github.coordinates2country:coordinates2country-android:1.3") {  exclude group: 'com.google.android', module: 'android' } |     implementation("io.github.coordinates2country:coordinates2country-android:1.8") {  exclude group: 'com.google.android', module: 'android' } | ||||||
| 
 | 
 | ||||||
|     //OSMDroid |     //OSMDroid | ||||||
|     implementation ("org.osmdroid:osmdroid-android:$OSMDROID_VERSION") |     implementation ("org.osmdroid:osmdroid-android:$OSMDROID_VERSION") | ||||||
|  |  | ||||||
|  | @ -17,6 +17,8 @@ import org.junit.Before | ||||||
| import org.junit.Rule | import org.junit.Rule | ||||||
| import org.junit.Test | import org.junit.Test | ||||||
| import org.junit.runner.RunWith | import org.junit.runner.RunWith | ||||||
|  | import org.hamcrest.MatcherAssert.assertThat | ||||||
|  | import org.hamcrest.CoreMatchers.equalTo | ||||||
| 
 | 
 | ||||||
| @LargeTest | @LargeTest | ||||||
| @RunWith(AndroidJUnit4::class) | @RunWith(AndroidJUnit4::class) | ||||||
|  | @ -59,7 +61,7 @@ class WelcomeActivityTest { | ||||||
|                 .perform(ViewActions.click()) |                 .perform(ViewActions.click()) | ||||||
|             onView(withId(R.id.finishTutorialButton)) |             onView(withId(R.id.finishTutorialButton)) | ||||||
|                 .perform(ViewActions.click()) |                 .perform(ViewActions.click()) | ||||||
|             assert(activityRule.activity.isDestroyed) |             assertThat(activityRule.activity.isDestroyed, equalTo(true)) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -69,10 +71,10 @@ class WelcomeActivityTest { | ||||||
|             .perform(ViewActions.click()) |             .perform(ViewActions.click()) | ||||||
|         onView(withId(R.id.welcomePager)) |         onView(withId(R.id.welcomePager)) | ||||||
|             .perform(ViewActions.swipeLeft()) |             .perform(ViewActions.swipeLeft()) | ||||||
|         assert(true) |         assertThat(true, equalTo(true)) | ||||||
|         onView(withId(R.id.welcomePager)) |         onView(withId(R.id.welcomePager)) | ||||||
|             .perform(ViewActions.swipeRight()) |             .perform(ViewActions.swipeRight()) | ||||||
|         assert(true) |         assertThat(true, equalTo(true)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|  | @ -84,13 +86,13 @@ class WelcomeActivityTest { | ||||||
|             .perform(ViewActions.swipeLeft()) |             .perform(ViewActions.swipeLeft()) | ||||||
|             .perform(ViewActions.swipeLeft()) |             .perform(ViewActions.swipeLeft()) | ||||||
|             .perform(ViewActions.swipeLeft()) |             .perform(ViewActions.swipeLeft()) | ||||||
|         assert(true) |         assertThat(true, equalTo(true)) | ||||||
|         onView(withId(R.id.welcomePager)) |         onView(withId(R.id.welcomePager)) | ||||||
|             .perform(ViewActions.swipeRight()) |             .perform(ViewActions.swipeRight()) | ||||||
|             .perform(ViewActions.swipeRight()) |             .perform(ViewActions.swipeRight()) | ||||||
|             .perform(ViewActions.swipeRight()) |             .perform(ViewActions.swipeRight()) | ||||||
|             .perform(ViewActions.swipeRight()) |             .perform(ViewActions.swipeRight()) | ||||||
|         assert(true) |         assertThat(true, equalTo(true)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|  | @ -101,10 +103,10 @@ class WelcomeActivityTest { | ||||||
|             if (viewPager.currentItem == 3) { |             if (viewPager.currentItem == 3) { | ||||||
|                 onView(withId(R.id.welcomePager)) |                 onView(withId(R.id.welcomePager)) | ||||||
|                     .perform(ViewActions.swipeLeft()) |                     .perform(ViewActions.swipeLeft()) | ||||||
|                 assert(true) |                 assertThat(true, equalTo(true)) | ||||||
|                 onView(withId(R.id.welcomePager)) |                 onView(withId(R.id.welcomePager)) | ||||||
|                     .perform(ViewActions.swipeRight()) |                     .perform(ViewActions.swipeRight()) | ||||||
|                 assert(false) |                 assertThat(true, equalTo(true)) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | @ -119,7 +121,7 @@ class WelcomeActivityTest { | ||||||
|                     .perform(ViewActions.click()) |                     .perform(ViewActions.click()) | ||||||
|                 onView(withId(R.id.finishTutorialButton)) |                 onView(withId(R.id.finishTutorialButton)) | ||||||
|                     .perform(ViewActions.click()) |                     .perform(ViewActions.click()) | ||||||
|                 assert(activityRule.activity.isDestroyed) |                 assertThat(activityRule.activity.isDestroyed, equalTo(true)) | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -13,7 +13,9 @@ | ||||||
|     android:maxSdkVersion="29"/> |     android:maxSdkVersion="29"/> | ||||||
|   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||||||
|   <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> |   <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> | ||||||
|   <uses-permission android:name="android.permission.GET_ACCOUNTS" /> |   <!-- Permission needed up to Android 5.1, see https://github.com/commons-app/apps-android-commons/pull/5863 --> | ||||||
|  |   <uses-permission android:name="android.permission.GET_ACCOUNTS" | ||||||
|  |     android:maxSdkVersion="22"/> | ||||||
|   <uses-permission android:name="android.permission.USE_CREDENTIALS" /> |   <uses-permission android:name="android.permission.USE_CREDENTIALS" /> | ||||||
|   <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> |   <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> | ||||||
|   <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> |   <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> | ||||||
|  |  | ||||||
|  | @ -40,7 +40,7 @@ class MediaConverter | ||||||
|                 metadata.licenseShortName(), |                 metadata.licenseShortName(), | ||||||
|                 metadata.prefixedLicenseUrl, |                 metadata.prefixedLicenseUrl, | ||||||
|                 getAuthor(metadata), |                 getAuthor(metadata), | ||||||
|                 imageInfo.user, |                 getAuthor(metadata), | ||||||
|                 MediaDataExtractorUtil.extractCategoriesFromList(metadata.categories), |                 MediaDataExtractorUtil.extractCategoriesFromList(metadata.categories), | ||||||
|                 metadata.latLng, |                 metadata.latLng, | ||||||
|                 entity.labels().mapValues { it.value.value() }, |                 entity.labels().mapValues { it.value.value() }, | ||||||
|  |  | ||||||
|  | @ -16,7 +16,6 @@ public interface Constants { | ||||||
|         int PICK_PICTURE_FROM_DOCUMENTS = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 11); |         int PICK_PICTURE_FROM_DOCUMENTS = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 11); | ||||||
|         int PICK_PICTURE_FROM_GALLERY = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 12); |         int PICK_PICTURE_FROM_GALLERY = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 12); | ||||||
|         int TAKE_PICTURE = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 13); |         int TAKE_PICTURE = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 13); | ||||||
|         int CAPTURE_VIDEO = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 14); |  | ||||||
| 
 | 
 | ||||||
|         int RECEIVE_DATA_FROM_FULL_SCREEN_MODE = 1 << 9; |         int RECEIVE_DATA_FROM_FULL_SCREEN_MODE = 1 << 9; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -109,7 +109,13 @@ public class FilePicker implements Constants { | ||||||
|      */ |      */ | ||||||
|     public static void openGallery(Activity activity, int type, boolean openDocumentIntentPreferred) { |     public static void openGallery(Activity activity, int type, boolean openDocumentIntentPreferred) { | ||||||
|         Intent intent = createGalleryIntent(activity, type, openDocumentIntentPreferred); |         Intent intent = createGalleryIntent(activity, type, openDocumentIntentPreferred); | ||||||
|         activity.startActivityForResult(intent, RequestCodes.PICK_PICTURE_FROM_GALLERY); |         int requestCode = RequestCodes.PICK_PICTURE_FROM_GALLERY; | ||||||
|  | 
 | ||||||
|  |             if(openDocumentIntentPreferred){ | ||||||
|  |                 requestCode = RequestCodes.PICK_PICTURE_FROM_DOCUMENTS; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         activity.startActivityForResult(intent, requestCode); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -157,7 +163,6 @@ public class FilePicker implements Constants { | ||||||
|             requestCode &= ~RequestCodes.SOURCE_CHOOSER; |             requestCode &= ~RequestCodes.SOURCE_CHOOSER; | ||||||
|             if (requestCode == RequestCodes.PICK_PICTURE_FROM_GALLERY || |             if (requestCode == RequestCodes.PICK_PICTURE_FROM_GALLERY || | ||||||
|                     requestCode == RequestCodes.TAKE_PICTURE || |                     requestCode == RequestCodes.TAKE_PICTURE || | ||||||
|                     requestCode == RequestCodes.CAPTURE_VIDEO || |  | ||||||
|                     requestCode == RequestCodes.PICK_PICTURE_FROM_DOCUMENTS || |                     requestCode == RequestCodes.PICK_PICTURE_FROM_DOCUMENTS || | ||||||
|                     requestCode == RequestCodes.PICK_PICTURE_FROM_CUSTOM_SELECTOR) { |                     requestCode == RequestCodes.PICK_PICTURE_FROM_CUSTOM_SELECTOR) { | ||||||
|                 if (resultCode == Activity.RESULT_OK) { |                 if (resultCode == Activity.RESULT_OK) { | ||||||
|  | @ -169,19 +174,16 @@ public class FilePicker implements Constants { | ||||||
|                         onPictureReturnedFromCustomSelector(data, activity, callbacks); |                         onPictureReturnedFromCustomSelector(data, activity, callbacks); | ||||||
|                     } else if (requestCode == RequestCodes.TAKE_PICTURE) { |                     } else if (requestCode == RequestCodes.TAKE_PICTURE) { | ||||||
|                         onPictureReturnedFromCamera(activity, callbacks); |                         onPictureReturnedFromCamera(activity, callbacks); | ||||||
|                     } else if (requestCode == RequestCodes.CAPTURE_VIDEO) { |  | ||||||
|                         onVideoReturnedFromCamera(activity, callbacks); |  | ||||||
|                     } else if (isPhoto(data)) { |  | ||||||
|                         onPictureReturnedFromCamera(activity, callbacks); |  | ||||||
|                     } else { |  | ||||||
|                         onPictureReturnedFromDocuments(data, activity, callbacks); |  | ||||||
|                     } |                     } | ||||||
|                 } else { |                 } else { | ||||||
|                     if (requestCode == RequestCodes.PICK_PICTURE_FROM_DOCUMENTS) { |                     if (requestCode == RequestCodes.PICK_PICTURE_FROM_DOCUMENTS) { | ||||||
|                         callbacks.onCanceled(FilePicker.ImageSource.DOCUMENTS, restoreType(activity)); |                         callbacks.onCanceled(FilePicker.ImageSource.DOCUMENTS, restoreType(activity)); | ||||||
|                     } else if (requestCode == RequestCodes.PICK_PICTURE_FROM_GALLERY) { |                     } else if (requestCode == RequestCodes.PICK_PICTURE_FROM_GALLERY) { | ||||||
|                         callbacks.onCanceled(FilePicker.ImageSource.GALLERY, restoreType(activity)); |                         callbacks.onCanceled(FilePicker.ImageSource.GALLERY, restoreType(activity)); | ||||||
|                     } else { |                     } else if (requestCode == RequestCodes.PICK_PICTURE_FROM_CUSTOM_SELECTOR){ | ||||||
|  |                         callbacks.onCanceled(ImageSource.CUSTOM_SELECTOR, restoreType(activity)); | ||||||
|  |                     } | ||||||
|  |                     else { | ||||||
|                         callbacks.onCanceled(FilePicker.ImageSource.CAMERA_IMAGE, restoreType(activity)); |                         callbacks.onCanceled(FilePicker.ImageSource.CAMERA_IMAGE, restoreType(activity)); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  | @ -19,6 +19,7 @@ import fr.free.nrw.commons.databinding.ActivityNotificationBinding; | ||||||
| import fr.free.nrw.commons.auth.SessionManager; | import fr.free.nrw.commons.auth.SessionManager; | ||||||
| import fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException; | import fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException; | ||||||
| import fr.free.nrw.commons.notification.models.Notification; | import fr.free.nrw.commons.notification.models.Notification; | ||||||
|  | import fr.free.nrw.commons.notification.models.NotificationType; | ||||||
| import fr.free.nrw.commons.theme.BaseActivity; | import fr.free.nrw.commons.theme.BaseActivity; | ||||||
| import fr.free.nrw.commons.utils.NetworkUtils; | import fr.free.nrw.commons.utils.NetworkUtils; | ||||||
| import fr.free.nrw.commons.utils.ViewUtil; | import fr.free.nrw.commons.utils.ViewUtil; | ||||||
|  | @ -148,7 +149,11 @@ public class NotificationActivity extends BaseActivity { | ||||||
|         } |         } | ||||||
|         adapter = new NotificatinAdapter(item -> { |         adapter = new NotificatinAdapter(item -> { | ||||||
|             Timber.d("Notification clicked %s", item.getLink()); |             Timber.d("Notification clicked %s", item.getLink()); | ||||||
|  |             if (item.getNotificationType() == NotificationType.EMAIL){ | ||||||
|  |                 ViewUtil.showLongSnackbar(binding.container,getString(R.string.check_your_email_inbox)); | ||||||
|  |             } else { | ||||||
|                 handleUrl(item.getLink()); |                 handleUrl(item.getLink()); | ||||||
|  |             } | ||||||
|             removeNotification(item); |             removeNotification(item); | ||||||
|             return Unit.INSTANCE; |             return Unit.INSTANCE; | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  | @ -51,13 +51,23 @@ class NotificationClient | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|         private fun WikimediaNotification.toCommonsNotification() = |         private fun WikimediaNotification.toCommonsNotification() : | ||||||
|             Notification( |             Notification { | ||||||
|                 notificationType = NotificationType.UNKNOWN, |             val notificationText = contents?.compactHeader ?: "" | ||||||
|                 notificationText = contents?.compactHeader ?: "", |             val notificationType = | ||||||
|  |                 if (notificationText.contains("Sent you an email", ignoreCase = true)) { | ||||||
|  |                     NotificationType.EMAIL | ||||||
|  |                 } else { | ||||||
|  |                     NotificationType.UNKNOWN | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 return Notification( | ||||||
|  |                     notificationType = notificationType, | ||||||
|  |                     notificationText = notificationText, | ||||||
|                     date = DateUtil.getMonthOnlyDateString(timestamp), |                     date = DateUtil.getMonthOnlyDateString(timestamp), | ||||||
|                     link = contents?.links?.primary?.url ?: "", |                     link = contents?.links?.primary?.url ?: "", | ||||||
|                     iconUrl = "", |                     iconUrl = "", | ||||||
|                     notificationId = id().toString(), |                     notificationId = id().toString(), | ||||||
|                 ) |                 ) | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ public enum NotificationType { | ||||||
|     THANK_YOU_EDIT("thank-you-edit"), |     THANK_YOU_EDIT("thank-you-edit"), | ||||||
|     EDIT_USER_TALK("edit-user-talk"), |     EDIT_USER_TALK("edit-user-talk"), | ||||||
|     MENTION("mention"), |     MENTION("mention"), | ||||||
|  |     EMAIL("email"), | ||||||
|     WELCOME("welcome"), |     WELCOME("welcome"), | ||||||
|     UNKNOWN("unknown"); |     UNKNOWN("unknown"); | ||||||
|     private String type; |     private String type; | ||||||
|  |  | ||||||
|  | @ -242,8 +242,8 @@ | ||||||
|   <string name="nominated_for_deletion">Meneget eo bet ar skeudenn evit lemel.</string> |   <string name="nominated_for_deletion">Meneget eo bet ar skeudenn evit lemel.</string> | ||||||
|   <string name="skip_login">Lezel a-gostez</string> |   <string name="skip_login">Lezel a-gostez</string> | ||||||
|   <string name="navigation_item_login">Kevreañ</string> |   <string name="navigation_item_login">Kevreañ</string> | ||||||
|   <string name="skip_login_title" fuzzy="true">Ha c\'hoant ho peus, evit gwir, da gevreañ ?</string> |   <string name="skip_login_title">Ha n\'ho peus ket c\'hoant, evit gwir, da gevreañ ?</string> | ||||||
|   <string name="skip_login_message" fuzzy="true">Da gevreañ ho po en amzer-da-zont evit pellgargañ skeudennoù.</string> |   <string name="skip_login_message">Ret e vo deoc\'h kevreañ en amzer-da-zont evit pellgargañ skeudennoù.</string> | ||||||
|   <string name="login_alert_message">Kevreit, mar plij, evit implijout an arc\'hwel-mañ</string> |   <string name="login_alert_message">Kevreit, mar plij, evit implijout an arc\'hwel-mañ</string> | ||||||
|   <string name="copy_wikicode">Eilañ an destenn wiki er golver</string> |   <string name="copy_wikicode">Eilañ an destenn wiki er golver</string> | ||||||
|   <string name="wikicode_copied">Testenn wiki eilet er golver</string> |   <string name="wikicode_copied">Testenn wiki eilet er golver</string> | ||||||
|  |  | ||||||
|  | @ -679,6 +679,7 @@ | ||||||
|   <string name="error_sending_thanks">作者への感謝の送信エラー。</string> |   <string name="error_sending_thanks">作者への感謝の送信エラー。</string> | ||||||
|   <string name="invalid_login_message">ログインが期限切れになりました。もう一度ログインしてください。</string> |   <string name="invalid_login_message">ログインが期限切れになりました。もう一度ログインしてください。</string> | ||||||
|   <string name="no_application_available_to_open_gpx_files">GPXファイルを開くことができるアプリケーションがありません</string> |   <string name="no_application_available_to_open_gpx_files">GPXファイルを開くことができるアプリケーションがありません</string> | ||||||
|  |   <string name="check_your_email_inbox">メールをご確認ください</string> | ||||||
|   <plurals name="custom_picker_images_selected_title_appendix"> |   <plurals name="custom_picker_images_selected_title_appendix"> | ||||||
|     <item quantity="other">%d件の画像が選択されました</item> |     <item quantity="other">%d件の画像が選択されました</item> | ||||||
|   </plurals> |   </plurals> | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ | ||||||
|   <string name="preference_category_appearance">ਦਿੱਖ</string> |   <string name="preference_category_appearance">ਦਿੱਖ</string> | ||||||
|   <string name="preference_category_general">ਆਮ</string> |   <string name="preference_category_general">ਆਮ</string> | ||||||
|   <string name="app_name" fuzzy="true">ਵਿਕੀਮੀਡੀਆ ਕਾਮਨਜ਼</string> |   <string name="app_name" fuzzy="true">ਵਿਕੀਮੀਡੀਆ ਕਾਮਨਜ਼</string> | ||||||
|   <string name="menu_settings">ਸੈਟਿੰਗ</string> |   <string name="menu_settings">ਪਸੰਦਾਂ</string> | ||||||
|   <string name="username">ਵਰਤੋਂਕਾਰ ਨਾਂ</string> |   <string name="username">ਵਰਤੋਂਕਾਰ ਨਾਂ</string> | ||||||
|   <string name="password">ਲੰਘ-ਸ਼ਬਦ</string> |   <string name="password">ਲੰਘ-ਸ਼ਬਦ</string> | ||||||
|   <string name="login">ਦਾਖ਼ਲ ਹੋਵੋ</string> |   <string name="login">ਦਾਖ਼ਲ ਹੋਵੋ</string> | ||||||
|  | @ -85,7 +85,7 @@ | ||||||
|   <string name="categories_not_found">%1$s ਨਾਲ਼ ਮੇਲ ਖਾਂਦੀ ਕੋਈ ਸ਼੍ਰੇਣੀ ਨਹੀਂ ਲੱਭੀ</string> |   <string name="categories_not_found">%1$s ਨਾਲ਼ ਮੇਲ ਖਾਂਦੀ ਕੋਈ ਸ਼੍ਰੇਣੀ ਨਹੀਂ ਲੱਭੀ</string> | ||||||
|   <string name="categories_skip_explanation" fuzzy="true">ਆਪਣੀਆਂ ਤਸਵੀਰਾਂ ਨੂੰ ਵਿਕੀਮੀਡੀਆ ਕਾਮਨਜ਼ ਵਿਚ ਜ਼ਿਆਦਾ ਲੱਭਣਯੋਗ ਬਣਾਉਣ ਲਈ ਸ਼੍ਰੇਣੀਆਂ ਜੋੜੋ।\n\nਸ਼੍ਰੇਣੀਆਂ ਜੋੜਨ ਲਈ ਟਾਈਪ ਕਰਨ ਅਰੰਭ ਕਰੋ।\nਇਸ ਕਾਰਜ ਨੂੰ ਅਣਡਿੱਠਾ ਕਰਨ ਲਈ ਇਹ ਸੁਨੇਹਾ ਥਪੇੜੋ (ਜਾਂ ਵਾਪਸੀ ਬਟਨ ਦਬਾਓ)।</string> |   <string name="categories_skip_explanation" fuzzy="true">ਆਪਣੀਆਂ ਤਸਵੀਰਾਂ ਨੂੰ ਵਿਕੀਮੀਡੀਆ ਕਾਮਨਜ਼ ਵਿਚ ਜ਼ਿਆਦਾ ਲੱਭਣਯੋਗ ਬਣਾਉਣ ਲਈ ਸ਼੍ਰੇਣੀਆਂ ਜੋੜੋ।\n\nਸ਼੍ਰੇਣੀਆਂ ਜੋੜਨ ਲਈ ਟਾਈਪ ਕਰਨ ਅਰੰਭ ਕਰੋ।\nਇਸ ਕਾਰਜ ਨੂੰ ਅਣਡਿੱਠਾ ਕਰਨ ਲਈ ਇਹ ਸੁਨੇਹਾ ਥਪੇੜੋ (ਜਾਂ ਵਾਪਸੀ ਬਟਨ ਦਬਾਓ)।</string> | ||||||
|   <string name="categories_activity_title">ਸ਼੍ਰੇਣੀਆਂ</string> |   <string name="categories_activity_title">ਸ਼੍ਰੇਣੀਆਂ</string> | ||||||
|   <string name="title_activity_settings">ਸੈਟਿੰਗ</string> |   <string name="title_activity_settings">ਪਸੰਦਾਂ</string> | ||||||
|   <string name="title_activity_signup">ਸਾਈਨ ਅੱਪ</string> |   <string name="title_activity_signup">ਸਾਈਨ ਅੱਪ</string> | ||||||
|   <string name="title_activity_category_details">ਸ਼੍ਰੇਣੀ</string> |   <string name="title_activity_category_details">ਸ਼੍ਰੇਣੀ</string> | ||||||
|   <string name="menu_about">ਇਸ ਬਾਰੇ</string> |   <string name="menu_about">ਇਸ ਬਾਰੇ</string> | ||||||
|  | @ -149,8 +149,8 @@ | ||||||
|   <string name="media_detail_coordinates_empty">ਕੋਈ ਉਪਲਬਧ ਨਹੀਂ</string> |   <string name="media_detail_coordinates_empty">ਕੋਈ ਉਪਲਬਧ ਨਹੀਂ</string> | ||||||
|   <string name="_2fa_code">2FA ਕੋਡ</string> |   <string name="_2fa_code">2FA ਕੋਡ</string> | ||||||
|   <string name="logout_verification">ਕੀ ਤੁਸੀਂ ਸੱਚੀਂ ਬੰਦ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ?</string> |   <string name="logout_verification">ਕੀ ਤੁਸੀਂ ਸੱਚੀਂ ਬੰਦ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ?</string> | ||||||
|   <string name="welcome_image_welcome_wikipedia">ਵਿਕੀਪੀਡੀਆ \'ਤੇ ਸੁਆਗਤ</string> |   <string name="welcome_image_welcome_wikipedia">ਵਿਕੀਪੀਡੀਆ \'ਤੇ ਜੀ ਆਇਆਂ ਨੂੰ</string> | ||||||
|   <string name="welcome_image_welcome_copyright">ਕਾਪੀਰਾਈਟ ਸੁਆਗਤ</string> |   <string name="welcome_image_welcome_copyright">ਜੀ ਆਇਆਂ ਨੂੰ ਕਾਪੀਰਾਈਟ</string> | ||||||
|   <string name="cancel">ਰੱਦ ਕਰੋ</string> |   <string name="cancel">ਰੱਦ ਕਰੋ</string> | ||||||
|   <string name="navigation_drawer_open">ਖੋਲ੍ਹੋ</string> |   <string name="navigation_drawer_open">ਖੋਲ੍ਹੋ</string> | ||||||
|   <string name="navigation_drawer_close">ਬੰਦ ਕਰੋ</string> |   <string name="navigation_drawer_close">ਬੰਦ ਕਰੋ</string> | ||||||
|  | @ -178,10 +178,14 @@ | ||||||
|   <string name="about_translate_cancel">ਰੱਦ ਕਰੋ</string> |   <string name="about_translate_cancel">ਰੱਦ ਕਰੋ</string> | ||||||
|   <string name="menu_search_button">ਲੱਭੋ</string> |   <string name="menu_search_button">ਲੱਭੋ</string> | ||||||
|   <string name="title_activity_search">ਲੱਭੋ</string> |   <string name="title_activity_search">ਲੱਭੋ</string> | ||||||
|  |   <string name="search_recent_header">ਹਾਲੀਆ ਖੋਜਾਂ:</string> | ||||||
|  |   <string name="provider_searches">ਹਾਲ ਦੀਆਂ ਪੁੱਛਗਿੱਛ ਖੋਜਾਂ</string> | ||||||
|  |   <string name="provider_recent_languages">ਹਾਲ ਹੀ ਵਿੱਚ ਬੋਲੀਆਂ ਬਾਰੇ ਪੁੱਛਗਿੱਛ</string> | ||||||
|   <string name="search_tab_title_categories">ਸ਼੍ਰੇਣੀਆਂ</string> |   <string name="search_tab_title_categories">ਸ਼੍ਰੇਣੀਆਂ</string> | ||||||
|   <string name="explore_tab_title_map">ਨਕਸ਼ਾ</string> |   <string name="explore_tab_title_map">ਨਕਸ਼ਾ</string> | ||||||
|   <string name="question">ਸਵਾਲ</string> |   <string name="question">ਸਵਾਲ</string> | ||||||
|   <string name="continue_message">ਜਾਰੀ ਰੱਖੋ</string> |   <string name="continue_message">ਜਾਰੀ ਰੱਖੋ</string> | ||||||
|  |   <string name="no_recent_searches">ਕੋਈ ਤਾਜ਼ਾ ਖੋਜ ਨਹੀਂ</string> | ||||||
|   <string name="delete">ਮਿਟਾਓ</string> |   <string name="delete">ਮਿਟਾਓ</string> | ||||||
|   <string name="Achievements">ਪ੍ਰਾਪਤੀਆਂ</string> |   <string name="Achievements">ਪ੍ਰਾਪਤੀਆਂ</string> | ||||||
|   <string name="statistics">ਅੰਕੜੇ</string> |   <string name="statistics">ਅੰਕੜੇ</string> | ||||||
|  |  | ||||||
|  | @ -111,4 +111,5 @@ | ||||||
|   <string name="detail_description_empty">没有说明</string> |   <string name="detail_description_empty">没有说明</string> | ||||||
|   <string name="detail_license_empty">未知授权协议</string> |   <string name="detail_license_empty">未知授权协议</string> | ||||||
|   <string name="menu_refresh">刷新</string> |   <string name="menu_refresh">刷新</string> | ||||||
|  |   <string name="check_your_email_inbox">请查看你的电子邮箱</string> | ||||||
| </resources> | </resources> | ||||||
|  |  | ||||||
|  | @ -215,4 +215,5 @@ | ||||||
|   <string name="description_info">請盡可能描述媒體內容:拍攝於何處?是顯示什麼事物?有什麼脈絡?請描述對象或人物。透露出一些較不易猜測的訊息,例如是風景的話,可以是一天裡的時間。如果媒體顯示出了一些不尋常的事物,請說明不尋常原因。</string> |   <string name="description_info">請盡可能描述媒體內容:拍攝於何處?是顯示什麼事物?有什麼脈絡?請描述對象或人物。透露出一些較不易猜測的訊息,例如是風景的話,可以是一天裡的時間。如果媒體顯示出了一些不尋常的事物,請說明不尋常原因。</string> | ||||||
|   <string name="learn_how_to_write_a_useful_description">學習如何編寫有用的描述</string> |   <string name="learn_how_to_write_a_useful_description">學習如何編寫有用的描述</string> | ||||||
|   <string name="learn_how_to_write_a_useful_caption">學習如何編寫有用的標題</string> |   <string name="learn_how_to_write_a_useful_caption">學習如何編寫有用的標題</string> | ||||||
|  |   <string name="check_your_email_inbox">請查看你的電子郵件信箱</string> | ||||||
| </resources> | </resources> | ||||||
|  |  | ||||||
|  | @ -805,4 +805,5 @@ | ||||||
|   <string name="pending">待處理</string> |   <string name="pending">待處理</string> | ||||||
|   <string name="failed">失敗</string> |   <string name="failed">失敗</string> | ||||||
|   <string name="could_not_load_place_data">無法載入地點資料</string> |   <string name="could_not_load_place_data">無法載入地點資料</string> | ||||||
|  |   <string name="check_your_email_inbox">請查看你的電子郵件信箱</string> | ||||||
| </resources> | </resources> | ||||||
|  |  | ||||||
|  | @ -7,6 +7,7 @@ | ||||||
| * A Retired User | * A Retired User | ||||||
| * Aefgh39622 | * Aefgh39622 | ||||||
| * Angrydog001 | * Angrydog001 | ||||||
|  | * Chimes | ||||||
| * Crowley666 | * Crowley666 | ||||||
| * D41D8CD98F | * D41D8CD98F | ||||||
| * Deathkon | * Deathkon | ||||||
|  | @ -827,4 +828,11 @@ | ||||||
|   <string name="is_at_a_different_place_please_specify_the_correct_place_below_if_possible_tell_us_the_correct_latitude_longitude">“%1$s”位于一个不同的位置。请在下方给出正确的位置,可以的话请填写正确的经纬度。</string> |   <string name="is_at_a_different_place_please_specify_the_correct_place_below_if_possible_tell_us_the_correct_latitude_longitude">“%1$s”位于一个不同的位置。请在下方给出正确的位置,可以的话请填写正确的经纬度。</string> | ||||||
|   <string name="other_problem_or_information_please_explain_below">其他问题或信息(请在下方解释)。</string> |   <string name="other_problem_or_information_please_explain_below">其他问题或信息(请在下方解释)。</string> | ||||||
|   <string name="feedback_destination_note">您的反馈已经发布在以下wiki页面:<a href=\"https://commons.wikimedia.org/wiki/Commons:Mobile_app/Feedback\">Commons:Mobile app/Feedback</a></string> |   <string name="feedback_destination_note">您的反馈已经发布在以下wiki页面:<a href=\"https://commons.wikimedia.org/wiki/Commons:Mobile_app/Feedback\">Commons:Mobile app/Feedback</a></string> | ||||||
|  |   <string name="are_you_sure_that_you_want_cancel_all_the_uploads">您确定要取消所有上传吗?</string> | ||||||
|  |   <string name="cancelling_all_the_uploads">取消所有的上传...</string> | ||||||
|  |   <string name="uploads">上传</string> | ||||||
|  |   <string name="pending">待处理</string> | ||||||
|  |   <string name="failed">失败</string> | ||||||
|  |   <string name="could_not_load_place_data">无法加载地点数据</string> | ||||||
|  |   <string name="check_your_email_inbox">请查看你的电子邮箱</string> | ||||||
| </resources> | </resources> | ||||||
|  |  | ||||||
|  | @ -504,6 +504,7 @@ Upload your first media by tapping on the add button.</string> | ||||||
|   <string name="no_notification">You have no unread notifications</string> |   <string name="no_notification">You have no unread notifications</string> | ||||||
|   <string name="no_read_notification">You have no read notifications</string> |   <string name="no_read_notification">You have no read notifications</string> | ||||||
|   <string name="share_logs_using">Share logs using</string> |   <string name="share_logs_using">Share logs using</string> | ||||||
|  |   <string name="check_your_email_inbox">Check your email inbox</string> | ||||||
|   <string name="menu_option_read">View read</string> |   <string name="menu_option_read">View read</string> | ||||||
|   <string name="menu_option_unread">View unread</string> |   <string name="menu_option_unread">View unread</string> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -64,13 +64,18 @@ class FilePickerTest { | ||||||
|         `when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref) |         `when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref) | ||||||
|         `when`(sharedPref.edit()).thenReturn(sharedPreferencesEditor) |         `when`(sharedPref.edit()).thenReturn(sharedPreferencesEditor) | ||||||
|         `when`(sharedPref.edit().putInt("type", 0)).thenReturn(sharedPreferencesEditor) |         `when`(sharedPref.edit().putInt("type", 0)).thenReturn(sharedPreferencesEditor) | ||||||
|         FilePicker.openGallery(activity, 0, nextBoolean()) |         val openDocumentPreferred = nextBoolean() | ||||||
|  |         FilePicker.openGallery(activity, 0, openDocumentPreferred) | ||||||
|         verify(activity).startActivityForResult( |         verify(activity).startActivityForResult( | ||||||
|             ArgumentMatchers.any(), |             ArgumentMatchers.any(), | ||||||
|             requestCodeCaptor?.capture()?.toInt()!!, |             requestCodeCaptor?.capture()?.toInt()!!, | ||||||
|         ) |         ) | ||||||
|  |         if(openDocumentPreferred){ | ||||||
|  |             assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_DOCUMENTS) | ||||||
|  |         }else{ | ||||||
|             assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_GALLERY) |             assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_GALLERY) | ||||||
|         } |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|     fun testOpenCameraForImageCode() { |     fun testOpenCameraForImageCode() { | ||||||
|  | @ -165,32 +170,6 @@ class FilePickerTest { | ||||||
|         method.invoke(mockFilePicker, activity) |         method.invoke(mockFilePicker, activity) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |  | ||||||
|     fun testTakenCameraVideo() { |  | ||||||
|         val mockFilePicker = mock(FilePicker::class.java) |  | ||||||
|         val method: Method = |  | ||||||
|             FilePicker::class.java.getDeclaredMethod( |  | ||||||
|                 "takenCameraVideo", |  | ||||||
|                 Context::class.java, |  | ||||||
|             ) |  | ||||||
|         method.isAccessible = true |  | ||||||
|         method.invoke(mockFilePicker, context) |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @Test |  | ||||||
|     fun testTakenCameraVideoCaseTrue() { |  | ||||||
|         val mockFilePicker = mock(FilePicker::class.java) |  | ||||||
|         `when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref) |  | ||||||
|         `when`(sharedPref.getString("last_video", null)).thenReturn("") |  | ||||||
|         val method: Method = |  | ||||||
|             FilePicker::class.java.getDeclaredMethod( |  | ||||||
|                 "takenCameraVideo", |  | ||||||
|                 Context::class.java, |  | ||||||
|             ) |  | ||||||
|         method.isAccessible = true |  | ||||||
|         method.invoke(mockFilePicker, activity) |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @Test |     @Test | ||||||
|     fun testIsPhoto() { |     fun testIsPhoto() { | ||||||
|         val mockFilePicker = mock(FilePicker::class.java) |         val mockFilePicker = mock(FilePicker::class.java) | ||||||
|  |  | ||||||
|  | @ -2,6 +2,9 @@ package fr.free.nrw.commons.location | ||||||
| 
 | 
 | ||||||
| import org.junit.Before | import org.junit.Before | ||||||
| import org.junit.Test | import org.junit.Test | ||||||
|  | import org.hamcrest.MatcherAssert.assertThat | ||||||
|  | import org.hamcrest.CoreMatchers.equalTo | ||||||
|  | import org.hamcrest.CoreMatchers.not | ||||||
| 
 | 
 | ||||||
| class LatLngTest { | class LatLngTest { | ||||||
|     private lateinit var latLng1: LatLng |     private lateinit var latLng1: LatLng | ||||||
|  | @ -14,51 +17,51 @@ class LatLngTest { | ||||||
|     @Test |     @Test | ||||||
|     fun testConstructorSmallLongitude() { |     fun testConstructorSmallLongitude() { | ||||||
|         latLng1 = LatLng(0.0, -181.0, 0.0f) |         latLng1 = LatLng(0.0, -181.0, 0.0f) | ||||||
|         assert(latLng1.longitude == 179.0) |         assertThat(latLng1.longitude, equalTo(179.0)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|     fun testConstructorBigLongitude() { |     fun testConstructorBigLongitude() { | ||||||
|         latLng1 = LatLng(0.0, 181.0, 0.0f) |         latLng1 = LatLng(0.0, 181.0, 0.0f) | ||||||
|         assert(latLng1.longitude == -179.0) |         assertThat(latLng1.longitude, equalTo(-179.0)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|     fun testConstructorSmallLatitude() { |     fun testConstructorSmallLatitude() { | ||||||
|         latLng1 = LatLng(-91.0, 0.0, 0.0f) |         latLng1 = LatLng(-91.0, 0.0, 0.0f) | ||||||
|         assert(latLng1.latitude == -90.0) |         assertThat(latLng1.latitude, equalTo(-90.0)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|     fun testConstructorBigLatitude() { |     fun testConstructorBigLatitude() { | ||||||
|         latLng1 = LatLng(91.0, 0.0, 0.0f) |         latLng1 = LatLng(91.0, 0.0, 0.0f) | ||||||
|         assert(latLng1.latitude == 90.0) |         assertThat(latLng1.latitude, equalTo(90.0)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|     fun testHashCodeDiffersWenLngZero() { |     fun testHashCodeDiffersWenLngZero() { | ||||||
|         latLng1 = LatLng(2.0, 0.0, 0.0f) |         latLng1 = LatLng(2.0, 0.0, 0.0f) | ||||||
|         latLng2 = LatLng(1.0, 0.0, 0.0f) |         latLng2 = LatLng(1.0, 0.0, 0.0f) | ||||||
|         assert(latLng1.hashCode() != latLng2.hashCode()) |         assertThat(latLng1.hashCode(), not(equalTo(latLng2.hashCode()))) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|     fun testHashCodeDiffersWenLatZero() { |     fun testHashCodeDiffersWenLatZero() { | ||||||
|         latLng1 = LatLng(0.0, 1.0, 0.0f) |         latLng1 = LatLng(0.0, 1.0, 0.0f) | ||||||
|         latLng2 = LatLng(0.0, 2.0, 0.0f) |         latLng2 = LatLng(0.0, 2.0, 0.0f) | ||||||
|         assert(latLng1.hashCode() != latLng2.hashCode()) |         assertThat(latLng1.hashCode(), not(equalTo(latLng2.hashCode()))) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|     fun testEqualsWorks() { |     fun testEqualsWorks() { | ||||||
|         latLng1 = LatLng(1.0, 2.0, 5.0f) |         latLng1 = LatLng(1.0, 2.0, 5.0f) | ||||||
|         latLng2 = LatLng(1.0, 2.0, 0.0f) |         latLng2 = LatLng(1.0, 2.0, 0.0f) | ||||||
|         assert(latLng1.equals(latLng2)) |         assertThat(latLng1, equalTo(latLng2)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
|     fun testToString() { |     fun testToString() { | ||||||
|         latLng1 = LatLng(1.0, 2.0, 5.0f) |         latLng1 = LatLng(1.0, 2.0, 5.0f) | ||||||
|         assert(latLng1.toString().equals("lat/lng: (1.0,2.0)")) |         assertThat(latLng1.toString(), equalTo("lat/lng: (1.0,2.0)")) | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,6 +3,8 @@ package fr.free.nrw.commons.nearby | ||||||
| import fr.free.nrw.commons.R | import fr.free.nrw.commons.R | ||||||
| import org.junit.Before | import org.junit.Before | ||||||
| import org.junit.Test | import org.junit.Test | ||||||
|  | import org.hamcrest.MatcherAssert.assertThat | ||||||
|  | import org.hamcrest.CoreMatchers.equalTo | ||||||
| 
 | 
 | ||||||
| class LabelTest { | class LabelTest { | ||||||
|     private lateinit var label: Label |     private lateinit var label: Label | ||||||
|  | @ -21,7 +23,7 @@ class LabelTest { | ||||||
|      */ |      */ | ||||||
|     @Test |     @Test | ||||||
|     fun testLabelIcon() { |     fun testLabelIcon() { | ||||||
|         assert(label.icon.equals(R.drawable.round_icon_church)) |         assertThat(label.icon, equalTo(R.drawable.round_icon_church)) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | @ -30,6 +32,6 @@ class LabelTest { | ||||||
|     @Test |     @Test | ||||||
|     fun testNullLabelIcon() { |     fun testNullLabelIcon() { | ||||||
|         var nullLabel: Label = Label.fromText("a random text not exist in label texts") |         var nullLabel: Label = Label.fromText("a random text not exist in label texts") | ||||||
|         assert(nullLabel.icon.equals(R.drawable.round_icon_unknown)) |         assertThat(nullLabel.icon, equalTo(R.drawable.round_icon_unknown)) | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nicolas Raoul
						Nicolas Raoul