Browse Source

Clean code, from uploads view implementation

masensio 9 years ago
parent
commit
8006c893f9
45 changed files with 298 additions and 592 deletions
  1. 1 1
      owncloud-android-library
  2. 0 17
      res/layout/upload_list_group.xml
  3. 8 8
      src/com/owncloud/android/authentication/AccountUtils.java
  4. 1 1
      src/com/owncloud/android/datamodel/OCFile.java
  5. 17 78
      src/com/owncloud/android/datamodel/UploadsStorageManager.java
  6. 1 6
      src/com/owncloud/android/db/OCUpload.java
  7. 3 3
      src/com/owncloud/android/db/ProviderMeta.java
  8. 1 3
      src/com/owncloud/android/db/UploadResult.java
  9. 0 3
      src/com/owncloud/android/files/FileOperationsHelper.java
  10. 18 18
      src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java
  11. 1 4
      src/com/owncloud/android/files/services/ConnectivityActionReceiver.java
  12. 2 4
      src/com/owncloud/android/files/services/FileDownloader.java
  13. 43 172
      src/com/owncloud/android/files/services/FileUploader.java
  14. 1 1
      src/com/owncloud/android/files/services/IndexedForest.java
  15. 21 15
      src/com/owncloud/android/media/MediaService.java
  16. 8 11
      src/com/owncloud/android/media/MediaServiceBinder.java
  17. 23 24
      src/com/owncloud/android/operations/SynchronizeFileOperation.java
  18. 2 8
      src/com/owncloud/android/operations/SynchronizeFolderOperation.java
  19. 1 4
      src/com/owncloud/android/providers/FileContentProvider.java
  20. 1 2
      src/com/owncloud/android/services/SyncFolderHandler.java
  21. 2 3
      src/com/owncloud/android/services/observer/FileObserverService.java
  22. 2 3
      src/com/owncloud/android/services/observer/FolderObserver.java
  23. 1 1
      src/com/owncloud/android/ui/activity/ComponentsGetter.java
  24. 17 17
      src/com/owncloud/android/ui/activity/ConflictsResolveActivity.java
  25. 1 1
      src/com/owncloud/android/ui/activity/FileActivity.java
  26. 17 19
      src/com/owncloud/android/ui/activity/FileDisplayActivity.java
  27. 2 8
      src/com/owncloud/android/ui/activity/FolderPickerActivity.java
  28. 1 4
      src/com/owncloud/android/ui/activity/Preferences.java
  29. 2 1
      src/com/owncloud/android/ui/activity/UploadListActivity.java
  30. 19 22
      src/com/owncloud/android/ui/activity/Uploader.java
  31. 17 43
      src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java
  32. 1 1
      src/com/owncloud/android/ui/adapter/FileListListAdapter.java
  33. 1 1
      src/com/owncloud/android/ui/errorhandling/ErrorShowActivity.java
  34. 1 1
      src/com/owncloud/android/ui/errorhandling/ExceptionHandler.java
  35. 4 2
      src/com/owncloud/android/ui/fragment/ExpandableListFragment.java
  36. 1 1
      src/com/owncloud/android/ui/fragment/ExtendedListFragment.java
  37. 3 3
      src/com/owncloud/android/ui/fragment/FileDetailFragment.java
  38. 3 4
      src/com/owncloud/android/ui/fragment/OCFileListFragment.java
  39. 1 44
      src/com/owncloud/android/ui/fragment/UploadListFragment.java
  40. 3 4
      src/com/owncloud/android/ui/preview/PreviewImageActivity.java
  41. 6 7
      src/com/owncloud/android/ui/preview/PreviewMediaFragment.java
  42. 15 15
      src/com/owncloud/android/utils/ConnectivityUtils.java
  43. 5 3
      src/com/owncloud/android/utils/FileStorageUtils.java
  44. 19 0
      src/com/owncloud/android/utils/MimetypeIconUtil.java
  45. 1 1
      src/com/owncloud/android/utils/UploadUtils.java

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit 6ff6f75ee20e1b28f84a3ca5213dccb5907a2bed
+Subproject commit dc3ae324c30872b905397c76f6ad9391ec482e66

+ 0 - 17
res/layout/upload_list_group.xml

@@ -8,28 +8,11 @@
        style="?android:attr/listSeparatorTextViewStyle"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
-       android:layout_toLeftOf="@+id/upload_group_right_button"
        android:divider="@null"
        android:dividerHeight="0dp"
        android:ellipsize="middle"
        android:showDividers="none"
        android:textColor="@color/color_accent"
 	/>
-   
-    <!-- This would be just too many buttons. 
-    <Button
-        android:id="@+id/upload_group_right_button"
-        android:layout_width="wrap_content"
-        android:layout_height="0dp"
-        android:layout_alignBottom="@+id/uploadListGroupName"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentTop="true"
-        style="?android:attr/buttonStyleSmall"
-        android:focusable="false"
-        android:focusableInTouchMode="false" 
-        android:text="CLEAR"
-        />
- 	 -->
-    
 
 </RelativeLayout>

+ 8 - 8
src/com/owncloud/android/authentication/AccountUtils.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   Copyright (C) 2012  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -20,7 +20,12 @@
 
 package com.owncloud.android.authentication;
 
-import java.util.Locale;
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.preference.PreferenceManager;
 
 import com.owncloud.android.MainApp;
 import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
