diff --git a/app/src/main/java/fr/free/nrw/commons/bookmarks/items/BookmarkItemsDao.kt b/app/src/main/java/fr/free/nrw/commons/bookmarks/items/BookmarkItemsDao.kt index e21e1ac8f..bfb3ec764 100644 --- a/app/src/main/java/fr/free/nrw/commons/bookmarks/items/BookmarkItemsDao.kt +++ b/app/src/main/java/fr/free/nrw/commons/bookmarks/items/BookmarkItemsDao.kt @@ -173,13 +173,19 @@ class BookmarkItemsDao @Inject constructor( categoryNameList: List, categoryDescriptionList: List, categoryThumbnailList: List - ): List = categoryNameList.mapIndexed { index, name -> - CategoryItem( - name = name, - description = categoryDescriptionList.getOrNull(index), - thumbnail = categoryThumbnailList.getOrNull(index), - isSelected = false - ) + ): List { + return buildList { + for (i in categoryNameList.indices) { + add( + CategoryItem( + categoryNameList[i], + categoryDescriptionList[i], + categoryThumbnailList[i], + false + ) + ) + } + } } /** diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyFilterSearchRecyclerViewAdapter.java b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyFilterSearchRecyclerViewAdapter.java index 53e9970a6..b5f760c9f 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyFilterSearchRecyclerViewAdapter.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyFilterSearchRecyclerViewAdapter.java @@ -91,7 +91,6 @@ public class NearbyFilterSearchRecyclerViewAdapter label.setSelected(!label.isSelected()); holder.placeTypeLayout.setSelected(label.isSelected()); - NearbyFilterState.setSelectedLabels(new ArrayList<>(selectedLabels)); callback.filterByMarkerType(selectedLabels, 0, false, false); }); } @@ -153,7 +152,6 @@ public class NearbyFilterSearchRecyclerViewAdapter label.setSelected(false); selectedLabels.remove(label); } - NearbyFilterState.setSelectedLabels(new ArrayList<>(selectedLabels)); notifyDataSetChanged(); } @@ -165,7 +163,6 @@ public class NearbyFilterSearchRecyclerViewAdapter selectedLabels.add(label); } } - NearbyFilterState.setSelectedLabels(new ArrayList<>(selectedLabels)); notifyDataSetChanged(); } diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt index 3e6e71511..5c991f465 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt +++ b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt @@ -881,12 +881,6 @@ 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, @@ -930,7 +924,6 @@ class NearbyParentFragment : CommonsDaggerSupportFragment(), return _isDarkTheme } }) - restoreStoredFilterSelection() binding!!.nearbyFilterList.root .layoutParams.width = getScreenWidth( requireActivity(), @@ -949,22 +942,6 @@ 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 @@ -3010,4 +2987,4 @@ class NearbyParentFragment : CommonsDaggerSupportFragment(), return input.contains("(") || input.contains(")") } } -} +} \ No newline at end of file diff --git a/app/src/main/res/layout/pic_of_day_app_widget.xml b/app/src/main/res/layout/pic_of_day_app_widget.xml index 53e54a7cf..beb3e20d4 100644 --- a/app/src/main/res/layout/pic_of_day_app_widget.xml +++ b/app/src/main/res/layout/pic_of_day_app_widget.xml @@ -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" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 996d0edba..064b197e4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -34,12 +34,12 @@ Starting Uploads - Processing %1$d upload - Processing %1$d uploads + Processing %d upload + Processing %d uploads - %1$d upload - %1$d uploads + %d upload + %d uploads This image will be licensed under %1$s @@ -83,7 +83,7 @@ Upload queued (limited connection mode enabled) %1$s uploaded! Tap to view your upload - Uploading file: %1$s + Uploading file: %s %1$s uploading Finishing uploading %1$s Failed to upload %1$s @@ -233,8 +233,8 @@ Llamas Rainbow Bridge Tulip - A schematic image of a generic Wikipedia article. - A drawing of a stack of papers with the copyright symbol crossed out. + Welcome Wikipedia + Welcome Copyright Sydney Opera House Cancel Open @@ -388,9 +388,9 @@ Thanks Received Featured Images Images via \"Nearby Places\" - Level %1$d - %1$s (Level %2$s) - %1$s (%2$s) + Level %d + %s (Level %s) + %s (%s) Images Uploaded Images Not Reverted Images Used @@ -610,7 +610,7 @@ Upload your first media by tapping on the add button. Share image via You haven\'t made any contributions yet - %1$s has not made any contributions yet + %s has not made any contributions yet Account created! Text copied to clipboard Notification marked as read @@ -757,8 +757,8 @@ Upload your first media by tapping on the add button. Please turn on location services to view nearby places. Location access is needed to show nearby places on the map. - Contributions of User: %1$s - Achievements of User: %1$s + Contributions of User: %s + Achievements of User: %s View user profile Edit depictions Edit categories @@ -834,8 +834,8 @@ Upload your first media by tapping on the add button. Saving as a KML file... Saving as a GPX file... - %1$d image selected - %1$d images selected + %d image selected + %d images selected 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. Note about multi-uploads diff --git a/app/src/main/res/xml/wikimedia_licenses.xml b/app/src/main/res/xml/wikimedia_licenses.xml new file mode 100644 index 000000000..b9ac19124 --- /dev/null +++ b/app/src/main/res/xml/wikimedia_licenses.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/update-license-info/Makefile b/update-license-info/Makefile new file mode 100644 index 000000000..a6c96ee2a --- /dev/null +++ b/update-license-info/Makefile @@ -0,0 +1,14 @@ +.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 diff --git a/update-license-info/include-stubs.php b/update-license-info/include-stubs.php new file mode 100644 index 000000000..c0a01a0d6 --- /dev/null +++ b/update-license-info/include-stubs.php @@ -0,0 +1,68 @@ + '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(); diff --git a/update-license-info/licenses.php b/update-license-info/licenses.php new file mode 100644 index 000000000..badda1a08 --- /dev/null +++ b/update-license-info/licenses.php @@ -0,0 +1,71 @@ + +// 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 "\n"; +echo "\n"; +foreach( $licenseList as $key => $licenseInfo ) { + $encId = htmlspecialchars( $key ); + echo " \n"; + +} +echo "\n"; + \ No newline at end of file