allow copying items in folders that contain no media, fix #62

This commit is contained in:
tibbi 2016-12-06 16:18:50 +01:00
parent c26ef0e513
commit 105866987d
10 changed files with 26 additions and 1 deletions

View File

@ -1,12 +1,15 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.app.AlertDialog import android.app.AlertDialog
import android.os.Environment
import android.support.v7.widget.RecyclerView import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater import android.view.LayoutInflater
import com.simplemobiletools.filepicker.dialogs.FilePickerDialog
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.SimpleActivity
import com.simplemobiletools.gallery.adapters.DirectoryAdapter import com.simplemobiletools.gallery.adapters.DirectoryAdapter
import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask
import com.simplemobiletools.gallery.helpers.Config
import kotlinx.android.synthetic.main.dialog_album_picker.view.* import kotlinx.android.synthetic.main.dialog_album_picker.view.*
import java.util.* import java.util.*
@ -21,8 +24,8 @@ class PickAlbumDialog(val activity: SimpleActivity, val callback: (path: String)
dialog = AlertDialog.Builder(activity) dialog = AlertDialog.Builder(activity)
.setTitle(activity.resources.getString(R.string.select_destination)) .setTitle(activity.resources.getString(R.string.select_destination))
.setView(view) .setView(view)
.setNeutralButton(R.string.other_folder, { dialogInterface, i -> showOtherFolder() })
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create() .create()
dialog.setCanceledOnTouchOutside(true) dialog.setCanceledOnTouchOutside(true)
@ -35,4 +38,17 @@ class PickAlbumDialog(val activity: SimpleActivity, val callback: (path: String)
directoriesGrid.adapter = adapter directoriesGrid.adapter = adapter
}.execute() }.execute()
} }
fun showOtherFolder() {
val initialPath = Environment.getExternalStorageDirectory().toString()
val showHidden = Config.newInstance(activity).showHiddenFolders
FilePickerDialog(activity, initialPath, false, showHidden, object : FilePickerDialog.OnFilePickerListener {
override fun onSuccess(pickedPath: String) {
callback.invoke(pickedPath)
}
override fun onFail(error: FilePickerDialog.FilePickerResult) {
}
})
}
} }

View File

@ -32,6 +32,7 @@
<string name="source">Quelle</string> <string name="source">Quelle</string>
<string name="destination">Ziel</string> <string name="destination">Ziel</string>
<string name="select_destination">Ziel auswählen</string> <string name="select_destination">Ziel auswählen</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">Konnte nicht an ausgewähltes Ziel schreiben</string> <string name="invalid_destination">Konnte nicht an ausgewähltes Ziel schreiben</string>
<string name="please_select_destination">Bitte wähle ein Ziel</string> <string name="please_select_destination">Bitte wähle ein Ziel</string>
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>

View File

@ -32,6 +32,7 @@
<string name="source">Source</string> <string name="source">Source</string>
<string name="destination">Destination</string> <string name="destination">Destination</string>
<string name="select_destination">Select destination</string> <string name="select_destination">Select destination</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">Could not write to the selected destination</string> <string name="invalid_destination">Could not write to the selected destination</string>
<string name="please_select_destination">Please select a destination</string> <string name="please_select_destination">Please select a destination</string>
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>

View File

@ -32,6 +32,7 @@
<string name="source">Fonte</string> <string name="source">Fonte</string>
<string name="destination">Destinazione</string> <string name="destination">Destinazione</string>
<string name="select_destination">Seleziona destinazione</string> <string name="select_destination">Seleziona destinazione</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">Impossibile scrivere nella destinazione selezionata</string> <string name="invalid_destination">Impossibile scrivere nella destinazione selezionata</string>
<string name="please_select_destination">Seleziona una destinazione</string> <string name="please_select_destination">Seleziona una destinazione</string>
<string name="source_and_destination_same">Sorgente e destinazione non possono essere uguali</string> <string name="source_and_destination_same">Sorgente e destinazione non possono essere uguali</string>

