Skip to content

Commit 75d127a

Browse files
committed
add confirmation dialog for sync all
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 3973176 commit 75d127a

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2233,14 +2233,44 @@ private boolean isSearchEventSet(SearchEvent event) {
22332233

22342234
private void syncFolderIncludingAllNestedFiles(OCFile folder) {
22352235
if (FileStorageUtils.checkIfEnoughSpace(folder)) {
2236-
mContainerActivity.getFileOperationsHelper().syncFolderIncludingNestedFiles(folder);
2236+
informUserForSyncAllAction(folder);
22372237
} else {
22382238
SyncFileNotEnoughSpaceDialogFragment
22392239
.newInstance(folder, FileOperationsHelper.getAvailableSpaceOnDevice())
22402240
.show(getParentFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
22412241
}
22422242
}
22432243

2244+
private void informUserForSyncAllAction(OCFile folder) {
2245+
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(
2246+
R.string.sync_all_action_dialog_description,
2247+
null,
2248+
R.string.sync_all_action_dialog_title,
2249+
R.drawable.ic_sync_all,
2250+
R.string.common_ok,
2251+
R.string.common_cancel,
2252+
-1);
2253+
2254+
dialog.setCancelable(false);
2255+
2256+
dialog.setOnConfirmationListener(new ConfirmationDialogFragment.ConfirmationDialogFragmentListener() {
2257+
@Override
2258+
public void onConfirmation(String callerTag) {
2259+
mContainerActivity.getFileOperationsHelper().syncFolderIncludingNestedFiles(folder);
2260+
}
2261+
2262+
@Override
2263+
public void onNeutral(String callerTag) {
2264+
}
2265+
2266+
@Override
2267+
public void onCancel(String callerTag) {
2268+
}
2269+
});
2270+
2271+
dialog.show(getParentFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
2272+
}
2273+
22442274
private void syncAndCheckFiles(Collection<OCFile> files) {
22452275
if (files.isEmpty()) return;
22462276

app/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@
329329
<string name="common_choose_account">Choose account</string>
330330
<string name="common_switch_account">Switch account</string>
331331
<string name="common_switch_to_account">Switch to account</string>
332+
<string name="sync_all_action_dialog_title">Download entire folder?</string>
333+
<string name="sync_all_action_dialog_description">
334+
All files and subfolders will be downloaded to your device. This may use significant storage space and take some time depending on your connection.
335+
</string>
332336
<string name="sync_fail_ticker">Sync failed</string>
333337
<string name="sync_fail_ticker_unauthorized">Sync failed, log in again</string>
334338
<string name="sync_fail_content">Could not sync %1$s</string>

0 commit comments

Comments
 (0)