Merge branch 'main' into issue5856

This commit is contained in:
Zhenhao Li 2024-10-16 21:59:49 +11:00 committed by GitHub
commit af81e642f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 64 additions and 48 deletions

View file

@ -174,7 +174,7 @@ dependencies {
kaptTest "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
implementation ("org.osmdroid:osmdroid-android:$OSMDROID_VERSION")

View file

@ -16,7 +16,6 @@ public interface Constants {
int PICK_PICTURE_FROM_DOCUMENTS = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 11);
int PICK_PICTURE_FROM_GALLERY = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 12);
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;
}

View file

@ -109,7 +109,13 @@ public class FilePicker implements Constants {
*/
public static void openGallery(Activity activity, int type, boolean 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;
if (requestCode == RequestCodes.PICK_PICTURE_FROM_GALLERY ||
requestCode == RequestCodes.TAKE_PICTURE ||
requestCode == RequestCodes.CAPTURE_VIDEO ||
requestCode == RequestCodes.PICK_PICTURE_FROM_DOCUMENTS ||
requestCode == RequestCodes.PICK_PICTURE_FROM_CUSTOM_SELECTOR) {
if (resultCode == Activity.RESULT_OK) {
@ -169,19 +174,16 @@ public class FilePicker implements Constants {
onPictureReturnedFromCustomSelector(data, activity, callbacks);
} else if (requestCode == RequestCodes.TAKE_PICTURE) {
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 {
if (requestCode == RequestCodes.PICK_PICTURE_FROM_DOCUMENTS) {
callbacks.onCanceled(FilePicker.ImageSource.DOCUMENTS, restoreType(activity));
} else if (requestCode == RequestCodes.PICK_PICTURE_FROM_GALLERY) {
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));
}
}

View file

@ -798,6 +798,9 @@
<string name="storage_permissions_denied">رُفض إذن التخزين</string>
<string name="unable_to_share_upload_item">تعذر مشاركة هذا العنصر</string>
<string name="permissions_are_required_for_functionality">الإذن مطلوب لهذه الوظيفة</string>
<string name="learn_how_to_write_a_useful_description">تعلم كيفية كتابة وصف مفيد</string>
<string name="remove_location_warning_title">إزالة تحذير الموقع</string>
<string name="send_thanks_to_author">اشكر المؤلف</string>
<string name="error_sending_thanks">حدث خطأ أثناء إرسال الشكر للمؤلف.</string>
<string name="could_not_load_place_data">تعذر تحميل بيانات المكان</string>
</resources>

View file

@ -242,8 +242,8 @@
<string name="nominated_for_deletion">Meneget eo bet ar skeudenn evit lemel.</string>
<string name="skip_login">Lezel a-gostez</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_message" fuzzy="true">Da gevreañ ho po en amzer-da-zont evit pellgargañ skeudennoù.</string>
<string name="skip_login_title">Ha n\'ho peus ket c\'hoant, evit gwir, da gevreañ ?</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="copy_wikicode">Eilañ an destenn wiki er golver</string>
<string name="wikicode_copied">Testenn wiki eilet er golver</string>

View file

@ -106,7 +106,7 @@
<string name="menu_view_file_page">Хьажа файлан агӀоне</string>
<string name="share_title_hint">Куьг йазор (ТIедилина ду)</string>
<string name="add_caption_toast">Дехар ду, хӀокху файлан цIе гайта</string>
<string name="share_description_hint">Цунах лаьцна</string>
<string name="share_description_hint">Цуьнах лаьцна</string>
<string name="share_caption_hint">Куьг</string>
<string name="login_failed_network">Чувала(йала) тара цало — сетан гӀалат</string>
<string name="login_failed_throttled">ТӀех дукха кхиаме боцу гӀертарш. Дехар ду масех минот йаьлча йуха а хьажа.</string>

View file

@ -29,6 +29,7 @@
* Sujan
* Sushi
* Tacsipacsi
* TheRabbit22
* ThisCarthing
* Tobi 406
* TomatoCake
@ -802,4 +803,17 @@
<string name="multiple_files_depiction">Bitte beachte, dass bei einem Multiupload alle Bilder die gleichen Kategorien und Bezeichnungen erhalten. Sollten die Bilder keine gemeinsamen Bezeichnungen und Kategorien haben, führe bitte mehrere separate Uploads durch.</string>
<string name="multiple_files_depiction_header">Hinweis zu Mehrfach-Uploads</string>
<string name="nearby_wikitalk">Melde ein Problem mit diesem Datenobjekt an Wikidata</string>
<string name="please_enter_some_comments">Bitte gib einige Kommentare ein</string>
<string name="talk">Diskussion</string>
<string name="write_something_about_the_item">Schreibe etwas über das Objekt %1$s. Deine Beschreibung wird öffentlich sichtbar sein.</string>
<string name="does_not_exist_anymore_no_picture_can_ever_be_taken_of_it">%1$s existiert nicht mehr, es kann kein Foto mehr davon gemacht werden.</string>
<string name="is_at_a_different_place_please_specify_the_correct_place_below_if_possible_tell_us_the_correct_latitude_longitude">%1$s ist jetzt an einem anderen Ort. Bitte gib den richtigen Ort und, wenn möglich, den Breiten- und Längengrad an.</string>
<string name="other_problem_or_information_please_explain_below">Sonstiges Problem oder Information (bitte unten erläutern).</string>
<string name="feedback_destination_note">Dein Feedback wird auf der folgenden Wiki-Seite veröffentlicht werden: &lt;a href=\"https://commons.wikimedia.org/wiki/Commons:Mobile_app/Feedback\"&gt;Commons:Mobile app/Feedback&lt;/a&gt;</string>
<string name="are_you_sure_that_you_want_cancel_all_the_uploads">Möchtest du wirklich alle Uploads abbrechen?</string>
<string name="cancelling_all_the_uploads">Alle Uploads werden abgebrochen…</string>
<string name="uploads">Hochgeladene Dateien</string>
<string name="pending">Ausstehend</string>
<string name="failed">Fehlgeschlagen</string>
<string name="could_not_load_place_data">Ortsdaten konnten nicht geladen werden</string>
</resources>

View file

@ -814,7 +814,7 @@
<string name="nearby_wikitalk">Signaler un problème concernant cet élément à Wikidata</string>
<string name="please_enter_some_comments">Merci de saisir vos commentaires</string>
<string name="talk">Discussion</string>
<string name="write_something_about_the_item">Ecrivez quelque chose sur l\'article \"%1$s\". Il sera visible par le public\nAjouter une définition terminologique pour ce terme</string>
<string name="write_something_about_the_item">Écrivez quelque chose à propos de lélément « %1$s ». Il sera visible publiquement.</string>
<string name="does_not_exist_anymore_no_picture_can_ever_be_taken_of_it">\'%1$s\' n\'existe plus, aucune photo ne pourra jamais en être prise.</string>
<string name="is_at_a_different_place_please_specify_the_correct_place_below_if_possible_tell_us_the_correct_latitude_longitude">\'%1$s\' se trouve à un endroit différent. Veuillez indiquer l\'endroit correct ci-dessous et, si possible, indiquez la latitude et la longitude correctes.</string>
<string name="other_problem_or_information_please_explain_below">Autre problème ou information (merci d\'expliquer ci-dessous).</string>
@ -824,5 +824,5 @@
<string name="uploads">Téléversements</string>
<string name="pending">En attente</string>
<string name="failed">Échec</string>
<string name="could_not_load_place_data">Ne peut pas supporter les données</string>
<string name="could_not_load_place_data">Les données du lieu n\'ont pas pu être chargées</string>
</resources>

View file

@ -765,8 +765,15 @@
<string name="nearby_wikitalk">Signalar a Wikidata un problema sur iste elemento</string>
<string name="please_enter_some_comments">Per favor insere alcun commentos</string>
<string name="talk">Discussion</string>
<string name="write_something_about_the_item">Scribe qualcosa sur le elemento %1$s. Isto essera visibile publicamente.</string>
<string name="does_not_exist_anymore_no_picture_can_ever_be_taken_of_it">%1$s non existe plus, necun imagine pote jammais esser prendite de illo.</string>
<string name="is_at_a_different_place_please_specify_the_correct_place_below_if_possible_tell_us_the_correct_latitude_longitude">%1$s es in un altere loco. Per favor specifica le loco correcte hic infra, e si possibile, indica le latitude e longitude correcte.</string>
<string name="other_problem_or_information_please_explain_below">Altere problema o information (per favor explica hic infra).</string>
<string name="feedback_destination_note">Tu retroaction apparera sur le sequente pagina wiki: &lt;a href=\"https://commons.wikimedia.org/wiki/Commons:Mobile_app/Feedback\"&gt;Commons:Mobile app/Feedback&lt;/a&gt;</string>
<string name="are_you_sure_that_you_want_cancel_all_the_uploads">Es tu secur de voler cancellar tote le incargamentos?</string>
<string name="cancelling_all_the_uploads">Cancella tote le incargamentos…</string>
<string name="uploads">Incargamentos</string>
<string name="pending">Pendente</string>
<string name="failed">Fallite</string>
<string name="could_not_load_place_data">Non poteva cargar le datos del loco</string>
</resources>

View file

@ -9,7 +9,7 @@
* ਗੁਰਪ੍ਰੀਤ ਹੁੰਦਲ
-->
<resources>
<string name="commons_logo">ਕਾਮਨਜ਼ ਲੋਗੋ</string>
<string name="commons_logo">ਕਾਮਨਜ਼ ਮਾਰਕਾ</string>
<string name="add_another_description">ਇੱਕ ਹੋਰ ਵੇਰਵਾ ਸ਼ਾਮਲ ਕਰੋ</string>
<string name="add_new_contribution">ਨਵਾਂ ਯੋਗਦਾਨ ਸ਼ਾਮਲ ਕਰੋ</string>
<string name="show_captions_description">ਵੇਰਵਾ</string>
@ -38,7 +38,7 @@
<string name="preference_category_appearance">ਦਿੱਖ</string>
<string name="preference_category_general">ਆਮ</string>
<string name="app_name" fuzzy="true">ਵਿਕੀਮੀਡੀਆ ਕਾਮਨਜ਼</string>
<string name="menu_settings">ਸੈਟਿੰਗ</string>
<string name="menu_settings">ਪਸੰਦਾਂ</string>
<string name="username">ਵਰਤੋਂਕਾਰ ਨਾਂ</string>
<string name="password">ਲੰਘ-ਸ਼ਬਦ</string>
<string name="login">ਦਾਖ਼ਲ ਹੋਵੋ</string>
@ -85,7 +85,7 @@
<string name="categories_not_found">%1$s ਨਾਲ਼ ਮੇਲ ਖਾਂਦੀ ਕੋਈ ਸ਼੍ਰੇਣੀ ਨਹੀਂ ਲੱਭੀ</string>
<string name="categories_skip_explanation" fuzzy="true">ਆਪਣੀਆਂ ਤਸਵੀਰਾਂ ਨੂੰ ਵਿਕੀਮੀਡੀਆ ਕਾਮਨਜ਼ ਵਿਚ ਜ਼ਿਆਦਾ ਲੱਭਣਯੋਗ ਬਣਾਉਣ ਲਈ ਸ਼੍ਰੇਣੀਆਂ ਜੋੜੋ।\n\nਸ਼੍ਰੇਣੀਆਂ ਜੋੜਨ ਲਈ ਟਾਈਪ ਕਰਨ ਅਰੰਭ ਕਰੋ।\nਇਸ ਕਾਰਜ ਨੂੰ ਅਣਡਿੱਠਾ ਕਰਨ ਲਈ ਇਹ ਸੁਨੇਹਾ ਥਪੇੜੋ (ਜਾਂ ਵਾਪਸੀ ਬਟਨ ਦਬਾਓ)।</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_category_details">ਸ਼੍ਰੇਣੀ</string>
<string name="menu_about">ਇਸ ਬਾਰੇ</string>
@ -126,6 +126,7 @@
<string name="welcome_copyright_subtext">ਇੰਟਰਨੈੱਟ ਉੱਤੇ ਮਿਲੀ ਕਾਪੀਰਾਈਟ ਸਮੱਗਰੀ ਅਤੇ ਪੋਸਟਰਾਂ, ਕਿਤਾਬਾਂ ਦੀਆਂ ਜਿਲਦਾਂ ਦੀਆਂ ਤਸਵੀਆਂ ਆਦਿ ਤੋਂ ਪਰਹੇਜ਼ ਰੱਖੋ।</string>
<string name="welcome_final_text">ਤੁਹਾਨੂੰ ਲੱਗਦਾ ਹੈ ਕਿ ਤੁਹਾਡੇ ਕੋਲ ਹੈ?</string>
<string name="welcome_final_button_text">ਹਾਂ!</string>
<string name="welcome_help_button_text">ਹੋਰ ਜਾਣਕਾਰੀ</string>
<string name="detail_panel_cats_label">ਸ਼੍ਰੇਣੀਆਂ</string>
<string name="detail_panel_cats_loading">ਲੱਦ ਰਿਹਾ ਹੈ...</string>
<string name="detail_panel_cats_none">ਕੋਈ ਵੀ ਨਹੀਂ ਚੁਣਿਆ</string>
@ -177,10 +178,13 @@
<string name="about_translate_cancel">ਰੱਦ ਕਰੋ</string>
<string name="menu_search_button">ਲੱਭੋ</string>
<string name="title_activity_search">ਲੱਭੋ</string>
<string name="search_recent_header">ਹਾਲੀਆ ਖੋਜਾਂ:</string>
<string name="provider_recent_languages">ਹਾਲ ਹੀ ਵਿੱਚ ਬੋਲੀਆਂ ਬਾਰੇ ਪੁੱਛਗਿੱਛ</string>
<string name="search_tab_title_categories">ਸ਼੍ਰੇਣੀਆਂ</string>
<string name="explore_tab_title_map">ਨਕਸ਼ਾ</string>
<string name="question">ਸਵਾਲ</string>
<string name="continue_message">ਜਾਰੀ ਰੱਖੋ</string>
<string name="no_recent_searches">ਕੋਈ ਤਾਜ਼ਾ ਖੋਜ ਨਹੀਂ</string>
<string name="delete">ਮਿਟਾਓ</string>
<string name="Achievements">ਪ੍ਰਾਪਤੀਆਂ</string>
<string name="statistics">ਅੰਕੜੇ</string>
@ -199,6 +203,7 @@
<string name="copied_successfully">ਉਤਾਰਾ ਕੀਤਾ</string>
<string name="exif_tag_name_location">ਟਿਕਾਣਾ</string>
<string name="wikipedia_instructions_step_7">ਲਿਖਤ ਛਾਪੋ</string>
<string name="leaderboard_tab_title">ਮੁਹਰੈਲ</string>
<string name="leaderboard_column_user">ਵਰਤੋਂਕਾਰ</string>
<string name="invalid_login_message">ਤੁਹਾਡੇ ਦਾਖਲੇ ਦੀ ਮਿਆਦ ਪੁੱਗ ਗਈ ਹੈ। ਕਿਰਪਾ ਕਰਕੇ ਦੁਬਾਰਾ ਦਾਖਲ ਹੋਵੋ।</string>
</resources>

View file

@ -7,6 +7,7 @@
* A Retired User
* Aefgh39622
* Angrydog001
* Chimes
* Crowley666
* D41D8CD98F
* Deathkon
@ -827,4 +828,10 @@
<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="feedback_destination_note">您的反馈已经发布在以下wiki页面&lt;a href=\"https://commons.wikimedia.org/wiki/Commons:Mobile_app/Feedback\"&gt;Commons:Mobile app/Feedback&lt;/a&gt;</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>
</resources>

View file

@ -18,7 +18,7 @@ WHERE {
}
# Get the label in the preferred language of the user, or any other language if no label is available in that language.
OPTIONAL {?item rdfs:label ?itemLabelPreferredLanguage. FILTER (lang(?itemLabelPreferredLanguage) = "en")}
OPTIONAL {?item rdfs:label ?itemLabelPreferredLanguage. FILTER (lang(?itemLabelPreferredLanguage) = "${LANG}")}
OPTIONAL {?item rdfs:label ?itemLabelAnyLanguage}
BIND(COALESCE(?itemLabelPreferredLanguage, ?itemLabelAnyLanguage, "?") as ?label)

View file

@ -64,12 +64,17 @@ class FilePickerTest {
`when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref)
`when`(sharedPref.edit()).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(
ArgumentMatchers.any(),
requestCodeCaptor?.capture()?.toInt()!!,
)
assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_GALLERY)
if(openDocumentPreferred){
assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_DOCUMENTS)
}else{
assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_GALLERY)
}
}
@Test
@ -165,32 +170,6 @@ class FilePickerTest {
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
fun testIsPhoto() {
val mockFilePicker = mock(FilePicker::class.java)