move DirectoryOperations and MediaOperations listeners in standalone files
This commit is contained in:
parent
2f152da15a
commit
7235aa8ac8
6 changed files with 32 additions and 21 deletions
|
@ -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
|
||||
|
|
|
@ -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 = ""
|
||||
|
|
|
@ -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<Directory>, val listener: DirOperationsListener?, recyclerView: MyRecyclerView,
|
||||
class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, 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<Directo
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface DirOperationsListener {
|
||||
fun refreshItems()
|
||||
|
||||
fun deleteFolders(folders: ArrayList<File>)
|
||||
|
||||
fun recheckPinnedFolders()
|
||||
|
||||
fun updateDirectories(directories: ArrayList<Directory>)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Thumbnai
|
|||
thumbnail_section.setTextColor(textColor)
|
||||
}
|
||||
}
|
||||
|
||||
interface MediaOperationsListener {
|
||||
fun refreshItems()
|
||||
|
||||
fun tryDeleteFiles(fileDirItems: ArrayList<FileDirItem>)
|
||||
|
||||
fun selectedPaths(paths: ArrayList<String>)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<File>)
|
||||
|
||||
fun recheckPinnedFolders()
|
||||
|
||||
fun updateDirectories(directories: ArrayList<Directory>)
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.simplemobiletools.gallery.interfaces
|
||||
|
||||
import com.simplemobiletools.commons.models.FileDirItem
|
||||
|
||||
interface MediaOperationsListener {
|
||||
fun refreshItems()
|
||||
|
||||
fun tryDeleteFiles(fileDirItems: ArrayList<FileDirItem>)
|
||||
|
||||
fun selectedPaths(paths: ArrayList<String>)
|
||||
}
|
Loading…
Reference in a new issue