mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
Add actions
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
5f99e4379d
commit
f4ffe4fdae
3 changed files with 32 additions and 19 deletions
|
@ -70,7 +70,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|||
* Activity listing pending, active, and completed uploads. User can delete completed uploads from view. Content of this
|
||||
* list of coming from {@link UploadsStorageManager}.
|
||||
*/
|
||||
public class UploadListActivity extends FileActivity implements TwoActionDialogFragment.TwoActionDialogActionListener {
|
||||
public class UploadListActivity extends FileActivity {
|
||||
|
||||
private static final String TAG = UploadListActivity.class.getSimpleName();
|
||||
public static final String HANDLE_FILE_EXISTENCE_RECEIVER = "HANDLE_FILE_EXISTENCE_RECEIVER";
|
||||
|
@ -161,24 +161,27 @@ public class UploadListActivity extends FileActivity implements TwoActionDialogF
|
|||
};
|
||||
|
||||
private void showHandleFileExistenceDialog() {
|
||||
TwoActionDialogFragment dialog = TwoActionDialogFragment.Companion.newInstance(R.string.uploader_handle_not_existed_file_dialog_title,
|
||||
R.string.uploader_handle_not_existed_file_dialog_message,
|
||||
R.string.common_cancel,
|
||||
R.string.common_ok,
|
||||
this);
|
||||
TwoActionDialogFragment dialog = TwoActionDialogFragment
|
||||
.Companion
|
||||
.newInstance(R.string.uploader_handle_not_existed_file_dialog_title,
|
||||
R.string.uploader_handle_not_existed_file_dialog_message,
|
||||
R.string.uploader_handle_not_existed_file_dialog_negative_button_text,
|
||||
R.string.common_ok,
|
||||
new TwoActionDialogFragment.TwoActionDialogActionListener() {
|
||||
@Override
|
||||
public void positiveAction() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void negativeAction() {
|
||||
OCFile fileOnlyExistOnLocalStorage = uploadListAdapter.getSelectedOCFile();
|
||||
uploadListAdapter.removeUpload(uploadListAdapter.selectedOCUpload);
|
||||
}
|
||||
});
|
||||
dialog.show(this.getSupportFragmentManager(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void positiveAction() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void negativeAction() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(handleFileExistenceReceiver);
|
||||
|
@ -240,8 +243,7 @@ public class UploadListActivity extends FileActivity implements TwoActionDialogF
|
|||
uploadsStorageManager,
|
||||
connectivityService,
|
||||
userAccountManager,
|
||||
powerManagementService
|
||||
)).start();
|
||||
powerManagementService)).start();
|
||||
|
||||
// update UI
|
||||
uploadListAdapter.loadUploadItemsFromDb();
|
||||
|
|
|
@ -502,6 +502,7 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
|||
ItemViewHolder itemViewHolder,
|
||||
OCUpload item,
|
||||
String status) {
|
||||
selectedFileRemotePath = item.getRemotePath();
|
||||
String remotePath = item.getRemotePath();
|
||||
OCFile localFile = storageManager.getFileByEncryptedRemotePath(remotePath);
|
||||
|
||||
|
@ -526,7 +527,10 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
|||
return false;
|
||||
}
|
||||
|
||||
public OCUpload selectedOCUpload;
|
||||
|
||||
private void refreshFolderAndUpdateUI(ItemViewHolder holder, User user, OCFile folder, String remotePath, OCUpload item, String status) {
|
||||
selectedOCUpload = item;
|
||||
Context context = MainApp.getAppContext();
|
||||
|
||||
this.refreshFolder(context, holder, user, folder, (caller, result) -> {
|
||||
|
@ -570,7 +574,13 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
|||
popup.show();
|
||||
}
|
||||
|
||||
private void removeUpload(OCUpload item) {
|
||||
private String selectedFileRemotePath;
|
||||
|
||||
public OCFile getSelectedOCFile() {
|
||||
return storageManager.getFileByEncryptedRemotePath(selectedFileRemotePath);
|
||||
}
|
||||
|
||||
public void removeUpload(OCUpload item) {
|
||||
uploadsStorageManager.removeUpload(item);
|
||||
loadUploadItemsFromDb();
|
||||
}
|
||||
|
|
|
@ -913,6 +913,7 @@
|
|||
<string name="create_rich_workspace">Add folder info</string>
|
||||
<string name="creates_rich_workspace">creates folder info</string>
|
||||
<string name="uploader_handle_not_existed_file_dialog_title">File Not Found</string>
|
||||
<string name="uploader_handle_not_existed_file_dialog_negative_button_text">Delete Local File</string>
|
||||
<string name="uploader_handle_not_existed_file_dialog_message">This file does not longer exist in server still want to upload?</string>
|
||||
<string name="uploader_file_not_found_on_server_message">We couldnt locate the file on server. Another user may have deleted the file</string>
|
||||
<string name="uploader_file_not_found_message">File not found. Are you sure this file exist or conflict not solved before?</string>
|
||||
|
|
Loading…
Reference in a new issue