change copymovetask interface to inline
This commit is contained in:
parent
7c3ad32dee
commit
f548ed833a
4 changed files with 46 additions and 39 deletions
|
@ -51,8 +51,7 @@ import butterknife.ButterKnife;
|
|||
|
||||
public class MainActivity extends SimpleActivity
|
||||
implements AdapterView.OnItemClickListener, GridView.MultiChoiceModeListener, GridView.OnTouchListener,
|
||||
SwipeRefreshLayout.OnRefreshListener, ChangeSorting.ChangeDialogListener, GetDirectoriesAsynctask.GetDirectoriesListener,
|
||||
CopyMoveTask.CopyMoveListener {
|
||||
SwipeRefreshLayout.OnRefreshListener, ChangeSorting.ChangeDialogListener, GetDirectoriesAsynctask.GetDirectoriesListener {
|
||||
@BindView(R.id.directories_grid) GridView mGridView;
|
||||
@BindView(R.id.directories_holder) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
|
||||
|
@ -331,7 +330,19 @@ public class MainActivity extends SimpleActivity
|
|||
}
|
||||
}
|
||||
|
||||
new CopyDialog(this, files, this);
|
||||
new CopyDialog(this, files, new CopyMoveTask.CopyMoveListener() {
|
||||
@Override
|
||||
public void copySucceeded(boolean deleted) {
|
||||
if (deleted)
|
||||
getDirectories();
|
||||
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFailed() {
|
||||
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isPickImageIntent(Intent intent) {
|
||||
|
@ -584,15 +595,4 @@ public class MainActivity extends SimpleActivity
|
|||
mGridView.setOnTouchListener(this);
|
||||
mGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copySucceeded(boolean deleted) {
|
||||
getDirectories();
|
||||
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFailed() {
|
||||
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import butterknife.ButterKnife;
|
|||
|
||||
public class MediaActivity extends SimpleActivity
|
||||
implements AdapterView.OnItemClickListener, GridView.MultiChoiceModeListener, GridView.OnTouchListener,
|
||||
SwipeRefreshLayout.OnRefreshListener, ChangeSorting.ChangeDialogListener, CopyMoveTask.CopyMoveListener {
|
||||
SwipeRefreshLayout.OnRefreshListener, ChangeSorting.ChangeDialogListener {
|
||||
private static final String TAG = MediaActivity.class.getSimpleName();
|
||||
@BindView(R.id.media_grid) GridView mGridView;
|
||||
@BindView(R.id.media_holder) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||
|
@ -415,7 +415,19 @@ public class MediaActivity extends SimpleActivity
|
|||
}
|
||||
}
|
||||
|
||||
new CopyDialog(this, files, this);
|
||||
new CopyDialog(this, files, new CopyMoveTask.CopyMoveListener() {
|
||||
@Override
|
||||
public void copySucceeded(boolean deleted) {
|
||||
if (deleted)
|
||||
refreshDir();
|
||||
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFailed() {
|
||||
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -519,6 +531,10 @@ public class MediaActivity extends SimpleActivity
|
|||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshDir();
|
||||
}
|
||||
|
||||
private void refreshDir() {
|
||||
final File dir = new File(mPath);
|
||||
if (dir.isDirectory()) {
|
||||
Utils.Companion.scanPath(getApplicationContext(), mPath);
|
||||
|
@ -531,14 +547,4 @@ public class MediaActivity extends SimpleActivity
|
|||
public void sortingDialogClosed() {
|
||||
initializeGallery();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copySucceeded(boolean deleted) {
|
||||
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFailed() {
|
||||
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ import butterknife.OnClick;
|
|||
|
||||
public class ViewPagerActivity extends SimpleActivity
|
||||
implements ViewPager.OnPageChangeListener, View.OnSystemUiVisibilityChangeListener, ViewPager.OnTouchListener,
|
||||
ViewPagerFragment.FragmentClickListener, CopyMoveTask.CopyMoveListener {
|
||||
ViewPagerFragment.FragmentClickListener {
|
||||
@BindView(R.id.undo_delete) View mUndoBtn;
|
||||
@BindView(R.id.view_pager) MyViewPager mPager;
|
||||
|
||||
|
@ -190,7 +190,19 @@ public class ViewPagerActivity extends SimpleActivity
|
|||
final File file = getCurrentFile();
|
||||
final ArrayList<File> files = new ArrayList<>();
|
||||
files.add(file);
|
||||
new CopyDialog(this, files, this);
|
||||
new CopyDialog(this, files, new CopyMoveTask.CopyMoveListener() {
|
||||
@Override
|
||||
public void copySucceeded(boolean deleted) {
|
||||
if (deleted)
|
||||
reloadViewPager();
|
||||
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFailed() {
|
||||
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void openEditor() {
|
||||
|
@ -495,14 +507,4 @@ public class ViewPagerActivity extends SimpleActivity
|
|||
super.onPause();
|
||||
deleteFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copySucceeded(boolean deleted) {
|
||||
Utils.Companion.showToast(getApplicationContext(), deleted ? R.string.moving_success : R.string.copying_success);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFailed() {
|
||||
Utils.Companion.showToast(getApplicationContext(), R.string.copying_failed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,6 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val c
|
|||
}
|
||||
|
||||
context.scanFiles(updatedFiles) {}
|
||||
context.toast(R.string.moving_success)
|
||||
dismiss()
|
||||
copyMoveListener.copySucceeded(true)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue