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

Commit 5ebf81e2 authored by jabarros's avatar jabarros
Browse files

Merge pull request #33 from owncloud/release-0.9.2

Release 0.9.2
parents 1651d1a5 f7c992f3
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -2,9 +2,10 @@ language: java
jdk: oraclejdk7
jdk: oraclejdk7
before_install:
before_install:
- sudo apt-get update -qq
- sudo apt-get update -qq
- sudo apt-get install -qq libstdc++6:i386 lib32z1
- sudo apt-get install -qq libstdc++6:i386 lib32z1 expect
- curl -3L https://raw.github.com/embarkmobile/android-sdk-installer/version-1/android-sdk-installer
- export LICENSES="android-sdk-license-5be876d5|android-sdk-license-598b93a6"
  | bash /dev/stdin --install=$COMPONENTS
- curl -3L https://raw.github.com/embarkmobile/android-sdk-installer/version-2/android-sdk-installer
  | bash /dev/stdin --install=$COMPONENTS --accept=$LICENSES
- source ~/.android-sdk-installer/env
- source ~/.android-sdk-installer/env
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 20M
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 20M
- emulator -avd test -no-skin -no-audio -no-window &
- emulator -avd test -no-skin -no-audio -no-window &
@@ -24,4 +25,4 @@ env:
  - secure: aF4U20Xlu/rfrbxCmoJAiGh1doYTAZ10UEDmajuinT+ZGSJLivuqD7DDY/00sI6IXWg+J1vL+7jJm4JSYusHPg38UHZ4q92k6RmZycW2ATUzZnGT54O5FRnY67MfVwgVpIMK9UOL/6NEciBHEjlIOL0wbKQiJB++1YtBZOQLGL4=
  - secure: aF4U20Xlu/rfrbxCmoJAiGh1doYTAZ10UEDmajuinT+ZGSJLivuqD7DDY/00sI6IXWg+J1vL+7jJm4JSYusHPg38UHZ4q92k6RmZycW2ATUzZnGT54O5FRnY67MfVwgVpIMK9UOL/6NEciBHEjlIOL0wbKQiJB++1YtBZOQLGL4=
  - secure: N+ECSwNg8v2GsAFJ2y/tCiffauHDpN76zuFI2pDqf0fjmCtJZHu4BH5ArXBHjyHKmgn20a/8eZXcwJaH1HsJ80bo7vDJ2miShjGIQ90hPcdmUiB2XVJcew4f04CtvMDH5o7DRt4ykWArlbPL2rhVag0jotlSidolHBwRFnbDhDY=
  - secure: N+ECSwNg8v2GsAFJ2y/tCiffauHDpN76zuFI2pDqf0fjmCtJZHu4BH5ArXBHjyHKmgn20a/8eZXcwJaH1HsJ80bo7vDJ2miShjGIQ90hPcdmUiB2XVJcew4f04CtvMDH5o7DRt4ykWArlbPL2rhVag0jotlSidolHBwRFnbDhDY=
  matrix:
  matrix:
  - COMPONENTS=build-tools-19.0.3,android-19,sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
  - COMPONENTS=build-tools-20.0.0,android-19,sys-img-armeabi-v7a-android-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
+1 −0
Original line number Original line Diff line number Diff line
@@ -33,3 +33,4 @@
        android:targetSdkVersion="19" />
        android:targetSdkVersion="19" />


</manifest>
</manifest>
+7 −1
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.resources.files.RemoteFile;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -80,7 +81,12 @@ public class MainActivity extends Activity implements OnRemoteOperationListener,
        
        
    	Uri serverUri = Uri.parse(getString(R.string.server_base_url) + AccountUtils.WEBDAV_PATH_4_0);
    	Uri serverUri = Uri.parse(getString(R.string.server_base_url) + AccountUtils.WEBDAV_PATH_4_0);
    	mClient = OwnCloudClientFactory.createOwnCloudClient(serverUri, this, true);
    	mClient = OwnCloudClientFactory.createOwnCloudClient(serverUri, this, true);
    	mClient.setBasicCredentials(getString(R.string.username), getString(R.string.password));
    	mClient.setCredentials(
    			OwnCloudCredentialsFactory.newBasicCredentials(
    					getString(R.string.username), 
    					getString(R.string.password)
				)
		);
    	
    	
    	mFilesAdapter = new FilesArrayAdapter(this, R.layout.file_in_list);
    	mFilesAdapter = new FilesArrayAdapter(this, R.layout.file_in_list);
    	((ListView)findViewById(R.id.list_view)).setAdapter(mFilesAdapter);
    	((ListView)findViewById(R.id.list_view)).setAdapter(mFilesAdapter);
