mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
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
|
public class MainActivity extends SimpleActivity
|
||||||
implements AdapterView.OnItemClickListener, GridView.MultiChoiceModeListener, GridView.OnTouchListener,
|
implements AdapterView.OnItemClickListener, GridView.MultiChoiceModeListener, GridView.OnTouchListener,
|
||||||
SwipeRefreshLayout.OnRefreshListener, ChangeSorting.ChangeDialogListener, GetDirectoriesAsynctask.GetDirectoriesListener,
|
SwipeRefreshLayout.OnRefreshListener, ChangeSorting.ChangeDialogListener, GetDirectoriesAsynctask.GetDirectoriesListener {
|
||||||
CopyMoveTask.CopyMoveListener {
|
|
||||||
@BindView(R.id.directories_grid) GridView mGridView;
|
@BindView(R.id.directories_grid) GridView mGridView;
|
||||||
@BindView(R.id.directories_holder) SwipeRefreshLayout mSwipeRefreshLayout;
|
@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) {
|
private boolean isPickImageIntent(Intent intent) {
|
||||||
|
@ -584,15 +595,4 @@ public class MainActivity extends SimpleActivity
|
||||||
mGridView.setOnTouchListener(this);
|
mGridView.setOnTouchListener(this);
|
||||||
mGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
|
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
|
public class MediaActivity extends SimpleActivity
|
||||||
implements AdapterView.OnItemClickListener, GridView.MultiChoiceModeListener, GridView.OnTouchListener,
|
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();
|
private static final String TAG = MediaActivity.class.getSimpleName();
|
||||||
@BindView(R.id.media_grid) GridView mGridView;
|
@BindView(R.id.media_grid) GridView mGridView;
|
||||||
@BindView(R.id.media_holder) SwipeRefreshLayout mSwipeRefreshLayout;
|
@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
|
@Override
|
||||||
|
@ -519,6 +531,10 @@ public class MediaActivity extends SimpleActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
|
refreshDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshDir() {
|
||||||
final File dir = new File(mPath);
|
final File dir = new File(mPath);
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
Utils.Companion.scanPath(getApplicationContext(), mPath);
|
Utils.Companion.scanPath(getApplicationContext(), mPath);
|
||||||
|
@ -531,14 +547,4 @@ public class MediaActivity extends SimpleActivity
|
||||||
public void sortingDialogClosed() {
|
public void sortingDialogClosed() {
|
||||||
initializeGallery();
|
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
|
public class ViewPagerActivity extends SimpleActivity
|
||||||
implements ViewPager.OnPageChangeListener, View.OnSystemUiVisibilityChangeListener, ViewPager.OnTouchListener,
|
implements ViewPager.OnPageChangeListener, View.OnSystemUiVisibilityChangeListener, ViewPager.OnTouchListener,
|
||||||
ViewPagerFragment.FragmentClickListener, CopyMoveTask.CopyMoveListener {
|
ViewPagerFragment.FragmentClickListener {
|
||||||
@BindView(R.id.undo_delete) View mUndoBtn;
|
@BindView(R.id.undo_delete) View mUndoBtn;
|
||||||
@BindView(R.id.view_pager) MyViewPager mPager;
|
@BindView(R.id.view_pager) MyViewPager mPager;
|
||||||
|
|
||||||
|
@ -190,7 +190,19 @@ public class ViewPagerActivity extends SimpleActivity
|
||||||
final File file = getCurrentFile();
|
final File file = getCurrentFile();
|
||||||
final ArrayList<File> files = new ArrayList<>();
|
final ArrayList<File> files = new ArrayList<>();
|
||||||
files.add(file);
|
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() {
|
private void openEditor() {
|
||||||
|
@ -495,14 +507,4 @@ public class ViewPagerActivity extends SimpleActivity
|
||||||
super.onPause();
|
super.onPause();
|
||||||
deleteFile();
|
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.scanFiles(updatedFiles) {}
|
||||||
context.toast(R.string.moving_success)
|
|
||||||
dismiss()
|
dismiss()
|
||||||
copyMoveListener.copySucceeded(true)
|
copyMoveListener.copySucceeded(true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue