Skip to content

Commit d0c011a

Browse files
committed
#155: Gallery refresh query after detail-change or delete
1 parent ca57d2d commit d0c011a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

Diff for: app/src/main/java/de/k3b/android/androFotoFinder/gallery/cursor/GalleryCursorFragment.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public void onResume() {
438438
// workaround fragment lifecycle is newFragment.attach oldFragment.detach.
439439
// this makes shure that the visible fragment has commands
440440
MoveOrCopyDestDirPicker.sFileCommands = mFileCommands;
441-
441+
requeryIfDataHasChanged();
442442
}
443443

444444
/**
@@ -835,7 +835,7 @@ public boolean onOptionsItemSelected(MenuItem menuItem) {
835835
AndroidFileCommands fileCommands = mFileCommands;
836836

837837
final SelectedFiles selectedFiles = this.mAdapter.createSelectedFiles(getActivity(), this.mSelectedItems);
838-
if ((mSelectedItems != null) && (fileCommands.onOptionsItemSelected(menuItem, selectedFiles))) {
838+
if ((mSelectedItems != null) && (fileCommands.onOptionsItemSelected(menuItem, selectedFiles, this))) {
839839
return true;
840840
}
841841
switch (menuItem.getItemId()) {

Diff for: app/src/main/java/de/k3b/android/androFotoFinder/imagedetail/ImageDetailActivityViewPager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public boolean onOptionsItemSelected(MenuItem menuItem) {
207207
this.invalidateOptionsMenu();
208208
return true;
209209
}
210-
if (mFileCommands.onOptionsItemSelected(menuItem, getCurrentFoto())) {
210+
if (mFileCommands.onOptionsItemSelected(menuItem, getCurrentFoto(), this)) {
211211
mModifyCount++;
212212
} else {
213213
// Handle presses on the action bar items

Diff for: app/src/main/java/de/k3b/android/util/AndroidFileCommands.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ private static int getResourceId(int opCode) {
173173

174174
}
175175

176-
public boolean onOptionsItemSelected(final MenuItem item, final SelectedFiles selectedFileNames) {
176+
public boolean onOptionsItemSelected(final MenuItem item, final SelectedFiles selectedFileNames, DataChangeNotifyer.DataChangedListener dataChangedListener) {
177177
if ((selectedFileNames != null) && (selectedFileNames.size() > 0)) {
178178
// Handle item selection
179179
switch (item.getItemId()) {
180180
case R.id.cmd_delete:
181-
return cmdDeleteFileWithQuestion(selectedFileNames);
181+
return cmdDeleteFileWithQuestion(selectedFileNames, dataChangedListener);
182182
default:break;
183183
}
184184
}
@@ -276,7 +276,8 @@ private void setLastCopyToPath(String copyToPath) {
276276
edit.apply();
277277
}
278278

279-
public boolean cmdDeleteFileWithQuestion(final SelectedFiles fotos) {
279+
public boolean cmdDeleteFileWithQuestion(final SelectedFiles fotos,
280+
final DataChangeNotifyer.DataChangedListener dataChangedListener) {
280281
String[] pathNames = fotos.getFileNames();
281282
String errorMessage = checkWriteProtected(R.string.delete_menu_title, SelectedFiles.getFiles(pathNames));
282283

@@ -307,6 +308,9 @@ public void onClick(
307308
final int id) {
308309
mActiveAlert = null;
309310
deleteFiles(fotos, null);
311+
if (dataChangedListener != null) {
312+
dataChangedListener.onNotifyDataChanged();
313+
}
310314
}
311315
}
312316
)

0 commit comments

Comments
 (0)