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

Commit 48f4605e authored by TChardeur's avatar TChardeur
Browse files

Fixed a few bugs

parent 0f5ad294
Loading
Loading
Loading
Loading
+34 −12
Original line number Diff line number Diff line
@@ -11,31 +11,58 @@ import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.Credentials;

import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settings.R;
import com.android.settings.accounts.FollowNSULinkRemoteOperation;

import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;

public class AccountRemoteStoragePreferenceController extends AbstractPreferenceController {
public class AccountRemoteStoragePreferenceController 
        extends AbstractPreferenceController
        implements OnClickListener {
    private static final String KEY_ACCOUNT_REMOTE_STORAGE = "account_remote_storage";

    private OwnCloudClient mClient;
    private Handler mhandler;
    private Account mAccount;
    private UserHandle mUserHandle;

    public AccountRemoteStoragePreferenceController(Context context) {
        super(context);
    }


    @Override
    public boolean isAvailable() {
        return this.mAccount.type.equals("e.foundation.webdav.eelo");
    }

    @Override
    public String getPreferenceKey() {
        return KEY_ACCOUNT_REMOTE_STORAGE;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    public void init(Account account, UserHandle userHandle) {
        this.mAccount = account;
        this.mUserHandle = userHandle;

        setContentView(R.layout.remove_account_button);

        Uri serverUri = Uri.parse(getString(R.string.e_ecloud_server_uri));

        mHandler = new Handler();
        mClient = OwnCloudClientFactory.createOwnCloudClient(serverUri, this, true);
        this.mHandler = new Handler();
        this.mClient = OwnCloudClientFactory.createOwnCloudClient(serverUri, this, true);

        Credentials cred = mAccount.getState().getCredentials(AuthScope.ANY);
        Credentials cred = this.mAccount.getState().getCredentials(AuthScope.ANY);

        mClient.setCredentials(
        this.mClient.setCredentials(
      			OwnCloudCredentialsFactory.newBasicCredentials(
      					cred.getUserName(),
      					cred.getPassword()
@@ -43,11 +70,6 @@ public class AccountRemoteStoragePreferenceController extends AbstractPreference
  		  );
    }

    public void init(Account account, UserHandle userHandle) {
        mAccount = account;
        mUserHandle = userHandle;
    }

    @Override
    public void onClick(View button) {
        if (button.getId() == R.id.increase_storage_button)
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public class FollowNSULinkRemoteOperation extends RemoteOperation {
        GetMethod get = new GetMethod(url);
        int status = client.executeMethod(get);

        if(!status)
        if(status == 0)
            return new RemoteOperationResult(false, get);

        String redirectLink = get.getResponseBodyAsString();