+98 −0
Original line number Original line Diff line number Diff line
/* ownCloud Android client application
 *   Copyright (C) 2014 ownCloud Inc.
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License version 2,
 *   as published by the Free Software Foundation.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package com.owncloud.android.lib.common;


import java.io.IOException;

import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;

import android.accounts.Account;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.content.Context;
import android.net.Uri;

/**
 * OwnCloud Account
 * 
 * @author David A. Velasco
 */
public class OwnCloudAccount {

    private Uri mBaseUri; 
    
    private OwnCloudCredentials mCredentials;
    
    private String mSavedAccountName;
    
    
    public OwnCloudAccount(Account savedAccount, Context context) 
    		throws AccountNotFoundException, AuthenticatorException, 
    		IOException, OperationCanceledException {
    	
    	if (savedAccount == null) {
    		throw new IllegalArgumentException("Parameter 'savedAccount' cannot be null");
    	}
    	if (context == null) {
    		throw new IllegalArgumentException("Parameter 'context' cannot be null");
    	}
    	
    	mSavedAccountName = savedAccount.name;
        mBaseUri = Uri.parse(AccountUtils.getBaseUrlForAccount(context, savedAccount));
        mCredentials = AccountUtils.getCredentialsForAccount(context, savedAccount);
        if (mCredentials == null) {
        	mCredentials = OwnCloudCredentialsFactory.getAnonymousCredentials();
        }
    }
    
    
    public OwnCloudAccount(Uri baseUri, OwnCloudCredentials credentials) {
        if (baseUri == null) {
            throw new IllegalArgumentException("Parameter 'baseUri' cannot be null");
        }
        mSavedAccountName = null;
        mBaseUri = baseUri;
        mCredentials = credentials != null ? 
        		credentials : OwnCloudCredentialsFactory.getAnonymousCredentials();
        String username = mCredentials.getUsername();
        if (username != null) {
        	mSavedAccountName = AccountUtils.buildAccountName(mBaseUri, username);
        }
    }
    

	public boolean isAnonymous() {
        return (mCredentials == null);
    }
    
    public Uri getBaseUri() {
        return mBaseUri;
    }
            
    public OwnCloudCredentials getCredentials() {
        return mCredentials;
    }
    
    public String getName() {
    	return mSavedAccountName;
    }

    
}
 No newline at end of file
+48 −0
Original line number Original line Diff line number Diff line
package com.owncloud.android.lib.common;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthPolicy;
import org.apache.commons.httpclient.auth.AuthScope;

public class OwnCloudBasicCredentials implements OwnCloudCredentials {

	private String mUsername;
	private String mPassword;

	public OwnCloudBasicCredentials(String username, String password) {
		mUsername = username != null ? username : "";
		mPassword = password != null ? password : "";
	}

	@Override
	public void applyTo(OwnCloudClient client) {
        List<String> authPrefs = new ArrayList<String>(1);
        authPrefs.add(AuthPolicy.BASIC);
        client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);        
        
        client.getParams().setAuthenticationPreemptive(true);
        client.getState().setCredentials(
        		AuthScope.ANY, 
        		new UsernamePasswordCredentials(mUsername, mPassword)
		);
	}

	@Override
	public String getUsername() {
		return mUsername;
	}

	@Override
	public String getAuthToken() {
		return mPassword;
	}

	@Override
	public boolean authTokenExpires() {
		return false;
	}

}
Loading