Răsfoiți Sursa

Progress on Analytics magic

Mario Danic 8 ani în urmă
părinte
comite
9130635fa1
100 a modificat fișierele cu 1030 adăugiri și 985 ștergeri
  1. 8 0
      build.gradle
  2. 9 0
      build.gradle.modified
  3. 29 0
      src/generic/java/com/owncloud/android/utils/AnalyticsUtils.java
  4. 0 2
      src/main/AndroidManifest.xml
  5. 4 22
      src/main/java/com/owncloud/android/MainApp.java
  6. 2 1
      src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java
  7. 23 21
      src/main/java/com/owncloud/android/db/OCUpload.java
  8. 5 3
      src/main/java/com/owncloud/android/db/PreferenceManager.java
  9. 20 21
      src/main/java/com/owncloud/android/db/ProviderMeta.java
  10. 15 15
      src/main/java/com/owncloud/android/db/UploadResult.java
  11. 15 16
      src/main/java/com/owncloud/android/files/BootupBroadcastReceiver.java
  12. 35 36
      src/main/java/com/owncloud/android/files/FileMenuFilter.java
  13. 16 16
      src/main/java/com/owncloud/android/files/InstantUploadBroadcastReceiver.java
  14. 68 69
      src/main/java/com/owncloud/android/media/MediaControlView.java
  15. 120 120
      src/main/java/com/owncloud/android/media/MediaService.java
  16. 25 26
      src/main/java/com/owncloud/android/media/MediaServiceBinder.java
  17. 8 8
      src/main/java/com/owncloud/android/operations/DownloadFileOperation.java
  18. 9 9
      src/main/java/com/owncloud/android/operations/OAuth2GetAccessToken.java
  19. 0 2
      src/main/java/com/owncloud/android/operations/UnshareOperation.java
  20. 5 5
      src/main/java/com/owncloud/android/services/observer/FileObserverService.java
  21. 8 8
      src/main/java/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java
  22. 14 14
      src/main/java/com/owncloud/android/ui/CheckBoxPreferenceWithLongTitle.java
  23. 14 15
      src/main/java/com/owncloud/android/ui/CustomPopup.java
  24. 14 15
      src/main/java/com/owncloud/android/ui/ExtendedListView.java
  25. 16 16
      src/main/java/com/owncloud/android/ui/NavigationDrawerItem.java
  26. 14 14
      src/main/java/com/owncloud/android/ui/PreferenceWithLongSummary.java
  27. 13 14
      src/main/java/com/owncloud/android/ui/RadioButtonPreference.java
  28. 11 12
      src/main/java/com/owncloud/android/ui/SquareImageView.java
  29. 11 12
      src/main/java/com/owncloud/android/ui/SquareLinearLayout.java
  30. 4 4
      src/main/java/com/owncloud/android/ui/TextDrawable.java
  31. 1 1
      src/main/java/com/owncloud/android/ui/activity/ComponentsGetter.java
  32. 4 4
      src/main/java/com/owncloud/android/ui/activity/CopyToClipboardActivity.java
  33. 1 2
      src/main/java/com/owncloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java
  34. 0 1
      src/main/java/com/owncloud/android/ui/activity/FileActivity.java
  35. 1 2
      src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java
  36. 1 1
      src/main/java/com/owncloud/android/ui/activity/FolderSyncActivity.java
  37. 1 2
      src/main/java/com/owncloud/android/ui/activity/GenericExplanationActivity.java
  38. 1 2
      src/main/java/com/owncloud/android/ui/activity/LogHistoryActivity.java
  39. 1 1
      src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java
  40. 1 2
      src/main/java/com/owncloud/android/ui/activity/ManageSpaceActivity.java
  41. 1 2
      src/main/java/com/owncloud/android/ui/activity/ParticipateActivity.java
  42. 1 2
      src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java
  43. 1 1
      src/main/java/com/owncloud/android/ui/activity/Preferences.java
  44. 1 1
      src/main/java/com/owncloud/android/ui/activity/StorageMigration.java
  45. 1 2
      src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java
  46. 1 2
      src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java
  47. 1 2
      src/main/java/com/owncloud/android/ui/activity/UploadPathActivity.java
  48. 1 1
      src/main/java/com/owncloud/android/ui/activity/WhatsNewActivity.java
  49. 3 3
      src/main/java/com/owncloud/android/ui/adapter/CertificateCombinedExceptionViewAdapter.java
  50. 8 8
      src/main/java/com/owncloud/android/ui/adapter/DiskLruImageCache.java
  51. 6 5
      src/main/java/com/owncloud/android/ui/adapter/SslCertificateViewAdapter.java
  52. 3 2
      src/main/java/com/owncloud/android/ui/adapter/SslErrorViewAdapter.java
  53. 7 7
      src/main/java/com/owncloud/android/ui/adapter/X509CertificateViewAdapter.java
  54. 1 1
      src/main/java/com/owncloud/android/ui/dialog/ChangelogDialog.java
  55. 1 1
      src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java
  56. 1 1
      src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java
  57. 6 6
      src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java
  58. 5 5
      src/main/java/com/owncloud/android/ui/dialog/CredentialsDialogFragment.java
  59. 2 2
      src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.java
  60. 2 1
      src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java
  61. 1 1
      src/main/java/com/owncloud/android/ui/dialog/SamlWebViewDialog.java
  62. 6 6
      src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.java
  63. 1 1
      src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java
  64. 5 5
      src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.java
  65. 13 14
      src/main/java/com/owncloud/android/ui/dialog/SslValidatorDialog.java
  66. 1 1
      src/main/java/com/owncloud/android/ui/dialog/UploadSourceDialogFragment.java
  67. 3 3
      src/main/java/com/owncloud/android/ui/errorhandling/ExceptionHandler.java
  68. 1 2
      src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java
  69. 1 1
      src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java
  70. 1 2
      src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java
  71. 1 1
      src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java
  72. 1 2
      src/main/java/com/owncloud/android/ui/fragment/SearchShareesFragment.java
  73. 1 2
      src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java
  74. 1 2
      src/main/java/com/owncloud/android/ui/fragment/UploadListFragment.java
  75. 0 3
      src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java
  76. 5 3
      src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java
  77. 5 6
      src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java
  78. 1 3
      src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java
  79. 7 7
      src/main/java/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java
  80. 1 2
      src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java
  81. 1 2
      src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java
  82. 1 2
      src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.java
  83. 61 76
      src/main/java/com/owncloud/android/utils/BitmapUtils.java
  84. 17 17
      src/main/java/com/owncloud/android/utils/ConnectivityUtils.java
  85. 12 13
      src/main/java/com/owncloud/android/utils/DialogMenuItem.java
  86. 28 27
      src/main/java/com/owncloud/android/utils/DisplayUtils.java
  87. 18 19
      src/main/java/com/owncloud/android/utils/ErrorMessageAdapter.java
  88. 53 54
      src/main/java/com/owncloud/android/utils/FileStorageUtils.java
  89. 14 17
      src/main/java/com/owncloud/android/utils/GetShareWithUsersAsyncTask.java
  90. 11 12
      src/main/java/com/owncloud/android/utils/MimeType.java
  91. 12 13
      src/main/java/com/owncloud/android/utils/MimeTypeUtil.java
  92. 13 14
      src/main/java/com/owncloud/android/utils/OwnCloudSession.java
  93. 1 2
      src/main/java/com/owncloud/android/utils/PermissionUtil.java
  94. 12 13
      src/main/java/com/owncloud/android/utils/UploadUtils.java
  95. 24 26
      src/main/java/com/owncloud/android/utils/UriUtils.java
  96. 18 19
      src/main/java/com/owncloud/android/widgets/ActionEditText.java
  97. 2 2
      src/main/res/values/setup.xml
  98. 4 1
      src/modified/AndroidManifest.xml
  99. 40 0
      src/modified/java/com/owncloud/android/ModifiedMainApp.java
  100. 32 0
      src/modified/java/com/owncloud/android/utils/AnalyticsUtils.java

+ 8 - 0
build.gradle

@@ -78,10 +78,12 @@ android {
         // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
 
         productFlavors {
+            // used for f-droid
             generic {
                 applicationId 'com.nextcloud.client'
             }
 
+            // both need .modified gradle file in place of the regular one
             modified {
                 // structure is:
                 // domain tld
@@ -89,6 +91,12 @@ android {
                 // .client
                 applicationId 'com.custom.client'
             }
+
+            zstore {
+                applicationId 'com.nextcloud.client'
+            }
+
+
         }
 
         configurations {

+ 9 - 0
build.gradle.modified

@@ -78,10 +78,12 @@ android {
         // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
 
         productFlavors {
+            // used for f-droid
             generic {
                 applicationId 'com.nextcloud.client'
             }
 
+            // both need .modified gradle file in place of the regular one
             modified {
                 // structure is:
                 // domain tld
@@ -89,6 +91,12 @@ android {
                 // .client
                 applicationId 'com.custom.client'
             }
+
+            zstore {
+                applicationId 'com.nextcloud.client'
+            }
+
+
         }
 
         configurations {
@@ -191,6 +199,7 @@ dependencies {
     annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
     compile 'org.greenrobot:eventbus:3.0.0'
     compile 'com.googlecode.ez-vcard:ez-vcard:0.10.2'
+
     compile 'com.google.android.gms:play-services:10.2.1'
 
     compile 'org.parceler:parceler-api:1.1.6'

+ 29 - 0
src/generic/java/com/owncloud/android/utils/AnalyticsUtils.java

@@ -0,0 +1,29 @@
+/**
+ * Nextcloud Android client application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils;
+
+import android.app.Activity;
+
+public class AnalyticsUtils {
+    public static void setCurrentScreenName(Activity activity, String s, String s1) {
+        // do nothing
+    }
+
+}

+ 0 - 2
src/main/AndroidManifest.xml

@@ -263,8 +263,6 @@
 
         <service android:name=".services.observer.FileObserverService" />
 
-        <service android:name="com.evernote.android.job.gcm.PlatformGcmService" tools:node="remove"/>
-
         <activity
             android:name=".ui.activity.CopyToClipboardActivity"
             android:icon="@drawable/copy_link"

+ 4 - 22
src/main/java/com/owncloud/android/MainApp.java

@@ -34,7 +34,6 @@ import android.support.multidex.MultiDexApplication;
 import android.support.v4.util.Pair;
 
 import com.evernote.android.job.JobManager;
-import com.google.firebase.analytics.FirebaseAnalytics;
 import com.owncloud.android.authentication.PassCodeManager;
 import com.owncloud.android.datamodel.SyncedFolder;
 import com.owncloud.android.datamodel.SyncedFolderProvider;
@@ -81,8 +80,6 @@ public class MainApp extends MultiDexApplication {
 
     private static SyncedFolderObserverService mObserverService;
 
-    private static FirebaseAnalytics firebaseAnalytics;
-
     @SuppressWarnings("unused")
     private boolean mBound;
 
@@ -91,13 +88,6 @@ public class MainApp extends MultiDexApplication {
         super.onCreate();
         JobManager.create(this).addJobCreator(new NCJobCreator());
         MainApp.mContext = getApplicationContext();
-
-        firebaseAnalytics = FirebaseAnalytics.getInstance(this);
-
-        if (!getResources().getBoolean(R.bool.analytics_enabled)) {
-            firebaseAnalytics.setAnalyticsCollectionEnabled(false);
-        }
-
         SharedPreferences appPrefs =
                 PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
         MainApp.storagePath = appPrefs.getString(Preferences.PreferenceKeys.STORAGE_PATH, Environment.
@@ -287,6 +277,7 @@ public class MainApp extends MultiDexApplication {
             syncedFolderProvider.updateAutoUploadPaths(mContext);
         }
     }
+
     private void cleanOldEntries() {
         // previous versions of application created broken entries in the SyncedFolderProvider
         // database, and this cleans all that and leaves 1 (newest) entry per synced folder
@@ -321,7 +312,9 @@ public class MainApp extends MultiDexApplication {
         }
     }
 
-    /** Defines callbacks for service binding, passed to bindService() */
+    /**
+     * Defines callbacks for service binding, passed to bindService()
+     */
     private ServiceConnection syncedFolderObserverServiceConnection = new ServiceConnection() {
 
         @Override
@@ -338,15 +331,4 @@ public class MainApp extends MultiDexApplication {
         }
     };
 
-    public static FirebaseAnalytics getFirebaseAnalyticsInstance() {
-        /*
-        In order for Firebase Analytics to work, you also need to
-        put a proper google-services.json in src/custom folder
-
-        If that file is flawed, nothing will be sent to Firebase
-         */
-        return firebaseAnalytics;
-    }
-
-
 }

+ 2 - 1
src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -113,6 +113,7 @@ import com.owncloud.android.ui.dialog.IndeterminateProgressDialog;
 import com.owncloud.android.ui.dialog.SamlWebViewDialog;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.DisplayUtils;
 
 import java.security.cert.X509Certificate;
@@ -804,7 +805,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     protected void onResume() {
         super.onResume();
 
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
 
         if (!webViewLoginMethod) {
             // bound here to avoid spurious changes triggered by Android on device rotations

+ 23 - 21
src/main/java/com/owncloud/android/db/OCUpload.java

@@ -1,23 +1,22 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author LukeOwncloud
- *   @author masensio
- *   @author David A. Velasco
- *   Copyright (C) 2016 ownCloud Inc.
+ * @author LukeOwncloud
+ * @author masensio
+ * @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 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/>.
+ * 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.db;
@@ -41,7 +40,7 @@ import java.io.File;
 /**
  * Stores all information in order to start upload operations. PersistentUploadObject can
  * be stored persistently by {@link UploadsStorageManager}.
- * 
+ *
  */
 public class OCUpload implements Parcelable {
 
@@ -158,6 +157,7 @@ public class OCUpload implements Parcelable {
     public void setUploadId(long id) {
         mId = id;
     }
+
     public long getUploadId() {
         return mId;
     }
@@ -220,7 +220,7 @@ public class OCUpload implements Parcelable {
 
 
     /**
-     * @return  File size
+     * @return File size
      */
     public long getFileSize() {
         return mFileSize;
@@ -306,7 +306,7 @@ public class OCUpload implements Parcelable {
         mUploadEndTimeStamp = uploadEndTimestamp;
     }
 
-    public long getUploadEndTimestamp(){
+    public long getUploadEndTimestamp() {
         return mUploadEndTimeStamp;
     }
 
@@ -318,8 +318,8 @@ public class OCUpload implements Parcelable {
             String localPath = getLocalPath() != null ? getLocalPath() : "";
             return localPath + " status:" + getUploadStatus() + " result:" +
                     (getLastResult() == null ? "null" : getLastResult().getValue());
-        } catch (NullPointerException e){
-            Log_OC.d(TAG, "Exception " + e.toString() );
+        } catch (NullPointerException e) {
+            Log_OC.d(TAG, "Exception " + e.toString());
             return (e.toString());
         }
     }
@@ -392,6 +392,8 @@ public class OCUpload implements Parcelable {
         dest.writeInt(mCreatedBy);
     }
 
-    enum CanUploadFileNowStatus {NOW, LATER, FILE_GONE, ERROR};
+    enum CanUploadFileNowStatus {NOW, LATER, FILE_GONE, ERROR}
+
+    ;
 
 }

+ 5 - 3
src/main/java/com/owncloud/android/db/PreferenceManager.java

@@ -97,9 +97,11 @@ public abstract class PreferenceManager {
     public static boolean instantVideoUploadViaWiFiOnly(Context context) {
         return getDefaultSharedPreferences(context).getBoolean(PREF__INSTANT_VIDEO_UPLOAD_ON_WIFI, false);
     }
+
     public static boolean instantPictureUploadWhenChargingOnly(Context context) {
         return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_upload_on_charging", false);
     }
+
     public static boolean instantVideoUploadWhenChargingOnly(Context context) {
         return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_video_upload_on_charging", false);
     }
@@ -237,7 +239,7 @@ public abstract class PreferenceManager {
     /**
      * Saves the legacy cleaning flag which the user has set last.
      *
-     * @param context   Caller {@link Context}, used to access to shared preferences manager.
+     * @param context     Caller {@link Context}, used to access to shared preferences manager.
      * @param legacyClean flag if it is a legacy cleaning
      */
     public static void setLegacyClean(Context context, boolean legacyClean) {
@@ -247,7 +249,7 @@ public abstract class PreferenceManager {
     /**
      * Saves the legacy cleaning flag which the user has set last.
      *
-     * @param context   Caller {@link Context}, used to access to shared preferences manager.
+     * @param context    Caller {@link Context}, used to access to shared preferences manager.
      * @param pathUpdate flag if it is a auto upload path update
      */
     public static void setAutoUploadPathsUpdate(Context context, boolean pathUpdate) {
@@ -268,7 +270,7 @@ public abstract class PreferenceManager {
     /**
      * Saves the uploader behavior which the user has set last.
      *
-     * @param context   Caller {@link Context}, used to access to shared preferences manager.
+     * @param context           Caller {@link Context}, used to access to shared preferences manager.
      * @param uploaderBehaviour the uploader behavior
      */
     public static void setUploaderBehaviour(Context context, int uploaderBehaviour) {

+ 20 - 21
src/main/java/com/owncloud/android/db/ProviderMeta.java

@@ -1,24 +1,23 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author Bartek Przybylski
- *   @author David A. Velasco
- *   @author masensio
- *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2016 ownCloud Inc.
+ * @author Bartek Przybylski
+ * @author David A. Velasco
+ * @author masensio
+ * 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 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/>.
+ * 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.db;
 
@@ -89,13 +88,13 @@ public class ProviderMeta {
         public static final String FILE_PERMISSIONS = "permissions";
         public static final String FILE_REMOTE_ID = "remote_id";
         public static final String FILE_UPDATE_THUMBNAIL = "update_thumbnail";
-        public static final String FILE_IS_DOWNLOADING= "is_downloading";
+        public static final String FILE_IS_DOWNLOADING = "is_downloading";
         public static final String FILE_ETAG_IN_CONFLICT = "etag_in_conflict";
         public static final String FILE_FAVORITE = "favorite";
 
         public static final String FILE_DEFAULT_SORT_ORDER = FILE_NAME
                 + " collate nocase asc";
-        
+
         // Columns of ocshares table
         public static final String OCSHARES_FILE_SOURCE = "file_source";
         public static final String OCSHARES_ITEM_SOURCE = "item_source";
@@ -111,8 +110,8 @@ public class ProviderMeta {
         public static final String OCSHARES_USER_ID = "user_id";
         public static final String OCSHARES_ID_REMOTE_SHARED = "id_remote_shared";
         public static final String OCSHARES_ACCOUNT_OWNER = "owner_share";
-        
-        public static final String OCSHARES_DEFAULT_SORT_ORDER = OCSHARES_FILE_SOURCE 
+
+        public static final String OCSHARES_DEFAULT_SORT_ORDER = OCSHARES_FILE_SOURCE
                 + " collate nocase asc";
 
         // Columns of capabilities table
@@ -160,7 +159,7 @@ public class ProviderMeta {
         public static final String UPLOADS_UPLOAD_END_TIMESTAMP = "upload_end_timestamp";
         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 = ProviderTableMeta._ID  + " collate nocase desc";
+        public static final String UPLOADS_DEFAULT_SORT_ORDER = ProviderTableMeta._ID + " collate nocase desc";
 
         // Columns of synced folder table
         public static final String SYNCED_FOLDER_LOCAL_PATH = "local_path";

+ 15 - 15
src/main/java/com/owncloud/android/db/UploadResult.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author masensio
- *   Copyright (C) 2016 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,
- *   as published by the Free Software Foundation.
+ * 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/>.
+ * 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.db;
@@ -46,6 +45,7 @@ public enum UploadResult {
     public int getValue() {
         return value;
     }
+
     public static UploadResult fromValue(int value) {
         switch (value) {
             case -1:
@@ -78,9 +78,9 @@ public enum UploadResult {
         return null;
     }
 
-    public static UploadResult fromOperationResult(RemoteOperationResult result){
+    public static UploadResult fromOperationResult(RemoteOperationResult result) {
         // messy :(
-        switch (result.getCode()){
+        switch (result.getCode()) {
             case OK:
                 return UPLOADED;
             case NO_NETWORK_CONNECTION:

+ 15 - 16
src/main/java/com/owncloud/android/files/BootupBroadcastReceiver.java

@@ -1,22 +1,21 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author David A. Velasco
- *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author David A. Velasco
+ * 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 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/>.
+ * 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;
@@ -36,12 +35,12 @@ import com.owncloud.android.services.observer.FileObserverService;
 public class BootupBroadcastReceiver extends BroadcastReceiver {
 
     private static final String TAG = BootupBroadcastReceiver.class.getSimpleName();
-    
+
     /**
      * Receives broadcast intent reporting that the system was just boot up.
      *
      * Starts {@link FileObserverService} to enable observation of favourite files.
-     * 
+     *
      * @param   context     The context where the receiver is running.
      * @param   intent      The intent received.
      */

+ 35 - 36
src/main/java/com/owncloud/android/files/FileMenuFilter.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author David A. Velasco
+ * 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 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/>.
+ * 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;
@@ -118,7 +117,7 @@ public class FileMenuFilter {
 
     private void hideAll(Menu menu) {
         MenuItem item;
-        for (int i=0; i<menu.size(); i++) {
+        for (int i = 0; i < menu.size(); i++) {
             item = menu.getItem(i);
             item.setVisible(false);
             item.setEnabled(false);
@@ -134,7 +133,7 @@ public class FileMenuFilter {
      * @param toShow            List to save the options that must be shown in the menu.
      * @param toHide            List to save the options that must be shown in the menu.
      */
-    private void filter(List<Integer> toShow, List <Integer> toHide) {
+    private void filter(List<Integer> toShow, List<Integer> toHide) {
         boolean synchronizing = anyFileSynchronizing();
 
         /// decision is taken for each possible action on a file in the menu
@@ -197,13 +196,13 @@ public class FileMenuFilter {
         }
 
         // SHARE FILE
-        boolean shareViaLinkAllowed = (mContext != null  &&
+        boolean shareViaLinkAllowed = (mContext != null &&
                 mContext.getResources().getBoolean(R.bool.share_via_link_feature));
-        boolean shareWithUsersAllowed = (mContext != null  &&
+        boolean shareWithUsersAllowed = (mContext != null &&
                 mContext.getResources().getBoolean(R.bool.share_with_users_feature));
 
         OCCapability capability = mComponentsGetter.getStorageManager().getCapability(mAccount.name);
-        boolean shareApiEnabled  = capability != null &&
+        boolean shareApiEnabled = capability != null &&
                 (capability.getFilesSharingApiEnabled().isTrue() ||
                         capability.getFilesSharingApiEnabled().isUnknown()
                 );
@@ -267,9 +266,9 @@ public class FileMenuFilter {
             FileUploaderBinder uploaderBinder = mComponentsGetter.getFileUploaderBinder();
             FileDownloaderBinder downloaderBinder = mComponentsGetter.getFileDownloaderBinder();
             synchronizing = (
-                anyFileSynchronizing(opsBinder) ||      // comparing local and remote
-                anyFileDownloading(downloaderBinder) ||
-                anyFileUploading(uploaderBinder)
+                    anyFileSynchronizing(opsBinder) ||      // comparing local and remote
+                            anyFileDownloading(downloaderBinder) ||
+                            anyFileUploading(uploaderBinder)
             );
         }
         return synchronizing;
@@ -278,7 +277,7 @@ public class FileMenuFilter {
     private boolean anyFileSynchronizing(OperationsServiceBinder opsBinder) {
         boolean synchronizing = false;
         if (opsBinder != null) {
-            for (Iterator<OCFile> iterator = mFiles.iterator(); !synchronizing && iterator.hasNext();) {
+            for (Iterator<OCFile> iterator = mFiles.iterator(); !synchronizing && iterator.hasNext(); ) {
                 synchronizing = opsBinder.isSynchronizing(mAccount, iterator.next());
             }
         }
@@ -288,7 +287,7 @@ public class FileMenuFilter {
     private boolean anyFileDownloading(FileDownloaderBinder downloaderBinder) {
         boolean downloading = false;
         if (downloaderBinder != null) {
-            for (Iterator<OCFile> iterator = mFiles.iterator(); !downloading && iterator.hasNext();) {
+            for (Iterator<OCFile> iterator = mFiles.iterator(); !downloading && iterator.hasNext(); ) {
                 downloading = downloaderBinder.isDownloading(mAccount, iterator.next());
             }
         }
@@ -298,7 +297,7 @@ public class FileMenuFilter {
     private boolean anyFileUploading(FileUploaderBinder uploaderBinder) {
         boolean uploading = false;
         if (uploaderBinder != null) {
-            for (Iterator<OCFile> iterator = mFiles.iterator(); !uploading && iterator.hasNext();) {
+            for (Iterator<OCFile> iterator = mFiles.iterator(); !uploading && iterator.hasNext(); ) {
                 uploading = uploaderBinder.isUploading(mAccount, iterator.next());
             }
         }
@@ -318,8 +317,8 @@ public class FileMenuFilter {
     }
 
     private boolean containsFolder() {
-        for(OCFile file: mFiles) {
-            if(file.isFolder()) {
+        for (OCFile file : mFiles) {
+            if (file.isFolder()) {
                 return true;
             }
         }
@@ -327,8 +326,8 @@ public class FileMenuFilter {
     }
 
     private boolean anyFileDown() {
-        for(OCFile file: mFiles) {
-            if(file.isDown()) {
+        for (OCFile file : mFiles) {
+            if (file.isDown()) {
                 return true;
             }
         }
@@ -336,8 +335,8 @@ public class FileMenuFilter {
     }
 
     private boolean allKeptAvailableOffline() {
-        for(OCFile file: mFiles) {
-            if(!file.isAvailableOffline()) {
+        for (OCFile file : mFiles) {
+            if (!file.isAvailableOffline()) {
                 return false;
             }
         }
@@ -345,8 +344,8 @@ public class FileMenuFilter {
     }
 
     private boolean allFavorites() {
-        for(OCFile file: mFiles) {
-            if(!file.getIsFavorite()) {
+        for (OCFile file : mFiles) {
+            if (!file.getIsFavorite()) {
                 return false;
             }
         }
@@ -354,8 +353,8 @@ public class FileMenuFilter {
     }
 
     private boolean allNotFavorites() {
-        for(OCFile file: mFiles) {
-            if(file.getIsFavorite()) {
+        for (OCFile file : mFiles) {
+            if (file.getIsFavorite()) {
                 return false;
             }
         }
@@ -363,8 +362,8 @@ public class FileMenuFilter {
     }
 
     private boolean allNotKeptAvailableOffline() {
-        for(OCFile file: mFiles) {
-            if(file.isAvailableOffline()) {
+        for (OCFile file : mFiles) {
+            if (file.isAvailableOffline()) {
                 return false;
             }
         }

+ 16 - 16
src/main/java/com/owncloud/android/files/InstantUploadBroadcastReceiver.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) 2016 ownCloud Inc.
+ * @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 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.
+ * 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/>.
+ * 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;
@@ -103,7 +103,7 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
         }
 
         String[] CONTENT_PROJECTION = {
-                Images.Media.DATA, Images.Media.DISPLAY_NAME, Images.Media.MIME_TYPE, Images.Media.SIZE };
+                Images.Media.DATA, Images.Media.DISPLAY_NAME, Images.Media.MIME_TYPE, Images.Media.SIZE};
 
         int permissionCheck = ContextCompat.checkSelfPermission(context,
                 Manifest.permission.READ_EXTERNAL_STORAGE);
@@ -136,7 +136,7 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
 
         int behaviour = getUploadBehaviour(context);
         Boolean subfolderByDate = PreferenceManager.instantPictureUploadPathUseSubfolders(context);
-            SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
+        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
         String uploadPathdef = context.getString(R.string.instant_upload_path);
         String uploadPath = pref.getString("instant_upload_path", uploadPathdef);
 

+ 68 - 69
src/main/java/com/owncloud/android/media/MediaControlView.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author David A. Velasco
+ * 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 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/>.
+ * 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.media;
 
@@ -48,31 +47,31 @@ import java.util.Locale;
 
 /**
  * View containing controls for a {@link MediaPlayer}. 
- * 
+ *
  * Holds buttons "play / pause", "rewind", "fast forward" 
  * and a progress slider. 
- * 
+ *
  * It synchronizes itself with the state of the 
  * {@link MediaPlayer}.
  */
 
 public class MediaControlView extends FrameLayout /* implements OnLayoutChangeListener, OnTouchListener */ implements OnClickListener, OnSeekBarChangeListener {
 
-    private MediaPlayerControl  mPlayer;
-    private Context             mContext;
-    private View                mRoot;
-    private ProgressBar         mProgress;
-    private TextView            mEndTime, mCurrentTime;
-    private boolean             mDragging;
-    private static final int    SHOW_PROGRESS = 1;
-    private ImageButton         mPauseButton;
-    private ImageButton         mFfwdButton;
-    private ImageButton         mRewButton;
-    
+    private MediaPlayerControl mPlayer;
+    private Context mContext;
+    private View mRoot;
+    private ProgressBar mProgress;
+    private TextView mEndTime, mCurrentTime;
+    private boolean mDragging;
+    private static final int SHOW_PROGRESS = 1;
+    private ImageButton mPauseButton;
+    private ImageButton mFfwdButton;
+    private ImageButton mRewButton;
+
     public MediaControlView(Context context, AttributeSet attrs) {
         super(context, attrs);
         mContext = context;
-        
+
         FrameLayout.LayoutParams frameParams = new FrameLayout.LayoutParams(
                 ViewGroup.LayoutParams.MATCH_PARENT,
                 ViewGroup.LayoutParams.MATCH_PARENT
@@ -81,7 +80,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
         mRoot = inflate.inflate(R.layout.media_control, null);
         initControllerView(mRoot);
         addView(mRoot, frameParams);
-        
+
         setFocusable(true);
         setFocusableInTouchMode(true);
         setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
@@ -189,15 +188,15 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
             return false;
     }
     */
-    
-    
+
+
     public void setMediaPlayer(MediaPlayerControl player) {
         mPlayer = player;
         mHandler.sendEmptyMessage(SHOW_PROGRESS);
         updatePausePlay();
     }
 
-    
+
     private void initControllerView(View v) {
         mPauseButton = (ImageButton) v.findViewById(R.id.playBtn);
         if (mPauseButton != null) {
@@ -231,7 +230,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
         mCurrentTime = (TextView) v.findViewById(R.id.currentTimeText);
     }
 
-    
+
     /**
      * Disable pause or seek buttons if the stream cannot be paused or seeked.
      * This requires the control interface to be a MediaPlayerControlExt
@@ -254,8 +253,8 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
             // the buttons.
         }
     }
-    
-    
+
+
     private Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
@@ -275,7 +274,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
 
         int seconds = totalSeconds % 60;
         int minutes = (totalSeconds / 60) % 60;
-        int hours   = totalSeconds / 3600;
+        int hours = totalSeconds / 3600;
 
         final StringBuilder mFormatBuilder = new StringBuilder();
         final Formatter mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
@@ -296,7 +295,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
             if (duration > 0) {
                 // use long to avoid overflow
                 long pos = 1000L * position / duration;
-                mProgress.setProgress( (int) pos);
+                mProgress.setProgress((int) pos);
             }
             int percent = mPlayer.getBufferPercentage();
             mProgress.setSecondaryProgress(percent * 10);
@@ -310,14 +309,14 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
         }
         return position;
     }
-    
+
 
     @Override
     public boolean dispatchKeyEvent(KeyEvent event) {
         int keyCode = event.getKeyCode();
         final boolean uniqueDown = event.getRepeatCount() == 0
                 && event.getAction() == KeyEvent.ACTION_DOWN;
-        if (keyCode ==  KeyEvent.KEYCODE_HEADSETHOOK
+        if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
                 || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
                 || keyCode == KeyEvent.KEYCODE_SPACE) {
             if (uniqueDown) {
@@ -393,34 +392,34 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
         int pos;
         boolean playing = mPlayer.isPlaying();
         switch (v.getId()) {
-        
-        case R.id.playBtn: 
-            doPauseResume();
-            break;
-
-        case R.id.rewindBtn:
-            pos = mPlayer.getCurrentPosition();
-            pos -= 5000;
-            mPlayer.seekTo(pos);
-            if (!playing) {
-                mPlayer.pause();  // necessary in some 2.3.x devices
-            }
-            setProgress();
-            break;
-
-        case R.id.forwardBtn:
-            pos = mPlayer.getCurrentPosition();
-            pos += 15000;
-            mPlayer.seekTo(pos);
-            if (!playing) {
-                mPlayer.pause(); // necessary in some 2.3.x devices
-            }
-            setProgress();
-            break;
+
+            case R.id.playBtn:
+                doPauseResume();
+                break;
+
+            case R.id.rewindBtn:
+                pos = mPlayer.getCurrentPosition();
+                pos -= 5000;
+                mPlayer.seekTo(pos);
+                if (!playing) {
+                    mPlayer.pause();  // necessary in some 2.3.x devices
+                }
+                setProgress();
+                break;
+
+            case R.id.forwardBtn:
+                pos = mPlayer.getCurrentPosition();
+                pos += 15000;
+                mPlayer.seekTo(pos);
+                if (!playing) {
+                    mPlayer.pause(); // necessary in some 2.3.x devices
+                }
+                setProgress();
+                break;
         }
     }
-    
-    
+
+
     @Override
     public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
         if (!fromUser) {
@@ -431,16 +430,16 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
 
         long duration = mPlayer.getDuration();
         long newposition = (duration * progress) / 1000L;
-        mPlayer.seekTo( (int) newposition);
+        mPlayer.seekTo((int) newposition);
         if (mCurrentTime != null) {
             mCurrentTime.setText(stringForTime((int) newposition));
         }
     }
-    
+
     /**
      * Called in devices with touchpad when the user starts to adjust the 
      * position of the seekbar's thumb.
-     * 
+     *
      * Will be followed by several onProgressChanged notifications.
      */
     @Override
@@ -449,7 +448,7 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
         mHandler.removeMessages(SHOW_PROGRESS);     // grants no more updates with media player progress while dragging 
     }
 
-    
+
     /**
      * Called in devices with touchpad when the user finishes the
      * adjusting of the seekbar.
@@ -473,5 +472,5 @@ public class MediaControlView extends FrameLayout /* implements OnLayoutChangeLi
         super.onInitializeAccessibilityNodeInfo(info);
         info.setClassName(MediaControlView.class.getName());
     }
-    
+
 }

+ 120 - 120
src/main/java/com/owncloud/android/media/MediaService.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author David A. Velasco
- *   Copyright (C) 2016 ownCloud Inc.
+ * @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 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/>.
+ * 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.media;
@@ -49,18 +48,18 @@ import java.io.IOException;
 
 /**
  * Service that handles media playback, both audio and video. 
- * 
+ *
  * Waits for Intents which signal the service to perform specific operations: Play, Pause,
  * Rewind, etc.
  */
 public class MediaService extends Service implements OnCompletionListener, OnPreparedListener,
-                OnErrorListener, AudioManager.OnAudioFocusChangeListener {
+        OnErrorListener, AudioManager.OnAudioFocusChangeListener {
 
     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";
-    
+
     /// Intent actions that we are prepared to handle
     public static final String ACTION_PLAY_FILE = MY_PACKAGE + ".action.PLAY_FILE";
     public static final String ACTION_STOP_ALL = MY_PACKAGE + ".action.STOP_ALL";
@@ -77,49 +76,51 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
     /** Time To keep the control panel visible when the user does not use it */
     public static final int MEDIA_CONTROL_SHORT_LIFE = 4000;
-    
+
     /** Time To keep the control panel visible when the user does not use it */
     public static final int MEDIA_CONTROL_PERMANENT = 0;
-    
+
     /** Volume to set when audio focus is lost and ducking is allowed */
     private static final float DUCK_VOLUME = 0.1f;
 
     /** Media player instance */
     private MediaPlayer mPlayer = null;
-    
+
     /** Reference to the system AudioManager */
     private AudioManager mAudioManager = null;
 
-    
+
     /** Values to indicate the state of the service */
     enum State {
         STOPPED,
-        PREPARING,      
-        PLAYING,        
-        PAUSED 
-    };
-    
+        PREPARING,
+        PLAYING,
+        PAUSED
+    }
+
+    ;
+
 
     /** Current state */
     private State mState = State.STOPPED;
-    
+
     /** Possible focus values */
     enum AudioFocus {
-        NO_FOCUS,            
-        NO_FOCUS_CAN_DUCK,   
-        FOCUS           
+        NO_FOCUS,
+        NO_FOCUS_CAN_DUCK,
+        FOCUS
     }
-    
+
     /** Current focus state */
     private AudioFocus mAudioFocus = AudioFocus.NO_FOCUS;
-    
+
 
     /** 'True' when the current song is streaming from the network */
     private boolean mIsStreaming = false;
 
     /** Wifi lock kept to prevents the device from shutting off the radio when streaming a file. */
     private WifiLock mWifiLock;
-    
+
     private static final String MEDIA_WIFI_LOCK_TAG = MY_PACKAGE + ".WIFI_LOCK";
 
     /** Notification to keep in the notification bar while a song is playing */
@@ -127,16 +128,16 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
     /** File being played */
     private OCFile mFile;
-    
+
     /** Account holding the file being played */
     private Account mAccount;
 
-    /** Flag signaling if the audio should be played immediately when the file is prepared */ 
+    /** Flag signaling if the audio should be played immediately when the file is prepared */
     protected boolean mPlayOnPrepared;
 
     /** Position, in miliseconds, where the audio should be started */
     private int mStartPosition;
-    
+
     /** Interface to access the service through binding */
     private IBinder mBinder;
 
@@ -145,21 +146,21 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
     /** Notification builder to create notifications, new reuse way since Android 6 */
     private NotificationCompat.Builder mNotificationBuilder;
-    
+
     /**
      * Helper method to get an error message suitable to show to users for errors occurred in media playback,
-     * 
+     *
      * @param context   A context to access string resources.
      * @param what      See {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)
      * @param extra     See {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)
-     * @return          Message suitable to users.
+     * @return Message suitable to users.
      */
     public static String getMessageForMediaError(Context context, int what, int extra) {
         int messageId;
-        
+
         if (what == OC_MEDIA_ERROR) {
             messageId = extra;
-                
+
         } else if (extra == MediaPlayer.MEDIA_ERROR_UNSUPPORTED) {
             /*  Added in API level 17
                 Bitstream is conforming to the related coding standard or file spec,
@@ -174,14 +175,14 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
                 Constant Value: -1004 (0xfffffc14) 
              */
             messageId = R.string.media_err_io;
-            
+
         } else if (extra == MediaPlayer.MEDIA_ERROR_MALFORMED) {
             /*  Added in API level 17
                 Bitstream is not conforming to the related coding standard or file spec.
                 Constant Value: -1007 (0xfffffc11) 
              */
             messageId = R.string.media_err_malformed;
-            
+
         } else if (extra == MediaPlayer.MEDIA_ERROR_TIMED_OUT) {
             /*  Added in API level 17
                 Some operation takes too long to complete, usually more than 3-5 seconds.
@@ -196,7 +197,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
                 Constant Value: 200 (0x000000c8)
             */
             messageId = R.string.media_err_invalid_progressive_playback;
-                
+
         } else {
             /*  MediaPlayer.MEDIA_ERROR_UNKNOWN
                 Added in API level 1
@@ -215,10 +216,9 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
     }
 
 
-    
     /**
      * Initialize a service instance
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -236,18 +236,18 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         mBinder = new MediaServiceBinder(this);
     }
 
-    
+
     /**
      * Entry point for Intents requesting actions, sent here via startService.
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
     public int onStartCommand(Intent intent, int flags, int startId) {
         String action = intent.getAction();
-        if (action.equals(ACTION_PLAY_FILE)) { 
+        if (action.equals(ACTION_PLAY_FILE)) {
             processPlayFileRequest(intent);
-            
+
         } else if (action.equals(ACTION_STOP_ALL)) {
             processStopRequest(true);
         }
@@ -258,9 +258,9 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
     /**
      * Processes a request to play a media file received as a parameter
-     * 
+     *
      * TODO If a new request is received when a file is being prepared, it is ignored. Is this what we want? 
-     * 
+     *
      * @param intent    Intent received in the request with the data to identify the file to play. 
      */
     private void processPlayFileRequest(Intent intent) {
@@ -274,7 +274,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         }
     }
 
-    
+
     /**
      * Processes a request to play a media file.
      */
@@ -286,7 +286,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         if (mState == State.STOPPED) {
             // (re)start playback
             playMedia();
-            
+
         } else if (mState == State.PAUSED) {
             // continue playback
             mState = State.PLAYING;
@@ -295,7 +295,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         }
     }
 
-    
+
     /**
      * Makes sure the media player exists and has been reset. This will create the media player
      * if needed. reset the existing media player if one already exists.
@@ -311,7 +311,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             mPlayer.setOnPreparedListener(this);
             mPlayer.setOnCompletionListener(this);
             mPlayer.setOnErrorListener(this);
-            
+
         } else {
             mPlayer.reset();
         }
@@ -328,11 +328,11 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             // TODO polite audio focus, instead of keep it owned; or not?
         }
     }
-    
-    
+
+
     /**
      * Processes a request to stop the playback.
-     * 
+     *
      * @param   force       When 'true', the playback is stopped no matter the value of mState
      */
     protected void processStopRequest(boolean force) {
@@ -345,7 +345,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             stopSelf();     // service is no longer necessary
         }
     }
-    
+
 
     /**
      * Releases resources used by the service for playback. This includes the "foreground service"
@@ -370,20 +370,20 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         }
     }
 
-    
+
     /**
      * Fully releases the audio focus.
      */
     private void giveUpAudioFocus() {
-        if (mAudioFocus == AudioFocus.FOCUS 
-                && mAudioManager != null  
-                && AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.abandonAudioFocus(this))  {
-            
+        if (mAudioFocus == AudioFocus.FOCUS
+                && mAudioManager != null
+                && AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.abandonAudioFocus(this)) {
+
             mAudioFocus = AudioFocus.NO_FOCUS;
         }
     }
 
-    
+
     /**
      * Reconfigures MediaPlayer according to audio focus settings and starts/restarts it. 
      */
@@ -391,42 +391,42 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         if (mPlayer == null) {
             throw new IllegalStateException("mPlayer is NULL");
         }
-        
+
         if (mAudioFocus == AudioFocus.NO_FOCUS) {
             if (mPlayer.isPlaying()) {
                 mPlayer.pause();        // have to be polite; but mState is not changed, to resume when focus is received again
             }
-            
-        }  else { 
+
+        } else {
             if (mAudioFocus == AudioFocus.NO_FOCUS_CAN_DUCK) {
                 mPlayer.setVolume(DUCK_VOLUME, DUCK_VOLUME);
-                
+
             } else {
                 mPlayer.setVolume(1.0f, 1.0f); // full volume
             }
-    
+
             if (!mPlayer.isPlaying()) {
                 mPlayer.start();
             }
         }
     }
 
-    
+
     /**
      * Requests the audio focus to the Audio Manager 
      */
     private void tryToGetAudioFocus() {
-        if (mAudioFocus != AudioFocus.FOCUS 
-                && mAudioManager != null 
-                && (AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus( this,
-                                                                                                AudioManager.STREAM_MUSIC, 
-                                                                                                AudioManager.AUDIOFOCUS_GAIN))
+        if (mAudioFocus != AudioFocus.FOCUS
+                && mAudioManager != null
+                && (AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus(this,
+                AudioManager.STREAM_MUSIC,
+                AudioManager.AUDIOFOCUS_GAIN))
                 ) {
             mAudioFocus = AudioFocus.FOCUS;
         }
     }
 
-    
+
     /**
      * Starts playing the current media file. 
      */
@@ -435,11 +435,11 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         releaseResources(false); // release everything except MediaPlayer
 
         try {
-            if (mFile == null) { 
+            if (mFile == null) {
                 Toast.makeText(this, R.string.media_err_nothing_to_play, Toast.LENGTH_LONG).show();
                 processStopRequest(true);
                 return;
-                
+
             } else if (mAccount == null) {
                 Toast.makeText(this, R.string.media_err_not_in_owncloud, Toast.LENGTH_LONG).show();
                 processStopRequest(true);
@@ -456,7 +456,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             mIsStreaming = url.startsWith("http:") || url.startsWith("https:");
             */
             mIsStreaming = false;
-            
+
             mPlayer.setDataSource(url);
 
             mState = State.PREPARING;
@@ -466,30 +466,30 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             mPlayer.prepareAsync();
 
             // prevent the Wifi from going to sleep when streaming
-            if (mIsStreaming) { 
+            if (mIsStreaming) {
                 mWifiLock.acquire();
             } else if (mWifiLock.isHeld()) {
                 mWifiLock.release();
             }
-            
+
         } 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();
             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();
             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();
             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()),
@@ -498,7 +498,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         }
     }
 
-    
+
     /** Called when media player is done playing current song. */
     public void onCompletion(MediaPlayer player) {
         Toast.makeText(this, String.format(getString(R.string.media_event_done, mFile.getFileName())), Toast.LENGTH_LONG).show();
@@ -513,9 +513,9 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         }
         return;
     }
-    
 
-    /** 
+
+    /**
      * Called when media player is done preparing. 
      *
      * Time to start.
@@ -531,14 +531,14 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         if (!mPlayOnPrepared) {
             processPauseRequest();
         }
-        
+
         if (mMediaController != null) {
             mMediaController.updatePausePlay();
         }
     }
-    
 
-    /** 
+
+    /**
      * Updates the status notification
      */
     private void updateNotification(String content) {
@@ -562,12 +562,12 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         mNotificationManager.notify(R.string.media_notif_ticker, mNotificationBuilder.build());
     }
 
-    
+
     /**
      * Configures the service as a foreground service.
-     * 
+     *
      * The system will avoid finishing the service as much as possible when resources as low.
-     * 
+     *
      * A notification must be created to keep the user aware of the existance of the service.
      */
     private void setUpAsForeground(String content) {
@@ -579,7 +579,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         //mNotification.tickerText = text;
         mNotificationBuilder.setWhen(System.currentTimeMillis());
         mNotificationBuilder.setOngoing(true);
-        
+
         /// 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, mFile);
@@ -597,22 +597,22 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
     /**
      * Called when there's an error playing media. 
-     * 
+     *
      * Warns the user about the error and resets the media player.
      */
     public boolean onError(MediaPlayer mp, int what, int extra) {
         Log_OC.e(TAG, "Error in audio playback, what = " + what + ", extra = " + extra);
-        
+
         String message = getMessageForMediaError(this, what, extra);
         Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
-        
+
         processStopRequest(true);
-        return true; 
+        return true;
     }
 
     /**
      * Called by the system when another app tries to play some sound.
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -624,22 +624,22 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
             if (mState == State.PLAYING) {
                 configAndStartMediaPlayer();
             }
-            
+
         } else if (focusChange < 0) {
             // focus loss; check AudioManager.AUDIOFOCUS_* values
             boolean canDuck = AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK == focusChange;
-                mAudioFocus = canDuck ? AudioFocus.NO_FOCUS_CAN_DUCK : AudioFocus.NO_FOCUS;
-                // start/restart/pause media player with new focus settings
-                if (mPlayer != null && mPlayer.isPlaying()) {
-                    configAndStartMediaPlayer();
-                }
+            mAudioFocus = canDuck ? AudioFocus.NO_FOCUS_CAN_DUCK : AudioFocus.NO_FOCUS;
+            // start/restart/pause media player with new focus settings
+            if (mPlayer != null && mPlayer.isPlaying()) {
+                configAndStartMediaPlayer();
+            }
         }
-        
+
     }
 
     /**
      * Called when the service is finished for final clean-up.
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -650,7 +650,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
         stopForeground(true);
         super.onDestroy();
     }
-    
+
 
     /**
      * Provides a binder object that clients can use to perform operations on the MediaPlayer managed by the MediaService. 
@@ -659,16 +659,16 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
     public IBinder onBind(Intent arg) {
         return mBinder;
     }
-    
-    
+
+
     /**
      * Called when ALL the bound clients were onbound.
-     * 
+     *
      * The service is destroyed if playback stopped or paused
      */
     @Override
     public boolean onUnbind(Intent intent) {
-        if (mState == State.PAUSED || mState == State.STOPPED)  {
+        if (mState == State.PAUSED || mState == State.STOPPED) {
             processStopRequest(false);
         }
         return false;   // not accepting rebinding (default behaviour)
@@ -677,9 +677,9 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
     /**
      * Accesses the current MediaPlayer instance in the service.
-     * 
+     *
      * To be handled carefully. Visibility is protected to be accessed only 
-     * 
+     *
      * @return Current MediaPlayer instance handled by MediaService.
      */
     protected MediaPlayer getPlayer() {
@@ -689,18 +689,18 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
 
     /**
      * Accesses the current OCFile loaded in the service.
-     * 
-     * @return  The current OCFile loaded in the service.
+     *
+     * @return The current OCFile loaded in the service.
      */
     protected OCFile getCurrentFile() {
         return mFile;
     }
 
-    
+
     /**
      * Accesses the current {@link State} of the MediaService.
-     * 
-     * @return  The current {@link State} of the MediaService.
+     *
+     * @return The current {@link State} of the MediaService.
      */
     protected State getState() {
         return mState;

+ 25 - 26
src/main/java/com/owncloud/android/media/MediaServiceBinder.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author David A. Velasco
- *   Copyright (C) 2016 ownCloud Inc.
+ * @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 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/>.
+ * 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.media;
@@ -34,7 +33,7 @@ import com.owncloud.android.media.MediaService.State;
 
 /**
  *  Binder allowing client components to perform operations on on the MediaPlayer managed by a MediaService instance.
- * 
+ *
  *  Provides the operations of {@link MediaController.MediaPlayerControl}, and an extra method to check if
  *  an {@link OCFile} instance is handled by the MediaService.
  */
@@ -45,10 +44,10 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
      * {@link MediaService} instance to access with the binder
      */
     private MediaService mService = null;
-    
+
     /**
      * Public constructor
-     * 
+     *
      * @param service       A {@link MediaService} instance to access with the binder 
      */
     public MediaServiceBinder(MediaService service) {
@@ -57,13 +56,13 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
         }
         mService = service;
     }
-    
-    
+
+
     public boolean isPlaying(OCFile mFile) {
-        return (mFile != null && mFile.equals(mService.getCurrentFile())); 
+        return (mFile != null && mFile.equals(mService.getCurrentFile()));
     }
 
-    
+
     @Override
     public boolean canPause() {
         return true;
@@ -110,10 +109,10 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
         }
     }
 
-    
+
     /**
      * Reports if the MediaService is playing a file or not.
-     * 
+     *
      * Considers that the file is being played when it is in preparation because the expected
      * client of this method is a {@link MediaController} , and we do not want that the 'play'
      * button is shown when the file is being prepared by the MediaService.
@@ -124,7 +123,7 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
         return (currentState == State.PLAYING || (currentState == State.PREPARING && mService.mPlayOnPrepared));
     }
 
-    
+
     @Override
     public void pause() {
         Log_OC.d(TAG, "Pausing through binder...");
@@ -146,7 +145,7 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
         Log_OC.d(TAG, "Starting through binder...");
         mService.processPlayRequest();  // this will finish the service if there is no file preloaded to play
     }
-    
+
     public void start(Account account, OCFile file, boolean playImmediately, int position) {
         Log_OC.d(TAG, "Loading and starting through binder...");
         Intent i = new Intent(mService, MediaService.class);
@@ -162,12 +161,12 @@ public class MediaServiceBinder extends Binder implements MediaController.MediaP
     public void registerMediaController(MediaControlView mediaController) {
         mService.setMediaContoller(mediaController);
     }
-    
+
     public void unregisterMediaController(MediaControlView mediaController) {
         if (mediaController != null && mediaController == mService.getMediaController()) {
             mService.setMediaContoller(null);
         }
-        
+
     }
 
     public boolean isInPlaybackState() {

+ 8 - 8
src/main/java/com/owncloud/android/operations/DownloadFileOperation.java

@@ -21,15 +21,12 @@
 
 package com.owncloud.android.operations;
 
-import java.io.File;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
+import android.accounts.Account;
+import android.webkit.MimeTypeMap;
 
 import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
 import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
 import com.owncloud.android.lib.common.operations.OperationCancelledException;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
@@ -37,8 +34,11 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
 import com.owncloud.android.utils.FileStorageUtils;
 
-import android.accounts.Account;
-import android.webkit.MimeTypeMap;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
  * Remote mDownloadOperation performing the download of a file to an ownCloud server

+ 9 - 9
src/main/java/com/owncloud/android/operations/OAuth2GetAccessToken.java

@@ -19,15 +19,6 @@
 
 package com.owncloud.android.operations;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.NameValuePair;
-import org.json.JSONException;
-import org.json.JSONObject;
-
 import com.owncloud.android.authentication.OAuth2Constants;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -35,6 +26,15 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.common.utils.Log_OC;
 
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
 
 public class OAuth2GetAccessToken extends RemoteOperation {
     

+ 0 - 2
src/main/java/com/owncloud/android/operations/UnshareOperation.java

@@ -23,7 +23,6 @@ package com.owncloud.android.operations;
 import android.content.Context;
 
 import com.owncloud.android.datamodel.OCFile;
-
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
@@ -32,7 +31,6 @@ import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.lib.resources.shares.RemoveRemoteShareOperation;
 import com.owncloud.android.lib.resources.shares.ShareType;
-
 import com.owncloud.android.operations.common.SyncOperation;
 
 import java.util.ArrayList;

+ 5 - 5
src/main/java/com/owncloud/android/services/observer/FileObserverService.java

@@ -21,11 +21,6 @@
 
 package com.owncloud.android.services.observer;
 
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
 import android.accounts.Account;
 import android.app.Service;
 import android.content.BroadcastReceiver;
@@ -44,6 +39,11 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.SynchronizeFileOperation;
 import com.owncloud.android.utils.FileStorageUtils;
 
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
 
 /**
  * Service keeping a list of {@link FolderObserver} instances that watch for local

+ 8 - 8
src/main/java/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java

@@ -22,14 +22,6 @@
 
 package com.owncloud.android.syncadapter;
 
-import java.io.IOException;
-
-import com.owncloud.android.datamodel.FileDataStorageManager;
-import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;
-import com.owncloud.android.lib.common.OwnCloudAccount;
-import com.owncloud.android.lib.common.OwnCloudClient;
-import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
-
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AuthenticatorException;
@@ -38,6 +30,14 @@ import android.content.AbstractThreadedSyncAdapter;
 import android.content.ContentProviderClient;
 import android.content.Context;
 
+import com.owncloud.android.datamodel.FileDataStorageManager;
+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.accounts.AccountUtils.AccountNotFoundException;
+
+import java.io.IOException;
+
 /**
  * Base synchronization adapter for ownCloud designed to be subclassed for different
  * resource types, like FileSync, ConcatsSync, CalendarSync, etc..

+ 14 - 14
src/main/java/com/owncloud/android/ui/CheckBoxPreferenceWithLongTitle.java

@@ -1,31 +1,30 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   Copyright (C) 2014 ownCloud Inc.
+ * Copyright (C) 2014 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 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/>.
+ * 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;
 
 import android.content.Context;
+import android.preference.CheckBoxPreference;
 import android.util.AttributeSet;
 import android.view.View;
 import android.widget.TextView;
-import android.preference.CheckBoxPreference;
 
-public class CheckBoxPreferenceWithLongTitle extends CheckBoxPreference{
+public class CheckBoxPreferenceWithLongTitle extends CheckBoxPreference {
 
     public CheckBoxPreferenceWithLongTitle(Context context) {
         super(context);
@@ -34,6 +33,7 @@ public class CheckBoxPreferenceWithLongTitle extends CheckBoxPreference{
     public CheckBoxPreferenceWithLongTitle(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
+
     public CheckBoxPreferenceWithLongTitle(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
     }

+ 14 - 15
src/main/java/com/owncloud/android/ui/CustomPopup.java

@@ -1,22 +1,21 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author Lorensius. W. T
- *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author Lorensius. W. T
+ * Copyright (C) 2011  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 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/>.
+ * 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;
 
@@ -28,9 +27,9 @@ import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.WindowManager;
 import android.view.View.OnTouchListener;
 import android.view.ViewGroup.LayoutParams;
+import android.view.WindowManager;
 import android.widget.PopupWindow;
 
 /**

+ 14 - 15
src/main/java/com/owncloud/android/ui/ExtendedListView.java

@@ -1,22 +1,21 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author David A. Velasco
- *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2012-2015 ownCloud Inc.
+ * @author David A. Velasco
+ * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-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 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/>.
+ * 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;
@@ -57,7 +56,7 @@ public class ExtendedListView extends ListView {
      *
      */
     @Override
-    protected void onDraw (Canvas canvas) {
+    protected void onDraw(Canvas canvas) {
         super.onDraw(canvas);
         if (mPositionToSetAndCenter > 0) {
             Log_OC.v(TAG, "Centering around position " + mPositionToSetAndCenter);

+ 16 - 16
src/main/java/com/owncloud/android/ui/NavigationDrawerItem.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author masensio
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author masensio
+ * 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 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/>.
+ * 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;
@@ -27,13 +26,14 @@ public class NavigationDrawerItem {
     private int mIcon;
 
     // Constructors
-    public NavigationDrawerItem(){}
+    public NavigationDrawerItem() {
+    }
 
-    public NavigationDrawerItem(String title){
+    public NavigationDrawerItem(String title) {
         mTitle = title;
     }
 
-    public NavigationDrawerItem(String title, String contentDescription, int icon){
+    public NavigationDrawerItem(String title, String contentDescription, int icon) {
         mTitle = title;
         mContentDescription = contentDescription;
         mIcon = icon;

+ 14 - 14
src/main/java/com/owncloud/android/ui/PreferenceWithLongSummary.java

@@ -1,32 +1,31 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   Copyright (C) 2014 ownCloud Inc.
+ * Copyright (C) 2014 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 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/>.
+ * 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;
 
 import android.content.Context;
+import android.preference.Preference;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.View;
 import android.widget.TextView;
-import android.preference.Preference;
 
-public class PreferenceWithLongSummary extends Preference{
+public class PreferenceWithLongSummary extends Preference {
 
     public PreferenceWithLongSummary(Context context) {
         super(context);
@@ -35,6 +34,7 @@ public class PreferenceWithLongSummary extends Preference{
     public PreferenceWithLongSummary(Context context, AttributeSet attrs) {
         super(context, attrs);
     }
+
     public PreferenceWithLongSummary(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
     }

+ 13 - 14
src/main/java/com/owncloud/android/ui/RadioButtonPreference.java

@@ -1,20 +1,19 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   Copyright (C) 2015 ownCloud Inc.
+ * 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 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/>.
+ * 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;
@@ -26,12 +25,12 @@ import android.view.View;
 import com.owncloud.android.R;
 
 public class RadioButtonPreference extends CheckBoxPreference implements View.OnLongClickListener {
-    
+
     public RadioButtonPreference(Context context) {
         super(context, null, android.R.attr.checkBoxPreferenceStyle);
         setWidgetLayoutResource(R.layout.preference_widget_radiobutton);
     }
-  
+
     @Override
     public boolean onLongClick(View v) {
         return true;

+ 11 - 12
src/main/java/com/owncloud/android/ui/SquareImageView.java

@@ -1,20 +1,19 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   Copyright (C) 2015 ownCloud Inc.
+ * 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 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/>.
+ * 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;

+ 11 - 12
src/main/java/com/owncloud/android/ui/SquareLinearLayout.java

@@ -1,20 +1,19 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   Copyright (C) 2015 ownCloud Inc.
+ * 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 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/>.
+ * 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;

+ 4 - 4
src/main/java/com/owncloud/android/ui/TextDrawable.java

@@ -91,7 +91,7 @@ public class TextDrawable extends Drawable {
      * @param radiusInDp  the circle's radius
      * @return the avatar as a TextDrawable
      * @throws UnsupportedEncodingException if the charset is not supported when calculating the color values
-     * @throws NoSuchAlgorithmException if the specified algorithm is not available when calculating the color values
+     * @throws NoSuchAlgorithmException     if the specified algorithm is not available when calculating the color values
      */
     @NonNull
     public static TextDrawable createAvatar(String accountName, float radiusInDp) throws
@@ -104,11 +104,11 @@ public class TextDrawable extends Drawable {
      * creates an avatar in form of a TextDrawable with the first letter of a name in a circle with the
      * given radius.
      *
-     * @param name the name
-     * @param radiusInDp  the circle's radius
+     * @param name       the name
+     * @param radiusInDp the circle's radius
      * @return the avatar as a TextDrawable
      * @throws UnsupportedEncodingException if the charset is not supported when calculating the color values
-     * @throws NoSuchAlgorithmException if the specified algorithm is not available when calculating the color values
+     * @throws NoSuchAlgorithmException     if the specified algorithm is not available when calculating the color values
      */
     @NonNull
     public static TextDrawable createNamedAvatar(String name, float radiusInDp) throws

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

@@ -21,10 +21,10 @@
 package com.owncloud.android.ui.activity;
 
 import com.owncloud.android.datamodel.FileDataStorageManager;
-import com.owncloud.android.ui.helpers.FileOperationsHelper;
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
 import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
 import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
+import com.owncloud.android.ui.helpers.FileOperationsHelper;
 
 public interface ComponentsGetter {
 

+ 4 - 4
src/main/java/com/owncloud/android/ui/activity/CopyToClipboardActivity.java

@@ -20,16 +20,16 @@
 
 package com.owncloud.android.ui.activity;
 
-import com.owncloud.android.R;
-import com.owncloud.android.lib.common.utils.Log_OC;
-
 import android.app.Activity;
 import android.content.ClipData;
+import android.content.ClipboardManager;
 import android.content.Intent;
 import android.os.Bundle;
-import android.content.ClipboardManager;
 import android.widget.Toast;
 
+import com.owncloud.android.R;
+import com.owncloud.android.lib.common.utils.Log_OC;
+
 /**
  * Activity copying the text of the received Intent into the system clibpoard.
  */

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

@@ -39,7 +39,6 @@ import android.widget.ListView;
 import android.widget.TextView;
 import android.widget.Toast;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
@@ -137,7 +136,7 @@ public class ErrorsWhileCopyingHandlerActivity  extends AppCompatActivity
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
         /**

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

@@ -42,7 +42,6 @@ import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.datamodel.OCFile;
-
 import com.owncloud.android.db.PreferenceManager;
 import com.owncloud.android.files.services.FileDownloader;
 import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;

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

@@ -40,7 +40,6 @@ import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.Toast;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -237,7 +236,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         super.onResume();
         Log_OC.e(TAG, "onResume() start");
 
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
 
         // refresh list of files
         refreshListOfFilesFragment(false);

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

@@ -102,7 +102,7 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     /**

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

@@ -32,7 +32,6 @@ import android.widget.ListAdapter;
 import android.widget.ListView;
 import android.widget.TextView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 
 import java.util.ArrayList;
@@ -88,7 +87,7 @@ public class GenericExplanationActivity  extends AppCompatActivity {
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     public class ExplanationListAdapterView extends ArrayAdapter<String> {

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

@@ -36,7 +36,6 @@ import android.widget.Button;
 import android.widget.TextView;
 import android.widget.Toast;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.dialog.LoadingDialog;
@@ -122,7 +121,7 @@ public class LogHistoryActivity extends ToolbarActivity {
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     @Override

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

@@ -134,7 +134,7 @@ public class ManageAccountsActivity extends FileActivity
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     @Override

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

@@ -32,7 +32,6 @@ import android.widget.Button;
 import android.widget.TextView;
 import android.widget.Toast;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 
@@ -72,7 +71,7 @@ public class ManageSpaceActivity extends AppCompatActivity {
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     @Override

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

@@ -30,7 +30,6 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.TextView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 
 /**
@@ -60,7 +59,7 @@ public class ParticipateActivity extends FileActivity {
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     private void setupContent() {

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

@@ -38,7 +38,6 @@ import android.widget.EditText;
 import android.widget.TextView;
 import android.widget.Toast;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 
@@ -144,7 +143,7 @@ public class PassCodeActivity extends AppCompatActivity {
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     /**

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

@@ -612,7 +612,7 @@ public class Preferences extends PreferenceActivity
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
 
         SharedPreferences appPrefs =
                 PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

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

@@ -22,8 +22,8 @@ package com.owncloud.android.ui.activity;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
-import android.app.ProgressDialog;
 import android.app.AlertDialog;
+import android.app.ProgressDialog;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.DialogInterface;

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

@@ -41,7 +41,6 @@ import android.widget.Button;
 import android.widget.Spinner;
 import android.widget.TextView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.db.PreferenceManager;
 import com.owncloud.android.lib.common.utils.Log_OC;
@@ -323,7 +322,7 @@ public class UploadFilesActivity extends FileActivity implements
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     /**

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

@@ -41,7 +41,6 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.Toast;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.datamodel.OCFile;
@@ -129,7 +128,7 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
         Log_OC.v(TAG, "onResume() start");
         super.onResume();
 
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
 
         // Listen for upload messages
         mUploadMessagesReceiver = new UploadMessagesReceiver();

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

@@ -23,7 +23,6 @@ import android.accounts.Account;
 import android.os.Bundle;
 import android.view.View.OnClickListener;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
@@ -52,7 +51,7 @@ public class UploadPathActivity extends FolderPickerActivity implements FileFrag
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     /**

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

@@ -132,7 +132,7 @@ public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPa
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     @Override

+ 3 - 3
src/main/java/com/owncloud/android/ui/adapter/CertificateCombinedExceptionViewAdapter.java

@@ -20,13 +20,13 @@
  */
 package com.owncloud.android.ui.adapter;
 
+import android.view.View;
+import android.widget.TextView;
+
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.network.CertificateCombinedException;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
 
-import android.view.View;
-import android.widget.TextView;
-
 /**
  * TODO
  *

+ 8 - 8
src/main/java/com/owncloud/android/ui/adapter/DiskLruImageCache.java

@@ -19,14 +19,6 @@
 
 package com.owncloud.android.ui.adapter;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.CompressFormat;
 import android.graphics.BitmapFactory;
@@ -35,6 +27,14 @@ import com.jakewharton.disklrucache.DiskLruCache;
 import com.owncloud.android.BuildConfig;
 import com.owncloud.android.lib.common.utils.Log_OC;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
 public class DiskLruImageCache {
 
     private DiskLruCache mDiskCache;

+ 6 - 5
src/main/java/com/owncloud/android/ui/adapter/SslCertificateViewAdapter.java

@@ -20,15 +20,16 @@
  */
 package com.owncloud.android.ui.adapter;
 
-import java.text.DateFormat;
-import java.util.Date;
-
-import com.owncloud.android.R;
-import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
 import android.net.http.SslCertificate;
 import android.view.View;
 import android.widget.TextView;
 
+import com.owncloud.android.R;
+import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
+
+import java.text.DateFormat;
+import java.util.Date;
+
 /**
  * TODO
  */

+ 3 - 2
src/main/java/com/owncloud/android/ui/adapter/SslErrorViewAdapter.java

@@ -20,12 +20,13 @@
  */
 package com.owncloud.android.ui.adapter;
 
-import com.owncloud.android.R;
-import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
 import android.net.http.SslError;
 import android.view.View;
 import android.widget.TextView;
 
+import com.owncloud.android.R;
+import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
+
 /**
  * Dialog to show an Untrusted Certificate
  */

+ 7 - 7
src/main/java/com/owncloud/android/ui/adapter/X509CertificateViewAdapter.java

@@ -20,6 +20,13 @@
  */
 package com.owncloud.android.ui.adapter;
 
+import android.util.Log;
+import android.view.View;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
+
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.cert.CertificateEncodingException;
@@ -31,13 +38,6 @@ import java.util.Map;
 
 import javax.security.auth.x500.X500Principal;
 
-import com.owncloud.android.R;
-import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
-
-import android.util.Log;
-import android.view.View;
-import android.widget.TextView;
-
 /**
  *
  */

+ 1 - 1
src/main/java/com/owncloud/android/ui/dialog/ChangelogDialog.java

@@ -19,11 +19,11 @@
 
 package com.owncloud.android.ui.dialog;
 
-import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
 import android.webkit.WebView;
 
 import com.owncloud.android.R;

+ 1 - 1
src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java

@@ -20,11 +20,11 @@
 
 package com.owncloud.android.ui.dialog;
 
-import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
 
 import com.owncloud.android.R;
 

+ 1 - 1
src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java

@@ -21,13 +21,13 @@
 
 package com.owncloud.android.ui.dialog;
 
-import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.AlertDialog;
 import android.support.v7.app.AppCompatActivity;
 
 import com.owncloud.android.R;

+ 6 - 6
src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java

@@ -20,16 +20,11 @@
 
 package com.owncloud.android.ui.dialog;
 
-import com.owncloud.android.R;
-import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.lib.resources.files.FileUtils;
-import com.owncloud.android.ui.activity.ComponentsGetter;
-
-import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.WindowManager.LayoutParams;
@@ -37,6 +32,11 @@ import android.widget.EditText;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.lib.resources.files.FileUtils;
+import com.owncloud.android.ui.activity.ComponentsGetter;
+
 /**
  *  Dialog to input the name for a new folder to create.  
  * 

+ 5 - 5
src/main/java/com/owncloud/android/ui/dialog/CredentialsDialogFragment.java

@@ -19,15 +19,12 @@
 
 package com.owncloud.android.ui.dialog;
 
-import com.owncloud.android.R;
-import com.owncloud.android.authentication.AuthenticatorActivity;
-
-import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
-import android.support.v7.app.AlertDialog.Builder;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AlertDialog.Builder;
 import android.text.InputType;
 import android.view.WindowManager.LayoutParams;
 import android.webkit.HttpAuthHandler;
@@ -35,6 +32,9 @@ import android.webkit.WebView;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 
+import com.owncloud.android.R;
+import com.owncloud.android.authentication.AuthenticatorActivity;
+
 
 
 /**

+ 2 - 2
src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.java

@@ -18,8 +18,6 @@
  */
 package com.owncloud.android.ui.dialog;
 
-import com.owncloud.android.R;
-
 import android.app.Dialog;
 import android.graphics.PorterDuff;
 import android.os.Bundle;
@@ -31,6 +29,8 @@ import android.view.Window;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 
+import com.owncloud.android.R;
+
 public class LoadingDialog extends DialogFragment {
 
     private String mMessage;

+ 2 - 1
src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java

@@ -25,11 +25,12 @@ package com.owncloud.android.ui.dialog;
  * 
  *  Triggers the rename operation. 
  */
-import android.support.v7.app.AlertDialog;
+
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.WindowManager.LayoutParams;

+ 1 - 1
src/main/java/com/owncloud/android/ui/dialog/SamlWebViewDialog.java

@@ -28,8 +28,8 @@ import android.content.DialogInterface;
 import android.os.Bundle;
 import android.os.Handler;
 import android.support.v4.app.DialogFragment;
-import android.support.v4.app.FragmentTransaction;
 import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;

+ 6 - 6
src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.java

@@ -20,12 +20,6 @@
 
 package com.owncloud.android.ui.dialog;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.ComponentName;
 import android.content.Context;
@@ -36,6 +30,7 @@ import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -47,6 +42,11 @@ import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.activity.CopyToClipboardActivity;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * Dialog showing a list activities able to resolve a given Intent, 
  * filtering out the activities matching give package names.

+ 1 - 1
src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java

@@ -18,11 +18,11 @@
  */
 package com.owncloud.android.ui.dialog;
 
-import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.WindowManager;

+ 5 - 5
src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.java

@@ -20,10 +20,6 @@
  */
 package com.owncloud.android.ui.dialog;
 
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.security.cert.X509Certificate;
-
 import android.app.Activity;
 import android.app.Dialog;
 import android.net.http.SslError;
@@ -31,9 +27,9 @@ import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 import android.view.Window;
-import android.view.View.OnClickListener;
 import android.webkit.SslErrorHandler;
 import android.widget.Button;
 
@@ -46,6 +42,10 @@ import com.owncloud.android.ui.adapter.SslCertificateViewAdapter;
 import com.owncloud.android.ui.adapter.SslErrorViewAdapter;
 import com.owncloud.android.ui.adapter.X509CertificateViewAdapter;
 
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.cert.X509Certificate;
+
 /**
  * Dialog to show information about an untrusted certificate and allow the user
  * to decide trust on it or not.

+ 13 - 14
src/main/java/com/owncloud/android/ui/dialog/SslValidatorDialog.java

@@ -20,20 +20,6 @@
 
 package com.owncloud.android.ui.dialog;
 
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.security.auth.x500.X500Principal;
-
-import com.owncloud.android.R;
-
 import android.app.Dialog;
 import android.content.Context;
 import android.os.Bundle;
@@ -42,11 +28,24 @@ import android.view.Window;
 import android.widget.Button;
 import android.widget.TextView;
 
+import com.owncloud.android.R;
 import com.owncloud.android.lib.common.network.CertificateCombinedException;
 import com.owncloud.android.lib.common.network.NetworkUtils;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.utils.Log_OC;
 
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.auth.x500.X500Principal;
+
 /**
  * Dialog to request the user about a certificate that could not be validated with the certificates store in the system.
  */

+ 1 - 1
src/main/java/com/owncloud/android/ui/dialog/UploadSourceDialogFragment.java

@@ -20,13 +20,13 @@
 package com.owncloud.android.ui.dialog;
 
 import android.accounts.Account;
-import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.os.Build;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
+import android.support.v7.app.AlertDialog;
 
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;

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

@@ -19,14 +19,14 @@
  */
 package com.owncloud.android.ui.errorhandling;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Build;
 import android.util.Log;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
 public class ExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler {
 	private final Activity mContext;
 

+ 1 - 2
src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java

@@ -32,7 +32,6 @@ import android.widget.CheckBox;
 import android.widget.CompoundButton;
 import android.widget.TextView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
@@ -381,7 +380,7 @@ public class EditShareFragment extends Fragment {
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
     }
 

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

@@ -111,7 +111,7 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
     }
 

+ 1 - 2
src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java

@@ -32,7 +32,6 @@ import android.widget.AdapterView;
 import android.widget.ImageView;
 import android.widget.ListView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.adapter.LocalFileListAdapter;
@@ -69,7 +68,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
     }
 

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

@@ -254,7 +254,7 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
         }
 
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
     }
 

+ 1 - 2
src/main/java/com/owncloud/android/ui/fragment/SearchShareesFragment.java

@@ -35,7 +35,6 @@ import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.ListView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.utils.Log_OC;
@@ -109,7 +108,7 @@ public class SearchShareesFragment extends Fragment implements ShareUserListAdap
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
     }
 

+ 1 - 2
src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java

@@ -44,7 +44,6 @@ import android.widget.ScrollView;
 import android.widget.TextView;
 import android.widget.Toast;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.datamodel.OCFile;
@@ -182,7 +181,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
     }
 

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

@@ -27,7 +27,6 @@ import android.view.ViewGroup;
 import android.widget.ExpandableListView;
 import android.widget.ListView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.db.OCUpload;
 import com.owncloud.android.lib.common.utils.Log_OC;
@@ -77,7 +76,7 @@ public class UploadListFragment extends ExpandableListFragment {
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
     }
 

+ 0 - 3
src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java

@@ -63,9 +63,6 @@ import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import static com.owncloud.android.R.drawable.file;
-import static com.owncloud.android.R.layout.files;
-
 /**
  *
  */

+ 5 - 3
src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java

@@ -19,17 +19,19 @@
 
 package com.owncloud.android.ui.notifications;
 
-import java.util.Random;
-
 import android.app.NotificationManager;
 import android.content.Context;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Process;
 import android.support.v4.app.NotificationCompat;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
 import com.owncloud.android.R;
 
+import java.util.Random;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
 public class NotificationUtils {
 
     /**

+ 5 - 6
src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java

@@ -19,12 +19,6 @@
  */
 package com.owncloud.android.ui.preview;
 
-import java.lang.ref.WeakReference;
-
-import com.owncloud.android.R;
-import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.ui.fragment.FileFragment;
-
 import android.accounts.Account;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
@@ -36,10 +30,15 @@ import android.view.ViewGroup;
 import android.widget.ProgressBar;
 import android.widget.TextView;
 
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
 import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.DisplayUtils;
 
+import java.lang.ref.WeakReference;
+
 
 /**
  * This Fragment is used to monitor the progress of a file downloading.

+ 1 - 3
src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java

@@ -51,8 +51,6 @@ import android.widget.TextView;
 
 import com.caverock.androidsvg.SVG;
 import com.caverock.androidsvg.SVGParseException;
-
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.FileMenuFilter;
@@ -380,7 +378,7 @@ public class PreviewImageFragment extends FileFragment {
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
     }
 

+ 7 - 7
src/main/java/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java

@@ -19,13 +19,6 @@
  */
 package com.owncloud.android.ui.preview;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
 import android.accounts.Account;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
@@ -37,6 +30,13 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.utils.FileStorageUtils;
 
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
 /**
  * Adapter class that provides Fragment instances
  */

+ 1 - 2
src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java

@@ -54,7 +54,6 @@ import android.widget.TextView;
 import android.widget.Toast;
 import android.widget.VideoView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.FileMenuFilter;
@@ -566,7 +565,7 @@ public class PreviewMediaFragment extends FileFragment implements
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
         Log_OC.v(TAG, "onResume");
     }

+ 1 - 2
src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java

@@ -34,7 +34,6 @@ import android.widget.ProgressBar;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.FileMenuFilter;
@@ -418,7 +417,7 @@ public class PreviewTextFragment extends FileFragment {
     public void onResume() {
         super.onResume();
         if (getActivity() != null) {
-            MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(getActivity(), SCREEN_NAME, TAG);
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
         }
         Log_OC.e(TAG, "onResume");
     }

+ 1 - 2
src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.java

@@ -33,7 +33,6 @@ import android.support.v7.app.AlertDialog;
 import android.widget.MediaController;
 import android.widget.VideoView;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.accounts.AccountUtils;
@@ -109,7 +108,7 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi
     @Override
     protected void onResume() {
         super.onResume();
-        MainApp.getFirebaseAnalyticsInstance().setCurrentScreen(this, SCREEN_NAME, TAG);
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
     }
 
     /**

+ 61 - 76
src/main/java/com/owncloud/android/utils/BitmapUtils.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author David A. Velasco
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author David A. Velasco
+ * 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 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/>.
+ * 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;
 
@@ -40,19 +39,19 @@ import java.util.Locale;
  * Utility class with methods for decoding Bitmaps.
  */
 public class BitmapUtils {
-    
-    
+
+
     /**
      * Decodes a bitmap from a file containing it minimizing the memory use, known that the bitmap
      * will be drawn in a surface of reqWidth x reqHeight
-     * 
+     *
      * @param srcPath       Absolute path to the file containing the image.
      * @param reqWidth      Width of the surface where the Bitmap will be drawn on, in pixels.
      * @param reqHeight     Height of the surface where the Bitmap will be drawn on, in pixels.
      * @return
      */
     public static Bitmap decodeSampledBitmapFromFile(String srcPath, int reqWidth, int reqHeight) {
-    
+
         // set desired options that will affect the size of the bitmap
         final Options options = new Options();
         options.inScaled = true;
@@ -63,39 +62,39 @@ public class BitmapUtils {
         if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
             options.inMutable = false;
         }
-        
+
         // make a false load of the bitmap to get its dimensions
         options.inJustDecodeBounds = true;
-        
-        BitmapFactory.decodeFile(srcPath, options);   
-        
+
+        BitmapFactory.decodeFile(srcPath, options);
+
         // calculate factor to subsample the bitmap
         options.inSampleSize = calculateSampleFactor(options, reqWidth, reqHeight);
 
         // decode bitmap with inSampleSize set
         options.inJustDecodeBounds = false;
         return BitmapFactory.decodeFile(srcPath, options);
-    }    
+    }
 
 
     /**
      * Calculates a proper value for options.inSampleSize in order to decode a Bitmap minimizing 
      * the memory overload and covering a target surface of reqWidth x reqHeight if the original
      * image is big enough. 
-     * 
+     *
      * @param options       Bitmap decoding options; options.outHeight and options.inHeight should
      *                      be set. 
      * @param reqWidth      Width of the surface where the Bitmap will be drawn on, in pixels.
      * @param reqHeight     Height of the surface where the Bitmap will be drawn on, in pixels.
-     * @return              The largest inSampleSize value that is a power of 2 and keeps both
+     * @return The largest inSampleSize value that is a power of 2 and keeps both
      *                      height and width larger than reqWidth and reqHeight.
      */
     private static int calculateSampleFactor(Options options, int reqWidth, int reqHeight) {
-        
+
         final int height = options.outHeight;
         final int width = options.outWidth;
         int inSampleSize = 1;
-    
+
         if (height > reqHeight || width > reqWidth) {
             final int halfHeight = height / 2;
             final int halfWidth = width / 2;
@@ -107,10 +106,10 @@ public class BitmapUtils {
                 inSampleSize *= 2;
             }
         }
-        
+
         return inSampleSize;
     }
-    
+
     /**
      * Rotate bitmap according to EXIF orientation. 
      * Cf. http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/ 
@@ -118,64 +117,54 @@ public class BitmapUtils {
      * @param storagePath Path to source file of bitmap. Needed for EXIF information. 
      * @return correctly EXIF-rotated bitmap
      */
-    public static Bitmap rotateImage(Bitmap bitmap, String storagePath){
+    public static Bitmap rotateImage(Bitmap bitmap, String storagePath) {
         Bitmap resultBitmap = bitmap;
 
-        try
-        {
+        try {
             ExifInterface exifInterface = new ExifInterface(storagePath);
             int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1);
 
             Matrix matrix = new Matrix();
 
             // 1: nothing to do
-            
+
             // 2
-            if (orientation == ExifInterface.ORIENTATION_FLIP_HORIZONTAL)
-            {
+            if (orientation == ExifInterface.ORIENTATION_FLIP_HORIZONTAL) {
                 matrix.postScale(-1.0f, 1.0f);
             }
             // 3
-            else if (orientation == ExifInterface.ORIENTATION_ROTATE_180)
-            {
+            else if (orientation == ExifInterface.ORIENTATION_ROTATE_180) {
                 matrix.postRotate(180);
             }
             // 4
-            else if (orientation == ExifInterface.ORIENTATION_FLIP_VERTICAL)
-            {
+            else if (orientation == ExifInterface.ORIENTATION_FLIP_VERTICAL) {
                 matrix.postScale(1.0f, -1.0f);
             }
             // 5
-            else if (orientation == ExifInterface.ORIENTATION_TRANSPOSE)
-            {
+            else if (orientation == ExifInterface.ORIENTATION_TRANSPOSE) {
                 matrix.postRotate(-90);
                 matrix.postScale(1.0f, -1.0f);
             }
             // 6
-            else if (orientation == ExifInterface.ORIENTATION_ROTATE_90)
-            {
+            else if (orientation == ExifInterface.ORIENTATION_ROTATE_90) {
                 matrix.postRotate(90);
             }
             // 7
-            else if (orientation == ExifInterface.ORIENTATION_TRANSVERSE)
-            {
+            else if (orientation == ExifInterface.ORIENTATION_TRANSVERSE) {
                 matrix.postRotate(90);
                 matrix.postScale(1.0f, -1.0f);
             }
             // 8
-            else if (orientation == ExifInterface.ORIENTATION_ROTATE_270)
-            {
+            else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) {
                 matrix.postRotate(270);
-            } 
-            
+            }
+
             // Rotate the bitmap
             resultBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
             if (!resultBitmap.equals(bitmap)) {
                 bitmap.recycle();
             }
-        }
-        catch (Exception exception)
-        {
+        } catch (Exception exception) {
             Log_OC.e("BitmapUtil", "Could not rotate the image: " + storagePath);
         }
         return resultBitmap;
@@ -192,24 +181,20 @@ public class BitmapUtils {
      *  gfxbuilder-core/src/main/com/camick/awt/HSLColor.java
      */
     @SuppressWarnings("PMD.MethodNamingConventions")
-    public static int[] HSLtoRGB(float h, float s, float l, float alpha)
-    {
-        if (s <0.0f || s > 100.0f)
-        {
+    public static int[] HSLtoRGB(float h, float s, float l, float alpha) {
+        if (s < 0.0f || s > 100.0f) {
             String message = "Color parameter outside of expected range - Saturation";
-            throw new IllegalArgumentException( message );
+            throw new IllegalArgumentException(message);
         }
 
-        if (l <0.0f || l > 100.0f)
-        {
+        if (l < 0.0f || l > 100.0f) {
             String message = "Color parameter outside of expected range - Luminance";
-            throw new IllegalArgumentException( message );
+            throw new IllegalArgumentException(message);
         }
 
-        if (alpha <0.0f || alpha > 1.0f)
-        {
+        if (alpha < 0.0f || alpha > 1.0f) {
             String message = "Color parameter outside of expected range - Alpha";
-            throw new IllegalArgumentException( message );
+            throw new IllegalArgumentException(message);
         }
 
         //  Formula needs all values between 0 - 1.
@@ -237,29 +222,29 @@ public class BitmapUtils {
     }
 
     @SuppressWarnings("PMD.MethodNamingConventions")
-    private static float HueToRGB(float p, float q, float h){
-		if (h < 0) {
+    private static float HueToRGB(float p, float q, float h) {
+        if (h < 0) {
             h += 1;
         }
 
-		if (h > 1 ) {
+        if (h > 1) {
             h -= 1;
         }
 
-		if (6 * h < 1) {
-			return p + ((q - p) * 6 * h);
-		}
+        if (6 * h < 1) {
+            return p + ((q - p) * 6 * h);
+        }
 
-		if (2 * h < 1 ) {
-			return  q;
-		}
+        if (2 * h < 1) {
+            return q;
+        }
 
-		if (3 * h < 2) {
-			return p + ( (q - p) * 6 * ((2.0f / 3.0f) - h) );
-		}
+        if (3 * h < 2) {
+            return p + ((q - p) * 6 * ((2.0f / 3.0f) - h));
+        }
 
-   		return p;
-	}
+        return p;
+    }
 
     /**
      * calculates the RGB value based on a given account name.

+ 17 - 17
src/main/java/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.
+ * @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 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.
+ * 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/>.
+ * 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;
@@ -24,8 +24,8 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
-import android.support.v4.net.ConnectivityManagerCompat;
 import android.os.BatteryManager;
+import android.support.v4.net.ConnectivityManagerCompat;
 
 import com.owncloud.android.lib.common.utils.Log_OC;
 
@@ -37,9 +37,9 @@ public class ConnectivityUtils {
         ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
         boolean result =
                 cm != null && cm.getActiveNetworkInfo() != null
-                && cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI
-                && cm.getActiveNetworkInfo().getState() == NetworkInfo.State.CONNECTED
-                && !ConnectivityManagerCompat.isActiveNetworkMetered(cm);
+                        && cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI
+                        && cm.getActiveNetworkInfo().getState() == NetworkInfo.State.CONNECTED
+                        && !ConnectivityManagerCompat.isActiveNetworkMetered(cm);
         Log_OC.d(TAG, "is AppConnectedViaWifi returns " + result);
         return result;
     }
@@ -49,7 +49,7 @@ public class ConnectivityUtils {
         return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected();
     }
 
-    public static boolean isCharging(Context context){
+    public static boolean isCharging(Context context) {
         IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
         Intent batteryStatus = context.registerReceiver(null, ifilter);
 

+ 12 - 13
src/main/java/com/owncloud/android/utils/DialogMenuItem.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author Andy Scherzinger
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author Andy Scherzinger
+ * 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 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/>.
+ * 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;

+ 28 - 27
src/main/java/com/owncloud/android/utils/DisplayUtils.java

@@ -1,25 +1,25 @@
 /**
- *   Nextcloud Android client application
+ * Nextcloud Android client application
  *
- *   @author Andy Scherzinger
- *   @author Bartek Przybylski
- *   @author David A. Velasco
- *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
- *   Copyright (C) 2016 Andy Scherzinger
+ * @author Andy Scherzinger
+ * @author Bartek Przybylski
+ * @author David A. Velasco
+ * Copyright (C) 2011  Bartek Przybylski
+ * Copyright (C) 2015 ownCloud Inc.
+ * Copyright (C) 2016 Andy Scherzinger
  *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- *   License as published by the Free Software Foundation; either
- *   version 3 of the License, or any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
  *
- *   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 AFFERO GENERAL PUBLIC LICENSE for more details.
+ * 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 AFFERO GENERAL PUBLIC LICENSE for more details.
  *
- *   You should have received a copy of the GNU Affero General Public
- *   License along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 package com.owncloud.android.utils;
@@ -97,8 +97,8 @@ import java.util.Set;
 public class DisplayUtils {
     private static final String TAG = DisplayUtils.class.getSimpleName();
 
-    private static final String[] sizeSuffixes = { "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
-    private static final int[] sizeScales = { 0, 0, 1, 1, 1, 2, 2, 2, 2 };
+    private static final String[] sizeSuffixes = {"B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
+    private static final int[] sizeScales = {0, 0, 1, 1, 1, 2, 2, 2, 2};
     private static final int RELATIVE_THRESHOLD_WARNING = 90;
     private static final int RELATIVE_THRESHOLD_CRITICAL = 95;
     private static final String MIME_TYPE_UNKNOWN = "Unknown type";
@@ -154,7 +154,7 @@ public class DisplayUtils {
     /**
      * Converts MIME types like "image/jpg" to more end user friendly output
      * like "JPG image".
-     * 
+     *
      * @param mimetype MIME type to convert
      * @return A human friendly version of the MIME type, {@link #MIME_TYPE_UNKNOWN} if it can't be converted
      */
@@ -219,7 +219,7 @@ public class DisplayUtils {
             return TWITTER_HANDLE_PREFIX + handle;
         }
     }
-    
+
     /**
      * Converts an internationalized domain name (IDN) in an URL to and from ASCII/Unicode.
      *
@@ -231,7 +231,7 @@ public class DisplayUtils {
     public static String convertIdn(String url, boolean toASCII) {
 
         String urlNoDots = url;
-        String dots="";
+        String dots = "";
         while (urlNoDots.startsWith(".")) {
             urlNoDots = url.substring(1);
             dots = dots + ".";
@@ -360,8 +360,8 @@ public class DisplayUtils {
     public static String getPathWithoutLastSlash(String path) {
 
         // Remove last slash from path
-        if (path.length() > 1 && path.charAt(path.length()-1) == OCFile.PATH_SEPARATOR.charAt(0)) {
-            path = path.substring(0, path.length()-1);
+        if (path.length() > 1 && path.charAt(path.length() - 1) == OCFile.PATH_SEPARATOR.charAt(0)) {
+            path = path.substring(0, path.length() - 1);
         }
         return path;
     }
@@ -424,7 +424,7 @@ public class DisplayUtils {
         if (seekBar != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
             colorPreLollipopHorizontalProgressBar(seekBar);
 
-            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                 int color = seekBar.getResources().getColor(R.color.color_accent);
                 seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
                 seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
@@ -484,6 +484,7 @@ public class DisplayUtils {
 
     public interface AvatarGenerationListener {
         void avatarGenerated(Drawable avatarDrawable, Object callContext);
+
         boolean shouldCallGeneratedCallback(String tag, Object callContext);
     }
 
@@ -496,7 +497,7 @@ public class DisplayUtils {
      * @param storageManager reference for caching purposes
      */
     public static void setAvatar(Account account, AvatarGenerationListener listener, float avatarRadius, Resources resources,
-                           FileDataStorageManager storageManager, Object callContext) {
+                                 FileDataStorageManager storageManager, Object callContext) {
         if (account != null) {
             if (callContext instanceof View) {
                 ((View) callContext).setContentDescription(account.name);
@@ -525,7 +526,7 @@ public class DisplayUtils {
                         final ThumbnailsCacheManager.AsyncAvatarDrawable asyncDrawable =
                                 new ThumbnailsCacheManager.AsyncAvatarDrawable(resources, thumbnail, task);
                         listener.avatarGenerated(BitmapUtils.bitmapToCircularBitmapDrawable(
-                                        resources, asyncDrawable.getBitmap()), callContext);
+                                resources, asyncDrawable.getBitmap()), callContext);
                     }
                     task.execute(account.name);
                 }

+ 18 - 19
src/main/java/com/owncloud/android/utils/ErrorMessageAdapter.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author masensio
- *   Copyright (C) 2014 ownCloud Inc.
+ * @author masensio
+ * Copyright (C) 2014 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 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/>.
+ * 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/>.
  */
 
 
@@ -55,7 +54,7 @@ public class ErrorMessageAdapter {
 
     public static String getErrorCauseMessage(RemoteOperationResult result,
                                               RemoteOperation operation, Resources res) {
-        
+
         String message = null;
 
         if (!result.isSuccess() && isNetworkError(result.getCode())) {
@@ -72,7 +71,7 @@ public class ErrorMessageAdapter {
                         || result.getCode() == ResultCode.LOCAL_STORAGE_NOT_COPIED) {
                     message = String.format(
                             res.getString(R.string.error__upload__local_file_not_copied),
-                            ((UploadFileOperation) operation).getFileName(), 
+                            ((UploadFileOperation) operation).getFileName(),
                             res.getString(R.string.app_name));
                 /*
                 } else if (result.getCode() == ResultCode.QUOTA_EXCEEDED) {
@@ -107,7 +106,7 @@ public class ErrorMessageAdapter {
                 } else {
                     message = String.format(
                             res.getString(R.string.downloader_download_failed_content), new File(
-                            ((DownloadFileOperation) operation).getSavePath()).getName());
+                                    ((DownloadFileOperation) operation).getSavePath()).getName());
                 }
             }
 
@@ -163,12 +162,12 @@ public class ErrorMessageAdapter {
                 message = res.getString(R.string.create_dir_fail_msg);
             }
         } else if (operation instanceof CreateShareViaLinkOperation ||
-                    operation instanceof CreateShareWithShareeOperation) {
+                operation instanceof CreateShareWithShareeOperation) {
 
             if (result.getData() != null && result.getData().size() > 0) {
                 message = (String) result.getData().get(0);     // share API sends its own error messages
 
-            } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND)  {
+            } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
                 message = res.getString(R.string.share_link_file_no_exist);
 
             } else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
@@ -200,7 +199,7 @@ public class ErrorMessageAdapter {
             }
 
         } else if (operation instanceof UpdateShareViaLinkOperation ||
-                    operation instanceof UpdateSharePermissionsOperation) {
+                operation instanceof UpdateSharePermissionsOperation) {
 
             if (result.getData() != null && result.getData().size() > 0) {
                 message = (String) result.getData().get(0);     // share API sends its own error messages

+ 53 - 54
src/main/java/com/owncloud/android/utils/FileStorageUtils.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author David A. Velasco
- *   Copyright (C) 2016 ownCloud Inc.
+ * @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 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/>.
+ * 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;
@@ -115,8 +114,8 @@ public class FileStorageUtils {
         File savePath = new File(MainApp.getStoragePath());
         return savePath.getUsableSpace();
     }
-    
-    public static String getLogPath()  {
+
+    public static String getLogPath() {
         return MainApp.getStoragePath() + File.separator + MainApp.getDataFolder() + File.separator + "log";
     }
 
@@ -166,10 +165,10 @@ public class FileStorageUtils {
                                                   Boolean subfolderByDate) {
         String subPath = "";
         if (subfolderByDate) {
-           subPath = getSubpathFromDate(dateTaken, current);
+            subPath = getSubpathFromDate(dateTaken, current);
         }
 
-        return remotePath + OCFile.PATH_SEPARATOR  + subPath + (fileName == null ? "" : fileName);
+        return remotePath + OCFile.PATH_SEPARATOR + subPath + (fileName == null ? "" : fileName);
     }
 
     public static String getInstantUploadFilePath(String remotePath,
@@ -202,23 +201,23 @@ public class FileStorageUtils {
         }
         return uploadVideoPath + OCFile.PATH_SEPARATOR + subPath + (fileName == null ? "" : fileName);
     }
-    
+
     public static String getParentPath(String remotePath) {
         String parentPath = new File(remotePath).getParent();
         parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath : parentPath + OCFile.PATH_SEPARATOR;
         return parentPath;
     }
-    
+
     /**
      * Creates and populates a new {@link OCFile} object with the data read from the server.
-     * 
+     *
      * @param remote    remote file read from the server (remote file or folder).
-     * @return          New OCFile instance representing the remote resource described by remote.
+     * @return New OCFile instance representing the remote resource described by remote.
      */
     public static OCFile fillOCFile(RemoteFile remote) {
         OCFile file = new OCFile(remote.getRemotePath());
         file.setCreationTimestamp(remote.getCreationTimestamp());
-        if (remote.getMimeType().equalsIgnoreCase(MimeType.DIRECTORY)){
+        if (remote.getMimeType().equalsIgnoreCase(MimeType.DIRECTORY)) {
             file.setFileLength(remote.getSize());
         } else {
             file.setFileLength(remote.getLength());
@@ -231,14 +230,14 @@ public class FileStorageUtils {
         file.setFavorite(remote.getIsFavorite());
         return file;
     }
-    
+
     /**
      * Creates and populates a new {@link RemoteFile} object with the data read from an {@link OCFile}.
-     * 
+     *
      * @param ocFile    OCFile
-     * @return          New RemoteFile instance representing the resource described by ocFile.
+     * @return New RemoteFile instance representing the resource described by ocFile.
      */
-    public static RemoteFile fillRemoteFile(OCFile ocFile){
+    public static RemoteFile fillRemoteFile(OCFile ocFile) {
         RemoteFile file = new RemoteFile(ocFile.getRemotePath());
         file.setCreationTimestamp(ocFile.getCreationTimestamp());
         file.setLength(ocFile.getFileLength());
@@ -267,21 +266,21 @@ public class FileStorageUtils {
     /**
      * Sorts all filenames, regarding last user decision 
      */
-    public static Vector<OCFile> sortOcFolder(Vector<OCFile> files){
-        switch (mSortOrder){
-        case 0:
-            files = FileStorageUtils.sortOCFilesByName(files);
-            break;
-        case 1:
-            files = FileStorageUtils.sortOCFilesByDate(files);
-            break;
-        case 2:
-            files = FileStorageUtils.sortOCFilesBySize(files);
-            break;
+    public static Vector<OCFile> sortOcFolder(Vector<OCFile> files) {
+        switch (mSortOrder) {
+            case 0:
+                files = FileStorageUtils.sortOCFilesByName(files);
+                break;
+            case 1:
+                files = FileStorageUtils.sortOCFilesByDate(files);
+                break;
+            case 2:
+                files = FileStorageUtils.sortOCFilesBySize(files);
+                break;
         }
 
         files = FileStorageUtils.sortOCFilesByFavourite(files);
-       
+
         return files;
     }
 
@@ -290,8 +289,8 @@ public class FileStorageUtils {
      *
      * @param files of files to sort
      */
-    public static File[] sortLocalFolder(File[] files){
-        switch (mSortOrder){
+    public static File[] sortLocalFolder(File[] files) {
+        switch (mSortOrder) {
             case 0:
                 files = FileStorageUtils.sortLocalFilesByName(files);
                 break;
@@ -305,23 +304,23 @@ public class FileStorageUtils {
 
         return files;
     }
-    
+
     /**
      * Sorts list by Date.
      *
      * @param files list of files to sort
      */
-    public static Vector<OCFile> sortOCFilesByDate(Vector<OCFile> files){
+    public static Vector<OCFile> sortOCFilesByDate(Vector<OCFile> files) {
         final int multiplier = mSortAscending ? 1 : -1;
-        
+
         Collections.sort(files, new Comparator<OCFile>() {
             @SuppressFBWarnings(value = "Bx", justification = "Would require stepping up API level")
             public int compare(OCFile o1, OCFile o2) {
-            Long obj1 = o1.getModificationTimestamp();
-            return multiplier * obj1.compareTo(o2.getModificationTimestamp());
+                Long obj1 = o1.getModificationTimestamp();
+                return multiplier * obj1.compareTo(o2.getModificationTimestamp());
             }
         });
-        
+
         return files;
     }
 
@@ -330,7 +329,7 @@ public class FileStorageUtils {
      *
      * @param filesArray list of files to sort
      */
-    public static File[] sortLocalFilesByDate(File[] filesArray){
+    public static File[] sortLocalFilesByDate(File[] filesArray) {
         final int multiplier = mSortAscending ? 1 : -1;
 
         List<File> files = new ArrayList<File>(Arrays.asList(filesArray));
@@ -338,8 +337,8 @@ public class FileStorageUtils {
         Collections.sort(files, new Comparator<File>() {
             @SuppressFBWarnings(value = "Bx")
             public int compare(File o1, File o2) {
-            Long obj1 = o1.lastModified();
-            return multiplier * obj1.compareTo(o2.lastModified());
+                Long obj1 = o1.lastModified();
+                return multiplier * obj1.compareTo(o2.lastModified());
             }
         });
 
@@ -352,7 +351,7 @@ public class FileStorageUtils {
      *
      * @param files list of files to sort
      */
-    public static Vector<OCFile> sortOCFilesBySize(Vector<OCFile> files){
+    public static Vector<OCFile> sortOCFilesBySize(Vector<OCFile> files) {
         final int multiplier = mSortAscending ? 1 : -1;
 
         Collections.sort(files, new Comparator<OCFile>() {
@@ -414,7 +413,7 @@ public class FileStorageUtils {
      * @param files files to sort
      */
     @SuppressFBWarnings(value = "Bx")
-    public static Vector<OCFile> sortOCFilesByName(Vector<OCFile> files){
+    public static Vector<OCFile> sortOCFilesByName(Vector<OCFile> files) {
         final int multiplier = mSortAscending ? 1 : -1;
 
         Collections.sort(files, new Comparator<OCFile>() {
@@ -429,7 +428,7 @@ public class FileStorageUtils {
                 return multiplier * new AlphanumComparator().compare(o1, o2);
             }
         });
-        
+
         return files;
     }
 
@@ -453,7 +452,7 @@ public class FileStorageUtils {
                     return 1;
                 }
                 return multiplier * new AlphanumComparator().compare(o1.getPath().toLowerCase(),
-                                                              o2.getPath().toLowerCase());
+                        o2.getPath().toLowerCase());
             }
         });
 
@@ -466,7 +465,7 @@ public class FileStorageUtils {
      *
      * @param files files to sort
      */
-    public static Vector<OCFile> sortOCFilesByFavourite(Vector<OCFile> files){
+    public static Vector<OCFile> sortOCFilesByFavourite(Vector<OCFile> files) {
         Collections.sort(files, new Comparator<OCFile>() {
             public int compare(OCFile o1, OCFile o2) {
                 if (o1.getIsFavorite() && o2.getIsFavorite()) {

+ 14 - 17
src/main/java/com/owncloud/android/utils/GetShareWithUsersAsyncTask.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author masensio
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author masensio
+ * 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 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/>.
+ * 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;
@@ -86,11 +85,9 @@ public class GetShareWithUsersAsyncTask extends AsyncTask<Object, Void, Pair<Rem
     @Override
     protected void onPostExecute(Pair<RemoteOperation, RemoteOperationResult> result) {
 
-        if (result!= null)
-        {
+        if (result != null) {
             OnRemoteOperationListener listener = mListener.get();
-            if (listener!= null)
-            {
+            if (listener != null) {
                 listener.onRemoteOperationFinish(result.first, result.second);
             }
         }

+ 11 - 12
src/main/java/com/owncloud/android/utils/MimeType.java

@@ -1,20 +1,19 @@
 /**
- *   Nextcloud Android client application
+ * Nextcloud Android client application
  *
- *   Copyright (C) 2016 Nextcloud
+ * Copyright (C) 2016 Nextcloud
  *
- *   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 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/>.
+ * 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;
 

+ 12 - 13
src/main/java/com/owncloud/android/utils/MimeTypeUtil.java

@@ -1,20 +1,19 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   Copyright (C) 2016 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,
- *   as published by the Free Software Foundation.
+ * 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/>.
+ * 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;
@@ -110,7 +109,7 @@ public class MimeTypeUtil {
      * into account the MIME types known by ownCloud first.
      *
      * @param filename      Name of file
-     * @return              A single MIME type, "application/octet-stream" for unknown file extensions.
+     * @return A single MIME type, "application/octet-stream" for unknown file extensions.
      */
     public static String getBestMimeTypeByFilename(String filename) {
         List<String> candidates = determineMimeTypesByFilename(filename);

+ 13 - 14
src/main/java/com/owncloud/android/utils/OwnCloudSession.java

@@ -1,22 +1,21 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author Bartek Przybylski
- *   Copyright (C) 2011  Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ * @author Bartek Przybylski
+ * Copyright (C) 2011  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 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/>.
+ * 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;
 

+ 1 - 2
src/main/java/com/owncloud/android/utils/PermissionUtil.java

@@ -20,7 +20,6 @@ public class PermissionUtil {
      * Determine whether <em>the app</em> has been granted a particular permission.
      *
      * @param permission The name of the permission being checked.
-     *
      * @return <code>true</code> if app has the permission, or <code>false</code> if not.
      */
     public static boolean checkSelfPermission(Context context, String permission) {
@@ -35,7 +34,7 @@ public class PermissionUtil {
      * which the permission is requested does not clearly communicate to the user
      * what would be the benefit from granting this permission.
      *
-     * @param activity The target activity.
+     * @param activity   The target activity.
      * @param permission A permission to be requested.
      * @return Whether to show permission rationale UI.
      */

+ 12 - 13
src/main/java/com/owncloud/android/utils/UploadUtils.java

@@ -1,21 +1,20 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   @author LukeOwncloud
- *   Copyright (C) 2016 ownCloud Inc.
+ * @author LukeOwncloud
+ * 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 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/>.
+ * 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;

+ 24 - 26
src/main/java/com/owncloud/android/utils/UriUtils.java

@@ -1,20 +1,19 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   Copyright (C) 2015 ownCloud Inc.
+ * 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 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/>.
+ * 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;
@@ -44,12 +43,12 @@ public class UriUtils {
     public static final String TAG = UriUtils.class.getSimpleName();
 
     public static final String URI_CONTENT_SCHEME = "content://";
-    
-    
+
+
     /**
      * Get the value of the data column for this Uri. This is useful for
      * MediaStore Uris, and other file-based ContentProviders.
-     * 
+     *
      * @param context The context.
      * @param uri The Uri to query.
      * @param selection (Optional) Filter used in the query.
@@ -60,7 +59,7 @@ public class UriUtils {
 
         Cursor cursor = null;
         final String column = "_data";
-        final String[] projection = { column };
+        final String[] projection = {column};
 
         try {
             cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
@@ -110,7 +109,7 @@ public class UriUtils {
     }
 
     /**
-     * 
+     *
      * @param uri The Uri to check.
      * @return Whether the Uri is from a content provider as kind "content://..."
      */
@@ -123,7 +122,7 @@ public class UriUtils {
      * Translates a content:// URI referred to a local file file to a path on the local filesystem
      *
      * @param uri       The URI to resolve
-     * @return          The path in the file system to the content or null if it could not be found (not a file)
+     * @return The path in the file system to the content or null if it could not be found (not a file)
      */
     @TargetApi(Build.VERSION_CODES.KITKAT)
     @SuppressFBWarnings("Bx")
@@ -167,7 +166,7 @@ public class UriUtils {
                 }
 
                 final String selection = "_id=?";
-                final String[] selectionArgs = new String[] { split[1] };
+                final String[] selectionArgs = new String[]{split[1]};
 
                 return UriUtils.getDataColumn(context, contentUri, selection, selectionArgs);
             }
@@ -194,7 +193,6 @@ public class UriUtils {
     }
 
 
-
     public static String getDisplayNameForUri(Uri uri, Context context) {
 
         if (uri == null || context == null) {
@@ -220,7 +218,7 @@ public class UriUtils {
                 // Add best possible extension
                 int index = displayName.lastIndexOf('.');
                 if (index == -1 || MimeTypeMap.getSingleton().
-                    getMimeTypeFromExtension(displayName.substring(index + 1)) == null) {
+                        getMimeTypeFromExtension(displayName.substring(index + 1)) == null) {
                     String mimeType = context.getContentResolver().getType(uri);
                     String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
                     if (extension != null) {
@@ -258,11 +256,11 @@ public class UriUtils {
             Cursor cursor = null;
             try {
                 cursor = context.getContentResolver().query(
-                    uri,
-                    new String[]{displayNameColumn},
-                    null,
-                    null,
-                    null
+                        uri,
+                        new String[]{displayNameColumn},
+                        null,
+                        null,
+                        null
                 );
                 if (cursor != null) {
                     cursor.moveToFirst();

+ 18 - 19
src/main/java/com/owncloud/android/widgets/ActionEditText.java

@@ -1,31 +1,24 @@
 /**
- *   ownCloud Android client application
+ * ownCloud Android client application
  *
- *   Copyright (C) 2012 Bartek Przybylski
- *   Copyright (C) 2015 ownCloud Inc.
+ * 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 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/>.
+ * 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.widgets;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import com.owncloud.android.R;
-import com.owncloud.android.lib.common.utils.Log_OC;
-
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.Canvas;
@@ -36,6 +29,12 @@ import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.widget.EditText;
 
+import com.owncloud.android.R;
+import com.owncloud.android.lib.common.utils.Log_OC;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
 public class ActionEditText extends EditText {
     private String s;
     private String optionOneString;

+ 2 - 2
src/main/res/values/setup.xml

@@ -39,7 +39,7 @@
     <bool name="show_whats_new">true</bool>
     <bool name="show_external_links">true</bool>
     
-    // Contacts backup
+    <!-- Contacts backup -->
     <bool name="contacts_backup">true</bool>
     <string name="contacts_backup_folder">/Contacts-Backup</string>
     <integer name="contacts_backup_expire">-1</integer>
@@ -119,7 +119,7 @@
     <string name="report_issue_link" translatable="false">https://github.com/nextcloud/android/issues</string>
 
     <!-- login data links -->
-    <string name="login_data_own_scheme" translatable="false">cloud</string>
+    <string name="login_data_own_scheme" translatable="false">nc</string>
     <!-- url for webview login, with the protocol prefix
     If set, will replace all other login methods available -->
     <string name="webview_login_url" translatable="false"></string>

+ 4 - 1
src/modified/AndroidManifest.xml

@@ -23,12 +23,15 @@
           android:versionName="1.4.2">
 
     <application
-        android:name=".MainApp"
+        android:name=".ModifiedMainApp"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
         android:fullBackupContent="@xml/backup_config"
         android:theme="@style/Theme.ownCloud.Toolbar"
+        tools:node="replace"
         android:manageSpaceActivity="com.owncloud.android.ui.activity.ManageSpaceActivity">
+
+
         <activity
             android:name=".ui.activity.ModifiedFileDisplayActivity"
             android:label="@string/app_name"

+ 40 - 0
src/modified/java/com/owncloud/android/ModifiedMainApp.java

@@ -0,0 +1,40 @@
+/**
+ * Nextcloud Android client application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.owncloud.android;
+
+import com.google.firebase.analytics.FirebaseAnalytics;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+public class ModifiedMainApp extends MainApp {
+
+
+    @SuppressFBWarnings("ST")
+    public void onCreate() {
+        super.onCreate();
+
+
+        if (!getResources().getBoolean(R.bool.analytics_enabled)) {
+            FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false);
+        }
+    }
+
+}

+ 32 - 0
src/modified/java/com/owncloud/android/utils/AnalyticsUtils.java

@@ -0,0 +1,32 @@
+/**
+ * Nextcloud Android client application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.owncloud.android.utils;
+
+import android.app.Activity;
+
+import com.google.firebase.analytics.FirebaseAnalytics;
+
+public class AnalyticsUtils {
+
+    public static void setCurrentScreenName(Activity activity, String s, String s1) {
+        FirebaseAnalytics.getInstance(activity).setCurrentScreen(activity, s, s1);
+    }
+
+}

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff