mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
do not show locked folders thumbnails, just a placeholder
This commit is contained in:
parent
8497e2fdec
commit
820fa8883d
5 changed files with 43 additions and 2 deletions
|
@ -61,7 +61,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.14.7'
|
||||
implementation 'com.simplemobiletools:commons:5.14.8'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
|
|
|
@ -30,7 +30,14 @@ import com.simplemobiletools.gallery.pro.helpers.*
|
|||
import com.simplemobiletools.gallery.pro.interfaces.DirectoryOperationsListener
|
||||
import com.simplemobiletools.gallery.pro.models.AlbumCover
|
||||
import com.simplemobiletools.gallery.pro.models.Directory
|
||||
import kotlinx.android.synthetic.main.directory_item_grid.view.*
|
||||
import kotlinx.android.synthetic.main.directory_item_list.view.*
|
||||
import kotlinx.android.synthetic.main.directory_item_list.view.dir_check
|
||||
import kotlinx.android.synthetic.main.directory_item_list.view.dir_location
|
||||
import kotlinx.android.synthetic.main.directory_item_list.view.dir_name
|
||||
import kotlinx.android.synthetic.main.directory_item_list.view.dir_pin
|
||||
import kotlinx.android.synthetic.main.directory_item_list.view.dir_thumbnail
|
||||
import kotlinx.android.synthetic.main.directory_item_list.view.photo_cnt
|
||||
import java.io.File
|
||||
|
||||
class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView,
|
||||
|
@ -46,9 +53,11 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
private var cropThumbnails = config.cropThumbnails
|
||||
private var groupDirectSubfolders = config.groupDirectSubfolders
|
||||
private var currentDirectoriesHash = dirs.hashCode()
|
||||
private var lockedFolderPaths = ArrayList<String>()
|
||||
|
||||
init {
|
||||
setupDragListener(true)
|
||||
fillLockedFolders()
|
||||
}
|
||||
|
||||
override fun getActionMenuId() = R.menu.cab_directories
|
||||
|
@ -328,6 +337,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
if (success) {
|
||||
getSelectedPaths().filter { !config.isFolderProtected(it) }.forEach {
|
||||
config.addFolderProtection(it, hash, type)
|
||||
lockedFolderPaths.add(it)
|
||||
}
|
||||
|
||||
listener?.refreshItems()
|
||||
|
@ -345,6 +355,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
if (success) {
|
||||
paths.filter { config.isFolderProtected(it) && config.getFolderProtectionType(it) == tabToShow && config.getFolderProtectionHash(it) == hashToCheck }.forEach {
|
||||
config.removeFolderProtection(it)
|
||||
lockedFolderPaths.remove(it)
|
||||
}
|
||||
|
||||
listener?.refreshItems()
|
||||
|
@ -538,11 +549,19 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
|
||||
private fun getItemWithKey(key: Int): Directory? = dirs.firstOrNull { it.path.hashCode() == key }
|
||||
|
||||
private fun fillLockedFolders() {
|
||||
lockedFolderPaths.clear()
|
||||
dirs.map { it.path }.filter { config.isFolderProtected(it) }.forEach {
|
||||
lockedFolderPaths.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateDirs(newDirs: ArrayList<Directory>) {
|
||||
val directories = newDirs.clone() as ArrayList<Directory>
|
||||
if (directories.hashCode() != currentDirectoriesHash) {
|
||||
currentDirectoriesHash = directories.hashCode()
|
||||
dirs = directories
|
||||
fillLockedFolders()
|
||||
notifyDataSetChanged()
|
||||
finishActMode()
|
||||
}
|
||||
|
@ -582,7 +601,13 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
dir_check.background?.applyColorFilter(primaryColor)
|
||||
}
|
||||
|
||||
if (lockedFolderPaths.contains(directory.path)) {
|
||||
dir_lock.beVisible()
|
||||
} else {
|
||||
dir_lock.beGone()
|
||||
activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails)
|
||||
}
|
||||
|
||||
dir_pin.beVisibleIf(pinnedFolders.contains(directory.path))
|
||||
dir_location.beVisibleIf(directory.location != LOCATION_INTERNAL)
|
||||
if (dir_location.isVisible()) {
|
||||
|
|
|
@ -13,6 +13,20 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dir_lock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignStart="@+id/dir_thumbnail"
|
||||
android:layout_alignTop="@+id/dir_thumbnail"
|
||||
android:layout_alignEnd="@+id/dir_thumbnail"
|
||||
android:layout_alignBottom="@+id/dir_thumbnail"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@color/default_background_color"
|
||||
android:padding="@dimen/lock_padding"
|
||||
android:src="@drawable/ic_lock_huge"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dir_check"
|
||||
android:layout_width="@dimen/selection_check_size"
|
||||
|
|
|
@ -6,4 +6,5 @@
|
|||
<dimen name="selection_check_size">38dp</dimen>
|
||||
<dimen name="tmb_shadow_height">70dp</dimen>
|
||||
<dimen name="instant_change_bar_width">100dp</dimen>
|
||||
<dimen name="lock_padding">80dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -22,4 +22,5 @@
|
|||
<dimen name="default_status_action_height">86dp</dimen>
|
||||
<dimen name="widget_initial_size">110dp</dimen>
|
||||
<dimen name="full_brush_size">40dp</dimen>
|
||||
<dimen name="lock_padding">40dp</dimen>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue