diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 68cb4710e..0ed9b044e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -32,6 +32,7 @@ import com.simplemobiletools.gallery.dialogs.FilterMediaDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.interfaces.DirectoryDao +import com.simplemobiletools.gallery.interfaces.DirectoryOperationsListener import com.simplemobiletools.gallery.models.AlbumCover import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium @@ -39,7 +40,7 @@ import kotlinx.android.synthetic.main.activity_main.* import java.io.* import java.util.* -class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { +class MainActivity : SimpleActivity(), DirectoryOperationsListener { private val PICK_MEDIA = 2 private val PICK_WALLPAPER = 3 private val LAST_MEDIA_CHECK_PERIOD = 3000L diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 847db89c2..fbcca3d2d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -39,6 +39,7 @@ import com.simplemobiletools.gallery.dialogs.ExcludeFolderDialog import com.simplemobiletools.gallery.dialogs.FilterMediaDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.* +import com.simplemobiletools.gallery.interfaces.MediaOperationsListener import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.models.ThumbnailItem import com.simplemobiletools.gallery.models.ThumbnailSection @@ -47,7 +48,7 @@ import java.io.File import java.io.IOException import java.util.* -class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { +class MediaActivity : SimpleActivity(), MediaOperationsListener { private val LAST_MEDIA_CHECK_PERIOD = 3000L private var mPath = "" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index d1f50a9a8..da089d244 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -21,6 +21,7 @@ import com.simplemobiletools.gallery.dialogs.ExcludeFolderDialog import com.simplemobiletools.gallery.dialogs.PickMediumDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.* +import com.simplemobiletools.gallery.interfaces.DirectoryOperationsListener import com.simplemobiletools.gallery.models.AlbumCover import com.simplemobiletools.gallery.models.Directory import kotlinx.android.synthetic.main.directory_item_list.view.* @@ -28,7 +29,7 @@ import java.io.File import java.util.* import kotlin.collections.ArrayList -class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList, val listener: DirOperationsListener?, recyclerView: MyRecyclerView, +class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView, val isPickIntent: Boolean, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { @@ -494,14 +495,4 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList) - - fun recheckPinnedFolders() - - fun updateDirectories(directories: ArrayList) - } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 860316b9b..e087907f1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -19,6 +19,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.dialogs.DeleteWithRememberDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.VIEW_TYPE_LIST +import com.simplemobiletools.gallery.interfaces.MediaOperationsListener import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.models.ThumbnailItem import com.simplemobiletools.gallery.models.ThumbnailSection @@ -415,12 +416,4 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList) - - fun selectedPaths(paths: ArrayList) - } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/DirectoryOperationsListener.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/DirectoryOperationsListener.kt new file mode 100644 index 000000000..760ed78f4 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/DirectoryOperationsListener.kt @@ -0,0 +1,14 @@ +package com.simplemobiletools.gallery.interfaces + +import com.simplemobiletools.gallery.models.Directory +import java.io.File + +interface DirectoryOperationsListener { + fun refreshItems() + + fun deleteFolders(folders: ArrayList) + + fun recheckPinnedFolders() + + fun updateDirectories(directories: ArrayList) +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/MediaOperationsListener.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/MediaOperationsListener.kt new file mode 100644 index 000000000..77e877fd8 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/interfaces/MediaOperationsListener.kt @@ -0,0 +1,11 @@ +package com.simplemobiletools.gallery.interfaces + +import com.simplemobiletools.commons.models.FileDirItem + +interface MediaOperationsListener { + fun refreshItems() + + fun tryDeleteFiles(fileDirItems: ArrayList) + + fun selectedPaths(paths: ArrayList) +}