import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.db.DbHandler;
+import com.owncloud.android.notifications.NotificationBuilderWithProgressBar;
+import com.owncloud.android.notifications.NotificationDelayer;
import com.owncloud.android.operations.CreateFolderOperation;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
-import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.ui.activity.FailedUploadActivity;
import com.owncloud.android.ui.activity.FileActivity;
import com.owncloud.android.ui.activity.InstantUploadActivity;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.Log_OC;
-import com.owncloud.android.utils.NotificationBuilderWithProgressBar;
import android.accounts.Account;
import android.accounts.AccountManager;
/// prepare client object to send requests to the ownCloud server
if (mUploadClient == null || !mLastAccount.equals(mCurrentUpload.getAccount())) {
mLastAccount = mCurrentUpload.getAccount();
- mStorageManager = new FileDataStorageManager(mLastAccount, getContentResolver());
- mUploadClient = OwnCloudClientFactory.createOwnCloudClient(mLastAccount, getApplicationContext());
+ mStorageManager =
+ new FileDataStorageManager(mLastAccount, getContentResolver());
+ mUploadClient = ((MainApp)getApplicationContext()).getOwnCloudClientManager().
+ getClientFor(mLastAccount, this);
}
/// check the existence of the parent folder for the file to upload
resultBuilder.setContentText(content);
mNotificationManager.notify(tickerId, resultBuilder.build());
- // Remove success notification
- if (uploadResult.isSuccess()) {
- // Sleep 2 seconds, so show the notification before remove it
- Handler handler = new Handler();
- handler.postDelayed(new Runnable() {
- public void run() {
- mNotificationManager.cancel(R.string.uploader_upload_succeeded_ticker);
- }
- }, 2000);
+ if (uploadResult.isSuccess()) {
+
+ DbHandler db = new DbHandler(this.getBaseContext());
+ db.removeIUPendingFile(mCurrentUpload.getOriginalStoragePath());
+ db.close();
+
+ // remove success notification, with a delay of 2 seconds
+ NotificationDelayer.cancelWithDelay(
+ mNotificationManager,
+ R.string.uploader_upload_succeeded_ticker,
+ 2000);
}
}