Merge branch 'develop' of github.com:owncloud/android into reliable_uploads

Conflicts:
	SETUP.md
	owncloud-android-library
	src/com/owncloud/android/datamodel/OCFile.java
This commit is contained in:
Luke Owncloud 2014-12-01 07:43:56 +01:00
commit 99d82430c5
29 changed files with 966 additions and 153 deletions

12
.gitignore vendored
View file

@ -10,6 +10,8 @@
# generated files
bin/
build/
*.iml
gen/
target/
@ -31,5 +33,11 @@ oc_framework/proguard-project.txt
oc_framework-test-project/proguard-project.txt
tests/proguard-project.txt
# Should not be commited inside this repo:
actionbarsherlock/
# Android Studio and Gradle specific entries
.gradle
.idea
*.iml
build
# Actionbarsherlock is now ignored since scripts takes care of init the sub-modules.
actionbarsherlock

5
.gitmodules vendored
View file

@ -1,6 +1,5 @@
[submodule "actionbarsherlock"]
path = actionbarsherlock
url = git://github.com/JakeWharton/ActionBarSherlock.git
[submodule "owncloud-android-library"]
path = owncloud-android-library
url = git://github.com/owncloud/android-library.git
branch = develop

View file

@ -1,22 +1,16 @@
language: android
android:
components:
- platform-tools
- tools
- build-tools-20.0.0
- android-19
- android-17
- android-14
- extra-android-support
licenses:
- 'android-sdk-license-5be876d5'
- 'android-sdk-license-598b93a6'
jdk: oraclejdk7
before_install:
- rm pom.xml
- ./setup_env.sh
- ./setup_env.sh gradle
script:
- ./gradlew clean build
- ./setup_env.sh ant
- ant clean
- ant debug

View file

@ -3,11 +3,9 @@ If you want to start help developing ownCloud please follow the [contribution gu
If you have any problems, start again with 1) and work your way down. If something still does not work as described here, please open a new issue describing exactly what you did, what happened, and what should have happened.
### 1) Fork and download android/develop repository:
### 1. Fork and download android/develop repository:
NOTE: Android SDK with platforms 8, 14 and 19 (and maybe others) need to be installed.
You must have the Android SDK 'tools/', and 'platforms-tools/' folders in your environment path variable.
"git" need to be installed and in your environment path variable.
NOTE: You must have git in your environment path variable to perform the next operations.
* Navigate to https://github.com/owncloud/android, click fork.
* Clone your new repo: "git clone git@github.com:YOURGITHUBNAME/android.git"
@ -16,25 +14,30 @@ NOTE: Android SDK with platforms 8, 14 and 19 (and maybe others) need to be inst
* Pull changes from your develop branch: "git pull origin develop"
* Make official ownCloud repo known as upstream: "git remote add upstream git@github.com:owncloud/android.git"
* Make sure to get the latest changes from official android/develop branch: "git pull upstream develop"
* Complete the setup of project properties and resolve pending dependencies running "setup_env.bat" or "./setup_env.sh" .
At this point you can continue using different tools to build the project. Sections 2a), 2b), and 2c) describe some of the existing alternatives.
At this point you can continue using different tools to build the project. Section 2, 3, 4, 5 and 6 describe some of the existing alternatives.
### 2. Building with Ant:
### 2a) Building with Ant:
NOTE: You must have the Android SDK 'tools/', and 'platforms-tools/' folders in your environment path variable.
* Run "ant clean" .
* Resolve necessary dependencies running:
- Windows: "setup_env.bat ant"
- Mac OS/Linux: "./setup_env.sh ant"
* Run "ant clean".
* Run "ant debug" to generate a debuggable version of the ownCloud app.
### 2b) Building with console/maven:
### 3. Building with console/maven:
WARNING: OBSOLETE!
NOTE: You must have mvn (version >= 3.1.1) in your environment path. Current Android 'platforms-tools' need to be installed.
Download/install Android plugin for Maven, install owncloud-android-library, then build ownCloud with mvn:
Download/install Android plugin for Maven, then build ownCloud with mvn:
* Resolve necessary dependencies running:
- Windows: "setup_env.bat maven"
- Mac OS/Linux: "./setup_env.sh maven"
* cd ..
* git clone https://github.com/mosabua/maven-android-sdk-deployer.git
* cd maven-android-sdk-deployer
@ -43,33 +46,55 @@ Download/install Android plugin for Maven, install owncloud-android-library, the
* mvn install
* cd ..
Now you can create ownCloud APK using "mvn package"
Now you can create ownCloud APK using "mvn package" and find it as ownCloud.apk under the target
### 2c) Building with Eclipse:
### 4. Building with Gradle:
* Complete the setup of project properties running:
- Windows: "setup_env.bat gradle"
- Mac OS/Linux: "./setup_env.sh gradle"
* Open a terminal and go to the "android" directory that contains the repository.
* Run the 'clean' and 'build' tasks using the Gradle wrapper provided:
- Windows: gradlew.bat clean build
- Mac OS/Linux: ./gradlew clean build
* You can find the generated apk file in android/build/outputs/apk
### 5. Building with Eclipse:
NOTE: You must have the Android SDK 'tools/', and 'platforms-tools/' folders in your environment path variable.
* Complete the setup of project properties and resolve pending dependencies running "setup_env.bat" or "./setup_env.sh" .
* Open Eclipse and create new "Android Project from Existing Code". Choose android/actionbarsherlock/library as root.
* Resolve necessary dependencies running:
- Windows: "setup_env.bat ant"
- Mac OS/Linux: "./setup_env.sh ant"
* Open Eclipse and create new "Android Project from Existing Code". Choose android/actionbarsherlock/library as root.
* Clean project and compile.
* If any error appear, check the project properties; in the 'Android' section, API Level should be greater or equal than 14.
* If "error loading libz.so.1" appears, try "sudo apt-get install lib32z1"
* If any error appears, check the project properties; in the 'Android' section, API Level should be greater or equal than 14.
* Make sure android/actionbarsherlock/library/bin/library.jar was created.
* Create a new "Android Project from Existing Code". Choose android/owncloud-android-library as root. (test and sample clients are not required.)
* Create a new "Android Project from Existing Code". Choose android/owncloud-android-library as root.
* Clean project and compile.
* If any error appear, check the project properties; in the 'Android' section, API Level should be 19 or greater.
* Make sure 'android/owncloud-android-library/bin/owncloud android library.jar' was created.
* If any error appears, check the project properties; in the 'Android' section, API Level should be 19 or greater.
* Make sure android/owncloud-android-library/bin/classes.jar was created.
* Import ownCloud Android project.
* Clean project and compile.
* If any error appears, check the project properties of owncloud-android project; in the 'Android' section:
- API Level should be 19 or greater.
- Two library projects should appear referred in the bottom square: actionbarsherlock/library and owncloud-android-library. Add them if needed.
- API Level should be 19 or greater.
- Two library projects should appear referred in the bottom square: actionbarsherlock/library and owncloud-android-library. Add them if needed.
* After those actions you should be good to go. HAVE FUN!
NOTE: Even though API level is set to 19, APK also runs on older devices because in AndroidManifest.xml minSdkVersion is set to 8.
### 3) Create pull request:
### 6. Building with Android Studio:
* Complete the setup of project properties running:
- Windows: "setup_env.bat gradle"
- Mac OS/Linux: "./setup_env.sh gradle"
* The first time you want to open the project in Android Studio, select 'Import Project...' and choose the file "android/settings.gradle".
Android Studio will then create the '.iml' files it needs. If you ever close the project but the files are still there, you just select
'Open Project...'. The file chooser will show an Android face as the folder icon, which you can select to reopen the project.
* To build the project, follow the guidelines shown on [4. Building with Gradle][2].
### 7. Create pull request:
NOTE: You must sign the [Contributor Agreement][1] before your changes can be accepted!
* Commit your changes locally: "git commit -a"
@ -80,7 +105,7 @@ NOTE: You must sign the [Contributor Agreement][1] before your changes can be ac
* Again, click "Edit" and set "compare:develop"
* Enter description and send pull request.
### 4) Create another pull request:
### 8. Create another pull request:
To make sure your new pull request does not contain commits which are already contained in previous PRs, create a new branch which is a clone of upstream/develop.
@ -88,8 +113,9 @@ To make sure your new pull request does not contain commits which are already co
* git checkout -b my_new_develop_branch upstream/develop
* If you want to rename that branch later: "git checkout -b my_new_develop_branch_with_new_name"
* Push branch to server: "git push -u origin name_of_local_develop_branch"
* Use Github to issue PR
* Use GitHub to issue PR
[0]: https://github.com/owncloud/android/blob/master/CONTRIBUTING.md
[1]: http://owncloud.org/about/contributor-agreement/
[2]: https://github.com/owncloud/android/blob/master/SETUP.md#4-building-with-gradle

@ -1 +0,0 @@
Subproject commit 9598f2bb2ceed4a834cd5586a903f270ca4c0ccc

78
build.gradle Normal file
View file

@ -0,0 +1,78 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.0'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
artifacts.add("default", file('libs/actionbarsherlock.aar'))
dependencies {
compile name: 'touch-image-view'
compile 'com.android.support:support-v4:19.1.0'
compile project('libs/actionbarsherlock_lib')
compile project(':owncloud-android-library')
compile 'com.jakewharton:disklrucache:2.0.2'
}
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['res']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
android {
lintOptions {
abortOnError false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,6 @@
#Wed Oct 15 10:45:44 CEST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip

164
gradlew vendored Executable file
View file

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View file

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View file

@ -0,0 +1,2 @@
configurations.create("default")
artifacts.add("default", file('library-4.1.0.aar'))

Binary file not shown.

View file

@ -0,0 +1,42 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.0'
}
}
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}

Binary file not shown.

View file

@ -0,0 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip

164
oc_jb_workaround/gradlew vendored Executable file
View file

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
oc_jb_workaround/gradlew.bat vendored Normal file
View file

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View file

@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-17
target=android-19

64
pom.xml
View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.owncloud.android</groupId>
@ -13,7 +14,7 @@
<owncloud.version>1.5.1-SNAPSHOT</owncloud.version>
<java-version>1.6</java-version>
<!-- Given by maven-android-sdk-deployer -->
<google.android-version>4.4.2_r3</google.android-version>
<google.android-version>4.4.2_r4</google.android-version>
<!-- Usually the latest Android API -->
<google.android-api>19</google.android-api>
<actionbarsherlock-version>4.2.0</actionbarsherlock-version>
@ -26,8 +27,17 @@
<developerConnection>scm:git:git@github.com:owncloud/android.git</developerConnection>
<url>https://github.com/owncloud/android</url>
</scm>
<!--<repositories>-->
<!--<repository>-->
<!--<id>android-support</id>-->
<!--<url>file://${env.ANDROID_HOME}/extras/android/m2repository</url>-->
<!--</repository>-->
<!--</repositories>-->
<dependencies>
<!-- Dirty trick, but it works. TouchImageView library is not available as Maven project. -->
<dependency>
<groupId>touch-image-view.jar</groupId>
@ -44,6 +54,13 @@
<version>19.1.0</version>
</dependency>-->
<!-- Instead we need to include the exact same version -->
<dependency>
<groupId>com.jakewharton</groupId>
<artifactId>disklrucache</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>android-support-v4.jar</groupId>
<artifactId>android-support-v4.jar</artifactId>
@ -51,7 +68,15 @@
<scope>system</scope>
<systemPath>${basedir}/third_party/android-support-library/android-support-v4.jar</systemPath>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>library</artifactId>
<version>${actionbarsherlock-version}</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
@ -59,26 +84,19 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>${actionbarsherlock-version}</version>
<scope>provided</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>android.support</groupId>-->
<!--<artifactId>compatibility-v4</artifactId>-->
<!--<version>19.1.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>${actionbarsherlock-version}</version>
<type>apklib</type>
</dependency>
<!-- MUST BE INSTALLED FIRST: cd owncloud-android-library; mvn install -->
<dependency>
<groupId>com.owncloud.android</groupId>
<artifactId>owncloud-android-library</artifactId>
<version>${owncloud.version}</version>
</dependency>
<groupId>com.owncloud.android</groupId>
<artifactId>owncloud-android-library</artifactId>
<version>${owncloud.version}</version>
</dependency>
</dependencies>
@ -92,7 +110,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<version>3.1</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
@ -102,7 +120,7 @@
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.8.0</version>
<version>3.8.2</version>
<configuration>
<sdk>
<path>${env.ANDROID_HOME}</path>

View file

@ -9,6 +9,7 @@
<string name="file_list_seconds_ago">sekondes gelede</string>
<string name="common_ok">OK</string>
<string name="common_cancel">Kanseleer</string>
<string name="common_error">Fout</string>
<string name="empty"></string>
<string name="move_choose_button_text">Kies</string>
</resources>

View file

@ -178,7 +178,7 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
<string name="auth_unauthorized">Nom d\'utilisateur ou mot de passe incorrect</string>
<string name="auth_oauth_error">Échec d\'autorisation</string>
<string name="auth_oauth_error_access_denied">Accès refusé par le serveur d\'autorisation</string>
<string name="auth_wtf_reenter_URL">État inattendu ; veuillez entrer à nouveau l\'URL du serveur</string>
<string name="auth_wtf_reenter_URL">État inattendu ; veuillez saisir à nouveau l\'URL du serveur</string>
<string name="auth_expired_oauth_token_toast">Votre autorisation a expiré. Merci de vous authentifier à nouveau</string>
<string name="auth_expired_basic_auth_toast">Veuillez saisir le mot de passe courant</string>
<string name="auth_expired_saml_sso_token_toast">Votre session a expiré. Merci de vous reconnecter</string>

3
settings.gradle Normal file
View file

@ -0,0 +1,3 @@
include ':owncloud-android-library'
include 'libs/actionbarsherlock_lib'
include ':'

View file

@ -1,8 +1,59 @@
@echo off
:: Use argument to decide which build system should be used
if "%1" == "gradle" goto initForGradle
if "%1" == "maven" goto initForMaven
if "%1" == "ant" goto initForAnt
goto invalidInput
:initForGradle
echo "Executing Gradle setup..."
goto initDefault
:initForMaven
echo "Executing Maven setup..."
goto initDefault
:initForAnt
echo "Executing Ant setup..."
::If the directory exists the script has already been executed
if not exist .\actionbarsherlock (
::Gets the owncloud-android-library
call git submodule init
call git submodule update
::Clones the actionbarsherlock and checks-out the right release (4.2.0)
git clone "https://github.com/JakeWharton/ActionBarSherlock.git" "actionbarsherlock"
cd "actionbarsherlock"
git checkout "90939dc3925ffaaa0de269bbbe1b35e274968ea1"
cd ../
call android.bat update project -p actionbarsherlock/library -n ActionBarSherlock --target android-19
call android.bat update lib-project -p owncloud-android-library
call android.bat update project -p .
call android.bat update project -p oc_jb_workaround
copy /Y third_party\android-support-library\android-support-v4.jar actionbarsherlock\library\libs\android-support-v4.jar
call android.bat update test-project -p tests -m ..
)
goto complete
:initDefault
call git submodule init
call git submodule update
call android.bat update project -p actionbarsherlock\library -n ActionBarSherlock
call android.bat update lib-project -p owncloud-android-library
call android.bat update project -p .
call android.bat update project -p oc_jb_workaround
copy /Y third_party\android-support-library\android-support-v4.jar actionbarsherlock\library\libs\android-support-v4.jar
call android.bat update test-project -p tests -m ..
goto complete
:invalidInput
echo "Input argument invalid."
echo "Usage: %0 [ant | maven | gradle]."
goto exit
:complete
echo "...setup complete."
goto exit
:exit

View file

@ -1,10 +1,75 @@
#!/bin/bash -e
git submodule init
git submodule update
android update project -p actionbarsherlock/library -n ActionBarSherlock
android update lib-project -p owncloud-android-library
android update project -p .
android update project -p oc_jb_workaround
cp third_party/android-support-library/android-support-v4.jar actionbarsherlock/library/libs/android-support-v4.jar
android update test-project -p tests -m ..
#Repository
ActionBarSherlockRepo="https://github.com/JakeWharton/ActionBarSherlock.git"
#Directory for actionbarsherlock
DIRECTORY="actionbarsherlock"
#Commit for version 4.2 of actionbar sherlock
COMMIT="90939dc3925ffaaa0de269bbbe1b35e274968ea1"
function initDefault {
git submodule init
git submodule update
android update lib-project -p owncloud-android-library
android update project -p .
android update project -p oc_jb_workaround
android update test-project -p tests -m ..
}
function initForAnt {
#If the directory exists the script has already been executed
if [ ! -d "$DIRECTORY" ]; then
#Gets the owncloud-android-library
git submodule init
git submodule update
#Clones the actionbarsherlock and checks-out the right release (4.2.0)
git clone $ActionBarSherlockRepo $DIRECTORY
cd $DIRECTORY
git checkout $COMMIT
cd ../
#As default it updates the ant scripts
android update project -p "$DIRECTORY"/library -n ActionBarSherlock --target android-19
android update lib-project -p owncloud-android-library
android update project -p .
android update project -p oc_jb_workaround
cp third_party/android-support-library/android-support-v4.jar actionbarsherlock/library/libs/android-support-v4.jar
android update test-project -p tests -m ..
fi
}
#No args
if [ $# -lt 1 ]; then
echo "No args found"
echo "Usage : $0 [gradle | maven | ant]"
exit
fi
#checking args
case "$1" in
"ant")
echo "Creating Ant environment"
initForAnt
;;
"gradle") echo "Creating gradle environment"
initDefault
;;
"maven") echo "Creating maven environment"
initDefault
;;
*) echo "Argument not recognized"
echo "Usage : $0 [gradle | maven | ant]"
;;
esac
exit

View file

