minor fixes

This commit is contained in:
Thibault Deckers 2021-10-05 19:38:52 +09:00
parent 35929fa7ab
commit 184f65eab6
3 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
package deckers.thibault.aves.model
enum class NameConflictStrategy {
SKIP, REPLACE, RENAME;
RENAME, REPLACE, SKIP;
companion object {
fun get(name: String?): NameConflictStrategy? {

View file

@ -339,9 +339,9 @@ class MediaStoreImageProvider : ImageProvider() {
): FieldMap {
val sourceFile = File(sourcePath)
val sourceDir = sourceFile.parent?.let { ensureTrailingSeparator(it) }
if (sourceDir == destinationDir) {
if (copy) throw Exception("file at path=$sourcePath is already in destination directory")
return HashMap<String, Any?>()
if (sourceDir == destinationDir && !(copy && nameConflictStrategy == NameConflictStrategy.RENAME)) {
// nothing to do unless it's a renamed copy
return skippedFieldMap
}
val sourceFileName = sourceFile.name

View file

@ -248,7 +248,7 @@ class _MapPageContentState extends State<MapPageContent> with SingleTickerProvid
return ThumbnailScroller(
availableWidth: mqWidth,
entryCount: regionEntries.length,
entryBuilder: (index) => regionEntries[index],
entryBuilder: (index) => index < regionEntries.length ? regionEntries[index] : null,
indexNotifier: _selectedIndexNotifier,
onTap: _onThumbnailTap,
heroTagger: (entry) => Object.hashAll([regionCollection?.id, entry.uri]),