create the copy dialog at viewpageractivity

This commit is contained in:
tibbi 2016-11-08 23:00:09 +01:00
parent c6598528fd
commit 9b809790f9
2 changed files with 31 additions and 3 deletions

View File

@ -23,6 +23,8 @@ import com.simplemobiletools.gallery.MyViewPager;
import com.simplemobiletools.gallery.R;
import com.simplemobiletools.gallery.Utils;
import com.simplemobiletools.gallery.adapters.MyPagerAdapter;
import com.simplemobiletools.gallery.asynctasks.CopyTask;
import com.simplemobiletools.gallery.dialogs.CopyDialog;
import com.simplemobiletools.gallery.dialogs.RenameFileDialog;
import com.simplemobiletools.gallery.fragments.ViewPagerFragment;
import com.simplemobiletools.gallery.models.Medium;
@ -41,7 +43,7 @@ import butterknife.OnClick;
public class ViewPagerActivity extends SimpleActivity
implements ViewPager.OnPageChangeListener, View.OnSystemUiVisibilityChangeListener, ViewPager.OnTouchListener,
ViewPagerFragment.FragmentClickListener {
ViewPagerFragment.FragmentClickListener, CopyTask.CopyListener {
@BindView(R.id.undo_delete) View mUndoBtn;
@BindView(R.id.view_pager) MyViewPager mPager;
@ -185,7 +187,16 @@ public class ViewPagerActivity extends SimpleActivity
}
private void displayCopyDialog() {
final File file = getCurrentFile();
final List<File> files = new ArrayList<>();
files.add(file);
new CopyDialog(this, files, this, new CopyDialog.OnCopyListener() {
@Override
public void onSuccess() {
}
});
}
private void openEditor() {
@ -491,4 +502,14 @@ public class ViewPagerActivity extends SimpleActivity
super.onPause();
deleteFile();
}
@Override
public void copySucceeded(@NotNull File destinationDir) {
}
@Override
public void copyFailed() {
}
}

View File

@ -5,6 +5,8 @@ import android.support.v4.util.Pair
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.WindowManager
import com.simplemobiletools.filepicker.extensions.getBasePath
import com.simplemobiletools.filepicker.extensions.getHumanReadablePath
import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.Utils
import com.simplemobiletools.gallery.asynctasks.CopyTask
@ -15,12 +17,17 @@ import kotlinx.android.synthetic.main.copy_item.view.*
import java.io.File
import java.util.*
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 {
val context = activity
val view = LayoutInflater.from(context).inflate(R.layout.copy_item, null)
view.source.text = "${path.trimEnd('/')}/"
val path = files[0].parent.trimEnd('/')
val basePath = path.getBasePath(context)
val humanPath = path.replaceFirst(basePath, activity.getHumanReadablePath(basePath))
view.source.text = humanPath
view.destination.setOnClickListener {