From 9cbf29b1bad180ec0bd118e8a9ed035b1b06ce28 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Wed, 25 Nov 2015 17:28:50 +0100 Subject: [PATCH 01/35] Update Version Number + Gradle + Support --- alfresco-mobile-android/build.gradle | 8 ++++---- build.gradle | 5 ++++- extensions/hockeyapp/build.gradle | 6 +++--- extensions/samsung/build.gradle | 6 +++--- extensions/scansnap/build.gradle | 6 +++--- extensions/tools/build.gradle | 6 +++--- mdm/mobileiron/build.gradle | 6 +++--- platform/foundation/build.gradle | 6 +++--- .../exception/CloudExceptionUtils.java | 3 +-- platform/thirdparty/build.gradle | 20 ++++++++++--------- 10 files changed, 38 insertions(+), 34 deletions(-) diff --git a/alfresco-mobile-android/build.gradle b/alfresco-mobile-android/build.gradle index 1f13ebff..1da48d41 100644 --- a/alfresco-mobile-android/build.gradle +++ b/alfresco-mobile-android/build.gradle @@ -1,15 +1,15 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { applicationId APPLICATION_ID minSdkVersion 15 - targetSdkVersion 22 - versionCode 50 + targetSdkVersion 23 + versionCode 60 versionName VERSION_NAME manifestPlaceholders = [PROVIDER_AUTHORITY: PROVIDER_AUTHORITY] diff --git a/build.gradle b/build.gradle index 413a669a..683d0652 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:1.2.3' + classpath 'com.android.tools.build:gradle:1.5.0' } } @@ -17,6 +17,9 @@ allprojects { maven { url "https://artifacts.alfresco.com/nexus/content/groups/public-snapshots" } + maven { + url "https://jitpack.io" + } jcenter() mavenCentral() } diff --git a/extensions/hockeyapp/build.gradle b/extensions/hockeyapp/build.gradle index 234bb64d..92c0f5e7 100644 --- a/extensions/hockeyapp/build.gradle +++ b/extensions/hockeyapp/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 1 versionName "1.0" } diff --git a/extensions/samsung/build.gradle b/extensions/samsung/build.gradle index edd28799..3cc75712 100644 --- a/extensions/samsung/build.gradle +++ b/extensions/samsung/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 1 versionName "1.0" } diff --git a/extensions/scansnap/build.gradle b/extensions/scansnap/build.gradle index a5a44abe..0dca89f8 100644 --- a/extensions/scansnap/build.gradle +++ b/extensions/scansnap/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 1 versionName "1.0" } diff --git a/extensions/tools/build.gradle b/extensions/tools/build.gradle index a5a44abe..0dca89f8 100644 --- a/extensions/tools/build.gradle +++ b/extensions/tools/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 1 versionName "1.0" } diff --git a/mdm/mobileiron/build.gradle b/mdm/mobileiron/build.gradle index 36188128..afef3292 100644 --- a/mdm/mobileiron/build.gradle +++ b/mdm/mobileiron/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 1 versionName "1.0" } diff --git a/platform/foundation/build.gradle b/platform/foundation/build.gradle index ffdd8b18..b2be52fd 100644 --- a/platform/foundation/build.gradle +++ b/platform/foundation/build.gradle @@ -19,12 +19,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 1 versionName "1.0" diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/exception/CloudExceptionUtils.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/exception/CloudExceptionUtils.java index 852e8ded..adc8fcd4 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/exception/CloudExceptionUtils.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/exception/CloudExceptionUtils.java @@ -30,7 +30,6 @@ import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException; -import org.apache.http.HttpStatus; import android.content.Context; import android.text.Html; @@ -105,7 +104,7 @@ public static void handleCloudException(Context context, Long accountId, Excepti int messageId = R.string.error_session_notfound; AlfrescoSessionException se = ((AlfrescoSessionException) exception); if (se.getErrorCode() == ErrorCodeRegistry.GENERAL_HTTP_RESP && se.getMessage() != null - && se.getMessage().contains(HttpStatus.SC_SERVICE_UNAVAILABLE + "")) + && se.getMessage().contains("503")) { messageId = R.string.error_session_cloud_unavailable; } diff --git a/platform/thirdparty/build.gradle b/platform/thirdparty/build.gradle index f65b07e4..7bfbc68a 100644 --- a/platform/thirdparty/build.gradle +++ b/platform/thirdparty/build.gradle @@ -19,12 +19,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" + compileSdkVersion 23 + buildToolsVersion "23.0.1" defaultConfig { minSdkVersion 15 - targetSdkVersion 22 + targetSdkVersion 23 versionCode 1 versionName "1.0" } @@ -44,11 +44,11 @@ dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) //Support - compile 'com.android.support:design:22.2.1' - compile 'com.android.support:support-v4:22.2.1' - compile 'com.android.support:appcompat-v7:22.2.1' - compile 'com.android.support:cardview-v7:22.2.1' - compile 'com.android.support:recyclerview-v7:22.2.1' + compile 'com.android.support:design:23.1.1' + compile 'com.android.support:support-v4:23.1.1' + compile 'com.android.support:appcompat-v7:23.1.1' + compile 'com.android.support:cardview-v7:23.1.1' + compile 'com.android.support:recyclerview-v7:23.1.1' //Square compile 'com.squareup.picasso:picasso:2.5.2' @@ -58,7 +58,9 @@ dependencies { //3rd Party Lib compile 'com.cocosw:bottomsheet:1.1.1@aar' - compile 'com.afollestad:material-dialogs:0.7.6.0' + compile('com.github.afollestad.material-dialogs:core:0.8.5.1@aar') { + transitive = true + } compile 'com.rengwuxian.materialedittext:library:2.1.4' compile 'com.mattprecious.telescope:telescope:1.4.0@aar' compile 'com.jmpergar:AwesomeText:1.0.0' From baf8712b5bb282b9fac7b9651391b0aec7ae2022 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Wed, 10 Feb 2016 16:25:29 +0100 Subject: [PATCH 02/35] ANDROID-241 ANDROID-233 ANDROID-245 ANDROID-238 Revert to 1.6.1 Update Dependencies --- alfresco-mobile-android/build.gradle | 26 +- alfresco-mobile-android/google-services.json | 45 ++ .../assets/Configuration/embedded_config.json | 7 + .../application/AlfrescoApplication.java | 34 +- .../application/activity/MainActivity.java | 17 +- .../capture/DeviceCaptureHelper.java | 36 +- .../configuration/ConfigurationConstant.java | 27 +- .../configuration/model/ViewConfigModel.java | 24 + .../fragments/about/AboutFragment.java | 2 + .../account/AccountEditFragment.java | 6 + .../fragments/account/NetworksFragment.java | 6 + .../fragments/actions/NodeActions.java | 18 + .../activitystream/ActivityFeedFragment.java | 3 +- .../builder/AlfrescoFragmentBuilder.java | 32 ++ .../fragments/config/MenuConfigFragment.java | 10 + .../create/DocumentTypesDialogFragment.java | 5 + .../fileexplorer/FileExplorerFragment.java | 2 + .../fileexplorer/FileExplorerHelper.java | 2 +- .../FileExplorerMenuFragment.java | 2 + .../fragments/help/HelpDialogFragment.java | 3 + .../fragments/menu/MainMenuFragment.java | 1 + .../DocumentFolderBrowserFragment.java | 35 ++ .../node/comment/CommentsFragment.java | 1 + .../create/CreateDocumentDialogFragment.java | 2 + .../create/CreateFolderDialogFragment.java | 2 + .../node/details/NodeDetailsFragment.java | 48 ++ .../node/details/NodePropertiesFragment.java | 1 + .../node/details/NodeSummaryFragment.java | 1 + .../details/PagerNodeDetailsFragment.java | 79 ++- .../node/favorite/FavoritesFragment.java | 2 + .../rendition/CarouselPreviewFragment.java | 2 + .../node/rendition/PreviewFragment.java | 1 + .../search/DocumentFolderSearchFragment.java | 2 + .../node/update/EditPropertiesFragment.java | 2 + .../node/versions/VersionFragment.java | 1 + .../preferences/AccountSettingsFragment.java | 31 +- .../preferences/GeneralPreferences.java | 68 ++- .../preferences/PasscodePreferences.java | 14 +- .../profile/ProfilesConfigFragment.java | 6 + .../search/AdvancedSearchFragment.java | 52 +- .../fragments/search/SearchFragment.java | 34 +- .../signin/AccountCredentialsFragment.java | 4 +- .../fragments/signin/AccountNameFragment.java | 2 + .../signin/AccountOAuthFragment.java | 30 +- .../signin/AccountOptionalFragment.java | 2 +- .../signin/AccountServerFragment.java | 2 + .../signin/AccountSignInFragment.java | 2 + .../fragments/signin/WelcomeFragment.java | 2 + .../browser/BrowserSitesPagerFragment.java | 52 +- .../fragments/site/browser/SitesFragment.java | 1 + .../request/JoinSiteRequestsFragment.java | 2 + .../site/search/SearchSitesFragment.java | 2 + .../fragments/sync/SyncFragment.java | 2 + .../fragments/user/UserProfileFragment.java | 60 +- .../fragments/user/UsersFragment.java | 21 +- .../workflow/CreateTaskFragment.java | 2 + .../CreateTaskTypePickerFragment.java | 28 +- .../process/ProcessTasksFragment.java | 2 + .../workflow/task/TaskDetailsFragment.java | 2 + .../workflow/task/TaskFilterFragment.java | 9 +- .../workflow/task/TasksFragment.java | 2 + .../fragments/workflow/task/TasksHelper.java | 4 +- .../application/managers/ConfigManager.java | 29 +- .../managers/extensions/AnalyticHelper.java | 224 ++++++++ .../managers/upgrade/UpgradeManager.java | 34 +- .../StorageAccessDocumentsProvider.java | 44 ++ .../application/security/DataCleaner.java | 6 +- .../DataProtectionUserDialogFragment.java | 4 +- .../security/PassCodeDialogFragment.java | 8 +- .../widgets/ActionShortcutActivity.java | 45 +- .../widgets/FolderShortcutActivity.java | 41 +- .../widgets/ToolbarWidgetProvider.java | 40 +- .../src/main/res/layout/fr_settings.xml | 48 +- .../src/main/res/values/strings.xml | 3 + build.gradle | 19 + extensions/analytics/.gitignore | 1 + extensions/analytics/build.gradle | 43 ++ extensions/analytics/google-services.json | 45 ++ extensions/analytics/proguard-rules.pro | 17 + .../analytics/src/main/AndroidManifest.xml | 50 ++ .../analytics/GAnalyticsManagerImpl.java | 265 +++++++++ .../src/main/res/values/config_extension.xml | 26 + .../analytics/src/main/res/values/keys.xml | 25 + .../src/main/res/xml/global_tracker.xml | 42 ++ extensions/hockeyapp/build.gradle | 20 +- extensions/samsung/build.gradle | 20 +- .../samsung/pen/SNoteEditorActivity.java | 4 + extensions/scansnap/build.gradle | 20 +- gradle.properties | 31 +- mdm/mobileiron/build.gradle | 20 +- platform/foundation/build.gradle | 2 +- .../foundation/src/main/AndroidManifest.xml | 23 + .../android/accounts/AccountSchema.java | 28 +- .../api/model/config/ConfigConstants.java | 21 + .../api/model/config/ConfigTypeIds.java | 26 +- .../api/model/config/FeatureConfig.java | 35 ++ .../model/config/impl/ConfigurationImpl.java | 76 ++- .../model/config/impl/FeatureConfigImpl.java | 68 +++ .../api/model/config/impl/FeatureHelper.java | 62 ++ .../android/api/services/ConfigService.java | 32 +- .../impl/AbstractConfigServiceImpl.java | 17 + .../services/impl/LocalConfigServiceImpl.java | 25 +- .../async/account/CreateAccountOperation.java | 20 +- .../node/comment/CreateCommentOperation.java | 36 +- .../node/create/CreateDocumentOperation.java | 34 +- .../node/create/CreateFolderOperation.java | 37 +- .../node/delete/DeleteNodeOperation.java | 36 +- .../node/favorite/FavoriteNodeOperation.java | 53 +- .../async/node/like/LikeNodeOperation.java | 36 +- .../async/node/search/SearchOperation.java | 27 +- .../async/node/sync/SyncNodeOperation.java | 36 +- .../node/update/UpdateContentOperation.java | 34 +- .../node/update/UpdateNodeOperation.java | 39 +- .../async/session/LoadSessionCallBack.java | 53 +- .../session/oauth/AccountOAuthHelper.java | 4 +- .../async/site/SiteFavoriteOperation.java | 35 +- .../CancelPendingMembershipOperation.java | 33 +- .../site/member/SiteMembershipOperation.java | 34 +- .../process/start/StartProcessOperation.java | 33 +- .../task/complete/CompleteTaskOperation.java | 34 +- .../task/delegate/ReassignTaskOperation.java | 32 +- .../accounts/AccountsPreferences.java | 28 +- .../accounts/AlfrescoAccountManager.java | 2 +- .../platform/extensions/AnalyticsHelper.java | 282 ++++++++++ .../platform/extensions/AnalyticsManager.java | 531 ++++++++++++++++++ .../platform/favorite/FavoritesManager.java | 42 +- .../security/DataProtectionManager.java | 32 +- .../android/sync/SyncContentManager.java | 16 +- .../android/sync/SyncContentSchema.java | 2 + .../android/sync/SyncContentSyncAdapter.java | 48 +- .../mobile/android/sync/SyncScanInfo.java | 32 +- .../sync/prepare/PrepareBaseHelper.java | 26 +- .../android/ui/activity/AlfrescoActivity.java | 13 +- .../ui/fragments/AlfrescoFragment.java | 22 +- .../ui/network/CloudNetworksFragment.java | 28 +- .../ui/node/browse/NodeBrowserTemplate.java | 28 +- .../res/values/config_default_managers.xml | 22 + platform/thirdparty/build.gradle | 2 +- settings.gradle | 27 +- 139 files changed, 3604 insertions(+), 739 deletions(-) create mode 100644 alfresco-mobile-android/google-services.json create mode 100644 alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java create mode 100644 extensions/analytics/.gitignore create mode 100644 extensions/analytics/build.gradle create mode 100644 extensions/analytics/google-services.json create mode 100644 extensions/analytics/proguard-rules.pro create mode 100644 extensions/analytics/src/main/AndroidManifest.xml create mode 100644 extensions/analytics/src/main/java/org/alfresco/mobile/android/application/extension/analytics/GAnalyticsManagerImpl.java create mode 100644 extensions/analytics/src/main/res/values/config_extension.xml create mode 100644 extensions/analytics/src/main/res/values/keys.xml create mode 100644 extensions/analytics/src/main/res/xml/global_tracker.xml create mode 100644 platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/FeatureConfig.java create mode 100644 platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/FeatureConfigImpl.java create mode 100644 platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/FeatureHelper.java create mode 100644 platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java create mode 100644 platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java diff --git a/alfresco-mobile-android/build.gradle b/alfresco-mobile-android/build.gradle index 1da48d41..7ce674b3 100644 --- a/alfresco-mobile-android/build.gradle +++ b/alfresco-mobile-android/build.gradle @@ -1,8 +1,26 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + apply plugin: 'com.android.application' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { applicationId APPLICATION_ID @@ -23,6 +41,8 @@ android { resValue "string", "oauth_callback", OAUTH_CALLBACK resValue "string", "oauth_scope", OAUTH_SCOPE resValue "string", "bamboo_buildnumber", BUILDNUMBER + + resValue "string", "ga_trackId", TRACKER_ID } lintOptions { @@ -57,7 +77,7 @@ android { resValue "string", "favorites_adapter", FAVORITES_ADAPTER_DEBUG resValue "string", "hockeyapp_key", HOCKEYAPP_KEY - + resValue "string", "ga_trackId", TRACKER_ID_DEBUG } release { @@ -89,9 +109,11 @@ android { dependencies { //DEBUG BUILD TYPE debugCompile project(':extensions:hockeyapp') + debugCompile project(':extensions:analytics') storeCompile project(':extensions:samsung') storeCompile project(':extensions:scansnap') + storeCompile project(':extensions:analytics') } } diff --git a/alfresco-mobile-android/google-services.json b/alfresco-mobile-android/google-services.json new file mode 100644 index 00000000..2a78c3c1 --- /dev/null +++ b/alfresco-mobile-android/google-services.json @@ -0,0 +1,45 @@ +{ + "project_info": { + "project_id": "alfresco-mobile", + "project_number": "1053450300169", + "name": "Alfresco Mobile" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:1053450300169:android:4c82694870595779", + "client_id": "android:org.alfresco.mobile.android.application", + "client_type": 1, + "android_client_info": { + "package_name": "org.alfresco.mobile.android.application" + } + }, + "oauth_client": [], + "api_key": [], + "services": { + "analytics_service": { + "status": 2, + "analytics_property": { + "tracking_id": "UA-70658012-1" + } + }, + "cloud_messaging_service": { + "status": 1, + "apns_config": [] + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "google_signin_service": { + "status": 1 + }, + "ads_service": { + "status": 1 + } + } + } + ], + "client_info": [], + "ARTIFACT_VERSION": "1" +} \ No newline at end of file diff --git a/alfresco-mobile-android/src/main/assets/Configuration/embedded_config.json b/alfresco-mobile-android/src/main/assets/Configuration/embedded_config.json index b83855d2..634422e9 100644 --- a/alfresco-mobile-android/src/main/assets/Configuration/embedded_config.json +++ b/alfresco-mobile-android/src/main/assets/Configuration/embedded_config.json @@ -10,6 +10,13 @@ "root-view-id": "views-menu-default" } }, + "features": [ + { + "id": "feature-analytics-default", + "type": "org.alfresco.client.feature.analytics", + "enable": false + } + ], "view-groups": [ { "id": "views-menu-default", diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/AlfrescoApplication.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/AlfrescoApplication.java index ff5eb248..471089b8 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/AlfrescoApplication.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/AlfrescoApplication.java @@ -1,25 +1,26 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application; import org.alfresco.mobile.android.application.managers.upgrade.UpgradeManager; import org.alfresco.mobile.android.async.OperationsUtils; import org.alfresco.mobile.android.platform.SessionManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.app.Application; @@ -27,6 +28,8 @@ public class AlfrescoApplication extends Application { protected SessionManager sessionManager; + private AnalyticsManager analyticsManager; + @Override public void onCreate() { @@ -39,4 +42,9 @@ public void onCreate() // Remove operations if necessary OperationsUtils.clean(this); } + + synchronized public AnalyticsManager getAnalyticsTracker() + { + return AnalyticsManager.getInstance(this); + } } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java index 6f7ad0d9..fcd6e894 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java @@ -47,6 +47,7 @@ import org.alfresco.mobile.android.application.intent.RequestCode; import org.alfresco.mobile.android.application.managers.ConfigManager; import org.alfresco.mobile.android.application.managers.RenditionManagerImpl; +import org.alfresco.mobile.android.application.managers.extensions.AnalyticHelper; import org.alfresco.mobile.android.application.security.DataProtectionUserDialogFragment; import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.account.CreateAccountEvent; @@ -67,6 +68,7 @@ import org.alfresco.mobile.android.platform.accounts.AccountsPreferences; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.favorite.FavoritesManager; import org.alfresco.mobile.android.platform.intent.AlfrescoIntentAPI; import org.alfresco.mobile.android.platform.intent.PrivateIntent; @@ -212,7 +214,7 @@ public void onCreate(Bundle savedInstanceState) // re-created after the AlfrescoAccount is created. DataProtectionUserDialogFragment.newInstance(true).show(getSupportFragmentManager(), DataProtectionUserDialogFragment.TAG); - prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).commit(); + prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).apply(); } } } @@ -276,6 +278,11 @@ public void onDrawerOpened(View drawerView) @Override protected void onStart() { + if (AnalyticsManager.getInstance(this) != null && AnalyticsManager.getInstance(this).isEnable()) + { + AnalyticsManager.getInstance(this).startReport(this); + } + registerPublicReceiver(new NetworkReceiver(), new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); super.onStart(); @@ -778,7 +785,7 @@ public void onAccountCreated(CreateAccountEvent event) { DataProtectionUserDialogFragment.newInstance(true).show(getSupportFragmentManager(), DataProtectionUserDialogFragment.TAG); - prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).commit(); + prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).apply(); } } } @@ -939,7 +946,7 @@ public void onAccountLoaded(LoadAccountCompletedEvent event) if (paidNetwork) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); - prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).commit(); + prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).apply(); if (mdmManager.hasConfig()) { @@ -968,11 +975,15 @@ public void onAccountLoaded(LoadAccountCompletedEvent event) startActivityForResult(new Intent(this, InfoActivity.class), SyncMigrationFragment.REQUEST_CODE); } + // Analytics + AnalyticHelper.analyzeSession(this, event.account, getCurrentSession()); + // Activate Automatic Sync for Sync Content & Favorite SyncContentManager.getInstance(this).setActivateSync(getCurrentAccount(), true); FavoritesManager.getInstance(this).setActivateSync(getCurrentAccount(), true); invalidateOptionsMenu(); + } @Subscribe diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/capture/DeviceCaptureHelper.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/capture/DeviceCaptureHelper.java index cc88ca74..1d48709f 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/capture/DeviceCaptureHelper.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/capture/DeviceCaptureHelper.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.capture; import java.io.File; @@ -24,6 +24,8 @@ import org.alfresco.mobile.android.application.activity.BaseActivity; import org.alfresco.mobile.android.application.fragments.fileexplorer.FileExplorerFragment; import org.alfresco.mobile.android.application.fragments.node.browser.DocumentFolderBrowserFragment; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; public final class DeviceCaptureHelper { @@ -50,23 +52,31 @@ public static DeviceCapture createDeviceCapture(BaseActivity c, int id) parentFolder = ((FileExplorerFragment) c.getFragment(FileExplorerFragment.TAG)).getParent(); } + String analyzeId = null; + switch (id) { case R.id.menu_device_capture_camera_photo: capture = new PhotoCapture(c, parentRepositoryFolder, parentFolder); + analyzeId = AnalyticsManager.ACTION_TAKE_PHOTO; break; case R.id.menu_device_capture_camera_video: capture = new VideoCapture(c, parentRepositoryFolder, parentFolder); + analyzeId = AnalyticsManager.ACTION_RECORD_VIDEO; break; case R.id.menu_device_capture_mic_audio: capture = new AudioCapture(c, parentRepositoryFolder, parentFolder); + analyzeId = AnalyticsManager.ACTION_RECORD_AUDIO; break; default: break; } if (capture != null) { + AnalyticsHelper.reportOperationEvent(c, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_QUICK_ACTIONS, analyzeId, 1, false); + capture.captureData(); } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/configuration/ConfigurationConstant.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/configuration/ConfigurationConstant.java index b5d4d51e..cbdef0b1 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/configuration/ConfigurationConstant.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/configuration/ConfigurationConstant.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.configuration; import java.util.ArrayList; @@ -89,5 +89,4 @@ public interface ConfigurationConstant add(KEY_LOCAL_FILES); } }; - } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/configuration/model/ViewConfigModel.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/configuration/model/ViewConfigModel.java index 0d0c74c2..f1c38989 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/configuration/model/ViewConfigModel.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/configuration/model/ViewConfigModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.alfresco.mobile.android.application.configuration.model; import java.util.ArrayList; @@ -6,6 +24,7 @@ import org.alfresco.mobile.android.api.model.config.ViewConfig; import org.alfresco.mobile.android.api.model.config.impl.ViewConfigImpl; +import org.alfresco.mobile.android.application.configuration.ConfigurationConstant; import android.content.Context; @@ -45,6 +64,11 @@ public String getType() return type; } + public String getSimpleType() + { + return type.substring(ConfigurationConstant.PREFIX.length() + 1, type.length()); + } + public int getIconResId() { return iconResId; diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/about/AboutFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/about/AboutFragment.java index cb4d0279..63aa38fb 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/about/AboutFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/about/AboutFragment.java @@ -22,6 +22,7 @@ import org.alfresco.mobile.android.api.Version; import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.application.fragments.builder.LeafFragmentBuilder; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import android.app.Dialog; @@ -50,6 +51,7 @@ public AboutFragment() { requiredSession = false; checkSession = false; + screenName = AnalyticsManager.SCREEN_SETTINGS_ABOUT; } protected static AboutFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/account/AccountEditFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/account/AccountEditFragment.java index bae42b75..2c3348e2 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/account/AccountEditFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/account/AccountEditFragment.java @@ -35,6 +35,8 @@ import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; import org.alfresco.mobile.android.platform.exception.AlfrescoExceptionHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.AccessibilityUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -89,6 +91,7 @@ public AccountEditFragment() super(); eventBusRequired = true; requiredSession = false; + screenName = AnalyticsManager.SCREEN_ACCOUNT_EDIT; } public static AccountEditFragment newInstanceByTemplate(Bundle b) @@ -322,6 +325,9 @@ public void onCheckSessionEvent(CheckSessionEvent event) SessionManager.getInstance(getActivity()).saveAccount(acc); SessionManager.getInstance(getActivity()).saveSession(acc, event.data); + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_ACCOUNT, + AnalyticsManager.ACTION_EDIT, AnalyticsManager.LABEL_CREDENTIALS, 1, false); + EventBusManager.getInstance().post( new LoadSessionCallBack.LoadAccountCompletedEvent(updatedAccount.getTitle(), updatedAccount)); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/account/NetworksFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/account/NetworksFragment.java index 1ec15a02..3253d7a4 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/account/NetworksFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/account/NetworksFragment.java @@ -27,6 +27,8 @@ import org.alfresco.mobile.android.async.session.network.NetworksEvent; import org.alfresco.mobile.android.platform.EventBusManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.network.CloudNetworkAdapter; import org.alfresco.mobile.android.ui.network.CloudNetworksFragment; @@ -87,6 +89,10 @@ public void onListItemClick(GridView l, View v, int position, long id) { EventBusManager.getInstance().post(new RequestSessionEvent(currentAccount, network.getIdentifier(), true)); getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); + + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_SESSION, + AnalyticsManager.ACTION_SWITCH, AnalyticsManager.LABEL_NETWORK, 1, false); } } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/actions/NodeActions.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/actions/NodeActions.java index a41baab6..c90d0d3f 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/actions/NodeActions.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/actions/NodeActions.java @@ -51,6 +51,8 @@ import org.alfresco.mobile.android.async.node.sync.SyncNodeRequest; import org.alfresco.mobile.android.async.utils.NodePlaceHolder; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; @@ -236,6 +238,7 @@ protected void getMenu(FragmentActivity activity, Menu menu) @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { + String label = null; Boolean b = false; switch (item.getItemId()) { @@ -243,48 +246,59 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) NodeDetailsFragment.with(getActivity()).node(selectedItems.get(0)).display(); break; case R.id.menu_action_update: + label = AnalyticsManager.ACTION_UPDATE; update(getActivity().getSupportFragmentManager().findFragmentByTag(PagerNodeDetailsFragment.TAG)); b = true; break; case R.id.menu_action_sync_group_sync: + label = AnalyticsManager.ACTION_SYNC; sync(true); b = true; break; case R.id.menu_action_sync_group_unsync: + label = AnalyticsManager.ACTION_UNSYNC; sync(false); b = true; break; case R.id.menu_action_favorite_group_favorite: + label = AnalyticsManager.ACTION_FAVORITE; favorite(true); b = true; break; case R.id.menu_action_favorite_group_unfavorite: + label = AnalyticsManager.ACTION_UNFAVORITE; favorite(false); b = true; break; case R.id.menu_action_like_group_like: + label = AnalyticsManager.ACTION_LIKE; like(true); b = true; break; case R.id.menu_action_like_group_unlike: + label = AnalyticsManager.ACTION_UNLIKE; like(false); b = true; break; case R.id.menu_action_download_all: case R.id.menu_action_download: + label = AnalyticsManager.ACTION_DOWNLOAD; download(); b = true; break; case R.id.menu_action_edit: + label = AnalyticsManager.ACTION_EDIT; edit(getActivity(), parentFolder, selectedItems.get(0)); b = true; break; case R.id.menu_action_delete: case R.id.menu_action_delete_folder: + label = AnalyticsManager.ACTION_DELETE; delete(getActivity(), getFragment(), new ArrayList(selectedItems)); b = true; break; case R.id.menu_workflow_review_attachments: + label = AnalyticsManager.ACTION_START_REVIEW; startReview(); b = true; break; @@ -293,6 +307,10 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) } if (b) { + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_MULTI_SELECT, label, selectedItems.size(), false); + selectedItems.clear(); selectedDocument.clear(); selectedFolder.clear(); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/activitystream/ActivityFeedFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/activitystream/ActivityFeedFragment.java index c75959ec..9498992c 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/activitystream/ActivityFeedFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/activitystream/ActivityFeedFragment.java @@ -32,6 +32,7 @@ import org.alfresco.mobile.android.application.fragments.node.details.NodeDetailsFragment; import org.alfresco.mobile.android.application.fragments.user.UserProfileFragment; import org.alfresco.mobile.android.async.activitystream.ActivityStreamEvent; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.activitystream.ActivityStreamFragment; import android.os.Bundle; @@ -61,7 +62,7 @@ public ActivityFeedFragment() super(); displayAsList = true; setHasOptionsMenu(true); - + screenName = AnalyticsManager.SCREEN_ACTIVITIES; } public static ActivityFeedFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/builder/AlfrescoFragmentBuilder.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/builder/AlfrescoFragmentBuilder.java index d638a331..3b472cdb 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/builder/AlfrescoFragmentBuilder.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/builder/AlfrescoFragmentBuilder.java @@ -28,6 +28,8 @@ import org.alfresco.mobile.android.application.configuration.model.ViewConfigModel; import org.alfresco.mobile.android.application.fragments.DisplayUtils; import org.alfresco.mobile.android.application.fragments.FragmentDisplayer; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.BundleUtils; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; @@ -168,6 +170,12 @@ public void onClick(View v) // Retrieve configuration AlfrescoFragmentBuilder builder = (AlfrescoFragmentBuilder) v.getTag(); + // Generally it's used when creating a menu item. + if (AnalyticsManager.getInstance(getActivity()) != null) + { + // AnalyticsManager.getInstance(getActivity()).reportScreen(builder.viewConfigModel.getSimpleType()); + } + // Views can requires a session. // We check against the activity to display the right info. if (builder.sessionRequired && getActivity() instanceof MainActivity) @@ -231,6 +239,30 @@ public Fragment createFragment() { Fragment frag = createFragment(createArguments()); if (frag == null) { return null; } + + // Analytics + // Report only fragment & report at creation enable (cf. pager case) + if (AnalyticsManager.getInstance(getActivity()) != null + || AnalyticsManager.getInstance(getActivity()).isEnable()) + { + if (frag instanceof AnalyticsManager.FragmentAnalyzed + && ((AnalyticsManager.FragmentAnalyzed) frag).reportAtCreationEnable()) + { + if (viewConfigModel != null) + { + // Track only Main Menu Selection + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.PREFIX_MENU + .concat(((AnalyticsManager.FragmentAnalyzed) frag).getScreenName())); + } + else + { + // Track all fragment created + AnalyticsHelper.reportScreen(getActivity(), + ((AnalyticsManager.FragmentAnalyzed) frag).getScreenName()); + } + } + } + // Retrieve session if fragment need it. if (sessionRequired && frag instanceof AlfrescoFragment) { diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/config/MenuConfigFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/config/MenuConfigFragment.java index efa97415..1f3a31cb 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/config/MenuConfigFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/config/MenuConfigFragment.java @@ -47,6 +47,8 @@ import org.alfresco.mobile.android.platform.EventBusManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.platform.utils.BundleUtils; import org.alfresco.mobile.android.sync.SyncContentManager; @@ -108,6 +110,7 @@ public MenuConfigFragment() requiredSession = false; checkSession = false; setHasOptionsMenu(true); + screenName = AnalyticsManager.SCREEN_SETTINGS_CUSTOM_MENU; } protected static MenuConfigFragment newInstanceByTemplate(Bundle b) @@ -179,6 +182,13 @@ public void onClick(View v) saveConfiguration(); getActivity().onBackPressed(); } + + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_ACCOUNT, + AnalyticsManager.ACTION_UPDATE_MENU, + getAccount().getTypeId() == AlfrescoAccount.TYPE_ALFRESCO_CLOUD + ? AnalyticsManager.SERVER_TYPE_CLOUD : AnalyticsManager.SERVER_TYPE_ONPREMISE, + 1, false); + } }); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java index e3b37642..8377e5bc 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java @@ -22,6 +22,8 @@ import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.data.DocumentTypeRecord; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseListAdapter; import org.alfresco.mobile.android.ui.holder.SingleLineViewHolder; @@ -96,6 +98,9 @@ public Dialog onCreateDialog(Bundle savedInstanceState) @Override public void onSelection(MaterialDialog materialDialog, View view, int position, CharSequence charSequence) { + AnalyticsHelper.reportOperationEvent(getActivity(), + AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, AnalyticsManager.ACTION_QUICK_ACTIONS, + AnalyticsManager.ACTION_CREATE.concat(" " + fileTypes.get(position)), 1, false); Bundle b = getArguments(); b.putSerializable(ARGUMENT_DOCUMENT_TYPE, fileTypes.get(position)); EditorsDialogFragment dialogft = EditorsDialogFragment.newInstance(b); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerFragment.java index 6d7a1650..0514c522 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerFragment.java @@ -38,6 +38,7 @@ import org.alfresco.mobile.android.async.file.update.RenameFileEvent; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.extensions.ScanSnapManager; import org.alfresco.mobile.android.platform.intent.BaseActionUtils.ActionManagerListener; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; @@ -91,6 +92,7 @@ public FileExplorerFragment() { emptyListMessageId = R.string.empty_download; setHasOptionsMenu(true); + screenName = AnalyticsManager.SCREEN_LOCAL_FILES_BROWSER; } public static FileExplorerFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerHelper.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerHelper.java index 50957bf0..db64d3c5 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerHelper.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerHelper.java @@ -120,7 +120,7 @@ else if (mediatype >= 0) LibraryFragment.with(activity).mediaType(mediatype).mode(mode).isShortCut(true) .menuId(itemPosition).display(); } - prefs.edit().putInt(FILEEXPLORER_DEFAULT, itemPosition).commit(); + prefs.edit().putInt(FILEEXPLORER_DEFAULT, itemPosition).apply(); return true; } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerMenuFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerMenuFragment.java index 90148d46..87488d11 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerMenuFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerMenuFragment.java @@ -27,6 +27,7 @@ import org.alfresco.mobile.android.application.configuration.model.view.LocalConfigModel; import org.alfresco.mobile.android.application.fragments.MenuFragmentHelper; import org.alfresco.mobile.android.application.fragments.builder.AlfrescoFragmentBuilder; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -56,6 +57,7 @@ public FileExplorerMenuFragment() { requiredSession = false; checkSession = false; + screenName = AnalyticsManager.SCREEN_LOCAL_FILES_MENU; } public static FileExplorerMenuFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/help/HelpDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/help/HelpDialogFragment.java index a840baed..b2f7e444 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/help/HelpDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/help/HelpDialogFragment.java @@ -22,6 +22,8 @@ import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.application.fragments.MenuFragmentHelper; import org.alfresco.mobile.android.application.fragments.builder.LeafFragmentBuilder; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.ConnectivityUtils; import org.alfresco.mobile.android.ui.RefreshFragment; import org.alfresco.mobile.android.ui.activity.AlfrescoActivity; @@ -295,6 +297,7 @@ public Builder(FragmentActivity appActivity, Map configuration) // /////////////////////////////////////////////////////////////////////////// protected Fragment createFragment(Bundle b) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_HELP); return newInstanceByTemplate(b); } } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/menu/MainMenuFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/menu/MainMenuFragment.java index 6142873d..c1bda583 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/menu/MainMenuFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/menu/MainMenuFragment.java @@ -123,6 +123,7 @@ public MainMenuFragment() checkSession = false; requiredSession = false; setHasOptionsMenu(true); + reportAtCreation = false; } protected static MainMenuFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/browser/DocumentFolderBrowserFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/browser/DocumentFolderBrowserFragment.java index f3f9aa08..5e030e86 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/browser/DocumentFolderBrowserFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/browser/DocumentFolderBrowserFragment.java @@ -79,6 +79,8 @@ import org.alfresco.mobile.android.async.utils.ContentFileProgressImpl; import org.alfresco.mobile.android.async.utils.NodePlaceHolder; import org.alfresco.mobile.android.platform.exception.AlfrescoAppException; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.extensions.ScanSnapManager; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; @@ -179,6 +181,32 @@ public static DocumentFolderBrowserFragment newInstanceByTemplate(Bundle b) DocumentFolderBrowserFragment cbf = new DocumentFolderBrowserFragment(); cbf.setArguments(b); b.putBoolean(ARGUMENT_BASED_ON_TEMPLATE, true); + + if (b != null) + { + if (b.containsKey(ARGUMENT_FOLDER_TYPE_ID)) + { + int index = b.getInt(ARGUMENT_FOLDER_TYPE_ID); + if (index == NodeChildrenRequest.FOLDER_SHARED) + { + cbf.screenName = AnalyticsManager.SCREEN_REPOSITORY_SHARED; + } + else if (index == NodeChildrenRequest.FOLDER_USER_HOMES) + { + cbf.screenName = AnalyticsManager.SCREEN_REPOSITORY_USERHOME; + } + } + else if (!b.containsKey(ARGUMENT_FOLDER) && !b.containsKey(ARGUMENT_SITE) && !b.containsKey(ARGUMENT_PATH) + && !b.containsKey(ARGUMENT_FOLDER_NODEREF) && !b.containsKey(ARGUMENT_SITE_SHORTNAME)) + { + cbf.screenName = AnalyticsManager.SCREEN_REPOSITORY; + } + else + { + cbf.screenName = AnalyticsManager.SCREEN_NODE_LISTING; + } + } + return cbf; } @@ -1014,10 +1042,15 @@ private boolean onOptionMenuItemSelected(int itemId) switch (itemId) { case R.id.menu_search_from_folder: + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_QUICK_ACTIONS, AnalyticsManager.ACTION_SEARCH, 1, false); search(); return true; case R.id.menu_create_folder: createFolder(); + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_QUICK_ACTIONS, + AnalyticsManager.ACTION_CREATE.concat(" " + AnalyticsManager.TYPE_FOLDER), 1, false); return true; case R.id.menu_upload: Intent i = new Intent(PrivateIntent.ACTION_PICK_FILE, null, getActivity(), @@ -1048,6 +1081,8 @@ private boolean onOptionMenuItemSelected(int itemId) if (ScanSnapManager.getInstance(getActivity()) != null) { ScanSnapManager.getInstance(getActivity()).startPresetChooser(getActivity()); + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_QUICK_ACTIONS, AnalyticsManager.ACTION_SCAN, 1, false); } return true; default: diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/comment/CommentsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/comment/CommentsFragment.java index db4142b2..e2ac0d05 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/comment/CommentsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/comment/CommentsFragment.java @@ -71,6 +71,7 @@ public CommentsFragment() { emptyListMessageId = R.string.empty_comment; loadState = LOAD_VISIBLE; + reportAtCreation = false; } protected static CommentsFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateDocumentDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateDocumentDialogFragment.java index 7938ea16..e6e5ba1d 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateDocumentDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateDocumentDialogFragment.java @@ -42,6 +42,7 @@ import org.alfresco.mobile.android.async.node.create.CreateDocumentRequest; import org.alfresco.mobile.android.async.node.create.RetrieveDocumentNameEvent; import org.alfresco.mobile.android.async.node.create.RetrieveDocumentNameRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.fragments.BaseListAdapter; @@ -111,6 +112,7 @@ public abstract class CreateDocumentDialogFragment extends AlfrescoFragment // ////////////////////////////////////////////////////////////////////// public CreateDocumentDialogFragment() { + screenName = AnalyticsManager.SCREEN_NODE_CREATE_FORM; } public static Bundle createBundle(Folder folder) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateFolderDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateFolderDialogFragment.java index 1f816924..c2254163 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateFolderDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateFolderDialogFragment.java @@ -21,6 +21,7 @@ import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.node.create.CreateFolderRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.operation.OperationWaitingDialogFragment; @@ -54,6 +55,7 @@ public abstract class CreateFolderDialogFragment extends AlfrescoFragment // /////////////////////////////////////////////////////////////////////////// public CreateFolderDialogFragment() { + screenName = AnalyticsManager.SCREEN_NODE_CREATE_FOLDER_FORM; } public static Bundle createBundle(Folder folder) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeDetailsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeDetailsFragment.java index 31a7d905..8ca41456 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeDetailsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeDetailsFragment.java @@ -77,6 +77,8 @@ import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.exception.AlfrescoAppException; import org.alfresco.mobile.android.platform.exception.AlfrescoExceptionHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.BaseActionUtils.ActionManagerListener; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; @@ -168,6 +170,7 @@ public NodeDetailsFragment() requiredSession = false; checkSession = false; layoutId = R.layout.app_details; + reportAtCreation = false; } // ////////////////////////////////////////////////////////////////////// @@ -636,6 +639,14 @@ public void onClick(View v) isSynced = (node.isFolder()) ? SyncContentManager.getInstance(getActivity()).isRootSynced(getAccount(), node) : SyncContentManager.getInstance(getActivity()).isSynced(getAccount(), node); + + AnalyticsHelper.reportOperationEvent(getActivity(), + AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + isSynced ? AnalyticsManager.ACTION_SYNC : AnalyticsManager.ACTION_UNSYNC, + node.isDocument() ? ((Document) node).getContentStreamMimeType() + : AnalyticsManager.TYPE_FOLDER, + 1, false); + sync(v); } }); @@ -834,6 +845,12 @@ public void onActivityNotFoundException(ActivityNotFoundException e) DialogFragment frag = new DownloadDialogFragment(); frag.setArguments(b); frag.show(getActivity().getSupportFragmentManager(), DownloadDialogFragment.TAG); + + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_SHARE, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + false); } else { @@ -851,6 +868,13 @@ public void onPositive(MaterialDialog dialog) frag.setArguments(b); frag.show(getActivity().getSupportFragmentManager(), DownloadDialogFragment.TAG); dialog.dismiss(); + + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), + AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, AnalyticsManager.ACTION_SHARE, + node.isDocument() ? ((Document) node).getContentStreamMimeType() + : AnalyticsManager.TYPE_FOLDER, + 1, false); } @Override @@ -892,6 +916,14 @@ else if (path.startsWith("/Sites/")) { Log.i(getString(R.string.app_name), "Site path not as expected: no /sites/"); } + + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), + AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_SHARE_AS_LINK, + node.isDocument() ? ((Document) node).getContentStreamMimeType() + : AnalyticsManager.TYPE_FOLDER, + 1, false); } else { @@ -961,6 +993,12 @@ public void onActivityNotFoundException(ActivityNotFoundException e) frag.setArguments(b); frag.show(getActivity().getSupportFragmentManager(), DownloadDialogFragment.TAG); } + + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_OPEN, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + false, AnalyticsManager.INDEX_FILE_SIZE, ((Document) node).getContentStreamLength()); } public void setDownloadDateTime(Date downloadDateTime) @@ -975,6 +1013,11 @@ public void download() if (node instanceof Document) { NodeActions.download(getActivity(), parentNode, (Document) node); + + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_DOWNLOAD, ((Document) node).getContentStreamMimeType(), 1, false, + AnalyticsManager.INDEX_FILE_SIZE, ((Document) node).getContentStreamLength()); } } @@ -1172,6 +1215,11 @@ public boolean onOptionsItemSelected(MenuItem item) in.putExtra(PrivateIntent.EXTRA_DOCUMENT, (Serializable) doc); in.putExtra(PrivateIntent.EXTRA_ACCOUNT_ID, getAccount().getId()); startActivity(in); + + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_START_REVIEW, doc.getContentStreamMimeType(), 1, false); + return true; } return super.onOptionsItemSelected(item); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodePropertiesFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodePropertiesFragment.java index 2c452e92..2e963271 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodePropertiesFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodePropertiesFragment.java @@ -55,6 +55,7 @@ public class NodePropertiesFragment extends NodeDetailsFragment public NodePropertiesFragment() { layoutId = R.layout.fr_node_properties; + reportAtCreation = false; } protected static NodePropertiesFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeSummaryFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeSummaryFragment.java index ec113cbb..20eceffb 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeSummaryFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeSummaryFragment.java @@ -55,6 +55,7 @@ public class NodeSummaryFragment extends NodePropertiesFragment public NodeSummaryFragment() { layoutId = R.layout.fr_node_summary; + reportAtCreation = false; } protected static NodeSummaryFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/PagerNodeDetailsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/PagerNodeDetailsFragment.java index 9d4ae889..68f40536 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/PagerNodeDetailsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/PagerNodeDetailsFragment.java @@ -39,6 +39,8 @@ import org.alfresco.mobile.android.async.node.sync.SyncNodeEvent; import org.alfresco.mobile.android.async.node.update.UpdateContentEvent; import org.alfresco.mobile.android.async.node.update.UpdateNodeEvent; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.sync.utils.NodeSyncPlaceHolder; import android.annotation.TargetApi; @@ -57,7 +59,7 @@ /** * Responsible to display details of a specific Node. - * + * * @author Jean Marie Pascal */ public class PagerNodeDetailsFragment extends NodeDetailsFragment @@ -70,6 +72,8 @@ public class PagerNodeDetailsFragment extends NodeDetailsFragment public PagerNodeDetailsFragment() { setHasOptionsMenu(true); + screenName = AnalyticsManager.SCREEN_NODE_SUMMARY; + reportAtCreation = false; } protected static PagerNodeDetailsFragment newInstanceByTemplate(Bundle b) @@ -111,6 +115,8 @@ protected void displayTabs() NodeDetailsPagerAdapter adapter = new NodeDetailsPagerAdapter(getChildFragmentManager(), getActivity(), node, parentNode); viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(pageChangeListener); + pageChangeListener.onPageSelected(0); viewPager.setCurrentItem(0); tabs.setViewPager(viewPager); tabs.setTextColor(getResources().getColor(android.R.color.black)); @@ -140,6 +146,77 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) } } + ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() + { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) + { + + } + + @Override + public void onPageSelected(int position) + { + if (AnalyticsManager.getInstance(getActivity()) != null) + { + boolean isTablet = !getActivity().getResources().getBoolean(R.bool.fr_details_summary); + if (node instanceof NodeSyncPlaceHolder) + { + screenName = (isTablet) ? AnalyticsManager.SCREEN_NODE_PROPERTIES + : AnalyticsManager.SCREEN_NODE_SUMMARY; + } + else if (node instanceof Folder) + { + switch (position + 1) + { + case NodeDetailsPagerAdapter.TAB_METADATA: + screenName = (isTablet) ? AnalyticsManager.SCREEN_NODE_PROPERTIES + : AnalyticsManager.SCREEN_NODE_SUMMARY; + break; + case NodeDetailsPagerAdapter.TAB_COMMENTS: + screenName = AnalyticsManager.SCREEN_NODE_COMMENTS; + break; + default: + break; + } + } + else + { + int relativePosition = position; + if (!isTablet) + { + relativePosition++; + } + switch (relativePosition) + { + case NodeDetailsPagerAdapter.TAB_PREVIEW: + screenName = AnalyticsManager.SCREEN_NODE_PREVIEW; + break; + case NodeDetailsPagerAdapter.TAB_METADATA: + screenName = (isTablet) ? AnalyticsManager.SCREEN_NODE_PROPERTIES + : AnalyticsManager.SCREEN_NODE_SUMMARY; + break; + case NodeDetailsPagerAdapter.TAB_COMMENTS: + screenName = AnalyticsManager.SCREEN_NODE_COMMENTS; + break; + case NodeDetailsPagerAdapter.TAB_HISTORY: + screenName = AnalyticsManager.SCREEN_NODE_VERSIONS; + break; + default: + break; + } + } + AnalyticsHelper.reportScreen(getActivity(), screenName); + } + } + + @Override + public void onPageScrollStateChanged(int state) + { + + } + }; + // /////////////////////////////////////////////////////////////////////////// // EVENTS RECEIVER // /////////////////////////////////////////////////////////////////////////// diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/favorite/FavoritesFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/favorite/FavoritesFragment.java index b7955c42..db612373 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/favorite/FavoritesFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/favorite/FavoritesFragment.java @@ -38,6 +38,7 @@ import org.alfresco.mobile.android.application.fragments.node.details.NodeDetailsFragment; import org.alfresco.mobile.android.async.node.favorite.FavoriteNodeEvent; import org.alfresco.mobile.android.async.node.favorite.FavoriteNodesEvent; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.favorite.FavoritesManager; import org.alfresco.mobile.android.ui.ListingModeFragment; import org.alfresco.mobile.android.ui.SelectableFragment; @@ -69,6 +70,7 @@ public class FavoritesFragment extends FavoritesNodeFragment implements Selectab public FavoritesFragment() { emptyListMessageId = R.string.empty_favorites; + screenName = AnalyticsManager.SCREEN_FAVORITES; } public static FavoritesFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/rendition/CarouselPreviewFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/rendition/CarouselPreviewFragment.java index 871f06ed..e70ee00c 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/rendition/CarouselPreviewFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/rendition/CarouselPreviewFragment.java @@ -30,6 +30,7 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.node.browse.NodeChildrenEvent; import org.alfresco.mobile.android.async.node.browse.NodeChildrenRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.node.browse.NodeBrowserTemplate; @@ -68,6 +69,7 @@ public class CarouselPreviewFragment extends AlfrescoFragment implements Details // ////////////////////////////////////////////////////////////////////// public CarouselPreviewFragment() { + screenName = AnalyticsManager.SCREEN_NODE_GALLERY; } protected static CarouselPreviewFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/rendition/PreviewFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/rendition/PreviewFragment.java index ebee0b1b..0228f0fa 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/rendition/PreviewFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/rendition/PreviewFragment.java @@ -86,6 +86,7 @@ public PreviewFragment() { requiredSession = true; checkSession = true; + reportAtCreation = false; } protected static PreviewFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/search/DocumentFolderSearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/search/DocumentFolderSearchFragment.java index 455af174..e4560e03 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/search/DocumentFolderSearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/search/DocumentFolderSearchFragment.java @@ -42,6 +42,7 @@ import org.alfresco.mobile.android.async.OperationRequest.OperationBuilder; import org.alfresco.mobile.android.async.node.search.SearchEvent; import org.alfresco.mobile.android.async.node.search.SearchRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.ListingModeFragment; import org.alfresco.mobile.android.ui.SelectableFragment; import org.alfresco.mobile.android.ui.node.search.SearchNodesFragment; @@ -86,6 +87,7 @@ public DocumentFolderSearchFragment() super(); loadState = LOAD_VISIBLE; displayAsList = false; + screenName = AnalyticsManager.SCREEN_SEARCH_RESULT_FILES; } protected static DocumentFolderSearchFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/update/EditPropertiesFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/update/EditPropertiesFragment.java index e684a286..5912982d 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/update/EditPropertiesFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/update/EditPropertiesFragment.java @@ -36,6 +36,7 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.definition.TypeDefinitionEvent; import org.alfresco.mobile.android.async.node.update.UpdateNodeRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.BundleUtils; import android.content.res.Configuration; @@ -68,6 +69,7 @@ public class EditPropertiesFragment extends EditNodePropertiesFragment implement public EditPropertiesFragment() { setRetainInstance(true); + screenName = AnalyticsManager.SCREEN_NODE_EDIT_PROPERTIES; } public static EditPropertiesFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/versions/VersionFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/versions/VersionFragment.java index 518fdca3..5ec87c11 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/versions/VersionFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/versions/VersionFragment.java @@ -51,6 +51,7 @@ public class VersionFragment extends VersionsNodeFragment // /////////////////////////////////////////////////////////////////////////// public VersionFragment() { + reportAtCreation = false; } protected static VersionFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/AccountSettingsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/AccountSettingsFragment.java index 8daf4924..ec17979a 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/AccountSettingsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/AccountSettingsFragment.java @@ -36,6 +36,7 @@ import org.alfresco.mobile.android.application.fragments.user.UserProfileFragment; import org.alfresco.mobile.android.application.fragments.utils.EditTextDialogFragment; import org.alfresco.mobile.android.application.managers.ConfigManager; +import org.alfresco.mobile.android.application.managers.extensions.AnalyticHelper; import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.account.DeleteAccountEvent; import org.alfresco.mobile.android.async.clean.CleanSyncFavoriteRequest; @@ -44,6 +45,8 @@ import org.alfresco.mobile.android.platform.accounts.AccountsPreferences; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.platform.security.DataProtectionManager; import org.alfresco.mobile.android.platform.utils.BundleUtils; @@ -105,6 +108,7 @@ public AccountSettingsFragment() { setHasOptionsMenu(true); requiredSession = false; + screenName = AnalyticsManager.SCREEN_SETTINGS_ACCOUNT; } protected static AccountSettingsFragment newInstanceByTemplate(Bundle b) @@ -346,7 +350,7 @@ public void onPositive(MaterialDialog dialog) edit.putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, false); // Turn off data protection DataProtectionManager.getInstance(getActivity()).setDataProtectionEnable(false); - edit.commit(); + edit.apply(); deleteAccount(); } @@ -384,12 +388,19 @@ private void deleteAccount() AccountManager.get(getActivity()).removeAccount( AlfrescoAccountManager.getInstance(getActivity()).getAndroidAccount(account.getId()), null, null); - // Send the event - EventBusManager.getInstance().post(new DeleteAccountEvent(account)); + // Analytics + AnalyticsHelper + .reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_ACCOUNT, + AnalyticsManager.ACTION_DELETE, account.getTypeId() == AlfrescoAccount.TYPE_ALFRESCO_CLOUD + ? AnalyticsManager.SERVER_TYPE_CLOUD : AnalyticsManager.SERVER_TYPE_ONPREMISE, + 1, false); // In case where currentAccount is the one deleted. SessionManager.getInstance(getActivity()).removeAccount(account.getId()); + // Send the event + EventBusManager.getInstance().post(new DeleteAccountEvent(account)); + AlfrescoAccount newAccount = AlfrescoAccountManager.getInstance(getActivity()).getDefaultAccount(); if (newAccount != null && newAccount.getId() == account.getId()) @@ -398,7 +409,7 @@ private void deleteAccount() long id = settings.getLong(AccountsPreferences.ACCOUNT_DEFAULT, -1); if (id == account.getId()) { - settings.edit().putLong(AccountsPreferences.ACCOUNT_DEFAULT, -1).commit(); + settings.edit().putLong(AccountsPreferences.ACCOUNT_DEFAULT, -1).apply(); } } @@ -417,7 +428,7 @@ private void deleteAccount() newAccount = accounts.get(0); SessionManager.getInstance(getActivity()).saveAccount(newAccount); SharedPreferences settings = getActivity().getSharedPreferences(AccountsPreferences.ACCOUNT_PREFS, 0); - settings.edit().putLong(AccountsPreferences.ACCOUNT_DEFAULT, newAccount.getId()).commit(); + settings.edit().putLong(AccountsPreferences.ACCOUNT_DEFAULT, newAccount.getId()).apply(); setCurrentAccount(newAccount); if (SessionManager.getInstance(getActivity()).hasSession(newAccount.getId())) @@ -446,14 +457,15 @@ private void deleteAccount() // If no AlfrescoAccount left, we remove all preferences // Remove preferences SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); - SharedPreferences.Editor editor = sharedPref.edit(); - editor.clear(); - editor.commit(); + sharedPref.edit().clear().apply(); // Redirect to HomeScreenActivity getActivity().startActivity(new Intent(getActivity(), WelcomeActivity.class)); getActivity().finish(); } + + // Clear Analytics Info for deleted account + AnalyticHelper.cleanOpt(getActivity(), account); } // ////////////////////////////////////////////////////////////////////////////////////// @@ -471,6 +483,9 @@ public void onTextEdited(int id, String newValue) SessionManager.getInstance(getActivity()).saveAccount(account); setCurrentAccount(account); + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_ACCOUNT, + AnalyticsManager.ACTION_EDIT, AnalyticsManager.LABEL_NAME, 1, false); + recreate(); } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java index 4ab24462..970a7a30 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java @@ -30,6 +30,7 @@ import org.alfresco.mobile.android.application.fragments.builder.LeafFragmentBuilder; import org.alfresco.mobile.android.application.fragments.signin.AccountSignInFragment; import org.alfresco.mobile.android.application.managers.ActionUtils; +import org.alfresco.mobile.android.application.managers.extensions.AnalyticHelper; import org.alfresco.mobile.android.application.security.DataProtectionUserDialogFragment; import org.alfresco.mobile.android.async.session.RequestSessionEvent; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; @@ -37,6 +38,7 @@ import org.alfresco.mobile.android.platform.SessionManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.extensions.DevToolsManager; import org.alfresco.mobile.android.platform.intent.PrivateRequestCode; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; @@ -44,6 +46,7 @@ import org.alfresco.mobile.android.platform.security.DataProtectionManager; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.holder.HolderUtils; +import org.alfresco.mobile.android.ui.holder.TwoLinesCheckboxViewHolder; import org.alfresco.mobile.android.ui.holder.TwoLinesViewHolder; import android.content.Intent; @@ -78,6 +81,8 @@ public class GeneralPreferences extends AlfrescoFragment private TwoLinesViewHolder dataProtectionVH, passcodeVH; + private TwoLinesCheckboxViewHolder diagnosticVH; + // /////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS // /////////////////////////////////////////////////////////////////////////// @@ -85,6 +90,7 @@ public GeneralPreferences() { requiredSession = false; setHasOptionsMenu(true); + screenName = AnalyticsManager.SCREEN_SETTINGS_DETAILS; } protected static GeneralPreferences newInstanceByTemplate(Bundle b) @@ -109,41 +115,41 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa setRootView(inflater.inflate(R.layout.fr_settings, container, false)); TwoLinesViewHolder vh; - // Links - // Alfresco Website - vh = HolderUtils.configure(viewById(R.id.settings_links_website), getString(R.string.settings_links_website), - getString(R.string.settings_links_website_summary), -1); - viewById(R.id.settings_links_website_container).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - ActionUtils.startWebBrowser(getActivity(), getString(R.string.settings_links_website_url)); - } - }); - - // Play Store - vh = HolderUtils.configure(viewById(R.id.settings_rating), getString(R.string.settings_rating), - getString(R.string.settings_rating_summary), -1); - viewById(R.id.settings_rating_container).setOnClickListener(new View.OnClickListener() + // Feedback - Analytics + if (AnalyticsManager.getInstance(getActivity()) == null + || AnalyticsManager.getInstance(getActivity()).isBlocked()) { - @Override - public void onClick(View v) - { - startPlayStore(); - } - }); + boolean isEnable = AnalyticsManager.getInstance(getActivity()).isEnable(); - // Facebook - vh = HolderUtils.configure(viewById(R.id.settings_links_facebook), getString(R.string.settings_links_facebook), - getString(R.string.settings_links_facebook_summary), -1); - viewById(R.id.settings_links_facebook_container).setOnClickListener(new View.OnClickListener() + diagnosticVH = HolderUtils.configure(viewById(R.id.settings_diagnostic), + getString(R.string.settings_feedback_diagnostic), getString(R.string.mdm_managed), isEnable); + diagnosticVH.choose.setVisibility(View.GONE); + diagnosticVH.choose.setEnabled(false); + } + else { - @Override - public void onClick(View v) + boolean isEnable = AnalyticsManager.getInstance(getActivity()).isEnable(); + + diagnosticVH = HolderUtils.configure(viewById(R.id.settings_diagnostic), + getString(R.string.settings_feedback_diagnostic), + getString(R.string.settings_feedback_diagnostic_summary), isEnable); + HolderUtils.makeMultiLine(diagnosticVH.bottomText, 3); + diagnosticVH.choose.setOnClickListener(new View.OnClickListener() { - ActionUtils.startWebBrowser(getActivity(), getString(R.string.settings_links_facebook_url)); - } - }); - HolderUtils.makeMultiLine(vh.topText, 2); + @Override + public void onClick(View v) + { + if (diagnosticVH.choose.isChecked()) + { + AnalyticHelper.optIn(getActivity(), getAccount()); + } + else + { + AnalyticHelper.optOut(getActivity(), getAccount()); + } + } + }); + } // About vh = HolderUtils.configure(viewById(R.id.settings_about), getString(R.string.version_number), diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/PasscodePreferences.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/PasscodePreferences.java index c806c32b..7c9ce02e 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/PasscodePreferences.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/PasscodePreferences.java @@ -29,6 +29,7 @@ import org.alfresco.mobile.android.application.fragments.builder.LeafFragmentBuilder; import org.alfresco.mobile.android.application.security.PassCodeActivity; import org.alfresco.mobile.android.application.security.PassCodeDialogFragment; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.holder.HolderUtils; import org.alfresco.mobile.android.ui.holder.SingleLineSwitchViewHolder; @@ -103,6 +104,7 @@ public class PasscodePreferences extends AlfrescoFragment public PasscodePreferences() { requiredSession = false; + screenName = AnalyticsManager.SCREEN_SETTINGS_PASSCODE; } protected static PasscodePreferences newInstanceByTemplate(Bundle b) @@ -193,7 +195,7 @@ public boolean onSelection(MaterialDialog dialog, View view, int which, { String newValue = getResources().getStringArray(R.array.passcode_timeout_values)[which]; index = which; - sharedPref.edit().putString(KEY_PASSCODE_TIMEOUT, (String) newValue).commit(); + sharedPref.edit().putString(KEY_PASSCODE_TIMEOUT, (String) newValue).apply(); int minutes = Math.round(Long.parseLong((String) newValue) / ONE_MINUTE); passcodeTimeoutVH.bottomText.setText(String.format( MessageFormat.format(getString(R.string.passcode_timeout_summary), minutes), @@ -222,11 +224,11 @@ public void onClick(View v) passcodeDataVH.choose.setChecked(maxAttemptActivated); if (maxAttemptActivated) { - sharedPref.edit().putInt(KEY_PASSCODE_MAX_ATTEMPT, 10).commit(); + sharedPref.edit().putInt(KEY_PASSCODE_MAX_ATTEMPT, 10).apply(); } else { - sharedPref.edit().remove(KEY_PASSCODE_MAX_ATTEMPT).commit(); + sharedPref.edit().remove(KEY_PASSCODE_MAX_ATTEMPT).apply(); } } }); @@ -240,11 +242,11 @@ public void onClick(View v) passcodeDataVH.choose.setChecked(maxAttemptActivated); if (maxAttemptActivated) { - sharedPref.edit().putInt(KEY_PASSCODE_MAX_ATTEMPT, 10).commit(); + sharedPref.edit().putInt(KEY_PASSCODE_MAX_ATTEMPT, 10).apply(); } else { - sharedPref.edit().remove(KEY_PASSCODE_MAX_ATTEMPT).commit(); + sharedPref.edit().remove(KEY_PASSCODE_MAX_ATTEMPT).apply(); } } }); @@ -318,7 +320,7 @@ public static void updateLastActivity(Context context) SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = sharedPref.edit(); editor.putLong(KEY_PASSCODE_ACTIVATED_AT, new Date().getTime()); - editor.commit(); + editor.apply(); } /** diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/profile/ProfilesConfigFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/profile/ProfilesConfigFragment.java index 25ffb3c7..6e58f41b 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/profile/ProfilesConfigFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/profile/ProfilesConfigFragment.java @@ -26,6 +26,8 @@ import org.alfresco.mobile.android.application.managers.ConfigManager; import org.alfresco.mobile.android.async.OperationRequest.OperationBuilder; import org.alfresco.mobile.android.foundation.R; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseGridFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -120,6 +122,10 @@ public void onListItemClick(GridView l, View v, int position, long id) ProfileConfig profile = (ProfileConfig) l.getItemAtPosition(position); ConfigManager.getInstance(getActivity()).swapProfile(getAccount(), profile.getIdentifier()); getActivity().getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); + + // Analytics + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_SESSION, + AnalyticsManager.ACTION_SWITCH, AnalyticsManager.LABEL_PROFILE, 1, false); } // /////////////////////////////////////////////////////////////////////////// diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/AdvancedSearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/AdvancedSearchFragment.java index 69520876..96e3b123 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/AdvancedSearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/AdvancedSearchFragment.java @@ -44,6 +44,8 @@ import org.alfresco.mobile.android.application.ui.form.picker.DatePickerFragment; import org.alfresco.mobile.android.application.ui.form.picker.DatePickerFragment.onPickDateFragment; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.AccessibilityUtils; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; @@ -123,6 +125,12 @@ public class AdvancedSearchFragment extends AlfrescoFragment // /////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS // /////////////////////////////////////////////////////////////////////////// + public AdvancedSearchFragment() + { + screenName = AnalyticsManager.SCREEN_SEARCH_ADVANCED; + reportAtCreation = false; + } + protected static AdvancedSearchFragment newInstanceByTemplate(Bundle b) { AdvancedSearchFragment cbf = new AdvancedSearchFragment(); @@ -146,15 +154,22 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa { case HistorySearch.TYPE_PERSON: layoutId = R.layout.app_search_user; + screenName = AnalyticsManager.SCREEN_SEARCH_ADVANCED_USERS; break; case HistorySearch.TYPE_FOLDER: + layoutId = R.layout.app_search_document; + screenName = AnalyticsManager.SCREEN_SEARCH_ADVANCED_FOLDERS; + break; case HistorySearch.TYPE_DOCUMENT: layoutId = R.layout.app_search_document; + screenName = AnalyticsManager.SCREEN_SEARCH_ADVANCED_FILES; break; default: break; } + AnalyticsHelper.reportScreen(getActivity(), screenName); + // Search inside a folder tmpParentFolder = (Folder) getArguments().getSerializable(ARGUMENT_FOLDER); if (getArguments().containsKey(ViewTemplate.ARGUMENT_LABEL)) @@ -266,8 +281,8 @@ public void onClick(View v) modificationDateTo = (Button) rootView.findViewById(R.id.metadata_modification_date_to); if (modificationDateToValue != null) { - modificationDateTo.setText(DateFormat.getDateFormat(getActivity()) - .format(modificationDateToValue.getTime())); + modificationDateTo + .setText(DateFormat.getDateFormat(getActivity()).format(modificationDateToValue.getTime())); } modificationDateTo.setOnClickListener(new OnClickListener() { @@ -291,8 +306,8 @@ public void onClick(View v) modificationDateFrom = (Button) rootView.findViewById(R.id.metadata_modification_date_from); if (modificationDateFromValue != null) { - modificationDateFrom.setText(DateFormat.getDateFormat(getActivity()).format( - modificationDateFromValue.getTime())); + modificationDateFrom + .setText(DateFormat.getDateFormat(getActivity()).format(modificationDateFromValue.getTime())); } modificationDateFrom.setOnClickListener(new OnClickListener() { @@ -384,17 +399,24 @@ private void search() String description = createDescriptionQuery(); if (statement == null) { - AlfrescoNotificationManager.getInstance(getActivity()).showLongToast( - getActivity().getString(R.string.error_search_fields_empty)); + AlfrescoNotificationManager.getInstance(getActivity()) + .showLongToast(getActivity().getString(R.string.error_search_fields_empty)); return; } + + String label = null; switch (searchKey) { case HistorySearch.TYPE_PERSON: + label = AnalyticsManager.LABEL_DOCUMENTS; UsersFragment.with(getActivity()).keywords(statement).title(description).display(); break; case HistorySearch.TYPE_FOLDER: + label = AnalyticsManager.LABEL_FOLDERS; + DocumentFolderSearchFragment.with(getActivity()).query(statement).title(description).display(); + break; case HistorySearch.TYPE_DOCUMENT: + label = AnalyticsManager.LABEL_DOCUMENTS; DocumentFolderSearchFragment.with(getActivity()).query(statement).title(description).display(); break; default: @@ -403,6 +425,10 @@ private void search() // Save history or update HistorySearchManager.createHistorySearch(getActivity(), SessionUtils.getAccount(getActivity()).getId(), searchKey, 1, description, statement, new Date().getTime()); + + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_SEARCH, + AnalyticsManager.ACTION_RUN_ADVANCED, label, 1, false); + } private String createQuery() @@ -608,15 +634,15 @@ public void onDatePicked(String dateId, GregorianCalendar gregorianCalendar) { modificationDateFromValue = new GregorianCalendar(TimeZone.getTimeZone("GMT")); modificationDateFromValue.setTime(gregorianCalendar.getTime()); - modificationDateFrom.setText(DateFormat.getDateFormat(getActivity()).format( - modificationDateFromValue.getTime())); + modificationDateFrom + .setText(DateFormat.getDateFormat(getActivity()).format(modificationDateFromValue.getTime())); } else if (DATE_TO.equalsIgnoreCase(dateId)) { modificationDateToValue = new GregorianCalendar(TimeZone.getTimeZone("GMT")); modificationDateToValue.setTime(gregorianCalendar.getTime()); - modificationDateTo.setText(DateFormat.getDateFormat(getActivity()) - .format(modificationDateToValue.getTime())); + modificationDateTo + .setText(DateFormat.getDateFormat(getActivity()).format(modificationDateToValue.getTime())); } } @@ -646,8 +672,8 @@ public MimetypeAdapter(FragmentActivity context) { super(context, R.layout.app_header_row, MIMETYPE_GROUPS); this.vhClassName = SimpleViewHolder.class.getCanonicalName(); - px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, getContext().getResources() - .getDisplayMetrics()); + px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, + getContext().getResources().getDisplayMetrics()); } @Override @@ -679,6 +705,7 @@ public View getDropDownView(int position, View convertView, ViewGroup parent) private static final List MIMETYPE_GROUPS = new ArrayList(10) { private static final long serialVersionUID = 1L; + { add(R.string.mimetype_unknown); add(R.string.mimetype_documents); @@ -704,6 +731,7 @@ public static class Builder extends AlfrescoFragmentBuilder public static final int ICON_ID = R.drawable.ic_search_dark; public static final int LABEL_ID = R.string.search_advanced; + // /////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS // /////////////////////////////////////////////////////////////////////////// diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java index 89fc98c6..31dc2ad7 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java @@ -42,6 +42,8 @@ import org.alfresco.mobile.android.application.providers.search.HistorySearchManager; import org.alfresco.mobile.android.application.providers.search.HistorySearchSchema; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseCursorGridFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; import org.apache.chemistry.opencmis.commons.PropertyIds; @@ -115,6 +117,8 @@ public SearchFragment() requiredSession = true; checkSession = true; setHasOptionsMenu(true); + reportAtCreation = false; + screenName = AnalyticsManager.SCREEN_SEARCH_FILES; } protected static SearchFragment newInstanceByTemplate(Bundle b) @@ -395,10 +399,26 @@ private void search(String keywords) public void search(String keywords, HistorySearch search) { + String label = null; + switch (searchKey) + { + case HistorySearch.TYPE_DOCUMENT: + label = AnalyticsManager.LABEL_DOCUMENTS; + break; + case HistorySearch.TYPE_PERSON: + label = AnalyticsManager.LABEL_PEOPLE; + break; + case HistorySearch.TYPE_SITE: + label = AnalyticsManager.LABEL_SITES; + break; + default: + label = AnalyticsManager.LABEL_FOLDERS; + break; + } + // History search so we use the query if (search != null && search.getAdvanced() == 1) { - switch (searchKey) { case HistorySearch.TYPE_PERSON: @@ -414,6 +434,10 @@ public void search(String keywords, HistorySearch search) // Update HistorySearchManager.update(getActivity(), search.getId(), search.getAccountId(), search.getType(), search.getAdvanced(), search.getDescription(), search.getQuery(), new Date().getTime()); + + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_SEARCH, + AnalyticsManager.ACTION_RUN_HISTORY, label, 1, false); + return; } @@ -452,6 +476,9 @@ public void search(String keywords, HistorySearch search) HistorySearchManager.update(getActivity(), search.getId(), search.getAccountId(), search.getType(), search.getAdvanced(), search.getDescription(), search.getQuery(), new Date().getTime()); } + + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_SEARCH, + AnalyticsManager.ACTION_RUN, label, 1, false); } // ////////////////////////////////////////////////////////////////////// @@ -505,14 +532,17 @@ private void updateForm(int id) { case HistorySearch.TYPE_PERSON: hintId = R.string.search_person_hint; + screenName = AnalyticsManager.SCREEN_SEARCH_USERS; // iconResId = R.drawable.ic_person_light; break; case HistorySearch.TYPE_DOCUMENT: hintId = R.string.search_form_hint; + screenName = AnalyticsManager.SCREEN_SEARCH_FILES; // iconResId = R.drawable.ic_office; break; case HistorySearch.TYPE_FOLDER: hintId = R.string.search_form_hint; + screenName = AnalyticsManager.SCREEN_SEARCH_FOLDERS; // iconResId = R.drawable.ic_repository_light; break; default: @@ -525,6 +555,8 @@ private void updateForm(int id) searchForm.setHint(hintId); searchKey = id; + AnalyticsHelper.reportScreen(getActivity(), screenName); + // Refresh History refreshSilently(); } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountCredentialsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountCredentialsFragment.java index bc2f9876..fb96213c 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountCredentialsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountCredentialsFragment.java @@ -32,6 +32,7 @@ import org.alfresco.mobile.android.async.account.CreateAccountRequest; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.exception.AlfrescoExceptionHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.AccessibilityUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -90,6 +91,7 @@ public AccountCredentialsFragment() super(); eventBusRequired = true; requiredSession = false; + screenName = AnalyticsManager.SCREEN_ACCOUNT_USER; } public static AccountCredentialsFragment newInstanceByTemplate(Bundle b) @@ -314,7 +316,7 @@ public void onAccountCreated(CreateAccountEvent event) SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); if (acc.getIsPaidAccount() && !prefs.getBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, false)) { - prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).commit(); + prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).apply(); } AccountNameFragment.with(getActivity()).accountId(acc.getId()).back(false).display(); } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountNameFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountNameFragment.java index 6c9aca93..03934824 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountNameFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountNameFragment.java @@ -33,6 +33,7 @@ import org.alfresco.mobile.android.platform.SessionManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.BundleUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -65,6 +66,7 @@ public class AccountNameFragment extends AlfrescoFragment public AccountNameFragment() { super(); + screenName = AnalyticsManager.SCREEN_ACCOUNT_NAME; } public static AccountNameFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOAuthFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOAuthFragment.java index ba04fac8..54d7fa79 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOAuthFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOAuthFragment.java @@ -37,6 +37,7 @@ import org.alfresco.mobile.android.platform.SessionManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.exception.AlfrescoExceptionHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.oauth.OAuthFragment; import org.alfresco.mobile.android.ui.oauth.OnOAuthAccessTokenListener; @@ -55,7 +56,7 @@ import com.squareup.otto.Subscribe; -public class AccountOAuthFragment extends OAuthFragment +public class AccountOAuthFragment extends OAuthFragment implements AnalyticsManager.FragmentAnalyzed { public static final String TAG = "AccountOAuthFragment"; @@ -241,9 +242,8 @@ public void load(OAuthData oauthData) if (getArguments() != null && getArguments().containsKey(ARGUMENT_ACCOUNT)) { // TODO Replace by SessionMAnager - EventBusManager.getInstance().post( - new RequestSessionEvent((AlfrescoAccount) getArguments().getSerializable(ARGUMENT_ACCOUNT), - oauthData)); + EventBusManager.getInstance().post(new RequestSessionEvent( + (AlfrescoAccount) getArguments().getSerializable(ARGUMENT_ACCOUNT), oauthData)); } else { @@ -260,15 +260,15 @@ public void load(OAuthData oauthData) private void retryOAuthAuthentication() { reload(); - AlfrescoNotificationManager.getInstance(getActivity()).showLongToast( - getActivity().getString(R.string.error_general)); + AlfrescoNotificationManager.getInstance(getActivity()) + .showLongToast(getActivity().getString(R.string.error_general)); } private void retryOAuthAuthentication(Exception e) { reload(); - AlfrescoNotificationManager.getInstance(getActivity()).showLongToast( - getString(AlfrescoExceptionHelper.getMessageId(getActivity(), e))); + AlfrescoNotificationManager.getInstance(getActivity()) + .showLongToast(getString(AlfrescoExceptionHelper.getMessageId(getActivity(), e))); } // /////////////////////////////////////////////////////////////////////////// @@ -292,13 +292,25 @@ public void onAccountCreated(CreateAccountEvent event) SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); if (acc.getIsPaidAccount() && !prefs.getBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, false)) { - prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).commit(); + prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).apply(); } AccountNameFragment.with(getActivity()).accountId(acc.getId()).back(false).display(); return; } } + @Override + public String getScreenName() + { + return AnalyticsManager.SCREEN_ACCOUNT_OAUTH; + } + + @Override + public boolean reportAtCreationEnable() + { + return true; + } + // /////////////////////////////////////////////////////////////////////////// // BUILDER // /////////////////////////////////////////////////////////////////////////// diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOptionalFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOptionalFragment.java index b5e86abb..52285aa2 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOptionalFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOptionalFragment.java @@ -99,7 +99,7 @@ public void onClick(View v) DataProtectionManager.getInstance(getActivity()).encrypt(SessionUtils.getAccount(getActivity())); } - prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).commit(); + prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).apply(); AccountNameFragment.with(getActivity()).accountId(accountId).back(false).display(); } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountServerFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountServerFragment.java index 19407b0d..03d7aad0 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountServerFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountServerFragment.java @@ -32,6 +32,7 @@ import org.alfresco.mobile.android.async.account.CheckServerEvent; import org.alfresco.mobile.android.async.account.CheckServerRequest; import org.alfresco.mobile.android.platform.exception.AlfrescoExceptionHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -72,6 +73,7 @@ public AccountServerFragment() super(); requiredSession = false; eventBusRequired = true; + screenName = AnalyticsManager.SCREEN_ACCOUNT_SERVER; } public static AccountServerFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountSignInFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountSignInFragment.java index f80745d8..c34c80b6 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountSignInFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountSignInFragment.java @@ -32,6 +32,7 @@ import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; import org.alfresco.mobile.android.platform.exception.AlfrescoExceptionHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.mdm.MDMManager; import org.alfresco.mobile.android.platform.utils.AccessibilityUtils; import org.alfresco.mobile.android.platform.utils.SessionUtils; @@ -93,6 +94,7 @@ public AccountSignInFragment() { requiredSession = false; checkSession = false; + screenName = AnalyticsManager.SCREEN_ACCOUNT_SIGNIN; } protected static AccountSignInFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/WelcomeFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/WelcomeFragment.java index 8ff25c9f..34493db3 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/WelcomeFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/WelcomeFragment.java @@ -27,6 +27,7 @@ import org.alfresco.mobile.android.application.activity.WelcomeActivity; import org.alfresco.mobile.android.application.fragments.FragmentDisplayer; import org.alfresco.mobile.android.application.fragments.builder.AlfrescoFragmentBuilder; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.AlfrescoIntentAPI; import org.alfresco.mobile.android.platform.mdm.MDMEvent; import org.alfresco.mobile.android.platform.mdm.MDMManager; @@ -66,6 +67,7 @@ public WelcomeFragment() { super(); requiredSession = false; + screenName = AnalyticsManager.SCREEN_ACCOUNT_TYPE; } public static WelcomeFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/browser/BrowserSitesPagerFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/browser/BrowserSitesPagerFragment.java index 725c3685..21a0cfd8 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/browser/BrowserSitesPagerFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/browser/BrowserSitesPagerFragment.java @@ -26,6 +26,8 @@ import org.alfresco.mobile.android.application.configuration.model.view.SiteBrowserConfigModel; import org.alfresco.mobile.android.application.fragments.builder.ListingFragmentBuilder; import org.alfresco.mobile.android.application.fragments.site.search.SearchSitesFragment; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.site.SitesTemplate; @@ -51,6 +53,7 @@ public class BrowserSitesPagerFragment extends AlfrescoFragment // ////////////////////////////////////////////////////////////////////// public BrowserSitesPagerFragment() { + reportAtCreation = false; } protected static BrowserSitesPagerFragment newInstanceByTemplate(Bundle b) @@ -74,6 +77,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa SitesPagerAdapter adapter = new SitesPagerAdapter(getChildFragmentManager(), getActivity(), getSession() instanceof CloudSession); viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(pageChangeListener); + pageChangeListener.onPageSelected(SitesPagerAdapter.TAB_MY_SITES); viewPager.setCurrentItem(SitesPagerAdapter.TAB_MY_SITES); PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) v.findViewById(R.id.tabs); @@ -94,6 +99,43 @@ public String onPrepareTitle() return title; } + ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() + { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) + { + + } + + @Override + public void onPageSelected(int position) + { + if (AnalyticsManager.getInstance(getActivity()) != null) + { + switch (position) + { + case SitesPagerAdapter.TAB_FAV_SITES: + screenName = AnalyticsManager.SCREEN_SITES_FAVORITES; + break; + case SitesPagerAdapter.TAB_MY_SITES: + screenName = AnalyticsManager.SCREEN_SITES_MY; + break; + default: + screenName = (getSession() instanceof CloudSession) ? AnalyticsManager.SCREEN_SITES_ALL + : AnalyticsManager.SCREEN_SITES_SEARCH; + break; + } + AnalyticsHelper.reportScreen(getActivity(), screenName); + } + } + + @Override + public void onPageScrollStateChanged(int state) + { + + } + }; + // /////////////////////////////////////////////////////////////////////////// // BUILDER // /////////////////////////////////////////////////////////////////////////// @@ -159,18 +201,20 @@ public SitesPagerAdapter(FragmentManager fm, FragmentActivity activity, boolean public Fragment getItem(int position) { SitesFragment.Builder builder = SitesFragment.with(activity.get()); + Fragment fr; switch (position) { case TAB_FAV_SITES: - builder.favorite(true); + fr = builder.favorite(true).createFragment(); break; case TAB_MY_SITES: - builder.favorite(false); + fr = builder.favorite(false).createFragment(); break; default: - return (isCloud) ? builder.createFragment() : SearchSitesFragment.with(activity.get()).createFragment(); + fr = (isCloud) ? builder.createFragment() : SearchSitesFragment.with(activity.get()).createFragment(); + break; } - return builder.createFragment(); + return fr; } @Override diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/browser/SitesFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/browser/SitesFragment.java index 0cf816c9..4c63f13e 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/browser/SitesFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/browser/SitesFragment.java @@ -66,6 +66,7 @@ public SitesFragment() super(); retrieveDataOnCreation = true; loadState = LOAD_VISIBLE; + reportAtCreation = false; } public static SitesFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/request/JoinSiteRequestsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/request/JoinSiteRequestsFragment.java index 2e692ef7..fde7ee46 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/request/JoinSiteRequestsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/request/JoinSiteRequestsFragment.java @@ -26,6 +26,7 @@ import org.alfresco.mobile.android.async.site.member.CancelPendingMembershipEvent; import org.alfresco.mobile.android.async.site.member.SitesPendingMembershipEvent; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.site.SitesPendingMembershipFoundationFragment; @@ -54,6 +55,7 @@ public class JoinSiteRequestsFragment extends SitesPendingMembershipFoundationFr public JoinSiteRequestsFragment() { emptyListMessageId = R.string.empty_joinsiterequest; + screenName = AnalyticsManager.SCREEN_SITES_PENDING_REQUEST; } public static JoinSiteRequestsFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/search/SearchSitesFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/search/SearchSitesFragment.java index e163ed7c..11ef41ca 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/search/SearchSitesFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/site/search/SearchSitesFragment.java @@ -89,6 +89,7 @@ public SearchSitesFragment() super(); retrieveDataOnCreation = false; loadState = LOAD_VISIBLE; + reportAtCreation = false; } public static SearchSitesFragment newInstanceByTemplate(Bundle b) @@ -322,6 +323,7 @@ public void setSearchValue(String searchValue) } } + // /////////////////////////////////////////////////////////////////////////// // EVENTS // /////////////////////////////////////////////////////////////////////////// diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/sync/SyncFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/sync/SyncFragment.java index 99382665..2d99388e 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/sync/SyncFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/sync/SyncFragment.java @@ -45,6 +45,7 @@ import org.alfresco.mobile.android.async.node.update.UpdateNodeEvent; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.provider.CursorUtils; import org.alfresco.mobile.android.platform.provider.MapUtil; import org.alfresco.mobile.android.platform.security.DataProtectionManager; @@ -134,6 +135,7 @@ public SyncFragment() checkSession = false; setHasOptionsMenu(true); displayAsList = true; + screenName = AnalyticsManager.SCREEN_SYNCED_CONTENT; } protected static SyncFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UserProfileFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UserProfileFragment.java index 66077ec8..ab7504b9 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UserProfileFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UserProfileFragment.java @@ -32,6 +32,8 @@ import org.alfresco.mobile.android.platform.SessionManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; import org.alfresco.mobile.android.platform.exception.CloudExceptionUtils; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.AccessibilityUtils; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; @@ -91,6 +93,7 @@ public class UserProfileFragment extends AlfrescoFragment implements OnMenuItemC // ////////////////////////////////////////////////////////////////////// public UserProfileFragment() { + screenName = AnalyticsManager.PREFIX_USER.concat(AnalyticsManager.SCREEN_USER_DETAILS); } protected static UserProfileFragment newInstanceByTemplate(Bundle b) @@ -114,7 +117,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa if (getArguments() != null) { userName = getArguments().getString(ARGUMENT_USERNAME); - accountId = getArguments().getLong(ARGUMENT_ACCOUNTID); + if (getArguments().containsKey(ARGUMENT_ACCOUNTID)) + { + accountId = getArguments().getLong(ARGUMENT_ACCOUNTID); + } } session = SessionUtils.getSession(getActivity()); @@ -151,8 +157,17 @@ public void onActivityCreated(Bundle savedInstanceState) hide(R.id.profile_details); show(R.id.progressbar); - Operator.with(getActivity(), AlfrescoAccountManager.getInstance(getActivity()).retrieveAccount(accountId)) - .load(new PersonRequest.Builder(userName).setAccountId(accountId)); + if (accountId == null) + { + Operator.with(getActivity(), getAccount()) + .load(new PersonRequest.Builder(userName).setAccountId(getAccount().getId())); + } + else + { + Operator.with(getActivity(), AlfrescoAccountManager.getInstance(getActivity()).retrieveAccount(accountId)) + .load(new PersonRequest.Builder(userName).setAccountId(accountId)); + } + } @Override @@ -232,8 +247,8 @@ private void getMenu(Menu menu, int mode) if (person.getCompany() != null && person.getCompany().getTelephoneNumber() != null && !person.getCompany().getTelephoneNumber().isEmpty()) { - mi = menu.add(Menu.NONE, R.id.menu_user_company_phone, Menu.FIRST + 5, person.getCompany() - .getTelephoneNumber()); + mi = menu.add(Menu.NONE, R.id.menu_user_company_phone, Menu.FIRST + 5, + person.getCompany().getTelephoneNumber()); mi.setIcon(R.drawable.ic_call); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } @@ -262,8 +277,8 @@ private void getMenu(Menu menu, int mode) if (person.getCompany() != null && person.getCompany().getEmail() != null && !person.getCompany().getEmail().isEmpty()) { - mi = menu.add(Menu.NONE, R.id.menu_user_company_email, Menu.FIRST + 4, person.getCompany() - .getEmail()); + mi = menu.add(Menu.NONE, R.id.menu_user_company_email, Menu.FIRST + 4, + person.getCompany().getEmail()); mi.setIcon(R.drawable.ic_send_mail); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } @@ -279,44 +294,68 @@ private void getMenu(Menu menu, int mode) public boolean onMenuItemClick(MenuItem item) { boolean onMenuItemClick = true; + String actionName = null, actionLabel = null; switch (item.getItemId()) { case R.id.menu_user_chat: onMenuItemClick = true; actionSkype(getActivity(), ACTION_CHAT, person.getSkypeId()); + actionName = AnalyticsManager.ACTION_SKYPE; + actionLabel = AnalyticsManager.LABEL_CHAT; break; case R.id.menu_user_call: actionSkype(getActivity(), ACTION_CALL, person.getSkypeId()); onMenuItemClick = true; + actionName = AnalyticsManager.ACTION_SKYPE; + actionLabel = AnalyticsManager.LABEL_CALL; break; case R.id.menu_user_videocall: actionSkype(getActivity(), ACTION_VIDEO_CALL, person.getSkypeId()); onMenuItemClick = true; + actionName = AnalyticsManager.ACTION_SKYPE; + actionLabel = AnalyticsManager.LABEL_VIDEOCALL; break; case R.id.menu_user_email: actionEmail(getActivity(), person.getEmail(), null, null); onMenuItemClick = true; + actionName = AnalyticsManager.ACTION_EMAIL; + actionLabel = AnalyticsManager.LABEL_USER; break; case R.id.menu_user_company_email: actionEmail(getActivity(), person.getCompany().getEmail(), null, null); onMenuItemClick = true; + actionName = AnalyticsManager.ACTION_EMAIL; + actionLabel = AnalyticsManager.LABEL_COMPANY; break; case R.id.menu_user_company_phone: actionCall(getActivity(), person.getCompany().getTelephoneNumber()); onMenuItemClick = true; + actionName = AnalyticsManager.ACTION_CALL; + actionLabel = AnalyticsManager.LABEL_COMPANY; break; case R.id.menu_user_phone: actionCall(getActivity(), person.getTelephoneNumber()); onMenuItemClick = true; + actionName = AnalyticsManager.ACTION_CALL; + actionLabel = AnalyticsManager.LABEL_PHONE; break; case R.id.menu_user_mobile: actionCall(getActivity(), person.getMobileNumber()); onMenuItemClick = true; + actionName = AnalyticsManager.ACTION_CALL; + actionLabel = AnalyticsManager.LABEL_MOBILE; break; default: onMenuItemClick = false; break; } + + if (onMenuItemClick) + { + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_USER, actionName, actionLabel, + 1, false); + } + return onMenuItemClick; } @@ -515,8 +554,8 @@ public void onClick(View v) @Override public void onClick(View v) { - actionGeolocalisation(getActivity(), person.getCompany().getFullAddress(), person.getCompany() - .getName()); + actionGeolocalisation(getActivity(), person.getCompany().getFullAddress(), + person.getCompany().getName()); } }); } @@ -664,6 +703,9 @@ else if (member.getInstantMessageId() != null && member.getInstantMessageId().le } activity.startActivity(Intent.createChooser(intent, activity.getString(R.string.contact_add))); + + AnalyticsHelper.reportOperationEvent(activity, AnalyticsManager.CATEGORY_USER, + AnalyticsManager.ACTION_ADD_CONTACT, AnalyticsManager.LABEL_CONTACT, 1, false); } catch (ActivityNotFoundException e) { diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UsersFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UsersFragment.java index 3c9511c3..b5f9a7b1 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UsersFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UsersFragment.java @@ -29,6 +29,8 @@ import org.alfresco.mobile.android.application.fragments.builder.ListingFragmentBuilder; import org.alfresco.mobile.android.application.managers.ConfigManager; import org.alfresco.mobile.android.async.person.PersonsEvent; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.person.PeopleFragment; import android.os.Bundle; @@ -56,6 +58,7 @@ public class UsersFragment extends PeopleFragment public UsersFragment() { emptyListMessageId = R.string.person_not_found; + reportAtCreation = false; } public static UsersFragment newInstanceByTemplate(Bundle b) @@ -66,6 +69,21 @@ public static UsersFragment newInstanceByTemplate(Bundle b) return cbf; } + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + if (keywords != null) + { + screenName = AnalyticsManager.SCREEN_SEARCH_RESULT_USERS; + } + else if (siteShortName != null) + { + screenName = AnalyticsManager.SCREEN_SITES_MEMBERS; + } + AnalyticsHelper.reportScreen(getActivity(), screenName); + } + // /////////////////////////////////////////////////////////////////////////// // LIST ACTIONS // /////////////////////////////////////////////////////////////////////////// @@ -136,7 +154,8 @@ public void onListItemClick(GridView l, View v, int position, long id) else { // Show properties - UserProfileFragment.with(getActivity()).personId(item.getIdentifier()).display(); + UserProfileFragment.with(getActivity()).accountId(getAccount().getId()).personId(item.getIdentifier()) + .display(); } } } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskFragment.java index c27aaac7..18a6e43b 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskFragment.java @@ -46,6 +46,7 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.workflow.process.start.StartProcessEvent; import org.alfresco.mobile.android.async.workflow.process.start.StartProcessRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.platform.mimetype.MimeTypeManager; import org.alfresco.mobile.android.ui.ListingModeFragment; @@ -122,6 +123,7 @@ public class CreateTaskFragment extends AlfrescoFragment // /////////////////////////////////////////////////////////////////////////// public CreateTaskFragment() { + screenName = AnalyticsManager.SCREEN_TASK_CREATE_FORM; } public static CreateTaskFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskTypePickerFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskTypePickerFragment.java index da9ee1a1..2b6df117 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskTypePickerFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskTypePickerFragment.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.fragments.workflow; import java.util.ArrayList; @@ -29,6 +29,7 @@ import org.alfresco.mobile.android.async.workflow.process.ProcessDefinitionsEvent; import org.alfresco.mobile.android.async.workflow.process.ProcessDefinitionsRequest; import org.alfresco.mobile.android.platform.exception.CloudExceptionUtils; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; @@ -67,6 +68,7 @@ public class CreateTaskTypePickerFragment extends AlfrescoFragment // /////////////////////////////////////////////////////////////////////////// public CreateTaskTypePickerFragment() { + screenName = AnalyticsManager.SCREEN_TASK_CREATE_TYPE; } public static CreateTaskTypePickerFragment newInstance(List docs) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/process/ProcessTasksFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/process/ProcessTasksFragment.java index f7d1a210..18c53544 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/process/ProcessTasksFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/process/ProcessTasksFragment.java @@ -28,6 +28,7 @@ import org.alfresco.mobile.android.async.OperationRequest.OperationBuilder; import org.alfresco.mobile.android.async.workflow.task.TasksEvent; import org.alfresco.mobile.android.async.workflow.task.TasksRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseGridFragment; import android.os.Bundle; @@ -59,6 +60,7 @@ public ProcessTasksFragment() emptyListMessageId = R.string.empty_tasks; retrieveDataOnCreation = true; checkSession = true; + screenName = AnalyticsManager.SCREEN_TASKS_HISTORY; } protected static ProcessTasksFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TaskDetailsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TaskDetailsFragment.java index 677653ea..c2ebcba2 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TaskDetailsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TaskDetailsFragment.java @@ -56,6 +56,7 @@ import org.alfresco.mobile.android.async.workflow.task.delegate.ReassignTaskEvent; import org.alfresco.mobile.android.async.workflow.task.delegate.ReassignTaskRequest; import org.alfresco.mobile.android.platform.exception.CloudExceptionUtils; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.mimetype.MimeTypeManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.ListingModeFragment; @@ -125,6 +126,7 @@ public class TaskDetailsFragment extends AlfrescoFragment implements UserPickerC public TaskDetailsFragment() { setHasOptionsMenu(true); + screenName = AnalyticsManager.SCREEN_TASK_DETAILS; } protected static TaskDetailsFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TaskFilterFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TaskFilterFragment.java index 962d4fcb..d6603826 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TaskFilterFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TaskFilterFragment.java @@ -24,6 +24,7 @@ import org.alfresco.mobile.android.api.model.ListingFilter; import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.application.fragments.builder.AlfrescoFragmentBuilder; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -50,6 +51,11 @@ public class TaskFilterFragment extends AlfrescoFragment // /////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS // /////////////////////////////////////////////////////////////////////////// + public TaskFilterFragment() + { + screenName = AnalyticsManager.SCREEN_TASKS_FILTER; + } + protected static TaskFilterFragment newInstanceByTemplate(Bundle b) { TaskFilterFragment cbf = new TaskFilterFragment(); @@ -78,7 +84,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa expandableList.setOnChildClickListener(new OnChildClickListener() { @Override - public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) + public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, + long id) { expListAdapter.select(v, groupPosition, childPosition); return false; diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksFragment.java index 169a9838..a7823617 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksFragment.java @@ -32,6 +32,7 @@ import org.alfresco.mobile.android.async.workflow.task.TasksEvent; import org.alfresco.mobile.android.async.workflow.task.complete.CompleteTaskEvent; import org.alfresco.mobile.android.async.workflow.task.delegate.ReassignTaskEvent; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.platform.utils.BundleUtils; import org.alfresco.mobile.android.ui.activity.AlfrescoActivity; @@ -72,6 +73,7 @@ public TasksFragment() emptyListMessageId = R.string.empty_tasks; loadState = LOAD_VISIBLE; setHasOptionsMenu(true); + screenName = AnalyticsManager.SCREEN_TASKS_LISTING; } public static TasksFragment newInstanceByTemplate(Bundle b) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksHelper.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksHelper.java index e124287e..b35b383c 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksHelper.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksHelper.java @@ -104,7 +104,7 @@ public boolean onNavigationItemSelected(int itemPosition, long itemId) if (isProcessFragment) { - prefs.edit().putInt(TASK_FILTER_DEFAULT, itemPosition).commit(); + prefs.edit().putInt(TASK_FILTER_DEFAULT, itemPosition).apply(); f.addFilter(PublicAPIWorkflowServiceImpl.INCLUDE_VARIABLES, "true"); ListingContext lc = new ListingContext(); @@ -116,7 +116,7 @@ public boolean onNavigationItemSelected(int itemPosition, long itemId) ListingContext lc = new ListingContext(); lc.setFilter(f); TasksFragment.with(activity).menuId(itemPosition).setListingContext(lc).display(); - prefs.edit().putInt(TASK_FILTER_DEFAULT, itemPosition).commit(); + prefs.edit().putInt(TASK_FILTER_DEFAULT, itemPosition).apply(); } return true; } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ConfigManager.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ConfigManager.java index f712defa..2c3f4044 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ConfigManager.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ConfigManager.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.managers; import java.io.File; @@ -274,6 +274,9 @@ public ConfigService getConfig(long accountId, ConfigTypeIds id) case REPOSITORY: service = (service.getRepositoryConfig() != null) ? service : null; break; + case FEATURES: + service = (service.getFeatureConfig() != null) ? service : null; + break; default: break; } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java new file mode 100644 index 00000000..7dae079b --- /dev/null +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.alfresco.mobile.android.application.managers.extensions; + +import java.util.List; + +import org.alfresco.mobile.android.api.model.config.ProfileConfig; +import org.alfresco.mobile.android.api.session.AlfrescoSession; +import org.alfresco.mobile.android.application.fragments.preferences.PasscodePreferences; +import org.alfresco.mobile.android.application.managers.ConfigManager; +import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; +import org.alfresco.mobile.android.platform.security.DataProtectionManager; +import org.alfresco.mobile.android.sync.SyncContentManager; +import org.alfresco.mobile.android.ui.activity.AlfrescoActivity; + +import android.app.Activity; +import android.content.Context; +import android.util.Log; +import android.util.SparseArray; + +/** + * Created by jpascal on 29/01/2016. + */ +public class AnalyticHelper extends AnalyticsHelper +{ + + public static void optIn(Activity activity, AlfrescoAccount account) + { + AnalyticsManager.getInstance(activity).optIn(activity, account); + AnalyticsManager.getInstance(activity).startReport(activity); + try + { + analyzeSession(activity, ((AlfrescoActivity) activity).getCurrentAccount(), + ((AlfrescoActivity) activity).getCurrentSession()); + } + catch (Exception e) + { + + } + AnalyticsManager.getInstance(activity).reportEvent(AnalyticsManager.CATEGORY_SETTINGS, + AnalyticsManager.ACTION_ANALYTICS, AnalyticsManager.LABEL_ENABLE, 1); + } + + public static void optOut(Activity activity, AlfrescoAccount account) + { + AnalyticsManager.getInstance(activity).reportEvent(AnalyticsManager.CATEGORY_SETTINGS, + AnalyticsManager.ACTION_ANALYTICS, AnalyticsManager.LABEL_DISABLE, 1); + AnalyticsManager.getInstance(activity).optOut(activity, account); + } + + public static void cleanOpt(Activity activity, AlfrescoAccount account) + { + if (AnalyticsManager.getInstance(activity) == null) { return; } + AnalyticsManager.getInstance(activity).cleanOptInfo(activity, account); + } + + public static void analyzeSession(Context context, AlfrescoAccount account, AlfrescoSession repoSession) + { + if (repoSession == null || account == null) { return; } + if (AnalyticsManager.getInstance(context) == null + || !AnalyticsManager.getInstance(context).isEnable()) { return; } + try + { + SparseArray customDimensions = new SparseArray<>(); + SparseArray customMetrics = new SparseArray<>(); + + // Accounts Info + List accounts = AlfrescoAccountManager.retrieveAccounts(context); + customMetrics.append(AnalyticsManager.INDEX_ACCOUNT_NUMBER, (long) accounts.size()); + customDimensions.append(AnalyticsManager.INDEX_ACCOUNT_COUNT, getAccountLabel(accounts.size())); + + // Settings Info + boolean dataProtectionEnable = DataProtectionManager.getInstance(context).hasDataProtectionEnable(); + boolean passcodeEnable = PasscodePreferences.hasPasscodeEnable(context); + Boolean syncWifiEnable = SyncContentManager.getInstance(context).hasWifiOnlySync(account); + customMetrics.append(AnalyticsManager.INDEX_PASSCODE, passcodeEnable ? 1L : 0L); + customMetrics.append(AnalyticsManager.INDEX_DATA_PROTECTION, dataProtectionEnable ? 1L : 0L); + customMetrics.append(AnalyticsManager.INDEX_SYNC_CELLULAR, syncWifiEnable ? 0L : 1L); + + // Server Info + customMetrics.append(AnalyticsManager.INDEX_SESSION_CREATION, 1L); + SparseArray customInfo = retrieveSessionInfo(repoSession); + for (int i = 0; i < customInfo.size(); i++) + { + int key = customInfo.keyAt(i); + customDimensions.append(key, customInfo.get(key)); + } + + // Sync Info + SparseArray syncInfo = retrieveSyncInfo(context, account); + for (int i = 0; i < syncInfo.size(); i++) + { + int key = syncInfo.keyAt(i); + if (key == AnalyticsManager.INDEX_SYNCED_FILES) + { + customDimensions.append(AnalyticsManager.INDEX_SYNC_FILE_COUNT, + getSyncFileLabel(syncInfo.get(key))); + } + customMetrics.append(key, syncInfo.get(key)); + } + + // Download Info + customMetrics.append(AnalyticsManager.INDEX_LOCAL_FILES, getDownloadedFilesCount(context, account)); + + // Profiles + customMetrics.append(AnalyticsManager.INDEX_PROFILES, getProfilesCount(context, account)); + + AnalyticsManager.getInstance(context).reportInfo(AnalyticsManager.ACTION_INFO, customDimensions, + customMetrics); + } + catch (Exception e) + { + // Do Nothing + } + } + + protected static Long getProfilesCount(Context context, AlfrescoAccount account) + { + int size = 0; + try + { + if (ConfigManager.getInstance(context) != null + && ConfigManager.getInstance(context).hasConfig(account.getId())) + { + List profileListing = ConfigManager.getInstance(context).getConfig(account.getId()) + .getProfiles(); + size = profileListing.size(); + } + + } + catch (Exception e) + { + Log.d("Analytics Profiles", Log.getStackTraceString(e)); + } + return (long) size; + } + + protected static String getAccountLabel(int value) + { + String label = AnalyticsManager.INDEX_ACCOUNT_COUNT_1; + switch (value) + { + case 1: + return AnalyticsManager.INDEX_ACCOUNT_COUNT_1; + case 2: + return AnalyticsManager.INDEX_ACCOUNT_COUNT_2; + case 3: + return AnalyticsManager.INDEX_ACCOUNT_COUNT_3; + case 4: + return AnalyticsManager.INDEX_ACCOUNT_COUNT_4; + case 5: + return AnalyticsManager.INDEX_ACCOUNT_COUNT_5; + } + return label; + } + + protected static String getSyncFileLabel(long value) + { + if (value <= 0) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_0; + } + else if (value <= 1) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_1; + } + else if (value <= 5) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_5; + } + else if (value <= 10) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_10; + } + else if (value <= 20) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_20; + } + else if (value <= 50) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_50; + } + else if (value <= 100) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_100; + } + else if (value <= 250) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_250; + } + else if (value <= 500) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_500; + } + else if (value <= 1000) + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_1000; + } + else + { + return AnalyticsManager.INDEX_SYNC_FILE_COUNT_1001; + } + } + +} diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/upgrade/UpgradeManager.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/upgrade/UpgradeManager.java index 61ef5e04..21a505a7 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/upgrade/UpgradeManager.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/upgrade/UpgradeManager.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.managers.upgrade; import java.io.File; @@ -98,7 +98,7 @@ private void checkVersionCode() else { // Save status - prefs.edit().putInt(VERSION_NUMBER, currentVersionNumber).commit(); + prefs.edit().putInt(VERSION_NUMBER, currentVersionNumber).apply(); } } catch (NameNotFoundException e) @@ -117,7 +117,7 @@ private void upgrade() upgradeVersion110(); // Upgrade done. Save current state. - prefs.edit().putInt(VERSION_NUMBER, currentVersionNumber).commit(); + prefs.edit().putInt(VERSION_NUMBER, currentVersionNumber).apply(); versionNumber = currentVersionNumber; canUpgrade = false; } @@ -155,12 +155,12 @@ private void upgradeVersion110() { UpgradeVersion110.transferFilesBackground(oldDownloads.getPath(), newDownloads.getPath(), AlfrescoStorageManager.DIRECTORY_DOWNLOAD, true, true); - prefs.edit().putBoolean(UPGRADE_MIGRATION_FILES, true).commit(); + prefs.edit().putBoolean(UPGRADE_MIGRATION_FILES, true).apply(); } } else { - prefs.edit().putBoolean(UPGRADE_MIGRATION_FILES, true).commit(); + prefs.edit().putBoolean(UPGRADE_MIGRATION_FILES, true).apply(); } } Log.i(TAG, "[upgradeVersion110] : Completed"); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/providers/storage/StorageAccessDocumentsProvider.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/providers/storage/StorageAccessDocumentsProvider.java index 5fdcc702..6e7cf750 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/providers/storage/StorageAccessDocumentsProvider.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/providers/storage/StorageAccessDocumentsProvider.java @@ -58,6 +58,8 @@ import org.alfresco.mobile.android.platform.SessionManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.platform.mimetype.MimeTypeManager; import org.alfresco.mobile.android.platform.provider.AlfrescoContentProvider; @@ -446,6 +448,13 @@ public ParcelFileDescriptor openDocument(String documentId, String mode, Cancell } Log.d(TAG, "Create Sync File Descriptor : " + downloadedFile.getPath()); + + // Analytics + AnalyticsHelper.reportOperationEvent(getContext(), AnalyticsManager.CATEGORY_DOC_PROVIDER, + AnalyticsManager.ACTION_OPEN, + MimeTypeManager.getInstance(getContext()).getMIMEType(downloadedFile.getName()), 1, + false); + // Document available locally return createSyncFileDescriptor(nodeRefId, isWrite, downloadedFile, accessMode); } @@ -520,6 +529,14 @@ public ParcelFileDescriptor openDocument(String documentId, String mode, Cancell if (cUri.type == PREFIX_SYNC && downloadedFile != null && downloadedFile.exists()) { Log.d(TAG, "Doc synced : " + downloadedFile.getPath() + " - Mode " + mode); + + // Analytics + AnalyticsHelper.reportOperationEvent(getContext(), AnalyticsManager.CATEGORY_DOC_PROVIDER, + AnalyticsManager.ACTION_OPEN, + currentNode.isDocument() ? ((org.alfresco.mobile.android.api.model.Document) currentNode) + .getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, + 1, false); + // Document available locally return createFileDescriptor((org.alfresco.mobile.android.api.model.Document) currentNode, isWrite, downloadedFile, accessMode); @@ -529,6 +546,14 @@ public ParcelFileDescriptor openDocument(String documentId, String mode, Cancell if (downloadedFile != null && downloadedFile.exists()) { Log.d(TAG, "Doc in cache : " + downloadedFile.getPath() + " - Mode " + mode); + + // Analytics + AnalyticsHelper.reportOperationEvent(getContext(), AnalyticsManager.CATEGORY_DOC_PROVIDER, + AnalyticsManager.ACTION_OPEN, + currentNode.isDocument() ? ((org.alfresco.mobile.android.api.model.Document) currentNode) + .getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, + 1, false); + // Document available locally return createFileDescriptor((org.alfresco.mobile.android.api.model.Document) currentNode, isWrite, downloadedFile, accessMode); @@ -564,6 +589,13 @@ public ParcelFileDescriptor openDocument(String documentId, String mode, Cancell if (downloadedFile.exists()) { + // Analytics + AnalyticsHelper.reportOperationEvent(getContext(), AnalyticsManager.CATEGORY_DOC_PROVIDER, + AnalyticsManager.ACTION_OPEN, + currentNode.isDocument() ? ((org.alfresco.mobile.android.api.model.Document) currentNode) + .getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, + 1, false); + // Document available locally return createFileDescriptor((org.alfresco.mobile.android.api.model.Document) currentNode, isWrite, downloadedFile, accessMode); @@ -785,6 +817,10 @@ else if (pathIndex.containsKey(cUri.id)) try { + // Analytics + AnalyticsHelper.reportOperationEvent(getContext(), AnalyticsManager.CATEGORY_DOC_PROVIDER, + AnalyticsManager.ACTION_CREATE, mimeType, 1, false); + // Flag to detect loading in progress Boolean active = mLoadingUris.get(cUri); @@ -861,6 +897,14 @@ protected Void doInBackground(Void... params) checkSession(cUri); Node currentNode = retrieveNode(cUri.id); session.getServiceRegistry().getDocumentFolderService().deleteNode(currentNode); + + // Analytics + AnalyticsHelper.reportOperationEvent(getContext(), AnalyticsManager.CATEGORY_DOC_PROVIDER, + AnalyticsManager.ACTION_DELETE, + currentNode.isDocument() ? ((org.alfresco.mobile.android.api.model.Document) currentNode) + .getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, + 1, false); + return null; } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/DataCleaner.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/DataCleaner.java index 1091e68f..95681118 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/DataCleaner.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/DataCleaner.java @@ -61,15 +61,15 @@ protected Boolean doInBackground(String... params) SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(activityRef.get()); Editor editor = sharedPref.edit(); editor.clear(); - editor.commit(); + editor.apply(); SharedPreferences settings = activityRef.get().getSharedPreferences(AccountsPreferences.ACCOUNT_PREFS, 0); editor = settings.edit(); editor.clear(); - editor.commit(); + editor.apply(); SharedPreferences prefs = activityRef.get().getSharedPreferences(FileExplorerHelper.FILEEXPLORER_PREFS, 0); editor = prefs.edit(); editor.clear(); - editor.commit(); + editor.apply(); // Remove All Accounts List accounts = AlfrescoAccountManager.getInstance(activityRef.get()).getAndroidAccounts(); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/DataProtectionUserDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/DataProtectionUserDialogFragment.java index 3446a5a4..fa41b3ab 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/DataProtectionUserDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/DataProtectionUserDialogFragment.java @@ -150,7 +150,7 @@ public void onPositive() if (firstTime) { DataProtectionManager.getInstance(getActivity()).setDataProtectionUserRequested(true); - prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).commit(); + prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).apply(); localMessageId = R.string.encryption_title; } else @@ -197,7 +197,7 @@ public void onNegative() if (firstTime) { DataProtectionManager.getInstance(getActivity()).setDataProtectionUserRequested(true); - prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).commit(); + prefs.edit().putBoolean(GeneralPreferences.HAS_ACCESSED_PAID_SERVICES, true).apply(); } } }; diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/PassCodeDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/PassCodeDialogFragment.java index 001e3ef5..01e94c86 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/PassCodeDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/security/PassCodeDialogFragment.java @@ -299,7 +299,7 @@ private void validate() Editor editor = sharedPref.edit(); editor.putLong(KEY_PASSCODE_ACTIVATED_AT, -1); editor.remove(KEY_PASSCODE_ATTEMPT); - editor.commit(); + editor.apply(); getActivity().setResult(FragmentActivity.RESULT_OK); getActivity().finish(); } @@ -340,7 +340,7 @@ else if (needConfirmation && getUserPassCode(true) != null) editor.putBoolean(KEY_PASSCODE_ENABLE, true); editor.remove(KEY_PASSCODE_ATTEMPT); editor.putString(KEY_PASSCODE_VALUE, getUserPassCode(true)); - editor.commit(); + editor.apply(); dismiss(); errorMessage.setVisibility(View.INVISIBLE); if (getActivity().getSupportFragmentManager().findFragmentByTag(PasscodePreferences.TAG) != null) @@ -369,7 +369,7 @@ private void delete() editor.putBoolean(KEY_PASSCODE_ENABLE, false); editor.remove(KEY_PASSCODE_ATTEMPT); editor.remove(KEY_PASSCODE_VALUE); - editor.commit(); + editor.apply(); dismiss(); errorMessage.setVisibility(View.INVISIBLE); if (getActivity().getSupportFragmentManager().findFragmentByTag(PasscodePreferences.TAG) != null) @@ -441,7 +441,7 @@ private void checkAttempts() Editor editor = sharedPref.edit(); editor.putInt(KEY_PASSCODE_ATTEMPT, attempts + 1); - editor.commit(); + editor.apply(); } private String getUserPassCode(boolean needConfirmation) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/ActionShortcutActivity.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/ActionShortcutActivity.java index eb178533..d37ca06f 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/ActionShortcutActivity.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/ActionShortcutActivity.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco Mobile for Android. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.widgets; import org.alfresco.mobile.android.api.model.Folder; @@ -25,6 +25,8 @@ import org.alfresco.mobile.android.async.session.LoadSessionCallBack.LoadAccountCompletedEvent; import org.alfresco.mobile.android.async.session.RequestSessionEvent; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.AlfrescoIntentAPI; import android.content.Intent; @@ -61,20 +63,24 @@ private void createShortcut(AlfrescoAccount uploadAccount, Folder folder, Site s { // Intent associated to the shortcut Intent actionIntent = null; + String label = null; int iconId = R.drawable.widget_doc; switch (actionId) { case R.string.action_text: actionIntent = PublicIntentAPIUtils.createTextIntent(); iconId = R.drawable.widget_doc; + label = AnalyticsManager.LABEL_CREATE_TEXT; break; case R.string.action_speech2text: actionIntent = PublicIntentAPIUtils.speechToTextIntent(); iconId = R.drawable.widget_mic; + label = AnalyticsManager.LABEL_SPEECH_2_TEXT; break; case R.string.action_photo: actionIntent = PublicIntentAPIUtils.captureImageIntent(); iconId = R.drawable.widget_photo; + label = AnalyticsManager.LABEL_TAKE_PHOTO; break; default: break; @@ -89,6 +95,11 @@ private void createShortcut(AlfrescoAccount uploadAccount, Folder folder, Site s shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, iconId)); setResult(RESULT_OK, shortcutIntent); + + // Analytics + AnalyticsHelper.reportOperationEvent(this, AnalyticsManager.CATEGORY_WIDGET, AnalyticsManager.ACTION_CREATE, + label, 1, false); + finish(); } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/FolderShortcutActivity.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/FolderShortcutActivity.java index 0946b7c8..921a83e5 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/FolderShortcutActivity.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/FolderShortcutActivity.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco Mobile for Android. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ******************************************************************************/ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.widgets; import java.io.File; @@ -26,6 +26,8 @@ import org.alfresco.mobile.android.async.session.LoadSessionCallBack.LoadAccountCompletedEvent; import org.alfresco.mobile.android.async.session.RequestSessionEvent; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.content.Intent; import android.view.View; @@ -65,6 +67,11 @@ private void createShortcut(String shortcutName, Intent shortcutIntent) addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, R.drawable.widget_folder)); setResult(RESULT_OK, addIntent); + + // Analytics + AnalyticsHelper.reportOperationEvent(this, AnalyticsManager.CATEGORY_WIDGET, AnalyticsManager.ACTION_SHORTCUT, + AnalyticsManager.LABEL_FOLDERS, 1, false); + finish(); } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/ToolbarWidgetProvider.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/ToolbarWidgetProvider.java index 015ceb93..3333145c 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/ToolbarWidgetProvider.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/widgets/ToolbarWidgetProvider.java @@ -1,26 +1,28 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.widgets; import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.application.activity.MainActivity; import org.alfresco.mobile.android.application.intent.PublicIntentAPIUtils; import org.alfresco.mobile.android.application.managers.ActionUtils; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; @@ -96,18 +98,30 @@ private PendingIntent createAlfrescoIntent(Context context) private PendingIntent createSpeechTextEditorIntent(Context context) { + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_WIDGET, AnalyticsManager.ACTION_TOOLBAR, + AnalyticsManager.LABEL_SPEECH_2_TEXT, 1, false); + return PendingIntent.getActivity(context, 1, PublicIntentAPIUtils.speechToTextIntent(), PendingIntent.FLAG_UPDATE_CURRENT); } private PendingIntent createTextEditorIntent(Context context) { + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_WIDGET, AnalyticsManager.ACTION_TOOLBAR, + AnalyticsManager.LABEL_CREATE_TEXT, 1, false); + return PendingIntent.getActivity(context, 0, PublicIntentAPIUtils.createTextIntent(), PendingIntent.FLAG_UPDATE_CURRENT); } private PendingIntent createPhotoCaptureIntent(Context context) { + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_WIDGET, AnalyticsManager.ACTION_TOOLBAR, + AnalyticsManager.LABEL_TAKE_PHOTO, 1, false); + return PendingIntent.getActivity(context, 2, PublicIntentAPIUtils.captureImageIntent(), PendingIntent.FLAG_UPDATE_CURRENT); } diff --git a/alfresco-mobile-android/src/main/res/layout/fr_settings.xml b/alfresco-mobile-android/src/main/res/layout/fr_settings.xml index a480c1fb..4f6b40ac 100644 --- a/alfresco-mobile-android/src/main/res/layout/fr_settings.xml +++ b/alfresco-mobile-android/src/main/res/layout/fr_settings.xml @@ -144,37 +144,39 @@ android:layout_height="1dip" android:background="?android:attr/dividerVertical" /> - + @@ -185,40 +187,6 @@ android:layout_marginLeft="@dimen/d_8" android:layout_marginRight="@dimen/d_8" android:background="?android:attr/dividerVertical" /> - - - - - - - - - - - - - Select which tabs are available on your menu. Menu Your Alfresco Administrator has disabled this feature. + Feedback + Send Diagnostics + To help us improve Alfresco Mobile, we collect anonymous technical diagnostic data. Switch off if preferred. diff --git a/build.gradle b/build.gradle index 683d0652..14295a9a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + buildscript { repositories { jcenter() @@ -5,6 +23,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' + classpath 'com.google.gms:google-services:1.5.0' } } diff --git a/extensions/analytics/.gitignore b/extensions/analytics/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/extensions/analytics/.gitignore @@ -0,0 +1 @@ +/build diff --git a/extensions/analytics/build.gradle b/extensions/analytics/build.gradle new file mode 100644 index 00000000..1d93ca83 --- /dev/null +++ b/extensions/analytics/build.gradle @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'com.android.library' +apply plugin: 'com.google.gms.google-services' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + minSdkVersion 15 + targetSdkVersion 23 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile 'com.google.android.gms:play-services-analytics:8.3.0' + compile project(':platform:foundation') +} diff --git a/extensions/analytics/google-services.json b/extensions/analytics/google-services.json new file mode 100644 index 00000000..2a78c3c1 --- /dev/null +++ b/extensions/analytics/google-services.json @@ -0,0 +1,45 @@ +{ + "project_info": { + "project_id": "alfresco-mobile", + "project_number": "1053450300169", + "name": "Alfresco Mobile" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:1053450300169:android:4c82694870595779", + "client_id": "android:org.alfresco.mobile.android.application", + "client_type": 1, + "android_client_info": { + "package_name": "org.alfresco.mobile.android.application" + } + }, + "oauth_client": [], + "api_key": [], + "services": { + "analytics_service": { + "status": 2, + "analytics_property": { + "tracking_id": "UA-70658012-1" + } + }, + "cloud_messaging_service": { + "status": 1, + "apns_config": [] + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "google_signin_service": { + "status": 1 + }, + "ads_service": { + "status": 1 + } + } + } + ], + "client_info": [], + "ARTIFACT_VERSION": "1" +} \ No newline at end of file diff --git a/extensions/analytics/proguard-rules.pro b/extensions/analytics/proguard-rules.pro new file mode 100644 index 00000000..1977d222 --- /dev/null +++ b/extensions/analytics/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in W:/Tools/AndroidSDK/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/extensions/analytics/src/main/AndroidManifest.xml b/extensions/analytics/src/main/AndroidManifest.xml new file mode 100644 index 00000000..0850ba81 --- /dev/null +++ b/extensions/analytics/src/main/AndroidManifest.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extensions/analytics/src/main/java/org/alfresco/mobile/android/application/extension/analytics/GAnalyticsManagerImpl.java b/extensions/analytics/src/main/java/org/alfresco/mobile/android/application/extension/analytics/GAnalyticsManagerImpl.java new file mode 100644 index 00000000..66fbcd43 --- /dev/null +++ b/extensions/analytics/src/main/java/org/alfresco/mobile/android/application/extension/analytics/GAnalyticsManagerImpl.java @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2005-2015 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.alfresco.mobile.android.application.extension.analytics; + +import java.util.List; + +import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; + +import android.app.Activity; +import android.content.Context; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; +import android.util.SparseArray; + +import com.google.android.gms.analytics.GoogleAnalytics; +import com.google.android.gms.analytics.HitBuilders; +import com.google.android.gms.analytics.Tracker; + +public class GAnalyticsManagerImpl extends AnalyticsManager +{ + private Tracker mTracker; + + private GoogleAnalytics analytics; + + private boolean hasOptOut = false; + + private static final boolean DISPATCH_MANUALLY = true; + + protected SharedPreferences.Editor editor; + + protected Integer status = null; + + // /////////////////////////////////////////////////////////////////////////// + // CONSTRUCTOR + // /////////////////////////////////////////////////////////////////////////// + public static GAnalyticsManagerImpl getInstance(Context context) + { + synchronized (LOCK) + { + if (mInstance == null) + { + mInstance = new GAnalyticsManagerImpl(context); + } + + return (GAnalyticsManagerImpl) mInstance; + } + } + + protected GAnalyticsManagerImpl(Context context) + { + super(context); + analytics = GoogleAnalytics.getInstance(context); + mTracker = analytics.newTracker(context.getString(R.string.ga_trackId)); + } + + // /////////////////////////////////////////////////////////////////////////// + // O + // /////////////////////////////////////////////////////////////////////////// + public void optOut(Activity activity, AlfrescoAccount account) + { + opt(activity, STATUS_DISABLE, account); + status = getStatus(); + } + + public void optOutByConfig(Context context, AlfrescoAccount account) + { + editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); + editor.putInt(ANALYTICS_PREFIX + account.getId(), STATUS_BLOCKED).apply(); + status = getStatus(); + } + + public void optInByConfig(Context context, AlfrescoAccount account) + { + editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); + editor.putInt(ANALYTICS_PREFIX + account.getId(), STATUS_ENABLE).apply(); + status = getStatus(); + } + + public void optIn(Activity activity, AlfrescoAccount account) + { + opt(activity, STATUS_ENABLE, account); + status = getStatus(); + } + + public void cleanOptInfo(Context context, AlfrescoAccount account) + { + if (editor == null) + { + editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); + } + if (account != null) + { + editor.remove(ANALYTICS_PREFIX + account.getId()); + editor.apply(); + } + status = getStatus(); + } + + private void opt(Context context, int value, AlfrescoAccount account) + { + if (editor == null) + { + editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); + } + if (account != null) + { + editor.putInt(ANALYTICS_PREFIX + account.getId(), value); + editor.apply(); + } + } + + public boolean isEnable() + { + if (status == null) + { + getStatus(); + } + return status == STATUS_ENABLE; + } + + public boolean isEnable(AlfrescoAccount account) + { + SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); + int tempStatus = sharedPref.getInt(ANALYTICS_PREFIX + account.getId(), STATUS_ENABLE); + return tempStatus == STATUS_ENABLE; + } + + public boolean isBlocked() + { + if (status == null) + { + getStatus(); + } + return status == STATUS_BLOCKED; + } + + public int getStatus() + { + SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); + List accounts = AlfrescoAccountManager.retrieveAccounts(appContext); + int tempStatus = STATUS_ENABLE; + Integer resultStatus = null; + for (AlfrescoAccount account : accounts) + { + tempStatus = sharedPref.getInt(ANALYTICS_PREFIX + account.getId(), STATUS_ENABLE); + switch (tempStatus) + { + case STATUS_BLOCKED: + resultStatus = STATUS_BLOCKED; + break; + case STATUS_DISABLE: + resultStatus = STATUS_DISABLE; + break; + default: + continue; + } + } + status = resultStatus != null ? resultStatus : STATUS_ENABLE; + return status; + } + + // /////////////////////////////////////////////////////////////////////////// + // REPORT + // /////////////////////////////////////////////////////////////////////////// + public void startReport(Activity activity) + { + analytics.enableAutoActivityReports(activity.getApplication()); + mTracker.send(new HitBuilders.ScreenViewBuilder().setNewSession().build()); + } + + public void reportScreen(String name) + { + mTracker.setScreenName(name); + mTracker.send(new HitBuilders.ScreenViewBuilder().build()); + if (DISPATCH_MANUALLY) + { + analytics.dispatchLocalHits(); + } + } + + public void reportEvent(String category, String action, String label, int value) + { + mTracker.send(new HitBuilders.EventBuilder().setCategory(category).setAction(action).setLabel(label) + .setValue(value).build()); + if (DISPATCH_MANUALLY) + { + analytics.dispatchLocalHits(); + } + } + + public void reportEvent(String category, String action, String label, int value, int customMetricId, + Long customMetricValue) + { + mTracker.send(new HitBuilders.EventBuilder().setCategory(category).setAction(action).setLabel(label) + .setValue(value).setCustomMetric(customMetricId, customMetricValue).build()); + if (DISPATCH_MANUALLY) + { + analytics.dispatchLocalHits(); + } + } + + public void reportInfo(String label, SparseArray dimensions, SparseArray metrics) + { + reportEvent(CATEGORY_SESSION, ACTION_INFO, label, 1, dimensions, metrics); + } + + public void reportEvent(String category, String action, String label, int eventValue, + SparseArray dimensions, SparseArray metrics) + { + HitBuilders.EventBuilder builder = new HitBuilders.EventBuilder().setCategory(category).setAction(action) + .setLabel(label).setValue(eventValue); + + if (dimensions != null) + { + for (int i = 0; i < dimensions.size(); i++) + { + int dimensionId = dimensions.keyAt(i); + String value = dimensions.get(dimensionId); + builder.setCustomDimension(dimensionId, value); + } + } + + if (metrics != null) + { + for (int i = 0; i < metrics.size(); i++) + { + int dimensionId = metrics.keyAt(i); + Long value = metrics.get(dimensionId); + builder.setCustomMetric(dimensionId, value); + } + } + + mTracker.send(builder.build()); + if (DISPATCH_MANUALLY) + { + analytics.dispatchLocalHits(); + } + } + + public void reportError(boolean isFatal, String description) + { + mTracker.send(new HitBuilders.ExceptionBuilder().setFatal(isFatal).setDescription(description).build()); + if (DISPATCH_MANUALLY) + { + analytics.dispatchLocalHits(); + } + } +} diff --git a/extensions/analytics/src/main/res/values/config_extension.xml b/extensions/analytics/src/main/res/values/config_extension.xml new file mode 100644 index 00000000..fd32af93 --- /dev/null +++ b/extensions/analytics/src/main/res/values/config_extension.xml @@ -0,0 +1,26 @@ + + + + + + + true + org.alfresco.mobile.android.application.extension.analytics.GAnalyticsManagerImpl + + \ No newline at end of file diff --git a/extensions/analytics/src/main/res/values/keys.xml b/extensions/analytics/src/main/res/values/keys.xml new file mode 100644 index 00000000..2b5bac37 --- /dev/null +++ b/extensions/analytics/src/main/res/values/keys.xml @@ -0,0 +1,25 @@ + + + + + + + TODO + + \ No newline at end of file diff --git a/extensions/analytics/src/main/res/xml/global_tracker.xml b/extensions/analytics/src/main/res/xml/global_tracker.xml new file mode 100644 index 00000000..6e493deb --- /dev/null +++ b/extensions/analytics/src/main/res/xml/global_tracker.xml @@ -0,0 +1,42 @@ + + + + + + + TO REPLACE BY RIGHT ID + + + 100.0 + 5 + + + true + + + true + + + 1 + + + Main + + \ No newline at end of file diff --git a/extensions/hockeyapp/build.gradle b/extensions/hockeyapp/build.gradle index 92c0f5e7..eb66687d 100644 --- a/extensions/hockeyapp/build.gradle +++ b/extensions/hockeyapp/build.gradle @@ -1,8 +1,26 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 15 diff --git a/extensions/samsung/build.gradle b/extensions/samsung/build.gradle index 3cc75712..bf31067b 100644 --- a/extensions/samsung/build.gradle +++ b/extensions/samsung/build.gradle @@ -1,8 +1,26 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 15 diff --git a/extensions/samsung/src/main/java/org/alfresco/mobile/android/application/extension/samsung/pen/SNoteEditorActivity.java b/extensions/samsung/src/main/java/org/alfresco/mobile/android/application/extension/samsung/pen/SNoteEditorActivity.java index 761e4a89..390e258b 100644 --- a/extensions/samsung/src/main/java/org/alfresco/mobile/android/application/extension/samsung/pen/SNoteEditorActivity.java +++ b/extensions/samsung/src/main/java/org/alfresco/mobile/android/application/extension/samsung/pen/SNoteEditorActivity.java @@ -25,6 +25,8 @@ import org.alfresco.mobile.android.application.extension.samsung.R; import org.alfresco.mobile.android.application.extension.samsung.utils.SNoteUtils; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.BaseActionUtils; import org.alfresco.mobile.android.ui.activity.AlfrescoActivity; @@ -132,6 +134,8 @@ public class SNoteEditorActivity extends AlfrescoActivity @Override public void onCreate(Bundle savedInstanceState) { + AnalyticsHelper.reportScreen(this, AnalyticsManager.SCREEN_SAMSUNG_SNOTE_EDITOR); + super.onCreate(savedInstanceState); setContentView(R.layout.snote_editor); context = this; diff --git a/extensions/scansnap/build.gradle b/extensions/scansnap/build.gradle index 0dca89f8..8262b69a 100644 --- a/extensions/scansnap/build.gradle +++ b/extensions/scansnap/build.gradle @@ -1,8 +1,26 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 15 diff --git a/gradle.properties b/gradle.properties index e49e6311..67239bc6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,21 @@ +# +# Copyright (C) 2005-2016 Alfresco Software Limited. +# +# This file is part of Alfresco Mobile for Android. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + # Project-wide Gradle settings. # IDE (e.g. Android Studio) users: @@ -21,7 +39,7 @@ ## DEFAULT BUILD VARIANT #################################################################### # Current Version number of the application -VERSION_NAME=1.6 +VERSION_NAME=1.6.1 # Build Number of the application # Overrides by Continuous Integration System during build @@ -53,6 +71,9 @@ ACCOUNT_ID_DEBUG=com.alfresco.account.debug SYNC_ADAPTER_DEBUG=org.alfresco.mobile.android.provider.debug.sync FAVORITES_ADAPTER_DEBUG=org.alfresco.mobile.android.provider.debug.favorites +## Google Analytics Tracker key for Debug version +TRACKER_ID_DEBUG=TRACK_ID_DEBUG + #################################################################### ## MAVEN CONSTANTS #################################################################### @@ -85,4 +106,10 @@ OAUTH_SCOPE=public_api #################################################################### ## HockeyAPP key ## For more information : http://hockeyapp.net/features/ -HOCKEYAPP_KEY=HOCKEYAPP_KEY \ No newline at end of file +HOCKEYAPP_KEY=HOCKEYAPP_KEY + +#################################################################### +## GOOGLE ANALYTICS +#################################################################### +## Google Analytics Tracker key +TRACKER_ID=TRACKER_ID \ No newline at end of file diff --git a/mdm/mobileiron/build.gradle b/mdm/mobileiron/build.gradle index afef3292..6ae6141f 100644 --- a/mdm/mobileiron/build.gradle +++ b/mdm/mobileiron/build.gradle @@ -1,8 +1,26 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 15 diff --git a/platform/foundation/build.gradle b/platform/foundation/build.gradle index b2be52fd..f87b72a0 100644 --- a/platform/foundation/build.gradle +++ b/platform/foundation/build.gradle @@ -20,7 +20,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 15 diff --git a/platform/foundation/src/main/AndroidManifest.xml b/platform/foundation/src/main/AndroidManifest.xml index e0ff68c6..c3691525 100644 --- a/platform/foundation/src/main/AndroidManifest.xml +++ b/platform/foundation/src/main/AndroidManifest.xml @@ -1,3 +1,21 @@ + + @@ -10,4 +28,9 @@ + + + + + diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/accounts/AccountSchema.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/accounts/AccountSchema.java index c83e6c0c..0cc9d198 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/accounts/AccountSchema.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/accounts/AccountSchema.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.accounts; import java.util.List; @@ -194,7 +194,7 @@ public static void onUpgrade(Context context, SQLiteDatabase db, int oldVersion, // settings syncManager.setActivateSync(account.getId(), sharedPref.getBoolean(SYNCHRO_PREFIX + account.getId(), false)); - sharedPref.edit().remove(SYNCHRO_PREFIX + account.getId()).commit(); + sharedPref.edit().remove(SYNCHRO_PREFIX + account.getId()).apply(); } Log.i("Migration", "Account " + account.getDescription() + "[" + account.getId() diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/ConfigConstants.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/ConfigConstants.java index 3cbd4f1c..6523567c 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/ConfigConstants.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/ConfigConstants.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.alfresco.mobile.android.api.model.config; import java.util.ArrayList; @@ -259,6 +277,9 @@ public interface ConfigConstants String OUTPUT_VALUE = "outputValue"; + // FEATURE + String ENABLE_VALUE = "enable"; + // ///////////////////////////////////////////////// // VIEW ENUM // ///////////////////////////////////////////////// diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/ConfigTypeIds.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/ConfigTypeIds.java index ac97b549..a3541db2 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/ConfigTypeIds.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/ConfigTypeIds.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of the Alfresco Mobile SDK. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - ******************************************************************************/ + */ package org.alfresco.mobile.android.api.model.config; /** @@ -29,6 +29,8 @@ public enum ConfigTypeIds VIEWS("views"), FORMS("forms"), CREATION("creation"), + FEATURES( + "features"), VIEW_GROUPS("view-groups"), FIELDS("fields"), FIELD_GROUPS("field-groups"), diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/FeatureConfig.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/FeatureConfig.java new file mode 100644 index 00000000..2429fd8a --- /dev/null +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/FeatureConfig.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.alfresco.mobile.android.api.model.config; + +/** + * Base type for View Configuration. + * + * @author Jean Marie Pascal + */ +public interface FeatureConfig extends ItemConfig +{ + // /////////////////////////////////////////////////////////////////////////// + // DEFAULT FEATURE + // /////////////////////////////////////////////////////////////////////////// + String PREFIX_FEATURE = "org.alfresco.client.feature"; + + String FEATURE_ANALYTICS = PREFIX_FEATURE.concat(".analytics"); + + boolean isEnable(); +} diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/ConfigurationImpl.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/ConfigurationImpl.java index 0871dd20..ad3b9107 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/ConfigurationImpl.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/ConfigurationImpl.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of the Alfresco Mobile SDK. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - ******************************************************************************/ + */ package org.alfresco.mobile.android.api.model.config.impl; import java.io.File; @@ -33,6 +33,7 @@ import org.alfresco.mobile.android.api.model.config.ConfigScope; import org.alfresco.mobile.android.api.model.config.ConfigTypeIds; import org.alfresco.mobile.android.api.model.config.CreationConfig; +import org.alfresco.mobile.android.api.model.config.FeatureConfig; import org.alfresco.mobile.android.api.model.config.FormConfig; import org.alfresco.mobile.android.api.model.config.ProfileConfig; import org.alfresco.mobile.android.api.model.config.RepositoryConfig; @@ -55,6 +56,8 @@ public class ConfigurationImpl private CreationHelper creationHelper; + private FeatureHelper featureHelper; + private ViewHelper viewHelper; private FormHelper formHelper; @@ -97,8 +100,8 @@ public static ConfigurationImpl load(File sourceFile, String sourceAsString, Fil String filename = ConfigConstants.CONFIG_LOCALIZATION_FILENAME; if (!Locale.ENGLISH.getLanguage().equals(Locale.getDefault().getLanguage())) { - filename = String.format(ConfigConstants.CONFIG_LOCALIZATION_FILENAME_PATTERN, Locale.getDefault() - .getLanguage()); + filename = String.format(ConfigConstants.CONFIG_LOCALIZATION_FILENAME_PATTERN, + Locale.getDefault().getLanguage()); } File localizedFile = new File(configFolder, filename); StringHelper stringConfig = StringHelper.load(localizedFile); @@ -149,8 +152,8 @@ public static ConfigurationImpl parseJson(AlfrescoSession session, Map getFeatureConfig() + { + if (featureHelper == null) { return null; } + return featureHelper.getFeatures(); + } // /////////////////////////////////////////////////////////////////////////// // INTERNALS // /////////////////////////////////////////////////////////////////////////// diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/FeatureConfigImpl.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/FeatureConfigImpl.java new file mode 100644 index 00000000..1fd6e9d3 --- /dev/null +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/FeatureConfigImpl.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.alfresco.mobile.android.api.model.config.impl; + +import java.util.Map; + +import org.alfresco.mobile.android.api.model.config.ConfigConstants; +import org.alfresco.mobile.android.api.model.config.FeatureConfig; +import org.apache.chemistry.opencmis.commons.impl.JSONConverter; + +/** + * @author Jean Marie Pascal + */ +public class FeatureConfigImpl extends ItemConfigImpl implements FeatureConfig +{ + private boolean isEnable = false; + + // /////////////////////////////////////////////////////////////////////////// + // CONSTRUCTORS + // /////////////////////////////////////////////////////////////////////////// + FeatureConfigImpl() + { + super(); + } + + FeatureConfigImpl(String identifier, String iconIdentifier, String label, String description, String type, + Map properties) + { + super(identifier, iconIdentifier, label, description, type, null, properties); + } + + static FeatureConfigImpl parse(Map json, ConfigurationImpl configuration) + { + ItemConfigData data = new ItemConfigData(JSONConverter.getString(json, ConfigConstants.ID_VALUE), json, + configuration); + FeatureConfigImpl featureConfig = new FeatureConfigImpl(data.identifier, data.iconIdentifier, data.label, + data.description, data.type, data.properties); + if (json.containsKey(ConfigConstants.ENABLE_VALUE)) + { + featureConfig.isEnable = JSONConverter.getBoolean(json, ConfigConstants.ENABLE_VALUE); + } + return featureConfig; + } + + // /////////////////////////////////////////////////////////////////////////// + // METHODS + // /////////////////////////////////////////////////////////////////////////// + @Override + public boolean isEnable() + { + return isEnable; + } +} diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/FeatureHelper.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/FeatureHelper.java new file mode 100644 index 00000000..b60dc4ca --- /dev/null +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/FeatureHelper.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.alfresco.mobile.android.api.model.config.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.alfresco.mobile.android.api.model.config.FeatureConfig; +import org.apache.chemistry.opencmis.commons.impl.JSONConverter; + +/** + * @author Jean Marie Pascal + */ +public class FeatureHelper extends HelperConfig +{ + private ArrayList featureConfigs; + + // /////////////////////////////////////////////////////////////////////////// + // CONSTRUCTORS + // /////////////////////////////////////////////////////////////////////////// + FeatureHelper(ConfigurationImpl context, StringHelper localHelper) + { + super(context, localHelper); + } + + boolean addFeatureConfig(List features) + { + if (features == null || features.isEmpty()) { return false; } + featureConfigs = new ArrayList<>(features.size()); + FeatureConfig featureConfig = null; + for (Object featureData : features) + { + featureConfig = FeatureConfigImpl.parse(JSONConverter.getMap(featureData), getConfiguration()); + featureConfigs.add(featureConfig); + } + return true; + } + + // /////////////////////////////////////////////////////////////////////////// + // PUBLIC METHODS + // /////////////////////////////////////////////////////////////////////////// + public List getFeatures() + { + if (featureConfigs == null) { return new ArrayList<>(); } + return featureConfigs; + } +} diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/ConfigService.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/ConfigService.java index b10f8dc6..f0e47b9b 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/ConfigService.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/ConfigService.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of the Alfresco Mobile SDK. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - ******************************************************************************/ + */ package org.alfresco.mobile.android.api.services; import java.util.List; @@ -22,6 +22,7 @@ import org.alfresco.mobile.android.api.model.config.ConfigInfo; import org.alfresco.mobile.android.api.model.config.ConfigScope; import org.alfresco.mobile.android.api.model.config.CreationConfig; +import org.alfresco.mobile.android.api.model.config.FeatureConfig; import org.alfresco.mobile.android.api.model.config.FormConfig; import org.alfresco.mobile.android.api.model.config.ProfileConfig; import org.alfresco.mobile.android.api.model.config.RepositoryConfig; @@ -142,4 +143,11 @@ public interface ConfigService extends Service /** Returns the configuration for creation related features. */ CreationConfig getCreationConfig(ConfigScope scope); + + // /////////////////////////////////////////////////////////////////////////// + // FEATURE + boolean hasFeatureConfig(); + + /** Returns the configuration for creation related features. */ + List getFeatureConfig(); } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractConfigServiceImpl.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractConfigServiceImpl.java index d04ec9c7..0753e310 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractConfigServiceImpl.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractConfigServiceImpl.java @@ -36,6 +36,7 @@ import org.alfresco.mobile.android.api.model.config.ConfigScope; import org.alfresco.mobile.android.api.model.config.ConfigTypeIds; import org.alfresco.mobile.android.api.model.config.CreationConfig; +import org.alfresco.mobile.android.api.model.config.FeatureConfig; import org.alfresco.mobile.android.api.model.config.FormConfig; import org.alfresco.mobile.android.api.model.config.ProfileConfig; import org.alfresco.mobile.android.api.model.config.RepositoryConfig; @@ -380,4 +381,20 @@ public CreationConfig getCreationConfig() if (configuration == null) { return null; } return configuration.getCreationConfig(); } + + // /////////////////////////////////////////////////////////////////////////// + // FEATURE + // /////////////////////////////////////////////////////////////////////////// + @Override + public boolean hasFeatureConfig() + { + return configuration != null && configuration.getCreationConfig() != null; + } + + @Override + public List getFeatureConfig() + { + if (configuration == null) { return null; } + return configuration.getFeatureConfig(); + } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/LocalConfigServiceImpl.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/LocalConfigServiceImpl.java index e47727e3..29f7abb2 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/LocalConfigServiceImpl.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/LocalConfigServiceImpl.java @@ -28,6 +28,7 @@ import org.alfresco.mobile.android.api.model.config.ConfigScope; import org.alfresco.mobile.android.api.model.config.ConfigTypeIds; import org.alfresco.mobile.android.api.model.config.CreationConfig; +import org.alfresco.mobile.android.api.model.config.FeatureConfig; import org.alfresco.mobile.android.api.model.config.FormConfig; import org.alfresco.mobile.android.api.model.config.ProfileConfig; import org.alfresco.mobile.android.api.model.config.RepositoryConfig; @@ -91,8 +92,8 @@ private static ConfigurationImpl load(Context context) File configFile = null, localizedFile = null; // CONFIGURATION - long lastUpdate = context.getPackageManager().getPackageInfo( - context.getApplicationContext().getPackageName(), 0).lastUpdateTime; + long lastUpdate = context.getPackageManager() + .getPackageInfo(context.getApplicationContext().getPackageName(), 0).lastUpdateTime; File assetFolder = AlfrescoStorageManager.getInstance(context).getConfigurationFolder(); String configName = context.getString(R.string.config_asset_prefix) + "_" @@ -116,8 +117,8 @@ private static ConfigurationImpl load(Context context) try { org.alfresco.mobile.android.api.utils.IOUtils.copyFile( - context.getAssets().open( - context.getString(R.string.config_asset_messages_path) + localizedName), + context.getAssets() + .open(context.getString(R.string.config_asset_messages_path) + localizedName), localizedFile); } catch (IOException e) @@ -269,6 +270,22 @@ public CreationConfig getCreationConfig() return configuration.getCreationConfig(); } + // /////////////////////////////////////////////////////////////////////////// + // FEATURE + // /////////////////////////////////////////////////////////////////////////// + @Override + public boolean hasFeatureConfig() + { + return configuration != null && configuration.getFeatureConfig() != null; + } + + @Override + public List getFeatureConfig() + { + if (configuration == null) { return null; } + return configuration.getFeatureConfig(); + } + // /////////////////////////////////////////////////////////////////////////// // SESSION // /////////////////////////////////////////////////////////////////////////// diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/account/CreateAccountOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/account/CreateAccountOperation.java index bae6763c..2dbce694 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/account/CreateAccountOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/account/CreateAccountOperation.java @@ -36,6 +36,8 @@ import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoSessionSettings; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.favorite.FavoritesManager; import org.alfresco.mobile.android.sync.SyncContentManager; @@ -146,8 +148,8 @@ private AlfrescoAccount createAccount() } // Retrieve Name/Description - String accountLabel = (description != null && !description.isEmpty()) ? description : context - .getString(R.string.account_default_onpremise); + String accountLabel = (description != null && !description.isEmpty()) ? description + : context.getString(R.string.account_default_onpremise); // Retrieve Paid Info isPaidAccount = isPaid(type, session); @@ -156,6 +158,8 @@ private AlfrescoAccount createAccount() acc = AlfrescoAccountManager.getInstance(context).create(accountLabel, session.getBaseUrl(), username, password, session.getRepositoryInfo().getIdentifier(), type, null, null, null, Boolean.toString(isPaidAccount)); + + AnalyticsHelper.checkServerConfiguration(context, session, acc); } else { @@ -173,9 +177,8 @@ private AlfrescoAccount createAccount() // Create Account acc = AlfrescoAccountManager.getInstance(context).create(context.getString(R.string.account_default_cloud), - session.getBaseUrl(), userPerson.getIdentifier(), null, - session.getRepositoryInfo().getIdentifier(), type, null, - ((CloudSession) session).getOAuthData().getAccessToken(), + session.getBaseUrl(), userPerson.getIdentifier(), null, session.getRepositoryInfo().getIdentifier(), + type, null, ((CloudSession) session).getOAuthData().getAccessToken(), ((CloudSession) session).getOAuthData().getRefreshToken(), Boolean.toString(isPaidAccount)); } @@ -255,6 +258,13 @@ public Person getCloudUser() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, + AnalyticsManager.CATEGORY_ACCOUNT, AnalyticsManager.ACTION_CREATE, session instanceof CloudSession + ? AnalyticsManager.SERVER_TYPE_CLOUD : AnalyticsManager.SERVER_TYPE_ONPREMISE, + 1, result.hasException()); + if (result.getData() != null) { SessionManager.getInstance(context).saveSession(result.getData(), session); diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/comment/CreateCommentOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/comment/CreateCommentOperation.java index ee947f90..ff4128bf 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/comment/CreateCommentOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/comment/CreateCommentOperation.java @@ -1,29 +1,32 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.comment; import org.alfresco.mobile.android.api.model.Comment; +import org.alfresco.mobile.android.api.model.Document; import org.alfresco.mobile.android.async.LoaderResult; import org.alfresco.mobile.android.async.OperationAction; import org.alfresco.mobile.android.async.OperationsDispatcher; import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.node.NodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.util.Log; @@ -72,6 +75,13 @@ protected LoaderResult doInBackground() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_COMMENT, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + result.hasException()); + EventBusManager.getInstance().post(new CreateCommentEvent(getRequestId(), result)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java index 92ab2ed5..60d64a23 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.create; import java.io.File; @@ -29,6 +29,8 @@ import org.alfresco.mobile.android.async.node.UpNodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; import org.alfresco.mobile.android.platform.exception.AlfrescoAppException; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.IOUtils; import org.alfresco.mobile.android.platform.security.DataProtectionManager; import org.alfresco.mobile.android.platform.security.EncryptionUtils; @@ -183,6 +185,12 @@ private boolean doesExist(String documentPath) protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_CREATE, doc != null ? doc.getContentStreamMimeType() : null, 1, + result.hasException(), AnalyticsManager.INDEX_SYNCED_SIZE, doc.getContentStreamLength()); + EventBusManager.getInstance().post(new CreateDocumentEvent(getRequestId(), result, parentFolder)); if (((CreateDocumentRequest) request).isCreation) { diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateFolderOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateFolderOperation.java index 444c14e8..1b8dcb45 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateFolderOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateFolderOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.create; import java.io.Serializable; @@ -27,6 +27,8 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.node.NodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.apache.chemistry.opencmis.commons.PropertyIds; import org.apache.chemistry.opencmis.commons.enums.BaseTypeId; @@ -71,8 +73,8 @@ protected LoaderResult doInBackground() try { - folder = session.getServiceRegistry().getDocumentFolderService() - .createFolder(parentFolder, folderName, properties); + folder = session.getServiceRegistry().getDocumentFolderService().createFolder(parentFolder, folderName, + properties); } catch (Exception e) { @@ -87,6 +89,7 @@ protected LoaderResult doInBackground() { Log.w(TAG, Log.getStackTraceString(e)); } + return new LoaderResult(); } @@ -104,6 +107,10 @@ public Folder getParentFolder() @Override protected void onPostExecute(LoaderResult result) { + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_CREATE, AnalyticsManager.TYPE_FOLDER, 1, result.hasException()); + super.onPostExecute(result); EventBusManager.getInstance().post(new CreateFolderEvent(getRequestId(), result, parentFolder)); } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/delete/DeleteNodeOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/delete/DeleteNodeOperation.java index e284fe69..aacf931d 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/delete/DeleteNodeOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/delete/DeleteNodeOperation.java @@ -1,22 +1,23 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.delete; +import org.alfresco.mobile.android.api.model.Document; import org.alfresco.mobile.android.async.LoaderResult; import org.alfresco.mobile.android.async.OperationAction; import org.alfresco.mobile.android.async.OperationsDispatcher; @@ -24,6 +25,8 @@ import org.alfresco.mobile.android.async.node.NodeOperation; import org.alfresco.mobile.android.async.node.sync.SyncNodeRequest; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.sync.SyncContentManager; import android.util.Log; @@ -75,6 +78,13 @@ public LoaderResult doInBackground() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_DELETE, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + result.hasException()); + EventBusManager.getInstance().post(new DeleteNodeEvent(getRequestId(), node)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/favorite/FavoriteNodeOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/favorite/FavoriteNodeOperation.java index 3202296f..6f75a838 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/favorite/FavoriteNodeOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/favorite/FavoriteNodeOperation.java @@ -1,24 +1,25 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.favorite; import java.util.GregorianCalendar; +import org.alfresco.mobile.android.api.model.Document; import org.alfresco.mobile.android.async.LoaderResult; import org.alfresco.mobile.android.async.OperationAction; import org.alfresco.mobile.android.async.OperationStatus; @@ -27,6 +28,8 @@ import org.alfresco.mobile.android.async.node.NodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.favorite.FavoritesManager; import org.alfresco.mobile.android.platform.favorite.FavoritesProvider; import org.alfresco.mobile.android.platform.favorite.FavoritesSchema; @@ -137,8 +140,8 @@ private void manageReferentialByRemoving(Cursor cursorId) cursorId.moveToNext(); for (int i = 0; i < cursorId.getCount(); i++) { - context.getContentResolver().delete( - FavoritesManager.getUri(cursorId.getLong(FavoritesSchema.COLUMN_ID_ID)), null, null); + context.getContentResolver() + .delete(FavoritesManager.getUri(cursorId.getLong(FavoritesSchema.COLUMN_ID_ID)), null, null); cursorId.moveToNext(); } } @@ -151,19 +154,18 @@ private void manageReferentialByAdding(Cursor cursorId) { // First time creation // Update local sync referential. - context.getContentResolver().insert( - FavoritesProvider.CONTENT_URI, - FavoritesManager.createFavoriteContentValues(context, AlfrescoAccountManager.getInstance(context) - .retrieveAccount(accountId), parentFolderIdentifier, node, new GregorianCalendar() - .getTimeInMillis())); + context.getContentResolver().insert(FavoritesProvider.CONTENT_URI, + FavoritesManager.createFavoriteContentValues(context, + AlfrescoAccountManager.getInstance(context).retrieveAccount(accountId), + parentFolderIdentifier, node, new GregorianCalendar().getTimeInMillis())); } else if (cursorId.getCount() == 1 && cursorId.moveToFirst()) { ContentValues cValues = new ContentValues(); cValues.put(FavoritesSchema.COLUMN_STATUS, OperationStatus.STATUS_SUCCESSFUL); cValues.put(FavoritesSchema.COLUMN_IS_FAVORITE, FavoritesProvider.FLAG_FAVORITE); - context.getContentResolver().update( - FavoritesManager.getUri(cursorId.getLong(FavoritesSchema.COLUMN_ID_ID)), cValues, null, null); + context.getContentResolver().update(FavoritesManager.getUri(cursorId.getLong(FavoritesSchema.COLUMN_ID_ID)), + cValues, null, null); } } @@ -174,6 +176,13 @@ else if (cursorId.getCount() == 1 && cursorId.moveToFirst()) protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + isFavorite ? AnalyticsManager.ACTION_FAVORITE : AnalyticsManager.ACTION_UNFAVORITE, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + result.hasException()); + EventBusManager.getInstance().post(new FavoriteNodeEvent(getRequestId(), result, node)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/like/LikeNodeOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/like/LikeNodeOperation.java index 1dcd5660..8cd86fc6 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/like/LikeNodeOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/like/LikeNodeOperation.java @@ -1,28 +1,31 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.like; +import org.alfresco.mobile.android.api.model.Document; import org.alfresco.mobile.android.async.LoaderResult; import org.alfresco.mobile.android.async.OperationAction; import org.alfresco.mobile.android.async.OperationsDispatcher; import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.node.NodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.util.Log; @@ -114,6 +117,13 @@ else if (!performLike && performLike != isLiked) protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + isLiked ? AnalyticsManager.ACTION_LIKE : AnalyticsManager.ACTION_UNLIKE, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + result.hasException()); + EventBusManager.getInstance().post(new LikeNodeEvent(getRequestId(), readOnly, result)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/search/SearchOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/search/SearchOperation.java index c2c2fe5b..f87087e4 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/search/SearchOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/search/SearchOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.search; import org.alfresco.mobile.android.api.model.KeywordSearchOptions; @@ -102,6 +102,7 @@ else if (statement != null) protected void onPostExecute(LoaderResult> result) { super.onPostExecute(result); + EventBusManager.getInstance().post(new SearchEvent(getRequestId(), result)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java index 7d8ed78f..4c15f2d8 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java @@ -1,25 +1,26 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.sync; import java.util.GregorianCalendar; import org.alfresco.mobile.android.api.constants.ContentModel; +import org.alfresco.mobile.android.api.model.Document; import org.alfresco.mobile.android.api.model.Folder; import org.alfresco.mobile.android.api.utils.NodeRefUtils; import org.alfresco.mobile.android.async.LoaderResult; @@ -29,6 +30,8 @@ import org.alfresco.mobile.android.async.node.NodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.provider.CursorUtils; import org.alfresco.mobile.android.sync.SyncContentManager; import org.alfresco.mobile.android.sync.SyncContentProvider; @@ -330,6 +333,13 @@ private void prepareChildrenFolderDelete(String nodeId) protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + isSynced ? AnalyticsManager.ACTION_SYNC : AnalyticsManager.ACTION_UNSYNC, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + result.hasException()); + EventBusManager.getInstance().post(new SyncNodeEvent(getRequestId(), result, node)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateContentOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateContentOperation.java index fdb1c0c5..0db332d5 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateContentOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateContentOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.update; import org.alfresco.cmis.client.AlfrescoDocument; @@ -27,6 +27,8 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.node.UpNodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.platform.security.DataProtectionManager; import org.alfresco.mobile.android.platform.security.EncryptionUtils; @@ -160,6 +162,12 @@ public Document getDocument() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_UPDATE, ((Document) node).getContentStreamMimeType(), 1, result.hasException(), + AnalyticsManager.INDEX_FILE_SIZE, ((Document) node).getContentStreamLength()); + EventBusManager.getInstance().post(new UpdateContentEvent(getRequestId(), result, node, parentFolder)); } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateNodeOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateNodeOperation.java index 69669453..fe8ce6fe 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateNodeOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateNodeOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.update; import java.io.Serializable; @@ -31,6 +31,8 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.node.NodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; public class UpdateNodeOperation extends NodeOperation { @@ -87,8 +89,8 @@ protected LoaderResult doInBackground() if (contentFile != null) { - resultNode = session.getServiceRegistry().getDocumentFolderService() - .updateContent((Document) node, contentFile); + resultNode = session.getServiceRegistry().getDocumentFolderService().updateContent((Document) node, + contentFile); } } catch (Exception e) @@ -108,6 +110,13 @@ protected LoaderResult doInBackground() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_EDIT, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + result.hasException()); + EventBusManager.getInstance().post(new UpdateNodeEvent(getRequestId(), result, node, parentFolder)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/LoadSessionCallBack.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/LoadSessionCallBack.java index e6629983..6ce937c7 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/LoadSessionCallBack.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/LoadSessionCallBack.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.session; import org.alfresco.mobile.android.api.session.AlfrescoSession; @@ -26,6 +26,7 @@ import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; import org.alfresco.mobile.android.platform.exception.AlfrescoExceptionHelper; import org.alfresco.mobile.android.platform.exception.CloudExceptionUtils; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; import android.content.Context; import android.util.Log; @@ -50,16 +51,17 @@ public LoadSessionCallBack(Context context) @Override public void onPreExecute(Operation task) { - EventBusManager.getInstance().post( - new LoadAccountStartedEvent(task.getRequestId(), ((LoadSessionOperation) task).getAccount())); + EventBusManager.getInstance() + .post(new LoadAccountStartedEvent(task.getRequestId(), ((LoadSessionOperation) task).getAccount())); } @Override - public void onPostExecute(Operation task, AlfrescoSession results) + public void onPostExecute(Operation task, AlfrescoSession result) { - saveData(task, results); - EventBusManager.getInstance().post( - new LoadAccountCompletedEvent(task.getRequestId(), ((LoadSessionOperation) task).getAccount())); + saveData(task, result); + + EventBusManager.getInstance() + .post(new LoadAccountCompletedEvent(task.getRequestId(), ((LoadSessionOperation) task).getAccount())); } @Override @@ -83,16 +85,15 @@ public void onError(Operation task, Exception e) else { // Cloud Account is not active - EventBusManager.getInstance().post( - new LoadInactiveAccountEvent(task.getRequestId(), ((LoadSessionOperation) task) - .getAccount())); + EventBusManager.getInstance().post(new LoadInactiveAccountEvent(task.getRequestId(), + ((LoadSessionOperation) task).getAccount())); } break; case AlfrescoAccount.TYPE_ALFRESCO_TEST_BASIC: case AlfrescoAccount.TYPE_ALFRESCO_CMIS: - EventBusManager.getInstance().post( - new LoadAccountErrorEvent(task.getRequestId(), ((LoadSessionOperation) task).getAccount(), e, - AlfrescoExceptionHelper.getMessageId(context, e))); + EventBusManager.getInstance() + .post(new LoadAccountErrorEvent(task.getRequestId(), ((LoadSessionOperation) task).getAccount(), + e, AlfrescoExceptionHelper.getMessageId(context, e))); break; default: break; @@ -110,6 +111,8 @@ private void saveData(Operation task, AlfrescoSession session) SessionManager.getInstance(context).saveSession(acc, session); } + AnalyticsHelper.checkServerConfiguration(context, session, acc); + // For cloud session, try to save the latest version of oauthdata if (loadingTask.getOAuthData() == null) return; diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/oauth/AccountOAuthHelper.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/oauth/AccountOAuthHelper.java index 2aafdebd..f02202d7 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/oauth/AccountOAuthHelper.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/oauth/AccountOAuthHelper.java @@ -116,7 +116,7 @@ public static void saveLastCloudLoadingTime(Context context) SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); Editor editor = sharedPref.edit(); editor.putLong(KEY_CLOUD_LOADING_TIME, new Date().getTime()); - editor.commit(); + editor.apply(); } /** @@ -130,7 +130,7 @@ public static void removeLastCloudLoadingTime(Context context) SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); Editor editor = sharedPref.edit(); editor.remove(KEY_CLOUD_LOADING_TIME); - editor.commit(); + editor.apply(); } /** diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/SiteFavoriteOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/SiteFavoriteOperation.java index 2caaab1d..f14245eb 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/SiteFavoriteOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/SiteFavoriteOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.site; import org.alfresco.mobile.android.api.model.Site; @@ -24,6 +24,8 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.impl.BaseOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.util.Log; @@ -83,6 +85,13 @@ protected LoaderResult doInBackground() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_SITE_MANAGEMENT, + AnalyticsManager.ACTION_FAVORITE, + site.isFavorite() ? AnalyticsManager.LABEL_ENABLE : AnalyticsManager.LABEL_DISABLE, 1, + result.hasException()); + EventBusManager.getInstance().post(new SiteFavoriteEvent(getRequestId(), result, site)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/member/CancelPendingMembershipOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/member/CancelPendingMembershipOperation.java index 11511ef2..a202e24d 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/member/CancelPendingMembershipOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/member/CancelPendingMembershipOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.site.member; import org.alfresco.mobile.android.api.model.Site; @@ -24,6 +24,8 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.impl.BaseOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.util.Log; @@ -76,6 +78,11 @@ protected LoaderResult doInBackground() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_SITE_MANAGEMENT, + AnalyticsManager.ACTION_MEMBERSHIP, AnalyticsManager.LABEL_CANCEL, 1, result.hasException()); + EventBusManager.getInstance().post(new CancelPendingMembershipEvent(getRequestId(), result, site)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/member/SiteMembershipOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/member/SiteMembershipOperation.java index efa39528..fc1052a6 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/member/SiteMembershipOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/site/member/SiteMembershipOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.site.member; import org.alfresco.mobile.android.api.model.Site; @@ -24,6 +24,8 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.impl.BaseOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.util.Log; @@ -88,6 +90,12 @@ else if (site != null && !isJoining) protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_SITE_MANAGEMENT, + AnalyticsManager.ACTION_MEMBERSHIP, + isJoining ? AnalyticsManager.LABEL_JOIN : AnalyticsManager.LABEL_LEAVE, 1, result.hasException()); + EventBusManager.getInstance().post(new SiteMembershipEvent(getRequestId(), result, site, isJoining)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/process/start/StartProcessOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/process/start/StartProcessOperation.java index 4dddc679..8b63435c 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/process/start/StartProcessOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/process/start/StartProcessOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.workflow.process.start; import java.util.ArrayList; @@ -30,6 +30,8 @@ import org.alfresco.mobile.android.async.impl.BaseOperation; import org.alfresco.mobile.android.async.utils.NodePlaceHolder; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.util.Log; @@ -117,6 +119,11 @@ else if (node instanceof Document) protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_BPM, AnalyticsManager.ACTION_CREATE, + process.getDefinitionIdentifier(), 1, result.hasException()); + EventBusManager.getInstance().post(new StartProcessEvent(getRequestId(), result)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/task/complete/CompleteTaskOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/task/complete/CompleteTaskOperation.java index ffc5320f..6f3f5d1e 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/task/complete/CompleteTaskOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/task/complete/CompleteTaskOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.workflow.task.complete; import org.alfresco.mobile.android.api.constants.WorkflowModel; @@ -26,6 +26,8 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.workflow.task.TaskOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.util.Log; @@ -91,6 +93,12 @@ protected LoaderResult doInBackground() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_BPM, + AnalyticsManager.ACTION_COMPLETE_TASK, updatedTask != null ? updatedTask.getKey() : null, 1, + result.hasException()); + EventBusManager.getInstance().post(new CompleteTaskEvent(getRequestId(), result)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/task/delegate/ReassignTaskOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/task/delegate/ReassignTaskOperation.java index 64e75871..c7438a5b 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/task/delegate/ReassignTaskOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/workflow/task/delegate/ReassignTaskOperation.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.workflow.task.delegate; import org.alfresco.mobile.android.api.model.Person; @@ -25,6 +25,8 @@ import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.workflow.task.TaskOperation; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import android.util.Log; @@ -94,6 +96,10 @@ protected LoaderResult doInBackground() protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); + + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_BPM, AnalyticsManager.ACTION_REASSIGN, + updatedTask != null ? updatedTask.getKey() : null, 1, result.hasException()); + EventBusManager.getInstance().post(new ReassignTaskEvent(getRequestId(), result)); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/accounts/AccountsPreferences.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/accounts/AccountsPreferences.java index adc35edb..c04f8d5e 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/accounts/AccountsPreferences.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/accounts/AccountsPreferences.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.platform.accounts; import android.content.Context; @@ -66,7 +66,7 @@ public static void setDefaultAccount(Context context, long id) { SharedPreferences.Editor editor = settings.edit(); editor.putLong(AccountsPreferences.ACCOUNT_DEFAULT, id); - editor.commit(); + editor.apply(); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/accounts/AlfrescoAccountManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/accounts/AlfrescoAccountManager.java index 00a35e01..61fe845a 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/accounts/AlfrescoAccountManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/accounts/AlfrescoAccountManager.java @@ -128,7 +128,7 @@ public AlfrescoAccount getDefaultAccount() public static List retrieveAccounts(Context context) { - List accounts = null; + List accounts = new ArrayList<>(); try { AccountManager mAccountManager = AccountManager.get(context); diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java new file mode 100644 index 00000000..25b7f3dd --- /dev/null +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.alfresco.mobile.android.platform.extensions; + +import java.util.List; + +import org.alfresco.mobile.android.api.constants.ContentModel; +import org.alfresco.mobile.android.api.model.config.FeatureConfig; +import org.alfresco.mobile.android.api.services.ConfigService; +import org.alfresco.mobile.android.api.services.impl.AlfrescoServiceRegistry; +import org.alfresco.mobile.android.api.session.AlfrescoSession; +import org.alfresco.mobile.android.api.session.CloudSession; +import org.alfresco.mobile.android.api.session.RepositorySession; +import org.alfresco.mobile.android.platform.SessionManager; +import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; +import org.alfresco.mobile.android.platform.provider.CursorUtils; +import org.alfresco.mobile.android.sync.SyncContentProvider; +import org.alfresco.mobile.android.sync.SyncContentSchema; +import org.alfresco.mobile.android.sync.operations.SyncContentStatus; + +import android.content.Context; +import android.database.Cursor; +import android.util.Log; +import android.util.SparseArray; + +/** + * Created by jpascal on 29/01/2016. + */ +public class AnalyticsHelper +{ + + protected static SparseArray retrieveSessionInfo(AlfrescoSession repoSession) + { + SparseArray customDimensions = new SparseArray<>(); + + if (repoSession != null) + { + if (repoSession instanceof CloudSession) + { + customDimensions.append(AnalyticsManager.INDEX_SERVER_VERSION, AnalyticsManager.SERVER_TYPE_CLOUD); + customDimensions.append(AnalyticsManager.INDEX_SERVER_TYPE, AnalyticsManager.SERVER_TYPE_CLOUD); + customDimensions.append(AnalyticsManager.INDEX_SERVER_EDITION, + ((CloudSession) repoSession).getNetwork().getSubscriptionLevel()); + } + else + { + customDimensions.append(AnalyticsManager.INDEX_SERVER_VERSION, + repoSession.getRepositoryInfo().getVersion()); + customDimensions.append(AnalyticsManager.INDEX_SERVER_TYPE, AnalyticsManager.SERVER_TYPE_ONPREMISE); + customDimensions.append(AnalyticsManager.INDEX_SERVER_EDITION, + repoSession.getRepositoryInfo().getEdition()); + } + } + return customDimensions; + } + + protected static SparseArray retrieveSyncInfo(Context context, AlfrescoAccount account) + { + SparseArray customMetrics = new SparseArray<>(); + + Integer syncedFile = getNumberOfSyncedFiles(context, account); + Integer syncedFolder = getNumberOfSyncedFolder(context, account); + + // Via Custom Metric + customMetrics.append(AnalyticsManager.INDEX_SYNC_CREATION, 1L); + customMetrics.append(AnalyticsManager.INDEX_SYNCED_FOLDERS, syncedFolder.longValue()); + customMetrics.append(AnalyticsManager.INDEX_SYNCED_FILES, syncedFile.longValue()); + customMetrics.append(AnalyticsManager.INDEX_SYNCED_SIZE, getSizeOfSyncedFiles(context, account)); + + return customMetrics; + } + + public static void analyzeSync(Context context, AlfrescoAccount account) + { + if (AnalyticsManager.getInstance(context) == null + || !AnalyticsManager.getInstance(context).isEnable()) { return; } + try + { + SparseArray customMetrics = new SparseArray<>(); + SparseArray customDimensions = new SparseArray<>(); + SparseArray customInfo = retrieveSessionInfo( + SessionManager.getInstance(context).getSession(account.getId())); + for (int i = 0; i < customInfo.size(); i++) + { + int key = customInfo.keyAt(i); + customDimensions.append(key, customInfo.get(key)); + } + + Integer syncedFile = getNumberOfSyncedFiles(context, account); + Integer syncedFolder = getNumberOfSyncedFolder(context, account); + customMetrics.append(AnalyticsManager.INDEX_SYNCED_SIZE, getSizeOfSyncedFiles(context, account)); + + // Via EVENT + AnalyticsManager.getInstance(context).reportEvent(AnalyticsManager.CATEGORY_SYNC, + AnalyticsManager.ACTION_RUN, AnalyticsManager.SYNCED_FILES, syncedFile, customDimensions, + customMetrics); + AnalyticsManager.getInstance(context).reportEvent(AnalyticsManager.CATEGORY_SYNC, + AnalyticsManager.ACTION_RUN, AnalyticsManager.SYNCED_FOLDERS, syncedFolder, customDimensions, null); + + } + catch (Exception e) + { + Log.d("Analytics Global", Log.getStackTraceString(e)); + } + } + + protected static Integer getNumberOfSyncedFolder(Context context, AlfrescoAccount account) + { + if (account == null) { return 0; } + Integer syncedFolders = 0; + try + { + Cursor syncedCursor = context.getContentResolver().query(SyncContentProvider.CONTENT_URI, + SyncContentSchema.COLUMN_IDS, + SyncContentProvider.getAccountFilter(account) + " AND " + SyncContentSchema.COLUMN_MIMETYPE + + " LIKE '" + ContentModel.TYPE_FOLDER + "' AND " + SyncContentSchema.COLUMN_STATUS + + " NOT IN ( " + SyncContentStatus.STATUS_HIDDEN + ")", + null, null); + syncedFolders = syncedCursor != null ? syncedCursor.getCount() : 0; + CursorUtils.closeCursor(syncedCursor); + Log.d("Analytics Folders", syncedFolders + ""); + } + catch (Exception e) + { + Log.d("Analytics Folders", Log.getStackTraceString(e)); + } + return syncedFolders; + } + + protected static Integer getNumberOfSyncedFiles(Context context, AlfrescoAccount account) + { + if (account == null) { return 0; } + + Integer syncedFiles = 0; + try + { + Cursor syncedCursor = context.getContentResolver().query(SyncContentProvider.CONTENT_URI, + SyncContentSchema.COLUMN_IDS, + SyncContentProvider.getAccountFilter(account) + " AND " + SyncContentSchema.COLUMN_MIMETYPE + + " NOT LIKE '" + ContentModel.TYPE_FOLDER + "' AND " + SyncContentSchema.COLUMN_STATUS + + " NOT IN ( " + SyncContentStatus.STATUS_HIDDEN + ")", + null, null); + syncedFiles = syncedCursor != null ? syncedCursor.getCount() : 0; + CursorUtils.closeCursor(syncedCursor); + Log.d("Analytics Files", syncedFiles + ""); + } + catch (Exception e) + { + Log.d("Analytics Files", Log.getStackTraceString(e)); + } + return syncedFiles; + } + + protected static Long getSizeOfSyncedFiles(Context context, AlfrescoAccount account) + { + if (account == null) { return 0L; } + + Long syncedSize = 0L; + String[] columns = new String[] { SyncContentSchema.COLUMN_TOTAL_SIZE_BYTES }; + try + { + Cursor syncedCursor = context.getContentResolver().query(SyncContentProvider.CONTENT_URI, columns, + SyncContentProvider.getAccountFilter(account) + " AND " + SyncContentSchema.COLUMN_MIMETYPE + + " NOT LIKE '" + ContentModel.TYPE_FOLDER + "' AND " + SyncContentSchema.COLUMN_STATUS + + " NOT IN ( " + SyncContentStatus.STATUS_HIDDEN + ")", + null, null); + if (syncedCursor != null) + { + while (syncedCursor.moveToNext()) + { + syncedSize = syncedSize + syncedCursor.getLong(0); + } + } + CursorUtils.closeCursor(syncedCursor); + Log.d("Analytics Size", syncedSize + ""); + } + catch (Exception e) + { + Log.d("Analytics Size Files", Log.getStackTraceString(e)); + } + return syncedSize; + } + + protected static Long getDownloadedFilesCount(Context context, AlfrescoAccount account) + { + int size = 0; + try + { + size = AlfrescoStorageManager.getInstance(context).getDownloadFolder(account).list().length; + } + catch (Exception e) + { + Log.d("Analytics DL Files", Log.getStackTraceString(e)); + } + return (long) size; + } + + public static void reportScreen(Context context, String screenName) + { + if (AnalyticsManager.getInstance(context) == null + || !AnalyticsManager.getInstance(context).isEnable()) { return; } + AnalyticsManager.getInstance(context).reportScreen(screenName); + } + + public static void reportOperationEvent(Context context, String category, String action, String label, int value, + boolean hasException) + { + if (AnalyticsManager.getInstance(context) == null + || !AnalyticsManager.getInstance(context).isEnable()) { return; } + AnalyticsManager.getInstance(context).reportEvent(category, action, + (hasException) ? AnalyticsManager.LABEL_FAILED : label, value); + } + + public static void reportOperationEvent(Context context, String category, String action, String label, int value, + boolean hasException, int customMetricId, Long customMetricValue) + { + if (AnalyticsManager.getInstance(context) == null + || !AnalyticsManager.getInstance(context).isEnable()) { return; } + AnalyticsManager.getInstance(context).reportEvent(category, action, + (hasException) ? AnalyticsManager.LABEL_FAILED : label, value, customMetricId, customMetricValue); + } + + public static void checkServerConfiguration(Context context, AlfrescoSession session, AlfrescoAccount acc) + { + try + { + // Analytics + if (session instanceof RepositorySession && AnalyticsManager.getInstance(context) != null + && session.getServiceRegistry() instanceof AlfrescoServiceRegistry) + { + ConfigService configService = ((AlfrescoServiceRegistry) session.getServiceRegistry()) + .getConfigService(); + if (configService != null) + { + List configs = configService.getFeatureConfig(); + for (FeatureConfig feature : configs) + { + if (FeatureConfig.FEATURE_ANALYTICS.equals(feature.getType())) + { + if (feature.isEnable() && !AnalyticsManager.getInstance(context).isEnable(acc)) + { + AnalyticsManager.getInstance(context).optInByConfig(context, acc); + } + else if (!feature.isEnable() && AnalyticsManager.getInstance(context).isEnable(acc)) + { + if (AnalyticsManager.getInstance(context).isEnable()) + { + AnalyticsManager.getInstance(context).reportEvent( + AnalyticsManager.CATEGORY_SETTINGS, AnalyticsManager.ACTION_ANALYTICS, + AnalyticsManager.LABEL_DISABLE_BY_CONFIG, 1); + } + AnalyticsManager.getInstance(context).optOutByConfig(context, acc); + } + } + } + } + } + } + catch (Exception e) + { + // DO Nothing + } + } + +} diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java new file mode 100644 index 00000000..9df955b7 --- /dev/null +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java @@ -0,0 +1,531 @@ +/* + * Copyright (C) 2005-2015 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.alfresco.mobile.android.platform.extensions; + +import org.alfresco.mobile.android.platform.Manager; +import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; + +import android.app.Activity; +import android.content.Context; +import android.util.SparseArray; + +public abstract class AnalyticsManager extends Manager +{ + + /////////////////////////////////////////////////////////// + // EVENTS : CATEGORIES + /////////////////////////////////////////////////////////// + public static final String CATEGORY_ACCOUNT = "Account"; + + public static final String CATEGORY_SESSION = "Session"; + + public static final String CATEGORY_DOCUMENT_MANAGEMENT = "DM"; + + public static final String CATEGORY_SITE_MANAGEMENT = "Site"; + + public static final String CATEGORY_BPM = "BPM"; + + public static final String CATEGORY_SEARCH = "Search"; + + public static final String CATEGORY_SYNC = "Sync"; + + public static final String CATEGORY_SETTINGS = "Settings"; + + public static final String CATEGORY_USER = "User"; + + public static final String CATEGORY_WIDGET = "Widget"; + + public static final String CATEGORY_DOC_PROVIDER = "Document Provider"; + + /////////////////////////////////////////////////////////// + // EVENTS : ACTIONS + /////////////////////////////////////////////////////////// + public static final String ACTION_QUICK_ACTIONS = "Quick Actions"; + + public static final String ACTION_TOOLBAR = "Toolbar"; + + public static final String ACTION_SHORTCUT = "Shortcut"; + + public static final String ACTION_INFO = "Info"; + + public static final String ACTION_SEARCH = "Search"; + + public static final String ACTION_SWITCH = "Switch"; + + public static final String ACTION_CREATE = "Create"; + + public static final String ACTION_COMMENT = "Comment"; + + public static final String ACTION_VIEW = "View"; + + public static final String ACTION_OPEN = "Open"; + + public static final String ACTION_DOWNLOAD = "Download"; + + public static final String ACTION_EDIT = "Edit"; + + public static final String ACTION_UPDATE = "Update"; + + public static final String ACTION_UPDATE_MENU = "Update Menu"; + + public static final String ACTION_DELETE = "Delete"; + + public static final String ACTION_RUN = "Run Simple"; + + public static final String ACTION_RUN_ADVANCED = "Run Advanced"; + + public static final String ACTION_RUN_HISTORY = "Run Hisotry"; + + public static final String ACTION_ANALYTICS = "Analytics"; + + public static final String ACTION_FAVORITE = "Favorite"; + + public static final String ACTION_UNFAVORITE = "UnFavorite"; + + public static final String ACTION_LIKE = "Like"; + + public static final String ACTION_UNLIKE = "UnLike"; + + public static final String ACTION_SYNC = "Sync"; + + public static final String ACTION_UNSYNC = "UnSync"; + + public static final String ACTION_SHARE = "Share"; + + public static final String ACTION_SHARE_AS_LINK = "Share"; + + public static final String ACTION_MEMBERSHIP = "Membership"; + + public static final String ACTION_CALL = "Call"; + + public static final String ACTION_SKYPE = "Skype"; + + public static final String ACTION_EMAIL = "Email"; + + public static final String ACTION_ADD_CONTACT = "Add Contact"; + + public static final String ACTION_TAKE_PHOTO = "Take Photo"; + + public static final String ACTION_RECORD_VIDEO = "Record Video"; + + public static final String ACTION_RECORD_AUDIO = "Add Contact"; + + public static final String ACTION_SCAN = "Add Contact"; + + public static final String ACTION_MULTI_SELECT = "Multiselect"; + + public static final String ACTION_REASSIGN = "Reassign"; + + public static final String ACTION_START_REVIEW = "Send for Review"; + + public static final String ACTION_COMPLETE_TASK = "Complete"; + + /////////////////////////////////////////////////////////// + // EVENTS : LABELS + /////////////////////////////////////////////////////////// + public static final String LABEL_CREATE_TEXT = "Text"; + + public static final String LABEL_SPEECH_2_TEXT = "Speech 2 Text"; + + public static final String LABEL_TAKE_PHOTO = "Take Photo"; + + public static final String LABEL_FAILED = "Failed"; + + public static final String LABEL_NETWORK = "Network"; + + public static final String LABEL_PROFILE = "Profile"; + + public static final String LABEL_PHONE = "Phone"; + + public static final String LABEL_MOBILE = "Mobile"; + + public static final String LABEL_COMPANY = "Company"; + + public static final String LABEL_CHAT = "Chat"; + + public static final String LABEL_CALL = "Call"; + + public static final String LABEL_VIDEOCALL = "Video"; + + public static final String LABEL_USER = "User"; + + public static final String LABEL_CONTACT = "Contact"; + + public static final String LABEL_ENABLE = "Enable"; + + public static final String LABEL_DISABLE = "Disable"; + + public static final String LABEL_DISABLE_BY_CONFIG = "Disable By Config"; + + public static final String LABEL_JOIN = "Join"; + + public static final String LABEL_LEAVE = "Leave"; + + public static final String LABEL_CANCEL = "Cancel"; + + public static final String LABEL_NAME = "Name"; + + public static final String LABEL_CREDENTIALS = "Credentials"; + + public static final String LABEL_DOCUMENTS = "Documents"; + + public static final String LABEL_FOLDERS = "Folders"; + + public static final String LABEL_SITES = "Sites"; + + public static final String LABEL_PEOPLE = "People"; + + /////////////////////////////////////////////////////////// + // CUSTOM DIMENSIONS + /////////////////////////////////////////////////////////// + // Beware to have the same index as defined in GAnalytics + public static final int INDEX_SERVER_TYPE = 1; + + public static final String SERVER_TYPE_ONPREMISE = "OnPremise"; + + public static final String SERVER_TYPE_CLOUD = "Cloud"; + + public static final int INDEX_SERVER_VERSION = 2; + + public static final int INDEX_SERVER_EDITION = 3; + + public static final int INDEX_SYNC_FILE_COUNT = 4; + + public static final String INDEX_SYNC_FILE_COUNT_0 = "0"; + + public static final String INDEX_SYNC_FILE_COUNT_1 = "1"; + + public static final String INDEX_SYNC_FILE_COUNT_5 = "2 - 5"; + + public static final String INDEX_SYNC_FILE_COUNT_10 = "5 - 10"; + + public static final String INDEX_SYNC_FILE_COUNT_20 = "11 - 20"; + + public static final String INDEX_SYNC_FILE_COUNT_50 = "21 - 50"; + + public static final String INDEX_SYNC_FILE_COUNT_100 = "51 - 100"; + + public static final String INDEX_SYNC_FILE_COUNT_250 = "101 - 250"; + + public static final String INDEX_SYNC_FILE_COUNT_500 = "251 - 500"; + + public static final String INDEX_SYNC_FILE_COUNT_1000 = "501 - 1000"; + + public static final String INDEX_SYNC_FILE_COUNT_1001 = "1000+"; + + public static final int INDEX_ACCOUNT_COUNT = 5; + + public static final String INDEX_ACCOUNT_COUNT_1 = "1"; + + public static final String INDEX_ACCOUNT_COUNT_2 = "2"; + + public static final String INDEX_ACCOUNT_COUNT_3 = "3"; + + public static final String INDEX_ACCOUNT_COUNT_4 = "4"; + + public static final String INDEX_ACCOUNT_COUNT_5 = "5+"; + + /////////////////////////////////////////////////////////// + // CUSTOM METRICS + /////////////////////////////////////////////////////////// + // Beware to have the same index as defined in GAnalytics + public static final int INDEX_ACCOUNT_NUMBER = 1; + + public static final int INDEX_DATA_PROTECTION = 2; + + public static final int INDEX_PASSCODE = 3; + + public static final int INDEX_LOCAL_FILES = 4; + + public static final int INDEX_SYNCED_FILES = 6; + + public static final int INDEX_SYNCED_FOLDERS = 5; + + public static final int INDEX_SYNCED_SIZE = 7; + + public static final int INDEX_SESSION_CREATION = 8; + + public static final int INDEX_SYNC_CREATION = 9; + + public static final int INDEX_FILE_SIZE = 10; + + public static final int INDEX_PROFILES = 11; + + public static final int INDEX_SYNC_CELLULAR = 12; + + public static final SparseArray CUSTOM_METRIC_LABEL = new SparseArray() + { + { + put(INDEX_ACCOUNT_NUMBER, "Account Number"); + put(INDEX_DATA_PROTECTION, "Data Protection"); + put(INDEX_PASSCODE, "Passcode"); + put(INDEX_LOCAL_FILES, "Local Files"); + put(INDEX_SESSION_CREATION, "Session Creation"); + put(INDEX_SYNC_CREATION, "Account Number"); + } + }; + + public static final SparseArray CUSTOM_DIMENSION_LABEL = new SparseArray() + { + { + put(INDEX_SERVER_TYPE, "Server Type"); + put(INDEX_SERVER_VERSION, "Server Version"); + put(INDEX_SERVER_EDITION, "Server Edition"); + } + }; + + /////////////////////////////////////////////////////////// + // TYPE : + /////////////////////////////////////////////////////////// + public static final String SYNCED_FILES = "Synced Files"; + + public static final String TYPE_FOLDER = "Folder"; + + public static final String SYNCED_FOLDERS = "Synced Folders"; + + /////////////////////////////////////////////////////////// + // SCREEN NAME + /////////////////////////////////////////////////////////// + public static final String ROOT_APPLICATION = "Application"; + + public static final String PREFIX_ACCOUNT = "Account - "; + + public static final String SCREEN_ACCOUNT_EDIT = PREFIX_ACCOUNT + "Edit"; + + public static final String SCREEN_ACCOUNT_TYPE = PREFIX_ACCOUNT + "Create - Type Picker"; + + public static final String SCREEN_ACCOUNT_SERVER = PREFIX_ACCOUNT + "Create - Server"; + + public static final String SCREEN_ACCOUNT_USER = PREFIX_ACCOUNT + "Create - Credentials"; + + public static final String SCREEN_ACCOUNT_NAME = PREFIX_ACCOUNT + "Create - Validation"; + + public static final String SCREEN_ACCOUNT_SIGNIN = PREFIX_ACCOUNT + "Sign In"; + + public static final String SCREEN_ACCOUNT_OAUTH = PREFIX_ACCOUNT + "OAuth"; + + public static final String SCREEN_ACCOUNT_NETWORK = PREFIX_ACCOUNT + "Networks"; + + public static final String PREFIX_MENU = "Menu - "; + + public static final String SCREEN_ACTIVITIES = "Activities"; + + public static final String SCREEN_REPOSITORY = "Repository"; + + public static final String SCREEN_REPOSITORY_SHARED = "Shared Files"; + + public static final String SCREEN_REPOSITORY_USERHOME = "My Files"; + + public static final String PREFIX_DOCUMENT = "Document - "; + + public static final String SCREEN_NODE_GALLERY = PREFIX_DOCUMENT + "Gallery"; + + public static final String SCREEN_NODE_LISTING = PREFIX_DOCUMENT + "Listing"; + + public static final String PREFIX_NODE_DETAILS = PREFIX_DOCUMENT + "Details - "; + + public static final String SCREEN_NODE_SUMMARY = PREFIX_NODE_DETAILS + "Summary"; + + public static final String SCREEN_NODE_PROPERTIES = PREFIX_NODE_DETAILS + "Properties"; + + public static final String SCREEN_NODE_PREVIEW = PREFIX_NODE_DETAILS + "Preview"; + + public static final String SCREEN_NODE_COMMENTS = PREFIX_NODE_DETAILS + "Comments"; + + public static final String SCREEN_NODE_VERSIONS = PREFIX_NODE_DETAILS + "Versions"; + + public static final String SCREEN_NODE_CREATE = PREFIX_DOCUMENT + "Create - "; + + public static final String SCREEN_NODE_CREATE_TYPE = SCREEN_NODE_CREATE + "Type Picker"; + + public static final String SCREEN_NODE_CREATE_EDITOR = SCREEN_NODE_CREATE + "Editor Picker"; + + public static final String SCREEN_NODE_CREATE_NAME = SCREEN_NODE_CREATE + "Name"; + + public static final String SCREEN_NODE_CREATE_FORM = SCREEN_NODE_CREATE + "Form"; + + public static final String SCREEN_NODE_CREATE_FOLDER_FORM = SCREEN_NODE_CREATE + "Folder Form"; + + public static final String SCREEN_NODE_EDIT_PROPERTIES = PREFIX_DOCUMENT + "Edit Properties"; + + public static final String PREFIX_SITES = "Sites - "; + + public static final String SCREEN_SITES_MY = PREFIX_SITES + "My"; + + public static final String SCREEN_SITES_ALL = PREFIX_SITES + "All"; + + public static final String SCREEN_SITES_FAVORITES = PREFIX_SITES + "Favorites"; + + public static final String SCREEN_SITES_SEARCH = PREFIX_SITES + "Search"; + + public static final String SCREEN_SITES_PENDING_REQUEST = PREFIX_SITES + "Pending Requests"; + + public static final String SCREEN_SITES_MEMBERS = PREFIX_SITES + "Members"; + + public static final String SCREEN_FAVORITES = "Favorites"; + + public static final String SCREEN_SYNCED_CONTENT = "Synced Content"; + + public static final String PREFIX_SEARCH = "Search - "; + + public static final String SCREEN_SEARCH_FILES = PREFIX_SEARCH + "Files"; + + public static final String SCREEN_SEARCH_FOLDERS = PREFIX_SEARCH + "Folders"; + + public static final String SCREEN_SEARCH_USERS = PREFIX_SEARCH + "Users"; + + public static final String SCREEN_SEARCH_SITES = PREFIX_SEARCH + "Sites"; + + public static final String PREFIX_SEARCH_RESULT = PREFIX_SEARCH + "Result - "; + + public static final String SCREEN_SEARCH_RESULT_FILES = PREFIX_SEARCH_RESULT + "Files"; + + public static final String SCREEN_SEARCH_RESULT_USERS = PREFIX_SEARCH_RESULT + "People"; + + public static final String SCREEN_SEARCH_ADVANCED = PREFIX_SEARCH + "Advanced - "; + + public static final String SCREEN_SEARCH_ADVANCED_FILES = PREFIX_SEARCH_RESULT + "Files"; + + public static final String SCREEN_SEARCH_ADVANCED_FOLDERS = PREFIX_SEARCH_RESULT + "Folders"; + + public static final String SCREEN_SEARCH_ADVANCED_USERS = PREFIX_SEARCH_RESULT + "People"; + + public static final String PREFIX_TASKS = "Tasks - "; + + public static final String SCREEN_TASKS_LISTING = PREFIX_TASKS + "Listing"; + + public static final String SCREEN_TASKS_HISTORY = PREFIX_TASKS + "History"; + + public static final String SCREEN_TASKS_FILTER = PREFIX_TASKS + "Filter"; + + public static final String SCREEN_TASK_DETAILS = PREFIX_TASKS + "Details"; + + public static final String SCREEN_TASK_CREATE_TYPE = PREFIX_TASKS + "Create - Type"; + + public static final String SCREEN_TASK_CREATE_FORM = PREFIX_TASKS + "Create - Form"; + + public static final String SCREEN_LOCAL_FILES_BROWSER = "Local Files - Listing"; + + public static final String SCREEN_LOCAL_FILES_MENU = "Local Files - Menu"; + + public static final String SCREEN_SETTINGS = "Settings - "; + + public static final String SCREEN_SETTINGS_DETAILS = SCREEN_SETTINGS + "Details"; + + public static final String SCREEN_SETTINGS_ACCOUNT = SCREEN_SETTINGS + "Account"; + + public static final String SCREEN_SETTINGS_PASSCODE = SCREEN_SETTINGS + "Passcode"; + + public static final String SCREEN_SETTINGS_CUSTOM_MENU = SCREEN_SETTINGS + "Custom Menu"; + + public static final String SCREEN_SETTINGS_ABOUT = SCREEN_SETTINGS + "About"; + + public static final String SCREEN_HELP = "Help"; + + public static final String PREFIX_USER = "User - "; + + public static final String SCREEN_USERS = PREFIX_USER + "Listing"; + + public static final String SCREEN_USER_DETAILS = PREFIX_USER + "Details"; + + public static final String SCREEN_SAMSUNG_SNOTE_EDITOR = "Samsung - SNote Editor"; + + // //////////////////////////////////////////////////// + // SETTINGS + // //////////////////////////////////////////////////// + protected static final String ANALYTICS_PREFIX = "Analytics-"; + + public static final int STATUS_BLOCKED = -1; + + public static final int STATUS_DISABLE = 0; + + public static final int STATUS_ENABLE = 1; + + protected static final Object LOCK = new Object(); + + protected static Manager mInstance; + + // /////////////////////////////////////////////////////////////////////////// + // CONSTRUCTOR + // /////////////////////////////////////////////////////////////////////////// + public static AnalyticsManager getInstance(Context context) + { + synchronized (LOCK) + { + if (mInstance == null) + { + mInstance = Manager.getInstance(context, AnalyticsManager.class.getSimpleName()); + } + + return (AnalyticsManager) mInstance; + } + } + + protected AnalyticsManager(Context applicationContext) + { + super(applicationContext); + } + + // /////////////////////////////////////////////////////////////////////////// + // PUBLIC METHODS + // /////////////////////////////////////////////////////////////////////////// + public abstract void cleanOptInfo(Context context, AlfrescoAccount account); + + public abstract void optOut(Activity activity, AlfrescoAccount account); + + public abstract void optOutByConfig(Context context, AlfrescoAccount account); + + public abstract void optInByConfig(Context context, AlfrescoAccount account); + + public abstract void optIn(Activity activity, AlfrescoAccount account); + + public abstract boolean isEnable(); + + public abstract boolean isEnable(AlfrescoAccount account); + + public abstract int getStatus(); + + public abstract boolean isBlocked(); + + // /////////////////////////////////////////////////////////////////////////// + // ABSTRACT METHODS + // /////////////////////////////////////////////////////////////////////////// + public abstract void startReport(Activity activity); + + public abstract void reportScreen(String name); + + public abstract void reportEvent(String category, String action, String label, int value); + + public abstract void reportEvent(String category, String action, String label, int value, int customMetricId, + Long customMetricValue); + + public abstract void reportEvent(String category, String action, String label, int eventValue, + SparseArray dimensions, SparseArray metrics); + + public abstract void reportInfo(String label, SparseArray dimensions, SparseArray metrics); + + public abstract void reportError(boolean isFatal, String description); + + public interface FragmentAnalyzed + { + String getScreenName(); + + boolean reportAtCreationEnable(); + } + +} diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/favorite/FavoritesManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/favorite/FavoritesManager.java index 71fed1a3..bf728145 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/favorite/FavoritesManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/favorite/FavoritesManager.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.platform.favorite; import java.io.File; @@ -351,7 +351,7 @@ public void saveStartSyncPrepareTimestamp() if (account != null) { editor.putLong(LAST_START_SYNC_PREPARE + account.getId(), new Date().getTime()); - editor.commit(); + editor.apply(); } } @@ -363,7 +363,7 @@ public void saveSyncPrepareTimestamp() if (account != null) { editor.putLong(LAST_SYNC_ACTIVATED_AT + account.getId(), new Date().getTime()); - editor.commit(); + editor.apply(); } } @@ -677,7 +677,7 @@ public void setWifiOnlySync(AlfrescoAccount account, boolean isWifiOnly) if (account != null) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); - sharedPref.edit().putBoolean(SYNCHRO_WIFI_PREFIX + account.getId(), isWifiOnly).commit(); + sharedPref.edit().putBoolean(SYNCHRO_WIFI_PREFIX + account.getId(), isWifiOnly).apply(); } } @@ -704,7 +704,7 @@ public boolean hasActivateSync(AlfrescoAccount account) public void setActivateSync(long accountId, boolean isActive) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); - sharedPref.edit().putBoolean(SYNCHRO_PREFIX + accountId, isActive).commit(); + sharedPref.edit().putBoolean(SYNCHRO_PREFIX + accountId, isActive).apply(); ContentResolver.setSyncAutomatically(AlfrescoAccountManager.getInstance(appContext) .getAndroidAccount(accountId), FavoritesProvider.AUTHORITY, isActive); } @@ -722,7 +722,7 @@ public void setDisplayActivateSync(AlfrescoAccount account, boolean isActive) SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); if (account != null) { - sharedPref.edit().putBoolean(SYNCHRO_DISPLAY_PREFIX + account.getId(), isActive).commit(); + sharedPref.edit().putBoolean(SYNCHRO_DISPLAY_PREFIX + account.getId(), isActive).apply(); } } @@ -749,7 +749,7 @@ public void setSyncEverything(boolean isActive) if (SessionUtils.getAccount(appContext) != null) { final AlfrescoAccount account = SessionUtils.getAccount(appContext); - sharedPref.edit().putBoolean(SYNCHRO_EVEYTHING_PREFIX + account.getId(), isActive).commit(); + sharedPref.edit().putBoolean(SYNCHRO_EVEYTHING_PREFIX + account.getId(), isActive).apply(); } } @@ -772,7 +772,7 @@ public void setDataSyncTransferAlert(long length) if (SessionUtils.getAccount(appContext) != null) { final AlfrescoAccount account = SessionUtils.getAccount(appContext); - sharedPref.edit().putLong(SYNCHRO_DATA_ALERT_PREFIX + account.getId(), length).commit(); + sharedPref.edit().putLong(SYNCHRO_DATA_ALERT_PREFIX + account.getId(), length).apply(); } } @@ -793,7 +793,7 @@ public void setDataSyncTransferAlert(float percent) if (SessionUtils.getAccount(appContext) != null) { final AlfrescoAccount account = SessionUtils.getAccount(appContext); - sharedPref.edit().putFloat(SYNCHRO_FREE_SPACE_ALERT_PREFIX + account.getId(), percent).commit(); + sharedPref.edit().putFloat(SYNCHRO_FREE_SPACE_ALERT_PREFIX + account.getId(), percent).apply(); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/security/DataProtectionManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/security/DataProtectionManager.java index 6792598b..34a7f2cc 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/security/DataProtectionManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/security/DataProtectionManager.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.platform.security; import java.io.File; @@ -225,7 +225,7 @@ public boolean hasDataProtectionEnable() public void setDataProtectionEnable(boolean isEnabled) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); - sharedPref.edit().putBoolean(DATA_PROTECTION_ENABLE, isEnabled).commit(); + sharedPref.edit().putBoolean(DATA_PROTECTION_ENABLE, isEnabled).apply(); } public File getRequiredDataProtectionFile() @@ -239,7 +239,7 @@ public File getRequiredDataProtectionFile() public void setRequiredDataProtectionFile(File file) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext); - prefs.edit().putString(REQUIRES_ENCRYPT, file.getPath()).commit(); + prefs.edit().putString(REQUIRES_ENCRYPT, file.getPath()).apply(); } public boolean hasDataProtectionUserRequested() @@ -251,6 +251,6 @@ public boolean hasDataProtectionUserRequested() public void setDataProtectionUserRequested(boolean isRequested) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); - sharedPref.edit().putBoolean(DATA_PROTECTION_USER_REQUEST, isRequested).commit(); + sharedPref.edit().putBoolean(DATA_PROTECTION_USER_REQUEST, isRequested).apply(); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentManager.java index 8094d5d7..f0fab8e2 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentManager.java @@ -447,7 +447,7 @@ public void saveStartSyncPrepareTimestamp() if (account != null) { editor.putLong(LAST_START_SYNC_PREPARE + account.getId(), new Date().getTime()); - editor.commit(); + editor.apply(); } } @@ -459,7 +459,7 @@ public void saveSyncPrepareTimestamp() if (account != null) { editor.putLong(LAST_SYNC_ACTIVATED_AT + account.getId(), new Date().getTime()); - editor.commit(); + editor.apply(); } } @@ -783,7 +783,7 @@ public void setWifiOnlySync(AlfrescoAccount account, boolean isWifiOnly) if (account != null) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); - sharedPref.edit().putBoolean(SYNCHRO_WIFI_PREFIX + account.getId(), isWifiOnly).commit(); + sharedPref.edit().putBoolean(SYNCHRO_WIFI_PREFIX + account.getId(), isWifiOnly).apply(); } } @@ -810,7 +810,7 @@ public boolean hasActivateSync(AlfrescoAccount account) public void setActivateSync(long accountId, boolean isActive) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); - sharedPref.edit().putBoolean(SYNCHRO_PREFIX + accountId, isActive).commit(); + sharedPref.edit().putBoolean(SYNCHRO_PREFIX + accountId, isActive).apply(); ContentResolver.setSyncAutomatically( AlfrescoAccountManager.getInstance(appContext).getAndroidAccount(accountId), SyncContentProvider.AUTHORITY, isActive); @@ -829,7 +829,7 @@ public void setDisplayActivateSync(AlfrescoAccount account, boolean isActive) SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); if (account != null) { - sharedPref.edit().putBoolean(SYNCHRO_DISPLAY_PREFIX + account.getId(), isActive).commit(); + sharedPref.edit().putBoolean(SYNCHRO_DISPLAY_PREFIX + account.getId(), isActive).apply(); } } @@ -856,7 +856,7 @@ public void setSyncEverything(boolean isActive) if (SessionUtils.getAccount(appContext) != null) { final AlfrescoAccount account = SessionUtils.getAccount(appContext); - sharedPref.edit().putBoolean(SYNCHRO_EVEYTHING_PREFIX + account.getId(), isActive).commit(); + sharedPref.edit().putBoolean(SYNCHRO_EVEYTHING_PREFIX + account.getId(), isActive).apply(); } } @@ -879,7 +879,7 @@ public void setDataSyncTransferAlert(long length) if (SessionUtils.getAccount(appContext) != null) { final AlfrescoAccount account = SessionUtils.getAccount(appContext); - sharedPref.edit().putLong(SYNCHRO_DATA_ALERT_PREFIX + account.getId(), length).commit(); + sharedPref.edit().putLong(SYNCHRO_DATA_ALERT_PREFIX + account.getId(), length).apply(); } } @@ -900,7 +900,7 @@ public void setDataSyncTransferAlert(float percent) if (SessionUtils.getAccount(appContext) != null) { final AlfrescoAccount account = SessionUtils.getAccount(appContext); - sharedPref.edit().putFloat(SYNCHRO_FREE_SPACE_ALERT_PREFIX + account.getId(), percent).commit(); + sharedPref.edit().putFloat(SYNCHRO_FREE_SPACE_ALERT_PREFIX + account.getId(), percent).apply(); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentSchema.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentSchema.java index c17bdef9..7df371ee 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentSchema.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentSchema.java @@ -80,6 +80,8 @@ private SyncContentSchema() public static final String[] COLUMN_ALL = join(COLUMNS, COLUMNS_SYNC); + public static final String[] COLUMN_IDS = { COLUMN_ID }; + // //////////////////////////////////////////////////// // QUERIES // //////////////////////////////////////////////////// diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentSyncAdapter.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentSyncAdapter.java index 2130ec12..93b3a410 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentSyncAdapter.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentSyncAdapter.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.sync; import java.util.GregorianCalendar; @@ -27,6 +27,7 @@ import org.alfresco.mobile.android.platform.EventBusManager; import org.alfresco.mobile.android.platform.SessionManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; import org.alfresco.mobile.android.sync.operations.SyncContent; import org.alfresco.mobile.android.sync.prepare.PrepareSyncHelper; @@ -99,16 +100,28 @@ public void onPerformSync(Account account, Bundle extras, String authority, Cont { ignoreWarning = extras.getBoolean(SyncContentManager.ARGUMENT_IGNORE_WARNING); } + else + { + ignoreWarning = false; + } if (extras.containsKey(SyncContentManager.ARGUMENT_NODE)) { node = (Node) extras.getSerializable(SyncContentManager.ARGUMENT_NODE); } + else + { + node = null; + } if (extras.containsKey(SyncContentManager.ARGUMENT_NODE_ID)) { nodeIdentifier = extras.getString(SyncContentManager.ARGUMENT_NODE_ID); } + else + { + nodeIdentifier = null; + } } try @@ -180,8 +193,8 @@ protected void sync(SyncResult syncResult) switch (currentSyncScan.getScanResult()) { - // Normal Case - // Scan is Success ==> Launch the sync + // Normal Case + // Scan is Success ==> Launch the sync case SyncScanInfo.RESULT_SUCCESS: // Start Execution for (SyncContent operation : requests) @@ -222,6 +235,11 @@ protected void sync(SyncResult syncResult) EventBusManager.getInstance().post(new SyncContentScanEvent()); + if (node == null && nodeIdentifier == null) + { + AnalyticsHelper.analyzeSync(getContext(), acc); + } + Log.d("SYNC", "Total:" + syncResult.stats.numEntries); Log.d("SYNC", "Skipped:" + syncResult.stats.numSkippedEntries); Log.d("SYNC", "Creation:" + syncResult.stats.numInserts); diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncScanInfo.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncScanInfo.java index 2aabed43..0f588adf 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncScanInfo.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncScanInfo.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.sync; import org.alfresco.mobile.android.foundation.R; @@ -132,7 +132,7 @@ public void save(Context context, AlfrescoAccount account) sharedPref.edit().putLong(SYNCHRO_SCAN_DATA_DELTA_PREFIX + account.getId(), deltaDataTransfer) .putLong(SYNCHRO_SCAN_DATA_TRANSFER_PREFIX + account.getId(), dataToTransfer) .putInt(SYNCHRO_SCAN_RESULT_PREFIX + account.getId(), scanResult) - .putInt(SYNCHRO_SCAN_RESPONSE_PREFIX + account.getId(), scanResponse).commit(); + .putInt(SYNCHRO_SCAN_RESPONSE_PREFIX + account.getId(), scanResponse).apply(); } public void reset(Context context, AlfrescoAccount account) @@ -140,7 +140,7 @@ public void reset(Context context, AlfrescoAccount account) SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); sharedPref.edit().remove(SYNCHRO_SCAN_DATA_DELTA_PREFIX + account.getId()) .remove(SYNCHRO_SCAN_DATA_TRANSFER_PREFIX + account.getId()) - .remove(SYNCHRO_SCAN_RESULT_PREFIX + account.getId()).commit(); + .remove(SYNCHRO_SCAN_RESULT_PREFIX + account.getId()).apply(); } public static SyncScanInfo getLastSyncScanData(Context context, AlfrescoAccount account) @@ -163,7 +163,7 @@ public static void setLastSyncScanData(Context context, AlfrescoAccount account, SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); sharedPref.edit().putLong(SYNCHRO_SCAN_DATA_DELTA_PREFIX + account.getId(), deltaDataTransfer) .putLong(SYNCHRO_SCAN_DATA_TRANSFER_PREFIX + account.getId(), dateToTransfer) - .putInt(SYNCHRO_SCAN_RESULT_PREFIX + account.getId(), scanResult).commit(); + .putInt(SYNCHRO_SCAN_RESULT_PREFIX + account.getId(), scanResult).apply(); } public String getErrorMessage(Context context) diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/prepare/PrepareBaseHelper.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/prepare/PrepareBaseHelper.java index 6f00fcaa..bab9fead 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/prepare/PrepareBaseHelper.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/prepare/PrepareBaseHelper.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.sync.prepare; import java.io.File; diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/activity/AlfrescoActivity.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/activity/AlfrescoActivity.java index 2d6be80e..30794f20 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/activity/AlfrescoActivity.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/activity/AlfrescoActivity.java @@ -29,6 +29,8 @@ import org.alfresco.mobile.android.platform.accounts.AlfrescoAccountManager; import org.alfresco.mobile.android.platform.exception.AlfrescoAppException; import org.alfresco.mobile.android.platform.exception.CloudExceptionUtils; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.extensions.HockeyAppManager; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.ui.fragments.WaitingDialogFragment; @@ -196,6 +198,13 @@ public void removeWaitingDialog() // /////////////////////////////////////////////////////////////////////////// public void swapAccount(AlfrescoAccount account) { + // Analytics + AnalyticsHelper + .reportOperationEvent(this, AnalyticsManager.CATEGORY_SESSION, + AnalyticsManager.ACTION_SWITCH, account.getTypeId() == AlfrescoAccount.TYPE_ALFRESCO_CLOUD + ? AnalyticsManager.SERVER_TYPE_CLOUD : AnalyticsManager.SERVER_TYPE_ONPREMISE, + 1, false); + setCurrentAccount(account); SessionManager.getInstance(this).loadSession(account); } @@ -261,8 +270,8 @@ public void initBugReport() telescopeView.setVibrate(false); telescopeView.setLens(new EmailDeviceInfoLens(this, getResources().getStringArray(R.array.bugreport_email), getString(R.string.bug_report_title), - getPackageManager().getPackageInfo(getPackageName(), 0).versionName, getPackageManager() - .getPackageInfo(getPackageName(), 0).versionCode)); + getPackageManager().getPackageInfo(getPackageName(), 0).versionName, + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode)); } catch (Exception e) { diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/fragments/AlfrescoFragment.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/fragments/AlfrescoFragment.java index b411041c..ded17adf 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/fragments/AlfrescoFragment.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/fragments/AlfrescoFragment.java @@ -24,6 +24,7 @@ import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; import org.alfresco.mobile.android.platform.EventBusManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.activity.AlfrescoActivity; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -42,7 +43,7 @@ * * @author Jean Marie Pascal */ -public abstract class AlfrescoFragment extends DialogFragment +public abstract class AlfrescoFragment extends DialogFragment implements AnalyticsManager.FragmentAnalyzed { protected static final String ARGUMENT_BASED_ON_TEMPLATE = "basedOnTemplate"; @@ -63,6 +64,11 @@ public abstract class AlfrescoFragment extends DialogFragment protected String title; + protected String screenName; + + /** Flag to send screen event with analytics. */ + protected boolean reportAtCreation = true; + // ///////////////////////////////////////////////////////////// // LIFECYCLE // //////////////////////////////////////////////////////////// @@ -238,4 +244,18 @@ public String onPrepareTitle() { return title; } + + // ///////////////////////////////////////////////////////////// + // ANLYTICS + // //////////////////////////////////////////////////////////// + public String getScreenName() + { + return TextUtils.isEmpty(screenName) ? getClass().getSimpleName() : screenName; + } + + @Override + public boolean reportAtCreationEnable() + { + return reportAtCreation; + } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/network/CloudNetworksFragment.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/network/CloudNetworksFragment.java index a37e4081..00fbddf2 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/network/CloudNetworksFragment.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/network/CloudNetworksFragment.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.ui.network; import java.util.ArrayList; @@ -25,6 +25,7 @@ import org.alfresco.mobile.android.async.session.network.NetworksEvent; import org.alfresco.mobile.android.async.session.network.NetworksRequest; import org.alfresco.mobile.android.foundation.R; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseGridFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -42,6 +43,7 @@ public class CloudNetworksFragment extends BaseGridFragment public CloudNetworksFragment() { emptyListMessageId = R.string.cloud_networks_empty; + screenName = AnalyticsManager.SCREEN_ACCOUNT_NETWORK; } // ////////////////////////////////////////////////////////////////////// diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/node/browse/NodeBrowserTemplate.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/node/browse/NodeBrowserTemplate.java index 132a1f5c..9cbdaf84 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/node/browse/NodeBrowserTemplate.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/node/browse/NodeBrowserTemplate.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.ui.node.browse; import org.alfresco.mobile.android.api.model.config.ConfigConstants; @@ -23,6 +23,8 @@ public interface NodeBrowserTemplate extends ListingTemplate { + String ANALYTICS_ID = "Node Browser"; + String ARGUMENT_FOLDER_NODEREF = "nodeRef"; String ARGUMENT_FOLDER = "parentFolder"; diff --git a/platform/foundation/src/main/res/values/config_default_managers.xml b/platform/foundation/src/main/res/values/config_default_managers.xml index 96e89884..8f26deaa 100644 --- a/platform/foundation/src/main/res/values/config_default_managers.xml +++ b/platform/foundation/src/main/res/values/config_default_managers.xml @@ -1,4 +1,22 @@ + + @@ -18,6 +36,10 @@ false org.alfresco.mobile.android.application.extension.hockeyapp.HockeyAppManagerImpl + + false + org.alfresco.mobile.android.application.extension.analytics.GAnalyticsManagerImpl + false org.alfresco.mobile.android.commons.manager.RenditionManager diff --git a/platform/thirdparty/build.gradle b/platform/thirdparty/build.gradle index 7bfbc68a..86f2e695 100644 --- a/platform/thirdparty/build.gradle +++ b/platform/thirdparty/build.gradle @@ -20,7 +20,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 23 - buildToolsVersion "23.0.1" + buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 15 diff --git a/settings.gradle b/settings.gradle index 77e22405..ecd2d836 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,15 +1,26 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + // APPLICATION -include ':alfresco-mobile-android' // FOUNDATION -include ':platform:thirdparty' -include ':platform:foundation' // EXTENSIONS -include ':extensions:hockeyapp' -include ':extensions:samsung' -include ':extensions:scansnap' -include ':extensions:tools' // MDM INTEGRATION -include ':mdm:mobileiron' +include ':alfresco-mobile-android', ':extensions', ':platform:foundation', ':extensions:hockeyapp', ':mdm', ':mdm:mobileiron', ':platform', ':extensions:samsung', ':extensions:scansnap', ':platform:thirdparty', 'extensions:analytics' From 545db2eec95c99531541fe08c2cc68133316a6dd Mon Sep 17 00:00:00 2001 From: jmpascal Date: Wed, 10 Feb 2016 16:54:31 +0100 Subject: [PATCH 03/35] Merge Latest version of 1.6 --- .../application/activity/MainActivity.java | 1 - .../res/layout/app_details_pager_tablet.xml | 19 +++++++++++- .../src/main/res/layout/app_pager_tab.xml | 31 ++++++++++--------- .../src/main/res/layout/fr_node_summary.xml | 19 +++++++++++- .../android/async/OperationsFactory.java | 26 ++++++++-------- .../session/oauth/AccountOAuthHelper.java | 1 - .../exception/AlfrescoOfflineException.java | 26 ++++++++-------- .../sync/operations/SyncContentDownload.java | 26 ++++++++-------- .../sync/operations/SyncContentUpdate.java | 26 ++++++++-------- 9 files changed, 104 insertions(+), 71 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java index eaa42a7e..6dc60ee8 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java @@ -1088,7 +1088,6 @@ else if (sessionState == SESSION_ERROR && getCurrentSession() == null) if (!isSyncActive(AlfrescoAccountManager.getInstance(context) .getAndroidAccount(getCurrentAccount().getId()), SyncContentProvider.AUTHORITY)) { - Log.e(TAG, "[Sync NETWORK]"); SyncContentManager.getInstance(context).sync(getCurrentAccount()); } } diff --git a/alfresco-mobile-android/src/main/res/layout/app_details_pager_tablet.xml b/alfresco-mobile-android/src/main/res/layout/app_details_pager_tablet.xml index 7e053ffe..118d01ea 100644 --- a/alfresco-mobile-android/src/main/res/layout/app_details_pager_tablet.xml +++ b/alfresco-mobile-android/src/main/res/layout/app_details_pager_tablet.xml @@ -1,4 +1,21 @@ - + + + ~ Copyright (C) 2005-2016 Alfresco Software Limited. + ~ + ~ This file is part of Alfresco Mobile for Android. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + + Date: Wed, 10 Feb 2016 17:38:44 +0100 Subject: [PATCH 04/35] Merge Latest version of 1.6 --- alfresco-mobile-android/google-services.json | 45 -------------------- 1 file changed, 45 deletions(-) delete mode 100644 alfresco-mobile-android/google-services.json diff --git a/alfresco-mobile-android/google-services.json b/alfresco-mobile-android/google-services.json deleted file mode 100644 index 2a78c3c1..00000000 --- a/alfresco-mobile-android/google-services.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "project_info": { - "project_id": "alfresco-mobile", - "project_number": "1053450300169", - "name": "Alfresco Mobile" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:1053450300169:android:4c82694870595779", - "client_id": "android:org.alfresco.mobile.android.application", - "client_type": 1, - "android_client_info": { - "package_name": "org.alfresco.mobile.android.application" - } - }, - "oauth_client": [], - "api_key": [], - "services": { - "analytics_service": { - "status": 2, - "analytics_property": { - "tracking_id": "UA-70658012-1" - } - }, - "cloud_messaging_service": { - "status": 1, - "apns_config": [] - }, - "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] - }, - "google_signin_service": { - "status": 1 - }, - "ads_service": { - "status": 1 - } - } - } - ], - "client_info": [], - "ARTIFACT_VERSION": "1" -} \ No newline at end of file From 473f6da506c10959be3bee9b9554bebe7ba129b2 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Thu, 11 Feb 2016 09:32:47 +0100 Subject: [PATCH 05/35] Fix Build --- alfresco-mobile-android/.gitignore | 2 + .../src/main/res/values-de/strings.xml | 2 +- .../src/main/res/values-es/strings.xml | 2 +- .../src/main/res/values-fr/strings.xml | 2 +- .../src/main/res/values-it/strings.xml | 2 +- .../src/main/res/values-ja/strings.xml | 2 +- .../src/main/res/values-zh-rCN/strings.xml | 2 +- .../src/main/res/values/strings.xml | 2 +- extensions/analytics/.gitignore | 2 + extensions/analytics/build.gradle | 1 - extensions/analytics/google-services.json | 45 ------------------- gradle/wrapper/gradle-wrapper.properties | 20 ++++++++- .../platform/extensions/AnalyticsManager.java | 4 +- 13 files changed, 32 insertions(+), 56 deletions(-) delete mode 100644 extensions/analytics/google-services.json diff --git a/alfresco-mobile-android/.gitignore b/alfresco-mobile-android/.gitignore index 796b96d1..1eff0cfb 100644 --- a/alfresco-mobile-android/.gitignore +++ b/alfresco-mobile-android/.gitignore @@ -1 +1,3 @@ /build +#Google +google-services.json \ No newline at end of file diff --git a/alfresco-mobile-android/src/main/res/values-de/strings.xml b/alfresco-mobile-android/src/main/res/values-de/strings.xml index 3840a311..b95a1b58 100644 --- a/alfresco-mobile-android/src/main/res/values-de/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-de/strings.xml @@ -798,7 +798,7 @@ Anzeigename des Accounts Name des mit dem Server verbundenen Repositorys. - Alfresco Server + Alfresco Server diff --git a/alfresco-mobile-android/src/main/res/values-es/strings.xml b/alfresco-mobile-android/src/main/res/values-es/strings.xml index a70a559e..7d641405 100644 --- a/alfresco-mobile-android/src/main/res/values-es/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-es/strings.xml @@ -798,7 +798,7 @@ Nombre de la cuenta para mostrar Nombre del servidor asociado al repositorio. - Servidor de Alfresco + Servidor de Alfresco diff --git a/alfresco-mobile-android/src/main/res/values-fr/strings.xml b/alfresco-mobile-android/src/main/res/values-fr/strings.xml index 7adde5ac..32afb9a5 100644 --- a/alfresco-mobile-android/src/main/res/values-fr/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-fr/strings.xml @@ -798,7 +798,7 @@ Nom complet du compte Nom du serveur associé à l\'entrepôt. - Serveur Alfresco + Serveur Alfresco diff --git a/alfresco-mobile-android/src/main/res/values-it/strings.xml b/alfresco-mobile-android/src/main/res/values-it/strings.xml index 1ed5a825..8fd81d47 100644 --- a/alfresco-mobile-android/src/main/res/values-it/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-it/strings.xml @@ -798,7 +798,7 @@ Nome visualizzato dell\'account Nome del server associato al repository. - Server Alfresco + Server Alfresco diff --git a/alfresco-mobile-android/src/main/res/values-ja/strings.xml b/alfresco-mobile-android/src/main/res/values-ja/strings.xml index 41d86968..9647bc81 100644 --- a/alfresco-mobile-android/src/main/res/values-ja/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-ja/strings.xml @@ -798,7 +798,7 @@ アカウントの表示名 リポジトリに接続しているサーバーの名前。 - Alfresco Server + Alfresco Server diff --git a/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml b/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml index 8fdaa3df..b73ed1c7 100644 --- a/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml @@ -798,7 +798,7 @@ 帐户显示名 与存储库相关联的服务器的名称。 - Alfresco 服务器 + Alfresco 服务器 diff --git a/alfresco-mobile-android/src/main/res/values/strings.xml b/alfresco-mobile-android/src/main/res/values/strings.xml index c3963e7c..116719c2 100644 --- a/alfresco-mobile-android/src/main/res/values/strings.xml +++ b/alfresco-mobile-android/src/main/res/values/strings.xml @@ -801,7 +801,7 @@ Account Display Name Name of the server associated to the repository. - Alfresco Server + Alfresco Server diff --git a/extensions/analytics/.gitignore b/extensions/analytics/.gitignore index 796b96d1..b8ea6b1c 100644 --- a/extensions/analytics/.gitignore +++ b/extensions/analytics/.gitignore @@ -1 +1,3 @@ /build +#Google +google-services.json diff --git a/extensions/analytics/build.gradle b/extensions/analytics/build.gradle index 1d93ca83..03583ab7 100644 --- a/extensions/analytics/build.gradle +++ b/extensions/analytics/build.gradle @@ -17,7 +17,6 @@ */ apply plugin: 'com.android.library' -apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 23 diff --git a/extensions/analytics/google-services.json b/extensions/analytics/google-services.json deleted file mode 100644 index 2a78c3c1..00000000 --- a/extensions/analytics/google-services.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "project_info": { - "project_id": "alfresco-mobile", - "project_number": "1053450300169", - "name": "Alfresco Mobile" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:1053450300169:android:4c82694870595779", - "client_id": "android:org.alfresco.mobile.android.application", - "client_type": 1, - "android_client_info": { - "package_name": "org.alfresco.mobile.android.application" - } - }, - "oauth_client": [], - "api_key": [], - "services": { - "analytics_service": { - "status": 2, - "analytics_property": { - "tracking_id": "UA-70658012-1" - } - }, - "cloud_messaging_service": { - "status": 1, - "apns_config": [] - }, - "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] - }, - "google_signin_service": { - "status": 1 - }, - "ads_service": { - "status": 1 - } - } - } - ], - "client_info": [], - "ARTIFACT_VERSION": "1" -} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c71e760..b4425f95 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,24 @@ +# +# Copyright (C) 2005-2016 Alfresco Software Limited. +# +# This file is part of Alfresco Mobile for Android. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + #Wed Apr 10 15:27:10 PDT 2013 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java index 9df955b7..134cc5a4 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java @@ -123,9 +123,9 @@ public abstract class AnalyticsManager extends Manager public static final String ACTION_RECORD_VIDEO = "Record Video"; - public static final String ACTION_RECORD_AUDIO = "Add Contact"; + public static final String ACTION_RECORD_AUDIO = "Record Audio"; - public static final String ACTION_SCAN = "Add Contact"; + public static final String ACTION_SCAN = "Scan"; public static final String ACTION_MULTI_SELECT = "Multiselect"; From 7903cc1db63abf913cc66b421e6734514f782b12 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Thu, 11 Feb 2016 15:32:52 +0100 Subject: [PATCH 06/35] ANDROID-245 ANDROID-235 ANDROID-233 ANDROID-241 --- alfresco-mobile-android/build.gradle | 4 +- .../managers/DevToolsManagerImpl.java | 47 ++++++++++++ .../src/debug/res/values/keys.xml | 21 ++---- .../preferences/AccountSettingsFragment.java | 1 + .../preferences/GeneralPreferences.java | 16 ++-- .../managers/extensions/AnalyticHelper.java | 4 +- .../src/main/res/layout/fr_settings.xml | 17 +---- .../src/main/res/values/keys.xml | 37 +++++++++ .../analytics/GAnalyticsManagerImpl.java | 75 +++++++++++++------ .../analytics/src/main/res/values/keys.xml | 23 +++++- .../model/config/impl/ConfigurationImpl.java | 2 +- .../impl/AbstractConfigServiceImpl.java | 2 +- .../services/impl/LocalConfigServiceImpl.java | 2 +- .../platform/extensions/AnalyticsHelper.java | 25 ++++++- .../platform/extensions/AnalyticsManager.java | 23 ++++-- .../platform/extensions/DevToolsManager.java | 29 +++---- .../res/layout/row_two_lines_checkbox.xml | 2 +- 17 files changed, 238 insertions(+), 92 deletions(-) rename extensions/analytics/src/main/res/xml/global_tracker.xml => alfresco-mobile-android/src/debug/res/values/keys.xml (55%) create mode 100644 alfresco-mobile-android/src/main/res/values/keys.xml diff --git a/alfresco-mobile-android/build.gradle b/alfresco-mobile-android/build.gradle index 7ce674b3..b304ea1b 100644 --- a/alfresco-mobile-android/build.gradle +++ b/alfresco-mobile-android/build.gradle @@ -42,7 +42,7 @@ android { resValue "string", "oauth_scope", OAUTH_SCOPE resValue "string", "bamboo_buildnumber", BUILDNUMBER - resValue "string", "ga_trackId", TRACKER_ID + resValue "string", "ga_trackingId", TRACKER_ID } lintOptions { @@ -77,7 +77,7 @@ android { resValue "string", "favorites_adapter", FAVORITES_ADAPTER_DEBUG resValue "string", "hockeyapp_key", HOCKEYAPP_KEY - resValue "string", "ga_trackId", TRACKER_ID_DEBUG + resValue "string", "ga_trackingId", TRACKER_ID_DEBUG } release { diff --git a/alfresco-mobile-android/src/debug/java/org/alfresco/mobile/android/application/managers/DevToolsManagerImpl.java b/alfresco-mobile-android/src/debug/java/org/alfresco/mobile/android/application/managers/DevToolsManagerImpl.java index bf4c004b..fa3f02cc 100644 --- a/alfresco-mobile-android/src/debug/java/org/alfresco/mobile/android/application/managers/DevToolsManagerImpl.java +++ b/alfresco-mobile-android/src/debug/java/org/alfresco/mobile/android/application/managers/DevToolsManagerImpl.java @@ -17,14 +17,25 @@ ******************************************************************************/ package org.alfresco.mobile.android.application.managers; +import org.alfresco.mobile.android.application.R; +import org.alfresco.mobile.android.application.extension.analytics.GAnalyticsManagerImpl; import org.alfresco.mobile.android.application.fragments.config.ConfigMenuEditorFragment; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.extensions.DevToolsManager; +import org.alfresco.mobile.android.ui.holder.HolderUtils; +import org.alfresco.mobile.android.ui.holder.TwoLinesCheckboxViewHolder; +import org.alfresco.mobile.android.ui.holder.TwoLinesViewHolder; import android.content.Context; import android.support.v4.app.FragmentActivity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; public class DevToolsManagerImpl extends DevToolsManager { + public boolean enableManualDispatch = false; + // /////////////////////////////////////////////////////////////////////////// // CONSTRUCTOR // /////////////////////////////////////////////////////////////////////////// @@ -54,4 +65,40 @@ public void displayMenuConfig(FragmentActivity activity) { ConfigMenuEditorFragment.with(activity).display(); } + + @Override + public void generateMenu(final FragmentActivity activity, ViewGroup root) + { + TwoLinesViewHolder vh = HolderUtils.configure(root, R.layout.row_two_lines_borderless, "Menu Editor", + "Tools to edit and manage menu and profiles", -1); + + ((ViewGroup) vh.icon.getParent().getParent()).setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + DevToolsManager.getInstance(activity).displayMenuConfig(activity); + } + }); + + View v = LayoutInflater.from(root.getContext()).inflate(R.layout.row_two_lines_checkbox, root, false); + final TwoLinesCheckboxViewHolder cvh = HolderUtils.configure(v, "Analytics RealTime", + "Switch ON to enable faster realtime analytics", enableManualDispatch); + root.addView(v); + + cvh.choose.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + enableManualDispatch = cvh.choose.isChecked(); + if (AnalyticsManager.getInstance(activity) != null) + { + ((GAnalyticsManagerImpl) AnalyticsManager.getInstance(activity)) + .enableManualDispatch(cvh.choose.isChecked()); + } + } + }); + } + } diff --git a/extensions/analytics/src/main/res/xml/global_tracker.xml b/alfresco-mobile-android/src/debug/res/values/keys.xml similarity index 55% rename from extensions/analytics/src/main/res/xml/global_tracker.xml rename to alfresco-mobile-android/src/debug/res/values/keys.xml index 6e493deb..44026362 100644 --- a/extensions/analytics/src/main/res/xml/global_tracker.xml +++ b/alfresco-mobile-android/src/debug/res/values/keys.xml @@ -1,5 +1,4 @@ - - - - - - TO REPLACE BY RIGHT ID + 100.0 - 5 - true + false + + + false true - 1 + 2 + - - Main - \ No newline at end of file diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/AccountSettingsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/AccountSettingsFragment.java index ec17979a..537a9148 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/AccountSettingsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/AccountSettingsFragment.java @@ -208,6 +208,7 @@ private void recreate() { viewById(R.id.settings_custom_menu_manage_container).setEnabled(false); menuCustomizationVH.bottomText.setText(R.string.settings_custom_menu_disable); + HolderUtils.makeMultiLine(menuCustomizationVH.bottomText, 3); } else { diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java index 970a7a30..5f2b0fb5 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java @@ -122,7 +122,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa boolean isEnable = AnalyticsManager.getInstance(getActivity()).isEnable(); diagnosticVH = HolderUtils.configure(viewById(R.id.settings_diagnostic), - getString(R.string.settings_feedback_diagnostic), getString(R.string.mdm_managed), isEnable); + getString(R.string.settings_feedback_diagnostic), getString(R.string.settings_custom_menu_disable), + isEnable); + HolderUtils.makeMultiLine(diagnosticVH.bottomText, 3); diagnosticVH.choose.setVisibility(View.GONE); diagnosticVH.choose.setEnabled(false); } @@ -166,16 +168,8 @@ public void onClick(View v) if (DevToolsManager.getInstance(getActivity()) != null) { show(R.id.settings_dev_tools_container); - vh = HolderUtils.configure(viewById(R.id.settings_dev_menu_config), "Menu Editor", - "Tools to edit and manage menu and profiles", -1); - viewById(R.id.settings_dev_menu_config_container).setOnClickListener(new View.OnClickListener() - { - @Override - public void onClick(View v) - { - DevToolsManager.getInstance(getActivity()).displayMenuConfig(getActivity()); - } - }); + DevToolsManager.getInstance(getActivity()).generateMenu(getActivity(), + (ViewGroup) viewById(R.id.settings_dev_tools_items)); } else { diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java index 7dae079b..1fc6358d 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java @@ -45,7 +45,7 @@ public class AnalyticHelper extends AnalyticsHelper public static void optIn(Activity activity, AlfrescoAccount account) { - AnalyticsManager.getInstance(activity).optIn(activity, account); + AnalyticsManager.getInstance(activity).optIn(activity); AnalyticsManager.getInstance(activity).startReport(activity); try { @@ -64,7 +64,7 @@ public static void optOut(Activity activity, AlfrescoAccount account) { AnalyticsManager.getInstance(activity).reportEvent(AnalyticsManager.CATEGORY_SETTINGS, AnalyticsManager.ACTION_ANALYTICS, AnalyticsManager.LABEL_DISABLE, 1); - AnalyticsManager.getInstance(activity).optOut(activity, account); + AnalyticsManager.getInstance(activity).optOut(activity); } public static void cleanOpt(Activity activity, AlfrescoAccount account) diff --git a/alfresco-mobile-android/src/main/res/layout/fr_settings.xml b/alfresco-mobile-android/src/main/res/layout/fr_settings.xml index 4f6b40ac..ae855c9c 100644 --- a/alfresco-mobile-android/src/main/res/layout/fr_settings.xml +++ b/alfresco-mobile-android/src/main/res/layout/fr_settings.xml @@ -260,24 +260,11 @@ android:background="?android:attr/dividerVertical" /> - - - - - - + android:orientation="vertical" /> diff --git a/alfresco-mobile-android/src/main/res/values/keys.xml b/alfresco-mobile-android/src/main/res/values/keys.xml new file mode 100644 index 00000000..d2d58c50 --- /dev/null +++ b/alfresco-mobile-android/src/main/res/values/keys.xml @@ -0,0 +1,37 @@ + + + + + + 100.0 + + + false + + + false + + + true + + + 20 + + + \ No newline at end of file diff --git a/extensions/analytics/src/main/java/org/alfresco/mobile/android/application/extension/analytics/GAnalyticsManagerImpl.java b/extensions/analytics/src/main/java/org/alfresco/mobile/android/application/extension/analytics/GAnalyticsManagerImpl.java index 66fbcd43..a414a136 100644 --- a/extensions/analytics/src/main/java/org/alfresco/mobile/android/application/extension/analytics/GAnalyticsManagerImpl.java +++ b/extensions/analytics/src/main/java/org/alfresco/mobile/android/application/extension/analytics/GAnalyticsManagerImpl.java @@ -41,7 +41,7 @@ public class GAnalyticsManagerImpl extends AnalyticsManager private boolean hasOptOut = false; - private static final boolean DISPATCH_MANUALLY = true; + private boolean dispatchManually = false; protected SharedPreferences.Editor editor; @@ -67,18 +67,19 @@ protected GAnalyticsManagerImpl(Context context) { super(context); analytics = GoogleAnalytics.getInstance(context); - mTracker = analytics.newTracker(context.getString(R.string.ga_trackId)); + // Set it via resource to support override mechanism + mTracker = analytics.newTracker(context.getString(R.string.ga_trackingId)); + mTracker.setSampleRate(Double.parseDouble(context.getResources().getString(R.string.ga_sampleFrequency))); + mTracker.enableAutoActivityTracking(context.getResources().getBoolean(R.bool.ga_autoActivityTracking)); + mTracker.enableExceptionReporting(context.getResources().getBoolean(R.bool.ga_reportUncaughtExceptions)); + mTracker.setSessionTimeout(context.getResources().getInteger(R.integer.ga_sessionTimeout)); + + dispatchManually = context.getResources().getBoolean(R.bool.ga_manualDispatch); } // /////////////////////////////////////////////////////////////////////////// // O // /////////////////////////////////////////////////////////////////////////// - public void optOut(Activity activity, AlfrescoAccount account) - { - opt(activity, STATUS_DISABLE, account); - status = getStatus(); - } - public void optOutByConfig(Context context, AlfrescoAccount account) { editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); @@ -93,9 +94,15 @@ public void optInByConfig(Context context, AlfrescoAccount account) status = getStatus(); } - public void optIn(Activity activity, AlfrescoAccount account) + public void optIn(Activity activity) + { + setStatus(STATUS_ENABLE); + status = getStatus(); + } + + public void optOut(Activity activity) { - opt(activity, STATUS_ENABLE, account); + setStatus(STATUS_DISABLE); status = getStatus(); } @@ -137,9 +144,14 @@ public boolean isEnable() public boolean isEnable(AlfrescoAccount account) { - SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); - int tempStatus = sharedPref.getInt(ANALYTICS_PREFIX + account.getId(), STATUS_ENABLE); - return tempStatus == STATUS_ENABLE; + return PreferenceManager.getDefaultSharedPreferences(appContext).getInt(ANALYTICS_PREFIX + account.getId(), + STATUS_ENABLE) == STATUS_ENABLE; + } + + public boolean isBlocked(AlfrescoAccount account) + { + return PreferenceManager.getDefaultSharedPreferences(appContext).getInt(ANALYTICS_PREFIX + account.getId(), + STATUS_ENABLE) == STATUS_BLOCKED; } public boolean isBlocked() @@ -151,7 +163,7 @@ public boolean isBlocked() return status == STATUS_BLOCKED; } - public int getStatus() + private int getStatus() { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); List accounts = AlfrescoAccountManager.retrieveAccounts(appContext); @@ -163,8 +175,8 @@ public int getStatus() switch (tempStatus) { case STATUS_BLOCKED: - resultStatus = STATUS_BLOCKED; - break; + status = STATUS_BLOCKED; + return STATUS_BLOCKED; case STATUS_DISABLE: resultStatus = STATUS_DISABLE; break; @@ -176,51 +188,66 @@ public int getStatus() return status; } + private void setStatus(int status) + { + List accounts = AlfrescoAccountManager.retrieveAccounts(appContext); + for (AlfrescoAccount account : accounts) + { + opt(appContext, status, account); + } + } + // /////////////////////////////////////////////////////////////////////////// // REPORT // /////////////////////////////////////////////////////////////////////////// + @Override public void startReport(Activity activity) { analytics.enableAutoActivityReports(activity.getApplication()); mTracker.send(new HitBuilders.ScreenViewBuilder().setNewSession().build()); } + @Override public void reportScreen(String name) { mTracker.setScreenName(name); mTracker.send(new HitBuilders.ScreenViewBuilder().build()); - if (DISPATCH_MANUALLY) + if (dispatchManually) { analytics.dispatchLocalHits(); } } + @Override public void reportEvent(String category, String action, String label, int value) { mTracker.send(new HitBuilders.EventBuilder().setCategory(category).setAction(action).setLabel(label) .setValue(value).build()); - if (DISPATCH_MANUALLY) + if (dispatchManually) { analytics.dispatchLocalHits(); } } + @Override public void reportEvent(String category, String action, String label, int value, int customMetricId, Long customMetricValue) { mTracker.send(new HitBuilders.EventBuilder().setCategory(category).setAction(action).setLabel(label) .setValue(value).setCustomMetric(customMetricId, customMetricValue).build()); - if (DISPATCH_MANUALLY) + if (dispatchManually) { analytics.dispatchLocalHits(); } } + @Override public void reportInfo(String label, SparseArray dimensions, SparseArray metrics) { reportEvent(CATEGORY_SESSION, ACTION_INFO, label, 1, dimensions, metrics); } + @Override public void reportEvent(String category, String action, String label, int eventValue, SparseArray dimensions, SparseArray metrics) { @@ -248,18 +275,24 @@ public void reportEvent(String category, String action, String label, int eventV } mTracker.send(builder.build()); - if (DISPATCH_MANUALLY) + if (dispatchManually) { analytics.dispatchLocalHits(); } } + @Override public void reportError(boolean isFatal, String description) { mTracker.send(new HitBuilders.ExceptionBuilder().setFatal(isFatal).setDescription(description).build()); - if (DISPATCH_MANUALLY) + if (dispatchManually) { analytics.dispatchLocalHits(); } } + + public void enableManualDispatch(boolean enable) + { + dispatchManually = enable; + } } diff --git a/extensions/analytics/src/main/res/values/keys.xml b/extensions/analytics/src/main/res/values/keys.xml index 2b5bac37..af26a0fc 100644 --- a/extensions/analytics/src/main/res/values/keys.xml +++ b/extensions/analytics/src/main/res/values/keys.xml @@ -1,5 +1,4 @@ - - - TODO + + TODO + + + 100.0 + + + false + + + false + + + true + + + 1 + \ No newline at end of file diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/ConfigurationImpl.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/ConfigurationImpl.java index ad3b9107..8f26c87b 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/ConfigurationImpl.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/model/config/impl/ConfigurationImpl.java @@ -398,7 +398,7 @@ public boolean hasFeatureConfig() public List getFeatureConfig() { - if (featureHelper == null) { return null; } + if (featureHelper == null) { return new ArrayList<>(0); } return featureHelper.getFeatures(); } // /////////////////////////////////////////////////////////////////////////// diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractConfigServiceImpl.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractConfigServiceImpl.java index 0753e310..9b67a209 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractConfigServiceImpl.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractConfigServiceImpl.java @@ -394,7 +394,7 @@ public boolean hasFeatureConfig() @Override public List getFeatureConfig() { - if (configuration == null) { return null; } + if (configuration == null) { return new ArrayList<>(0); } return configuration.getFeatureConfig(); } } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/LocalConfigServiceImpl.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/LocalConfigServiceImpl.java index 29f7abb2..e5d1f82c 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/LocalConfigServiceImpl.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/api/services/impl/LocalConfigServiceImpl.java @@ -282,7 +282,7 @@ public boolean hasFeatureConfig() @Override public List getFeatureConfig() { - if (configuration == null) { return null; } + if (configuration == null) { return new ArrayList<>(0); } return configuration.getFeatureConfig(); } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java index 25b7f3dd..f590b6a6 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java @@ -250,15 +250,26 @@ public static void checkServerConfiguration(Context context, AlfrescoSession ses if (configService != null) { List configs = configService.getFeatureConfig(); + + if (configs.isEmpty() && AnalyticsManager.getInstance(context).isBlocked(acc)) + { + // When server config has been removed we revert + // analytics + // to true + AnalyticsManager.getInstance(context).optInByConfig(context, acc); + } + for (FeatureConfig feature : configs) { if (FeatureConfig.FEATURE_ANALYTICS.equals(feature.getType())) { + // When analytics enable via server config if (feature.isEnable() && !AnalyticsManager.getInstance(context).isEnable(acc)) { AnalyticsManager.getInstance(context).optInByConfig(context, acc); } - else if (!feature.isEnable() && AnalyticsManager.getInstance(context).isEnable(acc)) + // When analytics disable via server config + else if (!feature.isEnable()) { if (AnalyticsManager.getInstance(context).isEnable()) { @@ -266,11 +277,21 @@ else if (!feature.isEnable() && AnalyticsManager.getInstance(context).isEnable(a AnalyticsManager.CATEGORY_SETTINGS, AnalyticsManager.ACTION_ANALYTICS, AnalyticsManager.LABEL_DISABLE_BY_CONFIG, 1); } - AnalyticsManager.getInstance(context).optOutByConfig(context, acc); + + if (!AnalyticsManager.getInstance(context).isBlocked(acc)) + { + AnalyticsManager.getInstance(context).optOutByConfig(context, acc); + } } } } } + else if (AnalyticsManager.getInstance(context).isBlocked(acc)) + { + // When server config has been removed we revert analytics + // to true + AnalyticsManager.getInstance(context).optInByConfig(context, acc); + } } } catch (Exception e) diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java index 134cc5a4..7053cbc9 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java @@ -486,22 +486,32 @@ protected AnalyticsManager(Context applicationContext) // /////////////////////////////////////////////////////////////////////////// public abstract void cleanOptInfo(Context context, AlfrescoAccount account); - public abstract void optOut(Activity activity, AlfrescoAccount account); - public abstract void optOutByConfig(Context context, AlfrescoAccount account); public abstract void optInByConfig(Context context, AlfrescoAccount account); - public abstract void optIn(Activity activity, AlfrescoAccount account); + /** + * OptIn check must be done prior to call this method. + * + * @param activity + */ + public abstract void optIn(Activity activity); + + /** + * optOut check must be done prior to call this method. + * + * @param activity + */ + public abstract void optOut(Activity activity); public abstract boolean isEnable(); public abstract boolean isEnable(AlfrescoAccount account); - public abstract int getStatus(); - public abstract boolean isBlocked(); + public abstract boolean isBlocked(AlfrescoAccount account); + // /////////////////////////////////////////////////////////////////////////// // ABSTRACT METHODS // /////////////////////////////////////////////////////////////////////////// @@ -521,6 +531,9 @@ public abstract void reportEvent(String category, String action, String label, i public abstract void reportError(boolean isFatal, String description); + // /////////////////////////////////////////////////////////////////////////// + // Fragment Interface + // /////////////////////////////////////////////////////////////////////////// public interface FragmentAnalyzed { String getScreenName(); diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/DevToolsManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/DevToolsManager.java index 1501754d..9169eb7f 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/DevToolsManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/DevToolsManager.java @@ -1,26 +1,27 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.platform.extensions; import org.alfresco.mobile.android.platform.Manager; import android.content.Context; import android.support.v4.app.FragmentActivity; +import android.view.ViewGroup; public abstract class DevToolsManager extends Manager { @@ -56,5 +57,7 @@ protected DevToolsManager(Context applicationContext) // /////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /////////////////////////////////////////////////////////////////////////// + public abstract void generateMenu(FragmentActivity activity, ViewGroup view); + public abstract void displayMenuConfig(FragmentActivity activity); } diff --git a/platform/foundation/src/main/res/layout/row_two_lines_checkbox.xml b/platform/foundation/src/main/res/layout/row_two_lines_checkbox.xml index 5123fd77..c076ad08 100644 --- a/platform/foundation/src/main/res/layout/row_two_lines_checkbox.xml +++ b/platform/foundation/src/main/res/layout/row_two_lines_checkbox.xml @@ -51,7 +51,7 @@ style="@style/AlfrescoMaterialTheme.Text.List.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" - tools:text="Plain Text for preview" /> + tools:text="Plain Text for preview ekjgze mlrjg emzlrkj zemljg mzlekjg mezl jgrmzelrjg mzel jgmzerlkjg" /> From 6c96deae9c1d8cb36b72951d04bd42c2459671f6 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Thu, 11 Feb 2016 21:08:23 +0100 Subject: [PATCH 07/35] ANDROID-215 --- .../providers/storage/StorageAccessDocumentsProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/providers/storage/StorageAccessDocumentsProvider.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/providers/storage/StorageAccessDocumentsProvider.java index 849ca64c..25a615a4 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/providers/storage/StorageAccessDocumentsProvider.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/providers/storage/StorageAccessDocumentsProvider.java @@ -985,7 +985,7 @@ private void addRootRow(DocumentFolderCursor result, AlfrescoAccount account) default: break; } - row.add(Root.COLUMN_ICON, R.drawable.ic_application_icon); + row.add(Root.COLUMN_ICON, R.drawable.ic_application_logo); } // ////////////////////////////////////////////////////////////////////// From efd92aaeb6e259fb3597bacce94e1d027c996e40 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Fri, 12 Feb 2016 09:05:35 +0100 Subject: [PATCH 08/35] ANDROID-231 --- alfresco-mobile-android/build.gradle | 2 ++ .../extension/tools/DeveloperSessionManager.java | 8 ++++---- settings.gradle | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/alfresco-mobile-android/build.gradle b/alfresco-mobile-android/build.gradle index b304ea1b..15f71727 100644 --- a/alfresco-mobile-android/build.gradle +++ b/alfresco-mobile-android/build.gradle @@ -110,6 +110,8 @@ android { //DEBUG BUILD TYPE debugCompile project(':extensions:hockeyapp') debugCompile project(':extensions:analytics') + debugCompile project(':extensions:tools') + storeCompile project(':extensions:samsung') storeCompile project(':extensions:scansnap') diff --git a/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java b/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java index 2c4d78c3..c65e6493 100644 --- a/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java +++ b/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java @@ -89,22 +89,22 @@ protected DeveloperSessionManager(Context context) // /////////////////////////////////////////////////////////////////////////// public AlfrescoSessionSettings prepareSettings(AlfrescoAccount acc) { - return new SettingsBuilder(appContext).prepare(acc).build(); + return new DevSettingsBuilder(appContext).prepare(acc).build(); } public AlfrescoSessionSettings prepareSettings(AlfrescoAccount acc, OAuthData data) { - return new SettingsBuilder(appContext).prepare(acc).build(); + return new DevSettingsBuilder(appContext).prepare(acc).build(); } public AlfrescoSessionSettings prepareSettings(String baseUrl, String username, String password) { - return new SettingsBuilder(appContext).prepare(baseUrl, username, password).build(); + return new DevSettingsBuilder(appContext).prepare(baseUrl, username, password).build(); } public AlfrescoSessionSettings prepareSettings(OAuthData oauthData) { - return new SettingsBuilder(appContext).prepare(oauthData).build(); + return new DevSettingsBuilder(appContext).prepare(oauthData).build(); } @Override diff --git a/settings.gradle b/settings.gradle index ecd2d836..41a19245 100644 --- a/settings.gradle +++ b/settings.gradle @@ -23,4 +23,4 @@ // EXTENSIONS // MDM INTEGRATION -include ':alfresco-mobile-android', ':extensions', ':platform:foundation', ':extensions:hockeyapp', ':mdm', ':mdm:mobileiron', ':platform', ':extensions:samsung', ':extensions:scansnap', ':platform:thirdparty', 'extensions:analytics' +include ':alfresco-mobile-android', ':extensions', ':platform:foundation', ':extensions:hockeyapp', ':mdm', ':mdm:mobileiron', ':platform', ':extensions:samsung', ':extensions:scansnap', ':platform:thirdparty', 'extensions:analytics', ':extensions:tools' From 2cb20f4101ceafd1ac44f84e8c0d127fb76e6524 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Fri, 12 Feb 2016 09:15:46 +0100 Subject: [PATCH 09/35] ANDROID-219 --- .../node/browse/NodeChildrenOperation.java | 148 +++++++++++++----- 1 file changed, 113 insertions(+), 35 deletions(-) diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/browse/NodeChildrenOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/browse/NodeChildrenOperation.java index a2531e38..47ab584d 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/browse/NodeChildrenOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/browse/NodeChildrenOperation.java @@ -1,23 +1,26 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.async.node.browse; +import java.net.HttpURLConnection; +import java.util.ArrayList; import java.util.List; +import java.util.Map; import org.alfresco.mobile.android.api.exceptions.AlfrescoServiceException; import org.alfresco.mobile.android.api.model.Folder; @@ -26,6 +29,9 @@ import org.alfresco.mobile.android.api.model.SearchLanguage; import org.alfresco.mobile.android.api.model.Site; import org.alfresco.mobile.android.api.model.impl.cloud.CloudFolderImpl; +import org.alfresco.mobile.android.api.network.NetworkHttpInvoker; +import org.alfresco.mobile.android.api.session.impl.AbstractAlfrescoSessionImpl; +import org.alfresco.mobile.android.api.utils.JsonUtils; import org.alfresco.mobile.android.async.LoaderResult; import org.alfresco.mobile.android.async.OperationAction; import org.alfresco.mobile.android.async.OperationsDispatcher; @@ -33,6 +39,9 @@ import org.alfresco.mobile.android.async.impl.ListingOperation; import org.alfresco.mobile.android.async.utils.ISO9075; import org.alfresco.mobile.android.platform.EventBusManager; +import org.apache.chemistry.opencmis.client.bindings.spi.http.Response; +import org.apache.chemistry.opencmis.commons.impl.JSONConverter; +import org.apache.chemistry.opencmis.commons.impl.UrlBuilder; import android.util.Log; @@ -100,26 +109,56 @@ protected LoaderResult> doInBackground() if (folderTypeId != -1) { List nodes = null; - String query = null; - switch (folderTypeId) + + // Try for 5.X + if (folderTypeId == NodeChildrenRequest.FOLDER_USER_HOMES + && session.getRepositoryInfo().getMajorVersion() >= 5) { - case NodeChildrenRequest.FOLDER_SHARED: - query = "SELECT * FROM cmis:folder WHERE CONTAINS ('QNAME:\"app:company_home/app:shared\"')"; - break; - case NodeChildrenRequest.FOLDER_USER_HOMES: - query = "SELECT * FROM cmis:folder WHERE CONTAINS ('QNAME:\"app:company_home/app:user_homes/cm:" - + ISO9075.encode(session.getPersonIdentifier()) + "\"')"; - break; - default: - break; + try + { + String statement = "SELECT cm:homeFolder FROM cm:person WHERE cm:userName = '%s'"; + String nodeId = getUserHomeIdWithBrowserBinding( + String.format(statement, ISO9075.encode(session.getPersonIdentifier()))); + if (nodeId != null) + { + parentFolder = (Folder) session.getServiceRegistry().getDocumentFolderService() + .getNodeByIdentifier(nodeId); + nodes = new ArrayList<>(1); + nodes.add(parentFolder); + pagingResult = session.getServiceRegistry().getDocumentFolderService() + .getChildren(parentFolder, listingContext); + } + } + catch (Exception e) + { + nodes = null; + } } - nodes = session.getServiceRegistry().getSearchService().search(query, SearchLanguage.CMIS); - if (nodes != null && nodes.size() == 1) + // If not 5.X + if (nodes == null) { - parentFolder = (Folder) nodes.get(0); - pagingResult = session.getServiceRegistry().getDocumentFolderService() - .getChildren(parentFolder, listingContext); + String query = null; + switch (folderTypeId) + { + case NodeChildrenRequest.FOLDER_SHARED: + query = "SELECT * FROM cmis:folder WHERE CONTAINS ('QNAME:\"app:company_home/app:shared\"')"; + break; + case NodeChildrenRequest.FOLDER_USER_HOMES: + query = "SELECT * FROM cmis:folder WHERE CONTAINS ('QNAME:\"app:company_home/app:user_homes/cm:" + + ISO9075.encode(session.getPersonIdentifier()) + "\"')"; + break; + default: + break; + } + + nodes = session.getServiceRegistry().getSearchService().search(query, SearchLanguage.CMIS); + if (nodes != null && nodes.size() == 1) + { + parentFolder = (Folder) nodes.get(0); + pagingResult = session.getServiceRegistry().getDocumentFolderService() + .getChildren(parentFolder, listingContext); + } } } else if (folderPath != null) @@ -127,8 +166,8 @@ else if (folderPath != null) Node n = session.getServiceRegistry().getDocumentFolderService().getChildByPath(folderPath); if (n.isFolder()) { - pagingResult = session.getServiceRegistry().getDocumentFolderService() - .getChildren((Folder) n, listingContext); + pagingResult = session.getServiceRegistry().getDocumentFolderService().getChildren((Folder) n, + listingContext); parentFolder = (Folder) n; } else @@ -144,8 +183,8 @@ else if (parentFolder != null) .getNodeByIdentifier(parentFolder.getIdentifier()); } - pagingResult = session.getServiceRegistry().getDocumentFolderService() - .getChildren(parentFolder, listingContext); + pagingResult = session.getServiceRegistry().getDocumentFolderService().getChildren(parentFolder, + listingContext); } else if (folderIdentifier != null) { @@ -153,8 +192,8 @@ else if (folderIdentifier != null) .getNodeByIdentifier(folderIdentifier); if (n.isFolder()) { - pagingResult = session.getServiceRegistry().getDocumentFolderService() - .getChildren((Folder) n, listingContext); + pagingResult = session.getServiceRegistry().getDocumentFolderService().getChildren((Folder) n, + listingContext); parentFolder = (Folder) n; } else @@ -180,6 +219,45 @@ else if (folderIdentifier != null) return new LoaderResult>(); } + private static final String BINDING_NETWORK_CMISATOM = "/api/-default-/public/cmis/versions/1.1/browser"; + + private String getUserHomeIdWithBrowserBinding(String statement) + { + + try + { + Map> httpHeaders = ((AbstractAlfrescoSessionImpl) session).getAuthenticationProvider() + .getHTTPHeaders(); + + UrlBuilder builder = new UrlBuilder(session.getBaseUrl().concat(BINDING_NETWORK_CMISATOM)); + builder.addParameter("cmisaction", "query"); + builder.addParameter("searchAllVersions", false); + builder.addParameter("skipCount", 0); + builder.addParameter("includeAllowableActions", false); + builder.addParameter("maxItems", 1); + builder.addParameter("includeRelationships", "none"); + builder.addParameter("succinct", true); + builder.addParameter("statement", statement); + + Response resp = NetworkHttpInvoker.invokePOST(builder, null, null, httpHeaders); + if (resp.getResponseCode() == HttpURLConnection.HTTP_OK) + { + // We got our info! + Map json = JsonUtils.parseObject(resp.getStream(), resp.getCharset()); + Map entry = (Map) JSONConverter.getList(json.get("results")).get(0); + List o = (List) ((Map) entry.get("succinctProperties")) + .get("cm:homeFolder"); + return JSONConverter.getJSONStringValue(o.get(0)); + } + } + catch (Exception e) + { + return null; + } + + return null; + } + // /////////////////////////////////////////////////////////////////////////// // UTILS // /////////////////////////////////////////////////////////////////////////// From 56ee9ab74cd4b0b4892c6227860eb60df93e31dd Mon Sep 17 00:00:00 2001 From: jmpascal Date: Fri, 12 Feb 2016 10:30:38 +0100 Subject: [PATCH 10/35] ANDROID-200 --- .../fileexplorer/FileExplorerFragment.java | 90 ++++++----- .../fileexplorer/FileNameDialogFragment.java | 142 ++++++++---------- 2 files changed, 119 insertions(+), 113 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerFragment.java index 0514c522..77905fbd 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileExplorerFragment.java @@ -21,6 +21,10 @@ import java.util.Map; import org.alfresco.mobile.android.application.R; +import org.alfresco.mobile.android.application.activity.BaseActivity; +import org.alfresco.mobile.android.application.activity.MainActivity; +import org.alfresco.mobile.android.application.capture.DeviceCapture; +import org.alfresco.mobile.android.application.capture.DeviceCaptureHelper; import org.alfresco.mobile.android.application.configuration.model.view.LocalConfigModel; import org.alfresco.mobile.android.application.configuration.model.view.LocalFilesConfigModel; import org.alfresco.mobile.android.application.fragments.MenuFragmentHelper; @@ -47,6 +51,7 @@ import org.alfresco.mobile.android.ui.fragments.WaitingDialogFragment; import android.content.ActivityNotFoundException; +import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; @@ -54,13 +59,10 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.SubMenu; import android.view.View; import android.widget.GridView; +import com.cocosw.bottomsheet.BottomSheet; import com.squareup.otto.Subscribe; /** @@ -345,45 +347,46 @@ private void displayNavigation(File file, boolean backstack) // MENU // ////////////////////////////////////////////////////////////////////// @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) + protected View.OnClickListener onPrepareFabClickListener() { - super.onCreateOptionsMenu(menu, inflater); - if (!MenuFragmentHelper.canDisplayFragmentMenu(getActivity())) { return; } - if (mode == MODE_LISTING) + if (!MenuFragmentHelper.canDisplayFragmentMenu(getActivity())) { return null; } + if (mode != MODE_LISTING) { return null; } + return new View.OnClickListener() { - - if (parent != null && privateFolder != null && !parent.getPath().startsWith(privateFolder.getPath())) + @Override + public void onClick(View v) { - MenuItem mi = menu.add(Menu.NONE, R.id.menu_create_folder, Menu.FIRST, R.string.folder_create); - mi.setIcon(R.drawable.ic_add_folder); - mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } - - SubMenu createMenu = menu.addSubMenu(Menu.NONE, R.id.menu_device_capture, Menu.FIRST + 30, - R.string.add_menu); - createMenu.setIcon(android.R.drawable.ic_menu_add); - createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - - createMenu.add(Menu.NONE, R.id.menu_create_document, Menu.FIRST + 1, R.string.create_document); - - createMenu.add(Menu.NONE, R.id.menu_device_capture_camera_photo, Menu.FIRST + 1, R.string.take_photo); - - createMenu.add(Menu.NONE, R.id.menu_device_capture_camera_video, Menu.FIRST + 2, R.string.make_video); + BottomSheet.Builder builder = new BottomSheet.Builder(getActivity(), R.style.M_StyleDialog) + .title(R.string.add_menu); - if (ScanSnapManager.getInstance(getActivity()) != null - && ScanSnapManager.getInstance(getActivity()).hasScanSnapApplication()) - { - createMenu.add(Menu.NONE, R.id.menu_scan_document, Menu.FIRST + 4, R.string.scan); + if (parent != null && privateFolder != null && !parent.getPath().startsWith(privateFolder.getPath())) + { + builder.sheet(R.id.menu_create_folder, R.drawable.ic_repository_light, R.string.folder_create); + } + builder.sheet(R.id.menu_create_document, R.drawable.ic_doc_light, R.string.create_document); + builder.sheet(R.id.menu_device_capture_camera_photo, R.drawable.ic_camera, R.string.take_photo); + builder.sheet(R.id.menu_device_capture_camera_video, R.drawable.ic_videos, R.string.make_video); + builder.sheet(R.id.menu_device_capture_mic_audio, R.drawable.ic_microphone, R.string.record_audio); + if (ScanSnapManager.getInstance(getActivity()) != null + && ScanSnapManager.getInstance(getActivity()).hasScanSnapApplication()) + { + builder.sheet(R.id.menu_scan_document, R.drawable.ic_camera, R.string.scan); + } + builder.grid().listener(new DialogInterface.OnClickListener() + { + @Override + public void onClick(DialogInterface dialog, int which) + { + onOptionsItemSelected(which); + } + }).show(); } - - createMenu.add(Menu.NONE, R.id.menu_device_capture_mic_audio, Menu.FIRST + 3, R.string.record_audio); - } + }; } - @Override - public boolean onOptionsItemSelected(MenuItem item) + public boolean onOptionsItemSelected(int id) { - switch (item.getItemId()) + switch (id) { case R.id.menu_create_folder: createFolder(); @@ -393,8 +396,23 @@ public boolean onOptionsItemSelected(MenuItem item) .newInstance(SessionUtils.getAccount(getActivity()), TAG); dialogft.show(getFragmentManager(), DocumentTypesDialogFragment.TAG); return true; + case R.id.menu_device_capture_camera_photo: + case R.id.menu_device_capture_camera_video: + case R.id.menu_device_capture_mic_audio: + DeviceCapture capture = DeviceCaptureHelper.createDeviceCapture((BaseActivity) getActivity(), id); + if (getActivity() instanceof MainActivity) + { + ((MainActivity) getActivity()).setCapture(capture); + } + return true; + case R.id.menu_scan_document: + if (ScanSnapManager.getInstance(getActivity()) != null) + { + ScanSnapManager.getInstance(getActivity()).startPresetChooser(getActivity()); + } + return true; } - return super.onOptionsItemSelected(item); + return false; } // ////////////////////////////////////////////////////////////////////// diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileNameDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileNameDialogFragment.java index 17c50fbc..f2760fed 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileNameDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/fileexplorer/FileNameDialogFragment.java @@ -28,6 +28,7 @@ import org.alfresco.mobile.android.ui.operation.OperationWaitingDialogFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; +import android.app.Dialog; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.DialogFragment; @@ -35,13 +36,12 @@ import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; -import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.view.ViewGroup.LayoutParams; -import android.view.Window; import android.view.WindowManager; -import android.widget.Button; -import android.widget.EditText; + +import com.afollestad.materialdialogs.DialogAction; +import com.afollestad.materialdialogs.MaterialDialog; +import com.rengwuxian.materialedittext.MaterialEditText; public class FileNameDialogFragment extends DialogFragment { @@ -90,24 +90,12 @@ public static DialogFragment newInstance(File parent, File fileToRename) return adf; } - @Override - public void onStart() + // /////////////////////////////////////////////////////////////////////////// + // LIFECYCLE + // /////////////////////////////////////////////////////////////////////////// + public Dialog onCreateDialog(Bundle savedInstanceState) { - getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); - if (fileToRename != null) - { - getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_edit); - } - else - { - getDialog().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.mime_folder); - } - super.onStart(); - } - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) - { // Init File if (getArguments().containsKey(ARGUMENT_FILE_RENAME)) { @@ -115,34 +103,24 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa } parentFile = (File) getArguments().get(ARGUMENT_FOLDER); + String title = null; if (fileToRename != null) { - getDialog().setTitle(getString(R.string.action_rename) + " : " + fileToRename.getName()); + title = getString(R.string.action_rename) + " : " + fileToRename.getName(); } else { - getDialog().setTitle(R.string.folder_create); + title = getString(R.string.folder_create); } - getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON); - - ViewGroup v = (ViewGroup) inflater.inflate(R.layout.app_create_document, container, false); + LayoutInflater inflater = LayoutInflater.from(getActivity()); + final View v = inflater.inflate(R.layout.app_create_document, (ViewGroup) this.getView()); - int width = (int) Math - .round(UIUtils.getScreenDimension(getActivity())[0] - * (Float.parseFloat(getResources().getString(android.R.dimen.dialog_min_width_major).replace( - "%", "")) * 0.01)); - v.setLayoutParams(new LayoutParams(width, LayoutParams.MATCH_PARENT)); - - final EditText textName = ((EditText) v.findViewById(R.id.document_name)); - final Button validate = UIUtils.initValidation(v, R.string.create); - validate.setEnabled(false); - final Button cancel = UIUtils.initCancel(v, R.string.cancel); + final MaterialEditText textName = ((MaterialEditText) v.findViewById(R.id.document_name)); if (fileToRename != null) { textName.setText("." + IOUtils.extractFileExtension(fileToRename.getName())); - validate.setText(R.string.ok); } textName.addTextChangedListener(new TextWatcher() @@ -151,16 +129,16 @@ public void afterTextChanged(Editable s) { if (s.length() > 0) { - validate.setEnabled(true); + ((MaterialDialog) getDialog()).getActionButton(DialogAction.POSITIVE).setEnabled(true); if (UIUtils.hasInvalidName(s.toString().trim())) { textName.setError(getString(R.string.filename_error_character)); - validate.setEnabled(false); + ((MaterialDialog) getDialog()).getActionButton(DialogAction.POSITIVE).setEnabled(false); } else if ((new File(parentFile, s.toString().trim()).exists())) { textName.setError(getString(R.string.create_document_filename_error)); - validate.setEnabled(false); + ((MaterialDialog) getDialog()).getActionButton(DialogAction.POSITIVE).setEnabled(false); } else { @@ -169,7 +147,7 @@ else if ((new File(parentFile, s.toString().trim()).exists())) } else { - validate.setEnabled(false); + ((MaterialDialog) getDialog()).getActionButton(DialogAction.POSITIVE).setEnabled(false); textName.setError(null); } } @@ -183,47 +161,57 @@ public void onTextChanged(CharSequence s, int start, int before, int count) } }); - validate.setOnClickListener(new OnClickListener() - { - public void onClick(View v) - { - UIUtils.hideKeyboard(getActivity()); + MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).iconRes(R.drawable.ic_application_logo) + .title(title).customView(v, true).positiveText((fileToRename != null) ? R.string.ok : R.string.create) + .negativeText(R.string.cancel).callback(new MaterialDialog.ButtonCallback() { - if (fileToRename != null) - { - String operationId = Operator.with(getActivity()).load( - new RenameFileRequest.Builder(fileToRename, textName.getText().toString().trim()) - .setNotificationVisibility(OperationRequest.VISIBILITY_DIALOG)); + @Override + public void onNegative(MaterialDialog dialog) { + dialog.dismiss(); + } - OperationWaitingDialogFragment.newInstance(CreateDirectoryRequest.TYPE_ID, R.drawable.ic_edit, - getString(R.string.action_rename), null, null, 0, operationId).show( - getActivity().getSupportFragmentManager(), OperationWaitingDialogFragment.TAG); - } - else - { - String operationId = Operator.with(getActivity()).load( - new CreateDirectoryRequest.Builder((File) getArguments().get(ARGUMENT_FOLDER), textName - .getText().toString().trim()) - .setNotificationVisibility(OperationRequest.VISIBILITY_DIALOG)); - - OperationWaitingDialogFragment.newInstance(CreateDirectoryRequest.TYPE_ID, - R.drawable.ic_add_folder, getString(R.string.folder_create), null, null, 0, operationId) - .show(getActivity().getSupportFragmentManager(), OperationWaitingDialogFragment.TAG); - } + @Override + public void onPositive(MaterialDialog dialog) { + UIUtils.hideKeyboard(getActivity()); + + if (fileToRename != null) { + String operationId = Operator.with(getActivity()) + .load(new RenameFileRequest.Builder(fileToRename, + textName.getText().toString().trim()) + .setNotificationVisibility(OperationRequest.VISIBILITY_DIALOG)); + + OperationWaitingDialogFragment + .newInstance(CreateDirectoryRequest.TYPE_ID, R.drawable.ic_edit, + getString(R.string.action_rename), null, null, 0, operationId) + .show(getActivity().getSupportFragmentManager(), + OperationWaitingDialogFragment.TAG); + } else { + String operationId = Operator.with(getActivity()) + .load(new CreateDirectoryRequest.Builder((File) getArguments().get(ARGUMENT_FOLDER), + textName.getText().toString().trim()) + .setNotificationVisibility(OperationRequest.VISIBILITY_DIALOG)); + + OperationWaitingDialogFragment + .newInstance(CreateDirectoryRequest.TYPE_ID, R.drawable.ic_add_folder, + getString(R.string.folder_create), null, null, 0, operationId) + .show(getActivity().getSupportFragmentManager(), + OperationWaitingDialogFragment.TAG); + } + + dismiss(); + } + }).build(); - dismiss(); - } - }); + dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false); - cancel.setOnClickListener(new OnClickListener() - { - public void onClick(View v) - { - FileNameDialogFragment.this.dismiss(); - } - }); + return dialog; + } - return v; + @Override + public void onStart() + { + getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); + super.onStart(); } @Override From 77c4d7232c762a719ad317399e7fb5ff2322b5b8 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Fri, 12 Feb 2016 10:31:23 +0100 Subject: [PATCH 11/35] ANDROID-238 ANDROID-239 --- .../preferences/GeneralPreferences.java | 14 +++ .../application/managers/ActionUtils.java | 110 ++++++++++++++++-- .../src/main/res/layout/fr_settings.xml | 23 +++- .../src/main/res/values/strings.xml | 3 +- 4 files changed, 139 insertions(+), 11 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java index 5f2b0fb5..ca086f81 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java @@ -115,6 +115,20 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa setRootView(inflater.inflate(R.layout.fr_settings, container, false)); TwoLinesViewHolder vh; + + // Feedback - Email + vh = HolderUtils.configure(viewById(R.id.settings_feedback_email_container), + getString(R.string.settings_feedback_email), getString(R.string.settings_feedback_email_summary), -1); + HolderUtils.makeMultiLine(vh.bottomText, 3); + viewById(R.id.settings_feedback_email_container).setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + ActionUtils.actionSendFeedbackEmail(GeneralPreferences.this); + } + }); + // Feedback - Analytics if (AnalyticsManager.getInstance(getActivity()) == null || AnalyticsManager.getInstance(getActivity()).isBlocked()) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java index 3dd103ed..1701223d 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java @@ -19,8 +19,10 @@ import java.io.File; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; +import java.util.Map; import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.application.activity.PublicDispatcherActivity; @@ -39,11 +41,13 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; +import android.os.Build; import android.speech.RecognizerIntent; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.text.Html; import android.text.TextUtils; +import android.util.DisplayMetrics; import android.util.Log; /** @@ -81,7 +85,8 @@ public static void actionOpenIn(Fragment fr, File myFile) // /////////////////////////////////////////////////////////////////////////// // ACTION VIEW // /////////////////////////////////////////////////////////////////////////// - public static void actionView(FragmentActivity context, File myFile, String mimeType, ActionManagerListener listener) + public static void actionView(FragmentActivity context, File myFile, String mimeType, + ActionManagerListener listener) { Intent intent = new Intent(Intent.ACTION_VIEW); Uri data = Uri.fromFile(myFile); @@ -151,8 +156,8 @@ public static Intent createViewIntent(FragmentActivity activity, File contentFil { Intent intent = new Intent(Intent.ACTION_VIEW); Uri data = Uri.fromFile(contentFile); - intent.setDataAndType(data, MimeTypeManager.getInstance(activity).getMIMEType(contentFile.getName()) - .toLowerCase()); + intent.setDataAndType(data, + MimeTypeManager.getInstance(activity).getMIMEType(contentFile.getName()).toLowerCase()); return intent; } @@ -238,8 +243,8 @@ public static void actionSend(FragmentActivity activity, File contentFile, Strin Intent i = new Intent(Intent.ACTION_SEND); i.putExtra(Intent.EXTRA_SUBJECT, contentFile.getName()); i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(contentFile)); - i.setType((TextUtils.isEmpty(mimetype)) ? MimeTypeManager.getInstance(activity).getMIMEType( - contentFile.getName()) : mimetype); + i.setType((TextUtils.isEmpty(mimetype)) + ? MimeTypeManager.getInstance(activity).getMIMEType(contentFile.getName()) : mimetype); if (i.resolveActivity(activity.getPackageManager()) == null) { @@ -501,8 +506,8 @@ public static void startPlayStore(Context context, String appPackage) } catch (android.content.ActivityNotFoundException anfe) { - context.startActivity(new Intent(Intent.ACTION_VIEW, Uri -.parse("https://play.google.com/store/apps/details?type=" + appPackageName))); + context.startActivity(new Intent(Intent.ACTION_VIEW, + Uri.parse("https://play.google.com/store/apps/details?type=" + appPackageName))); } } @@ -519,4 +524,95 @@ public static void startWebBrowser(Context context, String url) } } + public static boolean actionSendFeedbackEmail(Fragment fr) + { + try + { + Context context = fr.getContext(); + + Intent i = new Intent(Intent.ACTION_SEND); + i.setType("message/rfc822"); + + // Email + i.putExtra(Intent.EXTRA_EMAIL, context.getResources() + .getStringArray(org.alfresco.mobile.android.foundation.R.array.bugreport_email)); + + // Prepare Subject + String versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; + int versionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; + + String subject = "Android APP %s Feedback"; + i.putExtra(Intent.EXTRA_SUBJECT, String.format(subject, versionName)); + + // Content + DisplayMetrics dm = context.getResources().getDisplayMetrics(); + String densityBucket = getDensityString(dm); + + Map info = new LinkedHashMap<>(); + info.put("Version", versionName); + info.put("Version code", Integer.toString(versionCode)); + info.put("Make", Build.MANUFACTURER); + info.put("Model", Build.MODEL); + info.put("Resolution", dm.heightPixels + "x" + dm.widthPixels); + info.put("Density", dm.densityDpi + "dpi (" + densityBucket + ")"); + info.put("Release", Build.VERSION.RELEASE); + info.put("API", String.valueOf(Build.VERSION.SDK_INT)); + info.put("Language", context.getResources().getConfiguration().locale.getDisplayLanguage()); + + StringBuilder builder = new StringBuilder(); + builder.append("\n\n\n\n"); + builder.append("Technical informations\n"); + builder.append("-------------------\n").toString(); + for (Map.Entry entry : info.entrySet()) + { + builder.append(entry.getKey()).append(": ").append(entry.getValue()).append('\n'); + } + + builder.append("-------------------\n\n").toString(); + i.putExtra(Intent.EXTRA_TEXT, builder.toString()); + + if (i.resolveActivity(fr.getActivity().getPackageManager()) == null) + { + AlfrescoNotificationManager.getInstance(fr.getActivity()).showAlertCrouton(fr.getActivity(), + fr.getString(R.string.error_general)); + return false; + } + + fr.startActivity(Intent.createChooser(i, fr.getString(R.string.send_email))); + + return true; + } + catch (Exception e) + { + AlfrescoNotificationManager.getInstance(fr.getActivity()).showAlertCrouton(fr.getActivity(), + R.string.error_general); + Log.d(TAG, Log.getStackTraceString(e)); + } + + return false; + } + + private static String getDensityString(DisplayMetrics displayMetrics) + { + switch (displayMetrics.densityDpi) + { + case DisplayMetrics.DENSITY_LOW: + return "ldpi"; + case DisplayMetrics.DENSITY_MEDIUM: + return "mdpi"; + case DisplayMetrics.DENSITY_HIGH: + return "hdpi"; + case DisplayMetrics.DENSITY_XHIGH: + return "xhdpi"; + case DisplayMetrics.DENSITY_XXHIGH: + return "xxhdpi"; + case DisplayMetrics.DENSITY_XXXHIGH: + return "xxxhdpi"; + case DisplayMetrics.DENSITY_TV: + return "tvdpi"; + default: + return "unknown"; + } + } + } diff --git a/alfresco-mobile-android/src/main/res/layout/fr_settings.xml b/alfresco-mobile-android/src/main/res/layout/fr_settings.xml index ae855c9c..362600fb 100644 --- a/alfresco-mobile-android/src/main/res/layout/fr_settings.xml +++ b/alfresco-mobile-android/src/main/res/layout/fr_settings.xml @@ -168,15 +168,16 @@ android:background="@color/secondary_background" android:orientation="vertical"> + @@ -187,6 +188,22 @@ android:layout_marginLeft="@dimen/d_8" android:layout_marginRight="@dimen/d_8" android:background="?android:attr/dividerVertical" /> + + + + + + + + Feedback Send Diagnostics To help us improve Alfresco Mobile, we collect anonymous technical diagnostic data. Switch off if preferred. - + Send Feedback + Send comments and suggestions anytime From 93ff5a4835001c9758ed10258cc3e0b601a701de Mon Sep 17 00:00:00 2001 From: jmpascal Date: Fri, 12 Feb 2016 11:05:07 +0100 Subject: [PATCH 12/35] ANDROID-246 --- .../src/main/res/values-de/strings.xml | 8 ++++---- .../src/main/res/values-es/strings.xml | 8 ++++---- .../src/main/res/values-fr/strings.xml | 8 ++++---- .../src/main/res/values-it/strings.xml | 8 ++++---- .../src/main/res/values-ja/strings.xml | 8 ++++---- .../src/main/res/values-zh-rCN/strings.xml | 8 ++++---- alfresco-mobile-android/src/main/res/values/strings.xml | 8 ++++---- .../src/main/res/values-de/alfresco_strings.xml | 4 ++-- .../src/main/res/values-es/alfresco_strings.xml | 2 +- .../src/main/res/values-fr/alfresco_strings.xml | 4 ++-- .../src/main/res/values-it/alfresco_strings.xml | 4 ++-- .../src/main/res/values-ja/alfresco_strings.xml | 4 ++-- .../src/main/res/values-zh-rCN/alfresco_strings.xml | 4 ++-- .../foundation/src/main/res/values/alfresco_strings.xml | 2 +- 14 files changed, 40 insertions(+), 40 deletions(-) diff --git a/alfresco-mobile-android/src/main/res/values-de/strings.xml b/alfresco-mobile-android/src/main/res/values-de/strings.xml index b95a1b58..e8f6d5b5 100644 --- a/alfresco-mobile-android/src/main/res/values-de/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-de/strings.xml @@ -52,7 +52,7 @@ Alfresco One oder - Alfresco Cloud + Alfresco in the Cloud Account Account hinzufügen @@ -74,7 +74,7 @@ Alfresco Account-Informationen werden verifiziert… - Alfresco Cloud + Alfresco in the Cloud Alfresco Server @@ -173,7 +173,7 @@ SDK: Alfresco Mobile stellt eine Verbindung zu Alfresco in der Cloud und zu den lokalen Alfresco Servern (3.4 und höher) her, um unterwegs einen sicheren Zugriff auf Unternehmensinhalte zu ermöglichen.

+

Alfresco Mobile stellt eine Verbindung zu Alfresco in the Cloud und zu den lokalen Alfresco Servern (3.4 und höher) her, um unterwegs einen sicheren Zugriff auf Unternehmensinhalte zu ermöglichen.

Alfresco Mobile stellt mithilfe Ihrer Alfresco Anmeldeinformationen eine Verbindung zu Ihrem Alfresco Repository (über HTTP oder HTTPS) her und verwaltet den Benutzerzugriff basierend auf deren Berechtigungen.

]]> @@ -733,7 +733,7 @@ Synchronisierter Inhalt Ordner "Favoriten" Alfresco - Alfresco Cloud + Alfresco in the Cloud Alfresco vor Ort diff --git a/alfresco-mobile-android/src/main/res/values-es/strings.xml b/alfresco-mobile-android/src/main/res/values-es/strings.xml index 7d641405..7046b066 100644 --- a/alfresco-mobile-android/src/main/res/values-es/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-es/strings.xml @@ -52,7 +52,7 @@ Alfresco One O - Alfresco Cloud + Alfresco in the Cloud Cuenta Añadir una cuenta @@ -74,7 +74,7 @@ Verificando información de cuenta de Alfresco… - Alfresco Cloud + Alfresco in the Cloud Servidor de Alfresco @@ -173,7 +173,7 @@ SDK: Alfresco Mobile se conecta a Alfresco en la nube y servidores en instalaciones de Alfresco (3.4 y superior) para proporcionar acceso seguro a su contenido corporativo cuando no esté en la oficina.

+

Alfresco Mobile se conecta a Alfresco in the Cloud y servidores en instalaciones de Alfresco (3.4 y superior) para proporcionar acceso seguro a su contenido corporativo cuando no esté en la oficina.

Alfresco Mobile se conecta a su repositorio de Alfresco usando las credenciales de inicio de sesión de Alfresco (en HTTP o HTTPS) y gestiona el acceso del usuario basado en sus permisos.

]]> @@ -733,7 +733,7 @@ Contenido sincronizado Carpeta de favoritos Alfresco - Alfresco Cloud + Alfresco in the Cloud Alfresco On Premise diff --git a/alfresco-mobile-android/src/main/res/values-fr/strings.xml b/alfresco-mobile-android/src/main/res/values-fr/strings.xml index 32afb9a5..5552c0c9 100644 --- a/alfresco-mobile-android/src/main/res/values-fr/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-fr/strings.xml @@ -52,7 +52,7 @@ Alfresco One Ou - Alfresco Cloud + Alfresco in the Cloud Compte Ajouter un compte @@ -74,7 +74,7 @@ Vérification des informations du compte Alfresco… - Alfresco Cloud + Alfresco in the Cloud Serveur Alfresco @@ -173,7 +173,7 @@ SDK : Alfresco Mobile se connecte aux serveurs Alfresco dans le Cloud et Alfresco sur site (3.4 et supérieur) pour fournir un accès sécurisé à vos contenus en mode mobile.

+

Alfresco Mobile se connecte aux serveurs Alfresco in the Cloud et Alfresco sur site (3.4 et supérieur) pour fournir un accès sécurisé à vos contenus en mode mobile.

Alfresco Mobile se connecte à votre entrepôt Alfresco au moyen de vos identifiants Alfresco (par HTTP ou HTTPS), et gère les accès des utilisateurs en fonction de leurs autorisations.

]]> @@ -733,7 +733,7 @@ Contenu synchronisé Dossier Favoris Alfresco - Alfresco Cloud + Alfresco in the Cloud Alfresco sur site diff --git a/alfresco-mobile-android/src/main/res/values-it/strings.xml b/alfresco-mobile-android/src/main/res/values-it/strings.xml index 8fd81d47..790f895d 100644 --- a/alfresco-mobile-android/src/main/res/values-it/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-it/strings.xml @@ -52,7 +52,7 @@ Alfresco One o - Alfresco Cloud + Alfresco in the Cloud Account Aggiungi un account @@ -74,7 +74,7 @@ Verifica informazioni account Alfresco in corso… - Alfresco Cloud + Alfresco in the Cloud Server Alfresco @@ -173,7 +173,7 @@ SDK: Alfresco Mobile si connette ad Alfresco Cloud e on premise (v3.4 e successive) per garantire un accesso sicuro ai contenuti aziendali sempre e ovunque.

+

Alfresco Mobile si connette ad Alfresco in the Cloud e on premise (v3.4 e successive) per garantire un accesso sicuro ai contenuti aziendali sempre e ovunque.

Alfresco Mobile si connette al repository Alfresco con le credenziali di accesso ad Alfresco (su HTTP o HTTPS) e gestisce l\'accesso degli utenti in base ai permessi utente.

]]> @@ -733,7 +733,7 @@ Contenuti sincronizzati Cartella dei preferiti Alfresco - Alfresco Cloud + Alfresco in the Cloud Alfresco on premise diff --git a/alfresco-mobile-android/src/main/res/values-ja/strings.xml b/alfresco-mobile-android/src/main/res/values-ja/strings.xml index 9647bc81..64bed60b 100644 --- a/alfresco-mobile-android/src/main/res/values-ja/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-ja/strings.xml @@ -52,7 +52,7 @@ Alfresco One または - Alfresco Cloud + Alfresco in the Cloud アカウント アカウントを追加してください @@ -74,7 +74,7 @@ Alfresco アカウント情報を確認しています… - Alfresco Cloud + Alfresco in the Cloud Alfresco Server @@ -173,7 +173,7 @@ SDK: Alfresco Mobile は Alfresco Cloud とオンプレミスの Alfresco Server (3.4 以上) に接続して、社内のコンテンツに外出先から安全にアクセスできるようにします。

+

Alfresco Mobile は Alfresco in the Cloud とオンプレミスの Alfresco Server (3.4 以上) に接続して、社内のコンテンツに外出先から安全にアクセスできるようにします。

Alfresco Mobile は、Alfresco のログイン資格情報を使用して (HTTP または HTTPS 経由で) Alfresco のリポジトリに接続し、権限に基づいてユーザーのアクセスを管理します。

]]> @@ -733,7 +733,7 @@ 同期されているコンテンツ [お気に入り] フォルダ Alfresco - Alfresco Cloud + Alfresco in the Cloud Alfresco On Premise diff --git a/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml b/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml index b73ed1c7..53c3c008 100644 --- a/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml @@ -52,7 +52,7 @@ Alfresco One 或者 - Alfresco Cloud + Alfresco in the Cloud 帐户 添加一个帐户 @@ -74,7 +74,7 @@ 正在验证 Alfresco 帐户信息… - Alfresco Cloud + Alfresco in the Cloud Alfresco 服务器 @@ -173,7 +173,7 @@ SDK: Alfresco Mobile 连接至 Alfresco Cloud 和 Alfresco 内部部署服务器(3.4 及以上版本)以便安全访问当前您的企业内容。

+

Alfresco Mobile 连接至 Alfresco in the Cloud 和 Alfresco 内部部署服务器(3.4 及以上版本)以便安全访问当前您的企业内容。

Alfresco Mobile 使用 Alfresco 登录凭证(通过 HTTP 或 HTTPS)与您的 Alfresco 存储库连接,并且根据用户的权限管理用户访问。

]]> @@ -733,7 +733,7 @@ 已同步内容 收藏夹文件夹 Alfresco - Alfresco Cloud + Alfresco in the Cloud Alfresco 内部部署 diff --git a/alfresco-mobile-android/src/main/res/values/strings.xml b/alfresco-mobile-android/src/main/res/values/strings.xml index 5acb4ab8..9e93e356 100644 --- a/alfresco-mobile-android/src/main/res/values/strings.xml +++ b/alfresco-mobile-android/src/main/res/values/strings.xml @@ -52,7 +52,7 @@ Alfresco One Or - Alfresco Cloud + Alfresco in the Cloud Account Add an account @@ -74,7 +74,7 @@ Verifying Alfresco Account Information… - Alfresco Cloud + Alfresco in the Cloud Alfresco Server @@ -173,7 +173,7 @@ SDK: Alfresco Mobile connects to Alfresco in the cloud and Alfresco on premise servers (3.4 and above) to provide safe access to your corporate content on the go.

+

Alfresco Mobile connects to Alfresco in the Cloud and Alfresco on premise servers (3.4 and above) to provide safe access to your corporate content on the go.

Alfresco Mobile connects to your Alfresco repository using your Alfresco log-in credentials (over HTTP or HTTPS), and manages user access based on their permissions.

]]> @@ -737,7 +737,7 @@ Synced Content Favorites Folder Alfresco - Alfresco Cloud + Alfresco in the Cloud Alfresco On Premise diff --git a/platform/foundation/src/main/res/values-de/alfresco_strings.xml b/platform/foundation/src/main/res/values-de/alfresco_strings.xml index 0ff6e29d..0391e3cb 100644 --- a/platform/foundation/src/main/res/values-de/alfresco_strings.xml +++ b/platform/foundation/src/main/res/values-de/alfresco_strings.xml @@ -278,7 +278,7 @@ Überprüfen Sie Ihre Alfresco Account-Einstellungen und versuchen Sie es erneut.
Kontaktieren Sie Ihren Administrator, falls das Problem weiterhin besteht.]]>
-Alfresco in der Cloud ist derzeit überlastet!

+Alfresco in the Cloud ist derzeit überlastet!

Bitte versuchen Sie es in einigen Minuten erneut.
]]>
Ihre Sitzung ist abgelaufen. Melden Sie sich erneut an. @@ -304,7 +304,7 @@ Account-Informationen werden verifiziert… Sie können Ihren Account jetzt verwenden. Alfresco Server - Alfresco Cloud + Alfresco in the Cloud Bitte warten diff --git a/platform/foundation/src/main/res/values-es/alfresco_strings.xml b/platform/foundation/src/main/res/values-es/alfresco_strings.xml index 045ef850..50a04d68 100644 --- a/platform/foundation/src/main/res/values-es/alfresco_strings.xml +++ b/platform/foundation/src/main/res/values-es/alfresco_strings.xml @@ -304,7 +304,7 @@ Verificando información de cuenta… Su cuenta está lista para usarse. Servidor de Alfresco - Alfresco Cloud + Alfresco in the Cloud Espere diff --git a/platform/foundation/src/main/res/values-fr/alfresco_strings.xml b/platform/foundation/src/main/res/values-fr/alfresco_strings.xml index 0aab65b6..f0654235 100644 --- a/platform/foundation/src/main/res/values-fr/alfresco_strings.xml +++ b/platform/foundation/src/main/res/values-fr/alfresco_strings.xml @@ -278,7 +278,7 @@ Vérifiez vos paramètres de compte Alfresco et réessayez.
Si le problème persiste, contactez votre administrateur.]]>
-Alfresco Cloud est actuellement surchargé !

+Alfresco in the Cloud est actuellement surchargé !

Réessayez dans quelques minutes.
]]>
Votre session a expiré. Veuillez vous reconnecter. @@ -304,7 +304,7 @@ Vérification des informations du compte… Vous pouvez maintenant utiliser votre compte. Serveur Alfresco - Alfresco Cloud + Alfresco in the Cloud Veuillez patienter diff --git a/platform/foundation/src/main/res/values-it/alfresco_strings.xml b/platform/foundation/src/main/res/values-it/alfresco_strings.xml index 827a49d9..c6f590e2 100644 --- a/platform/foundation/src/main/res/values-it/alfresco_strings.xml +++ b/platform/foundation/src/main/res/values-it/alfresco_strings.xml @@ -278,7 +278,7 @@ Verificare le impostazioni dell\'account Alfresco e riprovare.
Se il problema persiste, contattare l\'amministratore.]]>
-Il carico di lavoro di Alfresco Cloud è al momento eccessivo.

+Il carico di lavoro di Alfresco in the Cloud è al momento eccessivo.

Riprovare tra qualche minuto.
]]>
La sessione è scaduta. Ripetere l\'accesso. @@ -304,7 +304,7 @@ Verifica delle informazioni account in corso… Account pronto per l\'utilizzo. Server Alfresco - Alfresco Cloud + Alfresco in the Cloud Attendere diff --git a/platform/foundation/src/main/res/values-ja/alfresco_strings.xml b/platform/foundation/src/main/res/values-ja/alfresco_strings.xml index d7959e76..5459db1d 100644 --- a/platform/foundation/src/main/res/values-ja/alfresco_strings.xml +++ b/platform/foundation/src/main/res/values-ja/alfresco_strings.xml @@ -278,7 +278,7 @@ Alfresco アカウントの設定を確認してから、もう一度やり直してください。
問題が解決しない場合は、管理者に問い合わせてください。]]>
-Alfresco Cloud は現在大量の処理を行っています。

+Alfresco in the Cloud は現在大量の処理を行っています。

しばらくしてから、操作をやり直してください。
]]>
セッションの期限が切れています。 もう一度サインインしてください。 @@ -304,7 +304,7 @@ アカウント情報を確認しています… アカウントを使用する準備ができました。 Alfresco Server - Alfresco Cloud + Alfresco in the Cloud お待ちください diff --git a/platform/foundation/src/main/res/values-zh-rCN/alfresco_strings.xml b/platform/foundation/src/main/res/values-zh-rCN/alfresco_strings.xml index 863bcc26..64888fd3 100644 --- a/platform/foundation/src/main/res/values-zh-rCN/alfresco_strings.xml +++ b/platform/foundation/src/main/res/values-zh-rCN/alfresco_strings.xml @@ -278,7 +278,7 @@ 请检查您的 Alfresco 帐户设置并重试。
如果问题仍然存在,请联系您的管理员。]]>
-Alfresco Cloud 现在非常繁忙!

+Alfresco in the Cloud 现在非常繁忙!

请过几分钟再试。
]]>
您的会话已过期。请重新登录。 @@ -304,7 +304,7 @@ 正在验证帐户信息… 您的帐户已可使用。 Alfresco 服务器 - Alfresco Cloud + Alfresco in the Cloud 请稍候 diff --git a/platform/foundation/src/main/res/values/alfresco_strings.xml b/platform/foundation/src/main/res/values/alfresco_strings.xml index fb5a2f37..513dcf32 100644 --- a/platform/foundation/src/main/res/values/alfresco_strings.xml +++ b/platform/foundation/src/main/res/values/alfresco_strings.xml @@ -305,7 +305,7 @@ Verifying Account Information… Your account is ready for you to use. Alfresco Server - Alfresco Cloud + Alfresco in the Cloud Please wait From 1e2c1b7aecfcf33e26edb0b761b18e06194ccae2 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 15 Feb 2016 10:00:30 +0100 Subject: [PATCH 13/35] ANDROID-207 --- .../src/main/res/layout/app_pick_person.xml | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/alfresco-mobile-android/src/main/res/layout/app_pick_person.xml b/alfresco-mobile-android/src/main/res/layout/app_pick_person.xml index fd85d4f2..46c8e95e 100644 --- a/alfresco-mobile-android/src/main/res/layout/app_pick_person.xml +++ b/alfresco-mobile-android/src/main/res/layout/app_pick_person.xml @@ -1,19 +1,20 @@ + ~ Copyright (C) 2005-2016 Alfresco Software Limited. + ~ + ~ This file is part of Alfresco Mobile for Android. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> Date: Mon, 15 Feb 2016 10:03:24 +0100 Subject: [PATCH 14/35] ANDROID-238 ANDROID-239 --- .../fragments/preferences/GeneralPreferences.java | 6 +++--- .../mobile/android/application/managers/ActionUtils.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java index ca086f81..2d26e818 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java @@ -118,8 +118,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa // Feedback - Email vh = HolderUtils.configure(viewById(R.id.settings_feedback_email_container), - getString(R.string.settings_feedback_email), getString(R.string.settings_feedback_email_summary), -1); - HolderUtils.makeMultiLine(vh.bottomText, 3); + getString(R.string.settings_feedback_email), null, -1); + // HolderUtils.makeMultiLine(vh.bottomText, 3); viewById(R.id.settings_feedback_email_container).setOnClickListener(new View.OnClickListener() { @Override @@ -149,7 +149,7 @@ public void onClick(View v) diagnosticVH = HolderUtils.configure(viewById(R.id.settings_diagnostic), getString(R.string.settings_feedback_diagnostic), getString(R.string.settings_feedback_diagnostic_summary), isEnable); - HolderUtils.makeMultiLine(diagnosticVH.bottomText, 3); + HolderUtils.makeMultiLine(diagnosticVH.bottomText, 4); diagnosticVH.choose.setOnClickListener(new View.OnClickListener() { @Override diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java index 1701223d..b0c79292 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java @@ -561,7 +561,7 @@ public static boolean actionSendFeedbackEmail(Fragment fr) StringBuilder builder = new StringBuilder(); builder.append("\n\n\n\n"); - builder.append("Technical informations\n"); + builder.append("Alfresco Mobile and device details\n"); builder.append("-------------------\n").toString(); for (Map.Entry entry : info.entrySet()) { From ac0fed2e64e1c82bd53058df8213024d1148fc14 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 15 Feb 2016 11:01:23 +0100 Subject: [PATCH 15/35] ANDROID-238 ANDROID-239 --- .../application/managers/ActionUtils.java | 24 +++++++------------ .../src/main/res/values/strings.xml | 1 - 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java index b0c79292..0c69df9e 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java @@ -45,6 +45,7 @@ import android.speech.RecognizerIntent; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; +import android.support.v4.app.ShareCompat; import android.text.Html; import android.text.TextUtils; import android.util.DisplayMetrics; @@ -528,21 +529,18 @@ public static boolean actionSendFeedbackEmail(Fragment fr) { try { + ShareCompat.IntentBuilder iBuilder = ShareCompat.IntentBuilder.from(fr.getActivity()); Context context = fr.getContext(); - - Intent i = new Intent(Intent.ACTION_SEND); - i.setType("message/rfc822"); - // Email - i.putExtra(Intent.EXTRA_EMAIL, context.getResources() + iBuilder.addEmailTo(context.getResources() .getStringArray(org.alfresco.mobile.android.foundation.R.array.bugreport_email)); // Prepare Subject String versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; int versionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; - String subject = "Android APP %s Feedback"; - i.putExtra(Intent.EXTRA_SUBJECT, String.format(subject, versionName)); + String subject = "Alfresco Mobile Feedback"; + iBuilder.setSubject(subject); // Content DisplayMetrics dm = context.getResources().getDisplayMetrics(); @@ -569,16 +567,10 @@ public static boolean actionSendFeedbackEmail(Fragment fr) } builder.append("-------------------\n\n").toString(); - i.putExtra(Intent.EXTRA_TEXT, builder.toString()); - - if (i.resolveActivity(fr.getActivity().getPackageManager()) == null) - { - AlfrescoNotificationManager.getInstance(fr.getActivity()).showAlertCrouton(fr.getActivity(), - fr.getString(R.string.error_general)); - return false; - } + iBuilder.setType("message/rfc822"); + iBuilder.setText(builder.toString()); + iBuilder.setChooserTitle(fr.getString(R.string.settings_feedback_email)).startChooser(); - fr.startActivity(Intent.createChooser(i, fr.getString(R.string.send_email))); return true; } diff --git a/alfresco-mobile-android/src/main/res/values/strings.xml b/alfresco-mobile-android/src/main/res/values/strings.xml index 9e93e356..e37b0436 100644 --- a/alfresco-mobile-android/src/main/res/values/strings.xml +++ b/alfresco-mobile-android/src/main/res/values/strings.xml @@ -346,7 +346,6 @@ Send Diagnostics To help us improve Alfresco Mobile, we collect anonymous technical diagnostic data. Switch off if preferred. Send Feedback - Send comments and suggestions anytime From f9f1cdb9b3185d4a7b80cbfe94b4464849058a75 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 15 Feb 2016 14:43:43 +0100 Subject: [PATCH 16/35] ANDROID-205 --- .../node/create/CreateDocumentOperation.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java index 60d64a23..a487a18a 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java @@ -26,14 +26,17 @@ import org.alfresco.mobile.android.async.OperationSchema; import org.alfresco.mobile.android.async.OperationsDispatcher; import org.alfresco.mobile.android.async.Operator; +import org.alfresco.mobile.android.async.UploadRetryService; import org.alfresco.mobile.android.async.node.UpNodeOperation; import org.alfresco.mobile.android.platform.EventBusManager; import org.alfresco.mobile.android.platform.exception.AlfrescoAppException; +import org.alfresco.mobile.android.platform.exception.AlfrescoOfflineException; import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.IOUtils; import org.alfresco.mobile.android.platform.security.DataProtectionManager; import org.alfresco.mobile.android.platform.security.EncryptionUtils; +import org.alfresco.mobile.android.platform.utils.ConnectivityUtils; import org.alfresco.mobile.android.sync.SyncContentManager; import android.content.ContentValues; @@ -111,7 +114,14 @@ protected LoaderResult doInBackground() } else { - result.setException(new AlfrescoAppException("ParentFolder is empty")); + if (!ConnectivityUtils.hasInternetAvailable(context)) + { + result.setException(new AlfrescoOfflineException("Offline")); + } + else + { + result.setException(new AlfrescoAppException("ParentFolder is empty")); + } } // Encrypt if necessary @@ -186,15 +196,21 @@ protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); - // Analytics - AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, - AnalyticsManager.ACTION_CREATE, doc != null ? doc.getContentStreamMimeType() : null, 1, - result.hasException(), AnalyticsManager.INDEX_SYNCED_SIZE, doc.getContentStreamLength()); - EventBusManager.getInstance().post(new CreateDocumentEvent(getRequestId(), result, parentFolder)); + if (result.hasException() && result.getException() instanceof AlfrescoOfflineException) + { + UploadRetryService.retryDelay(context, getRequestId(), UploadRetryService.DEFAULT_DELAY); + } + if (((CreateDocumentRequest) request).isCreation) { contentFile.getFile().delete(); } + + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_CREATE, doc != null ? doc.getContentStreamMimeType() : null, 1, + result.hasException(), AnalyticsManager.INDEX_SYNCED_SIZE, + doc != null ? doc.getContentStreamLength() : -1L); } } From 916b70ae1a2b4399965102f14799b01bea2815d5 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 15 Feb 2016 16:58:13 +0100 Subject: [PATCH 17/35] ANDROID-263 --- .../fragments/create/DocumentPropertiesDialogFragment.java | 4 ++++ .../fragments/create/DocumentTypesDialogFragment.java | 2 ++ .../application/fragments/create/EditorsDialogFragment.java | 4 ++++ .../fragments/node/create/CreateDocumentDialogFragment.java | 3 +++ .../fragments/node/create/CreateFolderDialogFragment.java | 3 +++ 5 files changed, 16 insertions(+) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentPropertiesDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentPropertiesDialogFragment.java index b6e691ef..62e486fa 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentPropertiesDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentPropertiesDialogFragment.java @@ -32,6 +32,8 @@ import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; import org.alfresco.mobile.android.platform.data.DocumentTypeRecord; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -86,6 +88,8 @@ public static DocumentPropertiesDialogFragment newInstance(Bundle bundle) // /////////////////////////////////////////////////////////////////////////// public Dialog onCreateDialog(Bundle savedInstanceState) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_NODE_CREATE_FORM); + final String fragmentTag = (String) getArguments().get(ARGUMENT_FRAGMENT_TAG); final AlfrescoAccount currentAccount = (AlfrescoAccount) getArguments().get(ARGUMENT_ACCOUNT); final DocumentTypeRecord documentType = (DocumentTypeRecord) getArguments().get(ARGUMENT_DOCUMENT_TYPE); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java index 8377e5bc..68f5d0dc 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java @@ -89,6 +89,8 @@ public static DocumentTypesDialogFragment newInstance(AlfrescoAccount currentAcc // /////////////////////////////////////////////////////////////////////////// public Dialog onCreateDialog(Bundle savedInstanceState) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_NODE_CREATE_TYPE); + fileTypes = DocumentTypeRecordHelper.getCreationDocumentTypeList(getActivity()); FileTypeAdapter adapter = new FileTypeAdapter(getActivity(), R.layout.row_single_line, fileTypes); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/EditorsDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/EditorsDialogFragment.java index 5b51664b..8db9fe7c 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/EditorsDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/EditorsDialogFragment.java @@ -29,6 +29,8 @@ import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.application.managers.ActionUtils; import org.alfresco.mobile.android.platform.data.DocumentTypeRecord; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseListAdapter; import org.alfresco.mobile.android.ui.holder.SingleLineViewHolder; @@ -87,6 +89,8 @@ public static EditorsDialogFragment newInstance(Bundle b) // /////////////////////////////////////////////////////////////////////////// public Dialog onCreateDialog(Bundle savedInstanceState) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_NODE_CREATE_EDITOR); + int title = R.string.create_document_editor_title; LayoutInflater inflater = LayoutInflater.from(getActivity()); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateDocumentDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateDocumentDialogFragment.java index e6e5ba1d..d4d35c04 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateDocumentDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateDocumentDialogFragment.java @@ -42,6 +42,7 @@ import org.alfresco.mobile.android.async.node.create.CreateDocumentRequest; import org.alfresco.mobile.android.async.node.create.RetrieveDocumentNameEvent; import org.alfresco.mobile.android.async.node.create.RetrieveDocumentNameRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.io.AlfrescoStorageManager; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; @@ -135,6 +136,8 @@ public static Bundle createBundle(Folder folder, ContentFile f, Boolean isCreati @Override public Dialog onCreateDialog(Bundle savedInstanceState) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_NODE_CREATE_FORM); + return new MaterialDialog.Builder(getActivity()).iconRes(R.drawable.ic_application_logo) .title(R.string.content_upload).customView(createView(LayoutInflater.from(getActivity()), null), true) .positiveText(R.string.create).negativeText(R.string.cancel) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateFolderDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateFolderDialogFragment.java index c2254163..94f3b92b 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateFolderDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/create/CreateFolderDialogFragment.java @@ -21,6 +21,7 @@ import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.async.Operator; import org.alfresco.mobile.android.async.node.create.CreateFolderRequest; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.utils.SessionUtils; import org.alfresco.mobile.android.ui.fragments.AlfrescoFragment; @@ -72,6 +73,8 @@ public static Bundle createBundle(Folder folder) @Override public Dialog onCreateDialog(Bundle savedInstanceState) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_NODE_CREATE_NAME); + MaterialDialog dialog = new MaterialDialog.Builder(getActivity()).iconRes(R.drawable.ic_application_logo) .title(R.string.folder_create).customView(createView(LayoutInflater.from(getActivity()), null), true) .positiveText(R.string.create).negativeText(R.string.cancel) From ec9156b04beaa1263a80b9dc4dcc99920fa77b4d Mon Sep 17 00:00:00 2001 From: jmpascal Date: Tue, 16 Feb 2016 09:29:00 +0100 Subject: [PATCH 18/35] ANDROID-264 --- .../create/DocumentTypesDialogFragment.java | 3 ++- .../node/details/NodeDetailsFragment.java | 7 ------- .../fragments/search/SearchFragment.java | 2 +- .../fragments/user/UsersFragment.java | 5 +++-- .../fragments/workflow/task/TasksFragment.java | 3 +++ .../fragments/workflow/task/TasksHelper.java | 13 +++++++++++++ .../async/node/like/LikeNodeOperation.java | 11 +++++++---- .../async/node/sync/SyncNodeOperation.java | 2 +- .../node/update/UpdateContentOperation.java | 10 +++++++--- .../platform/extensions/AnalyticsManager.java | 16 ++++++++++++++++ 10 files changed, 53 insertions(+), 19 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java index 68f5d0dc..ce64d448 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/create/DocumentTypesDialogFragment.java @@ -102,7 +102,8 @@ public void onSelection(MaterialDialog materialDialog, View view, int position, CharSequence charSequence) { AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, AnalyticsManager.ACTION_QUICK_ACTIONS, - AnalyticsManager.ACTION_CREATE.concat(" " + fileTypes.get(position)), 1, false); + AnalyticsManager.ACTION_CREATE.concat(" " + fileTypes.get(position).mimetype), 1, + false); Bundle b = getArguments(); b.putSerializable(ARGUMENT_DOCUMENT_TYPE, fileTypes.get(position)); EditorsDialogFragment dialogft = EditorsDialogFragment.newInstance(b); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeDetailsFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeDetailsFragment.java index 0cebc794..9c7f0049 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeDetailsFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/details/NodeDetailsFragment.java @@ -649,13 +649,6 @@ public void onClick(View v) ? SyncContentManager.getInstance(getActivity()).isRootSynced(getAccount(), node) : SyncContentManager.getInstance(getActivity()).isSynced(getAccount(), node); - AnalyticsHelper.reportOperationEvent(getActivity(), - AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, - isSynced ? AnalyticsManager.ACTION_SYNC : AnalyticsManager.ACTION_UNSYNC, - node.isDocument() ? ((Document) node).getContentStreamMimeType() - : AnalyticsManager.TYPE_FOLDER, - 1, false); - sync(v); } }); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java index 31dc2ad7..ac3ec5c7 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java @@ -117,7 +117,7 @@ public SearchFragment() requiredSession = true; checkSession = true; setHasOptionsMenu(true); - reportAtCreation = false; + reportAtCreation = true; screenName = AnalyticsManager.SCREEN_SEARCH_FILES; } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UsersFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UsersFragment.java index b5f9a7b1..e011bc2e 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UsersFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/user/UsersFragment.java @@ -69,10 +69,11 @@ public static UsersFragment newInstanceByTemplate(Bundle b) return cbf; } + @Override - public void onCreate(Bundle savedInstanceState) + public void onActivityCreated(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onActivityCreated(savedInstanceState); if (keywords != null) { screenName = AnalyticsManager.SCREEN_SEARCH_RESULT_USERS; diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksFragment.java index a7823617..8a6d3165 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksFragment.java @@ -32,6 +32,7 @@ import org.alfresco.mobile.android.async.workflow.task.TasksEvent; import org.alfresco.mobile.android.async.workflow.task.complete.CompleteTaskEvent; import org.alfresco.mobile.android.async.workflow.task.delegate.ReassignTaskEvent; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.platform.utils.BundleUtils; @@ -73,6 +74,7 @@ public TasksFragment() emptyListMessageId = R.string.empty_tasks; loadState = LOAD_VISIBLE; setHasOptionsMenu(true); + reportAtCreation = false; screenName = AnalyticsManager.SCREEN_TASKS_LISTING; } @@ -299,6 +301,7 @@ protected Fragment createFragment(Bundle b) if (b.containsKey(ListingTemplate.ARGUMENT_HAS_FILTER) || (extraConfiguration != null && extraConfiguration.containsKey(ListingTemplate.ARGUMENT_LISTING))) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_TASKS_FILTER_LISTING); return newInstanceByTemplate(b); } else diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksHelper.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksHelper.java index b35b383c..198de7cd 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksHelper.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/task/TasksHelper.java @@ -25,6 +25,8 @@ import org.alfresco.mobile.android.api.services.impl.publicapi.PublicAPIWorkflowServiceImpl; import org.alfresco.mobile.android.application.R; import org.alfresco.mobile.android.application.fragments.workflow.process.ProcessesFragment; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.activity.AlfrescoActivity; import android.content.SharedPreferences; @@ -67,27 +69,36 @@ public boolean onNavigationItemSelected(int itemPosition, long itemId) if (!backStack && itemPosition == currentSelection) { return true; } + String screenName = AnalyticsManager.SCREEN_TASKS_LISTING_ACTIVE; ListingFilter f = new ListingFilter(); switch (itemPosition) { case TasksShortCutAdapter.FILTER_ACTIVE: + screenName = AnalyticsManager.SCREEN_TASKS_LISTING_ACTIVE; f.addFilter(WorkflowService.FILTER_KEY_STATUS, WorkflowService.FILTER_STATUS_ACTIVE); break; case TasksShortCutAdapter.FILTER_INITIATOR: + screenName = AnalyticsManager.SCREEN_TASKS_LISTING_STARTED; isProcessFragment = true; break; case TasksShortCutAdapter.FILTER_COMPLETED: + screenName = AnalyticsManager.SCREEN_TASKS_LISTING_COMPLETED; f.addFilter(WorkflowService.FILTER_KEY_STATUS, WorkflowService.FILTER_STATUS_COMPLETE); break; case TasksShortCutAdapter.FILTER_HIGH_PRIORITY: + screenName = AnalyticsManager.SCREEN_TASKS_LISTING_HIGH; f.addFilter(WorkflowService.FILTER_KEY_PRIORITY, WorkflowService.FILTER_PRIORITY_HIGH); break; case TasksShortCutAdapter.FILTER_DUE_TODAY: + screenName = AnalyticsManager.SCREEN_TASKS_LISTING_DUE; f.addFilter(WorkflowService.FILTER_KEY_DUE, WorkflowService.FILTER_DUE_TODAY); break; case TasksShortCutAdapter.FILTER_OVERDUE: + screenName = AnalyticsManager.SCREEN_TASKS_LISTING_OVERDUE; f.addFilter(WorkflowService.FILTER_KEY_DUE, WorkflowService.FILTER_DUE_OVERDUE); + break; case TasksShortCutAdapter.FILTER_ASSIGNED: + screenName = AnalyticsManager.SCREEN_TASKS_LISTING_ASSIGNED; f.addFilter(WorkflowService.FILTER_KEY_ASSIGNEE, WorkflowService.FILTER_ASSIGNEE_ME); break; case TasksShortCutAdapter.FILTER_CUSTOM: @@ -97,6 +108,8 @@ public boolean onNavigationItemSelected(int itemPosition, long itemId) break; } + AnalyticsHelper.reportScreen(activity, screenName); + if (!backStack) { activity.getSupportFragmentManager().popBackStack(); diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/like/LikeNodeOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/like/LikeNodeOperation.java index 8cd86fc6..96553154 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/like/LikeNodeOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/like/LikeNodeOperation.java @@ -119,10 +119,13 @@ protected void onPostExecute(LoaderResult result) super.onPostExecute(result); // Analytics - AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, - isLiked ? AnalyticsManager.ACTION_LIKE : AnalyticsManager.ACTION_UNLIKE, - node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, - result.hasException()); + if (!readOnly) + { + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + isLiked ? AnalyticsManager.ACTION_LIKE : AnalyticsManager.ACTION_UNLIKE, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + result.hasException()); + } EventBusManager.getInstance().post(new LikeNodeEvent(getRequestId(), readOnly, result)); } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java index 4c15f2d8..5bda90b0 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java @@ -336,7 +336,7 @@ protected void onPostExecute(LoaderResult result) // Analytics AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, - isSynced ? AnalyticsManager.ACTION_SYNC : AnalyticsManager.ACTION_UNSYNC, + !isSynced ? AnalyticsManager.ACTION_SYNC : AnalyticsManager.ACTION_UNSYNC, node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, result.hasException()); diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateContentOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateContentOperation.java index 0db332d5..1a63fad2 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateContentOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/update/UpdateContentOperation.java @@ -164,9 +164,13 @@ protected void onPostExecute(LoaderResult result) super.onPostExecute(result); // Analytics - AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, - AnalyticsManager.ACTION_UPDATE, ((Document) node).getContentStreamMimeType(), 1, result.hasException(), - AnalyticsManager.INDEX_FILE_SIZE, ((Document) node).getContentStreamLength()); + if (node != null) + { + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + AnalyticsManager.ACTION_UPDATE, ((Document) node).getContentStreamMimeType(), 1, + result.hasException(), AnalyticsManager.INDEX_FILE_SIZE, + ((Document) node).getContentStreamLength()); + } EventBusManager.getInstance().post(new UpdateContentEvent(getRequestId(), result, node, parentFolder)); } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java index 7053cbc9..29469069 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java @@ -409,10 +409,26 @@ public abstract class AnalyticsManager extends Manager public static final String SCREEN_TASKS_LISTING = PREFIX_TASKS + "Listing"; + public static final String SCREEN_TASKS_LISTING_ASSIGNED = SCREEN_TASKS_LISTING + " - Tasks Assigned to Me"; + + public static final String SCREEN_TASKS_LISTING_STARTED = SCREEN_TASKS_LISTING + " - Tasks I've started"; + + public static final String SCREEN_TASKS_LISTING_COMPLETED = SCREEN_TASKS_LISTING + " - Completed Tasks"; + + public static final String SCREEN_TASKS_LISTING_HIGH = SCREEN_TASKS_LISTING + " - High Priority Tasks"; + + public static final String SCREEN_TASKS_LISTING_DUE = SCREEN_TASKS_LISTING + " - Tasks Due Today"; + + public static final String SCREEN_TASKS_LISTING_OVERDUE = SCREEN_TASKS_LISTING + " - Overdue Tasks"; + + public static final String SCREEN_TASKS_LISTING_ACTIVE = SCREEN_TASKS_LISTING + " - Active Tasks"; + public static final String SCREEN_TASKS_HISTORY = PREFIX_TASKS + "History"; public static final String SCREEN_TASKS_FILTER = PREFIX_TASKS + "Filter"; + public static final String SCREEN_TASKS_FILTER_LISTING = PREFIX_TASKS + "Filter - Listing"; + public static final String SCREEN_TASK_DETAILS = PREFIX_TASKS + "Details"; public static final String SCREEN_TASK_CREATE_TYPE = PREFIX_TASKS + "Create - Type"; From 94ed3868745f63a537c0a99e10500701a5fb7ad7 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Tue, 16 Feb 2016 16:06:59 +0100 Subject: [PATCH 19/35] ANDROID-264 --- .../editors/text/EncodingDialogFragment.java | 4 +++ .../editors/text/TextEditorActivity.java | 5 +++ .../editors/text/TextSizeDialogFragment.java | 4 +++ .../search/DocumentFolderSearchFragment.java | 1 + .../platform/extensions/AnalyticsManager.java | 14 +++++++-- .../ui/node/search/SearchNodesFragment.java | 31 +++++++++++-------- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/EncodingDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/EncodingDialogFragment.java index 1134ea18..2934719e 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/EncodingDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/EncodingDialogFragment.java @@ -23,6 +23,8 @@ import java.util.SortedMap; import org.alfresco.mobile.android.application.R; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseListAdapter; import org.alfresco.mobile.android.ui.holder.SingleLineViewHolder; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -71,6 +73,8 @@ public static EncodingDialogFragment newInstance(String defaultCharset) // /////////////////////////////////////////////////////////////////////////// public Dialog onCreateDialog(Bundle savedInstanceState) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_TEXT_EDITOR_ENCODING); + if (getArguments() != null && getArguments().containsKey(ARGUMENT_DEFAULT_CHARSET)) { defaultCharset = getArguments().getString(ARGUMENT_DEFAULT_CHARSET, "UTF-8"); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/TextEditorActivity.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/TextEditorActivity.java index 8fab7d39..5bd4a827 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/TextEditorActivity.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/TextEditorActivity.java @@ -36,6 +36,8 @@ import org.alfresco.mobile.android.async.file.open.OpenFileEvent; import org.alfresco.mobile.android.async.file.open.OpenFileRequest; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.AlfrescoIntentAPI; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -101,6 +103,9 @@ public class TextEditorActivity extends BaseActivity @Override public void onCreate(Bundle savedInstanceState) { + + AnalyticsHelper.reportScreen(this, AnalyticsManager.SCREEN_TEXT_EDITOR); + supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/TextSizeDialogFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/TextSizeDialogFragment.java index d6cd91e9..728ae49e 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/TextSizeDialogFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/editors/text/TextSizeDialogFragment.java @@ -22,6 +22,8 @@ import java.util.List; import org.alfresco.mobile.android.application.R; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseListAdapter; import org.alfresco.mobile.android.ui.holder.SingleLineViewHolder; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -110,6 +112,8 @@ public static TextSizeDialogFragment newInstance(int textSize) // /////////////////////////////////////////////////////////////////////////// public Dialog onCreateDialog(Bundle savedInstanceState) { + AnalyticsHelper.reportScreen(getActivity(), AnalyticsManager.SCREEN_TEXT_EDITOR_TEXT_SIZE); + int title = R.string.file_editor_text_size; if (getArguments() != null && getArguments().containsKey(ARGUMENT_DEFAULT_SIZE)) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/search/DocumentFolderSearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/search/DocumentFolderSearchFragment.java index e4560e03..a34291be 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/search/DocumentFolderSearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/node/search/DocumentFolderSearchFragment.java @@ -87,6 +87,7 @@ public DocumentFolderSearchFragment() super(); loadState = LOAD_VISIBLE; displayAsList = false; + reportAtCreation = false; screenName = AnalyticsManager.SCREEN_SEARCH_RESULT_FILES; } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java index 29469069..2e2662fc 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsManager.java @@ -395,15 +395,17 @@ public abstract class AnalyticsManager extends Manager public static final String SCREEN_SEARCH_RESULT_FILES = PREFIX_SEARCH_RESULT + "Files"; + public static final String SCREEN_SEARCH_RESULT_FOLDERS = PREFIX_SEARCH_RESULT + "Folders"; + public static final String SCREEN_SEARCH_RESULT_USERS = PREFIX_SEARCH_RESULT + "People"; public static final String SCREEN_SEARCH_ADVANCED = PREFIX_SEARCH + "Advanced - "; - public static final String SCREEN_SEARCH_ADVANCED_FILES = PREFIX_SEARCH_RESULT + "Files"; + public static final String SCREEN_SEARCH_ADVANCED_FILES = SCREEN_SEARCH_ADVANCED + "Files"; - public static final String SCREEN_SEARCH_ADVANCED_FOLDERS = PREFIX_SEARCH_RESULT + "Folders"; + public static final String SCREEN_SEARCH_ADVANCED_FOLDERS = SCREEN_SEARCH_ADVANCED + "Folders"; - public static final String SCREEN_SEARCH_ADVANCED_USERS = PREFIX_SEARCH_RESULT + "People"; + public static final String SCREEN_SEARCH_ADVANCED_USERS = SCREEN_SEARCH_ADVANCED + "People"; public static final String PREFIX_TASKS = "Tasks - "; @@ -461,6 +463,12 @@ public abstract class AnalyticsManager extends Manager public static final String SCREEN_SAMSUNG_SNOTE_EDITOR = "Samsung - SNote Editor"; + public static final String SCREEN_TEXT_EDITOR = "Text Editor"; + + public static final String SCREEN_TEXT_EDITOR_ENCODING = "Text Editor - Encoding"; + + public static final String SCREEN_TEXT_EDITOR_TEXT_SIZE = "Text Editor - Text Size"; + // //////////////////////////////////////////////////// // SETTINGS // //////////////////////////////////////////////////// diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/node/search/SearchNodesFragment.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/node/search/SearchNodesFragment.java index bc014669..9e3691b9 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/node/search/SearchNodesFragment.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/node/search/SearchNodesFragment.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.ui.node.search; import org.alfresco.mobile.android.api.model.Folder; @@ -25,6 +25,8 @@ import org.alfresco.mobile.android.async.node.search.SearchEvent; import org.alfresco.mobile.android.async.node.search.SearchRequest; import org.alfresco.mobile.android.foundation.R; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.ui.fragments.BaseGridFragment; import org.alfresco.mobile.android.ui.utils.UIUtils; @@ -101,6 +103,9 @@ protected void onRetrieveParameters(Bundle bundle) ARGUMENT_INCLUDE_DESCENDANTS) : includeDescendants; searchFolderOnly = (getArguments().containsKey(ARGUMENT_SEARCH_FOLDER)) ? getArguments().getBoolean( ARGUMENT_SEARCH_FOLDER) : searchFolderOnly; + + AnalyticsHelper.reportScreen(getActivity(), searchFolderOnly ? AnalyticsManager.SCREEN_SEARCH_RESULT_FOLDERS + : AnalyticsManager.SCREEN_SEARCH_RESULT_FILES); } protected OperationBuilder onCreateOperationRequest(ListingContext listingContext) From 1b25df826e43e5c1075be33e93be4f0828dd29d6 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Wed, 17 Feb 2016 21:35:04 +0100 Subject: [PATCH 20/35] ANDROID-266 --- .../preferences/GeneralPreferences.java | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java index 2d26e818..6474413e 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/GeneralPreferences.java @@ -129,44 +129,6 @@ public void onClick(View v) } }); - // Feedback - Analytics - if (AnalyticsManager.getInstance(getActivity()) == null - || AnalyticsManager.getInstance(getActivity()).isBlocked()) - { - boolean isEnable = AnalyticsManager.getInstance(getActivity()).isEnable(); - - diagnosticVH = HolderUtils.configure(viewById(R.id.settings_diagnostic), - getString(R.string.settings_feedback_diagnostic), getString(R.string.settings_custom_menu_disable), - isEnable); - HolderUtils.makeMultiLine(diagnosticVH.bottomText, 3); - diagnosticVH.choose.setVisibility(View.GONE); - diagnosticVH.choose.setEnabled(false); - } - else - { - boolean isEnable = AnalyticsManager.getInstance(getActivity()).isEnable(); - - diagnosticVH = HolderUtils.configure(viewById(R.id.settings_diagnostic), - getString(R.string.settings_feedback_diagnostic), - getString(R.string.settings_feedback_diagnostic_summary), isEnable); - HolderUtils.makeMultiLine(diagnosticVH.bottomText, 4); - diagnosticVH.choose.setOnClickListener(new View.OnClickListener() - { - @Override - public void onClick(View v) - { - if (diagnosticVH.choose.isChecked()) - { - AnalyticHelper.optIn(getActivity(), getAccount()); - } - else - { - AnalyticHelper.optOut(getActivity(), getAccount()); - } - } - }); - } - // About vh = HolderUtils.configure(viewById(R.id.settings_about), getString(R.string.version_number), AboutFragment.getVersionNumber(getActivity()), -1); @@ -375,6 +337,44 @@ public void onClick(View v) viewById(R.id.passcode_preference_container).setEnabled(false); passcodeVH.bottomText.setText(R.string.mdm_managed); } + + // Feedback - Analytics + if (AnalyticsManager.getInstance(getActivity()) == null + || AnalyticsManager.getInstance(getActivity()).isBlocked()) + { + boolean isEnable = AnalyticsManager.getInstance(getActivity()).isEnable(); + + diagnosticVH = HolderUtils.configure(viewById(R.id.settings_diagnostic), + getString(R.string.settings_feedback_diagnostic), getString(R.string.settings_custom_menu_disable), + isEnable); + HolderUtils.makeMultiLine(diagnosticVH.bottomText, 3); + diagnosticVH.choose.setVisibility(View.GONE); + diagnosticVH.choose.setEnabled(false); + } + else + { + boolean isEnable = AnalyticsManager.getInstance(getActivity()).isEnable(); + + diagnosticVH = HolderUtils.configure(viewById(R.id.settings_diagnostic), + getString(R.string.settings_feedback_diagnostic), + getString(R.string.settings_feedback_diagnostic_summary), isEnable); + HolderUtils.makeMultiLine(diagnosticVH.bottomText, 4); + diagnosticVH.choose.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + if (diagnosticVH.choose.isChecked()) + { + AnalyticHelper.optIn(getActivity(), getAccount()); + } + else + { + AnalyticHelper.optOut(getActivity(), getAccount()); + } + } + }); + } } private void startPlayStore() From 6ba47bf02bfaefcc79431720484d3e6855277ada Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 22 Feb 2016 09:21:14 +0100 Subject: [PATCH 21/35] ANDROID-246 Revert to build 22 --- alfresco-mobile-android/build.gradle | 2 +- .../preferences/PasscodePreferences.java | 6 ++++++ .../managers/extensions/AnalyticHelper.java | 2 +- .../src/main/res/values/strings.xml | 2 +- extensions/analytics/build.gradle | 2 +- extensions/hockeyapp/build.gradle | 2 +- extensions/samsung/build.gradle | 2 +- extensions/scansnap/build.gradle | 2 +- extensions/tools/build.gradle | 20 ++++++++++++++++++- mdm/mobileiron/build.gradle | 2 +- platform/foundation/build.gradle | 2 +- platform/thirdparty/build.gradle | 2 +- 12 files changed, 35 insertions(+), 11 deletions(-) diff --git a/alfresco-mobile-android/build.gradle b/alfresco-mobile-android/build.gradle index 15f71727..2e2d7020 100644 --- a/alfresco-mobile-android/build.gradle +++ b/alfresco-mobile-android/build.gradle @@ -26,7 +26,7 @@ android { applicationId APPLICATION_ID minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 60 versionName VERSION_NAME diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/PasscodePreferences.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/PasscodePreferences.java index 7c9ce02e..09405dcf 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/PasscodePreferences.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/preferences/PasscodePreferences.java @@ -350,6 +350,12 @@ public static boolean hasPasscodeEnable(Context context) return isTimeOut; } + public static boolean hasPasscode(Context context) + { + SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); + return sharedPref.getBoolean(KEY_PASSCODE_ENABLE, false); + } + private void disableEnableControls(boolean enable, ViewGroup vg) { for (int i = 0; i < vg.getChildCount(); i++) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java index 1fc6358d..fdebabfe 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/extensions/AnalyticHelper.java @@ -90,7 +90,7 @@ public static void analyzeSession(Context context, AlfrescoAccount account, Alfr // Settings Info boolean dataProtectionEnable = DataProtectionManager.getInstance(context).hasDataProtectionEnable(); - boolean passcodeEnable = PasscodePreferences.hasPasscodeEnable(context); + boolean passcodeEnable = PasscodePreferences.hasPasscode(context); Boolean syncWifiEnable = SyncContentManager.getInstance(context).hasWifiOnlySync(account); customMetrics.append(AnalyticsManager.INDEX_PASSCODE, passcodeEnable ? 1L : 0L); customMetrics.append(AnalyticsManager.INDEX_DATA_PROTECTION, dataProtectionEnable ? 1L : 0L); diff --git a/alfresco-mobile-android/src/main/res/values/strings.xml b/alfresco-mobile-android/src/main/res/values/strings.xml index e37b0436..37a9f0dc 100644 --- a/alfresco-mobile-android/src/main/res/values/strings.xml +++ b/alfresco-mobile-android/src/main/res/values/strings.xml @@ -50,7 +50,7 @@ I already have an account If you want to learn more about Alfresco Mobile take a look at our guide in the Help area - Alfresco One + Alfresco Server Or Alfresco in the Cloud diff --git a/extensions/analytics/build.gradle b/extensions/analytics/build.gradle index 03583ab7..1960678b 100644 --- a/extensions/analytics/build.gradle +++ b/extensions/analytics/build.gradle @@ -24,7 +24,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 1 versionName "1.0" } diff --git a/extensions/hockeyapp/build.gradle b/extensions/hockeyapp/build.gradle index eb66687d..f0880e27 100644 --- a/extensions/hockeyapp/build.gradle +++ b/extensions/hockeyapp/build.gradle @@ -24,7 +24,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 1 versionName "1.0" } diff --git a/extensions/samsung/build.gradle b/extensions/samsung/build.gradle index bf31067b..c36de8de 100644 --- a/extensions/samsung/build.gradle +++ b/extensions/samsung/build.gradle @@ -24,7 +24,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 1 versionName "1.0" } diff --git a/extensions/scansnap/build.gradle b/extensions/scansnap/build.gradle index 8262b69a..1144b4b3 100644 --- a/extensions/scansnap/build.gradle +++ b/extensions/scansnap/build.gradle @@ -24,7 +24,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 1 versionName "1.0" } diff --git a/extensions/tools/build.gradle b/extensions/tools/build.gradle index 0dca89f8..67b52eb8 100644 --- a/extensions/tools/build.gradle +++ b/extensions/tools/build.gradle @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. + * + * This file is part of Alfresco Mobile for Android. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + apply plugin: 'com.android.library' android { @@ -6,7 +24,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 1 versionName "1.0" } diff --git a/mdm/mobileiron/build.gradle b/mdm/mobileiron/build.gradle index 6ae6141f..95b079fb 100644 --- a/mdm/mobileiron/build.gradle +++ b/mdm/mobileiron/build.gradle @@ -24,7 +24,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 1 versionName "1.0" } diff --git a/platform/foundation/build.gradle b/platform/foundation/build.gradle index f87b72a0..0c01d916 100644 --- a/platform/foundation/build.gradle +++ b/platform/foundation/build.gradle @@ -24,7 +24,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 1 versionName "1.0" diff --git a/platform/thirdparty/build.gradle b/platform/thirdparty/build.gradle index 86f2e695..af189654 100644 --- a/platform/thirdparty/build.gradle +++ b/platform/thirdparty/build.gradle @@ -24,7 +24,7 @@ android { defaultConfig { minSdkVersion 15 - targetSdkVersion 23 + targetSdkVersion 22 versionCode 1 versionName "1.0" } From eead727316b3a1602ae8882fc62784452771e94e Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 22 Feb 2016 09:57:22 +0100 Subject: [PATCH 22/35] ANDROID-265 --- .../fragments/search/AdvancedSearchFragment.java | 2 +- .../application/fragments/search/SearchFragment.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/AdvancedSearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/AdvancedSearchFragment.java index 96e3b123..09539a20 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/AdvancedSearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/AdvancedSearchFragment.java @@ -408,7 +408,7 @@ private void search() switch (searchKey) { case HistorySearch.TYPE_PERSON: - label = AnalyticsManager.LABEL_DOCUMENTS; + label = AnalyticsManager.LABEL_PEOPLE; UsersFragment.with(getActivity()).keywords(statement).title(description).display(); break; case HistorySearch.TYPE_FOLDER: diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java index ac3ec5c7..eafdef96 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java @@ -470,15 +470,18 @@ public void search(String keywords, HistorySearch search) { HistorySearchManager.createHistorySearch(getActivity(), getAccount().getId(), searchKey, 0, getQueryDescription(keywords, tmpParentFolder, site), keywords, new Date().getTime()); + + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_SEARCH, + AnalyticsManager.ACTION_RUN, label, 1, false); } else { HistorySearchManager.update(getActivity(), search.getId(), search.getAccountId(), search.getType(), search.getAdvanced(), search.getDescription(), search.getQuery(), new Date().getTime()); - } - AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_SEARCH, - AnalyticsManager.ACTION_RUN, label, 1, false); + AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_SEARCH, + AnalyticsManager.ACTION_RUN_HISTORY, label, 1, false); + } } // ////////////////////////////////////////////////////////////////////// From 894eaa68716408dd620293edf7eea0ea41eb134d Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 22 Feb 2016 10:42:02 +0100 Subject: [PATCH 23/35] ANDROID-264 --- .../application/activity/PrivateDialogActivity.java | 4 ++++ .../fragments/workflow/CreateTaskTypePickerFragment.java | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/PrivateDialogActivity.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/PrivateDialogActivity.java index d52c7f5e..6fca7aa2 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/PrivateDialogActivity.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/PrivateDialogActivity.java @@ -34,6 +34,8 @@ import org.alfresco.mobile.android.application.fragments.workflow.CreateTaskTypePickerFragment; import org.alfresco.mobile.android.application.ui.form.picker.DocumentPickerFragment.onPickDocumentFragment; import org.alfresco.mobile.android.async.file.encryption.AccountProtectionEvent; +import org.alfresco.mobile.android.platform.extensions.AnalyticsHelper; +import org.alfresco.mobile.android.platform.extensions.AnalyticsManager; import org.alfresco.mobile.android.platform.intent.PrivateIntent; import android.content.Intent; @@ -140,6 +142,8 @@ && getIntent().getExtras().containsKey(PrivateIntent.EXTRA_DOCUMENTS)) Fragment f = docs.isEmpty() ? new CreateTaskTypePickerFragment() : CreateTaskTypePickerFragment.newInstance(docs); FragmentDisplayer.with(this).load(f).back(false).animate(null).into(FragmentDisplayer.PANEL_LEFT); + + AnalyticsHelper.reportScreen(this, AnalyticsManager.SCREEN_TASK_CREATE_TYPE); } if (PrivateIntent.ACTION_DISPLAY_HELP.equals(action)) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskTypePickerFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskTypePickerFragment.java index 2b6df117..17e5258b 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskTypePickerFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/workflow/CreateTaskTypePickerFragment.java @@ -71,6 +71,13 @@ public CreateTaskTypePickerFragment() screenName = AnalyticsManager.SCREEN_TASK_CREATE_TYPE; } + public static CreateTaskTypePickerFragment newInstanceByTemplate(Bundle b) + { + CreateTaskTypePickerFragment cbf = new CreateTaskTypePickerFragment(); + cbf.setArguments(b); + return cbf; + } + public static CreateTaskTypePickerFragment newInstance(List docs) { CreateTaskTypePickerFragment bf = new CreateTaskTypePickerFragment(); From afb6d12d582426e15985f7e7d70909da12eb1588 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 22 Feb 2016 11:02:37 +0100 Subject: [PATCH 24/35] ANDROID-239 --- .../application/managers/ActionUtils.java | 2 +- .../async/node/sync/SyncNodeOperation.java | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java index 0c69df9e..590442a3 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ActionUtils.java @@ -539,7 +539,7 @@ public static boolean actionSendFeedbackEmail(Fragment fr) String versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; int versionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; - String subject = "Alfresco Mobile Feedback"; + String subject = "Alfresco Android Mobile Feedback"; iBuilder.setSubject(subject); // Content diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java index 5bda90b0..c06c5c75 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/sync/SyncNodeOperation.java @@ -333,13 +333,15 @@ private void prepareChildrenFolderDelete(String nodeId) protected void onPostExecute(LoaderResult result) { super.onPostExecute(result); - - // Analytics - AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, - !isSynced ? AnalyticsManager.ACTION_SYNC : AnalyticsManager.ACTION_UNSYNC, - node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, - result.hasException()); - EventBusManager.getInstance().post(new SyncNodeEvent(getRequestId(), result, node)); + + if (markSync != null) + { + // Analytics + AnalyticsHelper.reportOperationEvent(context, AnalyticsManager.CATEGORY_DOCUMENT_MANAGEMENT, + !markSync ? AnalyticsManager.ACTION_SYNC : AnalyticsManager.ACTION_UNSYNC, + node.isDocument() ? ((Document) node).getContentStreamMimeType() : AnalyticsManager.TYPE_FOLDER, 1, + result.hasException()); + } } } From d3250d26a5da0d577061e1658788d79794b4f142 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 22 Feb 2016 13:04:43 +0100 Subject: [PATCH 25/35] ANDROID-267 --- .../android/application/activity/MainActivity.java | 2 +- .../fragments/menu/MainMenuFragment.java | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java index 6dc60ee8..24c2883f 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/activity/MainActivity.java @@ -362,7 +362,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) ((MainMenuFragment) getFragment(MainMenuFragment.SLIDING_TAG)).refreshAccount(); // Send Event - ConfigManager.getInstance(this).loadAndUseCustom(getCurrentAccount()); + // ConfigManager.getInstance(this).loadAndUseCustom(getCurrentAccount()); EventBusManager.getInstance() .post(new ConfigManager.ConfigurationMenuEvent(getCurrentAccount().getId())); } diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/menu/MainMenuFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/menu/MainMenuFragment.java index c1bda583..d54fb2f9 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/menu/MainMenuFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/menu/MainMenuFragment.java @@ -269,6 +269,10 @@ public void refreshAccount() { configManager = ConfigManager.getInstance(getActivity()); refresh(); + if (configManager.getConfig(currentAccount.getId()) == null) + { + configManager.init(currentAccount); + } MainMenuConfigManager config = new MainMenuConfigManager(getActivity(), configManager.getConfig(currentAccount.getId()), (ViewGroup) getRootView()); config.createMenu(); @@ -350,10 +354,7 @@ public void swapAccount() // /////////////////////////////////////////////////////////////////////////// private void configure(ConfigService configService) { - if (configService == null || !configService.hasViewConfig()) - { - return; - } + if (configService == null || !configService.hasViewConfig()) { return; } // Default only available since configuration 0.1 if (configService.getConfigInfo() == null || (configService.getConfigInfo() != null @@ -694,7 +695,10 @@ public void onAvatarLoaded(AvatarEvent event) @Subscribe public void onConfigureMenuEvent(ConfigurationMenuEvent event) { - refreshConfiguration(event.accountId); + if (event.accountId >= 0) + { + refreshConfiguration(event.accountId); + } } @Subscribe From 1a2436be4c3cc9d66a6833766b25705f20f16178 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 22 Feb 2016 13:06:24 +0100 Subject: [PATCH 26/35] ANDROID-207 --- .../android/application/fragments/search/SearchFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java index eafdef96..dd5caef3 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java @@ -534,7 +534,7 @@ private void updateForm(int id) switch (id) { case HistorySearch.TYPE_PERSON: - hintId = R.string.search_person_hint; + hintId = R.string.search; screenName = AnalyticsManager.SCREEN_SEARCH_USERS; // iconResId = R.drawable.ic_person_light; break; From 14aacc8e0420fde87554bc0ab90bd59f94e6af18 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 22 Feb 2016 17:13:23 +0100 Subject: [PATCH 27/35] ANDROID-205 --- .../android/async/UploadRetryService.java | 26 ++++++++++++++----- .../node/create/CreateDocumentOperation.java | 3 ++- .../android/sync/SyncContentManager.java | 19 +++++++++++--- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/UploadRetryService.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/UploadRetryService.java index ef02a57a..1d403618 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/UploadRetryService.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/UploadRetryService.java @@ -22,6 +22,7 @@ import org.alfresco.mobile.android.platform.intent.PrivateIntent; import org.alfresco.mobile.android.platform.utils.ConnectivityUtils; +import org.alfresco.mobile.android.sync.SyncContentManager; import android.app.AlarmManager; import android.app.PendingIntent; @@ -88,18 +89,25 @@ private void startService() private void retryOperations(Intent pIntent) { Uri uri = null; + Long accountId = -1L; if (pIntent.getExtras() != null && pIntent.hasExtra(PrivateIntent.EXTRA_OPERATION_ID)) { uri = Uri.parse(pIntent.getStringExtra(PrivateIntent.EXTRA_OPERATION_ID)); } - if (uri == null) + if (pIntent.getExtras() != null && pIntent.hasExtra(PrivateIntent.EXTRA_ACCOUNT_ID)) + { + accountId = pIntent.getLongExtra(PrivateIntent.EXTRA_ACCOUNT_ID, -1); + } + + if (uri == null || accountId == -1L) { stopSelf(); } // Postpone if still offline (double time for each attempt) - if (!ConnectivityUtils.hasInternetAvailable(getApplicationContext())) + if (!ConnectivityUtils.hasInternetAvailable(getApplicationContext()) + || !SyncContentManager.getInstance(getApplicationContext()).hasConnectivityToSync(accountId)) { if (OperationsFactory.canRetry(getApplicationContext(), uri)) { @@ -107,11 +115,11 @@ private void retryOperations(Intent pIntent) pIntent.getExtras().clear(); if (delay * 2 < DEFAULT_DELAY_MAX) { - postpone(uri.toString(), delay * 2); + postpone(uri.toString(), accountId, delay * 2); } } } - else + else if (SyncContentManager.getInstance(getApplicationContext()).hasConnectivityToSync(accountId)) { // Check if still present ? if (OperationsFactory.canRetry(getApplicationContext(), uri)) @@ -127,18 +135,22 @@ private void retryOperations(Intent pIntent) stopSelf(); } - private void postpone(String operationId, int delay) + private void postpone(String operationId, Long accountId, int delay) { - retryDelay(getApplicationContext(), operationId, delay); + retryDelay(getApplicationContext(), accountId, operationId, delay); } - public static void retryDelay(Context context, String operationId, int min) + public static void retryDelay(Context context, Long accountId, String operationId, int min) { // Start alarm to retry upload Intent postPoneIntent = new Intent(context, UploadRetryService.class); postPoneIntent.setAction(PrivateIntent.ACTION_RETRY_OPERATIONS); postPoneIntent.putExtra(PrivateIntent.EXTRA_OPERATION_ID, operationId); postPoneIntent.putExtra(PrivateIntent.EXTRA_OPERATION_DELAY, min); + if (accountId != null) + { + postPoneIntent.putExtra(PrivateIntent.EXTRA_ACCOUNT_ID, accountId); + } int uniqueInt = (int) (System.currentTimeMillis() & 0xfffffff); PendingIntent pIntent = PendingIntent.getService(context, uniqueInt, postPoneIntent, PendingIntent.FLAG_UPDATE_CURRENT); diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java index a487a18a..536b7630 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/node/create/CreateDocumentOperation.java @@ -199,7 +199,8 @@ protected void onPostExecute(LoaderResult result) EventBusManager.getInstance().post(new CreateDocumentEvent(getRequestId(), result, parentFolder)); if (result.hasException() && result.getException() instanceof AlfrescoOfflineException) { - UploadRetryService.retryDelay(context, getRequestId(), UploadRetryService.DEFAULT_DELAY); + UploadRetryService.retryDelay(context, acc != null ? acc.getId() : null, getRequestId(), + UploadRetryService.DEFAULT_DELAY); } if (((CreateDocumentRequest) request).isCreation) diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentManager.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentManager.java index 557f612d..5eb40b7f 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentManager.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/sync/SyncContentManager.java @@ -431,8 +431,14 @@ public boolean canSync(AlfrescoAccount account) public boolean hasConnectivityToSync(AlfrescoAccount account) { - return ((hasWifiOnlySync(account) && ConnectivityUtils.isWifiAvailable(appContext)) - || (!hasWifiOnlySync(account) && ConnectivityUtils.hasInternetAvailable(appContext))); + return ((hasWifiOnlySync(account.getId()) && ConnectivityUtils.isWifiAvailable(appContext)) + || (!hasWifiOnlySync(account.getId()) && ConnectivityUtils.hasInternetAvailable(appContext))); + } + + public boolean hasConnectivityToSync(Long accountId) + { + return ((hasWifiOnlySync(accountId) && ConnectivityUtils.isWifiAvailable(appContext)) + || (!hasWifiOnlySync(accountId) && ConnectivityUtils.hasInternetAvailable(appContext))); } /** @@ -788,10 +794,15 @@ public void setWifiOnlySync(AlfrescoAccount account, boolean isWifiOnly) public boolean hasWifiOnlySync(AlfrescoAccount account) { - if (account != null) + return account != null && hasWifiOnlySync(account.getId()); + } + + public boolean hasWifiOnlySync(Long accountId) + { + if (accountId != null) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(appContext); - return sharedPref.getBoolean(SYNCHRO_WIFI_PREFIX + account.getId(), false); + return sharedPref.getBoolean(SYNCHRO_WIFI_PREFIX + accountId, false); } return false; } From 6217b57f1c7f353d2cc9c27f954068af0c22d834 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Thu, 25 Feb 2016 17:29:01 +0100 Subject: [PATCH 28/35] ANDROID-231 --- .../signin/AccountOAuthFragment.java | 6 +-- .../application/managers/ConfigManager.java | 1 + .../tools/DeveloperSessionManager.java | 50 +++++++++++++++++-- .../async/session/LoadSessionHelper.java | 4 -- .../android/ui/oauth/OAuthFragment.java | 17 ++++--- 5 files changed, 60 insertions(+), 18 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOAuthFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOAuthFragment.java index 54d7fa79..a5be4efa 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOAuthFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/signin/AccountOAuthFragment.java @@ -77,7 +77,7 @@ public AccountOAuthFragment() public static AccountOAuthFragment newInstance(Context context) { - AccountOAuthFragment bf = new AccountOAuthFragment(); + AccountOAuthFragment bf = getOAuthFragment(context, null); Bundle b = createBundleArgs(R.layout.fr_oauth_cloud); bf.setArguments(b); return bf; @@ -101,7 +101,7 @@ public static AccountOAuthFragment getOAuthFragment(Context context, AlfrescoAcc { String oauthUrl = null, apikey = null, apisecret = null; Bundle b = SessionManager.getInstance(context).getOAuthSettings(); - if (b != null) + if (b != null && !b.isEmpty()) { oauthUrl = b.getString(OAUTH_URL); apikey = b.getString(OAUTH_API_KEY); @@ -122,7 +122,7 @@ public static AccountOAuthFragment getOAuthFragment(Context context, AlfrescoAcc AccountOAuthFragment oauthFragment; if (oauthUrl == null || oauthUrl.isEmpty()) { - oauthFragment = AccountOAuthFragment.newInstance(context); + oauthFragment = new AccountOAuthFragment(); } else { diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ConfigManager.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ConfigManager.java index 348a2f7e..218441ea 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ConfigManager.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/managers/ConfigManager.java @@ -373,6 +373,7 @@ public void onConfigContextEvent(ConfigurationEvent event) @Subscribe public void onSessionRequested(RequestSessionEvent event) { + if (event.accountToLoad == null){return;} if (hasConfig(event.accountToLoad.getId())) { currentService.remove(event.accountToLoad.getId()); diff --git a/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java b/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java index c65e6493..a75135c4 100644 --- a/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java +++ b/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java @@ -61,7 +61,7 @@ public class DeveloperSessionManager extends SessionManager private static final String CLOUD_BASIC_AUTH = "org.alfresco.mobile.binding.internal.cloud.basic"; - private static final String ALFRESCO_CLOUD_URL = "http://my.alfresco.com"; + private static final String ALFRESCO_CLOUD_URL = "https://my.alfresco.com"; // /////////////////////////////////////////////////////////////////////////// // CONSTRUCTORS @@ -136,6 +136,10 @@ public Bundle getOAuthSettings() IOUtils.closeStream(is); } } + else + { + return null; + } return b; } @@ -165,6 +169,7 @@ public SettingsBuilder prepare(OAuthData oauthData) { this.isCloud = true; this.oAuthData = oauthData; + prepareOauthURL(); return this; } @@ -194,8 +199,7 @@ protected void prepareData(AlfrescoAccount acc) { case AlfrescoAccount.TYPE_ALFRESCO_TEST_OAUTH: isCloud = true; - String apikey = null, - apisecret = null; + String apikey = null, apisecret = null; File f = new File(APP_CONFIG_PATH); if (f.exists()) { @@ -220,6 +224,7 @@ protected void prepareData(AlfrescoAccount acc) } baseUrl = acc.getUrl(); + extraSettings.put(BASE_URL, baseUrl); oAuthData = new OAuth2DataImpl(apikey, apisecret, acc.getAccessToken(), acc.getRefreshToken()); break; default: @@ -276,8 +281,8 @@ protected void prepareSSLSettings() try { URI url = new URI(baseUrl); - File f = AlfrescoStorageManager.getInstance(getContext()).getFileInPrivateFolder( - url.getHost() + ".properties"); + File f = AlfrescoStorageManager.getInstance(getContext()) + .getFileInPrivateFolder(url.getHost() + ".properties"); if (f.exists() && f.isFile()) { AlfrescoNotificationManager.getInstance(getContext()).showToast(R.string.security_ssl_disable); @@ -290,6 +295,41 @@ protected void prepareSSLSettings() } } + protected void prepareOauthURL() + { + String tmpurl = null; + // Check Properties available inside the device + File f = new File(APP_CONFIG_PATH); + if (f.exists()) + { + Properties prop = new Properties(); + InputStream is = null; + try + { + is = new FileInputStream(f); + // load a properties file + prop.load(is); + tmpurl = prop.getProperty(OAUTH_URL); + } + catch (IOException ex) + { + throw new AlfrescoServiceException(ErrorCodeRegistry.PARSING_GENERIC, ex); + } + finally + { + IOUtils.closeStream(is); + } + } + if (tmpurl != null) + { + extraSettings.put(BASE_URL, tmpurl); + } + else + { + // extraSettings.put(BASE_URL, ALFRESCO_CLOUD_URL); + } + } + private Context getContext() { return contextRef.get(); diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/LoadSessionHelper.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/LoadSessionHelper.java index 7e8bd94d..d06822ab 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/LoadSessionHelper.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/async/session/LoadSessionHelper.java @@ -33,7 +33,6 @@ import org.alfresco.mobile.android.platform.accounts.AlfrescoSessionSettings; import android.content.Context; -import android.util.Log; public class LoadSessionHelper { @@ -85,8 +84,6 @@ public AlfrescoSession requestSession() if (sessionSettings.isCloud) { - Log.d("[CLOUD]", "REQUEST CLOUD SESSION"); - // CLOUD oauthData = sessionSettings.oAuthData; originalOauthData = oauthData; @@ -101,7 +98,6 @@ public AlfrescoSession requestSession() { helper = new OAuthHelper(); } - Log.d("[CLOUD]", "REFRESH TOKEN"); oauthData = helper.refreshToken(oauthData); account = AccountOAuthHelper.saveNewOauthData(context, getAccount(), oauthData); } diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/oauth/OAuthFragment.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/oauth/OAuthFragment.java index 7a7c9827..abe29d68 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/oauth/OAuthFragment.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/ui/oauth/OAuthFragment.java @@ -28,6 +28,7 @@ import org.alfresco.mobile.android.foundation.R; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; import org.alfresco.mobile.android.platform.EventBusManager; +import org.alfresco.mobile.android.platform.utils.AndroidVersion; import android.graphics.Bitmap; import android.os.Bundle; @@ -38,6 +39,7 @@ import android.view.View; import android.view.ViewGroup; import android.webkit.WebChromeClient; +import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; @@ -121,6 +123,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa webview = (WebView) v.findViewById(R.id.webview); webview.getSettings().setJavaScriptEnabled(true); + if (AndroidVersion.isLollipopOrAbove()) + { + webview.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); + } final FragmentActivity activity = getActivity(); webview.setWebChromeClient(new WebChromeClient() @@ -212,9 +218,9 @@ private void onCodeUrl(String url) { if (onOAuthAccessTokenListener != null) { - onOAuthAccessTokenListener.failedRequestAccessToken(new AlfrescoSessionException( - ErrorCodeRegistry.SESSION_AUTH_CODE_INVALID, Messagesl18n - .getString("ErrorCodeRegistry.SESSION_AUTH_CODE_INVALID"))); + onOAuthAccessTokenListener.failedRequestAccessToken( + new AlfrescoSessionException(ErrorCodeRegistry.SESSION_AUTH_CODE_INVALID, + Messagesl18n.getString("ErrorCodeRegistry.SESSION_AUTH_CODE_INVALID"))); } } } @@ -241,9 +247,8 @@ public void retrieveAccessToken(String code) onOAuthAccessTokenListener.beforeRequestAccessToken(new Bundle()); } - Operator.with(getActivity()).load( - new RetrieveOAuthDataRequest.Builder(RetrieveOAuthDataRequest.OPERATION_ACCESS_TOKEN, baseOAuthUrl, - code, apiKey, apiSecret, callback)); + Operator.with(getActivity()).load(new RetrieveOAuthDataRequest.Builder( + RetrieveOAuthDataRequest.OPERATION_ACCESS_TOKEN, baseOAuthUrl, code, apiKey, apiSecret, callback)); } @Subscribe From 24e7600bdfec2873bde890450a361db0385987cd Mon Sep 17 00:00:00 2001 From: jmpascal Date: Thu, 25 Feb 2016 17:38:16 +0100 Subject: [PATCH 29/35] ANDROID-207 --- .../android/application/fragments/search/SearchFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java index dd5caef3..3c8aedf2 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/SearchFragment.java @@ -539,12 +539,12 @@ private void updateForm(int id) // iconResId = R.drawable.ic_person_light; break; case HistorySearch.TYPE_DOCUMENT: - hintId = R.string.search_form_hint; + hintId = R.string.search; screenName = AnalyticsManager.SCREEN_SEARCH_FILES; // iconResId = R.drawable.ic_office; break; case HistorySearch.TYPE_FOLDER: - hintId = R.string.search_form_hint; + hintId = R.string.search; screenName = AnalyticsManager.SCREEN_SEARCH_FOLDERS; // iconResId = R.drawable.ic_repository_light; break; From f03183922d13d76a35b9e4c909a744fabd669e37 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Wed, 2 Mar 2016 18:55:26 +0100 Subject: [PATCH 30/35] ANDROID-275 --- .../fragments/search/QueryHelper.java | 103 ++++++++++++------ 1 file changed, 71 insertions(+), 32 deletions(-) diff --git a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/QueryHelper.java b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/QueryHelper.java index de132e7c..8f14750a 100644 --- a/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/QueryHelper.java +++ b/alfresco-mobile-android/src/main/java/org/alfresco/mobile/android/application/fragments/search/QueryHelper.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (C) 2005-2014 Alfresco Software Limited. +/* + * Copyright (C) 2005-2016 Alfresco Software Limited. * - * This file is part of Alfresco Mobile for Android. + * This file is part of Alfresco Mobile for Android. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.alfresco.mobile.android.application.fragments.search; import java.text.SimpleDateFormat; @@ -88,14 +88,16 @@ public static String createQuery(boolean isSearchDocument, String name, String t } } + boolean isSimpleStatement = TextUtils.isEmpty(title) && TextUtils.isEmpty(description); + // Create the query based on properties StringBuilder whereClause = new StringBuilder(); // Name - addParenFolderParameter(whereClause, parentFolder); + addParenFolderParameter(whereClause, parentFolder, isSimpleStatement); // Name - addContainsParameter(whereClause, PropertyIds.NAME, name); + addContainsParameter(whereClause, PropertyIds.NAME, name, isSimpleStatement); // Title addAspectContainsParameter(whereClause, CMIS_PROP_TITLE, title); @@ -104,10 +106,10 @@ public static String createQuery(boolean isSearchDocument, String name, String t addAspectContainsParameter(whereClause, CMIS_PROP_DESCRIPTION, description); // Mimetype - addMimeTypeParameter(whereClause, mimetype); + addMimeTypeParameter(whereClause, mimetype, isSimpleStatement); // ModifiedBy - addParameter(whereClause, PropertyIds.LAST_MODIFIED_BY, OPERATOR_EQUAL, modifiedById); + addParameter(whereClause, PropertyIds.LAST_MODIFIED_BY, OPERATOR_EQUAL, modifiedById, isSimpleStatement); // Modified FROM if (modificationFrom != null) @@ -115,7 +117,7 @@ public static String createQuery(boolean isSearchDocument, String name, String t GregorianCalendar localModificationFrom = (GregorianCalendar) modificationFrom.clone(); localModificationFrom.add(Calendar.DAY_OF_MONTH, -1); addDateParameter(whereClause, PropertyIds.LAST_MODIFICATION_DATE, OPERATOR_SUPERIOR, - formatLast(localModificationFrom)); + formatLast(localModificationFrom), isSimpleStatement); } // Modified TO @@ -124,7 +126,7 @@ public static String createQuery(boolean isSearchDocument, String name, String t GregorianCalendar localModificationTo = (GregorianCalendar) modificationTo.clone(); localModificationTo.add(Calendar.DAY_OF_MONTH, 1); addDateParameter(whereClause, PropertyIds.LAST_MODIFICATION_DATE, OPERATOR_INFERIOR, - formatFirst(localModificationTo)); + formatFirst(localModificationTo), isSimpleStatement); } queryBuilder.append(whereClause); @@ -137,9 +139,9 @@ public static String createQuery(boolean isSearchDocument, String name, String t public static String createPersonSearchQuery(String name, String jobTitle, String company, String location) { StringBuilder queryBuilder = new StringBuilder(name); - addPersonParameter(queryBuilder, "jobtitle", jobTitle); - addPersonParameter(queryBuilder, "organization", company); - addPersonParameter(queryBuilder, "location", location); + addPersonParameter(queryBuilder, "jobtitle", jobTitle, true); + addPersonParameter(queryBuilder, "organization", company, true); + addPersonParameter(queryBuilder, "location", location, true); return queryBuilder.toString(); } @@ -158,45 +160,71 @@ public static String formatLast(GregorianCalendar calendar) return dateFormat.format(calendar.getTime()).concat("T23:59:59.999Z"); } - private static void addParenFolderParameter(StringBuilder builder, Folder value) + private static void addParenFolderParameter(StringBuilder builder, Folder value, Boolean isSimpleStatement) { if (value == null) { return; } if (builder.length() != 0) { builder.append(" AND "); } - builder.append(" IN_TREE('").append(value.getIdentifier()).append("')"); + if (isSimpleStatement) + { + builder.append(" IN_TREE('"); + } + else + { + builder.append(" IN_TREE(d,'"); + } + builder.append(value.getIdentifier()).append("')"); } - private static void addParameter(StringBuilder builder, String key, String operator, String value) + private static void addParameter(StringBuilder builder, String key, String operator, String value, + Boolean isSimpleStatement) { if (TextUtils.isEmpty(value)) { return; } if (builder.length() != 0) { builder.append(" AND "); } + if (!isSimpleStatement) + { + builder.append("d."); + } builder.append(key); builder.append(operator); builder.append("'").append(value).append("'"); } - private static void addContainsParameter(StringBuilder builder, String key, String value) + private static void addContainsParameter(StringBuilder builder, String key, String value, Boolean isSimpleStatement) { if (TextUtils.isEmpty(value)) { return; } if (builder.length() != 0) { builder.append(" AND "); } - builder.append("CONTAINS('~").append(key).append(":\\\'").append(value).append("\\\'')"); + if (isSimpleStatement) + { + builder.append("CONTAINS('~"); + } + else + { + builder.append("CONTAINS(d, '~"); + } + builder.append(key).append(":\\\'").append(value).append("\\\'')"); } - private static void addDateParameter(StringBuilder builder, String key, String operator, String value) + private static void addDateParameter(StringBuilder builder, String key, String operator, String value, + Boolean isSimpleStatement) { if (TextUtils.isEmpty(value)) { return; } if (builder.length() != 0) { builder.append(" AND "); } + if (!isSimpleStatement) + { + builder.append("d."); + } builder.append(key); builder.append(" "); builder.append(operator); @@ -214,7 +242,7 @@ private static void addAspectContainsParameter(StringBuilder builder, String key builder.append("CONTAINS(t, '~").append(key).append(":\\\'").append(value).append("\\\'')"); } - private static void addPersonParameter(StringBuilder builder, String key, String value) + private static void addPersonParameter(StringBuilder builder, String key, String value, Boolean isSimpleStatement) { if (TextUtils.isEmpty(value)) { return; } if (builder.length() != 0) @@ -224,6 +252,10 @@ private static void addPersonParameter(StringBuilder builder, String key, String String[] values = value.split(" "); for (int i = 0; i < values.length; i++) { + if (!isSimpleStatement) + { + builder.append("d."); + } builder.append(key); builder.append(":"); builder.append(values[i]); @@ -231,7 +263,7 @@ private static void addPersonParameter(StringBuilder builder, String key, String } } - private static void addMimeTypeParameter(StringBuilder builder, int mimetypeKey) + private static void addMimeTypeParameter(StringBuilder builder, int mimetypeKey, Boolean isSimpleStatement) { List types = null; switch (mimetypeKey) @@ -285,6 +317,10 @@ private static void addMimeTypeParameter(StringBuilder builder, int mimetypeKey) { builder.append(" AND "); } + if (!isSimpleStatement) + { + builder.append("d."); + } builder.append(PropertyIds.CONTENT_STREAM_MIME_TYPE); builder.append(" IN ("); builder.append(sb); @@ -327,6 +363,7 @@ private static List createAudioList() return new ArrayList() { private static final long serialVersionUID = 1L; + { add(new MimeType(MimeType.TYPE_AUDIO, "x-aiff")); add(new MimeType(MimeType.TYPE_AUDIO, "vnd.adobe.soundbooth")); @@ -410,7 +447,8 @@ private static List createPresentationsList() add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.oasis.opendocument.presentation")); add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.oasis.opendocument.presentation-template")); add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.ms-powerpoint.template.macroenabled.12")); - add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.openxmlformats-officedocument.presentationml.template")); + add(new MimeType(MimeType.TYPE_APPLICATION, + "vnd.openxmlformats-officedocument.presentationml.template")); add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.ms-powerpoint.slideshow.macroenabled.12")); add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.ms-powerpoint")); add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.ms-powerpoint.presentation.macroenabled.12")); @@ -444,7 +482,8 @@ private static List createSpreadsheetsList() add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.ms-excel.sheet.macroenabled.12")); add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.openxmlformats-officedocument.spreadsheetml.sheet")); add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.ms-excel.template.macroenabled.12")); - add(new MimeType(MimeType.TYPE_APPLICATION, "vnd.openxmlformats-officedocument.spreadsheetml.template")); + add(new MimeType(MimeType.TYPE_APPLICATION, + "vnd.openxmlformats-officedocument.spreadsheetml.template")); } }; } From a86ef4c164f10c296e0a2b8f4aaee086769857ce Mon Sep 17 00:00:00 2001 From: jmpascal Date: Thu, 3 Mar 2016 16:01:12 +0100 Subject: [PATCH 31/35] ANDROID-274 --- .../src/main/res/values-de/strings.xml | 23 +++++++------ .../src/main/res/values-es/strings.xml | 23 +++++++------ .../src/main/res/values-fr/strings.xml | 23 +++++++------ .../src/main/res/values-it/strings.xml | 23 +++++++------ .../src/main/res/values-ja/strings.xml | 33 ++++++++++--------- .../src/main/res/values-zh-rCN/strings.xml | 23 +++++++------ 6 files changed, 83 insertions(+), 65 deletions(-) diff --git a/alfresco-mobile-android/src/main/res/values-de/strings.xml b/alfresco-mobile-android/src/main/res/values-de/strings.xml index e8f6d5b5..6ce671aa 100644 --- a/alfresco-mobile-android/src/main/res/values-de/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-de/strings.xml @@ -1,14 +1,14 @@ de - + Version @@ -342,7 +342,10 @@ Wählen Sie aus, welche Registerkarten in Ihrem Menü verfügbar sind. Menü Ihr Alfresco Administrator hat diese Funktion deaktiviert. - + Feedback + Diagnose einsenden + Um Alfresco Mobile weiter zu verbessern, sammeln wir anonym technische Diagnosedaten. Wenn Sie möchten, können Sie dies hier abstellen. + Feedback einsenden @@ -734,7 +737,7 @@ Ordner "Favoriten" Alfresco Alfresco in the Cloud - Alfresco vor Ort + Alfresco Server @@ -904,4 +907,4 @@ Dieser Inhalt stammt nicht aus einer unterstützten Quelle.

Bitte wählen Sie etwas anderes.]]>
- \ No newline at end of file + diff --git a/alfresco-mobile-android/src/main/res/values-es/strings.xml b/alfresco-mobile-android/src/main/res/values-es/strings.xml index 7046b066..ddd0e816 100644 --- a/alfresco-mobile-android/src/main/res/values-es/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-es/strings.xml @@ -1,14 +1,14 @@ es - + Versión @@ -342,7 +342,10 @@ Seleccione las pestañas disponibles en su menú. Menú Su administrador de Alfresco ha deshabilitado esta función. - + Comentarios + Enviar diagnósticos + Para ayudarnos a mejorar Alfresco Mobile, recopilamos datos de diagnósticos técnicos anónimos. Puede desactivar esta opción si lo prefiere. + Enviar comentarios @@ -734,7 +737,7 @@ Carpeta de favoritos Alfresco Alfresco in the Cloud - Alfresco On Premise + Servidor de Alfresco @@ -904,4 +907,4 @@ Este contenido no proviene de una fuente de contenido compatible.

Seleccione otro.]]>
- \ No newline at end of file + diff --git a/alfresco-mobile-android/src/main/res/values-fr/strings.xml b/alfresco-mobile-android/src/main/res/values-fr/strings.xml index 5552c0c9..1dc917ec 100644 --- a/alfresco-mobile-android/src/main/res/values-fr/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-fr/strings.xml @@ -1,14 +1,14 @@ fr - + Version @@ -342,7 +342,10 @@ Sélectionnez les onglets disponibles dans votre menu. Menu Votre administrateur Alfresco a désactivé cette fonctionnalité. - + Vos données + Envoyer le diagnostic + Aidez-nous à améliorer Alfresco Mobile en nous envoyant vos données de diagnostic technique qui resteront anonymes. Désactivez l'option, le cas échéant. + Envoyer les données @@ -734,7 +737,7 @@ Dossier Favoris Alfresco Alfresco in the Cloud - Alfresco sur site + Serveur Alfresco @@ -904,4 +907,4 @@ Ce contenu ne provient pas d\'une source de contenu prise en charge.

Veuillez en sélectionner un autre.]]>
- \ No newline at end of file + diff --git a/alfresco-mobile-android/src/main/res/values-it/strings.xml b/alfresco-mobile-android/src/main/res/values-it/strings.xml index 790f895d..d20cdadb 100644 --- a/alfresco-mobile-android/src/main/res/values-it/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-it/strings.xml @@ -1,14 +1,14 @@ it - + Versione @@ -342,7 +342,10 @@ Seleziona le schede disponibili sul menu personale. Menu Funzione disabilitata dall\'amministratore Alfresco. - + Commenti + Invia diagnostica + Al fine di migliorare Alfresco Mobile, raccogliamo dati tecnici anonimi relativi alla diagnostica. Disattivare, se lo si preferisce. + Invia commenti @@ -734,7 +737,7 @@ Cartella dei preferiti Alfresco Alfresco in the Cloud - Alfresco on premise + Server Alfresco @@ -904,4 +907,4 @@ Questi contenuti non provengono da una fonte supportata.

Selezionare altri contenuti.]]>
- \ No newline at end of file + diff --git a/alfresco-mobile-android/src/main/res/values-ja/strings.xml b/alfresco-mobile-android/src/main/res/values-ja/strings.xml index 64bed60b..72c606c7 100644 --- a/alfresco-mobile-android/src/main/res/values-ja/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-ja/strings.xml @@ -1,14 +1,14 @@ Alfresco in the Cloud - Alfresco Server + Alfresco サーバー お待ちください @@ -165,17 +165,17 @@ ja - + バージョン バージョン: - SDK: + SDK: Alfresco Mobile は Alfresco in the Cloud とオンプレミスの Alfresco Server (3.4 以上) に接続して、社内のコンテンツに外出先から安全にアクセスできるようにします。

+

Alfresco Mobile は Alfresco in the Cloud とオンプレミスの Alfresco サーバー (3.4 以上) に接続して、外出先からでも社内のコンテンツに安全にアクセスできるようにします。

-

Alfresco Mobile は、Alfresco のログイン資格情報を使用して (HTTP または HTTPS 経由で) Alfresco のリポジトリに接続し、権限に基づいてユーザーのアクセスを管理します。

+

Alfresco Mobile は、Alfresco のログイン資格情報を使用して (HTTP または HTTPS 経由で) Alfresco のリポジトリに接続し、権限に基づいてユーザーのアクセスを管理します。

]]>
@@ -342,7 +342,10 @@ メニューに表示するタブを選択してください。 メニュー Alfresco 管理者がこの機能を無効に設定しています。 - + フィードバック + 診断データの送信 + 弊社は、Alfresco Mobile の改善に役立てるために技術的な診断データを匿名で収集しています。データの提供を希望されない場合は、チェックマークを外してください。 + フィードバックの送信 @@ -734,7 +737,7 @@ [お気に入り] フォルダ Alfresco Alfresco in the Cloud - Alfresco On Premise + Alfresco サーバー @@ -798,7 +801,7 @@ アカウントの表示名 リポジトリに接続しているサーバーの名前。 - Alfresco Server + Alfresco サーバー @@ -904,4 +907,4 @@ このコンテンツは、リンクできないソースに属しています。

別のコンテンツを選択してください。]]>
- \ No newline at end of file + diff --git a/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml b/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml index 53c3c008..07aa836a 100644 --- a/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-zh-rCN/strings.xml @@ -1,14 +1,14 @@ zh_cn - + 版本 @@ -342,7 +342,10 @@ 选择菜单上可用的选项卡。 菜单 您的 Alfresco 管理员已禁用此功能。 - + 反馈 + 发送诊断数据 + 为了帮助我们改进 Alfresco Mobile,我们收集匿名技术诊断数据。如果愿意,请关闭。 + 发送反馈 @@ -734,7 +737,7 @@ 收藏夹文件夹 Alfresco Alfresco in the Cloud - Alfresco 内部部署 + Alfresco 服务器 @@ -904,4 +907,4 @@ 此内容不是来自受支持的内容源。

请选择其他内容源。]]>
- \ No newline at end of file + From 71987de285e361fbfb77a2574e401c32b7e4dfa5 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Thu, 3 Mar 2016 16:13:58 +0100 Subject: [PATCH 32/35] ANDROID-274 --- alfresco-mobile-android/src/main/res/values-fr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alfresco-mobile-android/src/main/res/values-fr/strings.xml b/alfresco-mobile-android/src/main/res/values-fr/strings.xml index 1dc917ec..7d213159 100644 --- a/alfresco-mobile-android/src/main/res/values-fr/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-fr/strings.xml @@ -344,7 +344,7 @@ Votre administrateur Alfresco a désactivé cette fonctionnalité. Vos données Envoyer le diagnostic - Aidez-nous à améliorer Alfresco Mobile en nous envoyant vos données de diagnostic technique qui resteront anonymes. Désactivez l'option, le cas échéant. + Aidez-nous à améliorer Alfresco Mobile en nous envoyant vos données de diagnostic technique qui resteront anonymes. Désactivez l\'option, le cas échéant. Envoyer les données From 01de9f92d26315cc213e60a682d10da313a3a03d Mon Sep 17 00:00:00 2001 From: jmpascal Date: Mon, 7 Mar 2016 16:35:04 +0100 Subject: [PATCH 33/35] ANDROID-274 --- .../src/main/res/values-ja/strings.xml | 12 ++++++------ .../src/main/res/values/strings.xml | 2 +- .../android/platform/extensions/AnalyticsHelper.java | 3 --- .../src/main/res/values-ja/alfresco_strings.xml | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/alfresco-mobile-android/src/main/res/values-ja/strings.xml b/alfresco-mobile-android/src/main/res/values-ja/strings.xml index 72c606c7..3da8c961 100644 --- a/alfresco-mobile-android/src/main/res/values-ja/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-ja/strings.xml @@ -21,7 +21,7 @@ 使用できる Alfresco アカウントがありません - Alfresco Server のホスト名を入力してください + Alfresco サーバーのホスト名を入力してください ホスト名 続行 完了 @@ -64,8 +64,8 @@ ホスト名は、www.example.com のような形式で入力してください (必須です)。 www.example.com (必須) 説明 - 説明を入力します (任意です)。 デフォルトは Alfresco Server です - Alfresco Server (任意) + 説明を入力します (任意です)。 デフォルトは Alfresco サーバーです + Alfresco サーバー (任意) 詳細設定 アカウントの認証方法 HTTPS @@ -791,13 +791,13 @@ ユーザー名 - Alfresco Server に接続するときに使用するユーザー名 + Alfresco サーバーに接続するときに使用するユーザー名 Alfresco リポジトリの URL - Alfresco Server の接続先 + Alfresco サーバーの接続先 Alfresco Share の URL - Alfresco Share Server の接続先 + Alfresco Share サーバーの接続先 アカウントの表示名 リポジトリに接続しているサーバーの名前。 diff --git a/alfresco-mobile-android/src/main/res/values/strings.xml b/alfresco-mobile-android/src/main/res/values/strings.xml index 37a9f0dc..0988ed54 100644 --- a/alfresco-mobile-android/src/main/res/values/strings.xml +++ b/alfresco-mobile-android/src/main/res/values/strings.xml @@ -398,7 +398,7 @@ Keep your files in sync You can view and edit your synced files when you\'re offline - Sync has changed ! + Sync has changed! You can now sync different files on different devices. Just find a file and sync it! View and edit your synced files when you\'re offline. When you\'re back online they\'ll automatically sync with Alfresco. What about the files I already favorited? diff --git a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java index f590b6a6..e31f6df2 100644 --- a/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java +++ b/platform/foundation/src/main/java/org/alfresco/mobile/android/platform/extensions/AnalyticsHelper.java @@ -135,7 +135,6 @@ protected static Integer getNumberOfSyncedFolder(Context context, AlfrescoAccoun null, null); syncedFolders = syncedCursor != null ? syncedCursor.getCount() : 0; CursorUtils.closeCursor(syncedCursor); - Log.d("Analytics Folders", syncedFolders + ""); } catch (Exception e) { @@ -159,7 +158,6 @@ protected static Integer getNumberOfSyncedFiles(Context context, AlfrescoAccount null, null); syncedFiles = syncedCursor != null ? syncedCursor.getCount() : 0; CursorUtils.closeCursor(syncedCursor); - Log.d("Analytics Files", syncedFiles + ""); } catch (Exception e) { @@ -189,7 +187,6 @@ protected static Long getSizeOfSyncedFiles(Context context, AlfrescoAccount acco } } CursorUtils.closeCursor(syncedCursor); - Log.d("Analytics Size", syncedSize + ""); } catch (Exception e) { diff --git a/platform/foundation/src/main/res/values-ja/alfresco_strings.xml b/platform/foundation/src/main/res/values-ja/alfresco_strings.xml index 5459db1d..e5fc2c81 100644 --- a/platform/foundation/src/main/res/values-ja/alfresco_strings.xml +++ b/platform/foundation/src/main/res/values-ja/alfresco_strings.xml @@ -303,7 +303,7 @@ アカウント情報を確認しています… アカウントを使用する準備ができました。 - Alfresco Server + Alfresco サーバー Alfresco in the Cloud From e3c9dda924fd6a5d448781c35718afd9b2bdb416 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Tue, 8 Mar 2016 09:50:30 +0100 Subject: [PATCH 34/35] ANDROID-278 --- .../extension/tools/DeveloperSessionManager.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java b/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java index a75135c4..04980687 100644 --- a/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java +++ b/extensions/tools/src/main/java/org/alfresco/mobile/android/application/extension/tools/DeveloperSessionManager.java @@ -31,6 +31,7 @@ import org.alfresco.mobile.android.api.session.authentication.OAuthData; import org.alfresco.mobile.android.api.session.authentication.impl.OAuth2DataImpl; import org.alfresco.mobile.android.api.utils.IOUtils; +import org.alfresco.mobile.android.async.session.RequestSessionEvent; import org.alfresco.mobile.android.platform.AlfrescoNotificationManager; import org.alfresco.mobile.android.platform.SessionManager; import org.alfresco.mobile.android.platform.accounts.AlfrescoAccount; @@ -42,6 +43,8 @@ import android.os.Bundle; import android.os.Environment; +import com.squareup.otto.Subscribe; + public class DeveloperSessionManager extends SessionManager { public static final String OAUTH_URL = "oauth_url"; @@ -84,6 +87,15 @@ protected DeveloperSessionManager(Context context) super(context); } + // /////////////////////////////////////////////////////////////////////////// + // EVENTS RECEIVER + // /////////////////////////////////////////////////////////////////////////// + @Subscribe + public void onSessionRequested(RequestSessionEvent event) + { + super.onSessionRequested(event); + } + // /////////////////////////////////////////////////////////////////////////// // SETTINGS // /////////////////////////////////////////////////////////////////////////// From cc42380d029b602ea8e1d846a88f682d0b85ff94 Mon Sep 17 00:00:00 2001 From: jmpascal Date: Tue, 8 Mar 2016 10:03:31 +0100 Subject: [PATCH 35/35] ANDROID-274 --- alfresco-mobile-android/src/main/res/values-it/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alfresco-mobile-android/src/main/res/values-it/strings.xml b/alfresco-mobile-android/src/main/res/values-it/strings.xml index d20cdadb..864e8f80 100644 --- a/alfresco-mobile-android/src/main/res/values-it/strings.xml +++ b/alfresco-mobile-android/src/main/res/values-it/strings.xml @@ -344,7 +344,7 @@ Funzione disabilitata dall\'amministratore Alfresco. Commenti Invia diagnostica - Al fine di migliorare Alfresco Mobile, raccogliamo dati tecnici anonimi relativi alla diagnostica. Disattivare, se lo si preferisce. + Al fine di migliorare Alfresco Mobile, vengono raccolti dati tecnici anonimi relativi alla diagnostica. Disattiva l\'opzione, se lo preferisci. Invia commenti