Merge branch 'master' into develop
authorDavid A. Velasco <dvelasco@solidgear.es>
Wed, 3 Dec 2014 10:31:49 +0000 (11:31 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Wed, 3 Dec 2014 10:31:49 +0000 (11:31 +0100)
47 files changed:
.gitignore
.gitmodules
.travis.yml
SETUP.md
actionbarsherlock [deleted submodule]
build.gradle [new file with mode: 0644]
gradle/wrapper/gradle-wrapper.jar [new file with mode: 0644]
gradle/wrapper/gradle-wrapper.properties [new file with mode: 0644]
gradlew [new file with mode: 0755]
gradlew.bat [new file with mode: 0644]
libs/actionbarsherlock_lib/build.gradle [new file with mode: 0644]
libs/actionbarsherlock_lib/library-4.1.0.aar [new file with mode: 0644]
oc_jb_workaround/build.gradle [new file with mode: 0644]
oc_jb_workaround/gradle/wrapper/gradle-wrapper.jar [new file with mode: 0644]
oc_jb_workaround/gradle/wrapper/gradle-wrapper.properties [new file with mode: 0644]
oc_jb_workaround/gradlew [new file with mode: 0755]
oc_jb_workaround/gradlew.bat [new file with mode: 0644]
oc_jb_workaround/project.properties
owncloud-android-library
pom.xml
res/layout/list_footer.xml [new file with mode: 0644]
res/layout/list_fragment.xml
res/values-af-rZA/strings.xml
res/values-fr/strings.xml
res/values-it/strings.xml
res/values-sk-rSK/strings.xml
res/values-sq/strings.xml
res/values/strings.xml
settings.gradle [new file with mode: 0644]
setup_env.bat
setup_env.sh
src/com/owncloud/android/datamodel/FileDataStorageManager.java
src/com/owncloud/android/datamodel/OCFile.java
src/com/owncloud/android/files/services/FileDownloader.java
src/com/owncloud/android/operations/CreateShareOperation.java
src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java
src/com/owncloud/android/operations/DownloadFileOperation.java
src/com/owncloud/android/operations/GetSharesForFileOperation.java
src/com/owncloud/android/operations/RenameFileOperation.java
src/com/owncloud/android/providers/FileContentProvider.java
src/com/owncloud/android/services/OperationsService.java
src/com/owncloud/android/ui/dialog/RemoveFileDialogFragment.java
src/com/owncloud/android/ui/dialog/RenameFileDialogFragment.java
src/com/owncloud/android/ui/fragment/ExtendedListFragment.java
src/com/owncloud/android/ui/fragment/OCFileListFragment.java
src/com/owncloud/android/ui/preview/PreviewImageFragment.java
third_party/android-support-library/android-support-v4.jar

index 9b9bd8e..8346dbf 100644 (file)
@@ -10,6 +10,8 @@
 
 # generated files
 bin/
+build/
+*.iml
 gen/
 target/
 
@@ -30,5 +32,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/
\ No newline at end of file
+# Android Studio and Gradle specific entries
+.gradle
+.idea
+*.iml
+build
+
+# Actionbarsherlock is now ignored since scripts takes care of init the sub-modules.
+actionbarsherlock
\ No newline at end of file
index f0ca872..fa52fcd 100644 (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
index 50b73d1..d7e46cb 100644 (file)
@@ -1,22 +1,14 @@
 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
-
 script:
+  - ./setup_env.sh ant
   - ant clean
   - ant debug
 
index 3953903..a9e2a93 100644 (file)
--- a/SETUP.md
+++ b/SETUP.md
@@ -1,13 +1,11 @@
-  
+
 If you want to start help developing ownCloud please follow the [contribution guidelines][0] and observe these instructions.
 
 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:
 
-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.
+### 1. Fork and download android/develop repository:
+
+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,23 +14,28 @@ 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:
 
 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
@@ -41,43 +44,65 @@ 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
+
+### 4. Building with Gradle:
 
-### 2c) Building with Eclipse:
+* 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"
-* Push your changes to your Github repo: "git push"
+* Push your changes to your GitHub repo: "git push"
 * Browse to https://github.com/YOURGITHUBNAME/android/pulls and issue pull request
 * Click "Edit" and set "base:develop"
 * 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.
 
@@ -85,8 +110,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
diff --git a/actionbarsherlock b/actionbarsherlock
deleted file mode 160000 (submodule)
index 9598f2b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 9598f2bb2ceed4a834cd5586a903f270ca4c0ccc
diff --git a/build.gradle b/build.gradle
new file mode 100644 (file)
index 0000000..46308ac
--- /dev/null
@@ -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'
+    }
+}
+
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644 (file)
index 0000000..3d0dee6
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644 (file)
index 0000000..8d63f89
--- /dev/null
@@ -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
diff --git a/gradlew b/gradlew
new file mode 100755 (executable)
index 0000000..91a7e26
--- /dev/null
+++ b/gradlew
@@ -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 "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644 (file)
index 0000000..aec9973
--- /dev/null
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off\r
+@rem ##########################################################################\r
+@rem\r
+@rem  Gradle startup script for Windows\r
+@rem\r
+@rem ##########################################################################\r
+\r
+@rem Set local scope for the variables with windows NT shell\r
+if "%OS%"=="Windows_NT" setlocal\r
+\r
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r
+set DEFAULT_JVM_OPTS=\r
+\r
+set DIRNAME=%~dp0\r
+if "%DIRNAME%" == "" set DIRNAME=.\r
+set APP_BASE_NAME=%~n0\r
+set APP_HOME=%DIRNAME%\r
+\r
+@rem Find java.exe\r
+if defined JAVA_HOME goto findJavaFromJavaHome\r
+\r
+set JAVA_EXE=java.exe\r
+%JAVA_EXE% -version >NUL 2>&1\r
+if "%ERRORLEVEL%" == "0" goto init\r
+\r
+echo.\r
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r
+echo.\r
+echo Please set the JAVA_HOME variable in your environment to match the\r
+echo location of your Java installation.\r
+\r
+goto fail\r
+\r
+:findJavaFromJavaHome\r
+set JAVA_HOME=%JAVA_HOME:"=%\r
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe\r
+\r
+if exist "%JAVA_EXE%" goto init\r
+\r
+echo.\r
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r
+echo.\r
+echo Please set the JAVA_HOME variable in your environment to match the\r
+echo location of your Java installation.\r
+\r
+goto fail\r
+\r
+:init\r
+@rem Get command-line arguments, handling Windowz variants\r
+\r
+if not "%OS%" == "Windows_NT" goto win9xME_args\r
+if "%@eval[2+2]" == "4" goto 4NT_args\r
+\r
+:win9xME_args\r
+@rem Slurp the command line arguments.\r
+set CMD_LINE_ARGS=\r
+set _SKIP=2\r
+\r
+:win9xME_args_slurp\r
+if "x%~1" == "x" goto execute\r
+\r
+set CMD_LINE_ARGS=%*\r
+goto execute\r
+\r
+:4NT_args\r
+@rem Get arguments from the 4NT Shell from JP Software\r
+set CMD_LINE_ARGS=%$\r
+\r
+:execute\r
+@rem Setup the command line\r
+\r
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar\r
+\r
+@rem Execute Gradle\r
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r
+\r
+:end\r
+@rem End local scope for the variables with windows NT shell\r
+if "%ERRORLEVEL%"=="0" goto mainEnd\r
+\r
+:fail\r
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r
+rem the _cmd.exe /c_ return code!\r
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1\r
+exit /b 1\r
+\r
+:mainEnd\r
+if "%OS%"=="Windows_NT" endlocal\r
+\r
+:omega\r
diff --git a/libs/actionbarsherlock_lib/build.gradle b/libs/actionbarsherlock_lib/build.gradle
new file mode 100644 (file)
index 0000000..58172e2
--- /dev/null
@@ -0,0 +1,2 @@
+configurations.create("default")
+artifacts.add("default", file('library-4.1.0.aar'))
diff --git a/libs/actionbarsherlock_lib/library-4.1.0.aar b/libs/actionbarsherlock_lib/library-4.1.0.aar
new file mode 100644 (file)
index 0000000..f340e01
Binary files /dev/null and b/libs/actionbarsherlock_lib/library-4.1.0.aar differ
diff --git a/oc_jb_workaround/build.gradle b/oc_jb_workaround/build.gradle
new file mode 100644 (file)
index 0000000..882a090
--- /dev/null
@@ -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')
+    }
+}
diff --git a/oc_jb_workaround/gradle/wrapper/gradle-wrapper.jar b/oc_jb_workaround/gradle/wrapper/gradle-wrapper.jar
new file mode 100644 (file)
index 0000000..8c0fb64
Binary files /dev/null and b/oc_jb_workaround/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/oc_jb_workaround/gradle/wrapper/gradle-wrapper.properties b/oc_jb_workaround/gradle/wrapper/gradle-wrapper.properties
new file mode 100644 (file)
index 0000000..1e61d1f
--- /dev/null
@@ -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
diff --git a/oc_jb_workaround/gradlew b/oc_jb_workaround/gradlew
new file mode 100755 (executable)
index 0000000..91a7e26
--- /dev/null
@@ -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 "$@"
diff --git a/oc_jb_workaround/gradlew.bat b/oc_jb_workaround/gradlew.bat
new file mode 100644 (file)
index 0000000..aec9973
--- /dev/null
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off\r
+@rem ##########################################################################\r
+@rem\r
+@rem  Gradle startup script for Windows\r
+@rem\r
+@rem ##########################################################################\r
+\r
+@rem Set local scope for the variables with windows NT shell\r
+if "%OS%"=="Windows_NT" setlocal\r
+\r
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r
+set DEFAULT_JVM_OPTS=\r
+\r
+set DIRNAME=%~dp0\r
+if "%DIRNAME%" == "" set DIRNAME=.\r
+set APP_BASE_NAME=%~n0\r
+set APP_HOME=%DIRNAME%\r
+\r
+@rem Find java.exe\r
+if defined JAVA_HOME goto findJavaFromJavaHome\r
+\r
+set JAVA_EXE=java.exe\r
+%JAVA_EXE% -version >NUL 2>&1\r
+if "%ERRORLEVEL%" == "0" goto init\r
+\r
+echo.\r
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r
+echo.\r
+echo Please set the JAVA_HOME variable in your environment to match the\r
+echo location of your Java installation.\r
+\r
+goto fail\r
+\r
+:findJavaFromJavaHome\r
+set JAVA_HOME=%JAVA_HOME:"=%\r
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe\r
+\r
+if exist "%JAVA_EXE%" goto init\r
+\r
+echo.\r
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r
+echo.\r
+echo Please set the JAVA_HOME variable in your environment to match the\r
+echo location of your Java installation.\r
+\r
+goto fail\r
+\r
+:init\r
+@rem Get command-line arguments, handling Windowz variants\r
+\r
+if not "%OS%" == "Windows_NT" goto win9xME_args\r
+if "%@eval[2+2]" == "4" goto 4NT_args\r
+\r
+:win9xME_args\r
+@rem Slurp the command line arguments.\r
+set CMD_LINE_ARGS=\r
+set _SKIP=2\r
+\r
+:win9xME_args_slurp\r
+if "x%~1" == "x" goto execute\r
+\r
+set CMD_LINE_ARGS=%*\r
+goto execute\r
+\r
+:4NT_args\r
+@rem Get arguments from the 4NT Shell from JP Software\r
+set CMD_LINE_ARGS=%$\r
+\r
+:execute\r
+@rem Setup the command line\r
+\r
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar\r
+\r
+@rem Execute Gradle\r
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\r
+\r
+:end\r
+@rem End local scope for the variables with windows NT shell\r
+if "%ERRORLEVEL%"=="0" goto mainEnd\r
+\r
+:fail\r
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r
+rem the _cmd.exe /c_ return code!\r
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1\r
+exit /b 1\r
+\r
+:mainEnd\r
+if "%OS%"=="Windows_NT" endlocal\r
+\r
+:omega\r
index a3ee5ab..4ab1256 100644 (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
index 0030d82..8261865 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0030d82ee8156eb82224eaea810e4bf6010feef1
+Subproject commit 8261865ff24c1bfc05be19ae9364a66dac8f26c3
diff --git a/pom.xml b/pom.xml
index 6a8cf6a..538df03 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -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>
         <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>
             <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>
             <scope>system</scope>
             <systemPath>${basedir}/third_party/android-support-library/android-support-v4.jar</systemPath>
         </dependency>
-        
-        <dependency>
-            <groupId>android</groupId>
-            <artifactId>android</artifactId>
-            <version>${google.android-version}</version>
-            <scope>provided</scope>
-        </dependency>
+
 
         <dependency>
             <groupId>com.actionbarsherlock</groupId>
-            <artifactId>actionbarsherlock</artifactId>
+            <artifactId>library</artifactId>
             <version>${actionbarsherlock-version}</version>
-            <scope>provided</scope>
+            <type>apklib</type>
         </dependency>
 
         <dependency>
-            <groupId>com.actionbarsherlock</groupId>
-            <artifactId>actionbarsherlock</artifactId>
-            <version>${actionbarsherlock-version}</version>
-            <type>apklib</type>
+            <groupId>android</groupId>
+            <artifactId>android</artifactId>
+            <version>${google.android-version}</version>
+            <scope>provided</scope>
         </dependency>
 
+        <!--<dependency>-->
+            <!--<groupId>android.support</groupId>-->
+            <!--<artifactId>compatibility-v4</artifactId>-->
+            <!--<version>19.1.0</version>-->
+        <!--</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>
 
             <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>
             <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>
diff --git a/res/layout/list_footer.xml b/res/layout/list_footer.xml
new file mode 100644 (file)
index 0000000..a49874d
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="56dp"
+    android:layout_gravity="center_horizontal"
+    android:gravity="center_horizontal"
+    android:orientation="vertical"
+    android:showDividers="none" >
+
+    <TextView
+        android:id="@+id/footerText"
+        android:layout_width="match_parent"
+        android:layout_height="56dp"
+        android:layout_gravity="center"
+        android:gravity="center"
+        android:textColor="@color/setup_text_hint" />
+
+</LinearLayout> 
\ No newline at end of file
index 4236d07..160edc1 100644 (file)
     <android.support.v4.widget.SwipeRefreshLayout
         android:id="@+id/swipe_refresh_files"
         android:layout_width="match_parent"
-        android:layout_height="match_parent" >
-
+        android:layout_height="match_parent" 
+        android:layout_weight="1"
+        android:footerDividersEnabled="false" > 
+        
         <com.owncloud.android.ui.ExtendedListView
             android:id="@+id/list_root"
             android:layout_width="match_parent"
             android:layout_height="match_parent" />
-        
+            
     </android.support.v4.widget.SwipeRefreshLayout>
-
-    <android.support.v4.widget.SwipeRefreshLayout
+       
+       <android.support.v4.widget.SwipeRefreshLayout
         android:id="@+id/swipe_refresh_files_emptyView"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
index 4b024b7..55ab320 100644 (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>
index 90c7ba7..66c7c47 100644 (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>
index 5bb7982..b5dc46b 100644 (file)
   <string name="actionbar_logger">Registri</string>
   <string name="log_send_history_button">Invia cronologia</string>
   <string name="log_mail_subject">Registri applicazione ownCloud Android</string>
-  <string name="log_progress_dialog_text">Caricamento dati...</string>
+  <string name="log_progress_dialog_text">Caricamento dati in corso...</string>
   <string name="saml_authentication_required_text">Autenticazione richiesta</string>
   <string name="saml_authentication_wrong_pass">Password errata</string>
   <string name="actionbar_move">Sposta</string>
index 8616f68..3946e28 100644 (file)
   <string name="actionbar_settings">Nastavenia</string>
   <string name="actionbar_see_details">Podrobnosti</string>
   <string name="actionbar_send_file">Odoslať</string>
+  <string name="actionbar_sort">Zoradiť</string>
+  <string name="actionbar_sort_title">Zoradiť podľa</string>
+  <string-array name="actionbar_sortby">
+    <item>A-Z</item>
+    <item>Najnovšie - Najstaršie</item>
+  </string-array>
   <!--TODO re-enable when server-side folder size calculation is available   
        <item>Biggest - Smallest</item>-->
   <string name="prefs_category_general">Všeobecné</string>
   <string name="prefs_recommend">Doporučiť známemu</string>
   <string name="prefs_feedback">Spätná väzba</string>
   <string name="prefs_imprint">Podmienky používania</string>
+  <string name="prefs_remember_last_share_location">Zapamätať umiestnenie zdieľania</string>
+  <string name="prefs_remember_last_upload_location_summary">Zapamätať posledné umiestnenie pre nahranie zdieľaných súborov</string>
   <string name="recommend_subject">Skúste %1$s na vašom telefóne!</string>
+  <string name="recommend_text">Chcel by som vám odporučiť %1$s na vašom smartfóne!\nSťahujte tu: %2$s</string>
   <string name="auth_check_server">Skontrolovať Server</string>
   <string name="auth_host_url">Adresa servera https://...</string>
   <string name="auth_username">Používateľské meno</string>
   <string name="sync_fail_in_favourites_content">Obsah %1$d súborov nemohol byť synchronizovaný (%2$d konfliktov)</string>
   <string name="sync_foreign_files_forgotten_ticker">Niektoré lokálne súbory boli zabudnuté</string>
   <string name="sync_foreign_files_forgotten_content">%1$d súborov z %2$s priečinkov sa nepodarilo skopírovať do</string>
+  <string name="sync_foreign_files_forgotten_explanation">Od verzie 1.3.16 sú súbory nahrané z tohoto zariadenia kopírované do lokálneho priečinka %1$s, aby sa zabránilo strate dát pri synchronizácii jedného súboru s viacerými účtami.\n\nVšetky súbory nahraté predchádzajúcimi verziami aplikácie boli z tohoto dôvodu prekopírované do priečinka %2$s. Bohužiaľ sa objavila chyba zabraňujúca dokončeniu tejto operácie v priebehu synchronizácie účtu. Buď môžete súbor(y) ponechať ako sú a odobrať odkaz z priečinka %3$s, alebo presunúť súbor(y) do priečinka %1$s a zachovať odkaz na %4$s.\n\nNižšie je uvedený lokálny súbor(y) a vzdialený súbor(y) v %5$s, s ktorým je prepojený.</string>
   <string name="sync_current_folder_was_removed">Priečinok %1$s už existuje</string>
   <string name="foreign_files_move">Premiestniť všetko</string>
   <string name="foreign_files_success">Všetky súbory boli premiestnené</string>
   <string name="preview_image_description">Ukážka obrazu</string>
   <string name="preview_image_error_unknown_format">Obrázok nemožno zobraziť</string>
   <string name="error__upload__local_file_not_copied">%1$s nemožno skopírovať do lokálneho priečinka %2$s</string>
+  <string name="prefs_instant_upload_path_title">Cesta pre nahrávanie</string>
   <string name="share_link_no_support_share_api">Je nám to ľúto, ale zdieľanie nie je na vašom serveri povolené. Prosím kontaktujte vášho
                administrátora.</string>
+  <string name="share_link_file_no_exist">Nemožno zdieľať. Skontrolujte, či súbor existuje</string>
   <string name="share_link_file_error">Pri pokuse o zdieľanie tohto súboru alebo priečinka došlo k chybe</string>
+  <string name="unshare_link_file_no_exist">Nemožno ukončiť zdieľanie. Skontrolujte, či súbor existuje</string>
   <string name="unshare_link_file_error">Pri pokuse zrušiť zdieľanie tohto súboru alebo priečinka došlo k chybe</string>
   <string name="activity_chooser_send_file_title">Odoslať</string>
   <string name="copy_link">Kopíruj odkaz</string>
   <string name="downloader_download_file_not_found">Súbor už na serveri nie je dostupný</string>
   <string name="prefs_category_accounts">Účty</string>
   <string name="prefs_add_account">Pridať účet</string>
+  <string name="auth_redirect_non_secure_connection_title">Zabezpečené pripojenie je presmerované na nezabezpečenú trasu.</string>
+  <string name="actionbar_logger">Logy</string>
+  <string name="log_send_history_button">Odoslať históriu</string>
+  <string name="log_mail_subject">Logy aplikácie ownCloud pre Android</string>
+  <string name="log_progress_dialog_text">Nahrávam dáta...</string>
   <string name="saml_authentication_required_text">Vyžaduje sa overenie</string>
   <string name="saml_authentication_wrong_pass">Nesprávne heslo</string>
   <string name="actionbar_move">Presunúť</string>
+  <string name="file_list_empty_moving">Nič tu nie je. Pridajte priečinok!</string>
   <string name="move_choose_button_text">Vybrať</string>
+  <string name="move_file_not_found">Nemožno presunúť. Skontrolujte, či súbor existuje</string>
+  <string name="move_file_invalid_into_descendent">Priečinok nemožno presunúť do vlastného podpriečinka</string>
+  <string name="move_file_invalid_overwrite">Súbor už v cieľovom priečinku existuje</string>
+  <string name="move_file_error">Pri pokuse o presun tohoto súboru alebo priečinka nastala chyba</string>
+  <string name="forbidden_permissions_move">pre presun tohoto súboru</string>
+  <string name="prefs_category_instant_uploading">Okamžité nahratie</string>
   <string name="prefs_category_security">Zabezpečenie</string>
 </resources>
index a794c6d..6a79dc7 100644 (file)
@@ -32,6 +32,7 @@
   <string name="filedetails_created">Krijuar:</string>
   <string name="filedetails_modified">Modifikuar:</string>
   <string name="filedetails_download">Shkarko</string>
+  <string name="action_share_file">Ndaje lidhjen</string>
   <string name="common_yes">Po</string>
   <string name="common_no">Jo</string>
   <string name="common_ok">Ok</string>
index d6b5457..8b82868 100644 (file)
     <string name="file_list_empty">Nothing in here. Upload something!</string>
     <string name="file_list_loading">Loading...</string>
     <string name="local_file_list_empty">There are no files in this folder.</string>
+    <string name="file_list_folder">folder</string>
+    <string name="file_list_folders">folders</string>
+    <string name="file_list_file">file</string>
+    <string name="file_list_files">files</string>
     <string name="filedetails_select_file">Tap on a file to display additional information.</string>
     <string name="filedetails_size">Size:</string>
     <string name="filedetails_type">Type:</string>
diff --git a/settings.gradle b/settings.gradle
new file mode 100644 (file)
index 0000000..66022f5
--- /dev/null
@@ -0,0 +1,3 @@
+include ':owncloud-android-library'
+include 'libs/actionbarsherlock_lib'
+include ':'
index dc44a12..0781036 100644 (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
\ No newline at end of file
index ae42142..8c9af07 100755 (executable)
@@ -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
index 41a5106..d803064 100644 (file)
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
 
 import com.owncloud.android.MainApp;
@@ -33,7 +34,6 @@ import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.lib.resources.files.FileUtils;
 import com.owncloud.android.utils.FileStorageUtils;
 
-
 import android.accounts.Account;
 import android.content.ContentProviderClient;
 import android.content.ContentProviderOperation;
@@ -41,6 +41,7 @@ import android.content.ContentProviderResult;
 import android.content.ContentResolver;
 import android.content.ContentUris;
 import android.content.ContentValues;
+import android.content.Intent;
 import android.content.OperationApplicationException;
 import android.database.Cursor;
 import android.net.Uri;
@@ -346,7 +347,9 @@ public class FileDataStorageManager {
                     ).withSelection(where, whereArgs).build());
                     
                     if (file.isDown()) {
-                        new File(file.getStoragePath()).delete();
+                        String path = file.getStoragePath();
+                        new File(path).delete();
+                        triggerMediaScan(path); // notify MediaScanner about removed file
                     }
                 }
             }
@@ -484,8 +487,12 @@ public class FileDataStorageManager {
                     }
                     success &= (deleted > 0); 
                 }
-                if (removeLocalCopy && file.isDown() && file.getStoragePath() != null && success) {
-                    success = new File(file.getStoragePath()).delete();
+                String localPath = file.getStoragePath();
+                if (removeLocalCopy && file.isDown() && localPath != null && success) {
+                    success = new File(localPath).delete();
+                    if (success) {
+                        triggerMediaScan(localPath);
+                    }
                     if (!removeDBData && success) {
                         // maybe unnecessary, but should be checked TODO remove if unnecessary
                         file.setStoragePath(null);
@@ -542,11 +549,13 @@ public class FileDataStorageManager {
                         success &= removeLocalFolder(file);
                     } else {
                         if (file.isDown()) {
+                            String path = file.getStoragePath();
                             File localFile = new File(file.getStoragePath());
                             success &= localFile.delete();
                             if (success) {
                                 file.setStoragePath(null);
                                 saveFile(file);
+                                triggerMediaScan(path); // notify MediaScanner about removed file
                             }
                         }
                     }
@@ -568,7 +577,9 @@ public class FileDataStorageManager {
                 if (localFile.isDirectory()) {
                     success &= removeLocalFolder(localFile);
                 } else {
+                    String path = localFile.getAbsolutePath();
                     success &= localFile.delete();
+                    triggerMediaScan(path); // notify MediaScanner about removed file
                 }
             }
         }
@@ -576,109 +587,20 @@ public class FileDataStorageManager {
         return success;
     }
 
+    
     /**
-     * Updates database for a folder that was moved to a different location.
+     * Updates database and file system for a file or folder that was moved to a different location.
      * 
      * TODO explore better (faster) implementations
      * TODO throw exceptions up !
      */
-    public void moveFolder(OCFile folder, String newPath) {
-        // TODO check newPath
-
-        if (    folder != null && folder.isFolder() && 
-                folder.fileExists() && !OCFile.ROOT_PATH.equals(folder.getFileName())
-            ) {
-            /// 1. get all the descendants of 'dir' in a single QUERY (including 'dir')
-            Cursor c = null;
-            if (getContentProviderClient() != null) {
-                try {
-                    c = getContentProviderClient().query (
-                        ProviderTableMeta.CONTENT_URI, 
-                        null,
-                        ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " + 
-                                ProviderTableMeta.FILE_PATH + " LIKE ? ",
-                        new String[] { mAccount.name, folder.getRemotePath() + "%"  }, 
-                        ProviderTableMeta.FILE_PATH + " ASC "
-                    );
-                } catch (RemoteException e) {
-                    Log_OC.e(TAG, e.getMessage());
-                }
-            } else {
-                c = getContentResolver().query (
-                    ProviderTableMeta.CONTENT_URI, 
-                    null,
-                    ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " + 
-                            ProviderTableMeta.FILE_PATH + " LIKE ? ",
-                    new String[] { mAccount.name, folder.getRemotePath() + "%"  }, 
-                    ProviderTableMeta.FILE_PATH + " ASC "
-                );
-            }
-
-            /// 2. prepare a batch of update operations to change all the descendants
-            ArrayList<ContentProviderOperation> operations = 
-                    new ArrayList<ContentProviderOperation>(c.getCount());
-            int lengthOfOldPath = folder.getRemotePath().length();
-            String defaultSavePath = FileStorageUtils.getSavePath(mAccount.name);
-            int lengthOfOldStoragePath = defaultSavePath.length() + lengthOfOldPath;
-            if (c.moveToFirst()) {
-                do {
-                    ContentValues cv = new ContentValues(); // keep the constructor in the loop
-                    OCFile child = createFileInstance(c);
-                    cv.put(
-                        ProviderTableMeta.FILE_PATH, 
-                        newPath + child.getRemotePath().substring(lengthOfOldPath)
-                    );
-                    if (    child.getStoragePath() != null && 
-                            child.getStoragePath().startsWith(defaultSavePath)  ) {
-                        cv.put(
-                                ProviderTableMeta.FILE_STORAGE_PATH, 
-                                defaultSavePath + newPath + 
-                                    child.getStoragePath().substring(lengthOfOldStoragePath)
-                        );
-                    }
-                    operations.add(
-                            ContentProviderOperation.
-                            newUpdate(ProviderTableMeta.CONTENT_URI).
-                            withValues(cv).
-                            withSelection(  
-                                    ProviderTableMeta._ID + "=?", 
-                                    new String[] { String.valueOf(child.getFileId()) }
-                            ).
-                            build()
-                    );
-                } while (c.moveToNext());
-            }
-            c.close();
-
-            /// 3. apply updates in batch
-            try {
-                if (getContentResolver() != null) {
-                    getContentResolver().applyBatch(MainApp.getAuthority(), operations);
-
-                } else {
-                    getContentProviderClient().applyBatch(operations);
-                }
-
-            } catch (OperationApplicationException e) {
-                Log_OC.e(TAG, "Fail to update descendants of " + 
-                        folder.getFileId() + " in database", e);
-
-            } catch (RemoteException e) {
-                Log_OC.e(TAG, "Fail to update desendants of " + 
-                        folder.getFileId() + " in database", e);
-            }
-
-        }
-    }
-
-    
     public void moveLocalFile(OCFile file, String targetPath, String targetParentPath) {
 
         if (file != null && file.fileExists() && !OCFile.ROOT_PATH.equals(file.getFileName())) {
             
             OCFile targetParent = getFileByPath(targetParentPath);
             if (targetParent == null) {
-                // TODO panic
+                throw new IllegalStateException("Parent folder of the target path does not exist!!");
             }
             
             /// 1. get all the descendants of the moved element in a single QUERY
@@ -718,6 +640,8 @@ public class FileDataStorageManager {
             ArrayList<ContentProviderOperation> operations = 
                     new ArrayList<ContentProviderOperation>(c.getCount());
             String defaultSavePath = FileStorageUtils.getSavePath(mAccount.name);
+            List<String> originalPathsToTriggerMediaScan = new ArrayList<String>();
+            List<String> newPathsToTriggerMediaScan = new ArrayList<String>();
             if (c.moveToFirst()) {
                 int lengthOfOldPath = file.getRemotePath().length();
                 int lengthOfOldStoragePath = defaultSavePath.length() + lengthOfOldPath;
@@ -731,11 +655,14 @@ public class FileDataStorageManager {
                     if (child.getStoragePath() != null && 
                             child.getStoragePath().startsWith(defaultSavePath)) {
                         // update link to downloaded content - but local move is not done here!
-                        cv.put(
-                            ProviderTableMeta.FILE_STORAGE_PATH, 
-                            defaultSavePath + targetPath + 
-                                child.getStoragePath().substring(lengthOfOldStoragePath)
-                        );
+                        String targetLocalPath = defaultSavePath + targetPath + 
+                                child.getStoragePath().substring(lengthOfOldStoragePath);
+                        
+                        cv.put(ProviderTableMeta.FILE_STORAGE_PATH, targetLocalPath);
+                        
+                        originalPathsToTriggerMediaScan.add(child.getStoragePath());
+                        newPathsToTriggerMediaScan.add(targetLocalPath);
+                        
                     }
                     if (child.getRemotePath().equals(file.getRemotePath())) {
                         cv.put(
@@ -766,27 +693,35 @@ public class FileDataStorageManager {
                 }
 
             } catch (Exception e) {
-                Log_OC.e(
-                    TAG, 
-                    "Fail to update " + file.getFileId() + " and descendants in database", 
-                    e
-                );
+                Log_OC.e(TAG, "Fail to update " + file.getFileId() + " and descendants in database", e);
             }
 
             /// 4. move in local file system 
-            String localPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
-            File localFile = new File(localPath);
+            String originalLocalPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
+            String targetLocalPath = defaultSavePath + targetPath;
+            File localFile = new File(originalLocalPath);
             boolean renamed = false;
             if (localFile.exists()) {
-                File targetFile = new File(defaultSavePath + targetPath);
+                File targetFile = new File(targetLocalPath);
                 File targetFolder = targetFile.getParentFile();
                 if (!targetFolder.exists()) {
                     targetFolder.mkdirs();
                 }
                 renamed = localFile.renameTo(targetFile);
             }
-            Log_OC.d(TAG, "Local file RENAMED : " + renamed);
-            
+
+            if (renamed) {
+                Iterator<String> it = originalPathsToTriggerMediaScan.iterator();
+                while (it.hasNext()) {
+                    // Notify MediaScanner about removed file
+                    triggerMediaScan(it.next());
+                }
+                it = newPathsToTriggerMediaScan.iterator();
+                while (it.hasNext()) {
+                    // Notify MediaScanner about new file/folder
+                    triggerMediaScan(it.next());
+                }
+            }
         }
         
     }
@@ -1402,7 +1337,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)) {
@@ -1549,4 +1484,10 @@ public class FileDataStorageManager {
         //}
     }
 
+    public void triggerMediaScan(String path) {
+        Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
+        intent.setData(Uri.fromFile(new File(path)));
+        MainApp.getAppContext().sendBroadcast(intent);
+    }
+
 }
index 392d03b..cf25d27 100644 (file)
 
 package com.owncloud.android.datamodel;
 
-import java.io.File;
-
-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;
 
+import com.owncloud.android.lib.common.utils.Log_OC;
+
+import java.io.File;
+
+import third_parties.daveKoeller.AlphanumComparator;
 public class OCFile implements Parcelable, Comparable<OCFile> {
 
     public static final Parcelable.Creator<OCFile> CREATOR = new Parcelable.Creator<OCFile>() {
@@ -45,7 +45,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     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;
@@ -61,7 +61,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     private boolean mKeepInSync;
 
     private String mEtag;
-    
+
     private boolean mShareByLink;
     private String mPublicLink;
 
@@ -73,9 +73,9 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * 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) {
@@ -89,7 +89,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Reconstruct from parcel
-     * 
+     *
      * @param source The source parcel
      */
     private OCFile(Parcel source) {
@@ -137,10 +137,10 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         dest.writeString(mRemoteId);
         dest.writeInt(mNeedsUpdateThumbnail ? 1 : 0);
     }
-    
+
     /**
      * Gets the ID of the file
-     * 
+     *
      * @return the file ID
      */
     public long getFileId() {
@@ -149,7 +149,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Returns the remote path of the file on ownCloud
-     * 
+     *
      * @return The remote path to the file
      */
     public String getRemotePath() {
@@ -159,7 +159,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     /**
      * 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() {
@@ -168,7 +168,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Use this to find out if this file is a folder.
-     * 
+     *
      * @return true if it is a folder
      */
     public boolean isFolder() {
@@ -177,7 +177,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Use this to check if this file is available locally
-     * 
+     *
      * @return true if it is
      */
     public boolean isDown() {
@@ -187,10 +187,10 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         }
         return false;
     }
-    
+
     /**
      * The path, where the file is stored locally
-     * 
+     *
      * @return The local path to the file
      */
     public String getStoragePath() {
@@ -199,7 +199,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Can be used to set the path where the file is stored
-     * 
+     *
      * @param storage_path to set
      */
     public void setStoragePath(String storage_path) {
@@ -208,7 +208,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Get a UNIX timestamp of the file creation time
-     * 
+     *
      * @return A UNIX timestamp of the time that file was created
      */
     public long getCreationTimestamp() {
@@ -217,7 +217,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Set a UNIX timestamp of the time the file was created
-     * 
+     *
      * @param creation_timestamp to set
      */
     public void setCreationTimestamp(long creation_timestamp) {
@@ -227,8 +227,8 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     /**
      * 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;
@@ -236,22 +236,22 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * 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;
@@ -259,39 +259,38 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * 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;
             }
@@ -301,7 +300,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Can be used to get the Mimetype
-     * 
+     *
      * @return the Mimetype as a String
      */
     public String getMimetype() {
@@ -311,10 +310,10 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     /**
      * 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()) {
@@ -353,7 +352,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Sets the ID of the file
-     * 
+     *
      * @param file_id to set
      */
     public void setFileId(long file_id) {
@@ -362,7 +361,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Sets the Mime-Type of the
-     * 
+     *
      * @param mimetype to set
      */
     public void setMimetype(String mimetype) {
@@ -371,7 +370,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Sets the ID of the parent folder
-     * 
+     *
      * @param parent_id to set
      */
     public void setParentId(long parent_id) {
@@ -380,7 +379,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Sets the file size in bytes
-     * 
+     *
      * @param file_len to set
      */
     public void setFileLength(long file_len) {
@@ -389,7 +388,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Returns the size of the file in bytes
-     * 
+     *
      * @return The filesize in bytes
      */
     public long getFileLength() {
@@ -398,7 +397,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Returns the ID of the parent Folder
-     * 
+     *
      * @return The ID
      */
     public long getParentId() {
@@ -407,13 +406,13 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     /**
      * Check, if this file needs updating
-     * 
+     *
      * @return
      */
     public boolean needsUpdatingWhileSaving() {
         return mNeedsUpdating;
     }
-    
+
     public boolean needsUpdateThumbnail() {
         return mNeedsUpdateThumbnail;
     }
@@ -425,11 +424,11 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     public long getLastSyncDateForProperties() {
         return mLastSyncDateForProperties;
     }
-    
+
     public void setLastSyncDateForProperties(long lastSyncDate) {
         mLastSyncDateForProperties = lastSyncDate;
     }
-    
+
     public long getLastSyncDateForData() {
         return mLastSyncDateForData;
     }
@@ -441,14 +440,14 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     public void setKeepInSync(boolean keepInSync) {
         mKeepInSync = keepInSync;
     }
-    
+
     public boolean keepInSync() {
         return mKeepInSync;
     }
-    
+
     @Override
     public int describeContents() {
-        return this.hashCode();
+        return ((Object) this).hashCode();
     }
 
     @Override
@@ -465,13 +464,13 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
 
     @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;
     }
 
@@ -489,8 +488,8 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
     public void setEtag(String etag) {
         this.mEtag = etag;
     }
-    
-    
+
+
     public boolean isShareByLink() {
         return mShareByLink;
     }
@@ -515,22 +514,28 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
         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('.');
index fdc35f8..c9ad961 100644 (file)
@@ -400,6 +400,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         file.setFileLength((new File(mCurrentDownload.getSavePath()).length()));
         file.setRemoteId(mCurrentDownload.getFile().getRemoteId());
         mStorageManager.saveFile(file);
+        mStorageManager.triggerMediaScan(file.getStoragePath());
     }
 
 
index c32c477..b563790 100644 (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     \910\92 = user, \911\92 = group, \913\92 = 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 \91false\92 (default) public cannot upload to a public shared folder. 
-     *                      If \91true\92 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 \96 Default for \93public\94 shares
+     * @param permissions   1 - Read only - Default for public shares
      *                      2 - Update
      *                      4 - Create
      *                      8 - Delete
      *                      16- Re-share
-     *                      31- All above \96 Default for \93private\94 shares
+     *                      31- All above - Default for private shares
      *                      For user or group shares.
      *                      To obtain combinations, add the desired values together.  
-     *                      For instance, for \93Re-Share\94\93delete\94\93read\94\93update\94, 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) {
index c86c8b5..5afc421 100644 (file)
@@ -36,7 +36,6 @@ import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
 
 import android.content.Context;
 import android.net.Uri;
-import android.util.Log;
 
 /**
  * Operation to find out what authentication method requires
index 9f2bed7..0a5ff94 100644 (file)
@@ -150,13 +150,11 @@ public class DownloadFileOperation extends RemoteOperation {
             newFile = new File(getSavePath());
             newFile.getParentFile().mkdirs();
             moved = tmpFile.renameTo(newFile);
-        
             if (!moved)
                 result = new RemoteOperationResult(RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED);
         }
         Log_OC.i(TAG, "Download of " + mFile.getRemotePath() + " to " + getSavePath() + ": " + result.getLogMessage());
         
-        
         return result;
     }
 
index c319d62..649437d 100644 (file)
@@ -45,10 +45,10 @@ public class GetSharesForFileOperation extends SyncOperation {
      * Constructor
      * 
      * @param path      Path to file or folder
-     * @param reshares  If set to \91false\92 (default), only shares from the current user are returned
-     *                  If set to \91true\92, all shares from the given file are returned
-     * @param subfiles  If set to \91false\92 (default), lists only the folder being shared
-     *                  If set to \91true\92, 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;
index 95a5a9b..bd60e1f 100644 (file)
@@ -29,8 +29,6 @@ import com.owncloud.android.lib.resources.files.RenameRemoteFileOperation;
 import com.owncloud.android.operations.common.SyncOperation;
 import com.owncloud.android.utils.FileStorageUtils;
 
-import android.accounts.Account;
-
 
 /**
  * Remote operation performing the rename of a remote file (or folder?) in the ownCloud server.
@@ -44,7 +42,6 @@ public class RenameFileOperation extends SyncOperation {
     
     private OCFile mFile;
     private String mRemotePath;
-    private Account mAccount;
     private String mNewName;
     private String mNewRemotePath;
 
@@ -57,9 +54,8 @@ public class RenameFileOperation extends SyncOperation {
      * @param account               OwnCloud account containing the remote file 
      * @param newName               New name to set as the name of file.
      */
-    public RenameFileOperation(String remotePath, Account account, String newName) {
+    public RenameFileOperation(String remotePath, String newName) {
         mRemotePath = remotePath;
-        mAccount = account;
         mNewName = newName;
         mNewRemotePath = null;
     }
@@ -103,7 +99,8 @@ public class RenameFileOperation extends SyncOperation {
 
             if (result.isSuccess()) {
                 if (mFile.isFolder()) {
-                    saveLocalDirectory();
+                    getStorageManager().moveLocalFile(mFile, mNewRemotePath, parent);
+                    //saveLocalDirectory();
 
                 } else {
                     saveLocalFile();
@@ -118,28 +115,24 @@ public class RenameFileOperation extends SyncOperation {
         return result;
     }
 
-    
-    private void saveLocalDirectory() {
-        getStorageManager().moveFolder(mFile, mNewRemotePath);
-        String localPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, mFile);
-        File localDir = new File(localPath);
-        if (localDir.exists()) {
-            localDir.renameTo(new File(FileStorageUtils.getSavePath(mAccount.name) + mNewRemotePath));
-            // TODO - if renameTo fails, children files that are already down will result unlinked
-        }
-    }
-
     private void saveLocalFile() {
         mFile.setFileName(mNewName);
         
         // try to rename the local copy of the file
         if (mFile.isDown()) {
-            File f = new File(mFile.getStoragePath());
+            String oldPath = mFile.getStoragePath();
+            File f = new File(oldPath);
             String parentStoragePath = f.getParent();
             if (!parentStoragePath.endsWith(File.separator))
                 parentStoragePath += File.separator;
             if (f.renameTo(new File(parentStoragePath + mNewName))) {
-                mFile.setStoragePath(parentStoragePath + mNewName);
+                String newPath = parentStoragePath + mNewName;
+                mFile.setStoragePath(newPath);
+
+                // notify MediaScanner about removed file - TODO really works?
+                getStorageManager().triggerMediaScan(oldPath);
+                // notify to scan about new file
+                getStorageManager().triggerMediaScan(newPath);
             }
             // else - NOTHING: the link to the local file is kept although the local name can't be updated
             // TODO - study conditions when this could be a problem
index a94454c..21a8e2c 100644 (file)
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 
 import com.owncloud.android.R;
-import com.owncloud.android.datamodel.ThumbnailsCacheManager;
 import com.owncloud.android.db.ProviderMeta;
 import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
 import com.owncloud.android.lib.common.utils.Log_OC;
index a5bb22d..16c4dcc 100644 (file)
@@ -359,7 +359,7 @@ public class OperationsService extends Service {
                         // Rename file or folder
                         String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
                         String newName = operationIntent.getStringExtra(EXTRA_NEWNAME);
-                        operation = new RenameFileOperation(remotePath, account, newName);
+                        operation = new RenameFileOperation(remotePath, newName);
                         
                     } else if (action.equals(ACTION_REMOVE)) {
                         // Remove file or folder
index a78584a..2453404 100644 (file)
@@ -26,15 +26,15 @@ package com.owncloud.android.ui.dialog;
  */
 import java.util.Vector;
 
+import android.app.Dialog;
+import android.os.Bundle;
+
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
 
-import android.app.Dialog;
-import android.os.Bundle;
-
 public class RemoveFileDialogFragment extends ConfirmationDialogFragment 
 implements ConfirmationDialogFragmentListener {
 
@@ -105,8 +105,7 @@ implements ConfirmationDialogFragmentListener {
     @Override
     public void onNeutral(String callerTag) {
         ComponentsGetter cg = (ComponentsGetter)getSherlockActivity();
-        cg.getFileOperationsHelper()
-            .removeFile(mTargetFile, true);
+        cg.getFileOperationsHelper().removeFile(mTargetFile, true);
         
         FileDataStorageManager storageManager = cg.getStorageManager();
         
@@ -141,4 +140,4 @@ implements ConfirmationDialogFragmentListener {
         // nothing to do here
     }
     
-}
+}
\ No newline at end of file
index 530e920..d285f1e 100644 (file)
@@ -22,12 +22,6 @@ package com.owncloud.android.ui.dialog;
  * 
  *  Triggers the rename operation. 
  */
-import com.actionbarsherlock.app.SherlockDialogFragment;
-import com.owncloud.android.R;
-import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.lib.resources.files.FileUtils;
-import com.owncloud.android.ui.activity.ComponentsGetter;
-
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
@@ -39,6 +33,12 @@ import android.widget.EditText;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.actionbarsherlock.app.SherlockDialogFragment;
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.lib.resources.files.FileUtils;
+import com.owncloud.android.ui.activity.ComponentsGetter;
+
 
 /**
  *  Dialog to input a new name for a file or folder to rename.  
@@ -125,12 +125,8 @@ extends SherlockDialogFragment implements DialogInterface.OnClickListener {
                         Toast.LENGTH_LONG).show();
                 return;
             }
-            
-            ((ComponentsGetter)getSherlockActivity()).
-                getFileOperationsHelper().renameFile(mTargetFile, newFileName);
-            
-            
+
+            ((ComponentsGetter)getSherlockActivity()).getFileOperationsHelper().renameFile(mTargetFile, newFileName);
         }
     }
-    
 }
index 5d3f7ac..1b7a1dd 100644 (file)
@@ -38,14 +38,14 @@ import com.owncloud.android.ui.ExtendedListView;
 import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
 
 /**
- *  TODO extending SherlockListFragment instead of SherlockFragment 
+ * TODO extending SherlockListFragment instead of SherlockFragment
  */
 public class ExtendedListFragment extends SherlockFragment 
 implements OnItemClickListener, OnEnforceableRefreshListener {
-    
+
     private static final String TAG = ExtendedListFragment.class.getSimpleName();
 
-    private static final String KEY_SAVED_LIST_POSITION = "SAVED_LIST_POSITION"; 
+    private static final String KEY_SAVED_LIST_POSITION = "SAVED_LIST_POSITION";
     private static final String KEY_INDEXES = "INDEXES";
     private static final String KEY_FIRST_POSITIONS= "FIRST_POSITIONS";
     private static final String KEY_TOPS = "TOPS";
@@ -53,7 +53,7 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     private static final String KEY_EMPTY_LIST_MESSAGE = "EMPTY_LIST_MESSAGE";
 
     protected ExtendedListView mList;
-    
+
     private SwipeRefreshLayout mRefreshLayout;
     private SwipeRefreshLayout mRefreshEmptyLayout;
     private TextView mEmptyListMessage;
@@ -72,18 +72,22 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
         mList.invalidate();
     }
 
+    public void setFooterView(View footer) {
+        mList.addFooterView(footer, null, false);
+        mList.invalidate();
+    }
+
     public ListView getListView() {
         return mList;
     }
-    
-    
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         Log_OC.e(TAG, "onCreateView");
-        
+
         View v = inflater.inflate(R.layout.list_fragment, null);
         mEmptyListMessage = (TextView) v.findViewById(R.id.empty_list_view);
-        mList = (ExtendedListView)(v.findViewById(R.id.list_root));
+        mList = (ExtendedListView) (v.findViewById(R.id.list_root));
         mList.setOnItemClickListener(this);
 
         mList.setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));
@@ -93,7 +97,7 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
             int referencePosition = savedInstanceState.getInt(KEY_SAVED_LIST_POSITION);
             setReferencePosition(referencePosition);
         }
-        
+
         // Pull down refresh
         mRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files);
         mRefreshEmptyLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_files_emptyView);
@@ -106,7 +110,6 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
         return v;
     }
 
-    
     /**
      * {@inheritDoc}
      */
@@ -142,14 +145,16 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
         savedInstanceState.putString(KEY_EMPTY_LIST_MESSAGE, getEmptyViewText());
     }
 
-    
     /**
-     * Calculates the position of the item that will be used as a reference to reposition the visible items in the list when
-     * the device is turned to other position. 
+     * Calculates the position of the item that will be used as a reference to
+     * reposition the visible items in the list when the device is turned to
+     * other position.
      * 
-     * THe current policy is take as a reference the visible item in the center of the screen.  
+     * THe current policy is take as a reference the visible item in the center
+     * of the screen.
      * 
-     * @return      The position in the list of the visible item in the center of the screen.
+     * @return The position in the list of the visible item in the center of the
+     *         screen.
      */
     protected int getReferencePosition() {
         if (mList != null) {
@@ -159,11 +164,11 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
         }
     }
 
-    
     /**
      * Sets the visible part of the list from the reference position.
      * 
-     * @param   position    Reference position previously returned by {@link LocalFileListFragment#getReferencePosition()}
+     * @param position Reference position previously returned by
+     *            {@link LocalFileListFragment#getReferencePosition()}
      */
     protected void setReferencePosition(int position) {
         if (mList != null) {
@@ -227,7 +232,7 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
     
     @Override
     public void onItemClick (AdapterView<?> parent, View view, int position, long id) {
-        // to be @overriden  
+        // to be @overriden
     }
 
     @Override
@@ -240,7 +245,6 @@ implements OnItemClickListener, OnEnforceableRefreshListener {
             mOnRefreshListener.onRefresh();
         }
     }
-    
     public void setOnRefreshListener(OnEnforceableRefreshListener listener) {
         mOnRefreshListener = listener;
     }
index db9f28f..fd0b1a5 100644 (file)
 package com.owncloud.android.ui.fragment;
 
 import java.io.File;
+import java.util.Vector;
 
 import android.app.Activity;
+import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.v4.widget.SwipeRefreshLayout;
@@ -29,6 +31,8 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.AdapterView.AdapterContextMenuInfo;
+import android.widget.TextView;
+import android.view.LayoutInflater;
 
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
@@ -70,6 +74,7 @@ public class OCFileListFragment extends ExtendedListFragment {
    
     private OCFile mFile = null;
     private FileListListAdapter mAdapter;
+    private View mFooterView;
     
     private OCFile mTargetFile;
 
@@ -112,24 +117,28 @@ public class OCFileListFragment extends ExtendedListFragment {
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
         Log_OC.e(TAG, "onActivityCreated() start");
-        
+
         if (savedInstanceState != null) {
             mFile = savedInstanceState.getParcelable(KEY_FILE);
         }
-        
+
+        mFooterView = ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(
+                        R.layout.list_footer, null, false);
+        setFooterView(mFooterView);
+
         Bundle args = getArguments();
         boolean justFolders = (args == null) ? false : args.getBoolean(ARG_JUST_FOLDERS, false); 
         mAdapter = new FileListListAdapter(
                 justFolders,
                 getSherlockActivity(), 
                 mContainerActivity
-        );
+                );
         setListAdapter(mAdapter);
-        
+
         registerForContextMenu(getListView());
         getListView().setOnCreateContextMenuListener(this);
-  }
-    
+    }
+
     /**
      * Saves the current listed folder.
      */
@@ -384,9 +393,51 @@ public class OCFileListFragment extends ExtendedListFragment {
                 mList.setSelectionFromTop(0, 0);
             }
             mFile = directory;
+            
+            // Update Footer
+            TextView footerText = (TextView) mFooterView.findViewById(R.id.footerText);
+            Log_OC.d("footer", String.valueOf(System.currentTimeMillis()));
+            footerText.setText(generateFooterText(directory));
+            Log_OC.d("footer", String.valueOf(System.currentTimeMillis()));
         }
     }
     
+    private String generateFooterText(OCFile directory) {
+        Integer files = 0;
+        Integer folders = 0;
+
+        FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
+        Vector<OCFile> mFiles = storageManager.getFolderContent(mFile);
+
+        for (OCFile ocFile : mFiles) {
+            if (ocFile.isFolder()) {
+                folders++;
+            } else {
+                files++;
+            }
+        }
+
+        String output = "";
+       
+        if (files > 0){
+            if (files == 1) {
+                output = output + files.toString() + " " + getResources().getString(R.string.file_list_file);
+            } else {
+                output = output + files.toString() + " " + getResources().getString(R.string.file_list_files);
+            }
+        }
+        if (folders > 0 && files > 0){
+            output = output + ", ";
+        }
+        if (folders == 1) {
+            output = output + folders.toString() + " " + getResources().getString(R.string.file_list_folder);
+        } else if (folders > 1) {
+            output = output + folders.toString() + " " + getResources().getString(R.string.file_list_folders);
+        }
+        
+        return output;
+    }
+    
     public void sortByName(boolean descending) {
         mAdapter.setSortOrder(FileListListAdapter.SORT_NAME, descending);
     }
index 4dd5c43..a3814c7 100644 (file)
@@ -328,7 +328,7 @@ public class PreviewImageFragment extends FileFragment {
         finish();
     }
     
-    
+
     private class BitmapLoader extends AsyncTask<String, Void, Bitmap> {
 
         /**
index 187bdf4..d0b8535 100644 (file)
Binary files a/third_party/android-support-library/android-support-v4.jar and b/third_party/android-support-library/android-support-v4.jar differ