Compare commits

..

6 commits

Author SHA1 Message Date
Dmitriy
7d96e94689
Fix crash for bookmarks without descriptions/thumbnails (#6488)
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
2025-10-16 19:56:41 +09:00
Xinyu Yang
7a865df909
fix the bug of map reset (#6509)
Co-authored-by: Chengxu Yang <u7954427@anu.edu.au>
Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
2025-10-16 19:34:17 +09:00
Amir E. Aharoni
864884e7b2
Update alternative texts for the welcome screen (#6512)
* Update alternative texts for the welcome screen

I've also updated their documentation for translators (qq)
in transltaewiki itself.

Resolves #689.

* Fixed typo

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
2025-10-16 19:22:02 +09:00
Amir E. Aharoni
1ecaf09f21
Remove wikimedia_licenses.xml and files that use it (#6513)
This file doesn't seem to be used.

Resolves #6504.
2025-10-16 19:20:18 +09:00
Amir E. Aharoni
1ff2a28326
Replace tab with space in an XML layout file (#6514)
I was working on this file recently, and Android Studio
showed a warning that it has tabs instead of spaces,
so here's it's fixed.

A minor thing, but prevents distractions.
2025-10-16 19:19:30 +09:00
Amir E. Aharoni
b48905a153
Change all parameters to numbered parameters (#6516)
This will solve these errors:
"Format string is not a valid format string so it should not be passed to String.format"
2025-10-16 19:19:02 +09:00
9 changed files with 50 additions and 201 deletions

View file

@ -173,19 +173,13 @@ class BookmarkItemsDao @Inject constructor(
categoryNameList: List<String>,
categoryDescriptionList: List<String>,
categoryThumbnailList: List<String>
): List<CategoryItem> {
return buildList {
for (i in categoryNameList.indices) {
add(
CategoryItem(
categoryNameList[i],
categoryDescriptionList[i],
categoryThumbnailList[i],
false
)
)
}
}
): List<CategoryItem> = categoryNameList.mapIndexed { index, name ->
CategoryItem(
name = name,
description = categoryDescriptionList.getOrNull(index),
thumbnail = categoryThumbnailList.getOrNull(index),
isSelected = false
)
}
/**

View file

@ -91,6 +91,7 @@ public class NearbyFilterSearchRecyclerViewAdapter
label.setSelected(!label.isSelected());
holder.placeTypeLayout.setSelected(label.isSelected());
NearbyFilterState.setSelectedLabels(new ArrayList<>(selectedLabels));
callback.filterByMarkerType(selectedLabels, 0, false, false);
});
}
@ -152,6 +153,7 @@ public class NearbyFilterSearchRecyclerViewAdapter
label.setSelected(false);
selectedLabels.remove(label);
}
NearbyFilterState.setSelectedLabels(new ArrayList<>(selectedLabels));
notifyDataSetChanged();
}
@ -163,6 +165,7 @@ public class NearbyFilterSearchRecyclerViewAdapter
selectedLabels.add(label);
}
}
NearbyFilterState.setSelectedLabels(new ArrayList<>(selectedLabels));
notifyDataSetChanged();
}

View file

@ -881,6 +881,12 @@ class NearbyParentFragment : CommonsDaggerSupportFragment(),
fun initNearbyFilter() {
binding!!.nearbyFilterList.root.visibility = View.GONE
hideBottomSheet()
binding!!.nearbyFilter.searchViewLayout.searchView.apply {
setIconifiedByDefault(false)
isIconified = false
setQuery("", false)
clearFocus()
}
binding!!.nearbyFilter.searchViewLayout.searchView.setOnQueryTextFocusChangeListener { v, hasFocus ->
setLayoutHeightAlignedToWidth(
1.25,
@ -924,6 +930,7 @@ class NearbyParentFragment : CommonsDaggerSupportFragment(),
return _isDarkTheme
}
})
restoreStoredFilterSelection()
binding!!.nearbyFilterList.root
.layoutParams.width = getScreenWidth(
requireActivity(),
@ -942,6 +949,22 @@ class NearbyParentFragment : CommonsDaggerSupportFragment(),
})
}
private fun restoreStoredFilterSelection() {
val adapter = nearbyFilterSearchRecyclerViewAdapter ?: return
val savedLabels = ArrayList(NearbyFilterState.getInstance().selectedLabels)
adapter.selectedLabels.clear()
val savedSet = savedLabels.toSet()
Label.valuesAsList().forEach { label ->
val isSelected = savedSet.contains(label)
label.setSelected(isSelected)
if (isSelected) {
adapter.selectedLabels.add(label)
}
}
NearbyFilterState.setSelectedLabels(ArrayList(adapter.selectedLabels))
adapter.notifyDataSetChanged()
}
override fun setCheckBoxAction() {
binding!!.nearbyFilterList.checkboxTriStates.addAction()
binding!!.nearbyFilterList.checkboxTriStates.state = CheckBoxTriStates.UNKNOWN

View file

@ -46,6 +46,6 @@
android:id="@+id/appwidget_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/appwidget_img" />
android:contentDescription="@string/appwidget_img" />
</LinearLayout>

View file

@ -34,12 +34,12 @@
</plurals>
<string name="starting_uploads">Starting Uploads</string>
<plurals name="starting_multiple_uploads">
<item quantity="one">Processing %d upload</item>
<item quantity="other">Processing %d uploads</item>
<item quantity="one">Processing %1$d upload</item>
<item quantity="other">Processing %1$d uploads</item>
</plurals>
<plurals name="multiple_uploads_title">
<item quantity="one">%d upload</item>
<item quantity="other">%d uploads</item>
<item quantity="one">%1$d upload</item>
<item quantity="other">%1$d uploads</item>
</plurals>
<plurals name="share_license_summary">
<item quantity="one">This image will be licensed under %1$s</item>
@ -83,7 +83,7 @@
<string name="uploading_queued">Upload queued (limited connection mode enabled)</string>
<string name="upload_completed_notification_title">%1$s uploaded!</string>
<string name="upload_completed_notification_text">Tap to view your upload</string>
<string name="upload_progress_notification_title_start">Uploading file: %s</string>
<string name="upload_progress_notification_title_start">Uploading file: %1$s</string>
<string name="upload_progress_notification_title_in_progress">%1$s uploading</string>
<string name="upload_progress_notification_title_finishing">Finishing uploading %1$s</string>
<string name="upload_failed_notification_title">Failed to upload %1$s</string>
@ -233,8 +233,8 @@
<string name="welcome_image_llamas">Llamas</string>
<string name="welcome_image_rainbow_bridge">Rainbow Bridge</string>
<string name="welcome_image_tulip">Tulip</string>
<string name="welcome_image_welcome_wikipedia">Welcome Wikipedia</string>
<string name="welcome_image_welcome_copyright">Welcome Copyright</string>
<string name="welcome_image_welcome_wikipedia">A schematic image of a generic Wikipedia article.</string>
<string name="welcome_image_welcome_copyright">A drawing of a stack of papers with the copyright symbol crossed out.</string>
<string name="welcome_image_sydney_opera_house">Sydney Opera House</string>
<string name="cancel">Cancel</string>
<string name="navigation_drawer_open">Open</string>
@ -388,9 +388,9 @@
<string name="statistics_thanks">Thanks Received</string>
<string name="statistics_featured">Featured Images</string>
<string name="statistics_wikidata_edits">Images via \"Nearby Places\"</string>
<string name="level">Level %d</string>
<string name="profile_withLevel">%s (Level %s)</string>
<string name="profile_withoutLevel">%s (%s)</string>
<string name="level">Level %1$d</string>
<string name="profile_withLevel">%1$s (Level %2$s)</string>
<string name="profile_withoutLevel">%1$s (%2$s)</string>
<string name="images_uploaded">Images Uploaded</string>
<string name="image_reverts">Images Not Reverted</string>
<string name="images_used_by_wiki">Images Used</string>
@ -610,7 +610,7 @@ Upload your first media by tapping on the add button.</string>
<string name="share_image_via">Share image via</string>
<string name="you_have_no_achievements_yet">You haven\'t made any contributions yet</string>
<string name="no_achievements_yet">%s has not made any contributions yet</string>
<string name="no_achievements_yet">%1$s has not made any contributions yet</string>
<string name="account_created">Account created!</string>
<string name="text_copy">Text copied to clipboard</string>
<string name="notification_mark_read">Notification marked as read</string>
@ -757,8 +757,8 @@ Upload your first media by tapping on the add button.</string>
<string name="location_off_dialog_text">Please turn on location services to view nearby places.</string>
<string name="location_permission_rationale">Location access is needed to show nearby places on the map.</string>
<string name="contributions_of_user">Contributions of User: %s</string>
<string name="achievements_of_user">Achievements of User: %s</string>
<string name="contributions_of_user">Contributions of User: %1$s</string>
<string name="achievements_of_user">Achievements of User: %1$s</string>
<string name="menu_view_user_page">View user profile</string>
<string name="edit_depictions">Edit depictions</string>
<string name="edit_categories">Edit categories</string>
@ -834,8 +834,8 @@ Upload your first media by tapping on the add button.</string>
<string name="saving_kml_file">Saving as a KML file...</string>
<string name="saving_gpx_file">Saving as a GPX file...</string>
<plurals name="custom_picker_images_selected_title_appendix">
<item quantity="one">%d image selected</item>
<item quantity="other">%d images selected</item>
<item quantity="one">%1$d image selected</item>
<item quantity="other">%1$d images selected</item>
</plurals>
<string name="multiple_files_depiction">Please remember that all images in a multi-upload get the same categories and depictions. If the images do not share depictions and categories, please perform several separate uploads.</string>
<string name="multiple_files_depiction_header">Note about multi-uploads</string>

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<licenses xmlns="https://www.mediawiki.org/wiki/Extension:UploadWizard/xmlns/licenses">
<license id="cc-by-4.0" template="cc-by-4.0" url="https://creativecommons.org/licenses/by/4.0/deed.$lang"/>
<license id="cc-by-sa-4.0" template="cc-by-sa-4.0" url="https://creativecommons.org/licenses/by-sa/4.0/deed.$lang"/>
<license id="cc-by-sa-3.0" template="cc-by-sa-3.0" url="https://creativecommons.org/licenses/by-sa/3.0/deed.$lang"/>
<license id="cc-by-sa-3.0-at" template="cc-by-sa-3.0-at" url="https://creativecommons.org/licenses/by-sa/3.0/at/deed.$lang"/>
<license id="cc-by-sa-3.0-de" template="cc-by-sa-3.0-de" url="https://creativecommons.org/licenses/by-sa/3.0/de/deed.$lang"/>
<license id="cc-by-sa-3.0-ee" template="cc-by-sa-3.0-ee" url="https://creativecommons.org/licenses/by-sa/3.0/ee/deed.$lang"/>
<license id="cc-by-sa-3.0-es" template="cc-by-sa-3.0-es" url="https://creativecommons.org/licenses/by-sa/3.0/es/deed.$lang"/>
<license id="cc-by-sa-3.0-hr" template="cc-by-sa-3.0-hr" url="https://creativecommons.org/licenses/by-sa/3.0/hr/deed.$lang"/>
<license id="cc-by-sa-3.0-lu" template="cc-by-sa-3.0-lu" url="https://creativecommons.org/licenses/by-sa/3.0/lu/deed.$lang"/>
<license id="cc-by-sa-3.0-nl" template="cc-by-sa-3.0-nl" url="https://creativecommons.org/licenses/by-sa/3.0/nl/deed.$lang"/>
<license id="cc-by-sa-3.0-no" template="cc-by-sa-3.0-no" url="https://creativecommons.org/licenses/by-sa/3.0/no/deed.$lang"/>
<license id="cc-by-sa-3.0-pl" template="cc-by-sa-3.0-pl" url="https://creativecommons.org/licenses/by-sa/3.0/pl/deed.$lang"/>
<license id="cc-by-sa-3.0-ro" template="cc-by-sa-3.0-ro" url="https://creativecommons.org/licenses/by-sa/3.0/ro/deed.$lang"/>
<license id="cc-by-3.0" template="cc-by-3.0" url="https://creativecommons.org/licenses/by/3.0/deed.$lang"/>
<license id="cc-zero" template="cc-zero" url="https://creativecommons.org/publicdomain/zero/1.0/deed.$lang"/>
</licenses>

View file

@ -1,14 +0,0 @@
.FAKE : build update clean install
build : ../app/src/main/res/xml/wikimedia_licenses.xml
../app/src/main/res/xml/wikimedia_licenses.xml : licenses.php mediawiki-extensions-UploadWizard
php licenses.php > ../app/src/main/res/xml/wikimedia_licenses.xml
mediawiki-extensions-UploadWizard : update
update :
if [ -d mediawiki-extensions-UploadWizard ]; then (cd mediawiki-extensions-UploadWizard && git pull origin master); else git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UploadWizard mediawiki-extensions-UploadWizard; fi
clean :
rm -rf mediawiki-extensions-UploadWizard

View file

@ -1,68 +0,0 @@
<?php
// Stubs for enough of the MediaWiki environment to run UploadWizard.config.php
global $wgFileExtensions, $wgServer, $wgScriptPath, $wgAPIModules, $wgMaxUploadSize, $wgLang, $wgMemc, $wgUploadWizardConfig;
class FakeLang {
function getCode() {
return 'en';
}
}
$wgLang = new FakeLang();
function wfMemcKey() {
return 'fake-key';
}
class FakeMemc {
function get() {
return array( 'en' => 'English' );
}
}
$wgMemc = new FakeMemc();
class FakeMessage {
function plain() {
return 'stub-message-plain';
}
function parse() {
return 'stub-message-parsed';
}
}
function wfMessage() {
return new FakeMessage();
}
/**
* Converts shorthand byte notation to integer form
*
* @param $string String
* @return Integer
*/
function wfShorthandToInteger( $string = '' ) {
$string = trim( $string );
if ( $string === '' ) {
return -1;
}
$last = $string[strlen( $string ) - 1];
$val = intval( $string );
switch ( $last ) {
case 'g':
case 'G':
$val *= 1024;
// break intentionally missing
case 'm':
case 'M':
$val *= 1024;
// break intentionally missing
case 'k':
case 'K':
$val *= 1024;
}
return $val;
}
$wgAPIModules = array();

View file

@ -1,71 +0,0 @@
<?php
// Quick hack to extract default license list from UploadWizard configuration.
// In future, try to export this info via the API on wiki so we can pull dynamically.
//
// Brion Vibber <brion@pobox.com>
// 2013-09-30
require 'include-stubs.php';
$config = require "mediawiki-extensions-UploadWizard/UploadWizard.config.php";
require "mediawiki-extensions-UploadWizard/UploadWizard.i18n.php";
$licenseList = array();
foreach ( $config['licenses'] as $key => $license ) {
// Determine template -> license mappings
if ( isset( $license['templates'] ) ) {
$templates = $license['templates'];
} else {
$templates = array( $key );
}
if ( count( $templates ) < 1 ) {
throw new Exception("No templates for $key, this is wrong.");
}
if ( count( $templates ) > 1 ) {
//echo "Skipping multi-template license: $key\n";
continue;
}
$template = $templates[0];
if ( preg_match( '/^subst:/i', $template ) ) {
//echo "Skipping subst license: $key\n";
continue;
}
$msg = $messages['en'][$license['msg']];
$licenseInfo = array(
'desc' => $msg,
'template' => $template
);
if ( isset( $license['url'] ) ) {
$url = $license['url'];
if ( substr( $url, 0, 2 ) == '//' ) {
$url = 'https:' . $url;
}
if ( isset( $license['languageCodePrefix'] ) ) {
$url .= $license['languageCodePrefix'] . '$lang';
}
$licenseInfo['url'] = $url;
}
$licenseList[$key] = $licenseInfo;
}
//var_dump( $licenseList );
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<licenses xmlns=\"https://www.mediawiki.org/wiki/Extension:UploadWizard/xmlns/licenses\">\n";
foreach( $licenseList as $key => $licenseInfo ) {
$encId = htmlspecialchars( $key );
echo " <license id=\"$encId\"";
$encTemplate = htmlspecialchars( $licenseInfo['template'] );
echo " template=\"$encTemplate\"";
if ( isset( $licenseInfo['url'] ) ) {
$encUrl = htmlspecialchars( $licenseInfo['url'] );
echo " url=\"$encUrl\"";
}
echo "/>\n";
}
echo "</licenses>\n";