X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/70c46d8fdc00506e83e6209337255256379eeff9..baf003a555afed17457401d9061002fa3dfd75c0:/src/eu/alefzero/owncloud/files/services/FileUploader.java diff --git a/src/eu/alefzero/owncloud/files/services/FileUploader.java b/src/eu/alefzero/owncloud/files/services/FileUploader.java index d34034d5..5d748c96 100644 --- a/src/eu/alefzero/owncloud/files/services/FileUploader.java +++ b/src/eu/alefzero/owncloud/files/services/FileUploader.java @@ -1,7 +1,6 @@ package eu.alefzero.owncloud.files.services; import java.io.File; -import java.net.URLDecoder; import eu.alefzero.owncloud.AccountUtils; import eu.alefzero.owncloud.R; @@ -16,6 +15,7 @@ import android.accounts.Account; import android.accounts.AccountManager; import android.app.Notification; import android.app.NotificationManager; +import android.app.PendingIntent; import android.app.Service; import android.content.Intent; import android.net.Uri; @@ -123,7 +123,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe Toast.makeText(this, "Upload successfull", Toast.LENGTH_SHORT) .show(); } else { - Toast.makeText(this, "No i kupa", Toast.LENGTH_SHORT).show(); + Toast.makeText(this, "Upload could not be completed", Toast.LENGTH_SHORT).show(); } } @@ -148,7 +148,10 @@ public class FileUploader extends Service implements OnDatatransferProgressListe mNotification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.progressbar_layout); mNotification.contentView.setProgressBar(R.id.status_progress, 100, 0, false); mNotification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon); - + // dvelasco ; contentIntent MUST be assigned to avoid app crashes in versions previous to Android 4.x ; + // BUT an empty Intent is not a very elegant solution; something smart should happen when a user 'clicks' on an upload in the notification bar + mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT); + mNotificationManager.notify(42, mNotification); WebdavClient wc = new WebdavClient(ocUri); @@ -177,9 +180,9 @@ public class FileUploader extends Service implements OnDatatransferProgressListe new_file.setFileLength(new File(mLocalPaths[i]).length()); new_file.setModificationTimestamp(System.currentTimeMillis()); new_file.setLastSyncDate(0); - new_file.setStoragePath(mLocalPaths[i]); + new_file.setStoragePath(mLocalPaths[i]); File f = new File(mRemotePaths[i]); - new_file.setParentId(storageManager.getFileByPath(URLDecoder.decode(f.getParent().endsWith("/")?f.getParent():f.getParent()+"/")).getFileId()); + new_file.setParentId(storageManager.getFileByPath(f.getParent().endsWith("/")?f.getParent():f.getParent()+"/").getFileId()); storageManager.saveFile(new_file); } }