Compare commits

..

No commits in common. "b8d340fbe8472c9d4bd75d4ff95f257312abdb23" and "7be615bacb9df942fda680f4e6834956c13e32f5" have entirely different histories.

8 changed files with 23 additions and 55 deletions

View file

@ -144,18 +144,8 @@ 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(
name, getString(COLUMN_NAME),
getString(COLUMN_DESCRIPTION), getString(COLUMN_DESCRIPTION),
getString(COLUMN_IMAGE), getString(COLUMN_IMAGE),
getStringArray(COLUMN_INSTANCE_LIST), getStringArray(COLUMN_INSTANCE_LIST),
@ -165,7 +155,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(),
id getString(COLUMN_ID)
) )
} }

View file

@ -128,10 +128,7 @@ class BookmarkPicturesDao @Inject constructor(
} }
fun fromCursor(cursor: Cursor): Bookmark { fun fromCursor(cursor: Cursor): Bookmark {
var fileName = cursor.getString(COLUMN_MEDIA_NAME) val 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)
) )

View file

@ -963,17 +963,13 @@ class ExploreMapFragment : CommonsDaggerSupportFragment(), ExploreMapContract.Vi
if (geoPoint != null) { if (geoPoint != null) {
binding!!.mapView.controller.setCenter(geoPoint) binding!!.mapView.controller.setCenter(geoPoint)
val overlays = binding!!.mapView.overlays val overlays = binding!!.mapView.overlays
// collects the indices of items to remove
val indicesToRemove = mutableListOf<Int>()
for (i in overlays.indices) { for (i in overlays.indices) {
if (overlays[i] is Marker || overlays[i] is ScaleDiskOverlay) { if (overlays[i] is Marker) {
indicesToRemove.add(i) binding!!.mapView.overlays.removeAt(i)
} else if (overlays[i] is ScaleDiskOverlay) {
binding!!.mapView.overlays.removeAt(i)
} }
} }
// removes the items in reverse order to avoid index shifting
indicesToRemove.sortedDescending().forEach { index ->
binding!!.mapView.overlays.removeAt(index)
}
val diskOverlay = ScaleDiskOverlay( val diskOverlay = ScaleDiskOverlay(
requireContext(), requireContext(),
geoPoint, 2000, GeoConstants.UnitOfMeasure.foot geoPoint, 2000, GeoConstants.UnitOfMeasure.foot
@ -983,6 +979,7 @@ class ExploreMapFragment : CommonsDaggerSupportFragment(), ExploreMapContract.Vi
this.style = Paint.Style.STROKE this.style = Paint.Style.STROKE
this.strokeWidth = 2f this.strokeWidth = 2f
}) })
setCirclePaint1(Paint().apply { setCirclePaint1(Paint().apply {
setColor(Color.argb(40, 128, 128, 128)) setColor(Color.argb(40, 128, 128, 128))
this.style = Paint.Style.FILL_AND_STROKE this.style = Paint.Style.FILL_AND_STROKE
@ -991,6 +988,7 @@ class ExploreMapFragment : CommonsDaggerSupportFragment(), ExploreMapContract.Vi
setDisplaySizeMax(1700) setDisplaySizeMax(1700)
} }
binding!!.mapView.overlays.add(diskOverlay) binding!!.mapView.overlays.add(diskOverlay)
val startMarker = Marker( val startMarker = Marker(
binding!!.mapView binding!!.mapView
).apply { ).apply {

View file

@ -163,19 +163,11 @@ class RecentSearchesDao @Inject constructor(
* @param cursor * @param cursor
* @return RecentSearch object * @return RecentSearch object
*/ */
fun fromCursor(cursor: Cursor): RecentSearch { fun fromCursor(cursor: Cursor): RecentSearch = RecentSearch(
var query = cursor.getString(COLUMN_NAME) uriForId(cursor.getInt(COLUMN_ID)),
cursor.getString(COLUMN_NAME),
if (query == null) { Date(cursor.getLong(COLUMN_LAST_USED))
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,

View file

@ -1027,12 +1027,12 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C
val message: String = if (result) { val message: String = if (result) {
context.getString( context.getString(
R.string.send_thank_success_message, R.string.send_thank_success_message,
media!!.user media!!.displayTitle
) )
} else { } else {
context.getString( context.getString(
R.string.send_thank_failure_message, R.string.send_thank_failure_message,
media!!.user media!!.displayTitle
) )
} }

View file

@ -6,20 +6,9 @@ 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 =
val index = getColumnIndex(name) getString(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 =

View file

@ -374,6 +374,7 @@
<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>

View file

@ -384,6 +384,7 @@
<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>
@ -493,8 +494,8 @@ Upload your first media by tapping on the add button.</string>
<string name="check_category_toast">Requesting category check for %1$s</string> <string name="check_category_toast">Requesting category check for %1$s</string>
<string name="nominate_for_deletion_done">Done</string> <string name="nominate_for_deletion_done">Done</string>
<string name="send_thank_success_title">Sending Thanks: Success</string> <string name="send_thank_success_title">Sending Thanks: Success</string>
<string name="send_thank_success_message">Sent thanks to %1$s</string> <string name="send_thank_success_message">Successfully sent thanks to %1$s</string>
<string name="send_thank_failure_message">Failed to send thanks to %1$s</string> <string name="send_thank_failure_message">Failed to send thanks %1$s</string>
<string name="send_thank_failure_title">Sending Thanks: Failure</string> <string name="send_thank_failure_title">Sending Thanks: Failure</string>
<string name="send_thank_toast">Sending Thanks for %1$s</string> <string name="send_thank_toast">Sending Thanks for %1$s</string>
@ -532,7 +533,7 @@ Upload your first media by tapping on the add button.</string>
<string name="images_featured_explanation">Featured pictures are images from highly skilled photographers and illustrators that the Wikimedia Commons community has chosen as some of the highest quality on the site.</string> <string name="images_featured_explanation">Featured pictures are images from highly skilled photographers and illustrators that the Wikimedia Commons community has chosen as some of the highest quality on the site.</string>
<string name="images_via_nearby_explanation">Images Uploaded via Nearby places are the images which are uploaded by discovering places on the map.</string> <string name="images_via_nearby_explanation">Images Uploaded via Nearby places are the images which are uploaded by discovering places on the map.</string>
<string name="thanks_received_explanation">This feature allows editors to send a Thank you notification to users who make useful edits by using a small thank link on the history page or diff page.</string> <string name="thanks_received_explanation">This feature allows editors to send a Thank you notification to users who make useful edits by using a small thank link on the history page or diff page.</string>
<string name="copy_image_caption_description">Copy to the next items</string> <string name="copy_image_caption_description">Copy to subsequent media</string>
<string name="copied_successfully">Copied</string> <string name="copied_successfully">Copied</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>