Skip to content

Commit

Permalink
Merge pull request #713 from nextcloud/fix-quota-crash
Browse files Browse the repository at this point in the history
Fix quota crash
  • Loading branch information
mario authored Mar 3, 2017
2 parents f0bbb4b + 657dbcd commit e883ac1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 30 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.owncloud.android"
android:versionCode="10040201"
android:versionName="1.4.2 RC1">
android:versionCode="10040202"
android:versionName="1.4.2 RC2">

<uses-sdk
android:minSdkVersion="14"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies {
compile name: 'touch-image-view'
compile 'com.android.support:multidex:1.0.1'

compile 'com.github.nextcloud:android-library:1.0.12'
compile 'com.github.nextcloud:android-library:1.0.13'
compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
compile 'com.jakewharton:disklrucache:2.0.2'
Expand Down
56 changes: 29 additions & 27 deletions src/com/owncloud/android/ui/activity/DrawerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -632,34 +632,36 @@ public void run() {
final UserInfo userInfo = (UserInfo) result.getData().get(0);
final Quota quota = userInfo.getQuota();

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);
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);
}
}
}
});
});
}
}
}
});
Expand Down

0 comments on commit e883ac1

Please sign in to comment.