show hidden items at SelectFolderDialog when selected so

This commit is contained in:
tibbi 2016-10-11 22:04:40 +02:00
parent 4785692dd7
commit 6d230260d8
2 changed files with 6 additions and 4 deletions

View file

@ -548,7 +548,8 @@ public class ItemsFragment extends android.support.v4.app.Fragment
private View.OnClickListener destinationPicker = new View.OnClickListener() { private View.OnClickListener destinationPicker = new View.OnClickListener() {
@Override @Override
public void onClick(final View view) { public void onClick(final View view) {
SelectFolderDialog dialog = SelectFolderDialog.Companion.newInstance(mCopyDestinationPath); final boolean showHiddenItems = Config.newInstance(getContext()).getShowHidden();
SelectFolderDialog dialog = SelectFolderDialog.Companion.newInstance(mCopyDestinationPath, showHiddenItems);
dialog.setTargetFragment(ItemsFragment.this, SELECT_FOLDER_REQUEST); dialog.setTargetFragment(ItemsFragment.this, SELECT_FOLDER_REQUEST);
dialog.show(getFragmentManager(), "selectFolder"); dialog.show(getFragmentManager(), "selectFolder");
} }

View file

@ -24,10 +24,12 @@ class SelectFolderDialog : DialogFragment(), Breadcrumbs.BreadcrumbsListener {
companion object { companion object {
lateinit var mPath: String lateinit var mPath: String
var mFirstUpdate: Boolean = true var mFirstUpdate: Boolean = true
var mShowHidden: Boolean = false
fun newInstance(path: String): SelectFolderDialog { fun newInstance(path: String, showHidden: Boolean): SelectFolderDialog {
mPath = path mPath = path
mFirstUpdate = true mFirstUpdate = true
mShowHidden = showHidden
return SelectFolderDialog() return SelectFolderDialog()
} }
} }
@ -83,7 +85,6 @@ class SelectFolderDialog : DialogFragment(), Breadcrumbs.BreadcrumbsListener {
} }
private fun getItems(path: String): List<FileDirItem> { private fun getItems(path: String): List<FileDirItem> {
val showHidden = false//Config.newInstance(context).showHidden
val items = ArrayList<FileDirItem>() val items = ArrayList<FileDirItem>()
val base = File(path) val base = File(path)
val files = base.listFiles() val files = base.listFiles()
@ -92,7 +93,7 @@ class SelectFolderDialog : DialogFragment(), Breadcrumbs.BreadcrumbsListener {
if (!file.isDirectory) if (!file.isDirectory)
continue continue
if (!showHidden && file.isHidden) if (!mShowHidden && file.isHidden)
continue continue
val curPath = file.absolutePath val curPath = file.absolutePath