@ -1402,7 +1402,7 @@ public class FileDataStorageManager {
path = path + FileUtils.PATH_SEPARATOR;
}
// Update OCFile with data from share: ShareByLink żand publicLink?
// Update OCFile with data from share: ShareByLink and publicLink
OCFile file = getFileByPath(path);
if (file != null) {
if (share.getShareType().equals(ShareType.PUBLIC_LINK)) {

View file

@ -18,15 +18,17 @@
package com.owncloud.android.datamodel;
import java.io.File;
import java.io.Serializable;
import android.os.Parcel;
import android.os.Parcelable;
import android.webkit.MimeTypeMap;
import com.owncloud.android.lib.common.utils.Log_OC;
import third_parties.daveKoeller.AlphanumComparator;
import android.os.Parcel;
import android.os.Parcelable;
import android.webkit.MimeTypeMap;
// OCFile needs to be Serializable because it is stored persistently inside UploadDbObject.
// (Parcelable is not suitable for persistent storage.)
@ -53,7 +55,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
public static final String ROOT_PATH = PATH_SEPARATOR;
private static final String TAG = OCFile.class.getSimpleName();
private long mId;
private long mParentId;
private long mLength;
@ -69,7 +71,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
private boolean mKeepInSync;
private String mEtag;
private boolean mShareByLink;
private String mPublicLink;
@ -81,9 +83,9 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Create new {@link OCFile} with given path.
*
* <p/>
* The path received must be URL-decoded. Path separator must be OCFile.PATH_SEPARATOR, and it must be the first character in 'path'.
*
*
* @param path The remote path of the file.
*/
public OCFile(String path) {
@ -97,7 +99,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Reconstruct from parcel
*
*
* @param source The source parcel
*/
private OCFile(Parcel source) {
@ -145,10 +147,10 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
dest.writeString(mRemoteId);
dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0);
}
/**
* Gets the ID of the file
*
*
* @return the file ID
*/
public long getFileId() {
@ -157,7 +159,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Returns the remote path of the file on ownCloud
*
*
* @return The remote path to the file
*/
public String getRemotePath() {
@ -167,7 +169,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Can be used to check, whether or not this file exists in the database
* already
*
*
* @return true, if the file exists in the database
*/
public boolean fileExists() {
@ -176,7 +178,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Use this to find out if this file is a folder.
*
*
* @return true if it is a folder
*/
public boolean isFolder() {
@ -185,7 +187,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Use this to check if this file is available locally
*
*
* @return true if it is
*/
public boolean isDown() {
@ -195,10 +197,10 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
}
return false;
}
/**
* The path, where the file is stored locally
*
*
* @return The local path to the file
*/
public String getStoragePath() {
@ -207,7 +209,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Can be used to set the path where the local file is stored
*
*
* @param storage_path to set
*/
public void setStoragePath(String storage_path) {
@ -216,7 +218,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Get a UNIX timestamp of the file creation time
*
*
* @return A UNIX timestamp of the time that file was created
*/
public long getCreationTimestamp() {
@ -225,7 +227,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Set a UNIX timestamp of the time the file was created
*
*
* @param creation_timestamp to set
*/
public void setCreationTimestamp(long creation_timestamp) {
@ -235,8 +237,8 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Get a UNIX timestamp of the file modification time.
*
* @return A UNIX timestamp of the modification time, corresponding to the value returned by the server
* in the last synchronization of the properties of this file.
* @return A UNIX timestamp of the modification time, corresponding to the value returned by the server
* in the last synchronization of the properties of this file.
*/
public long getModificationTimestamp() {
return mModifiedTimestamp;
@ -244,22 +246,22 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Set a UNIX timestamp of the time the time the file was modified.
*
* To update with the value returned by the server in every synchronization of the properties
* <p/>
* To update with the value returned by the server in every synchronization of the properties
* of this file.
*
*
* @param modification_timestamp to set
*/
public void setModificationTimestamp(long modification_timestamp) {
mModifiedTimestamp = modification_timestamp;
}
/**
* Get a UNIX timestamp of the file modification time.
*
* @return A UNIX timestamp of the modification time, corresponding to the value returned by the server
* in the last synchronization of THE CONTENTS of this file.
* @return A UNIX timestamp of the modification time, corresponding to the value returned by the server
* in the last synchronization of THE CONTENTS of this file.
*/
public long getModificationTimestampAtLastSyncForData() {
return mModifiedTimestampAtLastSyncForData;
@ -267,39 +269,38 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Set a UNIX timestamp of the time the time the file was modified.
*
* To update with the value returned by the server in every synchronization of THE CONTENTS
* <p/>
* To update with the value returned by the server in every synchronization of THE CONTENTS
* of this file.
*
* @param modification_timestamp to set
*
* @param modificationTimestamp to set
*/
public void setModificationTimestampAtLastSyncForData(long modificationTimestamp) {
mModifiedTimestampAtLastSyncForData = modificationTimestamp;
}
/**
* Returns the filename and "/" for the root directory
*
*
* @return The name of the file
*/
public String getFileName() {
File f = new File(getRemotePath());
return f.getName().length() == 0 ? ROOT_PATH : f.getName();
}
/**
* Sets the name of the file
*
* Does nothing if the new name is null, empty or includes "/" ; or if the file is the root directory
* <p/>
* Does nothing if the new name is null, empty or includes "/" ; or if the file is the root directory
*/
public void setFileName(String name) {
Log_OC.d(TAG, "OCFile name changin from " + mRemotePath);
if (name != null && name.length() > 0 && !name.contains(PATH_SEPARATOR) && !mRemotePath.equals(ROOT_PATH)) {
String parent = (new File(getRemotePath())).getParent();
parent = (parent.endsWith(PATH_SEPARATOR)) ? parent : parent + PATH_SEPARATOR;
mRemotePath = parent + name;
mRemotePath = parent + name;
if (isFolder()) {
mRemotePath += PATH_SEPARATOR;
}
@ -309,7 +310,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Can be used to get the Mimetype
*
*
* @return the Mimetype as a String
*/
public String getMimetype() {
@ -319,10 +320,10 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Adds a file to this directory. If this file is not a directory, an
* exception gets thrown.
*
*
* @param file to add
* @throws IllegalStateException if you try to add a something and this is
* not a directory
* not a directory
*/
public void addFile(OCFile file) throws IllegalStateException {
if (isFolder()) {
@ -361,7 +362,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Sets the ID of the file
*
*
* @param file_id to set
*/
public void setFileId(long file_id) {
@ -370,7 +371,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Sets the Mime-Type of the
*
*
* @param mimetype to set
*/
public void setMimetype(String mimetype) {
@ -379,7 +380,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Sets the ID of the parent folder
*
*
* @param parent_id to set
*/
public void setParentId(long parent_id) {
@ -388,7 +389,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Sets the file size in bytes
*
*
* @param file_len to set
*/
public void setFileLength(long file_len) {
@ -397,7 +398,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Returns the size of the file in bytes
*
*
* @return The filesize in bytes
*/
public long getFileLength() {
@ -406,7 +407,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Returns the ID of the parent Folder
*
*
* @return The ID
*/
public long getParentId() {
@ -415,13 +416,13 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
/**
* Check, if this file needs updating
*
*
* @return
*/
public boolean needsUpdatingWhileSaving() {
return mNeedsUpdating;
}
public boolean needsUpdateThumbnail() {
return mNeedsUpdateThumbnail;
}
@ -433,11 +434,11 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
public long getLastSyncDateForProperties() {
return mLastSyncDateForProperties;
}
public void setLastSyncDateForProperties(long lastSyncDate) {
mLastSyncDateForProperties = lastSyncDate;
}
public long getLastSyncDateForData() {
return mLastSyncDateForData;
}
@ -449,14 +450,14 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
public void setKeepInSync(boolean keepInSync) {
mKeepInSync = keepInSync;
}
public boolean keepInSync() {
return mKeepInSync;
}
@Override
public int describeContents() {
return this.hashCode();
return ((Object) this).hashCode();
}
@Override
@ -473,13 +474,13 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
@Override
public boolean equals(Object o) {
if(o instanceof OCFile){
if (o instanceof OCFile) {
OCFile that = (OCFile) o;
if(that != null){
if (that != null) {
return this.mId == that.mId;
}
}
return false;
}
@ -497,8 +498,8 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
public void setEtag(String etag) {
this.mEtag = etag;
}
public boolean isShareByLink() {
return mShareByLink;
}
@ -523,22 +524,28 @@ public class OCFile implements Parcelable, Comparable<OCFile>, Serializable {
return 0;
}
/** @return 'True' if the file contains audio */
/**
* @return 'True' if the file contains audio
*/
public boolean isAudio() {
return (mMimeType != null && mMimeType.startsWith("audio/"));
}
/** @return 'True' if the file contains video */
/**
* @return 'True' if the file contains video
*/
public boolean isVideo() {
return (mMimeType != null && mMimeType.startsWith("video/"));
}
/** @return 'True' if the file contains an image */
/**
* @return 'True' if the file contains an image
*/
public boolean isImage() {
return ((mMimeType != null && mMimeType.startsWith("image/")) ||
getMimeTypeFromName().startsWith("image/"));
getMimeTypeFromName().startsWith("image/"));
}
public String getMimeTypeFromName() {
String extension = "";
int pos = mRemotePath.lastIndexOf('.');

View file

@ -57,20 +57,20 @@ public class CreateShareOperation extends SyncOperation {
/**
* Constructor
* @param path Full path of the file/folder being shared. Mandatory argument
* @param shareType 0 = user, 1 = group, 3 = Public link. Mandatory argument
* @param shareType 0 = user, 1 = group, 3 = Public link. Mandatory argument
* @param shareWith User/group ID with who the file should be shared. This is mandatory for shareType of 0 or 1
* @param publicUpload If false (default) public cannot upload to a public shared folder.
* If true public can upload to a shared folder. Only available for public link shares
* @param publicUpload If false (default) public cannot upload to a public shared folder.
* If true public can upload to a shared folder. Only available for public link shares
* @param password Password to protect a public link share. Only available for public link shares
* @param permissions 1 - Read only Default for public shares
* @param permissions 1 - Read only - Default for public shares
* 2 - Update
* 4 - Create
* 8 - Delete
* 16- Re-share
* 31- All above Default for private shares
* 31- All above - Default for private shares
* For user or group shares.
* To obtain combinations, add the desired values together.
* For instance, for Re-Share, delete, read, update, add 16+8+2+1 = 27.
* For instance, for Re-Share, delete, read, update, add 16+8+2+1 = 27.
*/
public CreateShareOperation(String path, ShareType shareType, String shareWith, boolean publicUpload,
String password, int permissions, Intent sendIntent) {

View file

@ -45,10 +45,10 @@ public class GetSharesForFileOperation extends SyncOperation {
* Constructor
*
* @param path Path to file or folder
* @param reshares If set to false (default), only shares from the current user are returned
* If set to true, all shares from the given file are returned
* @param subfiles If set to false (default), lists only the folder being shared
* If set to true, all shared files within the folder are returned.
* @param reshares If set to false (default), only shares from the current user are returned
* If set to true, all shares from the given file are returned
* @param subfiles If set to false (default), lists only the folder being shared
* If set to true, all shared files within the folder are returned.
*/
public GetSharesForFileOperation(String path, boolean reshares, boolean subfiles) {
mPath = path;