- */
-
- public void shareFileWithLink(OCFile file) {
- if (isSharedSupported()) {
- if (file != null) {
-
- // Create the Share - TODO integrate before or after the chooser menu
- //CreateShareOperation createShare = new CreateShareOperation(file.getRemotePath(), ShareType.PUBLIC_LINK, "", false, "", 1);
- //createShare.execute(getStorageManager(), this, this, mHandler, this);
-
- // TODO Get the link --> when the operation is finished
- String link = "https://fake.url.lolo";
-
- Intent intent = createShareWithLinkIntent(link);
- String[] packagesToExclude = new String[] { getPackageName() };
- DialogFragment chooserDialog = ActivityChooserDialog.newInstance(intent, packagesToExclude);
- chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
-
+
+
+ private void doOnResumeAndBound() {
+ mOperationsServiceBinder.addOperationListener(FileActivity.this, mHandler);
+ long waitingForOpId = mFileOperationsHelper.getOpIdWaitingFor();
+ if (waitingForOpId <= Integer.MAX_VALUE) {
+ boolean wait = mOperationsServiceBinder.dispatchResultIfFinished((int)waitingForOpId, this);
+ if (!wait ) {
+ dismissLoadingDialog();
+ }
+ }
+ }
+
+
+ /**
+ * Implements callback methods for service binding. Passed as a parameter to {
+ */
+ private class OperationsServiceConnection implements ServiceConnection {
+
+ @Override
+ public void onServiceConnected(ComponentName component, IBinder service) {
+ if (component.equals(new ComponentName(FileActivity.this, OperationsService.class))) {
+ Log_OC.d(TAG, "Operations service connected");
+ mOperationsServiceBinder = (OperationsServiceBinder) service;
+ /*if (!mOperationsServiceBinder.isPerformingBlockingOperation()) {
+ dismissLoadingDialog();
+ }*/
+ doOnResumeAndBound();
+