@@ -28,12 +33,7 @@ import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.status.OwnCloudVersion;
 
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.net.Uri;
-import android.preference.PreferenceManager;
+import java.util.Locale;
 
 public class AccountUtils {
 

+ 1 - 1
src/com/owncloud/android/datamodel/OCFile.java

@@ -4,7 +4,7 @@
  *   @author Bartek Przybylski
  *   @author David A. Velasco
  *   Copyright (C) 2012  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 17 - 78
src/com/owncloud/android/datamodel/UploadsStorageManager.java

@@ -1,22 +1,22 @@
 /**
- * ownCloud Android client application
+ *  ownCloud Android client application
  *
- * @author LukeOwncloud
- * @author David A. Velasco
- * @author masensio
- * Copyright (C) 2015 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  @author LukeOwncloud
+ *  @author David A. Velasco
+ *  @author masensio
+ *  Copyright (C) 2016 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 package com.owncloud.android.datamodel;
 
@@ -109,7 +109,6 @@ public class UploadsStorageManager extends Observable {
         cv.put(ProviderTableMeta.UPLOADS_REMOTE_PATH, ocUpload.getRemotePath());
         cv.put(ProviderTableMeta.UPLOADS_ACCOUNT_NAME, ocUpload.getAccountName());
         cv.put(ProviderTableMeta.UPLOADS_STATUS, ocUpload.getUploadStatus().value);
-        //cv.put(ProviderTableMeta.UPLOADS_FILE_ID, ocUpload.getOCFile().getFileId());
         cv.put(ProviderTableMeta.UPLOADS_LOCAL_BEHAVIOUR, ocUpload.getLocalAction());
         cv.put(ProviderTableMeta.UPLOADS_FORCE_OVERWRITE, ocUpload.isForceOverwrite() ? 1 : 0);
         cv.put(ProviderTableMeta.UPLOADS_IS_WHILE_CHARGING_ONLY, ocUpload.isWhileChargingOnly() ? 1 : 0);
@@ -329,7 +328,6 @@ public class UploadsStorageManager extends Observable {
         OCUpload[] list = new OCUpload[c.getCount()];
         if (c.moveToFirst()) {
             do {
-                //long fileUploadId = c.getLong(c.getColumnIndex(ProviderTableMeta.UPLOADS_FILE_ID));
                 OCUpload upload = createOCUploadFromCursor(c);
                 if (upload == null) {
                     Log_OC.e(TAG, "OCUpload could not be created from cursor");
@@ -364,65 +362,6 @@ public class UploadsStorageManager extends Observable {
     }
     */
 
-    /*
-    private OCFile createFileInstance(Cursor c) {
-        OCFile file = null;
-        if (c != null) {
-            file = new OCFile(c.getString(c
-                    .getColumnIndex(ProviderTableMeta.FILE_PATH)));
-            file.setFileId(c.getLong(c.getColumnIndex(ProviderTableMeta._ID)));
-            file.setParentId(c.getLong(c
-                    .getColumnIndex(ProviderTableMeta.FILE_PARENT)));
-            file.setMimetype(c.getString(c
-                    .getColumnIndex(ProviderTableMeta.FILE_CONTENT_TYPE)));
-            if (!file.isFolder()) {
-                file.setStoragePath(c.getString(c
-                        .getColumnIndex(ProviderTableMeta.FILE_STORAGE_PATH)));
-                if (file.getStoragePath() == null) {
-                    // try to find existing file and bind it with current account;
-                    // with the current update of SynchronizeFolderOperation, this won't be
-                    // necessary anymore after a full synchronization of the account
-                    String accountName = c.getString(c
-                            .getColumnIndex(ProviderTableMeta.FILE_ACCOUNT_OWNER));
-                    File f = new File(FileStorageUtils.getDefaultSavePathFor(accountName, file));
-                    if (f.exists()) {
-                        file.setStoragePath(f.getAbsolutePath());
-                        file.setLastSyncDateForData(f.lastModified());
-                    }
-                }
-            }
-            file.setFileLength(c.getLong(c
-                    .getColumnIndex(ProviderTableMeta.FILE_CONTENT_LENGTH)));
-            file.setCreationTimestamp(c.getLong(c
-                    .getColumnIndex(ProviderTableMeta.FILE_CREATION)));
-            file.setModificationTimestamp(c.getLong(c
-                    .getColumnIndex(ProviderTableMeta.FILE_MODIFIED)));
-            file.setModificationTimestampAtLastSyncForData(c.getLong(c
-                    .getColumnIndex(ProviderTableMeta.FILE_MODIFIED_AT_LAST_SYNC_FOR_DATA)));
-            file.setLastSyncDateForProperties(c.getLong(c
-                    .getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE)));
-            file.setLastSyncDateForData(c.getLong(c.
-                    getColumnIndex(ProviderTableMeta.FILE_LAST_SYNC_DATE_FOR_DATA)));
-            file.setFavorite(c.getInt(
-                    c.getColumnIndex(ProviderTableMeta.FILE_KEEP_IN_SYNC)) == 1);
-            file.setEtag(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ETAG)));
-            file.setShareViaLink(c.getInt(
-                    c.getColumnIndex(ProviderTableMeta.FILE_SHARED_VIA_LINK)) == 1);
-            file.setShareWithSharee(c.getInt(
-                    c.getColumnIndex(ProviderTableMeta.FILE_SHARED_WITH_SHAREE)) == 1);
-            file.setPublicLink(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_PUBLIC_LINK)));
-            file.setPermissions(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_PERMISSIONS)));
-            file.setRemoteId(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_REMOTE_ID)));
-            file.setNeedsUpdateThumbnail(c.getInt(
-                    c.getColumnIndex(ProviderTableMeta.FILE_UPDATE_THUMBNAIL)) == 1);
-            file.setDownloading(c.getInt(
-                    c.getColumnIndex(ProviderTableMeta.FILE_IS_DOWNLOADING)) == 1);
-            file.setEtagInConflict(c.getString(c.getColumnIndex(ProviderTableMeta.FILE_ETAG_IN_CONFLICT)));
-
-        }
-        return file;
-    }
-    */
 
     private OCUpload createOCUploadFromCursor(Cursor c) {
         OCUpload upload = null;

+ 1 - 6
src/com/owncloud/android/db/OCUpload.java

@@ -4,7 +4,7 @@
  *   @author LukeOwncloud
  *   @author masensio
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -39,7 +39,6 @@ import com.owncloud.android.utils.MimetypeIconUtil;
 import com.owncloud.android.utils.UploadUtils;
 
 import java.io.File;
-import java.util.Date;
 
 /**
  * Stores all information in order to start upload operations. PersistentUploadObject can
@@ -48,14 +47,10 @@ import java.util.Date;
  */
 public class OCUpload implements Parcelable {
 
-    /** Generated - should be refreshed every time the class changes!! */
-//    private static final long serialVersionUID = 2647551318657321611L;
-
     private static final String TAG = OCUpload.class.getSimpleName();
 
     private long mId;
 
-    //private OCFile mFile;
     /**
      * Absolute path in the local file system to the file to be uploaded
      */

+ 3 - 3
src/com/owncloud/android/db/ProviderMeta.java

@@ -2,8 +2,10 @@
  *   ownCloud Android client application
  *
  *   @author Bartek Przybylski
+ *   @author David A. Velasco
+ *   @author masensio
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -134,7 +136,6 @@ public class ProviderMeta {
                 + " collate nocase asc";
 
         //Columns of Uploads table
-        //public static final String UPLOADS_FILE_ID = "file_id";
         public static final String UPLOADS_LOCAL_PATH = "local_path";
         public static final String UPLOADS_REMOTE_PATH = "remote_path";
         public static final String UPLOADS_ACCOUNT_NAME = "account_name";
@@ -149,7 +150,6 @@ public class ProviderMeta {
         public static final String UPLOADS_LAST_RESULT = "last_result";
         public static final String UPLOADS_CREATED_BY = "created_by";
 
-        //public static final String UPLOADS_DEFAULT_SORT_ORDER = UPLOADS_FILE_ID  + " collate nocase asc";
         public static final String UPLOADS_DEFAULT_SORT_ORDER = ProviderTableMeta._ID  + " collate nocase desc";
 
     }

+ 1 - 3
src/com/owncloud/android/db/UploadResult.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author masensio
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -22,8 +22,6 @@ package com.owncloud.android.db;
 
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 
-import java.io.FileNotFoundException;
-
 public enum UploadResult {
     UPLOADED(0),
     NETWORK_CONNECTION(1),

+ 0 - 3
src/com/owncloud/android/files/FileOperationsHelper.java

@@ -36,9 +36,7 @@ import android.widget.Toast;
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.datamodel.UploadsStorageManager;
 import com.owncloud.android.db.OCUpload;
-import com.owncloud.android.db.UploadResult;
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
 import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
 import com.owncloud.android.lib.common.network.WebdavUtils;
@@ -53,7 +51,6 @@ import com.owncloud.android.ui.activity.ShareActivity;
 import com.owncloud.android.ui.dialog.ShareLinkToDialog;
 import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
 
-
 import java.util.List;
 
 /**

+ 18 - 18
src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java

@@ -1,22 +1,22 @@
 /**
- * ownCloud Android client application
- * <p/>
- * @author Bartek Przybylski
- * @author David A. Velasco
- * Copyright (C) 2012  Bartek Przybylski
- * Copyright (C) 2016 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  ownCloud Android client application
+ *
+ *  @author Bartek Przybylski
+ *  @author David A. Velasco
+ *  Copyright (C) 2012  Bartek Przybylski
+ *  Copyright (C) 2016 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.owncloud.android.files;

+ 1 - 4
src/com/owncloud/android/files/services/ConnectivityActionReceiver.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author LukeOwncloud
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -26,17 +26,14 @@ import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
-import android.database.Cursor;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.net.wifi.WifiManager;
 import android.os.Bundle;
-import android.preference.PreferenceManager;
 
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.db.PreferenceReader;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.utils.FileStorageUtils;
 
 /**
  * Receives all connectivity action from Android OS at all times and performs

+ 2 - 4
src/com/owncloud/android/files/services/FileDownloader.java

@@ -33,7 +33,6 @@ import android.os.HandlerThread;
 import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
-import android.os.Parcelable;
 import android.os.Process;
 import android.support.v4.app.NotificationCompat;
 import android.util.Pair;
@@ -81,7 +80,7 @@ public class FileDownloader extends Service
     public static final String EXTRA_LINKED_TO_PATH = "LINKED_TO";
     public static final String ACCOUNT_NAME = "ACCOUNT_NAME";
 
-    private static final String TAG = "FileDownloader";
+    private static final String TAG = FileDownloader.class.getSimpleName();
 
     private Looper mServiceLooper;
     private ServiceHandler mServiceHandler;
@@ -190,7 +189,6 @@ public class FileDownloader extends Service
                 msg.obj = requestedDownloads;
                 mServiceHandler.sendMessage(msg);
             }
-            //}
         }
 
         return START_NOT_STICKY;
@@ -504,7 +502,7 @@ public class FileDownloader extends Service
         } else {
             showDetailsIntent = new Intent(this, FileDisplayActivity.class);
         }
-        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)download.getFile());
+        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, download.getFile());
         showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, download.getAccount());
         showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 

+ 43 - 172
src/com/owncloud/android/files/services/FileUploader.java

@@ -1,24 +1,25 @@
 /**
- * ownCloud Android client application
+ *  ownCloud Android client application
  *
- * @author Bartek Przybylski
- * @author masensio
- * @author LukeOwnCloud
- * @author David A. Velasco
- * Copyright (C) 2012 Bartek Przybylski
- * Copyright (C) 2012-2016 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  @author Bartek Przybylski
+ *  @author masensio
+ *  @author LukeOwnCloud
+ *  @author David A. Velasco
+ *
+ *  Copyright (C) 2012 Bartek Przybylski
+ *  Copyright (C) 2012-2016 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.owncloud.android.files.services;
@@ -77,13 +78,13 @@ import java.util.Vector;
 
 /**
  * Service for uploading files. Invoke using context.startService(...).
- * <p/>
+ *
  * Files to be uploaded are stored persistently using {@link UploadsStorageManager}.
- * <p/>
+ *
  * On next invocation of {@link FileUploader} uploaded files which
  * previously failed will be uploaded again until either upload succeeded or a
  * fatal error occured.
- * <p/>
+ *
  * Every file passed to this service is uploaded. No filtering is performed.
  * However, Intent keys (e.g., KEY_WIFI_ONLY) are obeyed.
  */
@@ -145,10 +146,6 @@ public class FileUploader extends Service
      * Set to true if upload is to performed only when phone is being charged.
      */
     public static final String KEY_WHILE_CHARGING_ONLY = "KEY_WHILE_CHARGING_ONLY";
-//    /**
-//     * Set to future UNIX timestamp. Upload will not be performed before this timestamp.
-//     */
-//    public static final String KEY_UPLOAD_TIMESTAMP= "KEY_UPLOAD_TIMESTAMP";
 
     public static final String KEY_LOCAL_BEHAVIOUR = "BEHAVIOUR";
 
@@ -159,63 +156,6 @@ public class FileUploader extends Service
     public static final int LOCAL_BEHAVIOUR_FORGET = 2;
 
 
-    /**
-     * Describes local behavior for upload.
-     */
-//    public enum LocalBehaviour {
-//        /**
-//         * Creates a copy of file and stores it in tmp folder inside owncloud
-//         * folder on sd-card. After upload it is moved to local owncloud
-//         * storage. Original file stays untouched.
-//         */
-//        LOCAL_BEHAVIOUR_COPY(0),
-//        /**
-//         * Upload file from current storage. Afterwards original file is move to
-//         * local owncloud storage.
-//         */
-//        LOCAL_BEHAVIOUR_MOVE(1),
-//        /**
-//         * Just uploads file and leaves it where it is. Original file stays
-//         * untouched.
-//         */
-//        LOCAL_BEHAVIOUR_FORGET(2);
-//        private final int value;
-//
-//        LocalBehaviour(int value) {
-//            this.value = value;
-//        }
-//
-//        public int getValue() {
-//            return value;
-//        }
-//
-//        public static LocalBehaviour fromValue(int value){
-//            switch (value)
-//            {
-//                case 0:
-//                    return LOCAL_BEHAVIOUR_COPY;
-//                case 1:
-//                    return LOCAL_BEHAVIOUR_MOVE;
-//                case 2:
-//                    return LOCAL_BEHAVIOUR_FORGET;
-//            }
-//            return null;
-//        }
-//    }
-
-//    public enum UploadQuantity {
-//        UPLOAD_SINGLE_FILE(0), UPLOAD_MULTIPLE_FILES(1);
-//        private final int value;
-//
-//        UploadQuantity(int value) {
-//            this.value = value;
-//        }
-//
-//        public int getValue() {
-//            return value;
-//        }
-//    };
-
     private Looper mServiceLooper;
     private ServiceHandler mServiceHandler;
     private IBinder mBinder;
@@ -333,30 +273,29 @@ public class FileUploader extends Service
     /**
      * Call to update a dingle file already uploaded
      */
-    public static void uploadUpdate(Context context, Account account, OCFile existingFile, Integer behaviour, Boolean
-            forceOverwrite) {
+    public static void uploadUpdate(Context context, Account account, OCFile existingFile, Integer behaviour,
+                                    Boolean forceOverwrite) {
 
         uploadUpdate(context, account, new OCFile[]{existingFile}, behaviour, forceOverwrite);
     }
 
-    /**
-     * Checks if an ownCloud server version should support chunked uploads.
-     *
-     * @param version OwnCloud version instance corresponding to an ownCloud
-     *                server.
-     * @return 'True' if the ownCloud server with version supports chunked
-     * uploads.
-     * <p/>
-     * TODO - move to OwnCloudVersion
-     */
-    private static boolean chunkedUploadIsSupported(OwnCloudVersion version) {
-        return (version != null && version.compareTo(OwnCloudVersion.owncloud_v4_5) >= 0);
-    }
+//    /**
+//     * Checks if an ownCloud server version should support chunked uploads.
+//     *
+//     * @param version OwnCloud version instance corresponding to an ownCloud
+//     *                server.
+//     * @return 'True' if the ownCloud server with version supports chunked
+//     * uploads.
+//     * <p/>
+//     * TODO - move to OwnCloudVersion
+//     */
+//    private static boolean chunkedUploadIsSupported(OwnCloudVersion version) {
+//        return (version != null && version.compareTo(OwnCloudVersion.owncloud_v4_5) >= 0);
+//    }
 
     /**
      * Service initialization
      */
-    // TODO: Clean method: comments on extra code
     @Override
     public void onCreate() {
         super.onCreate();
@@ -369,14 +308,8 @@ public class FileUploader extends Service
         mServiceHandler = new ServiceHandler(mServiceLooper, this);
         mBinder = new FileUploaderBinder();
 
-        // From FileUploaderService
         mUploadsStorageManager = new UploadsStorageManager(getContentResolver());
 
-        //when this service starts there is no upload in progress. if db says so, app probably crashed before.
-        //mUploadsStorageManager.setAllCurrentToUploadLater();  // TODO why?
-
-        // mUploadExecutor = Executors.newFixedThreadPool(1);
-
 //      Log_OC.d(TAG, "FileUploader.retry() called by onCreate()");
 //      FileUploader.retry(getApplicationContext());
 
@@ -407,7 +340,7 @@ public class FileUploader extends Service
 
     /**
      * Entry point to add one or several files to the queue of uploads.
-     * <p/>
+     *
      * New uploads are added calling to startService(), resulting in a call to
      * this method. This ensures the service will keep on working although the
      * caller activity goes away.
@@ -436,7 +369,7 @@ public class FileUploader extends Service
             return Service.START_NOT_STICKY;
         }
         OwnCloudVersion ocv = AccountUtils.getServerVersion(account);
-        boolean chunked = FileUploader.chunkedUploadIsSupported(ocv);
+        boolean chunked = ocv.isChunkedUploadSupported();
 
         if (!retry) {
             if (!(intent.hasExtra(KEY_LOCAL_FILE) ||
@@ -459,20 +392,12 @@ public class FileUploader extends Service
                 mimeTypes = intent.getStringArrayExtra(KEY_MIME_TYPE);
             }
 
-            FileDataStorageManager storageManager = new FileDataStorageManager(
-                    account,
-                    getContentResolver()
-            );
 
             boolean forceOverwrite = intent.getBooleanExtra(KEY_FORCE_OVERWRITE, false);
-            //boolean isInstant = intent.getBooleanExtra(KEY_INSTANT_UPLOAD, false);
             int localAction = intent.getIntExtra(KEY_LOCAL_BEHAVIOUR, LOCAL_BEHAVIOUR_FORGET);
 
             boolean isCreateRemoteFolder = intent.getBooleanExtra(KEY_CREATE_REMOTE_FOLDER, false);
             int createdBy = intent.getIntExtra(KEY_CREATED_BY, UploadFileOperation.CREATED_BY_USER);
-            boolean isWhileChargingOnly = intent.getBooleanExtra(KEY_WHILE_CHARGING_ONLY, false);
-            //long uploadTimestamp = intent.getLongExtra(KEY_UPLOAD_TIMESTAMP, -1);
-
 
             if (intent.hasExtra(KEY_FILE) && files == null) {
                 Log_OC.e(TAG, "Incorrect array for OCFiles provided in upload intent");
@@ -618,7 +543,7 @@ public class FileUploader extends Service
     /**
      * Provides a binder object that clients can use to perform operations on
      * the queue of uploads, excepting the addition of new files.
-     * <p/>
+     *
      * Implemented to perform cancellation, pause and resume of existing
      * uploads.
      */
@@ -731,14 +656,11 @@ public class FileUploader extends Service
             cancelUploadsForAccount(account);
         }
 
-        // TODO: Review: Method from FileUploader with some changes because the merge with FileUploader
         // TODO Complete operation to retry the upload
         /**
          * Puts upload in upload list and tell FileUploader to upload items in list.
          */
         public void retry(Account account, OCUpload upload) {
-//            String uploadKey = buildRemoteName(account, upload.getOCFile());
-//            mPendingUploads.put(uploadKey, upload);
             FileUploader.retry(getApplicationContext(), account, upload);
         }
 
@@ -749,10 +671,10 @@ public class FileUploader extends Service
         /**
          * Returns True when the file described by 'file' is being uploaded to
          * the ownCloud account 'account' or waiting for it
-         * <p/>
+         *
          * If 'file' is a directory, returns 'true' if some of its descendant files
          * is uploading or waiting to upload.
-         * <p/>
+         *
          * Warning: If remote file exists and !forceOverwrite the original file
          * is being returned here. That is, it seems as if the original file is
          * being updated when actually a new file is being uploaded.
@@ -843,7 +765,6 @@ public class FileUploader extends Service
         }
 
 
-        // TODO: Review: Method from FileUploader with some changes because the merge with FileUploader
         @Override
         public void onTransferProgress(long progressRate, long totalTransferredSoFar,
                                        long totalToTransfer, String fileName) {
@@ -869,14 +790,6 @@ public class FileUploader extends Service
             return accountName + remotePath;
         }
 
-        /*private String buildRemoteName(Account account, OCFile file, long uploadId) {
-            String suffix = String.valueOf(uploadId);
-            if (uploadId != -1) {
-                suffix = "";
-            }
-            return account.name + file.getRemotePath() + suffix;
-        }*/
-
     }
 
     /**
@@ -1059,16 +972,6 @@ public class FileUploader extends Service
         mNotificationBuilder.setContentIntent(PendingIntent.getActivity(this, (int) System.currentTimeMillis(),
                 showUploadListIntent, 0));
 
-        // TODO: decide where do we go to navigate when the user clicks the notification
-        /// includes a pending intent in the notification showing the details view of the file
-//        Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
-//        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE,  (Parcelable) upload.getFile());
-//        showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, upload.getAccount());
-//        showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-//        mNotificationBuilder.setContentIntent(PendingIntent.getActivity(
-//                this, (int) System.currentTimeMillis(), showDetailsIntent, 0
-//        ));
-
         mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build());
 
         // TODO really needed?
@@ -1155,33 +1058,6 @@ public class FileUploader extends Service
                 // grant that future retries on the same account will get the fresh credentials
             } else {
                 mNotificationBuilder.setContentText(content);
-// Changes for compilation
-//                if (upload.isInstant()) {
-//                    DbHandler db = null;
-//                    try {
-//                        db = new DbHandler(this.getBaseContext());
-//                        String message = uploadResult.getLogMessage() + " errorCode: " +
-//                                uploadResult.getCode();
-//                        Log_OC.e(TAG, message + " Http-Code: " + uploadResult.getHttpCode());
-//                        if (uploadResult.getCode() == ResultCode.QUOTA_EXCEEDED) {
-//                            //message = getString(R.string.failed_upload_quota_exceeded_text);
-//                            if (db.updateFileState(
-//                                    upload.getOriginalStoragePath(),
-//                                    DbHandler.UPLOAD_STATUS_UPLOAD_FAILED,
-//                                    message) == 0) {
-//                                db.putFileForLater(
-//                                        upload.getOriginalStoragePath(),
-//                                        upload.getAccount().name,
-//                                        message
-//                                );
-//                            }
-//                        }
-//                    } finally {
-//                        if (db != null) {
-//                            db.close();
-//                        }
-//                    }
-//                }
             }
 
             if (!uploadResult.isSuccess() && !needsToUpdateCredentials ) {
@@ -1198,12 +1074,7 @@ public class FileUploader extends Service
             mNotificationManager.notify(tickerId, mNotificationBuilder.build());
 
             if (uploadResult.isSuccess()) {
-//Changes for compilation
-//                DbHandler db = new DbHandler(this.getBaseContext());
-//                db.removeIUPendingFile(mCurrentUpload.getOriginalStoragePath());
-//                db.close();
                 mPendingUploads.remove(upload.getAccount().name, upload.getFile().getRemotePath());
-                //updateDatabaseUploadResult(uploadResult, mCurrentUpload);
                 // remove success notification, with a delay of 2 seconds
                 NotificationDelayer.cancelWithDelay(
                         mNotificationManager,

+ 1 - 1
src/com/owncloud/android/files/services/IndexedForest.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 21 - 15
src/com/owncloud/android/media/MediaService.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -21,7 +21,6 @@
 package com.owncloud.android.media;
 
 import android.accounts.Account;
-import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
@@ -35,19 +34,18 @@ import android.media.MediaPlayer.OnPreparedListener;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.WifiLock;
 import android.os.IBinder;
-import android.os.Parcelable;
 import android.os.PowerManager;
 import android.support.v7.app.NotificationCompat;
 import android.widget.Toast;
 
-import java.io.IOException;
-
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
 
+import java.io.IOException;
+
 
 /**
  * Service that handles media playback, both audio and video. 
@@ -60,7 +58,8 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
     private static final String TAG = MediaService.class.getSimpleName();
 
-    private static final String MY_PACKAGE = MediaService.class.getPackage() != null ? MediaService.class.getPackage().getName() : "com.owncloud.android.media";
+    private static final String MY_PACKAGE = MediaService.class.getPackage() != null ?
+            MediaService.class.getPackage().getName() : "com.owncloud.android.media";
     
     /// Intent actions that we are prepared to handle
     public static final String ACTION_PLAY_FILE = MY_PACKAGE + ".action.PLAY_FILE";
@@ -163,7 +162,8 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
                 
         } else if (extra == MediaPlayer.MEDIA_ERROR_UNSUPPORTED) {
             /*  Added in API level 17
-                Bitstream is conforming to the related coding standard or file spec, but the media framework does not support the feature.
+                Bitstream is conforming to the related coding standard or file spec,
+                but the media framework does not support the feature.
                 Constant Value: -1010 (0xfffffc0e)
              */
             messageId = R.string.media_err_unsupported;
@@ -191,7 +191,8 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
         } else if (what == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
             /*  Added in API level 3
-                The video is streamed and its container is not valid for progressive playback i.e the video's index (e.g moov atom) is not at the start of the file.
+                The video is streamed and its container is not valid for progressive playback i.e the video's index
+                (e.g moov atom) is not at the start of the file.
                 Constant Value: 200 (0x000000c8)
             */
             messageId = R.string.media_err_invalid_progressive_playback;
@@ -204,7 +205,8 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             */
             /*  MediaPlayer.MEDIA_ERROR_SERVER_DIED)
                 Added in API level 1
-                Media server died. In this case, the application must release the MediaPlayer object and instantiate a new one.
+                Media server died. In this case, the application must release the MediaPlayer
+                object and instantiate a new one.
                 Constant Value: 100 (0x00000064) 
              */
             messageId = R.string.media_err_unknown;
@@ -472,22 +474,26 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             
         } catch (SecurityException e) {
             Log_OC.e(TAG, "SecurityException playing " + mAccount.name + mFile.getRemotePath(), e);
-            Toast.makeText(this, String.format(getString(R.string.media_err_security_ex), mFile.getFileName()), Toast.LENGTH_LONG).show();
+            Toast.makeText(this, String.format(getString(R.string.media_err_security_ex), mFile.getFileName()),
+                    Toast.LENGTH_LONG).show();
             processStopRequest(true);
             
         } catch (IOException e) {
             Log_OC.e(TAG, "IOException playing " + mAccount.name + mFile.getRemotePath(), e);
-            Toast.makeText(this, String.format(getString(R.string.media_err_io_ex), mFile.getFileName()), Toast.LENGTH_LONG).show();
+            Toast.makeText(this, String.format(getString(R.string.media_err_io_ex), mFile.getFileName()),
+                    Toast.LENGTH_LONG).show();
             processStopRequest(true);
             
         } catch (IllegalStateException e) {
             Log_OC.e(TAG, "IllegalStateException " + mAccount.name + mFile.getRemotePath(), e);
-            Toast.makeText(this, String.format(getString(R.string.media_err_unexpected), mFile.getFileName()), Toast.LENGTH_LONG).show();
+            Toast.makeText(this, String.format(getString(R.string.media_err_unexpected), mFile.getFileName()),
+                    Toast.LENGTH_LONG).show();
             processStopRequest(true);
             
         } catch (IllegalArgumentException e) {
             Log_OC.e(TAG, "IllegalArgumentException " + mAccount.name + mFile.getRemotePath(), e);
-            Toast.makeText(this, String.format(getString(R.string.media_err_unexpected), mFile.getFileName()), Toast.LENGTH_LONG).show();
+            Toast.makeText(this, String.format(getString(R.string.media_err_unexpected), mFile.getFileName()),
+                    Toast.LENGTH_LONG).show();
             processStopRequest(true);
         }
     }
@@ -540,7 +546,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
         // TODO check if updating the Intent is really necessary
         Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
-        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)mFile);
+        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, mFile);
         showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
         showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
 
