check write permissions before starting the deletion

This commit is contained in:
tibbi 2016-11-06 20:49:47 +01:00
parent 6c9c072dc9
commit 0ade1ec579
3 changed files with 12 additions and 1 deletions

View File

@ -196,6 +196,12 @@ public class MainActivity extends SimpleActivity
}
}
for (String path : mToBeDeleted) {
if (Utils.Companion.isShowingWritePermissions(this, new File(path))) {
return;
}
}
notifyDeletion(deletedCnt);
}

View File

@ -293,6 +293,9 @@ public class MediaActivity extends SimpleActivity
}
private void prepareForDeleting() {
if (Utils.Companion.isShowingWritePermissions(this, new File(mPath)))
return;
Utils.Companion.showToast(this, R.string.deleting);
final SparseBooleanArray items = mGridView.getCheckedItemPositions();
final int cnt = items.size();

View File

@ -242,8 +242,10 @@ public class ViewPagerActivity extends SimpleActivity
}
private void notifyDeletion() {
mToBeDeleted = getCurrentFile().getAbsolutePath();
if (Utils.Companion.isShowingWritePermissions(this, new File(mPath)))
return;
mToBeDeleted = getCurrentFile().getAbsolutePath();
if (mMedia.size() <= 1) {
deleteFile();
} else {