Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5140bf23 authored by Andy Scherzinger's avatar Andy Scherzinger
Browse files

minor CR code formattings

parent 5485ee44
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -24,17 +24,16 @@

package com.owncloud.android.lib.resources.users;

import java.util.ArrayList;

import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.json.JSONObject;

import com.owncloud.android.lib.common.OwnCloudClient;
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 org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.json.JSONObject;

import java.util.ArrayList;

/**
 * Gets information (id, display name, and e-mail address) about the user logged in.
@@ -42,7 +41,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 * @author masensio
 * @author David A. Velasco
 */

public class GetRemoteUserInfoOperation extends RemoteOperation {

    private static final String TAG = GetRemoteUserInfoOperation.class.getSimpleName();
@@ -91,7 +89,6 @@ public class GetRemoteUserInfoOperation extends RemoteOperation {
                ArrayList<Object> data = new ArrayList<Object>();
                data.add(userInfo);
                result.setData(data);

            } else {
                result = new RemoteOperationResult(false, status, get.getResponseHeaders());
                String response = get.getResponseBodyAsString();
@@ -105,13 +102,11 @@ public class GetRemoteUserInfoOperation extends RemoteOperation {
        } catch (Exception e) {
            result = new RemoteOperationResult(e);
            Log_OC.e(TAG, "Exception while getting OC user information", e);

        } finally {
            if (get != null) {
                get.releaseConnection();
            }
        }

        return result;
    }

@@ -119,11 +114,9 @@ public class GetRemoteUserInfoOperation extends RemoteOperation {
        return (status == HttpStatus.SC_OK);
    }


    public static class UserInfo {
        public String mId = "";
        public String mDisplayName = "";
        public String mEmail = "";
    }

}
+27 −19
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@ 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 org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.HttpStatus;
import org.json.JSONObject;

import java.util.ArrayList;
@@ -47,8 +47,8 @@ import java.util.ArrayList;
public class RemoteGetUserQuotaOperation extends RemoteOperation {

    static public class Quota {
        long mFree, mUsed, mTotal;
        double mRelative;
        private long mFree, mUsed, mTotal;
        private double mRelative;

        public Quota(long free, long used, long total, double relative) {
            mFree = free;
@@ -57,10 +57,21 @@ public class RemoteGetUserQuotaOperation extends RemoteOperation {
            mRelative = relative;
        }

        public long getFree() { return mFree; }
        public long getUsed() { return mUsed; }
        public long getTotal() { return mTotal; }
        public double getRelative() { return mRelative; }
        public long getFree() {
            return mFree;
        }

        public long getUsed() {
            return mUsed;
        }

        public long getTotal() {
            return mTotal;
        }

        public double getRelative() {
            return mRelative;
        }
    }

    private static final String TAG = RemoteGetUserQuotaOperation.class.getSimpleName();
@@ -82,7 +93,6 @@ public class RemoteGetUserQuotaOperation extends RemoteOperation {
        int status;
        GetMethod get = null;


        //Get the user
        try {
            OwnCloudBasicCredentials credentials = (OwnCloudBasicCredentials) client.getCredentials();
@@ -105,14 +115,12 @@ public class RemoteGetUserQuotaOperation extends RemoteOperation {
                final Long quotaTotal = quota.getLong(NODE_QUOTA_TOTAL);
                final Double quotaRelative = quota.getDouble(NODE_QUOTA_RELATIVE);


                // Result
                result = new RemoteOperationResult(true, status, get.getResponseHeaders());
                // Quota data in data collection
                ArrayList<Object> data = new ArrayList<Object>();
                ArrayList<Object> data = new ArrayList<>();
                data.add(new Quota(quotaFree, quotaUsed, quotaTotal, quotaRelative));
                result.setData(data);

            } else {
                result = new RemoteOperationResult(false, status, get.getResponseHeaders());
                String response = get.getResponseBodyAsString();
@@ -126,11 +134,11 @@ public class RemoteGetUserQuotaOperation extends RemoteOperation {
        } catch (Exception e) {
            result = new RemoteOperationResult(e);
            Log_OC.e(TAG, "Exception while getting OC user information", e);

        } finally {
            if (get != null) {
                get.releaseConnection();
            }

        }
        return result;
    }

+0 −4
Original line number Diff line number Diff line
@@ -51,10 +51,6 @@ public class GetUserQuotaTest extends RemoteTest {
    private static final String IMAGE_PATH_WITH_SPECIAL_CHARS = "/@file@download.png";
    private static final String IMAGE_NOT_FOUND = "/fileNotFound.png";

    private String mFullPath2Image;
    private String mFullPath2ImageWitSpecialChars;
    private String mFullPath2ImageNotFound;
    private String mDownloadedFilePath;
    private TestActivity mActivity;

    @Override