Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
show quota for server without quota-unlimited info capability
  • Loading branch information
AndyScherzinger committed Aug 31, 2016
commit b29744c00487dcf1831295a660389a3af088debb
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
/// dependencies for app building
compile name: 'touch-image-view'

compile 'com.github.nextcloud:android-library:1.0.4'
compile 'com.github.nextcloud:android-library:1.0.6'
compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
compile 'com.jakewharton:disklrucache:2.0.2'
Expand Down
22 changes: 18 additions & 4 deletions src/com/owncloud/android/ui/activity/DrawerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -587,19 +587,33 @@ public void run() {
AccountUtils.getCurrentOwnCloudAccount(DrawerActivity.this), DrawerActivity.this);

if (result.isSuccess() && result.getData() != null) {
RemoteGetUserQuotaOperation.Quota quota = (RemoteGetUserQuotaOperation.Quota) result.getData().get
(0);
final RemoteGetUserQuotaOperation.Quota quota =
(RemoteGetUserQuotaOperation.Quota) result.getData().get(0);

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 (mQuotaView != null) {
setQuotaInformation(used,total,relative);
if (quotaValue > 0
|| quotaValue == RemoteGetUserQuotaOperation.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