mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Merge branch 'main' into fix/issue-6432-map-crash
This commit is contained in:
commit
71968f2be1
8 changed files with 47 additions and 34 deletions
|
|
@ -144,8 +144,18 @@ class BookmarkItemsDao @Inject constructor(
|
||||||
*/
|
*/
|
||||||
@SuppressLint("Range")
|
@SuppressLint("Range")
|
||||||
fun fromCursor(cursor: Cursor) = with(cursor) {
|
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(
|
DepictedItem(
|
||||||
getString(COLUMN_NAME),
|
name,
|
||||||
getString(COLUMN_DESCRIPTION),
|
getString(COLUMN_DESCRIPTION),
|
||||||
getString(COLUMN_IMAGE),
|
getString(COLUMN_IMAGE),
|
||||||
getStringArray(COLUMN_INSTANCE_LIST),
|
getStringArray(COLUMN_INSTANCE_LIST),
|
||||||
|
|
@ -155,7 +165,7 @@ class BookmarkItemsDao @Inject constructor(
|
||||||
getStringArray(COLUMN_CATEGORIES_THUMBNAIL_LIST)
|
getStringArray(COLUMN_CATEGORIES_THUMBNAIL_LIST)
|
||||||
),
|
),
|
||||||
getString(COLUMN_IS_SELECTED).toBoolean(),
|
getString(COLUMN_IS_SELECTED).toBoolean(),
|
||||||
getString(COLUMN_ID)
|
id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,10 @@ class BookmarkPicturesDao @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fromCursor(cursor: Cursor): Bookmark {
|
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(
|
return Bookmark(
|
||||||
fileName, cursor.getString(COLUMN_CREATOR), uriForName(fileName)
|
fileName, cursor.getString(COLUMN_CREATOR), uriForName(fileName)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -153,21 +153,7 @@ after opening the app.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setUpPager()
|
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()
|
checkAndResumeStuckUploads()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,11 +163,19 @@ class RecentSearchesDao @Inject constructor(
|
||||||
* @param cursor
|
* @param cursor
|
||||||
* @return RecentSearch object
|
* @return RecentSearch object
|
||||||
*/
|
*/
|
||||||
fun fromCursor(cursor: Cursor): RecentSearch = RecentSearch(
|
fun fromCursor(cursor: Cursor): RecentSearch {
|
||||||
uriForId(cursor.getInt(COLUMN_ID)),
|
var query = cursor.getString(COLUMN_NAME)
|
||||||
cursor.getString(COLUMN_NAME),
|
|
||||||
Date(cursor.getLong(COLUMN_LAST_USED))
|
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,
|
* This class contains the database table architechture for recent searches,
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class MediaLicenseFragment : UploadBaseFragment(), MediaLicenseContract.View {
|
||||||
requireActivity(),
|
requireActivity(),
|
||||||
getString(R.string.license_step_title),
|
getString(R.string.license_step_title),
|
||||||
getString(R.string.license_tooltip),
|
getString(R.string.license_tooltip),
|
||||||
getString(android.R.string.ok),
|
getString(R.string.ok),
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,20 @@ import android.database.Cursor
|
||||||
fun Cursor.getStringArray(name: String): List<String> =
|
fun Cursor.getStringArray(name: String): List<String> =
|
||||||
stringToArray(getString(name))
|
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")
|
@SuppressLint("Range")
|
||||||
fun Cursor.getString(name: String): String =
|
fun Cursor.getString(name: String): String? {
|
||||||
getString(getColumnIndex(name))
|
val index = getColumnIndex(name)
|
||||||
|
if (index == -1) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return getString(index)
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("Range")
|
@SuppressLint("Range")
|
||||||
fun Cursor.getInt(name: String): Int =
|
fun Cursor.getInt(name: String): Int =
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,6 @@
|
||||||
<string name="Achievements">Menu item.</string>
|
<string name="Achievements">Menu item.</string>
|
||||||
<string name="Profile">Menu item.</string>
|
<string name="Profile">Menu item.</string>
|
||||||
<string name="badges">Title on Profile page.</string>
|
<string name="badges">Title on Profile page.</string>
|
||||||
<string name="statistics">Seems to be unused.</string>
|
|
||||||
<string name="statistics_thanks">Title on Profile page.</string>
|
<string name="statistics_thanks">Title on Profile page.</string>
|
||||||
<string name="statistics_featured">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\".</string>
|
<string name="statistics_featured">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\".</string>
|
||||||
<string name="statistics_wikidata_edits">Item in statistics.</string>
|
<string name="statistics_wikidata_edits">Item in statistics.</string>
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,6 @@
|
||||||
<string name="Achievements">Achievements</string>
|
<string name="Achievements">Achievements</string>
|
||||||
<string name="Profile">Profile</string>
|
<string name="Profile">Profile</string>
|
||||||
<string name="badges">Badges</string>
|
<string name="badges">Badges</string>
|
||||||
<string name="statistics">Statistics</string>
|
|
||||||
<string name="statistics_thanks">Thanks Received</string>
|
<string name="statistics_thanks">Thanks Received</string>
|
||||||
<string name="statistics_featured">Featured Images</string>
|
<string name="statistics_featured">Featured Images</string>
|
||||||
<string name="statistics_wikidata_edits">Images via \"Nearby Places\"</string>
|
<string name="statistics_wikidata_edits">Images via \"Nearby Places\"</string>
|
||||||
|
|
@ -462,7 +461,7 @@ Upload your first media by tapping on the add button.</string>
|
||||||
<string name="never_ask_again">Never ask this again</string>
|
<string name="never_ask_again">Never ask this again</string>
|
||||||
<string name="display_location_permission_title">Ask for location permission</string>
|
<string name="display_location_permission_title">Ask for location permission</string>
|
||||||
<string name="display_location_permission_explanation">Ask for location permission when needed for nearby notification card view feature.</string>
|
<string name="display_location_permission_explanation">Ask for location permission when needed for nearby notification card view feature.</string>
|
||||||
<string name="achievements_fetch_failed">Something went wrong, We could not fetch achievements</string>
|
<string name="achievements_fetch_failed">Something went wrong, and we could not fetch achievements</string>
|
||||||
<string name="achievements_fetch_failed_ultimate_achievement">You\'ve made so many contributions our achievements calculation system can\'t cope. This is the ultimate achievement.</string>
|
<string name="achievements_fetch_failed_ultimate_achievement">You\'ve made so many contributions our achievements calculation system can\'t cope. This is the ultimate achievement.</string>
|
||||||
<string name="ends_on">Ends on:</string>
|
<string name="ends_on">Ends on:</string>
|
||||||
<string name="display_campaigns">Display campaigns</string>
|
<string name="display_campaigns">Display campaigns</string>
|
||||||
|
|
@ -538,7 +537,7 @@ Upload your first media by tapping on the add button.</string>
|
||||||
<string name="welcome_do_upload_content_description">Examples of good images to upload to Commons</string>
|
<string name="welcome_do_upload_content_description">Examples of good images to upload to Commons</string>
|
||||||
<string name="welcome_dont_upload_content_description">Examples of images not to upload</string>
|
<string name="welcome_dont_upload_content_description">Examples of images not to upload</string>
|
||||||
<string name="skip_image">Skip this image</string>
|
<string name="skip_image">Skip this image</string>
|
||||||
<string name="download_failed_we_cannot_download_the_file_without_storage_permission">Download Failed!!. We cannot download the file without external storage permission.</string>
|
<string name="download_failed_we_cannot_download_the_file_without_storage_permission">Download failed. We cannot download the file without external storage permission.</string>
|
||||||
|
|
||||||
<string name="manage_exif_tags">Manage EXIF Tags</string>
|
<string name="manage_exif_tags">Manage EXIF Tags</string>
|
||||||
<string name="manage_exif_tags_summary">Select which EXIF tags to keep in uploads</string>
|
<string name="manage_exif_tags_summary">Select which EXIF tags to keep in uploads</string>
|
||||||
|
|
@ -551,9 +550,6 @@ Upload your first media by tapping on the add button.</string>
|
||||||
<string name="exif_tag_name_serialNumbers">Serial Numbers</string>
|
<string name="exif_tag_name_serialNumbers">Serial Numbers</string>
|
||||||
<string name="exif_tag_name_software">Software</string>
|
<string name="exif_tag_name_software">Software</string>
|
||||||
|
|
||||||
<string name="media_location_permission_denied">Media location access denied</string>
|
|
||||||
<string name="add_location_manually">We may not be able to automatically obtain location data from pictures you upload. Please add the appropriate location for each picture before submitting</string>
|
|
||||||
|
|
||||||
<string name="share_text">Upload photos to Wikimedia Commons directly from your phone. Download the Commons App now: %1$s</string>
|
<string name="share_text">Upload photos to Wikimedia Commons directly from your phone. Download the Commons App now: %1$s</string>
|
||||||
<string name="share_via">Share app via...</string>
|
<string name="share_via">Share app via...</string>
|
||||||
<string name="image_info">Image Info</string>
|
<string name="image_info">Image Info</string>
|
||||||
|
|
@ -671,7 +667,7 @@ Upload your first media by tapping on the add button.</string>
|
||||||
<string name="wikipedia_instructions_step_5">5. Paste the wikitext in the appropriate place.</string>
|
<string name="wikipedia_instructions_step_5">5. Paste the wikitext in the appropriate place.</string>
|
||||||
<string name="wikipedia_instructions_step_6">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>.</string>
|
<string name="wikipedia_instructions_step_6">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>.</string>
|
||||||
<string name="wikipedia_instructions_step_7">7. Publish the article</string>
|
<string name="wikipedia_instructions_step_7">7. Publish the article</string>
|
||||||
<string name="copy_wikicode_to_clipboard">Copy wikicode to clipboard</string>
|
<string name="copy_wikicode_to_clipboard">Copy wikitext to clipboard</string>
|
||||||
<string name="pause">pause</string>
|
<string name="pause">pause</string>
|
||||||
<string name="resume">resume</string>
|
<string name="resume">resume</string>
|
||||||
<string name="paused">Paused</string>
|
<string name="paused">Paused</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue