get a list of parents at exclude folder dialog
This commit is contained in:
parent
4e97c9bfa4
commit
f480ae6e14
|
@ -194,10 +194,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
}
|
||||
|
||||
private fun tryExcludeFolder() {
|
||||
val pathSet = HashSet<String>(1)
|
||||
pathSet.add(mPath)
|
||||
|
||||
ExcludeFolderDialog(this, pathSet) {
|
||||
ExcludeFolderDialog(this, arrayListOf(mPath)) {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
}
|
||||
|
||||
private fun tryExcludeFolder() {
|
||||
ExcludeFolderDialog(activity, getSelectedPaths()) {
|
||||
ExcludeFolderDialog(activity, getSelectedPaths().toList()) {
|
||||
listener?.refreshItems()
|
||||
actMode?.finish()
|
||||
}
|
||||
|
|
|
@ -3,12 +3,13 @@ package com.simplemobiletools.gallery.dialogs
|
|||
import android.support.v7.app.AlertDialog
|
||||
import android.view.LayoutInflater
|
||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||
import com.simplemobiletools.commons.extensions.getBasePath
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.activities.SimpleActivity
|
||||
import kotlinx.android.synthetic.main.dialog_exclude_folder.view.*
|
||||
|
||||
class ExcludeFolderDialog(val activity: SimpleActivity, val selectedPaths: HashSet<String>, val callback: () -> Unit) {
|
||||
class ExcludeFolderDialog(val activity: SimpleActivity, val selectedPaths: List<String>, val callback: () -> Unit) {
|
||||
var dialog: AlertDialog? = null
|
||||
|
||||
init {
|
||||
|
@ -30,11 +31,24 @@ class ExcludeFolderDialog(val activity: SimpleActivity, val selectedPaths: HashS
|
|||
|
||||
}
|
||||
|
||||
private fun getAlternativePaths(): ArrayList<String> {
|
||||
val parentsList = ArrayList<String>()
|
||||
private fun getAlternativePaths(): List<String> {
|
||||
val pathsList = ArrayList<String>()
|
||||
if (selectedPaths.size > 1)
|
||||
return parentsList
|
||||
return pathsList
|
||||
|
||||
return parentsList
|
||||
val path = selectedPaths[0]
|
||||
var basePath = path.getBasePath(activity)
|
||||
val relativePath = path.substring(basePath.length)
|
||||
val parts = relativePath.split("/").filter(String::isNotEmpty)
|
||||
if (parts.isEmpty())
|
||||
return pathsList
|
||||
|
||||
pathsList.add(basePath)
|
||||
for (part in parts) {
|
||||
basePath += "/$part"
|
||||
pathsList.add(basePath)
|
||||
}
|
||||
|
||||
return pathsList.reversed()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
android:id="@+id/exclude_folder_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/exclude_folder_parent"/>
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:text="@string/exclude_folder_parent"
|
||||
android:textSize="@dimen/normal_text_size"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/exclude_folder_radio_group"
|
||||
|
|
Loading…
Reference in New Issue