From ba5dae93b43259945e69d59d22b6560fd69076ab Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 24 Jan 2017 18:00:00 +0100 Subject: [PATCH] Quick fix to work with new library updates --- build.gradle | 4 ++-- .../authentication/AuthenticatorActivity.java | 8 ++++---- .../android/operations/GetUserProfileOperation.java | 4 ++-- .../owncloud/android/ui/activity/DrawerActivity.java | 12 +++++++----- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 8d8836c686..b619ee92a4 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.1' + classpath 'com.android.tools.build:gradle:2.2.3' } } @@ -41,7 +41,7 @@ dependencies { /// dependencies for app building compile name: 'touch-image-view' - compile 'com.github.nextcloud:android-library:1.0.10' + compile 'com.github.nextcloud:android-library:change-userinfo-calls-SNAPSHOT' compile "com.android.support:support-v4:${supportLibraryVersion}" compile "com.android.support:design:${supportLibraryVersion}" compile 'com.jakewharton:disklrucache:2.0.2' diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 8de275802f..d421b52635 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -68,6 +68,7 @@ import com.owncloud.android.lib.common.OwnCloudAccount; import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; import com.owncloud.android.lib.common.OwnCloudCredentials; import com.owncloud.android.lib.common.OwnCloudCredentialsFactory; +import com.owncloud.android.lib.common.UserInfo; import com.owncloud.android.lib.common.accounts.AccountTypeUtils; import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException; import com.owncloud.android.lib.common.accounts.AccountUtils.Constants; @@ -79,7 +80,6 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.status.OwnCloudVersion; import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation; -import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation.UserInfo; import com.owncloud.android.operations.DetectAuthenticationMethodOperation.AuthenticationMethod; import com.owncloud.android.operations.GetServerInfoOperation; import com.owncloud.android.operations.OAuth2GetAccessToken; @@ -1086,8 +1086,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity if (result.isSuccess()) { boolean success = false; String username; - if (result.getData().get(0) instanceof GetRemoteUserInfoOperation.UserInfo) { - username = ((GetRemoteUserInfoOperation.UserInfo) result.getData().get(0)).mDisplayName; + if (result.getData().get(0) instanceof UserInfo) { + username = ((UserInfo) result.getData().get(0)).getDisplayName(); } else { username = (String) result.getData().get(0); } @@ -1648,7 +1648,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity try { UserInfo userInfo = (UserInfo) authResult.getData().get(0); mAccountMgr.setUserData( - mAccount, Constants.KEY_DISPLAY_NAME, userInfo.mDisplayName + mAccount, Constants.KEY_DISPLAY_NAME, userInfo.getDisplayName() ); } catch (ClassCastException c) { Log_OC.w(TAG, "Couldn't get display name for " + username); diff --git a/src/com/owncloud/android/operations/GetUserProfileOperation.java b/src/com/owncloud/android/operations/GetUserProfileOperation.java index e1a55569d8..9bdcd75ace 100644 --- a/src/com/owncloud/android/operations/GetUserProfileOperation.java +++ b/src/com/owncloud/android/operations/GetUserProfileOperation.java @@ -24,10 +24,10 @@ import android.accounts.AccountManager; import com.owncloud.android.MainApp; import com.owncloud.android.lib.common.OwnCloudClient; +import com.owncloud.android.lib.common.UserInfo; import com.owncloud.android.lib.common.accounts.AccountUtils; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation; -import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation.UserInfo; import com.owncloud.android.operations.common.SyncOperation; /** @@ -63,7 +63,7 @@ public class GetUserProfileOperation extends SyncOperation { accountManager.setUserData( storedAccount, AccountUtils.Constants.KEY_DISPLAY_NAME, - userInfo.mDisplayName + userInfo.getDisplayName() ); } return result; diff --git a/src/com/owncloud/android/ui/activity/DrawerActivity.java b/src/com/owncloud/android/ui/activity/DrawerActivity.java index c580fe6da9..7bbbbc6b5d 100644 --- a/src/com/owncloud/android/ui/activity/DrawerActivity.java +++ b/src/com/owncloud/android/ui/activity/DrawerActivity.java @@ -48,10 +48,12 @@ import com.owncloud.android.R; import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.OwnCloudAccount; +import com.owncloud.android.lib.common.Quota; +import com.owncloud.android.lib.common.UserInfo; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.utils.Log_OC; -import com.owncloud.android.lib.resources.users.RemoteGetUserQuotaOperation; +import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation; import com.owncloud.android.ui.TextDrawable; import com.owncloud.android.utils.DisplayUtils; @@ -620,13 +622,13 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU Thread t = new Thread(new Runnable() { public void run() { - RemoteOperation getQuotaInfoOperation = new RemoteGetUserQuotaOperation(); + RemoteOperation getQuotaInfoOperation = new GetRemoteUserInfoOperation(); RemoteOperationResult result = getQuotaInfoOperation.execute( AccountUtils.getCurrentOwnCloudAccount(DrawerActivity.this), DrawerActivity.this); if (result.isSuccess() && result.getData() != null) { - final RemoteGetUserQuotaOperation.Quota quota = - (RemoteGetUserQuotaOperation.Quota) result.getData().get(0); + final UserInfo userInfo = (UserInfo) result.getData().get(0); + final Quota quota = userInfo.getQuota(); final long used = quota.getUsed(); final long total = quota.getTotal(); @@ -637,7 +639,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU @Override public void run() { if (quotaValue > 0 - || quotaValue == RemoteGetUserQuotaOperation.QUOTA_LIMIT_INFO_NOT_AVAILABLE) { + || quotaValue == GetRemoteUserInfoOperation.QUOTA_LIMIT_INFO_NOT_AVAILABLE) { /** * show quota in case * it is available and calculated (> 0) or