@@ -576,7 +582,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         
         /// includes a pending intent in the notification showing the details view of the file
         Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
-        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)mFile);
+        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, mFile);
         showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
         showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         mNotificationBuilder.setContentIntent(PendingIntent.getActivity(getApplicationContext(),

+ 8 - 11
src/com/owncloud/android/media/MediaServiceBinder.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -21,17 +21,16 @@
 package com.owncloud.android.media;
 
 
-import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.media.MediaService.State;
-
 import android.accounts.Account;
 import android.content.Intent;
 import android.media.MediaPlayer;
 import android.os.Binder;
-import android.os.Parcelable;
 import android.widget.MediaController;
 
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.media.MediaService.State;
+
 
 /**
  *  Binder allowing client components to perform operations on on the MediaPlayer managed by a MediaService instance.
@@ -95,8 +94,7 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
     public int getCurrentPosition() {
         MediaPlayer currentPlayer = mService.getPlayer();
         if (currentPlayer != null) {
-            int pos = currentPlayer.getCurrentPosition();
-            return pos;
+            return currentPlayer.getCurrentPosition();
         } else {
             return 0;
         }
@@ -106,8 +104,7 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
     public int getDuration() {
         MediaPlayer currentPlayer = mService.getPlayer();
         if (currentPlayer != null) {
-            int dur = currentPlayer.getDuration();
-            return dur;
+            return currentPlayer.getDuration();
         } else {
             return 0;
         }
@@ -154,7 +151,7 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
         Log_OC.d(TAG, "Loading and starting through binder...");
         Intent i = new Intent(mService, MediaService.class);
         i.putExtra(MediaService.EXTRA_ACCOUNT, account);
-        i.putExtra(MediaService.EXTRA_FILE, (Parcelable)file);
+        i.putExtra(MediaService.EXTRA_FILE, file);
         i.putExtra(MediaService.EXTRA_PLAY_ON_LOAD, playImmediately);
         i.putExtra(MediaService.EXTRA_START_POSITION, position);
         i.setAction(MediaService.ACTION_PLAY_FILE);

+ 23 - 24
src/com/owncloud/android/operations/SynchronizeFileOperation.java

@@ -1,22 +1,22 @@
 /**
- * ownCloud Android client application
+ *  ownCloud Android client application
  *
- * @author David A. Velasco
- * @author masensio
- * Copyright (C) 2012 Bartek Przybylski
- * Copyright (C) 2015 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  @author David A. Velasco
+ *  @author masensio
+ *  Copyright (C) 2012 Bartek Przybylski
+ *  Copyright (C) 2015 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.owncloud.android.operations;
@@ -24,7 +24,6 @@ package com.owncloud.android.operations;
 import android.accounts.Account;
 import android.content.Context;
 import android.content.Intent;
-import android.os.Parcelable;
 
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileDownloader;
@@ -96,11 +95,11 @@ public class SynchronizeFileOperation extends SyncOperation {
     /**
      * Constructor allowing to reuse {@link OCFile} instances just queried from local cache or
      * from remote OC server.
-     * <p/>
+     *
      * Useful to include this operation as part of the synchronization of a folder
      * (or a full account), avoiding the repetition of fetch operations (both in local database
      * or remote server).
-     * <p/>
+     *
      * At least one of localFile or serverFile MUST NOT BE NULL. If you don't have none of them,
      * use the other constructor.
      *
@@ -141,13 +140,13 @@ public class SynchronizeFileOperation extends SyncOperation {
 
     /**
      * Temporal constructor.
-     * <p/>
+     *
      * Extends the previous one to allow constrained synchronizations where uploads are never
      * performed - only downloads or conflict detection.
-     * <p/>
+     *
      * Do not use unless you are involved in 'folder synchronization' or 'folder download' work
      * in progress.
-     * <p/>
+     *
      * TODO Remove when 'folder synchronization' replaces 'folder download'.
      *
      * @param localFile        Data of file (just) retrieved from local cache/database.
@@ -299,7 +298,7 @@ public class SynchronizeFileOperation extends SyncOperation {
     private void requestForDownload(OCFile file) {
         Intent i = new Intent(mContext, FileDownloader.class);
         i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
-        i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable) file);
+        i.putExtra(FileDownloader.EXTRA_FILE, file);
         mContext.startService(i);
         mTransferWasRequested = true;
     }

+ 2 - 8
src/com/owncloud/android/operations/SynchronizeFolderOperation.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -30,7 +30,6 @@ import java.util.Vector;
 import android.accounts.Account;
 import android.content.Context;
 import android.content.Intent;
-import android.os.Parcelable;
 import android.util.Log;
 
 
@@ -51,8 +50,6 @@ import com.owncloud.android.utils.FileStorageUtils;
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
-//import android.support.v4.content.LocalBroadcastManager;
-
 
 /**
  *  Remote operation performing the synchronization of the list of files contained 
@@ -434,7 +431,7 @@ public class SynchronizeFolderOperation extends SyncOperation {
                 }
                 Intent i = new Intent(mContext, FileDownloader.class);
                 i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
-                i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable) file);
+                i.putExtra(FileDownloader.EXTRA_FILE, file);
                 mContext.startService(i);
             }
         }
@@ -481,7 +478,6 @@ public class SynchronizeFolderOperation extends SyncOperation {
 
     
     /**
-<<<<<<< HEAD
      * Creates and populates a new {@link com.owncloud.android.datamodel.OCFile}
      * object with the data read from the server.
      *
@@ -494,8 +490,6 @@ public class SynchronizeFolderOperation extends SyncOperation {
 
 
     /**
-=======
->>>>>>> master
      * Scans the default location for saving local copies of files searching for
      * a 'lost' file with the same full name as the {@link com.owncloud.android.datamodel.OCFile}
      * received as parameter.

+ 1 - 4
src/com/owncloud/android/providers/FileContentProvider.java

@@ -5,7 +5,7 @@
  *   @author David A. Velasco
  *   @author masensio
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -282,8 +282,6 @@ public class FileContentProvider extends ContentProvider {
                     throw new SQLException("ERROR " + uri);
 
                 }
-                // TODO??
-                // updateFilesTableAccordingToUploadInsertion(db, values);
                 return insertedUploadUri;
             default:
                 throw new IllegalArgumentException("Unknown uri id: " + uri);
@@ -846,7 +844,6 @@ public class FileContentProvider extends ContentProvider {
         // Create uploads table
         db.execSQL("CREATE TABLE " + ProviderTableMeta.UPLOADS_TABLE_NAME + "("
                 + ProviderTableMeta._ID + " INTEGER PRIMARY KEY, "
-                //+ ProviderTableMeta.UPLOADS_FILE_ID + " INTEGER, "
                 + ProviderTableMeta.UPLOADS_LOCAL_PATH + " TEXT, "
                 + ProviderTableMeta.UPLOADS_REMOTE_PATH + " TEXT, "
                 + ProviderTableMeta.UPLOADS_ACCOUNT_NAME + " TEXT, "

+ 1 - 2
src/com/owncloud/android/services/SyncFolderHandler.java

@@ -1,7 +1,7 @@
 /**
  *   ownCloud Android client application
  *
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -27,7 +27,6 @@ import android.os.Looper;
 import android.os.Message;
 import android.util.Pair;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileDownloader;

+ 2 - 3
src/com/owncloud/android/services/observer/FileObserverService.java

@@ -3,7 +3,7 @@
  *
  *   @author David A. Velasco
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -34,7 +34,6 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.database.Cursor;
 import android.os.IBinder;
-import android.os.Parcelable;
 
 import com.owncloud.android.MainApp;
 import com.owncloud.android.authentication.AccountUtils;
@@ -103,7 +102,7 @@ public class FileObserverService extends Service {
         Intent intent = new Intent(context, FileObserverService.class);
         intent.setAction(watchIt ? FileObserverService.ACTION_ADD_OBSERVED_FILE
                 : FileObserverService.ACTION_DEL_OBSERVED_FILE);
-        intent.putExtra(FileObserverService.ARG_FILE, (Parcelable)file);
+        intent.putExtra(FileObserverService.ARG_FILE, file);
         intent.putExtra(FileObserverService.ARG_ACCOUNT, account);
         return intent;
     }

+ 2 - 3
src/com/owncloud/android/services/observer/FolderObserver.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -28,7 +28,6 @@ import android.accounts.Account;
 import android.content.Context;
 import android.content.Intent;
 import android.os.FileObserver;
-import android.os.Parcelable;
 
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
@@ -205,7 +204,7 @@ public class FolderObserver extends FileObserver {
             // this can be very intrusive; a notification should be preferred
             Intent i = new Intent(mContext, ConflictsResolveActivity.class);
             i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
-            i.putExtra(ConflictsResolveActivity.EXTRA_FILE, (Parcelable)file);
+            i.putExtra(ConflictsResolveActivity.EXTRA_FILE, file);
             i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, mAccount);
             mContext.startActivity(i);
         }

+ 1 - 1
src/com/owncloud/android/ui/activity/ComponentsGetter.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 17 - 17
src/com/owncloud/android/ui/activity/ConflictsResolveActivity.java

@@ -1,22 +1,22 @@
 /**
- * ownCloud Android client application
+ *  ownCloud Android client application
  *
- * @author Bartek Przybylski
- * @author David A. Velasco
- * Copyright (C) 2012 Bartek Przybylski
- * Copyright (C) 2015 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  @author Bartek Przybylski
+ *  @author David A. Velasco
+ *  Copyright (C) 2012 Bartek Przybylski
+ *  Copyright (C) 2016 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  <p/>
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.owncloud.android.ui.activity;

+ 1 - 1
src/com/owncloud/android/ui/activity/FileActivity.java

@@ -3,7 +3,7 @@
  *
  *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 17 - 19
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -1,22 +1,22 @@
 /**
- * ownCloud Android client application
+ *  ownCloud Android client application
  *
- * @author Bartek Przybylski
- * @author David A. Velasco
- * Copyright (C) 2011  Bartek Przybylski
- * Copyright (C) 2015 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  @author Bartek Przybylski
+ *  @author David A. Velasco
+ *  Copyright (C) 2011  Bartek Przybylski
+ *  Copyright (C) 2016 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.owncloud.android.ui.activity;
@@ -45,14 +45,12 @@ import android.os.IBinder;
 import android.preference.PreferenceManager;
 import android.provider.OpenableColumns;
 import android.support.design.widget.Snackbar;
-import android.support.v4.app.ActivityCompat;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.view.GravityCompat;
 import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AppCompatDialog;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;

+ 2 - 8
src/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -1,7 +1,7 @@
 /**
  *   ownCloud Android client application
  *
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -20,7 +20,6 @@
 package com.owncloud.android.ui.activity;
 
 import android.accounts.Account;
-import android.accounts.AccountManager;
 import android.accounts.AuthenticatorException;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -44,11 +43,6 @@ import android.widget.Toast;
 
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.lib.common.OwnCloudAccount;
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
-import com.owncloud.android.lib.common.OwnCloudCredentials;
-import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
@@ -374,7 +368,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
             Parcelable targetFile = i.getParcelableExtra(FolderPickerActivity.EXTRA_FILE);
 
             Intent data = new Intent();
-            data.putExtra(EXTRA_FOLDER, (Parcelable)getCurrentFolder());
+            data.putExtra(EXTRA_FOLDER, getCurrentFolder());
             if (targetFile != null) {
                 data.putExtra(EXTRA_FILE, targetFile);
             }

+ 1 - 4
src/com/owncloud/android/ui/activity/Preferences.java

@@ -4,7 +4,7 @@
  *   @author Bartek Przybylski
  *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -25,7 +25,6 @@ import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AccountManagerCallback;
 import android.accounts.AccountManagerFuture;
-
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -45,14 +44,12 @@ import android.preference.Preference.OnPreferenceClickListener;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceCategory;
 import android.preference.PreferenceManager;
-
 import android.support.annotation.LayoutRes;
 import android.support.annotation.Nullable;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AlertDialog;
 import android.support.v7.app.AppCompatDelegate;
 import android.support.v7.widget.Toolbar;
-
 import android.view.ContextMenu;
 import android.view.ContextMenu.ContextMenuInfo;
 import android.view.Menu;

+ 2 - 1
src/com/owncloud/android/ui/activity/UploadListActivity.java

@@ -3,7 +3,8 @@
  *
  *   @author LukeOwncloud
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   @author masensio
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 19 - 22
src/com/owncloud/android/ui/activity/Uploader.java

@@ -1,34 +1,29 @@
 /**
- * ownCloud Android client application
+ *  ownCloud Android client application
  *
- * @author Bartek Przybylski
- * @author masensio
- * Copyright (C) 2012  Bartek Przybylski
- * Copyright (C) 2015 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  @author Bartek Przybylski
+ *  @author masensio
+ *  Copyright (C) 2012  Bartek Przybylski
+ *  Copyright (C) 2016 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.owncloud.android.ui.activity;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
-
 import android.annotation.SuppressLint;
-
-import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AlertDialog.Builder;
-
 import android.app.Dialog;
 import android.app.ProgressDialog;
 import android.content.Context;
@@ -51,6 +46,8 @@ import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v7.app.ActionBar;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AlertDialog.Builder;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;

+ 17 - 43
src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java

@@ -1,21 +1,21 @@
 /**
- * ownCloud Android client application
+ *  ownCloud Android client application
  *
- * @author LukeOwncloud
- * @author masensio
- * Copyright (C) 2015 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  @author LukeOwncloud
+ *  @author masensio
+ *  Copyright (C) 2016 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 package com.owncloud.android.ui.adapter;
 
@@ -233,7 +233,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
 
             //* upload date
             TextView uploadDateTextView = (TextView) view.findViewById(R.id.upload_date);
-            long updateTime = upload.getUploadEndTimestamp();//(new File(upload.getLocalPath())).lastModified();
+            long updateTime = upload.getUploadEndTimestamp();
             CharSequence dateString = DisplayUtils.getRelativeDateTimeString(
                     mParentActivity,
                     updateTime,
@@ -334,7 +334,6 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                     } else {
                         status = mParentActivity.getString(
                                 R.string.uploads_view_upload_status_failed);
-                        ;
                     }
 
                     String laterReason = upload.getUploadLaterReason(mParentActivity);
@@ -343,29 +342,6 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                         status = laterReason;
                     }
                     break;
-//                case UPLOAD_FAILED:
-//                    if (upload.getLastResult() == UploadResult.NETWORK_CONNECTION) {
-//                        status = mParentActivity.getString(R.string.uploads_view_upload_status_failed_connection_error);
-//                    } else {
-//                        status = mParentActivity.getString(R.string.uploads_view_upload_status_failed_retry);
-//                    }
-//                    String laterReason = upload.getUploadLaterReason(mParentActivity);
-//                    if (laterReason != null) {
-//                        //Upload failed once but is delayed now, show reason.
-//                        status = laterReason;
-//                    }
-//                    pathTextView.setVisibility(View.GONE);
-//                    fileSizeTextView.setVisibility(View.GONE);
-//                    accountNameTextView.setVisibility(View.INVISIBLE);
-//                    uploadDateTextView.setVisibility(View.GONE);
-//                    break;
-//                case UPLOAD_LATER:
-//                    uploadDateTextView.setVisibility(View.GONE);
-//                    pathTextView.setVisibility(View.GONE);
-//                    fileSizeTextView.setVisibility(View.GONE);
-//                    accountNameTextView.setVisibility(View.INVISIBLE);
-//                    status = upload.getUploadLaterReason(mParentActivity);
-//                    break;
                 case UPLOAD_SUCCEEDED:
                     status = mParentActivity.getString(R.string.uploads_view_upload_status_succeeded);
                     statusTextView.setVisibility(View.GONE);
@@ -628,8 +604,6 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
         }
         TextView tv = (TextView) convertView.findViewById(R.id.uploadListGroupName);
         tv.setText(group.getGroupName());
-//        ImageView icon = (ImageView) convertView.findViewById(R.id.uploadListGroupIcon);
-//        icon.setImageResource(group.getGroupIcon());
         return convertView;
     }
 

+ 1 - 1
src/com/owncloud/android/ui/adapter/FileListListAdapter.java

@@ -6,7 +6,7 @@
  *   @author David A. Velasco
  *   @author masensio
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 1 - 1
src/com/owncloud/android/ui/errorhandling/ErrorShowActivity.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author LukeOwncloud
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 1 - 1
src/com/owncloud/android/ui/errorhandling/ExceptionHandler.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author LukeOwncloud
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 4 - 2
src/com/owncloud/android/ui/fragment/ExpandableListFragment.java

@@ -1,6 +1,8 @@
-/* ownCloud Android client application
+/**
+ *   ownCloud Android client application
+ *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2013 ownCloud Inc.
+ *   Copyright (C) 2012-2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 1 - 1
src/com/owncloud/android/ui/fragment/ExtendedListFragment.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2015 ownCloud Inc.
+ *   Copyright (C) 2012-2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,

+ 3 - 3
src/com/owncloud/android/ui/fragment/FileDetailFragment.java

@@ -4,7 +4,7 @@
  *   @author Bartek Przybylski
  *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -547,7 +547,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
             }
             if (mContainerActivity.getFileUploaderBinder() != null) {
                 mContainerActivity.getFileUploaderBinder().
-                        addDatatransferProgressListener(mProgressListener, mAccount, getFile()/*, 0*/);
+                        addDatatransferProgressListener(mProgressListener, mAccount, getFile());
             }
         } else {
             Log_OC.d(TAG, "mProgressListener == null");
@@ -563,7 +563,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
             }
             if (mContainerActivity.getFileUploaderBinder() != null) {
                 mContainerActivity.getFileUploaderBinder().
-                        removeDatatransferProgressListener(mProgressListener, mAccount, getFile()/*, 0*/);
+                        removeDatatransferProgressListener(mProgressListener, mAccount, getFile());
             }
         }
     }

+ 3 - 4
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -5,7 +5,7 @@
  *   @author masensio
  *   @author David A. Velasco
  *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -27,7 +27,6 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.Bundle;
-import android.os.Parcelable;
 import android.support.v4.widget.SwipeRefreshLayout;
 import android.view.ContextMenu;
 import android.view.Menu;
@@ -408,7 +407,7 @@ public class OCFileListFragment extends ExtendedListFragment
                 Intent action = new Intent(getActivity(), FolderPickerActivity.class);
 
                 // Pass mTargetFile that contains info of selected file/folder
-                action.putExtra(FolderPickerActivity.EXTRA_FILE, (Parcelable)mTargetFile);
+                action.putExtra(FolderPickerActivity.EXTRA_FILE, mTargetFile);
                 getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES);
                 return true;
             }
@@ -424,7 +423,7 @@ public class OCFileListFragment extends ExtendedListFragment
                 Intent action = new Intent(getActivity(), FolderPickerActivity.class);
 
                 // Pass mTargetFile that contains info of selected file/folder
-                action.putExtra(FolderPickerActivity.EXTRA_FILE, (Parcelable) mTargetFile);
+                action.putExtra(FolderPickerActivity.EXTRA_FILE, mTargetFile);
                 getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_COPY_FILES);
                 return true;
             default:

+ 1 - 44
src/com/owncloud/android/ui/fragment/UploadListFragment.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author LukeOwncloud
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -31,11 +31,9 @@ import android.view.ViewGroup;
 import android.widget.ExpandableListView;
 import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
 import android.widget.ListView;
-import android.widget.Toast;
 
 import com.owncloud.android.R;
 import com.owncloud.android.db.OCUpload;
-import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.adapter.ExpandableUploadListAdapter;
@@ -157,47 +155,6 @@ public class UploadListFragment extends ExpandableListFragment {
         }
     }
 
-    // TODO review if this path is really needed any time
-    @Override
-    public boolean onContextItemSelected (MenuItem item) {
-        ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();  
-        int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition);
-        int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
-        OCUpload uploadFile = (OCUpload) mAdapter.getChild(groupPosition, childPosition);
-        switch (item.getItemId()) {
-        case R.id.action_cancel_upload:
-            FileUploader.FileUploaderBinder uploaderBinder = ((FileActivity) getActivity()).getFileUploaderBinder();
-            if (uploaderBinder != null) {
-                uploaderBinder.cancel(uploadFile);
-            }
-            return true;
-//        case R.id.action_remove_upload: {
-//            ((FileActivity) getActivity()).getFileOperationsHelper().removeUploadFromList(uploadFile);
-//            return true;
-//        }case R.id.action_retry_upload: {
-//            ((FileActivity) getActivity()).getFileOperationsHelper().retryUpload(uploadFile);
-//            return true;
-//        }
-        case R.id.action_see_details: {
-            Toast.makeText(getActivity(), "TO DO", Toast.LENGTH_SHORT).show();
-            /*
-            Intent showDetailsIntent = new Intent(getActivity(), FileDisplayActivity.class);
-            showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, uploadFile.getOCFile());
-            showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, uploadFile.getAccount(getActivity()));
-            startActivity(showDetailsIntent);
-            */
-            return true;
-        }
-        case R.id.action_open_file_with: {
-            Toast.makeText(getActivity(), "TO DO", Toast.LENGTH_SHORT).show();
-            //((FileActivity) getActivity()).getFileOperationsHelper().openFile(uploadFile.getOCFile());
-            return true;
-        }
-        default:
-            return super.onContextItemSelected(item);
-        }
-    }
-
     /**
      * Interface to implement by any Activity that includes some instance of
      * UploadListFragment

+ 3 - 4
src/com/owncloud/android/ui/preview/PreviewImageActivity.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2015  ownCloud Inc.
+ *   Copyright (C) 2016  ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -31,7 +31,6 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
-import android.os.Parcelable;
 import android.support.v4.view.GravityCompat;
 import android.support.v4.view.ViewPager;
 import android.support.v4.widget.DrawerLayout;
@@ -355,7 +354,7 @@ public class PreviewImageActivity extends FileActivity implements
     public void showDetails(OCFile file) {
         Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
         showDetailsIntent.setAction(FileDisplayActivity.ACTION_DETAILS);
-        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, (Parcelable)file);
+        showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, file);
         showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT,
                 AccountUtils.getCurrentOwnCloudAccount(this));
         startActivity(showDetailsIntent);
@@ -371,7 +370,7 @@ public class PreviewImageActivity extends FileActivity implements
         } else if (!mDownloaderBinder.isDownloading(getAccount(), file)) {
             Intent i = new Intent(this, FileDownloader.class);
             i.putExtra(FileDownloader.EXTRA_ACCOUNT, getAccount());
-            i.putExtra(FileDownloader.EXTRA_FILE, (Parcelable)file);
+            i.putExtra(FileDownloader.EXTRA_FILE, file);
             startService(i);
         }
     }

+ 6 - 7
src/com/owncloud/android/ui/preview/PreviewMediaFragment.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -21,10 +21,6 @@ package com.owncloud.android.ui.preview;
 
 import android.accounts.Account;
 import android.app.Activity;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.media.MediaMetadataRetriever;
-import android.support.v7.app.AlertDialog;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.DialogInterface;
@@ -32,13 +28,16 @@ import android.content.Intent;
 import android.content.ServiceConnection;
 import android.content.res.Configuration;
 import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.media.MediaMetadataRetriever;
 import android.media.MediaPlayer;
 import android.media.MediaPlayer.OnCompletionListener;
 import android.media.MediaPlayer.OnErrorListener;
 import android.media.MediaPlayer.OnPreparedListener;
 import android.os.Bundle;
 import android.os.IBinder;
-import android.os.Parcelable;
+import android.support.v7.app.AlertDialog;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -554,7 +553,7 @@ public class PreviewMediaFragment extends FileFragment implements
     private void startFullScreenVideo() {
         Intent i = new Intent(getActivity(), PreviewVideoActivity.class);
         i.putExtra(FileActivity.EXTRA_ACCOUNT, mAccount);
-        i.putExtra(FileActivity.EXTRA_FILE, (Parcelable)getFile());
+        i.putExtra(FileActivity.EXTRA_FILE, getFile());
         i.putExtra(PreviewVideoActivity.EXTRA_AUTOPLAY, mVideoPreview.isPlaying());
         mVideoPreview.pause();
         i.putExtra(PreviewVideoActivity.EXTRA_START_POSITION, mVideoPreview.getCurrentPosition());

+ 15 - 15
src/com/owncloud/android/utils/ConnectivityUtils.java

@@ -1,20 +1,20 @@
 /**
- * ownCloud Android client application
+ *  ownCloud Android client application
  *
- * @author David A. Velasco
- * Copyright (C) 2016 ownCloud Inc.
- * <p/>
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2,
- * as published by the Free Software Foundation.
- * <p/>
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * <p/>
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *  @author David A. Velasco
+ *  Copyright (C) 2016 ownCloud Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2,
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.owncloud.android.utils;

+ 5 - 3
src/com/owncloud/android/utils/FileStorageUtils.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,
@@ -72,7 +72,8 @@ public class FileStorageUtils {
     public static final String getSavePath(String accountName) {
         File sdCard = Environment.getExternalStorageDirectory();
         return sdCard.getAbsolutePath() + "/" + MainApp.getDataFolder() + "/" + Uri.encode(accountName, "@");
-        // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B
+        // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names,
+        // that can be in the accountName since 0.1.190B
     }
 
     /**
@@ -90,7 +91,8 @@ public class FileStorageUtils {
     public static final String getTemporalPath(String accountName) {
         File sdCard = Environment.getExternalStorageDirectory();
         return sdCard.getAbsolutePath() + "/" + MainApp.getDataFolder() + "/tmp/" + Uri.encode(accountName, "@");
-            // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B
+            // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names,
+            // that can be in the accountName since 0.1.190B
     }
 
     /**

+ 19 - 0
src/com/owncloud/android/utils/MimetypeIconUtil.java

@@ -1,3 +1,22 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   Copyright (C) 2016 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
 package com.owncloud.android.utils;
 
 import android.webkit.MimeTypeMap;

+ 1 - 1
src/com/owncloud/android/utils/UploadUtils.java

@@ -2,7 +2,7 @@
  *   ownCloud Android client application
  *
  *   @author LukeOwncloud
- *   Copyright (C) 2015 ownCloud Inc.
+ *   Copyright (C) 2016 ownCloud Inc.
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License version 2,