View File

@ -32,6 +32,7 @@
<string name="source"></string> <string name="source"></string>
<string name="destination"></string> <string name="destination"></string>
<string name="select_destination">宛先を選択</string> <string name="select_destination">宛先を選択</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">選択した宛先に書き込みできませんでした</string> <string name="invalid_destination">選択した宛先に書き込みできませんでした</string>
<string name="please_select_destination">宛先を選択してください</string> <string name="please_select_destination">宛先を選択してください</string>
<string name="source_and_destination_same">元と先を同じにすることはできません</string> <string name="source_and_destination_same">元と先を同じにすることはできません</string>

View File

@ -32,6 +32,7 @@
<string name="source">Origem</string> <string name="source">Origem</string>
<string name="destination">Destino</string> <string name="destination">Destino</string>
<string name="select_destination">Selecione o destino</string> <string name="select_destination">Selecione o destino</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">Não foi possível escrever no destino selecionado</string> <string name="invalid_destination">Não foi possível escrever no destino selecionado</string>
<string name="please_select_destination">Por favor selecione um destino</string> <string name="please_select_destination">Por favor selecione um destino</string>
<string name="source_and_destination_same">A origem e o destino não podem ser iguais</string> <string name="source_and_destination_same">A origem e o destino não podem ser iguais</string>

View File

@ -33,6 +33,7 @@
<string name="source">Путь источника</string> <string name="source">Путь источника</string>
<string name="destination">Путь назначения</string> <string name="destination">Путь назначения</string>
<string name="select_destination">Выберите путь назначения</string> <string name="select_destination">Выберите путь назначения</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">Не удалось записать в выбранное место</string> <string name="invalid_destination">Не удалось записать в выбранное место</string>
<string name="please_select_destination">Пожалуйста, выберите путь назначения</string> <string name="please_select_destination">Пожалуйста, выберите путь назначения</string>
<string name="source_and_destination_same">Исходный и конечный пути не могут совпадать</string> <string name="source_and_destination_same">Исходный и конечный пути не могут совпадать</string>

View File

@ -32,6 +32,7 @@
<string name="source">Källa</string> <string name="source">Källa</string>
<string name="destination">Mål</string> <string name="destination">Mål</string>
<string name="select_destination">Välj mål</string> <string name="select_destination">Välj mål</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">Det gick inte att skriva till målet</string> <string name="invalid_destination">Det gick inte att skriva till målet</string>
<string name="please_select_destination">Please select a destination</string> <string name="please_select_destination">Please select a destination</string>
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>

View File

@ -33,6 +33,7 @@
<string name="source">原路径</string> <string name="source">原路径</string>
<string name="destination">目标</string> <string name="destination">目标</string>
<string name="select_destination">选择目标</string> <string name="select_destination">选择目标</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">不能写入选中目标</string> <string name="invalid_destination">不能写入选中目标</string>
<string name="please_select_destination">请选择先目标</string> <string name="please_select_destination">请选择先目标</string>
<string name="source_and_destination_same">原路径和目标不能相同</string> <string name="source_and_destination_same">原路径和目标不能相同</string>

View File

@ -32,6 +32,7 @@
<string name="source">Source</string> <string name="source">Source</string>
<string name="destination">Destination</string> <string name="destination">Destination</string>
<string name="select_destination">Select destination</string> <string name="select_destination">Select destination</string>
<string name="other_folder">Other folder</string>
<string name="invalid_destination">Could not write to the selected destination</string> <string name="invalid_destination">Could not write to the selected destination</string>
<string name="please_select_destination">Please select a destination</string> <string name="please_select_destination">Please select a destination</string>
<string name="source_and_destination_same">Source and destination cannot be the same</string> <string name="source_and_destination_same">Source and destination cannot be the same</string>