From: David A. Velasco
Date: Thu, 4 Apr 2013 14:44:30 +0000 (+0200)
Subject: Merge branch 'develop' into feature_previews
X-Git-Tag: oc-android-1.4.3~39^2~6
X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/77ddd1ccb62e8b70580b8f410dda703a269f224f?hp=fa80179106169cd260570c5396d5b61e8a666e78
Merge branch 'develop' into feature_previews
Conflicts:
AndroidManifest.xml
res/menu/file_context_menu.xml
res/menu/menu.xml
res/values-de-rDE/strings.xml
res/values/strings.xml
src/com/owncloud/android/files/services/FileUploader.java
src/com/owncloud/android/operations/UploadFileOperation.java
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
---
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 279beba2..42c51748 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3,9 +3,11 @@
ownCloud Android client application
Copyright (C) 2012 Bartek Przybylski
+ Copyright (C) 2012-2013 ownCloud Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
+ the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -57,6 +59,9 @@
+
+
+
@@ -139,12 +144,12 @@
-
+
-
+
-
+
@@ -153,9 +158,9 @@
-
-
-
+
+
+
@@ -163,7 +168,7 @@
-
+
-
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..5d0c02f2
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,39 @@
+## Submitting issues
+
+If you have questions about how to use ownCloud, please direct these to the [mailing list][mailinglist] or our [forum][forum]. We are also available on [IRC][irc].
+
+### Guidelines
+* [Report the issue](https://github.com/owncloud/android/issues/new) using our [template][template], it includes all the informations we need to track down the issue.
+* This repository is *only* for issues within the ownCloud Android app code. Issues in other compontents should be reported in their own repositores:
+ - [ownCloud code](https://github.com/owncloud/core/issues)
+ - [iOS client](https://github.com/owncloud/ios-issues/issues)
+ - [Desktop client](https://github.com/owncloud/mirall/issues)
+ - [ownCloud apps](https://github.com/owncloud/apps/issues) (e.g. Calendar, Contacts...)
+* Search the existing issues first, it's likely that your issue was already reported.
+
+If your issue appears to be a bug, and hasn't been reported, open a new issue.
+
+Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues.
+
+[template]: https://raw.github.com/owncloud/android/master/issue_template.md
+[mailinglist]: https://mail.kde.org/mailman/listinfo/owncloud
+[forum]: http://forum.owncloud.org/
+[irc]: http://webchat.freenode.net/?channels=owncloud&uio=d4
+
+## Contributing to Source Code
+
+Thanks for wanting to contribute source code to ownCloud. That's great!
+
+Before we're able to merge your code into the ownCloud app for Android, you need to sign our [Contributor Agreement][agreement].
+
+### Guidelines
+* Contribute your code in the branch 'develop'. It will give us a better chance to test your code before merging it with stable code.
+* For your first contribution, start a pull request on develop and send us the signed [Contributor Agreement][agreement].
+* Keep on using pull requests for your next contributions although you own write permissions.
+
+[agreement]: http://owncloud.org/about/contributor-agreement/
+
+## Translations
+Please submit translations via [Transifex][transifex].
+
+[transifex]: https://www.transifex.com/projects/p/owncloud/
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 00000000..d159169d
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..3ba9f73a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+This is the android client for [owncloud][0].
+
+Make sure you read [SETUP.md][1] when you start working on this project.
+
+[0]: https://github.com/owncloud/core
+[1]: https://raw.github.com/owncloud/android/master/SETUP.md
\ No newline at end of file
diff --git a/README.setup b/README.setup
deleted file mode 100644
index 3d592e06..00000000
--- a/README.setup
+++ /dev/null
@@ -1,13 +0,0 @@
-If you want to start development of ownCloud android client you have two way to do so
-(a) building with console
-(b) building with eclipse
-
-1. Use setup_env.sh
-2a. ant clean;ant debug
-2b. Open Eclipse and import actionbarsherlock/library project to your workspace
-
-after those space you should be good to go.
-
-HAVE FUN!
-
-NOTE: You must have 'tools' and 'platforms-tools' in your path in order to run setup_env.sh
diff --git a/SETUP.md b/SETUP.md
new file mode 100644
index 00000000..d527d4fe
--- /dev/null
+++ b/SETUP.md
@@ -0,0 +1,23 @@
+
+ If you want to start development of ownCloud android client you have two way to do so:
+
+ 1. Building with console:
+
+ - Use setup_env.sh or setup_env.bat
+ - NOTE: You must have git, ant/bin, android/tools in your enviroment path
+
+ 2. Building with eclipse:
+
+ - Run ant clean debug
+ - Open Eclipse and import *actionbarsherlock/library* project to your workspace
+ - NOTE: You must have 'tools' and 'platforms-tools' in your path in order to run setup_env.sh
+
+ After those actions you should be good to go.
+
+ HAVE FUN!
+
+
+
+
+
+
diff --git a/THIRD_PARTY.txt b/THIRD_PARTY.txt
new file mode 100644
index 00000000..1d51b72a
--- /dev/null
+++ b/THIRD_PARTY.txt
@@ -0,0 +1,64 @@
+###################################################################
+ ownCloud Android client
+
+ Copyright (C) 2012-2013 ownCloud Inc.
+ Copyright (C) 2012 Bartek Przybylski
+###################################################################
+
+
+###########
+# LICENSE #
+###########
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+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.
+
+The source distribution of this program should include a full copy
+of the GNU GPL version 2 license in the LICENSE.txt file located
+in its root directory. If not, see .
+
+
+########################
+# THIRD PARTY LICENSES #
+########################
+
+Both the source and binary distributions of this software contain
+some third party software. All the third party software included
+or linked is redistributed under the terms and conditions of their
+original licenses. These licenses are compatible the GPL license
+that govern this software, for the purposes they are being used.
+
+The third party software included and used by this project is:
+
+ * Apache JackRabbit, version 2.2.5.
+ Copyright (C) 2004-2010 The Apache Software Foundation.
+ Licensed under Apache License, Version 2.0.
+ Placed at libs/jackrabbit-webdav-2.2.5-jar-with-dependencies.jar
+ The jar file must be included in the ownCloud client APK.
+ Original license document included at libs/LICENSE.txt
+ See http://jackrabbit.apache.org/
+
+ * Transifex client.JavaMail API, version 1.4.3
+ Copyright (C) Transifex.
+ Licensed under GNU General Public License.
+ Placed at third_party/transifex-client.
+ Used as a helper tool, not included in the ownCloud client APK.
+ Original license document included at third_party/transifex-client/LICENSE.
+ See http://help.transifex.com/features/client/
+
+ * ActionBarSherlock, master branch.
+ Copyright (C) 2012 Jake Wharton.
+ Licensed under Apache License, Version 2.0.
+ The official repository is linked as a submodule in the
+ ownCloud/android repository.
+ A binary JAR file must be generated from this linked project
+ and included in the ownCloud client APK.
+ See http://http://actionbarsherlock.com/
+
\ No newline at end of file
diff --git a/issue_template.md b/issue_template.md
new file mode 100644
index 00000000..493572d2
--- /dev/null
+++ b/issue_template.md
@@ -0,0 +1,32 @@
+### Expected behaviour
+Tell us what should happen
+
+### Actual behaviour
+Tell us what happens instead
+
+### Steps to reproduce
+1.
+2.
+3.
+
+### Environment data
+Android version:
+
+Device model:
+
+Stock or customized system:
+
+ownCloud app version:
+
+ownCloud server version:
+
+### Logs
+#### Web server error log
+```
+Insert your webserver log here
+```
+
+#### ownCloud log (data/owncloud.log)
+```
+Insert your ownCloud log here
+```
diff --git a/oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java b/oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java
index 32b164b0..102f2be6 100644
--- a/oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java
+++ b/oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java
@@ -1,8 +1,22 @@
/* ownCloud Jelly Bean Workaround for lost credentials
- *
* Copyright (C) 2013 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 .
+ *
*/
+
package com.owncloud.android.workaround.accounts;
import android.accounts.AbstractAccountAuthenticator;
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 00000000..27263337
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,100 @@
+
+
+
+ 4.0.0
+ com.owncloud.android
+ owncloud
+ 1.3.21-SNAPSHOT
+ apk
+ Owncloud Android
+
+
+ 1.6
+ 4.1.1.4
+ r7
+ 4.2.0
+
+
+ https://github.com/owncloud/android
+ Owncloud for Android
+
+ scm:git:git@github.com:owncloud/android.git
+ scm:git:git@github.com:owncloud/android.git
+ https://github.com/owncloud/android
+
+
+
+
+
+ com.google.android
+ android
+ ${google.android-version}
+ provided
+
+
+
+ com.google.android
+ support-v4
+ ${google.android.support-version}
+
+
+
+ com.actionbarsherlock
+ actionbarsherlock
+ ${actionbarsherlock-version}
+ provided
+
+
+
+ com.actionbarsherlock
+ actionbarsherlock
+ ${actionbarsherlock-version}
+ apklib
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webdav
+ 2.5.2
+
+
+
+
+
+ ${project.artifactId}
+
+ src
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.0
+
+ ${java-version}
+ ${java-version}
+
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+ 3.5.0
+
+
+
+ ${env.ANDROID_HOME}
+ 17
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/res/anim/disappear.xml b/res/anim/disappear.xml
index b1fd5e3a..1c98f627 100644
--- a/res/anim/disappear.xml
+++ b/res/anim/disappear.xml
@@ -1,4 +1,23 @@
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
diff --git a/res/anim/push_left_out.xml b/res/anim/push_left_out.xml
deleted file mode 100644
index 28802d2e..00000000
--- a/res/anim/push_left_out.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
diff --git a/res/anim/shrink_from_bottom.xml b/res/anim/shrink_from_bottom.xml
index a98d592a..517d36c8 100644
--- a/res/anim/shrink_from_bottom.xml
+++ b/res/anim/shrink_from_bottom.xml
@@ -1,4 +1,23 @@
+
+
+
+
+
+
+
diff --git a/res/drawable/btn.xml b/res/drawable/btn.xml
index 8e01f676..b58eda87 100644
--- a/res/drawable/btn.xml
+++ b/res/drawable/btn.xml
@@ -1,4 +1,23 @@
+
diff --git a/res/drawable/btn_round.xml b/res/drawable/btn_round.xml
index a7c5063f..a2c92aa8 100644
--- a/res/drawable/btn_round.xml
+++ b/res/drawable/btn_round.xml
@@ -1,4 +1,23 @@
+
diff --git a/res/drawable/btn_round_pressed.xml b/res/drawable/btn_round_pressed.xml
index 34d860dc..e567a6bd 100644
--- a/res/drawable/btn_round_pressed.xml
+++ b/res/drawable/btn_round_pressed.xml
@@ -1,4 +1,23 @@
+
diff --git a/res/drawable/connection_secure.xml b/res/drawable/connection_secure.xml
index b988c29b..7b2944f3 100644
--- a/res/drawable/connection_secure.xml
+++ b/res/drawable/connection_secure.xml
@@ -1,8 +1,27 @@
-
+
+
-
+
diff --git a/res/drawable/icon_list_selector.xml b/res/drawable/icon_list_selector.xml
deleted file mode 100644
index f7c83929..00000000
--- a/res/drawable/icon_list_selector.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/drawable/list_selector.xml b/res/drawable/list_selector.xml
index f7c83929..4af9f6b0 100644
--- a/res/drawable/list_selector.xml
+++ b/res/drawable/list_selector.xml
@@ -1,29 +1,28 @@
-
-
-
-
-
-
-
-
+
+
+
-
\ No newline at end of file
+
diff --git a/res/drawable/main_header_bg.xml b/res/drawable/main_header_bg.xml
index 04bdc465..166b666d 100644
--- a/res/drawable/main_header_bg.xml
+++ b/res/drawable/main_header_bg.xml
@@ -1,4 +1,23 @@
+
+
+
+
diff --git a/res/layout-land/account_setup.xml b/res/layout-land/account_setup.xml
index 24b3e8ad..c45405fa 100644
--- a/res/layout-land/account_setup.xml
+++ b/res/layout-land/account_setup.xml
@@ -2,10 +2,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/failed_upload_message_view.xml b/res/layout/failed_upload_message_view.xml
new file mode 100644
index 00000000..41e9a7d0
--- /dev/null
+++ b/res/layout/failed_upload_message_view.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/file_activity_details.xml b/res/layout/file_activity_details.xml
index f37270ba..e4f576c2 100644
--- a/res/layout/file_activity_details.xml
+++ b/res/layout/file_activity_details.xml
@@ -3,9 +3,11 @@
ownCloud Android client application
Copyright (C) 2012 Bartek Przybylski
+ Copyright (C) 2012-2013 ownCloud Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
+ the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@@ -14,7 +16,8 @@
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 .
+ along with this program. If not, see .
+
-->
+
+
+
+
diff --git a/res/layout/selected_account_element.xml b/res/layout/selected_account_element.xml
index fe3146e3..d4000484 100644
--- a/res/layout/selected_account_element.xml
+++ b/res/layout/selected_account_element.xml
@@ -1,4 +1,23 @@
+
+
- * DISCLAIMER: HttpClient developers DO NOT actively support this
- * component. The component is provided as a reference material, which
- * may be inappropriate for use without additional customization.
- *
- */
-
-public class EasySSLSocketFactory implements ProtocolSocketFactory {
-
- private static final String TAG = "EasySSLSocketFactory";
- private SSLContext sslcontext = null;
-
- /**
- * Constructor for EasySSLProtocolSocketFactory.
- */
- public EasySSLSocketFactory() {
- super();
- }
-
- private static SSLContext createEasySSLContext() {
- Log.d(TAG, "Creating Easy SSL Context");
- try {
- SSLContext context = SSLContext.getInstance("TLS");
- context.init(null, new TrustManager[] { new EasyX509TrustManager(
- null) }, null);
- return context;
- } catch (Exception er) {
- Log.e(TAG, er.getMessage() + "");
- throw new HttpClientError(er.toString());
- }
- }
-
- private SSLContext getSSLContext() {
- Log.d(TAG, "Getting Easy SSL Context");
- if (this.sslcontext == null) {
- this.sslcontext = createEasySSLContext();
- }
- return this.sslcontext;
- }
-
- /**
- * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int)
- */
- public Socket createSocket(String host, int port, InetAddress clientHost,
- int clientPort) throws IOException, UnknownHostException {
- Log.d(TAG, "Creating SSL Socket with remote " + host + ":" + port + ", client " + clientHost + ":" + clientPort);
-
- return getSSLContext().getSocketFactory().createSocket(host, port,
- clientHost, clientPort);
- }
-
- /**
- * Attempts to get a new socket connection to the given host within the
- * given time limit.
- *
- * To circumvent the limitations of older JREs that do not support connect
- * timeout a controller thread is executed. The controller thread attempts
- * to create a new socket within the given limit of time. If socket
- * constructor does not return until the timeout expires, the controller
- * terminates and throws an {@link ConnectTimeoutException}
- *
- *
- * @param host the host name/IP
- * @param port the port on the host
- * @param clientHost the local host name/IP to bind the socket to
- * @param clientPort the port on the local machine
- * @param params {@link HttpConnectionParams Http connection parameters}
- *
- * @return Socket a new socket
- *
- * @throws IOException if an I/O error occurs while creating the socket
- * @throws UnknownHostException if the IP address of the host cannot be
- * determined
- */
- public Socket createSocket(final String host, final int port,
- final InetAddress localAddress, final int localPort,
- final HttpConnectionParams params) throws IOException,
- UnknownHostException, ConnectTimeoutException {
- Log.d(TAG, "Creating SSL Socket with remote " + host + ":" + port + ", local " + localAddress + ":" + localPort + ", params: " + params);
- if (params == null) {
- throw new IllegalArgumentException("Parameters may not be null");
- }
- int timeout = params.getConnectionTimeout();
- SocketFactory socketfactory = getSSLContext().getSocketFactory();
- /*if (timeout == 0) {
- Log.d(TAG, " ... with connection timeout 0 and socket timeout " + params.getSoTimeout());
- Socket socket = socketfactory.createSocket(host, port, localAddress,
- localPort);
- socket.setSoTimeout(params.getSoTimeout());
- return socket;
- } else {*/
- Log.d(TAG, " ... with connection timeout " + timeout + " and socket timeout " + params.getSoTimeout());
- Socket socket = socketfactory.createSocket();
- SocketAddress localaddr = new InetSocketAddress(localAddress,
- localPort);
- SocketAddress remoteaddr = new InetSocketAddress(host, port);
- socket.setSoTimeout(params.getSoTimeout());
- socket.bind(localaddr);
- socket.connect(remoteaddr, timeout);
- return socket;
- //}
- }
-
- /**
- * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int)
- */
- public Socket createSocket(String host, int port) throws IOException,
- UnknownHostException {
- Log.d(TAG, "Creating SSL Socket with remote " + host + ":" + port);
- return getSSLContext().getSocketFactory().createSocket(host, port);
- }
-
- /**
- * @see SecureProtocolSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean)
- */
- public Socket createSocket(Socket socket, String host, int port,
- boolean autoClose) throws IOException, UnknownHostException {
- Log.d(TAG, "Creating SSL Socket from other shocket " + socket + " to remote " + host + ":" + port);
- return getSSLContext().getSocketFactory().createSocket(socket, host,
- port, autoClose);
- }
-
- public boolean equals(Object obj) {
- return ((obj != null) && obj.getClass().equals(
- EasySSLSocketFactory.class));
- }
-
- public int hashCode() {
- return EasySSLSocketFactory.class.hashCode();
- }
-
-}
\ No newline at end of file
diff --git a/src/com/owncloud/android/network/EasyX509TrustManager.java b/src/com/owncloud/android/network/EasyX509TrustManager.java
deleted file mode 100644
index 1ac62186..00000000
--- a/src/com/owncloud/android/network/EasyX509TrustManager.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.owncloud.android.network;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-
-/**
- * @author olamy
- * @version $Id: EasyX509TrustManager.java 765355 2009-04-15 20:59:07Z evenisse
- * $
- * @since 1.2.3
- */
-public class EasyX509TrustManager implements X509TrustManager {
-
- private X509TrustManager standardTrustManager = null;
-
- /**
- * Constructor for EasyX509TrustManager.
- */
- public EasyX509TrustManager(KeyStore keystore)
- throws NoSuchAlgorithmException, KeyStoreException {
- super();
- TrustManagerFactory factory = TrustManagerFactory
- .getInstance(TrustManagerFactory.getDefaultAlgorithm());
- factory.init(keystore);
- TrustManager[] trustmanagers = factory.getTrustManagers();
- if (trustmanagers.length == 0) {
- throw new NoSuchAlgorithmException("no trust manager found");
- }
- this.standardTrustManager = (X509TrustManager) trustmanagers[0];
- }
-
- /**
- * @see javax.net.ssl.X509TrustManager#checkClientTrusted(X509Certificate[],
- * String authType)
- */
- public void checkClientTrusted(X509Certificate[] certificates,
- String authType) throws CertificateException {
- standardTrustManager.checkClientTrusted(certificates, authType);
- }
-
- /**
- * @see javax.net.ssl.X509TrustManager#checkServerTrusted(X509Certificate[],
- * String authType)
- */
- public void checkServerTrusted(X509Certificate[] certificates,
- String authType) throws CertificateException {
- if ((certificates != null) && (certificates.length == 1)) {
- certificates[0].checkValidity();
- } else {
- // standardTrustManager.checkServerTrusted( certificates, authType
- // );
- }
- }
-
- /**
- * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers()
- */
- public X509Certificate[] getAcceptedIssuers() {
- return this.standardTrustManager.getAcceptedIssuers();
- }
-
-}
\ No newline at end of file
diff --git a/src/com/owncloud/android/network/OwnCloudClientUtils.java b/src/com/owncloud/android/network/OwnCloudClientUtils.java
index 5cc7a9fb..19844130 100644
--- a/src/com/owncloud/android/network/OwnCloudClientUtils.java
+++ b/src/com/owncloud/android/network/OwnCloudClientUtils.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -140,32 +140,6 @@ public class OwnCloudClientUtils {
/**
- * Allows or disallows self-signed certificates in ownCloud servers to reach
- *
- * @param allow 'True' to allow, 'false' to disallow
- */
- public static void allowSelfsignedCertificates(boolean allow) {
- Protocol pr = null;
- try {
- pr = Protocol.getProtocol("https");
- if (pr != null && mDefaultHttpsProtocol == null) {
- mDefaultHttpsProtocol = pr;
- }
- } catch (IllegalStateException e) {
- // nothing to do here; really
- }
- boolean isAllowed = (pr != null && pr.getSocketFactory() instanceof EasySSLSocketFactory);
- if (allow && !isAllowed) {
- Protocol.registerProtocol("https", new Protocol("https", new EasySSLSocketFactory(), 443));
- } else if (!allow && isAllowed) {
- if (mDefaultHttpsProtocol != null) {
- Protocol.registerProtocol("https", mDefaultHttpsProtocol);
- }
- }
- }
-
-
- /**
* Registers or unregisters the proper components for advanced SSL handling.
* @throws IOException
*/
diff --git a/src/com/owncloud/android/operations/ChunkedUploadFileOperation.java b/src/com/owncloud/android/operations/ChunkedUploadFileOperation.java
index 5e4b5913..d421803a 100644
--- a/src/com/owncloud/android/operations/ChunkedUploadFileOperation.java
+++ b/src/com/owncloud/android/operations/ChunkedUploadFileOperation.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/ConnectionCheckOperation.java b/src/com/owncloud/android/operations/ConnectionCheckOperation.java
index 558e0df2..f8ede263 100644
--- a/src/com/owncloud/android/operations/ConnectionCheckOperation.java
+++ b/src/com/owncloud/android/operations/ConnectionCheckOperation.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/DownloadFileOperation.java b/src/com/owncloud/android/operations/DownloadFileOperation.java
index 6a9d7b63..da6b2701 100644
--- a/src/com/owncloud/android/operations/DownloadFileOperation.java
+++ b/src/com/owncloud/android/operations/DownloadFileOperation.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/OnRemoteOperationListener.java b/src/com/owncloud/android/operations/OnRemoteOperationListener.java
index e226ef20..f2119a80 100644
--- a/src/com/owncloud/android/operations/OnRemoteOperationListener.java
+++ b/src/com/owncloud/android/operations/OnRemoteOperationListener.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/OperationCancelledException.java b/src/com/owncloud/android/operations/OperationCancelledException.java
index d15af08c..975d63fb 100644
--- a/src/com/owncloud/android/operations/OperationCancelledException.java
+++ b/src/com/owncloud/android/operations/OperationCancelledException.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/RemoteOperation.java b/src/com/owncloud/android/operations/RemoteOperation.java
index 5b58e0ca..1564f193 100644
--- a/src/com/owncloud/android/operations/RemoteOperation.java
+++ b/src/com/owncloud/android/operations/RemoteOperation.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/RemoteOperationResult.java b/src/com/owncloud/android/operations/RemoteOperationResult.java
index 64703386..0ef5b31b 100644
--- a/src/com/owncloud/android/operations/RemoteOperationResult.java
+++ b/src/com/owncloud/android/operations/RemoteOperationResult.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -32,142 +33,126 @@ import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.jackrabbit.webdav.DavException;
-import com.owncloud.android.network.CertificateCombinedException;
+import android.util.Log;
+import com.owncloud.android.network.CertificateCombinedException;
/**
* The result of a remote operation required to an ownCloud server.
*
- * Provides a common classification of remote operation results for all the application.
+ * Provides a common classification of remote operation results for all the
+ * application.
*
* @author David A. Velasco
*/
public class RemoteOperationResult implements Serializable {
-
+
/** Generated - should be refreshed every time the class changes!! */
private static final long serialVersionUID = -7805531062432602444L;
+ private static final String TAG = "RemoteOperationResult";
-
- public enum ResultCode {
- OK,
- OK_SSL,
- OK_NO_SSL,
- UNHANDLED_HTTP_CODE,
- UNAUTHORIZED,
- FILE_NOT_FOUND,
- INSTANCE_NOT_CONFIGURED,
- UNKNOWN_ERROR,
- WRONG_CONNECTION,
- TIMEOUT,
- INCORRECT_ADDRESS,
- HOST_NOT_AVAILABLE,
- NO_NETWORK_CONNECTION,
- SSL_ERROR,
- SSL_RECOVERABLE_PEER_UNVERIFIED,
- BAD_OC_VERSION,
- CANCELLED,
- INVALID_LOCAL_FILE_NAME,
- INVALID_OVERWRITE,
- CONFLICT,
- SYNC_CONFLICT,
- LOCAL_STORAGE_FULL,
- LOCAL_STORAGE_NOT_MOVED,
- LOCAL_STORAGE_NOT_COPIED
+ public enum ResultCode {
+ OK, OK_SSL, OK_NO_SSL, UNHANDLED_HTTP_CODE, UNAUTHORIZED, FILE_NOT_FOUND, INSTANCE_NOT_CONFIGURED, UNKNOWN_ERROR, WRONG_CONNECTION, TIMEOUT, INCORRECT_ADDRESS, HOST_NOT_AVAILABLE, NO_NETWORK_CONNECTION, SSL_ERROR, SSL_RECOVERABLE_PEER_UNVERIFIED, BAD_OC_VERSION, CANCELLED, INVALID_LOCAL_FILE_NAME, INVALID_OVERWRITE, CONFLICT, SYNC_CONFLICT, LOCAL_STORAGE_FULL, LOCAL_STORAGE_NOT_MOVED, LOCAL_STORAGE_NOT_COPIED, QUOTA_EXCEEDED
}
private boolean mSuccess = false;
private int mHttpCode = -1;
private Exception mException = null;
private ResultCode mCode = ResultCode.UNKNOWN_ERROR;
-
+
public RemoteOperationResult(ResultCode code) {
mCode = code;
mSuccess = (code == ResultCode.OK || code == ResultCode.OK_SSL || code == ResultCode.OK_NO_SSL);
}
-
+
public RemoteOperationResult(boolean success, int httpCode) {
- mSuccess = success;
+ mSuccess = success;
mHttpCode = httpCode;
if (success) {
mCode = ResultCode.OK;
-
+
} else if (httpCode > 0) {
switch (httpCode) {
- case HttpStatus.SC_UNAUTHORIZED:
- mCode = ResultCode.UNAUTHORIZED;
- break;
- case HttpStatus.SC_NOT_FOUND:
- mCode = ResultCode.FILE_NOT_FOUND;
- break;
- case HttpStatus.SC_INTERNAL_SERVER_ERROR:
- mCode = ResultCode.INSTANCE_NOT_CONFIGURED;
- break;
- case HttpStatus.SC_CONFLICT:
- mCode = ResultCode.CONFLICT;
- break;
- default:
- mCode = ResultCode.UNHANDLED_HTTP_CODE;
+ case HttpStatus.SC_UNAUTHORIZED:
+ mCode = ResultCode.UNAUTHORIZED;
+ break;
+ case HttpStatus.SC_NOT_FOUND:
+ mCode = ResultCode.FILE_NOT_FOUND;
+ break;
+ case HttpStatus.SC_INTERNAL_SERVER_ERROR:
+ mCode = ResultCode.INSTANCE_NOT_CONFIGURED;
+ break;
+ case HttpStatus.SC_CONFLICT:
+ mCode = ResultCode.CONFLICT;
+ break;
+ case HttpStatus.SC_INSUFFICIENT_STORAGE:
+ mCode = ResultCode.QUOTA_EXCEEDED;
+ break;
+ default:
+ mCode = ResultCode.UNHANDLED_HTTP_CODE;
+ Log.d(TAG, "RemoteOperationResult has prcessed UNHANDLED_HTTP_CODE: " + httpCode);
}
}
}
-
+
public RemoteOperationResult(Exception e) {
- mException = e;
-
+ mException = e;
+
if (e instanceof OperationCancelledException) {
mCode = ResultCode.CANCELLED;
-
- } else if (e instanceof SocketException) {
+
+ } else if (e instanceof SocketException) {
mCode = ResultCode.WRONG_CONNECTION;
-
+
} else if (e instanceof SocketTimeoutException) {
mCode = ResultCode.TIMEOUT;
-
+
} else if (e instanceof ConnectTimeoutException) {
mCode = ResultCode.TIMEOUT;
-
+
} else if (e instanceof MalformedURLException) {
mCode = ResultCode.INCORRECT_ADDRESS;
-
+
} else if (e instanceof UnknownHostException) {
mCode = ResultCode.HOST_NOT_AVAILABLE;
-
+
} else if (e instanceof SSLException || e instanceof RuntimeException) {
CertificateCombinedException se = getCertificateCombinedException(e);
if (se != null) {
mException = se;
- if (se.isRecoverable()) {
+ if (se.isRecoverable()) {
mCode = ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED;
}
-
- } else {
+ } else if (e instanceof RuntimeException) {
+ mCode = ResultCode.HOST_NOT_AVAILABLE;
+
+ } else {
mCode = ResultCode.SSL_ERROR;
}
-
+
} else {
mCode = ResultCode.UNKNOWN_ERROR;
}
-
+
}
-
-
+
public boolean isSuccess() {
return mSuccess;
}
-
+
public boolean isCancelled() {
return mCode == ResultCode.CANCELLED;
}
-
+
public int getHttpCode() {
return mHttpCode;
}
-
+
public ResultCode getCode() {
return mCode;
}
-
+
public Exception getException() {
return mException;
}
@@ -175,11 +160,11 @@ public class RemoteOperationResult implements Serializable {
public boolean isSslRecoverableException() {
return mCode == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED;
}
-
+
private CertificateCombinedException getCertificateCombinedException(Exception e) {
CertificateCombinedException result = null;
if (e instanceof CertificateCombinedException) {
- return (CertificateCombinedException)e;
+ return (CertificateCombinedException) e;
}
Throwable cause = mException.getCause();
Throwable previousCause = null;
@@ -188,39 +173,38 @@ public class RemoteOperationResult implements Serializable {
cause = cause.getCause();
}
if (cause != null && cause instanceof CertificateCombinedException) {
- result = (CertificateCombinedException)cause;
+ result = (CertificateCombinedException) cause;
}
return result;
}
-
-
+
public String getLogMessage() {
-
+
if (mException != null) {
if (mException instanceof OperationCancelledException) {
return "Operation cancelled by the caller";
-
- } else if (mException instanceof SocketException) {
+
+ } else if (mException instanceof SocketException) {
return "Socket exception";
-
+
} else if (mException instanceof SocketTimeoutException) {
return "Socket timeout exception";
-
+
} else if (mException instanceof ConnectTimeoutException) {
return "Connect timeout exception";
-
+
} else if (mException instanceof MalformedURLException) {
return "Malformed URL exception";
-
+
} else if (mException instanceof UnknownHostException) {
return "Unknown host exception";
-
+
} else if (mException instanceof CertificateCombinedException) {
if (((CertificateCombinedException) mException).isRecoverable())
return "SSL recoverable exception";
else
return "SSL exception";
-
+
} else if (mException instanceof SSLException) {
return "SSL exception";
@@ -237,25 +221,25 @@ public class RemoteOperationResult implements Serializable {
return "Unexpected exception";
}
}
-
+
if (mCode == ResultCode.INSTANCE_NOT_CONFIGURED) {
return "The ownCloud server is not configured!";
-
+
} else if (mCode == ResultCode.NO_NETWORK_CONNECTION) {
return "No network connection";
-
+
} else if (mCode == ResultCode.BAD_OC_VERSION) {
return "No valid ownCloud version was found at the server";
-
+
} else if (mCode == ResultCode.LOCAL_STORAGE_FULL) {
return "Local storage full";
-
+
} else if (mCode == ResultCode.LOCAL_STORAGE_NOT_MOVED) {
return "Error while moving file to final directory";
}
-
- return "Operation finished with HTTP status code " + mHttpCode + " (" + (isSuccess()?"success":"fail") + ")";
-
+
+ return "Operation finished with HTTP status code " + mHttpCode + " (" + (isSuccess() ? "success" : "fail") + ")";
+
}
}
diff --git a/src/com/owncloud/android/operations/RemoveFileOperation.java b/src/com/owncloud/android/operations/RemoveFileOperation.java
index bfc063f9..80f40977 100644
--- a/src/com/owncloud/android/operations/RemoveFileOperation.java
+++ b/src/com/owncloud/android/operations/RemoveFileOperation.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/RenameFileOperation.java b/src/com/owncloud/android/operations/RenameFileOperation.java
index f4ec7b0a..41233f18 100644
--- a/src/com/owncloud/android/operations/RenameFileOperation.java
+++ b/src/com/owncloud/android/operations/RenameFileOperation.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/SynchronizeFileOperation.java b/src/com/owncloud/android/operations/SynchronizeFileOperation.java
index 8bad631b..606017aa 100644
--- a/src/com/owncloud/android/operations/SynchronizeFileOperation.java
+++ b/src/com/owncloud/android/operations/SynchronizeFileOperation.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -116,7 +117,7 @@ public class SynchronizeFileOperation extends RemoteOperation {
serverChanged = (mServerFile.getModificationTimestamp() > mLocalFile.getModificationTimestampAtLastSyncForData());
}
boolean localChanged = (mLocalChangeAlreadyKnown || mLocalFile.getLocalModificationTimestamp() > mLocalFile.getLastSyncDateForData());
- // TODO this will be always true after the app is upgraded to database version 3; will result in unnecessary uploads
+ // TODO this will be always true after the app is upgraded to database version 2; will result in unnecessary uploads
/// decide action to perform depending upon changes
if (localChanged && serverChanged) {
diff --git a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java
index 849413fd..977460bf 100644
--- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java
+++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/UpdateOCVersionOperation.java b/src/com/owncloud/android/operations/UpdateOCVersionOperation.java
index 7072d39f..08a9c15f 100644
--- a/src/com/owncloud/android/operations/UpdateOCVersionOperation.java
+++ b/src/com/owncloud/android/operations/UpdateOCVersionOperation.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/operations/UploadFileOperation.java b/src/com/owncloud/android/operations/UploadFileOperation.java
index 55871eaf..0dfb72c3 100644
--- a/src/com/owncloud/android/operations/UploadFileOperation.java
+++ b/src/com/owncloud/android/operations/UploadFileOperation.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -33,6 +33,9 @@ import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.http.HttpStatus;
+import android.accounts.Account;
+import android.util.Log;
+
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileUploader;
import com.owncloud.android.network.ProgressiveDataTransferer;
@@ -45,8 +48,6 @@ import eu.alefzero.webdav.FileRequestEntity;
import eu.alefzero.webdav.OnDatatransferProgressListener;
import eu.alefzero.webdav.WebdavClient;
import eu.alefzero.webdav.WebdavUtils;
-import android.accounts.Account;
-import android.util.Log;
/**
* Remote operation performing the upload of a file to an ownCloud server
@@ -54,7 +55,7 @@ import android.util.Log;
* @author David A. Velasco
*/
public class UploadFileOperation extends RemoteOperation {
-
+
private static final String TAG = UploadFileOperation.class.getSimpleName();
private Account mAccount;
@@ -84,10 +85,13 @@ public class UploadFileOperation extends RemoteOperation {
throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation creation");
if (file == null)
throw new IllegalArgumentException("Illegal NULL file in UploadFileOperation creation");
- if (file.getStoragePath() == null || file.getStoragePath().length() <= 0 || !(new File(file.getStoragePath()).exists())) {
- throw new IllegalArgumentException("Illegal file in UploadFileOperation; storage path invalid or file not found: " + file.getStoragePath());
+ if (file.getStoragePath() == null || file.getStoragePath().length() <= 0
+ || !(new File(file.getStoragePath()).exists())) {
+ throw new IllegalArgumentException(
+ "Illegal file in UploadFileOperation; storage path invalid or file not found: "
+ + file.getStoragePath());
}
-
+
mAccount = account;
mFile = file;
mRemotePath = file.getRemotePath();
@@ -98,39 +102,38 @@ public class UploadFileOperation extends RemoteOperation {
mOriginalFileName = mFile.getFileName();
}
-
public Account getAccount() {
return mAccount;
}
-
+
public String getFileName() {
return mOriginalFileName;
}
-
+
public OCFile getFile() {
return mFile;
}
-
+
public OCFile getOldFile() {
- return mOldFile;
+ return mOldFile;
}
-
+
public String getOriginalStoragePath() {
return mOriginalStoragePath;
}
-
+
public String getStoragePath() {
return mFile.getStoragePath();
}
public String getRemotePath() {
- return mFile.getRemotePath();
+ return mFile.getRemotePath();
}
public String getMimeType() {
return mFile.getMimetype();
}
-
+
public boolean isInstant() {
return mIsInstant;
}
@@ -138,7 +141,7 @@ public class UploadFileOperation extends RemoteOperation {
public boolean isRemoteFolderToBeCreated() {
return mRemoteFolderToBeCreated;
}
-
+
public void setRemoteFolderToBeCreated() {
mRemoteFolderToBeCreated = true;
}
@@ -146,11 +149,11 @@ public class UploadFileOperation extends RemoteOperation {
public boolean getForceOverwrite() {
return mForceOverwrite;
}
-
+
public boolean wasRenamed() {
return mWasRenamed;
}
-
+
public Set getDataTransferListeners() {
return mDataTransferListeners;
}
@@ -172,38 +175,48 @@ public class UploadFileOperation extends RemoteOperation {
((ProgressiveDataTransferer)mEntity).removeDatatransferProgressListener(listener);
}
}
-
+
@Override
protected RemoteOperationResult run(WebdavClient client) {
RemoteOperationResult result = null;
boolean localCopyPassed = false, nameCheckPassed = false;
File temporalFile = null, originalFile = new File(mOriginalStoragePath), expectedFile = null;
try {
- /// rename the file to upload, if necessary
+ // / rename the file to upload, if necessary
if (!mForceOverwrite) {
String remotePath = getAvailableRemotePath(client, mRemotePath);
mWasRenamed = !remotePath.equals(mRemotePath);
if (mWasRenamed) {
- createNewOCFile(remotePath);
+ createNewOCFile(remotePath);
}
}
nameCheckPassed = true;
-
- String expectedPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, mFile); /// not before getAvailableRemotePath() !!!
+
+ String expectedPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, mFile); // /
+ // not
+ // before
+ // getAvailableRemotePath()
+ // !!!
expectedFile = new File(expectedPath);
-
- /// check location of local file; if not the expected, copy to a temporal file before upload (if COPY is the expected behaviour)
+
+ // / check location of local file; if not the expected, copy to a
+ // temporal file before upload (if COPY is the expected behaviour)
if (!mOriginalStoragePath.equals(expectedPath) && mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_COPY) {
if (FileStorageUtils.getUsableSpace(mAccount.name) < originalFile.length()) {
result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_FULL);
- return result; // error condition when the file should be copied
-
+ return result; // error condition when the file should be
+ // copied
+
} else {
String temporalPath = FileStorageUtils.getTemporalPath(mAccount.name) + mFile.getRemotePath();
mFile.setStoragePath(temporalPath);
temporalFile = new File(temporalPath);
- if (!mOriginalStoragePath.equals(temporalPath)) { // preventing weird but possible situation
+ if (!mOriginalStoragePath.equals(temporalPath)) { // preventing
+ // weird
+ // but
+ // possible
+ // situation
InputStream in = null;
OutputStream out = null;
try {
@@ -215,38 +228,42 @@ public class UploadFileOperation extends RemoteOperation {
temporalFile.createNewFile();
if (!temporalFile.isFile()) {
throw new IOException("Unexpected error: target file could not be created");
- }
+ }
in = new FileInputStream(originalFile);
out = new FileOutputStream(temporalFile);
byte[] buf = new byte[1024];
int len;
- while ((len = in.read(buf)) > 0){
+ while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
-
+
} catch (Exception e) {
result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_COPIED);
return result;
-
+
} finally {
try {
- if (in != null) in.close();
+ if (in != null)
+ in.close();
} catch (Exception e) {
- Log.d(TAG, "Weird exception while closing input stream for " + mOriginalStoragePath + " (ignoring)", e);
+ Log.d(TAG, "Weird exception while closing input stream for " + mOriginalStoragePath
+ + " (ignoring)", e);
}
try {
- if (out != null) out.close();
+ if (out != null)
+ out.close();
} catch (Exception e) {
- Log.d(TAG, "Weird exception while closing output stream for " + expectedPath + " (ignoring)", e);
+ Log.d(TAG, "Weird exception while closing output stream for " + expectedPath
+ + " (ignoring)", e);
}
}
}
}
}
localCopyPassed = true;
-
- /// perform the upload
- synchronized(mCancellationRequested) {
+
+ // / perform the upload
+ synchronized (mCancellationRequested) {
if (mCancellationRequested.get()) {
throw new OperationCancelledException();
} else {
@@ -254,19 +271,21 @@ public class UploadFileOperation extends RemoteOperation {
}
}
int status = uploadFile(client);
-
-
- /// move local temporal file or original file to its corresponding location in the ownCloud local folder
+
+ // / move local temporal file or original file to its corresponding
+ // location in the ownCloud local folder
if (isSuccess(status)) {
if (mLocalBehaviour == FileUploader.LOCAL_BEHAVIOUR_FORGET) {
mFile.setStoragePath(null);
-
+
} else {
mFile.setStoragePath(expectedPath);
File fileToMove = null;
- if (temporalFile != null) { // FileUploader.LOCAL_BEHAVIOUR_COPY ; see where temporalFile was set
+ if (temporalFile != null) { // FileUploader.LOCAL_BEHAVIOUR_COPY
+ // ; see where temporalFile was
+ // set
fileToMove = temporalFile;
- } else { // FileUploader.LOCAL_BEHAVIOUR_MOVE
+ } else { // FileUploader.LOCAL_BEHAVIOUR_MOVE
fileToMove = originalFile;
}
if (!expectedFile.equals(fileToMove)) {
@@ -274,18 +293,22 @@ public class UploadFileOperation extends RemoteOperation {
expectedFolder.mkdirs();
if (!expectedFolder.isDirectory() || !fileToMove.renameTo(expectedFile)) {
mFile.setStoragePath(null); // forget the local file
- // by now, treat this as a success; the file was uploaded; the user won't like that the local file is not linked, but this should be a veeery rare fail;
- // the best option could be show a warning message (but not a fail)
- //result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_MOVED);
- //return result;
+ // by now, treat this as a success; the file was
+ // uploaded; the user won't like that the local file
+ // is not linked, but this should be a very rare
+ // fail;
+ // the best option could be show a warning message
+ // (but not a fail)
+ // result = new
+ // RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_MOVED);
+ // return result;
}
}
- }
+ }
}
-
+
result = new RemoteOperationResult(isSuccess(status), status);
-
-
+
} catch (Exception e) {
// TODO something cleaner with cancellations
if (mCancellationRequested.get()) {
@@ -293,34 +316,36 @@ public class UploadFileOperation extends RemoteOperation {
} else {
result = new RemoteOperationResult(e);
}
-
-
+
} finally {
if (temporalFile != null && !originalFile.equals(temporalFile)) {
temporalFile.delete();
}
if (result.isSuccess()) {
Log.i(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage());
-
+
} else {
if (result.getException() != null) {
String complement = "";
if (!nameCheckPassed) {
complement = " (while checking file existence in server)";
} else if (!localCopyPassed) {
- complement = " (while copying local file to " + FileStorageUtils.getSavePath(mAccount.name) + ")";
+ complement = " (while copying local file to " + FileStorageUtils.getSavePath(mAccount.name)
+ + ")";
}
- Log.e(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage() + complement, result.getException());
+ Log.e(TAG,
+ "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage()
+ + complement, result.getException());
} else {
- Log.e(TAG, "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage());
+ Log.e(TAG,
+ "Upload of " + mOriginalStoragePath + " to " + mRemotePath + ": " + result.getLogMessage());
}
}
}
-
+
return result;
}
-
private void createNewOCFile(String newRemotePath) {
// a new OCFile instance must be created for a new remote path
OCFile newFile = new OCFile(newRemotePath);
@@ -339,12 +364,10 @@ public class UploadFileOperation extends RemoteOperation {
mFile = newFile;
}
-
public boolean isSuccess(int status) {
return ((status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED || status == HttpStatus.SC_NO_CONTENT));
}
-
-
+
protected int uploadFile(WebdavClient client) throws HttpException, IOException, OperationCancelledException {
int status = -1;
try {
@@ -356,16 +379,17 @@ public class UploadFileOperation extends RemoteOperation {
mPutMethod.setRequestEntity(mEntity);
status = client.executeMethod(mPutMethod);
client.exhaustResponse(mPutMethod.getResponseBodyAsStream());
-
+
} finally {
- mPutMethod.releaseConnection(); // let the connection available for other methods
+ mPutMethod.releaseConnection(); // let the connection available for
+ // other methods
}
return status;
}
-
+
/**
- * Checks if remotePath does not exist in the server and returns it, or adds a suffix to it in order to avoid the server
- * file is overwritten.
+ * Checks if remotePath does not exist in the server and returns it, or adds
+ * a suffix to it in order to avoid the server file is overwritten.
*
* @param string
* @return
@@ -375,12 +399,12 @@ public class UploadFileOperation extends RemoteOperation {
if (!check) {
return remotePath;
}
-
+
int pos = remotePath.lastIndexOf(".");
String suffix = "";
String extension = "";
if (pos >= 0) {
- extension = remotePath.substring(pos+1);
+ extension = remotePath.substring(pos + 1);
remotePath = remotePath.substring(0, pos);
}
int count = 2;
@@ -393,21 +417,19 @@ public class UploadFileOperation extends RemoteOperation {
count++;
} while (check);
- if (pos >=0) {
+ if (pos >= 0) {
return remotePath + suffix + "." + extension;
} else {
return remotePath + suffix;
}
}
-
public void cancel() {
- synchronized(mCancellationRequested) {
+ synchronized (mCancellationRequested) {
mCancellationRequested.set(true);
if (mPutMethod != null)
mPutMethod.abort();
}
}
-
}
diff --git a/src/com/owncloud/android/providers/FileContentProvider.java b/src/com/owncloud/android/providers/FileContentProvider.java
index e87d151c..5e54341b 100644
--- a/src/com/owncloud/android/providers/FileContentProvider.java
+++ b/src/com/owncloud/android/providers/FileContentProvider.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java b/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java
index 92c0b720..d362c55d 100644
--- a/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java
+++ b/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java b/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java
index 8a8264f1..1f307c94 100644
--- a/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java
+++ b/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/syncadapter/ContactSyncService.java b/src/com/owncloud/android/syncadapter/ContactSyncService.java
index cf9fbeaf..7c702d93 100644
--- a/src/com/owncloud/android/syncadapter/ContactSyncService.java
+++ b/src/com/owncloud/android/syncadapter/ContactSyncService.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
index f66980cb..6da3e81d 100644
--- a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
+++ b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/syncadapter/FileSyncService.java b/src/com/owncloud/android/syncadapter/FileSyncService.java
index cb2f7200..3d819616 100644
--- a/src/com/owncloud/android/syncadapter/FileSyncService.java
+++ b/src/com/owncloud/android/syncadapter/FileSyncService.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/ActionItem.java b/src/com/owncloud/android/ui/ActionItem.java
index b2be7029..e97dfef0 100644
--- a/src/com/owncloud/android/ui/ActionItem.java
+++ b/src/com/owncloud/android/ui/ActionItem.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/CustomPopup.java b/src/com/owncloud/android/ui/CustomPopup.java
index b7ce4265..a9315dd7 100644
--- a/src/com/owncloud/android/ui/CustomPopup.java
+++ b/src/com/owncloud/android/ui/CustomPopup.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/ExtendedListView.java b/src/com/owncloud/android/ui/ExtendedListView.java
index ba1e3604..5b7fb98a 100644
--- a/src/com/owncloud/android/ui/ExtendedListView.java
+++ b/src/com/owncloud/android/ui/ExtendedListView.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/FragmentListView.java b/src/com/owncloud/android/ui/FragmentListView.java
index 3dbe16da..d791eed3 100644
--- a/src/com/owncloud/android/ui/FragmentListView.java
+++ b/src/com/owncloud/android/ui/FragmentListView.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/QuickAction.java b/src/com/owncloud/android/ui/QuickAction.java
index 122792d5..a6d021d7 100644
--- a/src/com/owncloud/android/ui/QuickAction.java
+++ b/src/com/owncloud/android/ui/QuickAction.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java
index 21736e1d..31b59d49 100644
--- a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java
+++ b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java b/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java
index bd36ed1c..d2770406 100644
--- a/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java
+++ b/src/com/owncloud/android/ui/activity/AuthenticatorActivity.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/ConflictsResolveActivity.java b/src/com/owncloud/android/ui/activity/ConflictsResolveActivity.java
index d04d6cee..21aaed8f 100644
--- a/src/com/owncloud/android/ui/activity/ConflictsResolveActivity.java
+++ b/src/com/owncloud/android/ui/activity/ConflictsResolveActivity.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java b/src/com/owncloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java
index cb7e721f..0522cb85 100644
--- a/src/com/owncloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java
+++ b/src/com/owncloud/android/ui/activity/ErrorsWhileCopyingHandlerActivity.java
@@ -1,3 +1,21 @@
+/* ownCloud Android client application
+ * Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 .
+ *
+ */
+
package com.owncloud.android.ui.activity;
import java.io.File;
diff --git a/src/com/owncloud/android/ui/activity/FailedUploadActivity.java b/src/com/owncloud/android/ui/activity/FailedUploadActivity.java
new file mode 100644
index 00000000..01a97391
--- /dev/null
+++ b/src/com/owncloud/android/ui/activity/FailedUploadActivity.java
@@ -0,0 +1,49 @@
+package com.owncloud.android.ui.activity;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.owncloud.android.R;
+
+/**
+ * This Activity is used to display a detail message for failed uploads
+ *
+ * The entry-point for this activity is the 'Failed upload Notification"
+ *
+ *
+ * @author andomaex / Matthias Baumann
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * 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 de/
+ */
+public class FailedUploadActivity extends Activity {
+
+ public static final String MESSAGE = "message";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.failed_upload_message_view);
+ String message = getIntent().getStringExtra(MESSAGE);
+ TextView textView = (TextView) findViewById(R.id.faild_upload_message);
+ textView.setText(message);
+ Button close_button = (Button) findViewById(R.id.failed_uploadactivity_close_button);
+ close_button.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+ }
+}
diff --git a/src/com/owncloud/android/ui/activity/FileDetailActivity.java b/src/com/owncloud/android/ui/activity/FileDetailActivity.java
index 46632d65..ba948d36 100644
--- a/src/com/owncloud/android/ui/activity/FileDetailActivity.java
+++ b/src/com/owncloud/android/ui/activity/FileDetailActivity.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
index 97660e7d..ca0ff010 100644
--- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
+++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
@@ -1,5 +1,6 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -749,27 +750,33 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
break;
}
case DIALOG_CHOOSE_UPLOAD_SOURCE: {
- final String [] items = { getString(R.string.actionbar_upload_files),
- getString(R.string.actionbar_upload_from_apps) };
+ final String[] items = { getString(R.string.actionbar_upload_files),
+ getString(R.string.actionbar_upload_from_apps),
+ getString(R.string.actionbar_failed_instant_upload) };
builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.actionbar_upload);
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
if (item == 0) {
- //if (!mDualPane) {
- Intent action = new Intent(FileDisplayActivity.this, UploadFilesActivity.class);
- action.putExtra(UploadFilesActivity.EXTRA_ACCOUNT, AccountUtils.getCurrentOwnCloudAccount(FileDisplayActivity.this));
- startActivityForResult(action, ACTION_SELECT_MULTIPLE_FILES);
- //} else {
- // TODO create and handle new fragment LocalFileListFragment
- //}
+ // if (!mDualPane) {
+ Intent action = new Intent(FileDisplayActivity.this, UploadFilesActivity.class);
+ action.putExtra(UploadFilesActivity.EXTRA_ACCOUNT,
+ AccountUtils.getCurrentOwnCloudAccount(FileDisplayActivity.this));
+ startActivityForResult(action, ACTION_SELECT_MULTIPLE_FILES);
+ // } else {
+ // TODO create and handle new fragment
+ // LocalFileListFragment
+ // }
} else if (item == 1) {
Intent action = new Intent(Intent.ACTION_GET_CONTENT);
- action = action.setType("*/*")
- .addCategory(Intent.CATEGORY_OPENABLE);
- startActivityForResult(
- Intent.createChooser(action, getString(R.string.upload_chooser_title)),
+ action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
+ startActivityForResult(Intent.createChooser(action, getString(R.string.upload_chooser_title)),
ACTION_SELECT_CONTENT_FROM_APPS);
+ } else if (item == 2) {
+ Account account = AccountUtils.getCurrentOwnCloudAccount(FileDisplayActivity.this);
+ Intent action = new Intent(FileDisplayActivity.this, InstantUploadActivity.class);
+ action.putExtra(FileUploader.KEY_ACCOUNT, account);
+ startActivity(action);
}
}
});
@@ -1458,3 +1465,4 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
}
+
diff --git a/src/com/owncloud/android/ui/activity/GenericExplanationActivity.java b/src/com/owncloud/android/ui/activity/GenericExplanationActivity.java
index a45383f3..8a46a001 100644
--- a/src/com/owncloud/android/ui/activity/GenericExplanationActivity.java
+++ b/src/com/owncloud/android/ui/activity/GenericExplanationActivity.java
@@ -1,3 +1,21 @@
+/* ownCloud Android client application
+ * Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 .
+ *
+ */
+
package com.owncloud.android.ui.activity;
import java.util.ArrayList;
diff --git a/src/com/owncloud/android/ui/activity/InstantUploadActivity.java b/src/com/owncloud/android/ui/activity/InstantUploadActivity.java
new file mode 100644
index 00000000..7b964a65
--- /dev/null
+++ b/src/com/owncloud/android/ui/activity/InstantUploadActivity.java
@@ -0,0 +1,485 @@
+/* ownCloud Android client application
+ * Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 .
+ *
+ */
+package com.owncloud.android.ui.activity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.accounts.Account;
+import android.app.Activity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Bundle;
+import android.util.Log;
+import android.util.SparseArray;
+import android.view.Gravity;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.View.OnLongClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.owncloud.android.AccountUtils;
+import com.owncloud.android.R;
+import com.owncloud.android.db.DbHandler;
+import com.owncloud.android.files.InstantUploadBroadcastReceiver;
+import com.owncloud.android.files.services.FileUploader;
+import com.owncloud.android.utils.FileStorageUtils;
+
+/**
+ * This Activity is used to display a list with images they could not be
+ * uploaded instantly. The images can be selected for delete or for a try again
+ * upload
+ *
+ * The entry-point for this activity is the 'Failed upload Notification" and a
+ * sub-menu underneath the 'Upload' menu-item
+ *
+ * @author andomaex / Matthias Baumann
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * 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 de/
+ */
+public class InstantUploadActivity extends Activity {
+
+ private static final String LOG_TAG = InstantUploadActivity.class.getSimpleName();
+ private LinearLayout listView;
+ private static final String retry_chexbox_tag = "retry_chexbox_tag";
+ private static int MAX_LOAD_IMAGES = 5;
+ private int lastLoadImageIdx = 0;
+
+ private SparseArray fileList = null;
+ CheckBox failed_upload_all_cb;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.failed_upload_files);
+
+ Button delete_all_btn = (Button) findViewById(R.id.failed_upload_delete_all_btn);
+ delete_all_btn.setOnClickListener(getDeleteListner());
+ Button retry_all_btn = (Button) findViewById(R.id.failed_upload_retry_all_btn);
+ retry_all_btn.setOnClickListener(getRetryListner());
+ this.failed_upload_all_cb = (CheckBox) findViewById(R.id.failed_upload_headline_cb);
+ failed_upload_all_cb.setOnCheckedChangeListener(getCheckAllListener());
+ listView = (LinearLayout) findViewById(R.id.failed_upload_scrollviewlayout);
+
+ loadListView(true);
+
+ }
+
+ /**
+ * init the listview with ImageButtons, checkboxes and filename for every
+ * Image that was not successfully uploaded
+ *
+ * this method is call at Activity creation and on delete one ore more
+ * list-entry an on retry the upload by clicking the ImageButton or by click
+ * to the 'retry all' button
+ *
+ */
+ private void loadListView(boolean reset) {
+ DbHandler db = new DbHandler(getApplicationContext());
+ Cursor c = db.getFailedFiles();
+
+ if (reset) {
+ fileList = new SparseArray();
+ listView.removeAllViews();
+ lastLoadImageIdx = 0;
+ }
+ if (c != null) {
+ try {
+ c.moveToPosition(lastLoadImageIdx);
+
+ while (c.moveToNext()) {
+
+ lastLoadImageIdx++;
+ String imp_path = c.getString(1);
+ String message = c.getString(4);
+ fileList.put(lastLoadImageIdx, imp_path);
+ LinearLayout rowLayout = getHorizontalLinearLayout(lastLoadImageIdx);
+ rowLayout.addView(getFileCheckbox(lastLoadImageIdx));
+ rowLayout.addView(getImageButton(imp_path, lastLoadImageIdx));
+ rowLayout.addView(getFileButton(imp_path, message, lastLoadImageIdx));
+ listView.addView(rowLayout);
+ Log.d(LOG_TAG, imp_path + " on idx: " + lastLoadImageIdx);
+ if (lastLoadImageIdx % MAX_LOAD_IMAGES == 0) {
+ break;
+ }
+ }
+ if (lastLoadImageIdx > 0) {
+ addLoadMoreButton(listView);
+ }
+ } finally {
+ db.close();
+ }
+ }
+ }
+
+ private void addLoadMoreButton(LinearLayout listView) {
+ if (listView != null) {
+ Button loadmoreBtn = null;
+ View oldButton = listView.findViewById(42);
+ if (oldButton != null) {
+ // remove existing button
+ listView.removeView(oldButton);
+ // to add the button at the end
+ loadmoreBtn = (Button) oldButton;
+ } else {
+ // create a new button to add to the scoll view
+ loadmoreBtn = new Button(this);
+ loadmoreBtn.setId(42);
+ loadmoreBtn.setText(getString(R.string.failed_upload_load_more_images));
+ loadmoreBtn.setBackgroundResource(R.color.owncloud_white);
+ loadmoreBtn.setTextSize(12);
+ loadmoreBtn.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ loadListView(false);
+ }
+
+ });
+ }
+ listView.addView(loadmoreBtn);
+ }
+ }
+
+ /**
+ * provide a list of CheckBox instances, looked up from parent listview this
+ * list ist used to select/deselect all checkboxes at the list
+ *
+ * @return List
+ */
+ private List getCheckboxList() {
+ List list = new ArrayList();
+ for (int i = 0; i < listView.getChildCount(); i++) {
+ Log.d(LOG_TAG, "ListView has Childs: " + listView.getChildCount());
+ View childView = listView.getChildAt(i);
+ if (childView != null && childView instanceof ViewGroup) {
+ View checkboxView = getChildViews((ViewGroup) childView);
+ if (checkboxView != null && checkboxView instanceof CheckBox) {
+ Log.d(LOG_TAG, "found Child: " + checkboxView.getId() + " " + checkboxView.getClass());
+ list.add((CheckBox) checkboxView);
+ }
+ }
+ }
+ return list;
+ }
+
+ /**
+ * recursive called method, used from getCheckboxList method
+ *
+ * @param View
+ * @return View
+ */
+ private View getChildViews(ViewGroup view) {
+ if (view != null) {
+ for (int i = 0; i < view.getChildCount(); i++) {
+ View cb = view.getChildAt(i);
+ if (cb != null && cb instanceof ViewGroup) {
+ return getChildViews((ViewGroup) cb);
+ } else if (cb instanceof CheckBox) {
+ return cb;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * create a new OnCheckedChangeListener for the 'check all' checkbox *
+ *
+ * @return OnCheckedChangeListener to select all checkboxes at the list
+ */
+ private OnCheckedChangeListener getCheckAllListener() {
+ return new OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ List list = getCheckboxList();
+ for (CheckBox checkbox : list) {
+ ((CheckBox) checkbox).setChecked(isChecked);
+ }
+ }
+
+ };
+ }
+
+ /**
+ * Button click Listener for the retry button at the headline
+ *
+ * @return a Listener to perform a retry for all selected images
+ */
+ private OnClickListener getRetryListner() {
+ return new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ try {
+
+ List list = getCheckboxList();
+ for (CheckBox checkbox : list) {
+ boolean to_retry = checkbox.isChecked();
+
+ Log.d(LOG_TAG, "Checkbox for " + checkbox.getId() + " was checked: " + to_retry);
+ String img_path = fileList.get(checkbox.getId());
+ if (to_retry) {
+
+ final String msg = "Image-Path " + checkbox.getId() + " was checked: " + img_path;
+ Log.d(LOG_TAG, msg);
+ startUpload(img_path);
+ }
+
+ }
+ } finally {
+ // refresh the List
+ listView.removeAllViews();
+ loadListView(true);
+ if (failed_upload_all_cb != null) {
+ failed_upload_all_cb.setChecked(false);
+ }
+ }
+
+ }
+ };
+ }
+
+ /**
+ * Button click Listener for the delete button at the headline
+ *
+ * @return a Listener to perform a delete for all selected images
+ */
+ private OnClickListener getDeleteListner() {
+
+ return new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ final DbHandler dbh = new DbHandler(getApplicationContext());
+ try {
+ List list = getCheckboxList();
+ for (CheckBox checkbox : list) {
+ boolean to_be_delete = checkbox.isChecked();
+
+ Log.d(LOG_TAG, "Checkbox for " + checkbox.getId() + " was checked: " + to_be_delete);
+ String img_path = fileList.get(checkbox.getId());
+ Log.d(LOG_TAG, "Image-Path " + checkbox.getId() + " was checked: " + img_path);
+ if (to_be_delete) {
+ boolean deleted = dbh.removeIUPendingFile(img_path);
+ Log.d(LOG_TAG, "removing " + checkbox.getId() + " was : " + deleted);
+
+ }
+
+ }
+ } finally {
+ dbh.close();
+ // refresh the List
+ listView.removeAllViews();
+ loadListView(true);
+ if (failed_upload_all_cb != null) {
+ failed_upload_all_cb.setChecked(false);
+ }
+ }
+
+ }
+ };
+ }
+
+ private LinearLayout getHorizontalLinearLayout(int id) {
+ LinearLayout linearLayout = new LinearLayout(getApplicationContext());
+ linearLayout.setId(id);
+ linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.MATCH_PARENT));
+ linearLayout.setGravity(Gravity.RIGHT);
+ linearLayout.setOrientation(LinearLayout.HORIZONTAL);
+ return linearLayout;
+ }
+
+ private LinearLayout getVerticalLinearLayout() {
+ LinearLayout linearLayout = new LinearLayout(getApplicationContext());
+ linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.MATCH_PARENT));
+ linearLayout.setGravity(Gravity.TOP);
+ linearLayout.setOrientation(LinearLayout.VERTICAL);
+ return linearLayout;
+ }
+
+ private View getFileButton(final String img_path, String message, int id) {
+
+ TextView failureTextView = new TextView(this);
+ failureTextView.setText(getString(R.string.failed_upload_failure_text) + message);
+ failureTextView.setBackgroundResource(R.color.owncloud_white);
+ failureTextView.setTextSize(8);
+ failureTextView.setOnLongClickListener(getOnLongClickListener(message));
+ failureTextView.setPadding(5, 5, 5, 10);
+ TextView retryButton = new TextView(this);
+ retryButton.setId(id);
+ retryButton.setText(img_path);
+ retryButton.setBackgroundResource(R.color.owncloud_white);
+ retryButton.setTextSize(8);
+ retryButton.setOnClickListener(getImageButtonOnClickListener(img_path));
+ retryButton.setOnLongClickListener(getOnLongClickListener(message));
+ retryButton.setPadding(5, 5, 5, 10);
+ LinearLayout verticalLayout = getVerticalLinearLayout();
+ verticalLayout.addView(retryButton);
+ verticalLayout.addView(failureTextView);
+
+ return verticalLayout;
+ }
+
+ private OnLongClickListener getOnLongClickListener(final String message) {
+ return new OnLongClickListener() {
+
+ @Override
+ public boolean onLongClick(View v) {
+ Log.d(LOG_TAG, message);
+ Toast toast = Toast.makeText(InstantUploadActivity.this, getString(R.string.failed_upload_retry_text)
+ + message, Toast.LENGTH_LONG);
+ toast.show();
+ return true;
+ }
+
+ };
+ }
+
+ private CheckBox getFileCheckbox(int id) {
+ CheckBox retryCB = new CheckBox(this);
+ retryCB.setId(id);
+ retryCB.setBackgroundResource(R.color.owncloud_white);
+ retryCB.setTextSize(8);
+ retryCB.setTag(retry_chexbox_tag);
+ return retryCB;
+ }
+
+ private ImageButton getImageButton(String img_path, int id) {
+ ImageButton imageButton = new ImageButton(this);
+ imageButton.setId(id);
+ imageButton.setClickable(true);
+ imageButton.setOnClickListener(getImageButtonOnClickListener(img_path));
+
+ // scale and add a thumbnail to the imagebutton
+ int base_scale_size = 32;
+ if (img_path != null) {
+ Log.d(LOG_TAG, "add " + img_path + " to Image Button");
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inJustDecodeBounds = true;
+ Bitmap bitmap = BitmapFactory.decodeFile(img_path, options);
+ int width_tpm = options.outWidth, height_tmp = options.outHeight;
+ int scale = 3;
+ while (true) {
+ if (width_tpm / 2 < base_scale_size || height_tmp / 2 < base_scale_size) {
+ break;
+ }
+ width_tpm /= 2;
+ height_tmp /= 2;
+ scale++;
+ }
+
+ Log.d(LOG_TAG, "scale Imgae with: " + scale);
+ BitmapFactory.Options options2 = new BitmapFactory.Options();
+ options2.inSampleSize = scale;
+ bitmap = BitmapFactory.decodeFile(img_path, options2);
+
+ if (bitmap != null) {
+ Log.d(LOG_TAG, "loaded Bitmap Bytes: " + bitmap.getRowBytes());
+ imageButton.setImageBitmap(bitmap);
+ } else {
+ Log.d(LOG_TAG, "could not load imgage: " + img_path);
+ }
+ }
+ return imageButton;
+ }
+
+ private OnClickListener getImageButtonOnClickListener(final String img_path) {
+ return new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ startUpload(img_path);
+ loadListView(true);
+ }
+
+ };
+ }
+
+ /**
+ * start uploading a file to the INSTANT_UPLOD_DIR
+ *
+ * @param img_path
+ */
+ private void startUpload(String img_path) {
+ // extract filename
+ String filename = FileStorageUtils.getInstantUploadFilePath(img_path);
+ if (canInstantUpload()) {
+ Account account = AccountUtils.getCurrentOwnCloudAccount(InstantUploadActivity.this);
+ // add file again to upload queue
+ DbHandler db = new DbHandler(InstantUploadActivity.this);
+ try {
+ db.updateFileState(img_path, DbHandler.UPLOAD_STATUS_UPLOAD_LATER, null);
+ } finally {
+ db.close();
+ }
+
+ Intent i = new Intent(InstantUploadActivity.this, FileUploader.class);
+ i.putExtra(FileUploader.KEY_ACCOUNT, account);
+ i.putExtra(FileUploader.KEY_LOCAL_FILE, img_path);
+ i.putExtra(FileUploader.KEY_REMOTE_FILE, filename);
+ i.putExtra(FileUploader.KEY_UPLOAD_TYPE, FileUploader.UPLOAD_SINGLE_FILE);
+ i.putExtra(com.owncloud.android.files.services.FileUploader.KEY_INSTANT_UPLOAD, true);
+
+ final String msg = "try to upload file with name :" + filename;
+ Log.d(LOG_TAG, msg);
+ Toast toast = Toast.makeText(InstantUploadActivity.this, getString(R.string.failed_upload_retry_text)
+ + filename, Toast.LENGTH_LONG);
+ toast.show();
+
+ startService(i);
+ } else {
+ Toast toast = Toast.makeText(InstantUploadActivity.this,
+ getString(R.string.failed_upload_retry_do_nothing_text) + filename, Toast.LENGTH_LONG);
+ toast.show();
+ }
+ }
+
+ private boolean canInstantUpload() {
+
+ if (!InstantUploadBroadcastReceiver.isOnline(this)
+ || (InstantUploadBroadcastReceiver.instantUploadViaWiFiOnly(this) && !InstantUploadBroadcastReceiver
+ .isConnectedViaWiFi(this))) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/com/owncloud/android/ui/activity/LandingActivity.java b/src/com/owncloud/android/ui/activity/LandingActivity.java
index 3af64853..32fae223 100644
--- a/src/com/owncloud/android/ui/activity/LandingActivity.java
+++ b/src/com/owncloud/android/ui/activity/LandingActivity.java
@@ -3,7 +3,7 @@
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/PinCodeActivity.java b/src/com/owncloud/android/ui/activity/PinCodeActivity.java
index ea22268b..4ad0e57a 100644
--- a/src/com/owncloud/android/ui/activity/PinCodeActivity.java
+++ b/src/com/owncloud/android/ui/activity/PinCodeActivity.java
@@ -3,7 +3,7 @@
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java
index 9dfce138..460c5e0c 100644
--- a/src/com/owncloud/android/ui/activity/Preferences.java
+++ b/src/com/owncloud/android/ui/activity/Preferences.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/PreferencesNewSession.java b/src/com/owncloud/android/ui/activity/PreferencesNewSession.java
index cafb86c6..211cce5f 100644
--- a/src/com/owncloud/android/ui/activity/PreferencesNewSession.java
+++ b/src/com/owncloud/android/ui/activity/PreferencesNewSession.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/TransferServiceGetter.java b/src/com/owncloud/android/ui/activity/TransferServiceGetter.java
index 332976a3..0160f7e5 100644
--- a/src/com/owncloud/android/ui/activity/TransferServiceGetter.java
+++ b/src/com/owncloud/android/ui/activity/TransferServiceGetter.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/activity/UploadFilesActivity.java b/src/com/owncloud/android/ui/activity/UploadFilesActivity.java
index ed6e7fa7..d16b2637 100644
--- a/src/com/owncloud/android/ui/activity/UploadFilesActivity.java
+++ b/src/com/owncloud/android/ui/activity/UploadFilesActivity.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/adapter/FileListActionListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListActionListAdapter.java
index f4393b58..ac7aa90f 100644
--- a/src/com/owncloud/android/ui/adapter/FileListActionListAdapter.java
+++ b/src/com/owncloud/android/ui/adapter/FileListActionListAdapter.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java
index b924cc8c..8d879935 100644
--- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java
+++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/adapter/LandingScreenAdapter.java b/src/com/owncloud/android/ui/adapter/LandingScreenAdapter.java
index 8bc56754..1f588c48 100644
--- a/src/com/owncloud/android/ui/adapter/LandingScreenAdapter.java
+++ b/src/com/owncloud/android/ui/adapter/LandingScreenAdapter.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java b/src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java
index 82031542..d55eb3f6 100644
--- a/src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java
+++ b/src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/dialog/ChangelogDialog.java b/src/com/owncloud/android/ui/dialog/ChangelogDialog.java
index 6330da74..ab0e0a7b 100644
--- a/src/com/owncloud/android/ui/dialog/ChangelogDialog.java
+++ b/src/com/owncloud/android/ui/dialog/ChangelogDialog.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2013 ownCloud Inc.
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -15,6 +15,7 @@
* along with this program. If not, see .
*
*/
+
package com.owncloud.android.ui.dialog;
import java.io.InputStream;
diff --git a/src/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java b/src/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java
index 1c89790c..6a3fa219 100644
--- a/src/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java
+++ b/src/com/owncloud/android/ui/dialog/ConflictsResolveDialog.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/dialog/EditNameDialog.java b/src/com/owncloud/android/ui/dialog/EditNameDialog.java
index 41d65d4d..069eedb7 100644
--- a/src/com/owncloud/android/ui/dialog/EditNameDialog.java
+++ b/src/com/owncloud/android/ui/dialog/EditNameDialog.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -16,7 +17,6 @@
*
*/
-
package com.owncloud.android.ui.dialog;
import android.app.AlertDialog;
diff --git a/src/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.java b/src/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.java
index ab7d0558..314b6060 100644
--- a/src/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.java
+++ b/src/com/owncloud/android/ui/dialog/IndeterminateProgressDialog.java
@@ -1,3 +1,21 @@
+/* ownCloud Android client application
+ * Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 .
+ *
+ */
+
package com.owncloud.android.ui.dialog;
import android.app.Dialog;
diff --git a/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java b/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java
index f67968ad..2143e9a9 100644
--- a/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java
+++ b/src/com/owncloud/android/ui/dialog/SslValidatorDialog.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -15,6 +15,7 @@
* along with this program. If not, see .
*
*/
+
package com.owncloud.android.ui.dialog;
import java.io.IOException;
diff --git a/src/com/owncloud/android/ui/fragment/AuthenticatorAccountDetailsFragment.java b/src/com/owncloud/android/ui/fragment/AuthenticatorAccountDetailsFragment.java
index 2a3b331c..265bb1dd 100644
--- a/src/com/owncloud/android/ui/fragment/AuthenticatorAccountDetailsFragment.java
+++ b/src/com/owncloud/android/ui/fragment/AuthenticatorAccountDetailsFragment.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/fragment/AuthenticatorGetStartedFragment.java b/src/com/owncloud/android/ui/fragment/AuthenticatorGetStartedFragment.java
index 860eb5b0..5ddee243 100644
--- a/src/com/owncloud/android/ui/fragment/AuthenticatorGetStartedFragment.java
+++ b/src/com/owncloud/android/ui/fragment/AuthenticatorGetStartedFragment.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/fragment/ConfirmationDialogFragment.java b/src/com/owncloud/android/ui/fragment/ConfirmationDialogFragment.java
index 42d1e622..7a59bd65 100644
--- a/src/com/owncloud/android/ui/fragment/ConfirmationDialogFragment.java
+++ b/src/com/owncloud/android/ui/fragment/ConfirmationDialogFragment.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
index e8b897c6..80dc4264 100644
--- a/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
+++ b/src/com/owncloud/android/ui/fragment/FileDetailFragment.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/fragment/LandingPageFragment.java b/src/com/owncloud/android/ui/fragment/LandingPageFragment.java
index a021afbf..ab584638 100644
--- a/src/com/owncloud/android/ui/fragment/LandingPageFragment.java
+++ b/src/com/owncloud/android/ui/fragment/LandingPageFragment.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java b/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java
index 18266ab6..51f78b70 100644
--- a/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java
+++ b/src/com/owncloud/android/ui/fragment/LocalFileListFragment.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java
index 9a479da2..90a06c0d 100644
--- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java
+++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/utils/FileStorageUtils.java b/src/com/owncloud/android/utils/FileStorageUtils.java
index 63aee6b5..72815a9a 100644
--- a/src/com/owncloud/android/utils/FileStorageUtils.java
+++ b/src/com/owncloud/android/utils/FileStorageUtils.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -20,41 +20,71 @@ package com.owncloud.android.utils;
import java.io.File;
+import android.annotation.SuppressLint;
import android.net.Uri;
import android.os.Environment;
import android.os.StatFs;
+import android.util.Log;
import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.files.services.InstantUploadService;
-
+/**
+ * Static methods to help in access to local file system.
+ *
+ * @author David A. Velasco
+ */
public class FileStorageUtils {
-
+ private static final String LOG_TAG = "FileStorageUtils";
+
public static final String getSavePath(String accountName) {
File sdCard = Environment.getExternalStorageDirectory();
- return sdCard.getAbsolutePath() + "/owncloud/" + Uri.encode(accountName, "@");
- // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B
+ return sdCard.getAbsolutePath() + "/owncloud/" + Uri.encode(accountName, "@");
+ // URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B
}
-
+
public static final String getDefaultSavePathFor(String accountName, OCFile file) {
return getSavePath(accountName) + file.getRemotePath();
}
-
+
public static final String getTemporalPath(String accountName) {
File sdCard = Environment.getExternalStorageDirectory();
return sdCard.getAbsolutePath() + "/owncloud/tmp/" + Uri.encode(accountName, "@");
// URL encoding is an 'easy fix' to overcome that NTFS and FAT32 don't allow ":" in file names, that can be in the accountName since 0.1.190B
}
+ @SuppressLint("NewApi")
public static final long getUsableSpace(String accountName) {
File savePath = Environment.getExternalStorageDirectory();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD) {
return savePath.getUsableSpace();
-
+
} else {
StatFs stats = new StatFs(savePath.getAbsolutePath());
return stats.getAvailableBlocks() * stats.getBlockSize();
}
-
+
+ }
+
+ // to ensure we will not add the slash twice between filename and
+ // folder-name
+ private static String getFileName(String filepath) {
+ if (filepath != null && !"".equals(filepath)) {
+ int psi = filepath.lastIndexOf('/');
+ String filename = filepath;
+ if (psi > -1) {
+ filename = filepath.substring(psi + 1, filepath.length());
+ Log.d(LOG_TAG, "extracted filename :" + filename);
+ }
+ return filename;
+ } else {
+ // Toast
+ Log.w(LOG_TAG, "the given filename was null or empty");
+ return null;
+ }
+ }
+
+ public static String getInstantUploadFilePath(String fileName) {
+ return InstantUploadService.INSTANT_UPLOAD_DIR + "/" + getFileName(fileName);
}
-
}
\ No newline at end of file
diff --git a/src/com/owncloud/android/utils/OwnCloudVersion.java b/src/com/owncloud/android/utils/OwnCloudVersion.java
index 43ea9838..8bba93f0 100644
--- a/src/com/owncloud/android/utils/OwnCloudVersion.java
+++ b/src/com/owncloud/android/utils/OwnCloudVersion.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@@ -33,7 +34,7 @@ public class OwnCloudVersion implements Comparable {
// format is in version
// 0xAABBCC
// for version AA.BB.CC
- // ie version 3.0.3 will be stored as 0x030003
+ // ie version 2.0.3 will be stored as 0x030003
private int mVersion;
private boolean mIsValid;
diff --git a/src/com/owncloud/android/utils/RecursiveFileObserver.java b/src/com/owncloud/android/utils/RecursiveFileObserver.java
index aac34eb3..3ce88534 100644
--- a/src/com/owncloud/android/utils/RecursiveFileObserver.java
+++ b/src/com/owncloud/android/utils/RecursiveFileObserver.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/com/owncloud/android/widgets/ActionEditText.java b/src/com/owncloud/android/widgets/ActionEditText.java
index a4f5527f..d77a825a 100644
--- a/src/com/owncloud/android/widgets/ActionEditText.java
+++ b/src/com/owncloud/android/widgets/ActionEditText.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/eu/alefzero/webdav/ChunkFromFileChannelRequestEntity.java b/src/eu/alefzero/webdav/ChunkFromFileChannelRequestEntity.java
index 7f15d8b8..8d3912d9 100644
--- a/src/eu/alefzero/webdav/ChunkFromFileChannelRequestEntity.java
+++ b/src/eu/alefzero/webdav/ChunkFromFileChannelRequestEntity.java
@@ -1,9 +1,9 @@
/* ownCloud Android client application
- * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/eu/alefzero/webdav/FileRequestEntity.java b/src/eu/alefzero/webdav/FileRequestEntity.java
index aa32a324..d60eabf1 100644
--- a/src/eu/alefzero/webdav/FileRequestEntity.java
+++ b/src/eu/alefzero/webdav/FileRequestEntity.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/eu/alefzero/webdav/OnDatatransferProgressListener.java b/src/eu/alefzero/webdav/OnDatatransferProgressListener.java
index 5469f88c..a8c84b12 100644
--- a/src/eu/alefzero/webdav/OnDatatransferProgressListener.java
+++ b/src/eu/alefzero/webdav/OnDatatransferProgressListener.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/eu/alefzero/webdav/WebdavClient.java b/src/eu/alefzero/webdav/WebdavClient.java
index f34cb692..df30dcb6 100644
--- a/src/eu/alefzero/webdav/WebdavClient.java
+++ b/src/eu/alefzero/webdav/WebdavClient.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2011 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/eu/alefzero/webdav/WebdavEntry.java b/src/eu/alefzero/webdav/WebdavEntry.java
index 30b5660f..f76ee697 100644
--- a/src/eu/alefzero/webdav/WebdavEntry.java
+++ b/src/eu/alefzero/webdav/WebdavEntry.java
@@ -3,7 +3,7 @@
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/src/eu/alefzero/webdav/WebdavUtils.java b/src/eu/alefzero/webdav/WebdavUtils.java
index a42b9024..7e2d6840 100644
--- a/src/eu/alefzero/webdav/WebdavUtils.java
+++ b/src/eu/alefzero/webdav/WebdavUtils.java
@@ -1,9 +1,10 @@
/* ownCloud Android client application
* Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
diff --git a/tests/src/com/owncloud/android/test/AccountUtilsTest.java b/tests/src/com/owncloud/android/test/AccountUtilsTest.java
index 3c04ad22..528392a4 100644
--- a/tests/src/com/owncloud/android/test/AccountUtilsTest.java
+++ b/tests/src/com/owncloud/android/test/AccountUtilsTest.java
@@ -1,3 +1,22 @@
+/* ownCloud Android client application
+ * Copyright (C) 2012 Bartek Przybylski
+ * Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 .
+ *
+ */
+
package com.owncloud.android.test;
import android.test.AndroidTestCase;