From 657dbcd03ef7d4fefc6eea108ce417cd537bb469 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Fri, 3 Mar 2017 18:52:10 +0100 Subject: [PATCH] Fix quota crash --- AndroidManifest.xml | 4 +- build.gradle | 2 +- .../android/ui/activity/DrawerActivity.java | 56 ++++++++++--------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index b13fa200a097..b41901de0d53 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -20,8 +20,8 @@ --> + android:versionCode="10040202" + android:versionName="1.4.2 RC2"> 0 - || quotaValue == GetRemoteUserInfoOperation.QUOTA_LIMIT_INFO_NOT_AVAILABLE) { - /** - * show quota in case - * it is available and calculated (> 0) or - * in case of legacy servers (==QUOTA_LIMIT_INFO_NOT_AVAILABLE) - */ - setQuotaInformation(used, total, relative); - } else { - /** - * quotaValue < 0 means special cases like - * {@link RemoteGetUserQuotaOperation.SPACE_NOT_COMPUTED}, - * {@link RemoteGetUserQuotaOperation.SPACE_UNKNOWN} or - * {@link RemoteGetUserQuotaOperation.SPACE_UNLIMITED} - * thus don't display any quota information. - */ - showQuota(false); + if (quota != null) { + final long used = quota.getUsed(); + final long total = quota.getTotal(); + final int relative = (int) Math.ceil(quota.getRelative()); + final long quotaValue = quota.getQuota(); + + runOnUiThread(new Runnable() { + @Override + public void run() { + if (quotaValue > 0 + || quotaValue == GetRemoteUserInfoOperation.QUOTA_LIMIT_INFO_NOT_AVAILABLE) { + /** + * show quota in case + * it is available and calculated (> 0) or + * in case of legacy servers (==QUOTA_LIMIT_INFO_NOT_AVAILABLE) + */ + setQuotaInformation(used, total, relative); + } else { + /** + * quotaValue < 0 means special cases like + * {@link RemoteGetUserQuotaOperation.SPACE_NOT_COMPUTED}, + * {@link RemoteGetUserQuotaOperation.SPACE_UNKNOWN} or + * {@link RemoteGetUserQuotaOperation.SPACE_UNLIMITED} + * thus don't display any quota information. + */ + showQuota(false); + } } - } - }); + }); + } } } });