simplify the copydialog constructor

This commit is contained in:
tibbi 2016-11-08 22:00:42 +01:00
parent e87b6553a1
commit 3ce7d682b6
2 changed files with 3 additions and 2 deletions

View File

@ -368,7 +368,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment
itemsToCopy.add(new File(item.getPath())); itemsToCopy.add(new File(item.getPath()));
} }
new CopyDialog(getActivity(), itemsToCopy, mPath, this, new CopyDialog.OnCopyListener() { new CopyDialog(getActivity(), itemsToCopy, this, new CopyDialog.OnCopyListener() {
@Override @Override
public void onSuccess() { public void onSuccess() {
fillItems(); fillItems();

View File

@ -19,11 +19,12 @@ import com.simplemobiletools.filepicker.dialogs.FilePickerDialog
import kotlinx.android.synthetic.main.copy_item.view.* import kotlinx.android.synthetic.main.copy_item.view.*
import java.io.File import java.io.File
class CopyDialog(val activity: Activity, val files: List<File>, val path: String, val copyListener: CopyTask.CopyListener, val listener: OnCopyListener) { class CopyDialog(val activity: Activity, val files: List<File>, val copyListener: CopyTask.CopyListener, val listener: OnCopyListener) {
init { init {
val context = activity val context = activity
val view = LayoutInflater.from(context).inflate(R.layout.copy_item, null) val view = LayoutInflater.from(context).inflate(R.layout.copy_item, null)
val path = files[0].parent
view.source.text = "${path.trimEnd('/')}/" view.source.text = "${path.trimEnd('/')}/"
view.destination.setOnClickListener { view.destination.setOnClickListener {