Merge pull request #178 from nextcloud/updateCopyMove

move / copy updated
This commit is contained in:
Andy Scherzinger 2016-09-06 17:23:18 +02:00 committed by GitHub
commit 0bec9c31c9
29 changed files with 137 additions and 640 deletions

View file

@ -1,16 +1,30 @@
## 1.3.0 (September, 2016)
- Files drop permission in share viewe
- Display quota if configured/available in navigation drawer
- Resume chunked uploads instead of complete restarts
- Filter remote and local file lists
- Mix folders and files on sort by date
- Upload when charging option
- Revamp upload options Move/Copy/Just-Upload
- Text can be selected and shared to Nextcloud
- Respect metered wifi and block instant uploads
- Proper handling of .djvu files
- Bugfixes and design improvements
## 1.2.0 (July 29, 2016)
- Multi select capabilities
- confirmation dialog on account removal
- offline available filter in main menu
- sorting capability when choosing files to be uploaded
- video thumbnails if activated on server
- thumbnails during upload
- fixed user agent for file firewalling
- showing server side folder sizes
- text in test preview can now be selected
- search suggestions fixed for user/group search during sharing
- minor bugfixes
- Confirmation dialog on account removal
- Offline available filter in main menu
- Sorting capability when choosing files to be uploaded
- Video thumbnails if activated on server
- Thumbnails during upload
- Fixed user agent for file firewalling
- Showing server side folder sizes
- Text in test preview can now be selected
- Search suggestions fixed for user/group search during sharing
- Minor bugfixes
## 1.1.0 (July 6, 2016)

View file

@ -1,19 +0,0 @@
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Mac .DS_Store files
.DS_Store

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.owncloud.android.workaround.accounts"
android:versionCode="0100029"
android:versionName="1.0.29" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="23" />
<application
android:allowBackup="false"
android:icon="@drawable/workaround_app_icon"
android:label="@string/workaround_app_name"
>
<service
android:name=".AccountAuthenticatorService"
android:exported="false">
<intent-filter android:priority="1">
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>
</application>
</manifest>

View file

@ -1,8 +0,0 @@
# Nextcloud Jelly Bean Workaround
Helper app to work around the problem of lost credentials at reboot time found in devices with Android 4.1.x.
Only needed for Nextcloud apps installed from the Google Play Store.
See more information about the bug here:
http://code.google.com/p/android/issues/detail?id=34880

View file

@ -1,42 +0,0 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
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')
}
}

View file

@ -1,6 +0,0 @@
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

View file

@ -1,164 +0,0 @@
#!/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 "$@"

View file

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

View file

@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View file

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
ownCloud Android client application
Copyright (C) 2015 ownCloud Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<string name="workaround_app_name">ownCloud Jelly Bean Workaround for lost credentials</string>
<string name="main_app_name">ownCloud</string>
<string name="account_type">owncloud</string>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="@string/account_type"
android:icon="@drawable/main_app_icon"
android:label="@string/main_app_name"
android:smallIcon="@drawable/main_app_icon">
</account-authenticator>

View file

