mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Added 20-img limit
This commit is contained in:
parent
d918b848e8
commit
82cb5db144
5 changed files with 9 additions and 9 deletions
|
|
@ -190,8 +190,8 @@ class ImageAdapter(
|
|||
)
|
||||
holder.itemView.setOnClickListener {
|
||||
if (!holder.isItemUploaded() && !holder.isItemNotForUpload()) {
|
||||
if (selectedImages.size >= 5 && !isSelected) { //enforce the 5-image limit
|
||||
Toast.makeText(context, "Cannot select more than 5 images", Toast.LENGTH_SHORT).show()
|
||||
if (selectedImages.size >= 20 && !isSelected) { //enforce the 20-image limit
|
||||
Toast.makeText(context, "Cannot select more than 20 images", Toast.LENGTH_SHORT).show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (isSelected) {
|
||||
|
|
@ -400,7 +400,7 @@ class ImageAdapter(
|
|||
* Set new selected images
|
||||
*/
|
||||
fun setSelectedImages(newSelectedImages: ArrayList<Image>) {
|
||||
selectedImages = ArrayList(newSelectedImages.take(5)) // enforce 5-image limit
|
||||
selectedImages = ArrayList(newSelectedImages.take(20)) // enforce 20-image limit
|
||||
imageSelectListener.onSelectedImagesChanged(selectedImages, 0)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class CustomSelectorActivity :
|
|||
/**
|
||||
* Maximum number of images that can be selected.
|
||||
*/
|
||||
private var uploadLimit: Int = 5 // Changed to 5 asper the issue #3101
|
||||
private var uploadLimit: Int = 20 // changed to 20 asper the issue #3101
|
||||
|
||||
/**
|
||||
* Flag that is marked true when the amount
|
||||
|
|
@ -651,7 +651,7 @@ class CustomSelectorActivity :
|
|||
return
|
||||
}
|
||||
if (selectedImages.size > uploadLimit) {
|
||||
displayUploadLimitWarning() // shows the warning dialog if >5 images
|
||||
displayUploadLimitWarning() // shows the warning dialog if >20 images
|
||||
return
|
||||
}
|
||||
scope.launch(ioDispatcher) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ internal class ThumbnailsAdapter(private val callback: Callback) :
|
|||
var onThumbnailDeletedListener: OnThumbnailDeletedListener? = null
|
||||
var uploadableFiles: List<UploadableFile> = emptyList()
|
||||
set(value) {
|
||||
field = value.take(5) //enforce 5-image limit
|
||||
field = value.take(20) //enforce 20-image limit
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -735,8 +735,8 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C
|
|||
intent.getParcelableArrayListExtra<UploadableFile>(EXTRA_FILES)
|
||||
}
|
||||
|
||||
// Convert to mutable list,takes up to 5 files, or return empty list if null
|
||||
files?.toMutableList()?.take(5)?.toMutableList() ?: run { //enforce 5-image limit
|
||||
// Convert to mutable list,takes up to 20 files, or return empty list if null
|
||||
files?.toMutableList()?.take(20)?.toMutableList() ?: run { //enforce 20-image limit
|
||||
Timber.w("Files array was null")
|
||||
mutableListOf()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -888,5 +888,5 @@ Upload your first media by tapping on the add button.</string>
|
|||
<string name="image_tag_line_created_by_and_uploaded_by">Created by %1$s and uploaded by %2$s</string>
|
||||
<string name="nominated_for_deletion_btn">Nominated for Deletion</string>
|
||||
|
||||
<string name="custom_selector_limit_warning_message">You can only select up to 5 images.</string>
|
||||
<string name="custom_selector_limit_warning_message">You can only select up to 20 images.</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue