Explorar el Código

Merge pull request #901 from nextcloud/gplay-edition

Gplay edition
Mario Đanić hace 8 años
padre
commit
28582da92a
Se han modificado 100 ficheros con 1752 adiciones y 974 borrados
  1. 6 0
      CONTRIBUTING.md
  2. 11 1
      build.gradle
  3. 0 236
      build.gradle.modified
  4. 33 0
      src/generic/java/com/owncloud/android/utils/AnalyticsUtils.java
  5. 104 0
      src/gplay/AndroidManifest.xml
  6. 35 0
      src/gplay/google-services.json
  7. 41 0
      src/gplay/java/com/owncloud/android/authentication/ModifiedAuthenticatorActivity.java
  8. 45 0
      src/gplay/java/com/owncloud/android/services/firebase/NCFirebaseInstanceIDService.java
  9. 66 0
      src/gplay/java/com/owncloud/android/services/firebase/NCFirebaseMessagingService.java
  10. 36 0
      src/gplay/java/com/owncloud/android/ui/activity/ModifiedFileDisplayActivity.java
  11. 35 0
      src/gplay/java/com/owncloud/android/utils/AnalyticsUtils.java
  12. 49 0
      src/gplay/java/com/owncloud/android/utils/GooglePlayUtils.java
  13. 248 0
      src/gplay/java/com/owncloud/android/utils/PushUtils.java
  14. 137 0
      src/gplay/res/values/setup.xml
  15. 0 2
      src/main/AndroidManifest.xml
  16. 9 1
      src/main/java/com/owncloud/android/MainApp.java
  17. 3 0
      src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java
  18. 23 21
      src/main/java/com/owncloud/android/db/OCUpload.java
  19. 5 3
      src/main/java/com/owncloud/android/db/PreferenceManager.java
  20. 20 21
      src/main/java/com/owncloud/android/db/ProviderMeta.java
  21. 15 15
      src/main/java/com/owncloud/android/db/UploadResult.java
  22. 15 16
      src/main/java/com/owncloud/android/files/BootupBroadcastReceiver.java
  23. 35 36
      src/main/java/com/owncloud/android/files/FileMenuFilter.java
  24. 16 16
      src/main/java/com/owncloud/android/files/InstantUploadBroadcastReceiver.java
  25. 68 69
      src/main/java/com/owncloud/android/media/MediaControlView.java
  26. 120 120
      src/main/java/com/owncloud/android/media/MediaService.java
  27. 25 26
      src/main/java/com/owncloud/android/media/MediaServiceBinder.java
  28. 8 8
      src/main/java/com/owncloud/android/operations/DownloadFileOperation.java
  29. 9 9
      src/main/java/com/owncloud/android/operations/OAuth2GetAccessToken.java
  30. 0 2
      src/main/java/com/owncloud/android/operations/UnshareOperation.java
  31. 5 5
      src/main/java/com/owncloud/android/services/observer/FileObserverService.java
  32. 8 8
      src/main/java/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java
  33. 14 14
      src/main/java/com/owncloud/android/ui/CheckBoxPreferenceWithLongTitle.java
  34. 14 15
      src/main/java/com/owncloud/android/ui/CustomPopup.java
  35. 14 15
      src/main/java/com/owncloud/android/ui/ExtendedListView.java
  36. 16 16
      src/main/java/com/owncloud/android/ui/NavigationDrawerItem.java
  37. 14 14
      src/main/java/com/owncloud/android/ui/PreferenceWithLongSummary.java
  38. 13 14
      src/main/java/com/owncloud/android/ui/RadioButtonPreference.java
  39. 11 12
      src/main/java/com/owncloud/android/ui/SquareImageView.java
  40. 11 12
      src/main/java/com/owncloud/android/ui/SquareLinearLayout.java
  41. 4 4
      src/main/java/com/owncloud/android/ui/TextDrawable.java
  42. 8 0
      src/main/java/com/owncloud/android/ui/activity/ActivitiesListActivity.java
  43. 1 1
      src/main/java/com/owncloud/android/ui/activity/ComponentsGetter.java
  44. 4 4
      src/main/java/com/owncloud/android/ui/activity/CopyToClipboardActivity.java
  45. 7 0
      src/main/java/com/owncloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java
  46. 0 1
      src/main/java/com/owncloud/android/ui/activity/FileActivity.java
  47. 3 0
      src/main/java/com/owncloud/android/ui/activity/FingerprintActivity.java
  48. 4 1
      src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java
  49. 7 0
      src/main/java/com/owncloud/android/ui/activity/FolderSyncActivity.java
  50. 7 0
      src/main/java/com/owncloud/android/ui/activity/GenericExplanationActivity.java
  51. 7 0
      src/main/java/com/owncloud/android/ui/activity/LogHistoryActivity.java
  52. 7 0
      src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java
  53. 7 0
      src/main/java/com/owncloud/android/ui/activity/ManageSpaceActivity.java
  54. 9 0
      src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java
  55. 6 0
      src/main/java/com/owncloud/android/ui/activity/ParticipateActivity.java
  56. 7 0
      src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java
  57. 2 0
      src/main/java/com/owncloud/android/ui/activity/Preferences.java
  58. 1 1
      src/main/java/com/owncloud/android/ui/activity/StorageMigration.java
  59. 7 0
      src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java
  60. 4 1
      src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java
  61. 7 0
      src/main/java/com/owncloud/android/ui/activity/UploadPathActivity.java
  62. 7 0
      src/main/java/com/owncloud/android/ui/activity/WhatsNewActivity.java
  63. 3 3
      src/main/java/com/owncloud/android/ui/adapter/CertificateCombinedExceptionViewAdapter.java
  64. 8 8
      src/main/java/com/owncloud/android/ui/adapter/DiskLruImageCache.java
  65. 6 5
      src/main/java/com/owncloud/android/ui/adapter/SslCertificateViewAdapter.java
  66. 3 2
      src/main/java/com/owncloud/android/ui/adapter/SslErrorViewAdapter.java
  67. 7 7
      src/main/java/com/owncloud/android/ui/adapter/X509CertificateViewAdapter.java
  68. 1 1
      src/main/java/com/owncloud/android/ui/dialog/ChangelogDialog.java
  69. 1 1
      src/main/java/com/owncloud/android/ui/dialog/ConfirmationDialogFragment.java
  70. 1 1
      src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java
  71. 6 6
      src/main/java/com/owncloud/android/ui/dialog/CreateFolderDialogFragment.java
  72. 5 5
      src/main/java/com/owncloud/android/ui/dialog/CredentialsDialogFragment.java
  73. 2 2
      src/main/java/com/owncloud/android/ui/dialog/LoadingDialog.java
  74. 2 1
      src/main/java/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java
  75. 1 1
      src/main/java/com/owncloud/android/ui/dialog/SamlWebViewDialog.java
  76. 6 6
      src/main/java/com/owncloud/android/ui/dialog/ShareLinkToDialog.java
  77. 1 1
      src/main/java/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java
  78. 5 5
      src/main/java/com/owncloud/android/ui/dialog/SslUntrustedCertDialog.java
  79. 13 14
      src/main/java/com/owncloud/android/ui/dialog/SslValidatorDialog.java
  80. 1 1
      src/main/java/com/owncloud/android/ui/dialog/UploadSourceDialogFragment.java
  81. 3 3
      src/main/java/com/owncloud/android/ui/errorhandling/ExceptionHandler.java
  82. 9 0
      src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java
  83. 8 0
      src/main/java/com/owncloud/android/ui/fragment/FileDetailFragment.java
  84. 15 7
      src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java
  85. 5 0
      src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java
  86. 9 0
      src/main/java/com/owncloud/android/ui/fragment/SearchShareesFragment.java
  87. 9 0
      src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java
  88. 10 1
      src/main/java/com/owncloud/android/ui/fragment/UploadListFragment.java
  89. 0 3
      src/main/java/com/owncloud/android/ui/helpers/FileOperationsHelper.java
  90. 5 3
      src/main/java/com/owncloud/android/ui/notifications/NotificationUtils.java
  91. 5 6
      src/main/java/com/owncloud/android/ui/preview/FileDownloadFragment.java
  92. 9 0
      src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java
  93. 7 7
      src/main/java/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java
  94. 5 1
      src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java
  95. 4 0
      src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java
  96. 6 0
      src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.java
  97. 61 76
      src/main/java/com/owncloud/android/utils/BitmapUtils.java
  98. 17 17
      src/main/java/com/owncloud/android/utils/ConnectivityUtils.java
  99. 12 13
      src/main/java/com/owncloud/android/utils/DialogMenuItem.java
  100. 28 27
      src/main/java/com/owncloud/android/utils/DisplayUtils.java

+ 6 - 0
CONTRIBUTING.md

@@ -79,6 +79,12 @@ Our formatter setup is rather simple:
 * Auto optimize imports (Settings->Editor->Auto Import->Optimize imports on the fly)
 
 
+### Build variants
+There are three build variants
+* generic: no Google Stuff, used for FDroid
+* gplay: with Google Stuff (Push notification) and Analytics disabled, used for Google Play Store
+* modified: custom, with Google Stuff and Analytics enabled, used for branded releases
+
 ## Contribution process
 * Contribute your code in the branch 'master'. It will give us a better chance to test your code before merging it with stable code.
 * For your first contribution start a pull request on master.

+ 11 - 1
build.gradle

@@ -78,10 +78,15 @@ 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'
             }
 
+            gplay {
+                applicationId 'com.nextcloud.client'
+            }
+
             modified {
                 // structure is:
                 // domain tld
@@ -192,11 +197,15 @@ dependencies {
     compile 'org.greenrobot:eventbus:3.0.0'
     compile 'com.googlecode.ez-vcard:ez-vcard:0.10.2'
 
+// uncomment for gplay, modified
+//    compile 'com.google.android.gms:play-services:10.2.1'
+
     compile 'org.parceler:parceler-api:1.1.6'
     annotationProcessor 'org.parceler:parceler:1.1.6'
 
     compile 'com.github.bumptech.glide:glide:3.7.0'
     compile 'com.caverock:androidsvg:1.2.1'
+
     /// dependencies for local unit tests
     testCompile 'junit:junit:4.12'
     testCompile 'org.mockito:mockito-core:1.10.19'
@@ -232,4 +241,5 @@ tasks.withType(Test) {
     }
 }
 
-apply plugin: 'com.google.gms.google-services'
+// uncomment for gplay, modified (must be at the bottom)
+//apply plugin: 'com.google.gms.google-services'

+ 0 - 236
build.gradle.modified

@@ -1,236 +0,0 @@
-// Gradle build file
-//
-// This project was started in Eclipse and later moved to Android Studio. In the transition, both IDEs were supported.
-// Due to this, the files layout is not the usual in new projects created with Android Studio / gradle. This file
-// merges declarations usually split in two separates build.gradle file, one for global settings of the project in
-// its root folder, another one for the app module in subfolder of root.
-
-buildscript {
-    repositories {
-        jcenter()
-        maven {
-            url 'https://oss.sonatype.org/content/repositories/snapshots/'
-        }
-    }
-    dependencies {
-        classpath 'com.android.tools.build:gradle:2.3.1'
-        classpath 'com.google.gms:google-services:3.0.0'
-    }
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'checkstyle'
-apply plugin: 'pmd'
-apply plugin: 'findbugs'
-
-configurations.all {
-    // check for updates every build
-    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
-}
-
-ext {
-    supportLibraryVersion = '25.0.0'
-
-    travisBuild = System.getenv("TRAVIS") == "true"
-
-    // allows for -Dpre-dex=false to be set
-    preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
-}
-
-repositories {
-    jcenter()
-    maven { url "https://jitpack.io" }
-    maven {
-        url 'https://oss.sonatype.org/content/repositories/snapshots/'
-    }
-
-    flatDir {
-        dirs 'libs'
-    }
-}
-
-android {
-    lintOptions {
-        abortOnError true
-        lintConfig file("${project.rootDir}/lint.xml")
-        htmlReport true
-        htmlOutput file("$project.buildDir/reports/lint/lint.html")
-    }
-
-    dexOptions {
-        javaMaxHeapSize "4g"
-    }
-
-    compileSdkVersion 25
-    buildToolsVersion '25.0.0'
-
-    defaultConfig {
-        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
-
-        // arguments to be passed to functional tests
-        testInstrumentationRunnerArgument "TEST_USER", "\"$System.env.OCTEST_APP_USERNAME\""
-        testInstrumentationRunnerArgument "TEST_PASSWORD", "\"$System.env.OCTEST_APP_PASSWORD\""
-        testInstrumentationRunnerArgument "TEST_SERVER_URL", "\"$System.env.OCTEST_SERVER_BASE_URL\""
-
-        multiDexEnabled true
-
-        // adapt structure from Eclipse to Gradle/Android Studio expectations;
-        // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
-
-        productFlavors {
-            generic {
-                applicationId 'com.nextcloud.client'
-            }
-
-            modified {
-                // structure is:
-                // domain tld
-                // domain name
-                // .client
-                applicationId 'com.custom.client'
-            }
-        }
-
-        configurations {
-            modifiedCompile
-        }
-    }
-
-
-    // adapt structure from Eclipse to Gradle/Android Studio expectations;
-    // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
-
-    dexOptions {
-        // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
-        preDexLibraries = preDexEnabled && !travisBuild
-    }
-
-    compileOptions {
-        sourceCompatibility JavaVersion.VERSION_1_7
-        targetCompatibility JavaVersion.VERSION_1_7
-    }
-
-    lintOptions {
-        abortOnError false
-    }
-
-    packagingOptions {
-        exclude 'META-INF/LICENSE.txt'
-        exclude 'META-INF/LICENSE'
-    }
-
-    task checkstyle(type: Checkstyle) {
-        configFile = file("${rootProject.projectDir}/checkstyle.xml")
-        configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
-        source 'src'
-        include '**/*.java'
-        exclude '**/gen/**'
-        classpath = files()
-    }
-
-    task pmd(type: Pmd) {
-        ruleSetFiles = files("${project.rootDir}/pmd-ruleset.xml")
-        ignoreFailures = false
-        ruleSets = []
-
-        source 'src'
-        include '**/*.java'
-        exclude '**/gen/**'
-
-        reports {
-            xml.enabled = false
-            html.enabled = true
-            xml {
-                destination "$project.buildDir/reports/pmd/pmd.xml"
-            }
-            html {
-                destination "$project.buildDir/reports/pmd/pmd.html"
-            }
-        }
-    }
-
-    task findbugs(type: FindBugs) {
-        ignoreFailures = false
-        effort = "max"
-        reportLevel = "high"
-        classes = files("$project.buildDir/intermediates/classes")
-        excludeFilter = new File("${project.rootDir}/findbugs-filter.xml")
-        source 'src'
-        include '**/*.java'
-        exclude '**/gen/**'
-
-        reports {
-            xml.enabled = false
-            html.enabled = true
-            html {
-                destination "$project.buildDir/reports/findbugs/findbugs.html"
-            }
-        }
-        classpath = files()
-    }
-    check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
-
-}
-
-dependencies {
-    /// dependencies for app building
-    compile name: 'touch-image-view'
-    compile 'com.android.support:multidex:1.0.1'
-
-    compile 'com.github.nextcloud:android-library:1.0.15'
-    compile "com.android.support:support-v4:${supportLibraryVersion}"
-    compile "com.android.support:design:${supportLibraryVersion}"
-    compile 'com.jakewharton:disklrucache:2.0.2'
-    compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
-    compile "com.android.support:cardview-v7:${supportLibraryVersion}"
-    compile 'com.getbase:floatingactionbutton:1.10.1'
-    compile 'com.google.code.findbugs:annotations:2.0.1'
-    compile group: 'commons-io', name: 'commons-io', version: '2.4'
-    compile 'com.github.evernote:android-job:v1.1.9'
-    compile 'com.jakewharton:butterknife:8.4.0'
-    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'
-    annotationProcessor 'org.parceler:parceler:1.1.6'
-
-    compile 'com.github.bumptech.glide:glide:3.7.0'
-    compile 'com.caverock:androidsvg:1.2.1'
-    /// dependencies for local unit tests
-    testCompile 'junit:junit:4.12'
-    testCompile 'org.mockito:mockito-core:1.10.19'
-
-    /// dependencies for instrumented tests
-    // JUnit4 Rules
-    androidTestCompile 'com.android.support.test:rules:0.5'
-
-    // Android JUnit Runner
-    androidTestCompile 'com.android.support.test:runner:0.5'
-
-    // Android Annotation Support
-    androidTestCompile "com.android.support:support-annotations:${supportLibraryVersion}"
-
-    // Espresso core
-    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
-
-    // UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
-    //androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
-    // fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
-    //androidTestCompile "com.android.support:support-annotations:${supportLibraryVersion}"
-
-}
-
-configurations.all {
-    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
-}
-
-tasks.withType(Test) {
-    /// increased logging for tests
-    testLogging {
-        events "passed", "skipped", "failed"
-    }
-}
-
-apply plugin: 'com.google.gms.google-services'

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

@@ -0,0 +1,33 @@
+/**
+ * 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
+    }
+
+    public static void disableAnalytics() {
+        // do nothing
+    }
+
+}

+ 104 - 0
src/gplay/AndroidManifest.xml

@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Nextcloud Android client application
+
+  Copyright (C) 2017 Mario Danic
+
+  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/>.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          xmlns:tools="http://schemas.android.com/tools"
+          package="com.owncloud.android"
+          android:versionCode="10040299"
+          android:versionName="1.4.2">
+
+    <application
+        android:name=".MainApp"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:fullBackupContent="@xml/backup_config"
+        android:theme="@style/Theme.ownCloud.Toolbar"
+        android:manageSpaceActivity="com.owncloud.android.ui.activity.ManageSpaceActivity">
+
+        <meta-data android:name="com.google.android.gms.version"
+                   android:value="@integer/google_play_services_version" />
+
+        <activity
+            android:name=".ui.activity.ModifiedFileDisplayActivity"
+            android:label="@string/app_name"
+            android:theme="@style/Theme.ownCloud.Toolbar.Drawer">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <activity
+            android:name=".authentication.ModifiedAuthenticatorActivity"
+            android:exported="true"
+            android:launchMode="singleTask"
+            android:theme="@style/Theme.ownCloud.noActionBar.Login">
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.BROWSABLE" />
+
+                <data android:scheme="@string/oauth2_redirect_scheme" />
+            </intent-filter>
+            <intent-filter>
+                <action android:name="com.owncloud.android.workaround.accounts.CREATE" />
+
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.BROWSABLE" />
+                <data android:scheme="@string/login_data_own_scheme" android:host="login"/>
+            </intent-filter>
+        </activity>
+
+        <activity
+            android:name=".ui.activity.FileDisplayActivity"
+            tools:node="remove"/>
+
+        <activity-alias
+            android:name=".ui.activity.FileDisplayActivity"
+            android:targetActivity=".ui.activity.ModifiedFileDisplayActivity"
+            tools:replace="android:targetActivity"/>
+
+        <activity-alias
+            android:name=".authentication.AuthenticatorActivity"
+            android:targetActivity=".authentication.ModifiedAuthenticatorActivity"
+            tools:replace="android:targetActivity"/>
+
+
+        <service
+            android:name=".services.firebase.NCFirebaseMessagingService">
+            <intent-filter>
+                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
+            </intent-filter>
+        </service>
+
+        <service
+            android:name=".services.firebase.NCFirebaseInstanceIDService">
+            <intent-filter>
+                <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
+            </intent-filter>
+        </service>
+
+    </application>
+
+</manifest>

+ 35 - 0
src/gplay/google-services.json

@@ -0,0 +1,35 @@
+{
+  "project_info": {
+    "project_number": "",
+    "project_id": ""
+  },
+  "client": [
+    {
+      "client_info": {
+        "mobilesdk_app_id": "",
+        "android_client_info": {
+          "package_name": "com.nextcloud.client"
+        }
+      },
+      "oauth_client": [],
+      "api_key": [
+        {
+          "current_key": ""
+        }
+      ],
+      "services": {
+        "analytics_service": {
+          "status": 1
+        },
+        "appinvite_service": {
+          "status": 1,
+          "other_platform_oauth_client": []
+        },
+        "ads_service": {
+          "status": 1
+        }
+      }
+    }
+  ],
+  "configuration_version": "1"
+}

+ 41 - 0
src/gplay/java/com/owncloud/android/authentication/ModifiedAuthenticatorActivity.java

@@ -0,0 +1,41 @@
+package com.owncloud.android.authentication;
+
+import android.os.Bundle;
+
+import com.owncloud.android.utils.GooglePlayUtils;
+
+/**
+ * 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/>.
+ */
+
+public class ModifiedAuthenticatorActivity extends AuthenticatorActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        GooglePlayUtils.checkPlayServices(this);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        GooglePlayUtils.checkPlayServices(this);
+    }
+
+}

+ 45 - 0
src/gplay/java/com/owncloud/android/services/firebase/NCFirebaseInstanceIDService.java

@@ -0,0 +1,45 @@
+/**
+ * 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.services.firebase;
+
+import android.text.TextUtils;
+
+import com.google.firebase.iid.FirebaseInstanceId;
+import com.google.firebase.iid.FirebaseInstanceIdService;
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+import com.owncloud.android.db.PreferenceManager;
+import com.owncloud.android.utils.PushUtils;
+
+public class NCFirebaseInstanceIDService extends FirebaseInstanceIdService {
+    private static final String TAG = "NCFirebaseInstanceID";
+
+    @Override
+    public void onTokenRefresh() {
+        //You can implement this method to store the token on your server
+        if (!TextUtils.isEmpty(getResources().getString(R.string.push_server_url))) {
+            PreferenceManager.setPushToken(MainApp.getAppContext(), FirebaseInstanceId.getInstance().getToken());
+            PreferenceManager.setPushTokenUpdateTime(MainApp.getAppContext(), System.currentTimeMillis());
+
+            PushUtils.pushRegistrationToServer();
+        }
+    }
+}
+

+ 66 - 0
src/gplay/java/com/owncloud/android/services/firebase/NCFirebaseMessagingService.java

@@ -0,0 +1,66 @@
+/**
+ * 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.services.firebase;
+
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.support.v4.app.NotificationCompat;
+
+import com.google.firebase.messaging.FirebaseMessagingService;
+import com.google.firebase.messaging.RemoteMessage;
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+import com.owncloud.android.ui.activity.NotificationsActivity;
+
+public class NCFirebaseMessagingService extends FirebaseMessagingService {
+    private static final String TAG = "NCFirebaseMessaging";
+
+    @Override
+    public void onMessageReceived(RemoteMessage remoteMessage) {
+        super.onMessageReceived(remoteMessage);
+
+        sendNotification(MainApp.getAppContext().getString(R.string.new_notification_received));
+    }
+
+    private void sendNotification(String contentTitle) {
+        Intent intent = new Intent(this, NotificationsActivity.class);
+        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent,
+                PendingIntent.FLAG_ONE_SHOT);
+
+        Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
+        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
+                .setSmallIcon(R.mipmap.ic_launcher)
+                .setContentTitle(contentTitle)
+                .setSound(defaultSoundUri)
+                .setAutoCancel(true)
+                .setContentIntent(pendingIntent);
+
+        NotificationManager notificationManager =
+                (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+
+        notificationManager.notify(0, notificationBuilder.build());
+    }
+
+}

+ 36 - 0
src/gplay/java/com/owncloud/android/ui/activity/ModifiedFileDisplayActivity.java

@@ -0,0 +1,36 @@
+/**
+ * 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.ui.activity;
+
+import com.owncloud.android.ui.events.TokenPushEvent;
+import com.owncloud.android.utils.PushUtils;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+public class ModifiedFileDisplayActivity extends FileDisplayActivity {
+
+    @Subscribe(threadMode = ThreadMode.BACKGROUND)
+    public void onMessageEvent(TokenPushEvent event) {
+        PushUtils.pushRegistrationToServer();
+    }
+
+}

+ 35 - 0
src/gplay/java/com/owncloud/android/utils/AnalyticsUtils.java

@@ -0,0 +1,35 @@
+/**
+ * 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;
+import com.owncloud.android.MainApp;
+
+public class AnalyticsUtils {
+    public static void setCurrentScreenName(Activity activity, String s, String s1) {
+        // do nothing
+    }
+
+    public static void disableAnalytics() {
+        FirebaseAnalytics.getInstance(MainApp.getAppContext()).setAnalyticsCollectionEnabled(false);
+    }
+}

+ 49 - 0
src/gplay/java/com/owncloud/android/utils/GooglePlayUtils.java

@@ -0,0 +1,49 @@
+/**
+ * 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 android.util.Log;
+
+import com.google.android.gms.common.ConnectionResult;
+import com.google.android.gms.common.GoogleApiAvailability;
+
+public class GooglePlayUtils {
+    private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
+    private static final String TAG = "GooglePlayUtils";
+
+    public static boolean checkPlayServices(Activity activity) {
+        GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
+        int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
+        if (resultCode != ConnectionResult.SUCCESS) {
+            if (apiAvailability.isUserResolvableError(resultCode)) {
+                apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
+                        .show();
+            } else {
+                Log.i(TAG, "This device is not supported.");
+                activity.finish();
+            }
+            return false;
+        }
+        return true;
+    }
+
+}

+ 248 - 0
src/gplay/java/com/owncloud/android/utils/PushUtils.java

@@ -0,0 +1,248 @@
+/**
+ * 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.accounts.Account;
+import android.accounts.AuthenticatorException;
+import android.accounts.OperationCanceledException;
+import android.content.Context;
+import android.text.TextUtils;
+import android.util.Base64;
+
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountUtils;
+import com.owncloud.android.db.PreferenceManager;
+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.operations.RemoteOperation;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForNotificationsOperation;
+import com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForProxyOperation;
+import com.owncloud.android.lib.resources.notifications.models.PushResponse;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.PublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+
+public class PushUtils {
+
+    private static final String TAG = "PushUtils";
+    private static final String KEYPAIR_FOLDER = "nc-keypair";
+    private static final String KEYPAIR_FILE_NAME = "push_key";
+    private static final String KEYPAIR_PRIV_EXTENSION = ".priv";
+    private static final String KEYPAIR_PUB_EXTENSION = ".pub";
+
+    public static String generateSHA512Hash(String pushToken) {
+        MessageDigest messageDigest = null;
+        try {
+            messageDigest = MessageDigest.getInstance("SHA-512");
+            messageDigest.update(pushToken.getBytes());
+            return bytesToHex(messageDigest.digest());
+        } catch (NoSuchAlgorithmException e) {
+            Log_OC.d(TAG, "SHA-512 algorithm not supported");
+        }
+        return "";
+    }
+
+    private static String bytesToHex(byte[] bytes) {
+        StringBuilder result = new StringBuilder();
+        for (byte individualByte : bytes) {
+            result.append(Integer.toString((individualByte & 0xff) + 0x100, 16)
+                    .substring(1));
+        }
+        return result.toString();
+    }
+
+    public static int generateRsa2048KeyPair() {
+        String keyPath = MainApp.getStoragePath() + File.separator + MainApp.getDataFolder() + File.separator
+                + KEYPAIR_FOLDER;
+
+        String privateKeyPath = keyPath + File.separator + KEYPAIR_FILE_NAME + KEYPAIR_PRIV_EXTENSION;
+        String publicKeyPath = keyPath + File.separator + KEYPAIR_FILE_NAME + KEYPAIR_PUB_EXTENSION;
+        File keyPathFile = new File(keyPath);
+
+        if (!new File(privateKeyPath).exists() && !new File(publicKeyPath).exists()) {
+            try {
+                if (!keyPathFile.exists()) {
+                    keyPathFile.mkdir();
+                }
+                KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+                keyGen.initialize(2048);
+
+                KeyPair pair = keyGen.generateKeyPair();
+                int statusPrivate = saveKeyToFile(pair.getPrivate(), privateKeyPath);
+                int statusPublic = saveKeyToFile(pair.getPublic(), publicKeyPath);
+
+                if (statusPrivate == 0 && statusPublic == 0) {
+                    // all went well
+                    return 0;
+                } else {
+                    return -2;
+                }
+            } catch (NoSuchAlgorithmException e) {
+                Log_OC.d(TAG, "RSA algorithm not supported");
+            }
+        } else {
+            // we already have the key
+            return -1;
+        }
+
+        // we failed to generate the key
+        return -2;
+    }
+
+    public static void pushRegistrationToServer() {
+        String token = PreferenceManager.getPushToken(MainApp.getAppContext());
+        if (!TextUtils.isEmpty(MainApp.getAppContext().getResources().getString(R.string.push_server_url)) &&
+                !TextUtils.isEmpty(token)) {
+            PushUtils.generateRsa2048KeyPair();
+            String pushTokenHash = PushUtils.generateSHA512Hash(token).toLowerCase();
+            PublicKey devicePublicKey = (PublicKey) PushUtils.readKeyFromFile(true);
+            if (devicePublicKey != null) {
+                byte[] publicKeyBytes = Base64.encode(devicePublicKey.getEncoded(), Base64.NO_WRAP);
+                String publicKey = new String(publicKeyBytes);
+                publicKey = publicKey.replaceAll("(.{64})", "$1\n");
+
+                publicKey = "-----BEGIN PUBLIC KEY-----\n" + publicKey + "\n-----END PUBLIC KEY-----\n";
+
+                Context context = MainApp.getAppContext();
+                for (Account account : AccountUtils.getAccounts(context)) {
+                    try {
+                        OwnCloudAccount ocAccount = new OwnCloudAccount(account, context);
+                        OwnCloudClient mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
+                                getClientFor(ocAccount, context);
+
+                        RemoteOperation registerAccountDeviceForNotificationsOperation =
+                                new RegisterAccountDeviceForNotificationsOperation(pushTokenHash,
+                                        publicKey,
+                                        context.getResources().getString(R.string.push_server_url));
+
+                        RemoteOperationResult remoteOperationResult = registerAccountDeviceForNotificationsOperation.
+                                execute(mClient);
+
+                        if (remoteOperationResult.isSuccess()) {
+                            PushResponse pushResponse = remoteOperationResult.getPushResponseData();
+
+                            RemoteOperation registerAccountDeviceForProxyOperation = new
+                                    RegisterAccountDeviceForProxyOperation(
+                                    context.getResources().getString(R.string.push_server_url),
+                                    token, pushResponse.getDeviceIdentifier(), pushResponse.getSignature(),
+                                    pushResponse.getPublicKey());
+
+                            remoteOperationResult = registerAccountDeviceForProxyOperation.execute(mClient);
+                            PreferenceManager.setPushTokenLastSentTime(MainApp.getAppContext(),
+                                    System.currentTimeMillis());
+
+                        }
+                    } catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) {
+                        Log_OC.d(TAG, "Failed to find an account");
+                    } catch (AuthenticatorException e) {
+                        Log_OC.d(TAG, "Failed via AuthenticatorException");
+                    } catch (IOException e) {
+                        Log_OC.d(TAG, "Failed via IOException");
+                    } catch (OperationCanceledException e) {
+                        Log_OC.d(TAG, "Failed via OperationCanceledException");
+                    }
+                }
+            }
+        }
+    }
+
+    public static Key readKeyFromFile(boolean readPublicKey) {
+        String keyPath = MainApp.getStoragePath() + File.separator + MainApp.getDataFolder() + File.separator
+                + KEYPAIR_FOLDER;
+        
+        String privateKeyPath = keyPath + File.separator + KEYPAIR_FILE_NAME + KEYPAIR_PRIV_EXTENSION;
+        String publicKeyPath = keyPath + File.separator + KEYPAIR_FILE_NAME + KEYPAIR_PUB_EXTENSION;
+
+        String path;
+
+        if (readPublicKey) {
+            path = publicKeyPath;
+        } else {
+            path = privateKeyPath;
+        }
+
+        FileInputStream fileInputStream = null;
+        try {
+            fileInputStream = new FileInputStream(path);
+            byte[] bytes = new byte[fileInputStream.available()];
+            fileInputStream.read(bytes);
+            fileInputStream.close();
+
+            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
+
+            if (readPublicKey) {
+                X509EncodedKeySpec keySpec = new X509EncodedKeySpec(bytes);
+                return keyFactory.generatePublic(keySpec);
+            } else {
+                PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bytes);
+                return keyFactory.generatePrivate(keySpec);
+            }
+
+        } catch (FileNotFoundException e) {
+            Log_OC.d(TAG, "Failed to find path while reading the Key");
+        } catch (IOException e) {
+            Log_OC.d(TAG, "IOException while reading the key");
+        } catch (InvalidKeySpecException e) {
+            Log_OC.d(TAG, "InvalidKeySpecException while reading the key");
+        } catch (NoSuchAlgorithmException e) {
+            Log_OC.d(TAG, "RSA algorithm not supported");
+        }
+
+        return null;
+    }
+
+    private static int saveKeyToFile(Key key, String path) {
+        byte[] encoded = key.getEncoded();
+        FileOutputStream keyFileOutputStream = null;
+        try {
+            if (!new File(path).exists()) {
+                new File(path).createNewFile();
+            }
+            keyFileOutputStream = new FileOutputStream(path);
+            keyFileOutputStream.write(encoded);
+            keyFileOutputStream.close();
+            return 0;
+        } catch (FileNotFoundException e) {
+            Log_OC.d(TAG, "Failed to save key to file");
+        } catch (IOException e) {
+            Log_OC.d(TAG, "Failed to save key to file via IOException");
+        }
+
+        return -1;
+    }
+}

+ 137 - 0
src/gplay/res/values/setup.xml

@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <!-- Beta indicator -->
+    <bool name="is_beta">false</bool>
+
+    <!-- App name  and other strings-->
+    <string name="app_name">Nextcloud</string>
+    <string name="account_type">nextcloud</string>	<!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->
+    <string name="authority">org.nextcloud</string>	<!-- better if was the app package with ".provider" appended ; it identifies the provider -->
+    <string name="users_and_groups_search_authority">com.nextcloud.android.providers.UsersAndGroupsSearchProvider</string>
+    <string name="users_and_groups_share_with">com.nextcloud.android.providers.UsersAndGroupsSearchProvider.action.SHARE_WITH</string>
+    <string name="document_provider_authority">org.nextcloud.documents</string>
+    <string name="file_provider_authority">org.nextcloud.files</string>
+    <string name ="db_file">nextcloud.db</string>
+    <string name ="db_name">nextcloud</string>
+    <string name ="data_folder">nextcloud</string>
+    <string name ="log_name">nextcloud</string>
+    <string name ="default_display_name_for_root_folder">Nextcloud</string>
+    <string name ="user_agent">Mozilla/5.0 (Android) ownCloud-android/%1$s</string>
+
+    <!-- URLs and flags related -->
+    <string name="server_url"></string>
+    <bool name="show_server_url_input">true</bool>
+    <!-- Can be regular (full input), prefix (subdomain input) and suffix (directory input) -->
+    <!-- Requires server url to be set -->
+    <string name="server_input_type">regular</string>
+    <bool name="show_welcome_link">true</bool>
+    <string name="welcome_link_url">"https://nextcloud.com/providers"</string>
+    <string name="share_api_link"></string>
+
+    <!-- Flags to setup the authentication methods available in the app -->
+    <string name="auth_method_oauth2">off</string>
+    <string name="auth_method_saml_web_sso">off</string>
+
+    <!-- Flags to enable/disable some features -->
+    <string name = "send_files_to_other_apps">on</string>
+    <bool name = "share_via_link_feature">true</bool>
+    <bool name = "share_with_users_feature">true</bool>
+    <bool name="show_whats_new">true</bool>
+    <bool name="show_external_links">true</bool>
+
+    <!-- Contacts backup -->
+    <bool name="contacts_backup">true</bool>
+    <string name="contacts_backup_folder">/Contacts-Backup</string>
+    <integer name="contacts_backup_expire">-1</integer>
+
+    <!-- To fill if you want to show webviews instead of regular welcome views -->
+    <array name="whatsnew_urls"></array>
+
+    <!-- Colors -->
+    <color name="primary">@color/nc_blue</color>
+    <color name="primary_dark">#006AA3</color>
+    <color name="color_accent">@color/nc_blue_accent</color>
+    <color name="login_text_color">@color/white</color>
+    <color name="login_text_hint_color">#7fC0E3</color>
+    <color name="login_background_color">#FFFFFF</color>    <!-- Not used at the moment -->
+    <color name="login_logo_background_color">#FFFFFF</color>    <!-- Not used at the moment -->
+    <color name="background_color">#FFFFFF</color>
+    <color name="navigation_bar_start_color">#0082c9</color>
+    <color name="navigation_bar_end_color">#0082c9</color>
+    <color name="primary_button_background_color">@color/nc_blue_accent</color>
+    <color name="primary_button_text_color">@color/white</color>
+    <color name="secondary_button_background_color">#D6D7D7</color>
+    <color name="secondary_button_text_color">@color/black</color>
+
+    <!-- special transparent action bar colors for image preview -->
+    <color name="color_transparent">#201D2D44</color>
+    <color name="color_dark_transparent">#40162233</color>
+
+    <!-- Button -->
+    <color name="button_text_color">#000000</color>
+
+    <!-- Multiselect backgrounds -->
+    <color name="action_mode_background">#757575</color>
+    <color name="action_mode_status_bar_background">#616161</color>
+    <color name="selected_item_background">#ECECEC</color>
+
+    <!-- Multiaccount support -->
+    <bool name="multiaccount_support">true</bool>
+
+    <!-- Drawer options -->
+    <bool name="recently_added_enabled">false</bool>
+    <bool name="recently_modified_enabled">false</bool>
+    <bool name="shared_enabled">true</bool>
+    <bool name="videos_enabled">false</bool>
+
+    <!-- Bottom toolbar -->
+    <bool name="bottom_toolbar_enabled">false</bool>
+
+    <!-- Help, imprint and feedback, and other things -->
+    <bool name="fingerprint_enabled">true</bool>
+    <bool name="davdroid_integration_enabled">true</bool>
+    <bool name="help_enabled">true</bool>
+    <bool name="imprint_enabled">false</bool>
+    <bool name="recommend_enabled">true</bool>
+    <bool name="feedback_enabled">true</bool>
+    <bool name="logger_enabled">false</bool>
+    <string name="url_help">https://help.nextcloud.com/c/feature</string>
+    <string name="url_imprint"></string>
+    <string name="mail_recommend">"mailto:"</string>
+    <string name="mail_feedback">"mailto:android@nextcloud.com"</string>
+    <string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
+    <string name="url_server_install">https://nextcloud.com/install</string>
+
+    <!--Destination mail for sending log files -->
+    <string name="mail_logger"></string>
+
+    <!-- Determine is participate enabled -->
+    <bool name="participate_enabled">true</bool>
+    <!-- Participate links -->
+    <string name="fdroid_beta_link" translatable="false">https://f-droid.org/repository/browse/?fdid=com.nextcloud.android.beta</string>
+    <string name="beta_apk_link" translatable="false">https://download.nextcloud.com/android/dev/latest.apk</string>
+    <string name="play_store_register_beta" translatable="false">https://play.google.com/apps/testing/com.nextcloud.client</string>
+    <string name="fdroid_link" translatable="false">https://f-droid.org/repository/browse/?fdid=com.nextcloud.client</string>
+    <string name="irc_weblink" translatable="false">http://webchat.freenode.net?channels=nextcloud-mobile</string>
+    <string name="help_link" translatable="false">https://help.nextcloud.com/c/clients/android</string>
+    <string name="translation_link" translatable="false">https://www.transifex.com/nextcloud/nextcloud/android/</string>
+    <string name="contributing_link" translatable="false">https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md</string>
+    <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">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>
+
+    <!-- analytics enabled -->
+    <bool name="analytics_enabled">false</bool>
+
+    <!-- Files becomes Home -->
+    <bool name="use_home">false</bool>
+
+    <!-- Push server url -->
+    <string name="push_server_url" translatable="false">https://push-notifications.nextcloud.com</string>
+</resources>
+
+

+ 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"

+ 9 - 1
src/main/java/com/owncloud/android/MainApp.java

@@ -46,6 +46,7 @@ import com.owncloud.android.services.NCJobCreator;
 import com.owncloud.android.services.observer.SyncedFolderObserverService;
 import com.owncloud.android.ui.activity.Preferences;
 import com.owncloud.android.ui.activity.WhatsNewActivity;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -89,6 +90,10 @@ public class MainApp extends MultiDexApplication {
         JobManager.create(this).addJobCreator(new NCJobCreator());
         MainApp.mContext = getApplicationContext();
 
+        if (!getResources().getBoolean(R.bool.analytics_enabled)) {
+            AnalyticsUtils.disableAnalytics();
+        }
+
         SharedPreferences appPrefs =
                 PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
         MainApp.storagePath = appPrefs.getString(Preferences.PreferenceKeys.STORAGE_PATH, Environment.
@@ -278,6 +283,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
@@ -312,7 +318,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

+ 3 - 0
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,6 +805,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     protected void onResume() {
         super.onResume();
 
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+
         if (!webViewLoginMethod) {
             // bound here to avoid spurious changes triggered by Android on device rotations
             mHostUrlInput.setOnFocusChangeListener(this);

+ 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

+ 8 - 0
src/main/java/com/owncloud/android/ui/activity/ActivitiesListActivity.java

@@ -52,6 +52,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.activities.GetRemoteActivitiesOperation;
 import com.owncloud.android.ui.adapter.ActivityListAdapter;
 import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -68,6 +69,7 @@ import butterknife.Unbinder;
 public class ActivitiesListActivity extends FileActivity {
 
     private static final String TAG = ActivitiesListActivity.class.getSimpleName();
+    private static final String SCREEN_NAME = "Activities";
 
     @BindView(R.id.empty_list_view)
     public LinearLayout emptyContentContainer;
@@ -299,4 +301,10 @@ public class ActivitiesListActivity extends FileActivity {
         }
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
 }

+ 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.
  */

+ 7 - 0
src/main/java/com/owncloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java

@@ -44,6 +44,7 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.dialog.IndeterminateProgressDialog;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 
 import java.io.File;
@@ -133,6 +134,12 @@ public class ErrorsWhileCopyingHandlerActivity  extends AppCompatActivity
         okBtn.setOnClickListener(this);
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
         /**
          * Customized adapter, showing the local files as main text in two-lines list item and the
          * remote files as the secondary text.

+ 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;

+ 3 - 0
src/main/java/com/owncloud/android/ui/activity/FingerprintActivity.java

@@ -47,6 +47,7 @@ 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.utils.AnalyticsUtils;
 
 import java.io.IOException;
 import java.security.InvalidAlgorithmParameterException;
@@ -69,6 +70,7 @@ import javax.crypto.SecretKey;
 public class FingerprintActivity extends AppCompatActivity {
 
     private static final String TAG = FingerprintActivity.class.getSimpleName();
+    private static final String SCREEN_NAME = "Fingerprint";
 
     public final static String KEY_CHECK_RESULT = "KEY_CHECK_RESULT";
 
@@ -151,6 +153,7 @@ public class FingerprintActivity extends AppCompatActivity {
     @Override
     public void onResume(){
         super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
         startFingerprint();
         ImageView imageView = (ImageView)findViewById(R.id.fingerprinticon);
         imageView.setImageDrawable(getDrawable(R.drawable.ic_fingerprint));

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

@@ -52,6 +52,7 @@ import com.owncloud.android.syncadapter.FileSyncAdapter;
 import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.DataHolderUtil;
 import com.owncloud.android.utils.ErrorMessageAdapter;
 
@@ -103,7 +104,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
             caption = getIntent().getStringExtra(EXTRA_ACTION);
         } else {
             caption = getString(R.string.default_display_name_for_root_folder);
-        }
+        };
         getSupportActionBar().setTitle(caption);
 
         setIndeterminate(mSyncInProgress);
@@ -236,6 +237,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
         super.onResume();
         Log_OC.e(TAG, "onResume() start");
 
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+
         // refresh list of files
         refreshListOfFilesFragment(false);
 

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

@@ -50,6 +50,7 @@ import com.owncloud.android.ui.decoration.MediaGridItemDecoration;
 import com.owncloud.android.ui.dialog.SyncedFolderPreferencesDialogFragment;
 import com.owncloud.android.ui.dialog.parcel.SyncedFolderParcelable;
 import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -99,6 +100,12 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
         setupContent();
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     /**
      * sets up the UI elements and loads all media/synced folders.
      */

+ 7 - 0
src/main/java/com/owncloud/android/ui/activity/GenericExplanationActivity.java

@@ -33,6 +33,7 @@ import android.widget.ListView;
 import android.widget.TextView;
 
 import com.owncloud.android.R;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 import java.util.ArrayList;
 
@@ -84,6 +85,12 @@ public class GenericExplanationActivity  extends AppCompatActivity {
         }
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     public class ExplanationListAdapterView extends ArrayAdapter<String> {
         
         ArrayList<String> mList;

+ 7 - 0
src/main/java/com/owncloud/android/ui/activity/LogHistoryActivity.java

@@ -39,6 +39,7 @@ import android.widget.Toast;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.dialog.LoadingDialog;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 
 import java.io.BufferedReader;
@@ -118,6 +119,12 @@ public class LogHistoryActivity extends ToolbarActivity {
         }
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         boolean retval = true;

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

@@ -51,6 +51,7 @@ import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.ui.adapter.AccountListAdapter;
 import com.owncloud.android.ui.adapter.AccountListItem;
 import com.owncloud.android.ui.helpers.FileOperationsHelper;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.DisplayUtils;
 
 import org.parceler.Parcels;
@@ -131,6 +132,12 @@ public class ManageAccountsActivity extends FileActivity
         initializeComponentGetters();
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);

+ 7 - 0
src/main/java/com/owncloud/android/ui/activity/ManageSpaceActivity.java

@@ -34,6 +34,7 @@ import android.widget.Toast;
 
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 import java.io.File;
 
@@ -68,6 +69,12 @@ public class ManageSpaceActivity extends AppCompatActivity {
     }
 
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         boolean retval = true;

+ 9 - 0
src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java

@@ -53,6 +53,7 @@ import com.owncloud.android.lib.resources.notifications.GetRemoteNotificationsOp
 import com.owncloud.android.lib.resources.notifications.models.Notification;
 import com.owncloud.android.ui.adapter.NotificationListAdapter;
 import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 import java.io.IOException;
 import java.util.List;
@@ -68,6 +69,7 @@ import butterknife.Unbinder;
 public class NotificationsActivity extends FileActivity {
 
     private static final String TAG = NotificationsActivity.class.getSimpleName();
+    private static final String SCREEN_NAME = "Notifications";
 
     @BindView(R.id.empty_list_view)
     public LinearLayout emptyContentContainer;
@@ -292,4 +294,11 @@ public class NotificationsActivity extends FileActivity {
             emptyContentIcon.setVisibility(View.VISIBLE);
         }
     }
+
+    @Override
+    public void onResume(){
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
 }

+ 6 - 0
src/main/java/com/owncloud/android/ui/activity/ParticipateActivity.java

@@ -31,6 +31,7 @@ import android.view.View;
 import android.widget.TextView;
 
 import com.owncloud.android.R;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 /**
  * Activity providing information about ways to participate in the app's development.
@@ -56,6 +57,11 @@ public class ParticipateActivity extends FileActivity {
         setupContent();
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
 
     private void setupContent() {
         TextView rcView = (TextView) findViewById(R.id.participate_release_candidate_text);

+ 7 - 0
src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java

@@ -40,6 +40,7 @@ import android.widget.Toast;
 
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 import java.util.Arrays;
 
@@ -140,6 +141,12 @@ public class PassCodeActivity extends AppCompatActivity {
         setTextListeners();
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     /**
      * Enables or disables the cancel button to allow the user interrupt the ACTION
      * requested to the activity.

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

@@ -67,6 +67,7 @@ import com.owncloud.android.lib.common.ExternalLinkType;
 import com.owncloud.android.lib.common.OwnCloudAccount;
 import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
 import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.DisplayUtils;
 
 import java.io.IOException;
@@ -612,6 +613,7 @@ public class Preferences extends PreferenceActivity
     @Override
     protected void onResume() {
         super.onResume();
+        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;

+ 7 - 0
src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java

@@ -50,6 +50,7 @@ import com.owncloud.android.ui.dialog.IndeterminateProgressDialog;
 import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
 import com.owncloud.android.ui.fragment.ExtendedListFragment;
 import com.owncloud.android.ui.fragment.LocalFileListFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 
 import java.io.File;
@@ -319,6 +320,12 @@ public class UploadFilesActivity extends FileActivity implements
         Log_OC.d(TAG, "onSaveInstanceState() end");
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     /**
      * Pushes a directory to the drop down list
      * @param directory to push

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

@@ -55,6 +55,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.CheckCurrentCredentialsOperation;
 import com.owncloud.android.ui.fragment.UploadListFragment;
 import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 
 import java.io.File;
@@ -128,6 +129,8 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
         Log_OC.v(TAG, "onResume() start");
         super.onResume();
 
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+
         // Listen for upload messages
         mUploadMessagesReceiver = new UploadMessagesReceiver();
         IntentFilter uploadIntentFilter = new IntentFilter();
@@ -331,7 +334,7 @@ public class UploadListActivity extends FileActivity implements UploadListFragme
                 mUploaderBinder = null;
             }
         }
-    }
+    };
 
     /**
      * Once the file upload has changed its status -> update uploads list view

+ 7 - 0
src/main/java/com/owncloud/android/ui/activity/UploadPathActivity.java

@@ -26,6 +26,7 @@ import android.view.View.OnClickListener;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 public class UploadPathActivity extends FolderPickerActivity implements FileFragment.ContainerActivity,
         OnClickListener, OnEnforceableRefreshListener {
@@ -48,6 +49,12 @@ public class UploadPathActivity extends FolderPickerActivity implements FileFrag
         setFile(folder);
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     /**
      * Called when the ownCloud {@link Account} associated to the Activity was
      * just updated.

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

@@ -51,6 +51,7 @@ import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.features.FeatureList;
 import com.owncloud.android.features.FeatureList.FeatureItem;
 import com.owncloud.android.ui.whatsnew.ProgressIndicator;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 /**
  * Activity displaying general feature after a fresh install and new features after an update.
@@ -138,6 +139,12 @@ public class WhatsNewActivity extends FragmentActivity implements ViewPager.OnPa
         updateNextButtonIfNeeded();
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
+
     @Override
     public void onBackPressed() {
         onFinish();

+ 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;
 

+ 9 - 0
src/main/java/com/owncloud/android/ui/fragment/EditShareFragment.java

@@ -41,6 +41,7 @@ import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.lib.resources.shares.SharePermissionsBuilder;
 import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.ui.activity.FileActivity;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 public class EditShareFragment extends Fragment {
 
@@ -376,6 +377,14 @@ public class EditShareFragment extends Fragment {
     }
 
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
+    }
+
     /**
      * Get {@link OCShare} instance from DB and updates the UI.
      *

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

@@ -50,6 +50,7 @@ import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
 import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 
@@ -107,6 +108,13 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
         mProgressListener = null;
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
+    }
 
     @Override
     public void onActivityCreated(Bundle savedInstanceState) {

+ 15 - 7
src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java

@@ -35,6 +35,7 @@ import android.widget.ListView;
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.adapter.LocalFileListAdapter;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 
 import java.io.File;
@@ -64,6 +65,13 @@ public class LocalFileListFragment extends ExtendedListFragment {
         setHasOptionsMenu(true);
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
+    }
 
     /**
      * {@inheritDoc}
@@ -133,7 +141,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
             } else {    /// Click on a file
                 ImageView checkBoxV = (ImageView) v.findViewById(R.id.custom_checkbox);
                 if (checkBoxV != null) {
-                    if (getListView().isItemChecked(position)) {
+                    if (((AbsListView)getListView()).isItemChecked(position)) {
                         checkBoxV.setImageResource(R.drawable.ic_checkbox_marked);
                     } else {
                         checkBoxV.setImageResource(R.drawable.ic_checkbox_blank_outline);
@@ -214,7 +222,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
         }
 
         // by now, only files in the same directory will be kept as selected
-        mCurrentListView.clearChoices();
+        ((AbsListView)mCurrentListView).clearChoices();
         mAdapter.swapDirectory(directory);
         if (mDirectory == null || !mDirectory.equals(directory)) {
             mCurrentListView.setSelection(0);
@@ -230,7 +238,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
      */
     public String[] getCheckedFilePaths() {
         ArrayList<String> result = new ArrayList<String>();
-        SparseBooleanArray positions = mCurrentListView.getCheckedItemPositions();
+        SparseBooleanArray positions = ((AbsListView)mCurrentListView).getCheckedItemPositions();
         if (positions.size() > 0) {
             for (int i = 0; i < positions.size(); i++) {
                 if (positions.get(positions.keyAt(i)) == true) {
@@ -262,7 +270,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
      * @param select <code>true</code> to select all, <code>false</code> to deselect all
      */
     public void selectAllFiles(boolean select) {
-        AbsListView listView = getListView();
+        AbsListView listView = (AbsListView) getListView();
         for (int position = 0; position < listView.getCount(); position++) {
             File file = (File) mAdapter.getItem(position);
             if (file.isFile()) {
@@ -281,7 +289,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
          *  
          * @param directory
          */
-        void onDirectoryClick(File directory);
+        public void onDirectoryClick(File directory);
         
         /**
          * Callback method invoked when a file (non directory)
@@ -289,7 +297,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
          *  
          * @param file
          */
-        void onFileClick(File file);
+        public void onFileClick(File file);
         
         
         /**
@@ -298,7 +306,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
          * 
          * @return  Directory to list firstly. Can be NULL.
          */
-        File getInitialDirectory();
+        public File getInitialDirectory();
 
     }
 

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

@@ -89,6 +89,7 @@ import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface;
 import com.owncloud.android.ui.preview.PreviewImageFragment;
 import com.owncloud.android.ui.preview.PreviewMediaFragment;
 import com.owncloud.android.ui.preview.PreviewTextFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
@@ -252,6 +253,10 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
         if (remoteOperationAsyncTask != null) {
             remoteOperationAsyncTask.cancel(true);
         }
+
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
     }
 
     @Override

+ 9 - 0
src/main/java/com/owncloud/android/ui/fragment/SearchShareesFragment.java

@@ -41,6 +41,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.adapter.ShareUserListAdapter;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 import java.util.ArrayList;
 
@@ -104,6 +105,14 @@ public class SearchShareesFragment extends Fragment implements ShareUserListAdap
 
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
+    }
+
     /**
      * {@inheritDoc}
      */

+ 9 - 0
src/main/java/com/owncloud/android/ui/fragment/ShareFileFragment.java

@@ -56,6 +56,7 @@ import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.adapter.ShareUserListAdapter;
 import com.owncloud.android.ui.dialog.ExpirationDatePickerDialogFragment;
 import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 
@@ -177,6 +178,14 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
         }
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
+    }
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {

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

@@ -32,6 +32,7 @@ import com.owncloud.android.db.OCUpload;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.adapter.ExpandableUploadListAdapter;
+import com.owncloud.android.utils.AnalyticsUtils;
 
 /**
  * A Fragment that lists all files and folders in a given LOCAL path.
@@ -72,6 +73,14 @@ public class UploadListFragment extends ExpandableListFragment {
         return v;
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
+    }
+
     @Override
     public void onRefresh() {
         // remove the progress circle as soon as pull is triggered, like in the list of files
@@ -135,7 +144,7 @@ public class UploadListFragment extends ExpandableListFragment {
          * @param file the file that has been clicked on.
          * @return return true if click was handled.
          */
-        boolean onUploadItemClick(OCUpload file);
+        public boolean onUploadItemClick(OCUpload file);
     }
 
     public void binderReady(){

+ 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.

+ 9 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewImageFragment.java

@@ -58,6 +58,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
 import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.BitmapUtils;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
@@ -374,6 +375,14 @@ public class PreviewImageFragment extends FileFragment {
         mContainerActivity.showDetails(getFile());
     }
 
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
+    }
+
     @Override
     public void onPause() {
         super.onPause();

+ 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
  */

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

@@ -65,6 +65,7 @@ import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
 import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 
 
@@ -236,7 +237,7 @@ public class PreviewMediaFragment extends FileFragment implements
 
         }
         else {
-            file = savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_FILE);
+            file = (OCFile) savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_FILE);
             setFile(file);
             mAccount = savedInstanceState.getParcelable(PreviewMediaFragment.EXTRA_ACCOUNT);
             mSavedPlaybackPosition =
@@ -564,6 +565,9 @@ public class PreviewMediaFragment extends FileFragment implements
     @Override
     public void onResume() {
         super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
         Log_OC.v(TAG, "onResume");
     }
 

+ 4 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewTextFragment.java

@@ -42,6 +42,7 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
 import com.owncloud.android.ui.dialog.RemoveFilesDialogFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 
 import java.io.BufferedWriter;
@@ -416,6 +417,9 @@ public class PreviewTextFragment extends FileFragment {
     @Override
     public void onResume() {
         super.onResume();
+        if (getActivity() != null) {
+            AnalyticsUtils.setCurrentScreenName(getActivity(), SCREEN_NAME, TAG);
+        }
         Log_OC.e(TAG, "onResume");
     }
 

+ 6 - 0
src/main/java/com/owncloud/android/ui/preview/PreviewVideoActivity.java

@@ -40,6 +40,7 @@ import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundExce
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.media.MediaService;
 import com.owncloud.android.ui.activity.FileActivity;
+import com.owncloud.android.utils.AnalyticsUtils;
 import com.owncloud.android.utils.MimeTypeUtil;
 
 /**
@@ -105,6 +106,11 @@ public class PreviewVideoActivity extends FileActivity implements OnCompletionLi
         mVideoPlayer.setKeepScreenOn(true);
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
+    }
 
     /**
      * {@inheritDoc}

+ 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);
                 }

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio