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 d64ab16b3..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 @@ -144,8 +144,18 @@ class BookmarkItemsDao @Inject constructor( */ @SuppressLint("Range") fun fromCursor(cursor: Cursor) = with(cursor) { + var name = getString(COLUMN_NAME) + if (name == null) { + name = "" + } + + var id = getString(COLUMN_ID) + if (id == null) { + id = "" + } + DepictedItem( - getString(COLUMN_NAME), + name, getString(COLUMN_DESCRIPTION), getString(COLUMN_IMAGE), getStringArray(COLUMN_INSTANCE_LIST), @@ -155,7 +165,7 @@ class BookmarkItemsDao @Inject constructor( getStringArray(COLUMN_CATEGORIES_THUMBNAIL_LIST) ), getString(COLUMN_IS_SELECTED).toBoolean(), - getString(COLUMN_ID) + id ) } diff --git a/app/src/main/java/fr/free/nrw/commons/bookmarks/pictures/BookmarkPicturesDao.kt b/app/src/main/java/fr/free/nrw/commons/bookmarks/pictures/BookmarkPicturesDao.kt index e30b3160d..00c8e3228 100644 --- a/app/src/main/java/fr/free/nrw/commons/bookmarks/pictures/BookmarkPicturesDao.kt +++ b/app/src/main/java/fr/free/nrw/commons/bookmarks/pictures/BookmarkPicturesDao.kt @@ -128,7 +128,10 @@ class BookmarkPicturesDao @Inject constructor( } fun fromCursor(cursor: Cursor): Bookmark { - val fileName = cursor.getString(COLUMN_MEDIA_NAME) + var fileName = cursor.getString(COLUMN_MEDIA_NAME) + if (fileName == null) { + fileName = "" + } return Bookmark( fileName, cursor.getString(COLUMN_CREATOR), uriForName(fileName) ) diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.kt b/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.kt index 5c2c44ab5..ac7068cc7 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.kt +++ b/app/src/main/java/fr/free/nrw/commons/contributions/MainActivity.kt @@ -153,21 +153,7 @@ after opening the app. } } setUpPager() - /** - * Ask the user for media location access just after login - * so that location in the EXIF metadata of the images shared by the user - * is retained on devices running Android 10 or above - */ -// if (VERSION.SDK_INT >= VERSION_CODES.Q) { -// ActivityCompat.requestPermissions(this, -// new String[]{Manifest.permission.ACCESS_MEDIA_LOCATION}, 0); -// PermissionUtils.checkPermissionsAndPerformAction( -// this, -// () -> {}, -// R.string.media_location_permission_denied, -// R.string.add_location_manually, -// permission.ACCESS_MEDIA_LOCATION); -// } + checkAndResumeStuckUploads() } } diff --git a/app/src/main/java/fr/free/nrw/commons/explore/recentsearches/RecentSearchesDao.kt b/app/src/main/java/fr/free/nrw/commons/explore/recentsearches/RecentSearchesDao.kt index e1d0740de..d16d250dd 100644 --- a/app/src/main/java/fr/free/nrw/commons/explore/recentsearches/RecentSearchesDao.kt +++ b/app/src/main/java/fr/free/nrw/commons/explore/recentsearches/RecentSearchesDao.kt @@ -163,11 +163,19 @@ class RecentSearchesDao @Inject constructor( * @param cursor * @return RecentSearch object */ - fun fromCursor(cursor: Cursor): RecentSearch = RecentSearch( - uriForId(cursor.getInt(COLUMN_ID)), - cursor.getString(COLUMN_NAME), - Date(cursor.getLong(COLUMN_LAST_USED)) - ) + fun fromCursor(cursor: Cursor): RecentSearch { + var query = cursor.getString(COLUMN_NAME) + + if (query == null) { + query = "" + } + + return RecentSearch( + uriForId(cursor.getInt(COLUMN_ID)), + query, + Date(cursor.getLong(COLUMN_LAST_USED)) + ) + } /** * This class contains the database table architechture for recent searches, diff --git a/app/src/main/java/fr/free/nrw/commons/upload/license/MediaLicenseFragment.kt b/app/src/main/java/fr/free/nrw/commons/upload/license/MediaLicenseFragment.kt index 65826a505..a789ef362 100644 --- a/app/src/main/java/fr/free/nrw/commons/upload/license/MediaLicenseFragment.kt +++ b/app/src/main/java/fr/free/nrw/commons/upload/license/MediaLicenseFragment.kt @@ -70,7 +70,7 @@ class MediaLicenseFragment : UploadBaseFragment(), MediaLicenseContract.View { requireActivity(), getString(R.string.license_step_title), getString(R.string.license_tooltip), - getString(android.R.string.ok), + getString(R.string.ok), null ) } diff --git a/app/src/main/java/fr/free/nrw/commons/utils/DatabaseUtils.kt b/app/src/main/java/fr/free/nrw/commons/utils/DatabaseUtils.kt index 1fd99bcee..737f34614 100644 --- a/app/src/main/java/fr/free/nrw/commons/utils/DatabaseUtils.kt +++ b/app/src/main/java/fr/free/nrw/commons/utils/DatabaseUtils.kt @@ -6,9 +6,20 @@ import android.database.Cursor fun Cursor.getStringArray(name: String): List = stringToArray(getString(name)) +/** + * Gets the String at the current row and specified column. + * + * @param name The name of the column to get the String from. + * @return The String if the column exists. Else, null is returned. + */ @SuppressLint("Range") -fun Cursor.getString(name: String): String = - getString(getColumnIndex(name)) +fun Cursor.getString(name: String): String? { + val index = getColumnIndex(name) + if (index == -1) { + return null + } + return getString(index) +} @SuppressLint("Range") fun Cursor.getInt(name: String): Int = diff --git a/app/src/main/res/values-qq/strings.xml b/app/src/main/res/values-qq/strings.xml index e1b7a0e1b..bc4869a83 100644 --- a/app/src/main/res/values-qq/strings.xml +++ b/app/src/main/res/values-qq/strings.xml @@ -374,7 +374,6 @@ Menu item. Menu item. Title on Profile page. - Seems to be unused. Title on Profile page. To see the correct translation for your language, please go to https://commons.wikimedia.org/wiki/Commons:Featured_pictures and select your language in \"This project page in other languages\". Item in statistics. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6e76cd25d..45519a370 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -384,7 +384,6 @@ Achievements Profile Badges - Statistics Thanks Received Featured Images Images via \"Nearby Places\" @@ -462,7 +461,7 @@ Upload your first media by tapping on the add button. Never ask this again Ask for location permission Ask for location permission when needed for nearby notification card view feature. - Something went wrong, We could not fetch achievements + Something went wrong, and we could not fetch achievements You\'ve made so many contributions our achievements calculation system can\'t cope. This is the ultimate achievement. Ends on: Display campaigns @@ -538,7 +537,7 @@ Upload your first media by tapping on the add button. Examples of good images to upload to Commons Examples of images not to upload Skip this image - Download Failed!!. We cannot download the file without external storage permission. + Download failed. We cannot download the file without external storage permission. Manage EXIF Tags Select which EXIF tags to keep in uploads @@ -551,9 +550,6 @@ Upload your first media by tapping on the add button. Serial Numbers Software - Media location access denied - We may not be able to automatically obtain location data from pictures you upload. Please add the appropriate location for each picture before submitting - Upload photos to Wikimedia Commons directly from your phone. Download the Commons App now: %1$s Share app via... Image Info @@ -671,7 +667,7 @@ Upload your first media by tapping on the add button. 5. Paste the wikitext in the appropriate place. 6. Edit the wikitext for appropriate positioning, if necessary. For more information, see <a href="https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Images#How_to_place_an_image">here</a>. 7. Publish the article - Copy wikicode to clipboard + Copy wikitext to clipboard pause resume Paused