@ -1,138 +0,0 @@
/* ownCloud Jelly Bean Workaround for lost credentials
* Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.owncloud.android.workaround.accounts;
import android.accounts.AbstractAccountAuthenticator;
import android.accounts.Account;
import android.accounts.AccountAuthenticatorResponse;
import android.accounts.AccountManager;
import android.accounts.NetworkErrorException;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
//import android.util.Log;
public class AccountAuthenticatorService extends Service {
private AccountAuthenticator mAuthenticator;
//static final public String ACCOUNT_TYPE = "owncloud";
@Override
public void onCreate() {
super.onCreate();
mAuthenticator = new AccountAuthenticator(this);
}
@Override
public IBinder onBind(Intent intent) {
return mAuthenticator.getIBinder();
}
public static class AccountAuthenticator extends AbstractAccountAuthenticator {
public static final String KEY_AUTH_TOKEN_TYPE = "authTokenType";
public static final String KEY_REQUIRED_FEATURES = "requiredFeatures";
public static final String KEY_LOGIN_OPTIONS = "loginOptions";
public AccountAuthenticator(Context context) {
super(context);
}
@Override
public Bundle addAccount(AccountAuthenticatorResponse response,
String accountType, String authTokenType,
String[] requiredFeatures, Bundle options)
throws NetworkErrorException {
//Log.e("WORKAROUND", "Yes, WORKAROUND takes the control here");
final Intent intent = new Intent("com.owncloud.android.workaround.accounts.CREATE");
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
response);
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures);
intent.putExtra(KEY_LOGIN_OPTIONS, options);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
final Bundle bundle = new Bundle();
bundle.putParcelable(AccountManager.KEY_INTENT, intent);
return bundle;
//return getCommonResultBundle();
}
@Override
public Bundle confirmCredentials(AccountAuthenticatorResponse response,
Account account, Bundle options) throws NetworkErrorException {
return getCommonResultBundle();
}
@Override
public Bundle editProperties(AccountAuthenticatorResponse response,
String accountType) {
return getCommonResultBundle();
}
@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response,
Account account, String authTokenType, Bundle options)
throws NetworkErrorException {
return getCommonResultBundle();
}
@Override
public String getAuthTokenLabel(String authTokenType) {
return "";
}
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response,
Account account, String[] features) throws NetworkErrorException {
return getCommonResultBundle();
}
@Override
public Bundle updateCredentials(AccountAuthenticatorResponse response,
Account account, String authTokenType, Bundle options)
throws NetworkErrorException {
return getCommonResultBundle();
}
@Override
public Bundle getAccountRemovalAllowed(
AccountAuthenticatorResponse response, Account account)
throws NetworkErrorException {
return super.getAccountRemovalAllowed(response, account);
}
private Bundle getCommonResultBundle() {
Bundle resultBundle = new Bundle();
resultBundle.putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION);
resultBundle.putString(AccountManager.KEY_ERROR_MESSAGE, "This is just a workaround, not a real account authenticator");
return resultBundle;
}
}
}

View file

@ -17,7 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/upload_files_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
@ -49,33 +48,13 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp">
android:padding="@dimen/standard_padding">
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_radio_group"
android:layout_width="fill_parent"
<Spinner
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/upload_copy_files"
android:id="@+id/upload_radio_copy"
android:paddingRight="8dp"
android:checked="false" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/upload_move_files"
android:id="@+id/upload_radio_move"
android:paddingRight="8dp"
android:checked="false" />
</RadioGroup>
android:id="@+id/upload_files_spinner_behaviour"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
@ -83,9 +62,9 @@
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingBottom="16dp">
android:paddingLeft="@dimen/standard_padding"
android:paddingRight="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_padding">
<android.support.v7.widget.AppCompatButton
android:id="@+id/upload_files_btn_cancel"

View file

@ -2,22 +2,34 @@
<resources>
<declare-styleable name="ActionEditText">
<attr name="optionOneString" format="string" />
<attr name="optionOneColor" format="color" />
<attr name="optionTwoString" format="string" />
<attr name="optionTwoColor" format="color" />
<attr name="onBadgeClick" format="string" />
</declare-styleable>
<string-array name="pref_behaviour_entries">
<string-array name="pref_behaviour_entries" translatable="false">
<item>@string/pref_behaviour_entries_keep_file</item>
<item>@string/pref_behaviour_entries_move</item>
<item>@string/pref_behaviour_entries_delete_file</item>
</string-array>
<string-array name="pref_behaviour_entryValues">
<string-array name="pref_behaviour_entryValues" translatable="false">
<item>NOTHING</item>
<item>MOVE</item>
<item>DELETE</item>
</string-array>
<string-array name="upload_files_behaviour" translatable="false">
<item>@string/uploader_upload_files_behaviour_move_to_nextcloud_folder</item>
<item>@string/uploader_upload_files_behaviour_only_upload</item>
<item>@string/uploader_upload_files_behaviour_upload_and_delete_from_source</item>
</string-array>
<string-array name="menu_items_sort_by_options" translatable="false">
<item>@string/menu_item_sort_by_name</item>
<item>@string/menu_item_sort_by_date</item>
<item>@string/menu_item_sort_by_size</item>
</string-array>
</resources>

View file

@ -14,11 +14,9 @@
<string name="actionbar_send_file">Send</string>
<string name="actionbar_sort">Sort</string>
<string name="actionbar_sort_title">Sort by</string>
<string-array name="actionbar_sortby">
<item>A-Z</item>
<item>Newest - Oldest</item>
<item>Biggest - Smallest</item>
</string-array>
<string name="menu_item_sort_by_name">A - Z</string>
<string name="menu_item_sort_by_date">Newest - Oldest</string>
<string name="menu_item_sort_by_size">Biggest - Smallest</string>
<string name="drawer_item_all_files">All files</string>
<string name="drawer_item_on_device">On device</string>
<string name="drawer_item_settings">Settings</string>
@ -71,6 +69,9 @@
<string name="uploader_error_message_read_permission_not_granted">%1$s is not allowed to read a received file</string>
<string name="uploader_error_message_source_file_not_found">File to upload was not found in its location. Please check whether the file exists.</string>
<string name="uploader_error_message_source_file_not_copied">An error occurred while copying the file to a temporary folder. Please try to send again.</string>
<string name="uploader_upload_files_behaviour_move_to_nextcloud_folder">move to nextcloud folder</string>
<string name="uploader_upload_files_behaviour_only_upload">only upload</string>
<string name="uploader_upload_files_behaviour_upload_and_delete_from_source">upload and delete from source</string>
<string name="file_list_seconds_ago">seconds ago</string>
<string name="file_list_empty">Nothing in here. Upload something!</string>
<string name="file_list_loading">Loading&#8230;</string>
@ -413,6 +414,7 @@
<string name="pref_behaviour_entries_keep_file">kept in original folder</string>
<string name="pref_behaviour_entries_move">moved to app folder</string>
<string name="pref_behaviour_entries_delete_file">deleted</string>
<string name="share_dialog_title">Sharing</string>
<string name="share_file">Share %1$s</string>

View file

@ -1,2 +1 @@
include ':'
include ':oc_jb_workaround'

View file

@ -143,7 +143,7 @@ public abstract class PreferenceManager {
*/
public static int getUploaderBehaviour(Context context) {
return getDefaultSharedPreferences(context)
.getInt(AUTO_PREF__UPLOADER_BEHAVIOR, FileUploader.LOCAL_BEHAVIOUR_COPY);
.getInt(AUTO_PREF__UPLOADER_BEHAVIOR, 1);
}
/**

View file

@ -154,6 +154,9 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
} else if (behaviour.equalsIgnoreCase("MOVE")) {
Log_OC.d(TAG, "upload file and move file to oc folder");
return FileUploader.LOCAL_BEHAVIOUR_MOVE;
} else if (behaviour.equalsIgnoreCase("DELETE")) {
Log_OC.d(TAG, "upload file and delete original file");
return FileUploader.LOCAL_BEHAVIOUR_DELETE;
}
return null;
}

View file

@ -149,7 +149,7 @@ public class FileUploader extends Service
public static final int LOCAL_BEHAVIOUR_COPY = 0;
public static final int LOCAL_BEHAVIOUR_MOVE = 1;
public static final int LOCAL_BEHAVIOUR_FORGET = 2;
public static final int LOCAL_BEHAVIOUR_DELETE = 3;
private Looper mServiceLooper;
private ServiceHandler mServiceHandler;

View file

@ -397,6 +397,8 @@ public class UploadFileOperation extends SyncOperation {
}
mFile.setStoragePath("");
} else if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_DELETE) {
originalFile.delete();
} else {
mFile.setStoragePath(expectedPath);

View file

@ -574,7 +574,7 @@ public class FileDisplayActivity extends HookActivity
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.actionbar_sort_title)
.setSingleChoiceItems(R.array.actionbar_sortby, sortOrder,
.setSingleChoiceItems(R.array.menu_items_sort_by_options, sortOrder,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
switch (which) {
@ -654,12 +654,16 @@ public class FileDisplayActivity extends HookActivity
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE__SELECT_CONTENT_FROM_APPS &&
(resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
(resultCode == RESULT_OK ||
resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
requestUploadOfContentFromApps(data, resultCode);
} else if (requestCode == REQUEST_CODE__SELECT_FILES_FROM_FILE_SYSTEM &&
(resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
(resultCode == RESULT_OK ||
resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE ||
resultCode == UploadFilesActivity.RESULT_OK_AND_DO_NOTHING ||
resultCode == UploadFilesActivity.RESULT_OK_AND_DELETE)) {
requestUploadOfFilesFromFileSystem(data, resultCode);
@ -704,8 +708,23 @@ public class FileDisplayActivity extends HookActivity
remotePaths[j] = remotePathBase + (new File(filePaths[j])).getName();
}
int behaviour = (resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE) ? FileUploader
.LOCAL_BEHAVIOUR_MOVE : FileUploader.LOCAL_BEHAVIOUR_COPY;
// default, as fallback
int behaviour = FileUploader.LOCAL_BEHAVIOUR_FORGET;
switch (resultCode) {
case UploadFilesActivity.RESULT_OK_AND_MOVE:
behaviour = FileUploader.LOCAL_BEHAVIOUR_MOVE;
break;
case UploadFilesActivity.RESULT_OK_AND_DELETE:
behaviour = FileUploader.LOCAL_BEHAVIOUR_DELETE;
break;
case UploadFilesActivity.RESULT_OK_AND_DO_NOTHING:
behaviour = FileUploader.LOCAL_BEHAVIOUR_FORGET;
break;
}
FileUploader.UploadRequester requester = new FileUploader.UploadRequester();
requester.uploadNewFile(
this,

View file

@ -37,12 +37,11 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import com.owncloud.android.R;
import com.owncloud.android.db.PreferenceManager;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment.ConfirmationDialogFragmentListener;
@ -67,6 +66,7 @@ public class UploadFilesActivity extends FileActivity implements
private LocalFileListFragment mFileListFragment;
private Button mCancelBtn;
private Button mUploadBtn;
private Spinner mBehaviourSpinner;
private Account mAccountOnCreation;
private DialogFragment mCurrentDialog;
private Menu mOptionsMenu;
@ -74,8 +74,10 @@ public class UploadFilesActivity extends FileActivity implements
public static final String EXTRA_CHOSEN_FILES =
UploadFilesActivity.class.getCanonicalName() + ".EXTRA_CHOSEN_FILES";
public static final int RESULT_OK_AND_MOVE = RESULT_FIRST_USER;
public static final int RESULT_OK_AND_MOVE = RESULT_FIRST_USER;
public static final int RESULT_OK_AND_DO_NOTHING = 2;
public static final int RESULT_OK_AND_DELETE = 3;
private static final String KEY_DIRECTORY_PATH =
UploadFilesActivity.class.getCanonicalName() + ".KEY_DIRECTORY_PATH";
private static final String KEY_ALL_SELECTED =
@ -84,9 +86,6 @@ public class UploadFilesActivity extends FileActivity implements
private static final String TAG = "UploadFilesActivity";
private static final String WAIT_DIALOG_TAG = "WAIT";
private static final String QUERY_TO_MOVE_DIALOG_TAG = "QUERY_TO_MOVE";
private RadioButton mRadioBtnCopyFiles;
private RadioButton mRadioBtnMoveFiles;
@Override
public void onCreate(Bundle savedInstanceState) {
@ -130,15 +129,13 @@ public class UploadFilesActivity extends FileActivity implements
int localBehaviour = PreferenceManager.getUploaderBehaviour(this);
mRadioBtnMoveFiles = (RadioButton) findViewById(R.id.upload_radio_move);
if (localBehaviour == FileUploader.LOCAL_BEHAVIOUR_MOVE){
mRadioBtnMoveFiles.setChecked(true);
}
mRadioBtnCopyFiles = (RadioButton) findViewById(R.id.upload_radio_copy);
if (localBehaviour == FileUploader.LOCAL_BEHAVIOUR_COPY){
mRadioBtnCopyFiles.setChecked(true);
}
// file upload spinner
mBehaviourSpinner = (Spinner) findViewById(R.id.upload_files_spinner_behaviour);
ArrayAdapter<CharSequence> behaviourAdapter = ArrayAdapter.createFromResource(this,
R.array.upload_files_behaviour, android.R.layout.simple_spinner_item);
behaviourAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mBehaviourSpinner.setAdapter(behaviourAdapter);
mBehaviourSpinner.setSelection(localBehaviour);
// setup the toolbar
setupToolbar();
@ -380,9 +377,9 @@ public class UploadFilesActivity extends FileActivity implements
if (v.getId() == R.id.upload_files_btn_cancel) {
setResult(RESULT_CANCELED);
finish();
} else if (v.getId() == R.id.upload_files_btn_upload) {
new CheckAvailableSpaceTask().execute();
new CheckAvailableSpaceTask().execute(mBehaviourSpinner.getSelectedItemPosition()==0);
}
}
@ -392,7 +389,7 @@ public class UploadFilesActivity extends FileActivity implements
*
* Maybe an AsyncTask is not strictly necessary, but who really knows.
*/
private class CheckAvailableSpaceTask extends AsyncTask<Void, Void, Boolean> {
private class CheckAvailableSpaceTask extends AsyncTask<Boolean, Void, Boolean> {
/**
* Updates the UI before trying the movement
@ -403,22 +400,27 @@ public class UploadFilesActivity extends FileActivity implements
mCurrentDialog = IndeterminateProgressDialog.newInstance(R.string.wait_a_moment, false);
mCurrentDialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);
}
/**
* Checks the available space
*
* @return 'True' if there is space enough.
* Checks the available space.
*
* @param params boolean flag if storage calculation should be done.
* @return 'True' if there is space enough or doesn't have to be calculated
*/
@Override
protected Boolean doInBackground(Void... params) {
String[] checkedFilePaths = mFileListFragment.getCheckedFilePaths();
long total = 0;
for (int i=0; checkedFilePaths != null && i < checkedFilePaths.length ; i++) {
String localPath = checkedFilePaths[i];
File localFile = new File(localPath);
total += localFile.length();
protected Boolean doInBackground(Boolean... params) {
if(params[0]) {
String[] checkedFilePaths = mFileListFragment.getCheckedFilePaths();
long total = 0;
for (int i = 0; checkedFilePaths != null && i < checkedFilePaths.length; i++) {
String localPath = checkedFilePaths[i];
File localFile = new File(localPath);
total += localFile.length();
}
return FileStorageUtils.getUsableSpace(mAccountOnCreation.name) >= total;
}
return FileStorageUtils.getUsableSpace(mAccountOnCreation.name) >= total;
return true;
}
/**
@ -441,13 +443,25 @@ public class UploadFilesActivity extends FileActivity implements
Intent data = new Intent();
data.putExtra(EXTRA_CHOSEN_FILES, mFileListFragment.getCheckedFilePaths());
if (mRadioBtnMoveFiles.isChecked()){
setResult(RESULT_OK_AND_MOVE, data);
PreferenceManager.setUploaderBehaviour(getApplicationContext(), FileUploader.LOCAL_BEHAVIOUR_MOVE);
} else {
setResult(RESULT_OK, data);
PreferenceManager.setUploaderBehaviour(getApplicationContext(), FileUploader.LOCAL_BEHAVIOUR_COPY);
// set result code
switch (mBehaviourSpinner.getSelectedItemPosition()) {
case 0: // move to nextcloud folder
setResult(RESULT_OK_AND_MOVE, data);
break;
case 1: // only upload
setResult(RESULT_OK_AND_DO_NOTHING, data);
break;
case 2: // upload and delete from source
setResult(RESULT_OK_AND_DELETE, data);
break;
}
// store behaviour
PreferenceManager.setUploaderBehaviour(getApplicationContext(),
mBehaviourSpinner.getSelectedItemPosition());
finish();
} else {
// show a dialog to query the user if wants to move the selected files