Merge pull request #29 from SimpleMobileTools/master

upd
This commit is contained in:
solokot 2018-04-30 11:12:54 +03:00 committed by GitHub
commit 9495a70646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 7 deletions

View file

@ -680,7 +680,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private fun showSortedDirs(dirs: ArrayList<Directory>) { private fun showSortedDirs(dirs: ArrayList<Directory>) {
var sortedDirs = getSortedDirectories(dirs).clone() as ArrayList<Directory> var sortedDirs = getSortedDirectories(dirs).clone() as ArrayList<Directory>
sortedDirs = sortedDirs.distinctBy { it.path.toLowerCase() } as ArrayList<Directory> sortedDirs = sortedDirs.distinctBy { it.path.getDistinctPath() } as ArrayList<Directory>
runOnUiThread { runOnUiThread {
(directories_grid.adapter as DirectoryAdapter).updateDirs(sortedDirs) (directories_grid.adapter as DirectoryAdapter).updateDirs(sortedDirs)

View file

@ -276,7 +276,7 @@ fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly:
} }
}) as ArrayList<Directory> }) as ArrayList<Directory>
callback(filteredDirectories.distinctBy { it.path.toLowerCase() } as ArrayList<Directory>) callback(filteredDirectories.distinctBy { it.path.getDistinctPath() } as ArrayList<Directory>)
removeInvalidDBDirectories(directories, directoryDao) removeInvalidDBDirectories(directories, directoryDao)
}.start() }.start()

View file

@ -1,6 +1,7 @@
package com.simplemobiletools.gallery.extensions package com.simplemobiletools.gallery.extensions
import com.bumptech.glide.signature.ObjectKey import com.bumptech.glide.signature.ObjectKey
import com.simplemobiletools.commons.helpers.OTG_PATH
import java.io.File import java.io.File
fun String.getFileSignature(): ObjectKey { fun String.getFileSignature(): ObjectKey {
@ -32,3 +33,6 @@ fun String.shouldFolderBeVisible(excludedPaths: MutableSet<String>, includedPath
true true
} }
} }
// recognize /sdcard/DCIM as the same folder as /storage/emulated/0/DCIM
fun String.getDistinctPath() = if (startsWith(OTG_PATH)) toLowerCase() else File(this).canonicalPath.toLowerCase()

View file

@ -9,6 +9,7 @@ import com.simplemobiletools.commons.helpers.OTG_PATH
import com.simplemobiletools.commons.helpers.photoExtensions import com.simplemobiletools.commons.helpers.photoExtensions
import com.simplemobiletools.commons.helpers.videoExtensions import com.simplemobiletools.commons.helpers.videoExtensions
import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.extensions.getDistinctPath
import com.simplemobiletools.gallery.extensions.getOTGFolderChildren import com.simplemobiletools.gallery.extensions.getOTGFolderChildren
import com.simplemobiletools.gallery.extensions.shouldFolderBeVisible import com.simplemobiletools.gallery.extensions.shouldFolderBeVisible
import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.models.Medium
@ -139,7 +140,7 @@ class MediaFetcher(val context: Context) {
foldersToScan.add(curPath) foldersToScan.add(curPath)
} }
return foldersToScan.distinctBy { it.toLowerCase() } as ArrayList<String> return foldersToScan.distinctBy { it.getDistinctPath() } as ArrayList<String>
} }
private fun addFolder(curFolders: ArrayList<String>, folder: String) { private fun addFolder(curFolders: ArrayList<String>, folder: String) {

View file

@ -9,7 +9,7 @@
<string name="pin_folder">Pin folder</string> <string name="pin_folder">Pin folder</string>
<string name="unpin_folder">Unpin folder</string> <string name="unpin_folder">Unpin folder</string>
<string name="pin_to_the_top">Pin to the top</string> <string name="pin_to_the_top">Pin to the top</string>
<string name="show_all">Vis indholdet af alle mappert</string> <string name="show_all">Vis indholdet af alle mapper</string>
<string name="all_folders">Alle mapper</string> <string name="all_folders">Alle mapper</string>
<string name="folder_view">Skift til mappevisning</string> <string name="folder_view">Skift til mappevisning</string>
<string name="other_folder">Anden mappe</string> <string name="other_folder">Anden mappe</string>
@ -102,7 +102,7 @@
<string name="random_order">Tilfældig rækkefølge</string> <string name="random_order">Tilfældig rækkefølge</string>
<string name="use_fade">Use fade animations</string> <string name="use_fade">Use fade animations</string>
<string name="move_backwards">Kør baglæns</string> <string name="move_backwards">Kør baglæns</string>
<string name="loop_slideshow">Loop slideshow</string> <string name="loop_slideshow">Endeløs kørsel</string>
<string name="slideshow_ended">Slideshowet endte</string> <string name="slideshow_ended">Slideshowet endte</string>
<string name="no_media_for_slideshow">Der blev ikke funket nogen mediefiler til slideshowet</string> <string name="no_media_for_slideshow">Der blev ikke funket nogen mediefiler til slideshowet</string>
@ -134,14 +134,14 @@
<string name="manage_extended_details">Manage extended details</string> <string name="manage_extended_details">Manage extended details</string>
<string name="one_finger_zoom">Tillad zoom med en finger når medier er i fuldskærm</string> <string name="one_finger_zoom">Tillad zoom med en finger når medier er i fuldskærm</string>
<string name="allow_instant_change">Tillad skift af medie ved klik på skærmens sider</string> <string name="allow_instant_change">Tillad skift af medie ved klik på skærmens sider</string>
<string name="replace_zoomable_images">RErstat stærkt zoombare billeder med nogle i bedre kvalitet</string> <string name="replace_zoomable_images">Erstat stærkt zoombare billeder med nogle i bedre kvalitet</string>
<string name="hide_extended_details">Skjul udvidede oplysninger når statuslinjen er skjult</string> <string name="hide_extended_details">Skjul udvidede oplysninger når statuslinjen er skjult</string>
<string name="do_extra_check">Tjek en ekstra gang for at undgå visning af ugyldige filer</string> <string name="do_extra_check">Tjek en ekstra gang for at undgå visning af ugyldige filer</string>
<!-- Setting sections --> <!-- Setting sections -->
<string name="thumbnails">Thumbnails</string> <string name="thumbnails">Thumbnails</string>
<string name="fullscreen_media">Fullscreen media</string> <string name="fullscreen_media">Fullscreen media</string>
<string name="extended_details">Extended details</string> <string name="extended_details">Flere oplysninger</string>
<!-- FAQ --> <!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string> <string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>