Skip to content

Commit

Permalink
Merge branch 'master' into fixOOB
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasKaminsky authored Nov 16, 2016
2 parents d8c1942 + 4dc3ad2 commit 8e97a32
Show file tree
Hide file tree
Showing 25 changed files with 104 additions and 130 deletions.
14 changes: 14 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pipeline:
test:
image: nextcloudci/android:android-7
commands:
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 20M
- emulator -avd test -no-window &
- ./wait_for_emulator.sh
# build app
- ./gradlew clean build

environment:
- ANDROID_TARGET=android-24
- ANDROID_ABI=armeabi-v7a
- LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/opt/android-sdk-linux/tools/lib64/gles_mesa/
2 changes: 2 additions & 0 deletions .lgtm
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pattern = "(?i):shipit:|:\\+1:|LGTM"
self_approval_off=true
approvals = 1
49 changes: 0 additions & 49 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="23" />
android:targetSdkVersion="24" />

</manifest>

28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# [Nextcloud](https://nextcloud.com) Android Library
**Build status:** master ![](https://api.travis-ci.org/nextcloud/android-library.svg?branch=master)
# [Nextcloud](https://nextcloud.com) Android Library [![Build Status](https://drone.nextcloud.com/api/badges/nextcloud/android-library/status.svg)](https://drone.nextcloud.com/nextcloud/android-library) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d9f94f04e0f447a6b21c0ae08f6f7594)](https://www.codacy.com/app/Nextcloud/android-library?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nextcloud/android-library&amp;utm_campaign=Badge_Grade)

## Introduction
Using Nextcloud Android library it will be the easiest way to communicate with Nextcloud servers.
Add this library in your project and integrate your application with Nextcloud seamlessly.

## Use Library
In the repository it is not only the library project but also the example project sample_client;
In the repository it is not only the library project but also the example project "sample_client";
thanks to it you will learn how to use the library.

*There are different ways of adding this library to your code*
Expand Down Expand Up @@ -37,22 +36,27 @@ The repository holds one main branch with an infinite lifetime:

Branch __origin/master__ is considered the main branch where the source code of HEAD always reflects a state with the latest delivered development changes for the next release.

Other branches, some supporting branches are used to aid parallel development between team members, ease tracking of features, prepare for production releases and to assist in quickly fixing live production problems. Unlike the main branches, these branches always have a limited life time, since they will be removed eventually.
Other branches, some supporting branches are used to aid parallel development between team members, ease tracking of features and to assist in quickly fixing live production problems. Unlike the main branch, these branches always have a limited life time, since they will be removed eventually (feature branching).

The different types of branches we use:
## Development process
We are all about quality while not sacrificing speed so we use a very pragmatic workflow.

- Branch __perNewFeature__
- Branch __releaseBranches__

Both of them branch off from master and must merge back into master branch through a [pull requests](https://github.com/nextcloud/android-library/pulls) in Github. Once the PR is approved and merged, the branch may be deleted.
* create an issue with feature request
* discuss it with other developers
* create mockup if necessary
* must be approved --> label approved
* after that no conceptual changes!
* develop code
* create [pull request](https://github.com/nextcloud/android-library/pulls)
* to assure the quality of the app, any PR gets reviewed, approved and tested by [two developers](https://github.com/nextcloud/android-library/blob/master/MAINTAINERS) before it will be merged to master

## License

Nextcloud Android Library is available under MIT license. See [LICENSE.md](https://github.com/nextcloud/android-library/blob/master/LICENSE.md) with the full license text.

### Third party libraries
```
Nextcloud Android Library uses Apache JackRabbit, version 2.2.5.
Nextcloud Android Library uses Apache JackRabbit, version 2.12.4.
Copyright (C) 2004-2010 The Apache Software Foundation.
Licensed under Apache License, Version 2.0.
```
Expand All @@ -65,6 +69,6 @@ Licensed under Apache License, Version 2.0.

## Compatibility

Nextcloud Android library is valid for Android version 3.0 and up (android:minSdkVersion="11" android:targetSdkVersion="23").
Nextcloud Android library is valid for Android version 3.0 and up (with ```android:minSdkVersion="11"``` and ```android:targetSdkVersion="24"```).

Nextcloud Android library supports Nextcloud server from version 9.
Nextcloud Android library supports Nextcloud server from version 9+.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
Expand All @@ -18,12 +18,12 @@ repositories {
}

dependencies {
compile 'org.apache.jackrabbit:jackrabbit-webdav:2.10.1'
compile 'org.apache.jackrabbit:jackrabbit-webdav:2.12.4'
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion 24
buildToolsVersion "24.0.2"

sourceSets {
main {
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-23
target=android-24
android.library=true
2 changes: 1 addition & 1 deletion sample_client/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="23" />
android:targetSdkVersion="24" />
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="MainActivity"
android:label="@string/app_name"
Expand Down
9 changes: 2 additions & 7 deletions sample_client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dependencies {
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion 24
buildToolsVersion "24.0.2"

sourceSets {
main {
Expand Down Expand Up @@ -43,9 +43,4 @@ android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
android {
lintOptions {
abortOnError false
}
}
}
2 changes: 1 addition & 1 deletion sample_client/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-23
target=android-24
android.library.reference.1=..
2 changes: 1 addition & 1 deletion sample_client/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
-->

<resources>
<string name="app_name">ownCloud Sample Client</string>
<string name="app_name">Nextcloud Sample Client</string>
<string name="refresh">Refresh</string>
<string name="upload">Upload</string>
<string name="delete_remote_file">Delete remote file</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void setOffset(long offset) {

public long getContentLength() {
try {
return Math.min(mChunkSize, mChannel.size() - mChannel.position());
return Math.min(mChunkSize, mChannel.size() - mOffset);
} catch (IOException e) {
return mChunkSize;
}
Expand Down Expand Up @@ -168,4 +168,4 @@ public void writeRequest(final OutputStream out) throws IOException {

}

}
}
5 changes: 3 additions & 2 deletions src/com/owncloud/android/lib/common/utils/Log_OC.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;


Expand Down Expand Up @@ -43,7 +44,7 @@ public static void d(String TAG, String message){
}
public static void d(String TAG, String message, Exception e) {
Log.d(TAG, message, e);
appendLog(TAG + " : " + message + " Exception : "+ e.getStackTrace());
appendLog(TAG + " : " + message + " Exception : "+ Arrays.toString(e.getStackTrace()));
}
public static void e(String TAG, String message){
Log.e(TAG, message);
Expand All @@ -52,7 +53,7 @@ public static void e(String TAG, String message){

public static void e(String TAG, String message, Throwable e) {
Log.e(TAG, message, e);
appendLog(TAG+" : " + message +" Exception : " + e.getStackTrace());
appendLog(TAG+" : " + message +" Exception : " + Arrays.toString(e.getStackTrace()));
}

public static void v(String TAG, String message){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@


public class ChunkedUploadRemoteFileOperation extends UploadRemoteFileOperation {


private static final int LAST_CHUNK_TIMEOUT = 900000; //15 mins.

public static final long CHUNK_SIZE = 1024000;
private static final String OC_CHUNKED_HEADER = "OC-Chunked";
private static final String OC_CHUNK_SIZE_HEADER = "OC-Chunk-Size";
Expand Down Expand Up @@ -114,6 +116,14 @@ protected int uploadFile(OwnCloudClient client) throws IOException {
mPutMethod.abort();
// next method will throw an exception
}

if (chunkIndex == chunkCount - 1) {
// Added a high timeout to the last chunk due to when the last chunk
// arrives to the server with the last PUT, all chunks get assembled
// within that PHP request, so last one takes longer.
mPutMethod.getParams().setSoTimeout(LAST_CHUNK_TIMEOUT);
}

status = client.executeMethod(mPutMethod);

if (status == 400) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
* <p/>
* Allow updating several parameters, triggering a request to the server per parameter.
*/

public class UpdateRemoteShareOperation extends RemoteOperation {

private static final String TAG = GetRemoteShareOperation.class.getSimpleName();
Expand Down Expand Up @@ -159,24 +158,24 @@ protected RemoteOperationResult run(OwnCloudClient client) {
}
if (mExpirationDateInMillis < 0) {
// clear expiration date
parametersToUpdate.add(new Pair(PARAM_EXPIRATION_DATE, ""));
parametersToUpdate.add(new Pair<>(PARAM_EXPIRATION_DATE, ""));

} else if (mExpirationDateInMillis > 0) {
// set expiration date
DateFormat dateFormat = new SimpleDateFormat(FORMAT_EXPIRATION_DATE);
Calendar expirationDate = Calendar.getInstance();
expirationDate.setTimeInMillis(mExpirationDateInMillis);
String formattedExpirationDate = dateFormat.format(expirationDate.getTime());
parametersToUpdate.add(new Pair(PARAM_EXPIRATION_DATE, formattedExpirationDate));
parametersToUpdate.add(new Pair<>(PARAM_EXPIRATION_DATE, formattedExpirationDate));

} // else, ignore - no update
if (mPermissions > 0) {
// set permissions
parametersToUpdate.add(new Pair(PARAM_PERMISSIONS, Integer.toString(mPermissions)));
parametersToUpdate.add(new Pair<>(PARAM_PERMISSIONS, Integer.toString(mPermissions)));
}

if (mPublicUpload != null) {
parametersToUpdate.add(new Pair(PARAM_PUBLIC_UPLOAD, Boolean.toString(mPublicUpload)));
parametersToUpdate.add(new Pair<>(PARAM_PUBLIC_UPLOAD, Boolean.toString(mPublicUpload)));
}

/// perform required PUT requests
Expand Down
Loading

0 comments on commit 8e97a32

Please sign in to comment.