Эх сурвалжийг харах

Merge branch 'develop' into fixForCrashedSharedContents

Conflicts:
	src/com/owncloud/android/Uploader.java
David A. Velasco 12 жил өмнө
parent
commit
65f403bf99
100 өөрчлөгдсөн 2461 нэмэгдсэн , 1164 устгасан
  1. 167 159
      AndroidManifest.xml
  2. 3 4
      LICENSE.txt
  3. 2 3
      THIRD_PARTY.txt
  4. 2 3
      oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java
  5. 2 3
      res/anim/disappear.xml
  6. 2 3
      res/anim/grow_from_bottom.xml
  7. 2 3
      res/anim/grow_from_bottomleft_to_topright.xml
  8. 2 3
      res/anim/grow_from_bottomright_to_topleft.xml
  9. 2 3
      res/anim/grow_from_top.xml
  10. 2 3
      res/anim/grow_from_topleft_to_bottomright.xml
  11. 2 3
      res/anim/grow_from_topright_to_bottomleft.xml
  12. 2 3
      res/anim/pump_bottom.xml
  13. 2 3
      res/anim/pump_top.xml
  14. 2 3
      res/anim/shrink_from_bottom.xml
  15. 2 3
      res/anim/shrink_from_bottomleft_to_topright.xml
  16. 2 3
      res/anim/shrink_from_bottomright_to_topleft.xml
  17. 2 3
      res/anim/shrink_from_top.xml
  18. 2 3
      res/anim/shrink_from_topleft_to_bottomright.xml
  19. 2 3
      res/anim/shrink_from_topright_to_bottomleft.xml
  20. 2 3
      res/drawable/action_item_btn.xml
  21. 2 3
      res/drawable/btn.xml
  22. 2 3
      res/drawable/btn_round.xml
  23. 2 3
      res/drawable/btn_round_pressed.xml
  24. 2 3
      res/drawable/connection_secure.xml
  25. 2 3
      res/drawable/list_selector.xml
  26. 2 3
      res/drawable/main_header_bg.xml
  27. 2 3
      res/drawable/progress_small.xml
  28. 2 3
      res/drawable/split_action_bg.xml
  29. 2 3
      res/drawable/uploader_list_separator.xml
  30. 226 181
      res/layout-land/account_setup.xml
  31. 2 3
      res/layout-large-land/files.xml
  32. 2 3
      res/layout-v14/generic_explanation.xml
  33. 241 179
      res/layout/account_setup.xml
  34. 2 3
      res/layout/action_item.xml
  35. 2 3
      res/layout/authenticator_getting_started_fragment.xml
  36. 3 4
      res/layout/edit_box_dialog.xml
  37. 2 3
      res/layout/extensions_available_dialog.xml
  38. 3 3
      res/layout/failed_upload_files.xml
  39. 2 3
      res/layout/file_activity_details.xml
  40. 2 3
      res/layout/file_details_empty.xml
  41. 2 3
      res/layout/file_details_fragment.xml
  42. 2 3
      res/layout/file_display_action_list_element.xml
  43. 2 3
      res/layout/file_download_fragment.xml
  44. 2 3
      res/layout/file_preview.xml
  45. 2 3
      res/layout/files.xml
  46. 2 3
      res/layout/fragment_changelog.xml
  47. 2 3
      res/layout/generic_explanation.xml
  48. 2 3
      res/layout/landing_page_fragment.xml
  49. 2 3
      res/layout/landing_page_item.xml
  50. 2 3
      res/layout/list_fragment.xml
  51. 2 3
      res/layout/list_item.xml
  52. 19 0
      res/layout/log_item.xml
  53. 34 0
      res/layout/log_send_file.xml
  54. 2 3
      res/layout/main.xml
  55. 2 3
      res/layout/media_control.xml
  56. 2 3
      res/layout/no_account_available.xml
  57. 2 3
      res/layout/pick_account_layout.xml
  58. 2 3
      res/layout/pincodelock.xml
  59. 2 3
      res/layout/popup.xml
  60. 2 3
      res/layout/preview_image_activity.xml
  61. 2 3
      res/layout/preview_image_fragment.xml
  62. 2 3
      res/layout/progressbar_layout.xml
  63. 2 3
      res/layout/selected_account_element.xml
  64. 3 4
      res/layout/ssl_validator_layout.xml
  65. 2 3
      res/layout/upload_files_layout.xml
  66. 2 3
      res/layout/uploader_layout.xml
  67. 2 3
      res/layout/uploader_list_item_layout.xml
  68. 2 3
      res/menu/account_picker.xml
  69. 2 3
      res/menu/account_picker_long_click.xml
  70. 2 3
      res/menu/file_actions_menu.xml
  71. 2 4
      res/menu/main_menu.xml
  72. 2 3
      res/menu/session_context_menu.xml
  73. 2 3
      res/raw-de/changelog.html
  74. 2 3
      res/raw-es/changelog.html
  75. 2 3
      res/raw/changelog.html
  76. 2 3
      res/values/bools.xml
  77. 2 3
      res/values/colors.xml
  78. 23 0
      res/values/oauth2_configuration.xml
  79. 28 7
      res/values/strings.xml
  80. 6 3
      res/values/styles.xml
  81. 2 3
      res/values/urls.xml
  82. 2 3
      res/xml/authenticator.xml
  83. 15 5
      res/xml/preferences.xml
  84. 2 3
      res/xml/preferences_new_session.xml
  85. 2 3
      res/xml/syncadapter_files.xml
  86. 10 6
      src/com/owncloud/android/AccountUtils.java
  87. 2 5
      src/com/owncloud/android/DisplayUtils.java
  88. 127 0
      src/com/owncloud/android/Log_OC.java
  89. 2 3
      src/com/owncloud/android/OwnCloudSession.java
  90. 20 20
      src/com/owncloud/android/Uploader.java
  91. 222 189
      src/com/owncloud/android/authentication/AccountAuthenticator.java
  92. 3 4
      src/com/owncloud/android/authentication/AccountAuthenticatorService.java
  93. 1085 0
      src/com/owncloud/android/authentication/AuthenticatorActivity.java
  94. 53 0
      src/com/owncloud/android/authentication/OAuth2Constants.java
  95. 0 89
      src/com/owncloud/android/authenticator/AuthenticationRunnable.java
  96. 0 26
      src/com/owncloud/android/authenticator/OnAuthenticationResultListener.java
  97. 0 30
      src/com/owncloud/android/authenticator/OnConnectCheckListener.java
  98. 2 3
      src/com/owncloud/android/datamodel/DataStorageManager.java
  99. 14 15
      src/com/owncloud/android/datamodel/FileDataStorageManager.java
  100. 6 8
      src/com/owncloud/android/datamodel/OCFile.java

+ 167 - 159
AndroidManifest.xml

@@ -1,166 +1,173 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 
-  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 <http://www.gnu.org/licenses/>.
- -->
-<manifest package="com.owncloud.android"
-    android:versionCode="104000"
-    android:versionName="1.4.0" xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
-    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
-    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
-    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-    <uses-permission android:name="android.permission.READ_SYNC_STATS" />
-    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
-    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
-    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
-    <uses-permission android:name="android.permission.WAKE_LOCK"/>
-    
-    <uses-sdk
-        android:minSdkVersion="8"
-        android:targetSdkVersion="13" />
-
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
-    </uses-permission>
-
-    <application
-        android:icon="@drawable/icon"
-        android:label="@string/app_name"
-        android:theme="@style/Theme.ownCloud"> 
-        <activity
-            android:name=".ui.activity.FileDisplayActivity"
-            android:label="@string/app_name">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-        <activity android:name=".ui.activity.UploadFilesActivity">
-        </activity>
- 		<activity android:name=".ui.activity.InstantUploadActivity">
-        </activity>
-        <activity android:name=".ui.activity.FailedUploadActivity" android:theme="@android:style/Theme.Dialog" android:excludeFromRecents="true"/>
-        <activity android:name=".Uploader" >
-            <intent-filter>
-                <action android:name="android.intent.action.SEND" >
-                </action>
-
-                <category android:name="android.intent.category.DEFAULT" >
-                </category>
-
-                <data android:mimeType="*/*" >
-                </data>
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.intent.action.SEND_MULTIPLE" >
-                </action>
-
-                <category android:name="android.intent.category.DEFAULT" >
-                </category>
-
-                <data android:mimeType="*/*" >
-                </data>
-            </intent-filter>
-        </activity>
-        <activity
-            android:name=".ui.activity.Preferences"
-            android:theme="@style/Theme.ownCloud" >
-        </activity>
-        <activity android:name=".ui.activity.PreferencesNewSessionewSession" >
-        </activity>
-        
-		<activity	android:name="com.owncloud.android.ui.preview.PreviewImageActivity" />
-		        
-        <activity	android:name="com.owncloud.android.ui.preview.PreviewVideoActivity"
-					android:label="@string/app_name"
-					android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
-		</activity>        
-
-        <service
-            android:name=".authenticator.AccountAuthenticatorService"
-            android:exported="true">
-            <intent-filter  android:priority="100">
-                <action android:name="android.accounts.AccountAuthenticator" />
-            </intent-filter>
-
-            <meta-data
-                android:name="android.accounts.AccountAuthenticator"
-                android:resource="@xml/authenticator" />
-        </service>
-        <service
-            android:name=".syncadapter.FileSyncService"
-            android:exported="true" >
-            <intent-filter>
-                <action android:name="android.content.SyncAdapter" />
-            </intent-filter>
-
-            <meta-data
-                android:name="android.content.SyncAdapter"
-                android:resource="@xml/syncadapter_files" />
-        </service>
-
-        <provider
-            android:name=".providers.FileContentProvider"
-            android:authorities="org.owncloud"
-            android:enabled="true"
-            android:exported="false"
-            android:label="@string/sync_string_files"
-            android:syncable="true" >
-        </provider>
-
-        <activity
-            android:name=".ui.activity.AuthenticatorActivity"
-            android:exported="true"
-            android:theme="@style/Theme.ownCloud.noActionBar" >
-            <intent-filter>
-                <action android:name="com.owncloud.android.workaround.accounts.CREATE" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <service android:name=".files.services.FileDownloader" />
-        <service android:name=".files.services.FileUploader" />
-        <service android:name=".media.MediaService" />
-
-        <activity android:name=".ui.activity.FileDetailActivity" />
-        <activity android:name=".ui.activity.PinCodeActivity" />
-        <activity android:name=".extensions.ExtensionsAvailableActivity"></activity>
-        <activity android:name=".extensions.ExtensionsListActivity"></activity>
-        <activity android:name=".ui.activity.AccountSelectActivity" android:uiOptions="none" android:label="@string/prefs_accounts"></activity>
-        <activity android:name=".ui.activity.ConflictsResolveActivity"/>
-        <activity android:name=".ui.activity.GenericExplanationActivity"/>
-        <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+  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 version 2,
+  as published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ -->
+<manifest package="com.owncloud.android"
+    android:versionCode="104000"
+    android:versionName="1.4.0" xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
+    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+    <uses-permission android:name="android.permission.READ_SYNC_STATS" />
+    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
+    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
+    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
+    <uses-permission android:name="android.permission.WAKE_LOCK"/>
+    
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="13" />
+
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
+    </uses-permission>
+
+    <application
+        android:icon="@drawable/icon"
+        android:label="@string/app_name"
+        android:theme="@style/Theme.ownCloud"> 
+        <activity
+            android:name=".ui.activity.FileDisplayActivity"
+            android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".ui.activity.UploadFilesActivity">
+        </activity>
+ 		<activity android:name=".ui.activity.InstantUploadActivity">
+        </activity>
+        <activity android:name=".ui.activity.FailedUploadActivity" android:theme="@android:style/Theme.Dialog" android:excludeFromRecents="true"/>
+        <activity android:name=".Uploader" >
+            <intent-filter>
+                <action android:name="android.intent.action.SEND" >
+                </action>
+
+                <category android:name="android.intent.category.DEFAULT" >
+                </category>
+
+                <data android:mimeType="*/*" >
+                </data>
+            </intent-filter>
+            <intent-filter>
+                <action android:name="android.intent.action.SEND_MULTIPLE" >
+                </action>
+
+                <category android:name="android.intent.category.DEFAULT" >
+                </category>
+
+                <data android:mimeType="*/*" >
+                </data>
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".ui.activity.Preferences"
+            android:theme="@style/Theme.ownCloud" >
+        </activity>
+        <activity android:name=".ui.activity.PreferencesNewSessionewSession" >
+        </activity>
+        
+        <activity	android:name="com.owncloud.android.ui.preview.PreviewImageActivity" />
+		        
+        <activity	android:name="com.owncloud.android.ui.preview.PreviewVideoActivity"
+					android:label="@string/app_name"
+					android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
+		</activity>        
+
+        <service
+            android:name=".authentication.AccountAuthenticatorService"
+            android:exported="true">
+            <intent-filter  android:priority="100">
+                <action android:name="android.accounts.AccountAuthenticator" />
+            </intent-filter>
+
+            <meta-data
+                android:name="android.accounts.AccountAuthenticator"
+                android:resource="@xml/authenticator" />
+        </service>
+        <service
+            android:name=".syncadapter.FileSyncService"
+            android:exported="true" >
+            <intent-filter>
+                <action android:name="android.content.SyncAdapter" />
+            </intent-filter>
+
+            <meta-data
+                android:name="android.content.SyncAdapter"
+                android:resource="@xml/syncadapter_files" />
+        </service>
+
+        <provider
+            android:name=".providers.FileContentProvider"
+            android:authorities="org.owncloud"
+            android:enabled="true"
+            android:exported="false"
+            android:label="@string/sync_string_files"
+            android:syncable="true" >
+        </provider>
+
+        <activity
+            android:name=".authentication.AuthenticatorActivity"
+            android:exported="true"
+            android:theme="@style/Theme.ownCloud.noActionBar" 
+            android:launchMode="singleTask">
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.BROWSABLE" />
+                <data android:scheme="@string/oauth2_redirect_scheme" />
+            </intent-filter>
+            <intent-filter>
+                <action android:name="com.owncloud.android.workaround.accounts.CREATE" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+        <service android:name=".files.services.FileDownloader" />
+        <service android:name=".files.services.FileUploader" />
+        <service android:name=".media.MediaService" />
+        
+        <activity android:name=".ui.activity.FileDetailActivity" />
+        <activity android:name=".ui.activity.PinCodeActivity" />
+        <activity android:name=".extensions.ExtensionsAvailableActivity"></activity>
+        <activity android:name=".extensions.ExtensionsListActivity"></activity>
+        <activity android:name=".ui.activity.AccountSelectActivity" android:uiOptions="none" android:label="@string/prefs_accounts"></activity>
+        <activity android:name=".ui.activity.ConflictsResolveActivity"/>
+        <activity android:name=".ui.activity.GenericExplanationActivity"/>
+        <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
+        
+        <activity android:name=".ui.activity.LogHistoryActivity"/>
         
-        <service android:name=".files.services.InstantUploadService" />
         <receiver android:name=".files.InstantUploadBroadcastReceiver">
             <intent-filter>
                 <action android:name="com.android.camera.NEW_PICTURE" />
                 <data android:mimeType="image/*" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
+            </intent-filter>
+            <intent-filter>
+                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
             </intent-filter>
         </receiver>
         <receiver android:name=".files.BootupBroadcastReceiver">
@@ -169,6 +176,7 @@
             </intent-filter>
         </receiver>
         <service android:name=".files.services.FileObserverService"/>
+        
     </application>
 
-</manifest>
+</manifest>

+ 3 - 4
LICENSE.txt

@@ -294,10 +294,9 @@ the "copyright" line and a pointer to where the full notice is found.
     Copyright (C) <year>  <name of author>
 
     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.
-
+    it under the terms of the GNU General Public License version 2,
+    as published by the Free Software Foundation.
+  
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+ 2 - 3
THIRD_PARTY.txt

@@ -11,9 +11,8 @@
 ###########
 
 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.
+it under the terms of the GNU General Public License verions 2,
+as published by the Free Software Foundation.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java

@@ -2,9 +2,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/disappear.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/grow_from_bottom.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/grow_from_bottomleft_to_topright.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/grow_from_bottomright_to_topleft.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/grow_from_top.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/grow_from_topleft_to_bottomright.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/grow_from_topright_to_bottomleft.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/pump_bottom.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/pump_top.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/shrink_from_bottom.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/shrink_from_bottomleft_to_topright.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/shrink_from_bottomright_to_topleft.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/shrink_from_top.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/shrink_from_topleft_to_bottomright.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/anim/shrink_from_topright_to_bottomleft.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/action_item_btn.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/btn.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/btn_round.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/btn_round_pressed.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/connection_secure.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/list_selector.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/main_header_bg.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/progress_small.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/split_action_bg.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/drawable/uploader_list_separator.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 226 - 181
res/layout-land/account_setup.xml

@@ -1,14 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?>
+<!--
   ownCloud Android client application
 
-  Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,177 +16,223 @@
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:oc="http://schemas.android.com/apk/res/com.owncloud.android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:focusable="true"
-    android:gravity="center|fill"
-    android:orientation="vertical" >
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:layout_marginLeft="16dip"
-        android:layout_marginRight="16dip"
-        android:layout_weight="1" >
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="match_parent" >
-
-            <ImageView
-                android:id="@+id/imageView1"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:layout_margin="7dp"
-                android:layout_weight="1"
-                android:src="@drawable/owncloud_logo" />
-
-            <LinearLayout
-                android:id="@+id/LinearLayout1"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center"
-                android:layout_weight="1"
-                android:orientation="vertical" >
-
-                <FrameLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1" >
-
-                    <EditText
-                        android:id="@+id/host_URL"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_weight="1"
-                        android:ems="10"
-                        android:hint="@string/auth_host_url"
-                        android:inputType="textNoSuggestions">
-                        <requestFocus />
-                    </EditText>
-
-                    <ImageView
-                        android:id="@+id/refreshButton"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_gravity="right|center_vertical"
-                        android:src="@drawable/ic_action_refresh_black"
-                        android:visibility="invisible" />
-                </FrameLayout>
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="50dp"
-                    android:layout_weight="1" >
-
-                    <ImageView
-                        android:id="@+id/action_indicator"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_marginLeft="5dp"
-                        android:layout_marginRight="5dp"
-                        android:src="@android:drawable/stat_notify_sync"
-                        android:visibility="invisible" />
-
-                    <TextView
-                        android:id="@+id/status_text"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="TextView"
-                        android:visibility="invisible" />
-                </LinearLayout>
-
-                <TextView
-                    android:id="@+id/textView2"
-                    android:layout_width="wrap_content"
-                    android:layout_height="0dp"
-                    android:layout_weight="1"
-                    android:text="@string/auth_login_details"
-                    android:textAppearance="?android:attr/textAppearanceSmall" />
-
-                <EditText
-                    android:id="@+id/account_username"
-                    android:layout_width="match_parent"
-                    android:layout_height="0dp"
-                    android:layout_weight="1"
-                    android:ems="10"
-                    android:hint="@string/auth_username"
-                    android:inputType="textNoSuggestions" />
-
-                <FrameLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1" >
-
-                    <EditText
-                        android:id="@+id/account_password"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_weight="1"
-                        android:ems="10"
-                        android:hint="@string/auth_password"
-                        android:inputType="textPassword"/>
-
-                    <ImageView
-                        android:id="@+id/viewPassword"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_gravity="right|center_vertical"
-                        android:src="@android:drawable/ic_menu_view"
-                        android:visibility="invisible" />
-                </FrameLayout>
-            </LinearLayout>
-        </LinearLayout>
-    </FrameLayout>
-
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true" >
-
-        <LinearLayout
-            android:id="@+id/buttons_layout"        
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:weightSum="1">
-
-            <Button
-                android:id="@+id/buttonCancel"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight=".5"
-                android:onClick="onCancelClick"
-                android:text="@string/common_cancel" />
-
-            <Button
-                android:id="@+id/buttonOK"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight=".5"
-                android:enabled="false"
-                android:onClick="onOkClick"
-                android:text="@string/setup_btn_connect"
-                android:textColor="@android:color/black" />
-            
-        </LinearLayout>
-        
-		<Button
-			android:id="@+id/account_register"
-			android:layout_width="wrap_content"
-			android:layout_height="wrap_content"
-			android:layout_below="@id/buttons_layout"
-			android:layout_centerHorizontal="true"
-			android:onClick="onRegisterClick"
-			android:paddingTop="10dp"
-			android:paddingBottom="10dp"
-			android:textColor="#0000FF"
-			android:background="@android:color/transparent" />
-			<!-- android:text="@string/app_name @string/auth_register" /-->
-        
-    </RelativeLayout>
-
-</LinearLayout>
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:oc="http://schemas.android.com/apk/res/com.owncloud.android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:focusable="true"
+    android:gravity="center|fill"
+    android:orientation="vertical" >
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_marginLeft="16dip"
+        android:layout_marginRight="16dip"
+        android:layout_weight="1" >
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" >
+
+            <ImageView
+                android:id="@+id/imageView1"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_margin="7dp"
+                android:layout_weight="1"
+                android:src="@drawable/owncloud_logo" />
+
+            <LinearLayout
+                android:id="@+id/LinearLayout1"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:layout_weight="1"
+                android:orientation="vertical" >
+
+                <FrameLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1" >
+
+                    <EditText
+                        android:id="@+id/hostUrlInput"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:ems="10"
+                        android:hint="@string/auth_host_url"
+                        android:inputType="textNoSuggestions">
+                        <requestFocus />
+                    </EditText>
+
+                    <ImageView
+                        android:id="@+id/refreshButton"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="right|center_vertical"
+                        android:src="@drawable/ic_action_refresh_black"
+                    	android:onClick="onRefreshClick"
+                        android:visibility="invisible" />
+                </FrameLayout>
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="50dp"
+                    android:layout_weight="1" >
+
+                    <ImageView
+                        android:id="@+id/action_indicator"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="5dp"
+                        android:layout_marginRight="5dp"
+                        android:src="@android:drawable/stat_notify_sync"
+                        android:visibility="invisible" />
+
+                    <TextView
+                        android:id="@+id/status_text"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:text="TextView"
+                        android:visibility="invisible" />
+                </LinearLayout>
+
+                <CheckBox
+                    android:id="@+id/oauth_onOff_check"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:checked="false"
+                    android:onClick="onCheckClick"
+                    android:text="@string/oauth_check_onoff"
+                    android:textAppearance="?android:attr/textAppearanceSmall" />
+
+                <TextView
+                    android:id="@+id/textView2"
+                    android:layout_width="wrap_content"
+                    android:layout_height="0dp"
+                    android:layout_weight="1"
+                    android:text="@string/auth_login_details"
+                    android:textAppearance="?android:attr/textAppearanceSmall" />
+
+	            <EditText
+	                android:id="@+id/oAuthEntryPoint_1"
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+	                android:layout_weight="1"
+	                android:ems="10"
+                	android:enabled="false"
+	                android:text="@string/oauth2_url_endpoint_auth"
+	                android:singleLine="true"
+	                android:visibility="gone" >
+	
+	                <requestFocus />
+	            </EditText>            
+	
+	            <EditText
+	                android:id="@+id/oAuthEntryPoint_2"
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+	                android:layout_weight="1"
+	                android:ems="10"
+                	android:enabled="false"
+	                android:text="@string/oauth2_url_endpoint_access"
+	                android:singleLine="true"
+	                android:visibility="gone" >
+	
+	                <requestFocus />
+	            </EditText>            
+	
+                <EditText
+                    android:id="@+id/account_username"
+                    android:layout_width="match_parent"
+                    android:layout_height="0dp"
+                    android:layout_weight="1"
+                    android:ems="10"
+                    android:hint="@string/auth_username"
+                    android:inputType="textNoSuggestions" />
+
+                <FrameLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_weight="1" >
+
+                    <EditText
+                        android:id="@+id/account_password"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:ems="10"
+                        android:hint="@string/auth_password"
+                        android:inputType="textPassword"/>
+
+                    <ImageView
+                        android:id="@+id/viewPasswordButton"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="right|center_vertical"
+                        android:src="@android:drawable/ic_menu_view"
+						android:onClick="onViewPasswordClick"
+                        android:visibility="invisible" />
+                </FrameLayout>
+                
+	            <TextView
+	                android:id="@+id/auth_status_text"
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+	                android:layout_weight="1" 
+	                android:text="@string/text_placeholder"
+	                android:layout_marginLeft="5dp"
+	                android:layout_marginRight="5dp"
+					android:drawableLeft="@android:drawable/stat_notify_sync"
+	    			android:drawablePadding="5dip"
+	    			android:visibility="invisible"                
+	                />
+                
+            </LinearLayout>
+            
+        </LinearLayout>
+    </FrameLayout>
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true" >
+
+        <LinearLayout
+            android:id="@+id/buttons_layout"        
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:weightSum="1">
+
+            <Button
+                android:id="@+id/buttonOK"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_weight=".5"
+                android:layout_marginLeft="16dip"
+		        android:layout_marginRight="16dip"
+                android:enabled="false"
+                android:onClick="onOkClick"
+                android:text="@string/setup_btn_connect"
+                android:textColor="@android:color/black" />
+            
+        </LinearLayout>
+        
+		<Button
+			android:id="@+id/account_register"
+			android:layout_width="wrap_content"
+			android:layout_height="wrap_content"
+			android:layout_below="@id/buttons_layout"
+			android:layout_centerHorizontal="true"
+			android:onClick="onRegisterClick"
+			android:paddingTop="10dp"
+			android:paddingBottom="10dp"
+			android:textColor="#0000FF"
+			android:background="@android:color/transparent" />
+			<!-- android:text="@string/app_name @string/auth_register" /-->
+        
+    </RelativeLayout>
+
+</LinearLayout>

+ 2 - 3
res/layout-large-land/files.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout-v14/generic_explanation.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 241 - 179
res/layout/account_setup.xml

@@ -1,14 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?>
+<!--
   ownCloud Android client application
 
-  Copyright (C) 2012  Bartek Przybylski
-  Copyright (C) 2012-2013 ownCloud Inc.
+  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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,175 +16,238 @@
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:focusable="true"
-    android:gravity="center|fill"
-    android:orientation="vertical" >
-
-    <FrameLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:layout_marginLeft="16dip"
-        android:layout_marginRight="16dip"
-        android:layout_weight="1" >
-
-        <LinearLayout
-            android:id="@+id/LinearLayout1"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:layout_weight="1"
-            android:orientation="vertical" >
-
-            <ImageView
-                android:id="@+id/imageView1"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="10dp"
-                android:layout_weight="1"
-                android:src="@drawable/owncloud_logo" />
-
-            <FrameLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="1" >
-
-                <EditText
-                    android:id="@+id/host_URL"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:ems="10"
-                    android:hint="@string/auth_host_url"
-                    android:inputType="textNoSuggestions" >
-                    <requestFocus />
-                </EditText>
-
-                <ImageView
-                    android:id="@+id/refreshButton"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:src="@drawable/ic_action_refresh_black"
-                    android:layout_gravity="right|center_vertical"
-                    android:visibility="invisible" />
-
-            </FrameLayout>
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="50dp"
-                android:layout_weight="1" >
-
-                <ImageView
-                    android:id="@+id/action_indicator"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_marginLeft="5dp"
-                    android:layout_marginRight="5dp"
-                    android:src="@android:drawable/stat_notify_sync"
-                    android:visibility="invisible" />
-
-                <TextView
-                    android:id="@+id/status_text"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="TextView"
-                    android:visibility="invisible" />
-
-            </LinearLayout>
-
-            <TextView
-                android:id="@+id/textView2"
-                android:layout_width="wrap_content"
-                android:layout_height="0dp"
-                android:layout_weight="1"
-                android:text="@string/auth_login_details"
-                android:textAppearance="?android:attr/textAppearanceSmall" />
-
-            <EditText
-                android:id="@+id/account_username"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_weight="1"
-                android:ems="10"
-                android:hint="@string/auth_username"
-                android:inputType="textNoSuggestions" />
-
-            <FrameLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="1" >
-
-                <EditText
-                    android:id="@+id/account_password"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:ems="10"
-                    android:hint="@string/auth_password"
-                    android:inputType="textPassword"/>
-
-                <ImageView
-                    android:id="@+id/viewPassword"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="right|center_vertical"
-                    android:src="@android:drawable/ic_menu_view"
-                    android:visibility="invisible" />
-
-            </FrameLayout>
-
-            </LinearLayout>
-
-    </FrameLayout>
-
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-
-        <LinearLayout
-            android:id="@+id/buttons_layout"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:weightSum="1" >
-
-            <Button
-                android:id="@+id/buttonCancel"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight=".5"
-                android:onClick="onCancelClick"
-                android:text="@string/common_cancel" />
-
-            <Button
-                android:id="@+id/buttonOK"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight=".5"
-                android:enabled="false"
-                android:onClick="onOkClick"
-                android:text="@string/setup_btn_connect"
-                android:textColor="@android:color/black" />
-
-        </LinearLayout>
-        
-		<Button
-			android:id="@+id/account_register"
-			android:layout_width="wrap_content"
-			android:layout_height="wrap_content"
-			android:layout_below="@id/buttons_layout"
-			android:layout_centerHorizontal="true"
-			android:onClick="onRegisterClick"
-			android:paddingTop="10dp"
-			android:paddingBottom="10dp"
-			android:textColor="#0000FF"
-			android:background="@android:color/transparent" />
-			<!-- android:text="@string/app_name @string/auth_register" /-->
-        
-    </RelativeLayout>
-
-</LinearLayout>
+-->
+
+
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical" >
+
+	<LinearLayout
+	    android:layout_width="match_parent"
+	    android:layout_height="wrap_content"
+	    android:layout_gravity="center"
+	    android:focusable="true"
+	    android:gravity="center"
+	    android:orientation="vertical" >
+
+    	<FrameLayout
+			android:layout_width="match_parent"
+			android:layout_height="0dip"
+			android:layout_gravity="center"
+			android:layout_marginBottom="50dip"
+			android:layout_marginLeft="16dip"
+			android:layout_marginRight="16dip"
+			android:layout_weight="1" >
+		
+			<LinearLayout
+				android:id="@+id/LinearLayout1"
+				android:layout_width="match_parent"
+				android:layout_height="wrap_content"
+				android:layout_gravity="center"
+				android:orientation="vertical" >
+		
+				<ImageView
+					android:id="@+id/imageView1"
+					android:layout_width="match_parent"
+					android:layout_height="wrap_content"
+					android:layout_marginBottom="10dp"
+					android:layout_weight="1"
+					android:src="@drawable/owncloud_logo" />
+		
+	            <FrameLayout
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+	                android:layout_weight="1" >
+	
+	                <EditText
+	                    android:id="@+id/hostUrlInput"
+	                    android:layout_width="match_parent"
+	                    android:layout_height="wrap_content"
+	                    android:ems="10"
+	                    android:hint="@string/auth_host_url"
+	                    android:inputType="textNoSuggestions" >
+	                    <requestFocus />
+	                </EditText>
+	
+	                <ImageView
+	                    android:id="@+id/refreshButton"
+	                    android:layout_width="wrap_content"
+	                    android:layout_height="wrap_content"
+	                    android:src="@drawable/ic_action_refresh_black"
+	                    android:layout_gravity="right|center_vertical"
+	                    android:visibility="invisible" />
+	
+	            </FrameLayout>
+	
+	            <LinearLayout
+	                android:layout_width="match_parent"
+	                android:layout_height="50dp"
+	                android:layout_weight="1" >
+	
+	                <ImageView
+	                    android:id="@+id/action_indicator"
+	                    android:layout_width="wrap_content"
+	                    android:layout_height="wrap_content"
+	                    android:layout_marginLeft="5dp"
+	                    android:layout_marginRight="5dp"
+	                    android:src="@android:drawable/stat_notify_sync"
+	                    android:visibility="invisible" />
+	
+	                <TextView
+	                    android:id="@+id/status_text"
+	                    android:layout_width="wrap_content"
+	                    android:layout_height="wrap_content"
+	                    android:text="TextView"
+	                    android:visibility="invisible" />
+	
+	            </LinearLayout>
+	
+	            <CheckBox
+	                android:id="@+id/oauth_onOff_check"
+	                android:layout_width="wrap_content"
+	                android:layout_height="wrap_content"
+	                android:checked="false"
+	                android:onClick="onCheckClick"
+	                android:text="@string/oauth_check_onoff"
+	                android:textAppearance="?android:attr/textAppearanceSmall" />
+	
+				<TextView
+	                android:id="@+id/textView2"
+	                android:layout_width="wrap_content"
+	                android:layout_height="0dp"
+	                android:layout_weight="1"
+	                android:text="@string/auth_login_details"
+	                android:textAppearance="?android:attr/textAppearanceSmall" />
+	
+	            <EditText
+	                android:id="@+id/oAuthEntryPoint_1"
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+	                android:layout_weight="1"
+	                android:ems="10"
+	                android:text="@string/oauth2_url_endpoint_auth"
+	                android:singleLine="true"
+	                android:visibility="gone" >
+	
+	                <requestFocus />
+	            </EditText>            
+	
+	            <EditText
+	                android:id="@+id/oAuthEntryPoint_2"
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+	                android:layout_weight="1"
+	                android:ems="10"
+		            android:text="@string/oauth2_url_endpoint_access"
+	                android:singleLine="true"
+	                android:visibility="gone" >
+	
+	                <requestFocus />
+	            </EditText>            
+	
+				<EditText
+	                android:id="@+id/account_username"
+	                android:layout_width="match_parent"
+	                android:layout_height="0dp"
+	                android:layout_weight="1"
+	                android:ems="10"
+	                android:hint="@string/auth_username"
+	                android:inputType="textNoSuggestions" />
+	
+	            <FrameLayout
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+	                android:layout_weight="1" >
+	
+	                <EditText
+	                    android:id="@+id/account_password"
+	                    android:layout_width="match_parent"
+	                    android:layout_height="wrap_content"
+	                    android:ems="10"
+	                    android:hint="@string/auth_password"
+	                    android:inputType="textPassword"/>
+	
+	                <ImageView
+	                    android:id="@+id/viewPasswordButton"
+	                    android:layout_width="wrap_content"
+	                    android:layout_height="wrap_content"
+	                    android:layout_gravity="right|center_vertical"
+	                    android:src="@android:drawable/ic_menu_view"
+						android:onClick="onViewPasswordClick"
+	                    android:visibility="invisible" />
+	
+	            </FrameLayout>
+		
+	            <TextView
+	                android:id="@+id/auth_status_text"
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+	                android:layout_weight="1" 
+	                android:text="@string/text_placeholder"
+	                android:layout_marginLeft="5dp"
+	                android:layout_marginRight="5dp"
+					android:drawableLeft="@android:drawable/stat_notify_sync"
+	    			android:drawablePadding="5dip"
+	    			android:visibility="invisible"                
+	                />
+	                    
+	           </LinearLayout>
+	
+	    </FrameLayout>
+	
+	    <RelativeLayout
+	        android:layout_width="match_parent"
+	        android:layout_height="wrap_content">
+	
+	        <LinearLayout
+	            android:id="@+id/buttons_layout"
+	            android:layout_width="match_parent"
+	            android:layout_height="wrap_content"
+	            android:weightSum="1">
+	
+	            <Button
+	                android:id="@+id/buttonOK"
+	                android:layout_width="match_parent"
+	                android:layout_height="wrap_content"
+		            android:layout_gravity="center_horizontal"
+		           	android:layout_marginLeft="16dip"
+		            android:layout_marginRight="16dip"
+	                android:enabled="false"
+	                android:onClick="onOkClick"
+	                android:text="@string/setup_btn_connect"
+	                android:textColor="@android:color/black" />
+	
+	        </LinearLayout>
+	        
+			<Button
+				android:id="@+id/account_register"
+				android:layout_width="wrap_content"
+				android:layout_height="wrap_content"
+				android:layout_below="@id/buttons_layout"
+				android:layout_centerHorizontal="true"
+				android:onClick="onRegisterClick"
+				android:paddingTop="10dp"
+				android:paddingBottom="10dp"
+				android:textColor="#0000FF"
+				android:background="@android:color/transparent" />
+			
+			<Button
+				android:id="@+id/account_register"
+				android:layout_width="wrap_content"
+				android:layout_height="wrap_content"
+				android:layout_below="@id/buttons_layout"
+				android:layout_centerHorizontal="true"
+				android:onClick="onRegisterClick"
+				android:paddingTop="10dp"
+				android:paddingBottom="10dp"
+				android:textColor="#0000FF"
+				android:background="@android:color/transparent" />
+				<!-- android:text="@string/app_name @string/auth_register" /-->
+	        
+	    </RelativeLayout>
+
+	</LinearLayout>
+			
+</ScrollView>

+ 2 - 3
res/layout/action_item.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/authenticator_getting_started_fragment.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 3 - 4
res/layout/edit_box_dialog.xml

@@ -6,10 +6,9 @@
     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.
-
+    it under the terms of the GNU General Public License version 2,
+    as published by the Free Software Foundation.
+  
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

+ 2 - 3
res/layout/extensions_available_dialog.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 3 - 3
res/layout/failed_upload_files.xml

@@ -4,10 +4,10 @@
 
   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
-  (at your option) any later version.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/file_activity_details.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/file_details_empty.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/file_details_fragment.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/file_display_action_list_element.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/file_download_fragment.xml

@@ -4,9 +4,8 @@
 
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/file_preview.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/files.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/fragment_changelog.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/generic_explanation.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/landing_page_fragment.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/landing_page_item.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/list_fragment.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/list_item.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 19 - 0
res/layout/log_item.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal" >
+    
+     <TextView android:id="@+id/log_item_single"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:gravity="center_vertical"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentBottom="true"
+        android:textStyle="bold"
+        android:textSize="22dp"
+        android:textColor="#000000"
+        android:layout_marginTop="5dp"
+        android:layout_marginBottom="5dp" />
+
+</LinearLayout>

+ 34 - 0
res/layout/log_send_file.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+ <LinearLayout 
+      	 xmlns:android="http://schemas.android.com/apk/res/android"
+         android:orientation="vertical"
+         android:layout_width="match_parent"
+         android:layout_height="match_parent"
+         android:paddingLeft="8dp"
+         android:paddingRight="8dp">
+      
+
+     <ListView 	android:id="@android:id/list"
+               	android:layout_width="match_parent"
+               	android:layout_height="wrap_content"
+               />
+
+     <TextView 	android:id="@android:id/empty"
+               	android:layout_width="match_parent"
+               	android:layout_height="wrap_content"
+               	android:background="#FF0000"
+               	android:text="No data"/>
+     <LinearLayout 
+         android:orientation="vertical"
+         android:layout_width="match_parent"
+         android:layout_height="wrap_content"
+         android:gravity="bottom">
+        
+     <Button   	android:id="@+id/deleteLogHistoryButton"
+         		android:layout_width="match_parent"
+     		   	android:layout_height="wrap_content"
+     		   	android:text="@string/prefs_log_delete_history_button"/>
+     
+     </LinearLayout>
+     
+ </LinearLayout>

+ 2 - 3
res/layout/main.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/media_control.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/no_account_available.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/pick_account_layout.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/pincodelock.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/popup.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/preview_image_activity.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/preview_image_fragment.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/progressbar_layout.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/selected_account_element.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 3 - 4
res/layout/ssl_validator_layout.xml

@@ -5,10 +5,9 @@
     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.
-
+    it under the terms of the GNU General Public License version 2,
+    as published by the Free Software Foundation.
+  
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

+ 2 - 3
res/layout/upload_files_layout.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/uploader_layout.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/layout/uploader_list_item_layout.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/menu/account_picker.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/menu/account_picker_long_click.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/menu/file_actions_menu.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 4
res/menu/main_menu.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -24,7 +23,6 @@
     <item android:id="@+id/action_create_dir" 		android:title="@string/actionbar_mkdir" 	android:icon="@drawable/ic_action_create_dir"			android:orderInCategory="2" />
     <item android:id="@+id/action_upload" 			android:title="@string/actionbar_upload" 	android:icon="@drawable/ic_action_upload" 				android:orderInCategory="2" />
     <item android:id="@+id/action_settings" 		android:title="@string/actionbar_settings" 	android:icon="@android:drawable/ic_menu_preferences" 	android:orderInCategory="2" />
-    <item android:id="@+id/action_about_app" 		android:title="@string/about_title" 		android:icon="@android:drawable/ic_menu_info_details" 	android:orderInCategory="2" />
     
     <!--  <item android:id="@+id/search" android:title="@string/actionbar_search" android:icon="@drawable/ic_action_search"></item>-->
 </menu>

+ 2 - 3
res/menu/session_context_menu.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/raw-de/changelog.html

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/raw-es/changelog.html

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/raw/changelog.html

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/values/bools.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/values/colors.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 23 - 0
res/values/oauth2_configuration.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <!-- Flag to configure OAuth availability in the app.
+    	 3 valid values now: on, off, optional	
+     -->
+    <string name="oauth2_mode">off</string>
+    
+    <!-- constants that must be respected by the authorization server; if changed, the app must be rebuild -->
+    <string name="oauth2_redirect_scheme">owncloud</string>
+    <string name="oauth2_redirect_uri">owncloud://callback</string>
+    
+    <!-- values that should be provided by ownCloud server -->
+    <string name="oauth2_url_endpoint_auth">http://oauth2.authorization.server.org/paht/to/endpoint/for/authorization</string>
+    <string name="oauth2_url_endpoint_access">http://oauth2.authorization.server.org/paht/to/endporint/for/access/token</string>
+    <string name="oauth2_scope">owncloud</string>
+    <string name="oauth2_grant_type">authorization_code</string>	<!-- the only one supported right now -->
+    <string name="oauth2_response_type">code</string>				<!-- depends on oauth2_grant_type -->
+    
+    <!-- values that should be pre-agreed between app and authorization server, but can be loaded without rebuilding the app -->
+    <string name="oauth2_client_id">com.owncloud.android</string>	<!-- preferable that client decides this -->
+    <string name="oauth2_client_secret"></string>					<!-- preferable that client decides this -->
+    
+</resources>

+ 28 - 7
res/values/strings.xml

@@ -14,7 +14,8 @@
     <string name="main_settings">Settings</string>
     <string name="main_tit_accsetup">Setup Account</string>
     <string name="main_wrn_accsetup">There is no account set up on your device. In order to use this App, you need to create one.</string>
-    <string name="about_message">%1$s Android App\n\nversion: %2$s</string>
+    <string name="about_android">%1$s Android App</string>
+    <string name="about_version">version %1$s</string>
     <string name="actionbar_sync">Refresh</string>
     <string name="actionbar_upload">Upload</string>
     <string name="actionbar_upload_from_apps">Content from other apps</string>
@@ -40,7 +41,13 @@
     <string name="prefs_pincode_summary">Protect your client</string>
     <string name="prefs_instant_upload">Enable instant uploads</string>
     <string name="prefs_instant_upload_summary">Instantly upload photos taken by camera</string>
-    <string name="auth_host_url">URL</string>
+    <string name="prefs_log_title">Enable Logging</string>
+    <string name="prefs_log_summary">This is used to log problems</string>
+    <string name="prefs_log_title_history">Logging History</string>
+    <string name="prefs_log_summary_history">This shows the recorded logs</string>
+    <string name="prefs_log_delete_history_button">Delete History</string>
+    
+    <string name="auth_host_url">Server address</string>
     <string name="auth_username">Username</string>
     <string name="auth_password">Password</string>
     <string name="auth_register">I am new to %1$s</string>
@@ -111,8 +118,9 @@
     <string name="sync_string_contacts">Contacts</string>
     <string name="sync_fail_ticker">Synchronization failed</string>
     <string name="sync_fail_content">Synchronization of %1$s could not be completed</string>
-    <string name="sync_conflicts_in_favourites_ticker">Conflicts found</string>
-    <string name="sync_conflicts_in_favourites_content">%1$d kept-in-sync files could not be sync\'ed</string>
+    <string name="sync_fail_content_unauthorized">Invalid credentials for %1$s</string>
+	<string name="sync_conflicts_in_favourites_ticker">Conflicts found</string>
+	<string name="sync_conflicts_in_favourites_content">%1$d kept-in-sync files could not be sync\'ed</string>
     <string name="sync_fail_in_favourites_ticker">Kept-in-sync files failed</string>
     <string name="sync_fail_in_favourites_content">Contents of %1$d files could not be sync\'ed (%2$d conflicts)</string>
     <string name="sync_foreign_files_forgotten_ticker">Some local files were forgotten</string>
@@ -169,14 +177,14 @@
         <item>60</item>
     </string-array>
 
-    <string name="auth_trying_to_login">Trying to login</string>
+    <string name="auth_trying_to_login">Trying to login...</string>
     <string name="auth_no_net_conn_title">No network connection</string>
     <string name="auth_no_net_conn_message">No network connection has been detected, check your Internet connection and try again.</string>
     <string name="auth_connect_anyway">Connect anyway</string>
     <string name="auth_nossl_plain_ok_title">Secure connection unavailable.</string>
     <string name="auth_nossl_plain_ok_message">The Application cannot establish a secure connection to the server. A non secure connection is available. You may continue or cancel.</string>
     <string name="auth_connection_established">Connection established</string>
-    <string name="auth_testing_connection">Testing connection</string>
+    <string name="auth_testing_connection">Testing connection...</string>
     <string name="auth_not_configured_title">Malformed server configuration</string>
     <string name="auth_not_configured_message">It seems that your server instance is not correctly configured. Contact your administrator for more details.</string>
     <string name="auth_unknown_error_title">Unknown error occurred!</string>
@@ -193,9 +201,15 @@
     <string name="auth_wrong_connection_title">Couldn\'t establish connection</string>
     <string name="auth_secure_connection">Secure connection established</string>
     <string name="auth_login_details">Login details</string>
-    <string name="auth_unauthorized">Invalid login / password</string>
+    <string name="auth_unauthorized">Invalid credentials</string>
+	<string name="auth_oauth_error">Unsuccessful authorization</string>
+	<string name="auth_oauth_error_access_denied">Access denied by authorization server</string>
     <string name="auth_not_found">Wrong path given</string>
     <string name="auth_internal">Internal server error, code %1$d</string>
+    <string name="auth_wtf_reenter_URL">Unexpected state; please, enter the server URL again</string>
+    <string name="auth_expired_oauth_token_toast">Your authorization expired.\nPlease, authorize again</string>
+    <string name="auth_expired_basic_auth_toast">Your saved credentials are invalid.\nPlease, enter the current credentials</string>
+    
     <string name="crashlog_message">Application terminated unexpectedly. Would you like to submit a crash report?</string>
     <string name="crashlog_send_report">Send report</string>
     <string name="crashlog_dont_send_report">Don\'t send report</string>
@@ -222,6 +236,13 @@
     <string name="wait_a_moment">Wait a moment</string>
     <string name="filedisplay_unexpected_bad_get_content">"Unexpected problem ; please select the file from a different app"</string>
     <string name="filedisplay_no_file_selected">No file was selected</string>
+    
+    <string name="oauth_host_url">oAuth2 URL</string> 
+    <string name="oauth_check_onoff">Login with oAuth2.</string> 
+    <string name="oauth_login_connection">Connecting to oAuth2 server…</string>    
+    <string name="oauth_code_validation_message">Please, open a web browser and go to:\n%1$s.\nValidate this code there:\n%2$s</string>
+    <string name="oauth_connection_url_unavailable">Connection to this URL not available.</string> 
+        
     <string name="ssl_validator_title">Warning</string>
     <string name="ssl_validator_header">The identity of the site could not be verified</string>
     <string name="ssl_validator_reason_cert_not_trusted">- The server certificate is not trusted</string>

+ 6 - 3
res/values/styles.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -102,6 +101,10 @@
 		<item name="android:singleLine">true</item>
   		    
     </style>
+	
+	<style name="OAuthDialog" parent="@android:style/Theme.Dialog">
+		<item name="android:windowNoTitle">false</item>	
+	</style>    
 		
 	<color name="setup_text_hint">#777777</color>
 	<color name="setup_text_typed">#000000</color>

+ 2 - 3
res/values/urls.xml

@@ -5,9 +5,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/xml/authenticator.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 15 - 5
res/xml/preferences.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -32,8 +31,19 @@
     <CheckBoxPreference android:key="instant_uploading" 
                         android:title="@string/prefs_instant_upload"  
                         android:summary="@string/prefs_instant_upload_summary"/>
-    <CheckBoxPreference android:dependency="instant_uploading" android:disableDependentsState="true" android:title="@string/instant_upload_on_wifi" android:key="instant_upload_on_wifi"/>
-    
+    <CheckBoxPreference android:dependency="instant_uploading" 
+        				android:disableDependentsState="true" 
+        				android:title="@string/instant_upload_on_wifi" 
+        				android:key="instant_upload_on_wifi"/>
+    <CheckBoxPreference android:key="log_to_file" 
+                        android:title="@string/prefs_log_title"  
+                        android:summary="@string/prefs_log_summary"/>
+	<Preference 		android:key="log_history" 
+                        android:title="@string/prefs_log_title_history"  
+                        android:summary="@string/prefs_log_summary_history"/>
+	<Preference 		android:id="@+id/about_app" 
+        				android:title="@string/about_title" 
+        				android:key="about_app" />
 	</PreferenceCategory>
     
 

+ 2 - 3
res/xml/preferences_new_session.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 2 - 3
res/xml/syncadapter_files.xml

@@ -6,9 +6,8 @@
   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.
+  it under the terms of the GNU General Public License version 2,
+  as published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 10 - 6
src/com/owncloud/android/AccountUtils.java

@@ -3,9 +3,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,7 +18,7 @@
 
 package com.owncloud.android;
 
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.utils.OwnCloudVersion;
 
 import android.accounts.Account;
@@ -32,6 +31,7 @@ public class AccountUtils {
     public static final String WEBDAV_PATH_1_2 = "/webdav/owncloud.php";
     public static final String WEBDAV_PATH_2_0 = "/files/webdav.php";
     public static final String WEBDAV_PATH_4_0 = "/remote.php/webdav";
+    private static final String ODAV_PATH = "/remote.php/odav";
     public static final String CARDDAV_PATH_2_0 = "/apps/contacts/carddav.php";
     public static final String CARDDAV_PATH_4_0 = "/remote/carddav.php";
     public static final String STATUS_PATH = "/status.php";
@@ -113,8 +113,11 @@ public class AccountUtils {
      * @param version version of owncloud
      * @return webdav path for given OC version, null if OC version unknown
      */
-    public static String getWebdavPath(OwnCloudVersion version) {
+    public static String getWebdavPath(OwnCloudVersion version, boolean supportsOAuth) {
         if (version != null) {
+            if (supportsOAuth) {
+                return ODAV_PATH;
+            }
             if (version.compareTo(OwnCloudVersion.owncloud_v4) >= 0)
                 return WEBDAV_PATH_4_0;
             if (version.compareTo(OwnCloudVersion.owncloud_v3) >= 0
@@ -137,8 +140,9 @@ public class AccountUtils {
             AccountManager ama = AccountManager.get(context);
             String baseurl = ama.getUserData(account, AccountAuthenticator.KEY_OC_BASE_URL);
             String strver  = ama.getUserData(account, AccountAuthenticator.KEY_OC_VERSION);
+            boolean supportsOAuth = (ama.getUserData(account, AccountAuthenticator.KEY_SUPPORTS_OAUTH2) != null);
             OwnCloudVersion ver = new OwnCloudVersion(strver);
-            String webdavpath = getWebdavPath(ver);
+            String webdavpath = getWebdavPath(ver, supportsOAuth);
 
             if (webdavpath == null) return null;
             return baseurl + webdavpath;

+ 2 - 5
src/com/owncloud/android/DisplayUtils.java

@@ -3,9 +3,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,8 +24,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
 
-import android.util.Log;
-
 /**
  * A helper class for some string operations.
  * 

+ 127 - 0
src/com/owncloud/android/Log_OC.java

@@ -0,0 +1,127 @@
+package com.owncloud.android;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import android.util.Log;
+
+
+
+public class Log_OC {
+    
+
+    private static boolean isEnabled = false;
+    private static File logFile;
+    private static File folder;
+    private static BufferedWriter buf;  
+    
+    public static void i(String TAG, String message){
+        // Printing the message to LogCat console
+        Log.i(TAG, message);
+        // Write the log message to the file
+        appendLog(TAG+" : "+message);
+    }
+
+    public static void d(String TAG, String message){
+        Log.d(TAG, message);
+        appendLog(TAG+" : "+message);
+    }
+    public static void d(String TAG, String message, Exception e) {
+        Log.d(TAG, message, e);
+        appendLog(TAG+" : "+ message+" Exception : "+e.getStackTrace());
+    }
+    public static void e(String TAG, String message){
+        Log.e(TAG, message);
+        appendLog(TAG+" : "+message);
+    }
+    
+    public static void e(String TAG, String message, Throwable e) {
+        Log.e(TAG, message, e);
+        appendLog(TAG+" : "+ message+" Exception : "+e.getStackTrace());
+    }
+    
+    public static void v(String TAG, String message){
+        Log.v(TAG, message);
+        appendLog(TAG+" : "+message);
+    }
+    
+    public static void w(String TAG, String message) {
+        Log.w(TAG,message); 
+        appendLog(TAG+" : "+message);
+    }
+    
+    public static void wtf(String TAG, String message) {
+        Log.wtf(TAG,message); 
+        appendLog(TAG+" : "+message);
+    }
+    
+    public static void startLogging(String logPath) {
+        folder = new File(logPath);
+        logFile = new File(folder+File.separator+"log.txt");
+        
+        if (!folder.exists()) {
+            folder.mkdirs();
+        }
+        if (logFile.exists()) {
+            logFile.delete();
+        }
+        try { 
+            logFile.createNewFile();
+            buf = new BufferedWriter(new FileWriter(logFile, true));
+            isEnabled = true;
+            appendPhoneInfo();
+        }catch (IOException e){ 
+            e.printStackTrace(); 
+        } 
+    }
+    
+    public static void stopLogging() {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss",Locale.getDefault());
+        String currentDateandTime = sdf.format(new Date());
+        if (logFile != null) {
+            logFile.renameTo(new File(folder+File.separator+"Owncloud_"+currentDateandTime+".log"));
+          
+            isEnabled = false;
+            try {
+                buf.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            } 
+        
+        }
+        
+    }
+    
+    private static void appendPhoneInfo() {
+        appendLog("Model : " + android.os.Build.MODEL);
+        appendLog("Brand : " + android.os.Build.BRAND);
+        appendLog("Product : " + android.os.Build.PRODUCT);
+        appendLog("Device : " + android.os.Build.DEVICE);
+        appendLog("Version-Codename : " + android.os.Build.VERSION.CODENAME);
+        appendLog("Version-Release : " + android.os.Build.VERSION.RELEASE);
+    }
+    
+    private static void appendLog(String text) { 
+        if (isEnabled) {
+           try { 
+               buf.append(text); 
+               buf.newLine(); 
+           } catch (IOException e) { 
+               e.printStackTrace(); 
+        } 
+    }
+}
+
+    
+   
+
+  
+
+   
+   
+}

+ 2 - 3
src/com/owncloud/android/OwnCloudSession.java

@@ -3,9 +3,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 20 - 20
src/com/owncloud/android/Uploader.java

@@ -3,9 +3,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,6 +15,7 @@
  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
+
 package com.owncloud.android;
 
 import java.io.File;
@@ -45,7 +45,6 @@ import android.os.Parcelable;
 import android.provider.MediaStore.Audio;
 import android.provider.MediaStore.Images;
 import android.provider.MediaStore.Video;
-import android.util.Log;
 import android.view.View;
 import android.view.Window;
 import android.widget.AdapterView;
@@ -55,14 +54,13 @@ import android.widget.EditText;
 import android.widget.SimpleAdapter;
 import android.widget.Toast;
 
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.datamodel.DataStorageManager;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileUploader;
-import com.owncloud.android.network.OwnCloudClientUtils;
 
-import eu.alefzero.webdav.WebdavClient;
+import com.owncloud.android.R;
 
 /**
  * This can be used to upload things to an ownCloud instance.
@@ -86,7 +84,6 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
     private final static int DIALOG_WAITING = 1;
     private final static int DIALOG_NO_STREAM = 2;
     private final static int DIALOG_MULTIPLE_ACCOUNT = 3;
-    //private final static int DIALOG_GET_DIRNAME = 4;
 
     private final static int REQUEST_CODE_SETUP_ACCOUNT = 0;
 
@@ -96,16 +93,14 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
         getWindow().requestFeature(Window.FEATURE_NO_TITLE);
         mParents = new Stack<String>();
         mParents.add("");
-        /*if (getIntent().hasExtra(Intent.EXTRA_STREAM)) {
-            prepareStreamsToUpload();*/
         if (prepareStreamsToUpload()) {
             mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
             Account[] accounts = mAccountManager.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE);
             if (accounts.length == 0) {
-                Log.i(TAG, "No ownCloud account is available");
+                Log_OC.i(TAG, "No ownCloud account is available");
                 showDialog(DIALOG_NO_ACCOUNT);
             } else if (accounts.length > 1) {
-                Log.i(TAG, "More then one ownCloud is available");
+                Log_OC.i(TAG, "More then one ownCloud is available");
                 showDialog(DIALOG_MULTIPLE_ACCOUNT);
             } else {
                 mAccount = accounts[0];
@@ -141,8 +136,8 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
                         // in API7 < this constatant is defined in
                         // Settings.ADD_ACCOUNT_SETTINGS
                         // and Settings.EXTRA_AUTHORITIES
-                        Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");
-                        intent.putExtra("authorities", new String[] { AccountAuthenticator.AUTH_TOKEN_TYPE });
+                        Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT);
+                        intent.putExtra("authorities", new String[] { AccountAuthenticator.AUTHORITY });
                         startActivityForResult(intent, REQUEST_CODE_SETUP_ACCOUNT);
                     } else {
                         // since in API7 there is no direct call for
@@ -234,7 +229,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
     @Override
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
         // click on folder in the list
-        Log.d(TAG, "on item click");
+        Log_OC.d(TAG, "on item click");
         Vector<OCFile> tmpfiles = mStorageManager.getDirectoryContent(mFile);
         if (tmpfiles.size() <= 0) return;
         // filter on dirtype
@@ -257,7 +252,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
             mUploadPath = "";   // first element in mParents is root dir, represented by ""; init mUploadPath with "/" results in a "//" prefix
             for (String p : mParents)
                 mUploadPath += p + OCFile.PATH_SEPARATOR;
-            Log.d(TAG, "Uploading file to dir " + mUploadPath);
+            Log_OC.d(TAG, "Uploading file to dir " + mUploadPath);
 
             uploadFiles();
 
@@ -270,7 +265,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
-        Log.i(TAG, "result received. req: " + requestCode + " res: " + resultCode);
+        Log_OC.i(TAG, "result received. req: " + requestCode + " res: " + resultCode);
         if (requestCode == REQUEST_CODE_SETUP_ACCOUNT) {
             dismissDialog(DIALOG_NO_ACCOUNT);
             if (resultCode == RESULT_CANCELED) {
@@ -296,7 +291,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
         for (String a : mParents)
             full_path += a + "/";
         
-        Log.d(TAG, "Populating view with content of : " + full_path);
+        Log_OC.d(TAG, "Populating view with content of : " + full_path);
         
         mFile = mStorageManager.getFileByPath(full_path);
         if (mFile != null) {
@@ -333,15 +328,19 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
 
     public void uploadFiles() {
         try {
-            WebdavClient webdav = OwnCloudClientUtils.createOwnCloudClient(mAccount, getApplicationContext());
+            //WebdavClient webdav = OwnCloudClientUtils.createOwnCloudClient(mAccount, getApplicationContext());
 
             ArrayList<String> local = new ArrayList<String>();
             ArrayList<String> remote = new ArrayList<String>();
             
+            /* TODO - mCreateDir can never be true at this moment; we will replace wdc.createDirectory by CreateFolderOperation when that is fixed 
+            WebdavClient wdc = OwnCloudClientUtils.createOwnCloudClient(mAccount, getApplicationContext());
             // create last directory in path if necessary
             if (mCreateDir) {
-                webdav.createDirectory(mUploadPath);
+                wdc.createDirectory(mUploadPath);
             }
+            */
+            
             // this checks the mimeType 
             for (Parcelable mStream : mStreamsToUpload) {
                 
@@ -419,6 +418,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
             startService(intent);
             finish();
             }
+            
         } catch (SecurityException e) {
             String message = String.format(getString(R.string.uploader_error_forbidden_content), getString(R.string.app_name));
             Toast.makeText(this, message, Toast.LENGTH_LONG).show();            

+ 222 - 189
src/com/owncloud/android/authenticator/AccountAuthenticator.java → src/com/owncloud/android/authentication/AccountAuthenticator.java

@@ -1,103 +1,122 @@
-/* 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-package com.owncloud.android.authenticator;
-
-import com.owncloud.android.ui.activity.AuthenticatorActivity;
-
-import android.accounts.*;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.util.Log;
-
-public class AccountAuthenticator extends AbstractAccountAuthenticator {
-    /**
-     * Is used by android system to assign accounts to authenticators. Should be
-     * used by application and all extensions.
-     */
-    public static final String ACCOUNT_TYPE = "owncloud";
-    public static final String AUTH_TOKEN_TYPE = "org.owncloud";
-
-    public static final String KEY_AUTH_TOKEN_TYPE = "authTokenType";
-    public static final String KEY_REQUIRED_FEATURES = "requiredFeatures";
-    public static final String KEY_LOGIN_OPTIONS = "loginOptions";
-    public static final String KEY_ACCOUNT = "account";
-    /**
-     * Value under this key should handle path to webdav php script. Will be
-     * removed and usage should be replaced by combining
-     * {@link com.owncloud.android.authenticator.AuthenticatorActivity.KEY_OC_BASE_URL} and
-     * {@link com.owncloud.android.utils.OwnCloudVersion}
-     * 
-     * @deprecated
-     */
-    public static final String KEY_OC_URL = "oc_url";
-    /**
-     * Version should be 3 numbers separated by dot so it can be parsed by
-     * {@link com.owncloud.android.utils.OwnCloudVersion}
-     */
-    public static final String KEY_OC_VERSION = "oc_version";
-    /**
-     * Base url should point to owncloud installation without trailing / ie:
-     * http://server/path or https://owncloud.server
-     */
-    public static final String KEY_OC_BASE_URL = "oc_base_url";
-
-    private static final String TAG = "AccountAuthenticator";
-    private Context mContext;
-
-    public AccountAuthenticator(Context context) {
-        super(context);
-        mContext = context;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Bundle addAccount(AccountAuthenticatorResponse response,
-            String accountType, String authTokenType,
-            String[] requiredFeatures, Bundle options)
-            throws NetworkErrorException {
-        Log.i(TAG, "Adding account with type " + accountType
-                + " and auth token " + authTokenType);
-        try {
-            validateAccountType(accountType);
-        } catch (AuthenticatorException e) {
-            Log.e(TAG, "Failed to validate account type " + accountType + ": "
-                    + e.getMessage());
-            e.printStackTrace();
-            return e.getFailureBundle();
-        }
-        final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
-        intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
-                response);
-        intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
-        intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures);
-        intent.putExtra(KEY_LOGIN_OPTIONS, options);
-
-        setIntentFlags(intent);
-        final Bundle bundle = new Bundle();
-        bundle.putParcelable(AccountManager.KEY_INTENT, intent);
-        return bundle;
-    }
-
+/* 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 version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.authentication;
+
+import android.accounts.*;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import com.owncloud.android.Log_OC;
+
+/**
+ *  Authenticator for ownCloud accounts.
+ * 
+ *  Controller class accessed from the system AccountManager, providing integration of ownCloud accounts with the Android system.
+ * 
+ *  TODO - better separation in operations for OAuth-capable and regular ownCloud accounts.
+ *  TODO - review completeness 
+ * 
+ * @author David A. Velasco
+ */
+public class AccountAuthenticator extends AbstractAccountAuthenticator {
+    
+    /**
+     * Is used by android system to assign accounts to authenticators. Should be
+     * used by application and all extensions.
+     */
+    public static final String ACCOUNT_TYPE = "owncloud";
+    public static final String AUTHORITY = "org.owncloud";
+    public static final String AUTH_TOKEN_TYPE = "org.owncloud";
+    public static final String AUTH_TOKEN_TYPE_PASSWORD = "owncloud.password";
+    public static final String AUTH_TOKEN_TYPE_ACCESS_TOKEN = "owncloud.oauth2.access_token";
+    public static final String AUTH_TOKEN_TYPE_REFRESH_TOKEN = "owncloud.oauth2.refresh_token";
+
+    public static final String KEY_AUTH_TOKEN_TYPE = "authTokenType";
+    public static final String KEY_REQUIRED_FEATURES = "requiredFeatures";
+    public static final String KEY_LOGIN_OPTIONS = "loginOptions";
+    public static final String KEY_ACCOUNT = "account";
+    
+    /**
+     * Value under this key should handle path to webdav php script. Will be
+     * removed and usage should be replaced by combining
+     * {@link com.owncloud.android.authentication.AuthenticatorActivity.KEY_OC_BASE_URL} and
+     * {@link com.owncloud.android.utils.OwnCloudVersion}
+     * 
+     * @deprecated
+     */
+    public static final String KEY_OC_URL = "oc_url";
+    /**
+     * Version should be 3 numbers separated by dot so it can be parsed by
+     * {@link com.owncloud.android.utils.OwnCloudVersion}
+     */
+    public static final String KEY_OC_VERSION = "oc_version";
+    /**
+     * Base url should point to owncloud installation without trailing / ie:
+     * http://server/path or https://owncloud.server
+     */
+    public static final String KEY_OC_BASE_URL = "oc_base_url";
+    /**
+     * Flag signaling if the ownCloud server can be accessed with OAuth2 access tokens.
+     */
+    public static final String KEY_SUPPORTS_OAUTH2 = "oc_supports_oauth2";
+    
+    private static final String TAG = AccountAuthenticator.class.getSimpleName();
+    
+    private Context mContext;
+
+    public AccountAuthenticator(Context context) {
+        super(context);
+        mContext = context;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Bundle addAccount(AccountAuthenticatorResponse response,
+            String accountType, String authTokenType,
+            String[] requiredFeatures, Bundle options)
+            throws NetworkErrorException {
+        Log_OC.i(TAG, "Adding account with type " + accountType
+                + " and auth token " + authTokenType);
+        try {
+            validateAccountType(accountType);
+        } catch (AuthenticatorException e) {
+            Log_OC.e(TAG, "Failed to validate account type " + accountType + ": "
+                    + e.getMessage());
+            e.printStackTrace();
+            return e.getFailureBundle();
+        }
+        final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
+        intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
+        intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
+        intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures);
+        intent.putExtra(KEY_LOGIN_OPTIONS, options);
+        intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_CREATE);
+
+        setIntentFlags(intent);
+        
+        final Bundle bundle = new Bundle();
+        bundle.putParcelable(AccountManager.KEY_INTENT, intent);
+        return bundle;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -107,7 +126,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
         try {
             validateAccountType(account.type);
         } catch (AuthenticatorException e) {
-            Log.e(TAG, "Failed to validate account type " + account.type + ": "
+            Log_OC.e(TAG, "Failed to validate account type " + account.type + ": "
                     + e.getMessage());
             e.printStackTrace();
             return e.getFailureBundle();
@@ -131,96 +150,110 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
         return null;
     }
 
-    @Override
-    public Bundle getAuthToken(AccountAuthenticatorResponse response,
-            Account account, String authTokenType, Bundle options)
-            throws NetworkErrorException {
-        try {
-            validateAccountType(account.type);
-            validateAuthTokenType(authTokenType);
-        } catch (AuthenticatorException e) {
-            Log.e(TAG, "Failed to validate account type " + account.type + ": "
-                    + e.getMessage());
-            e.printStackTrace();
-            return e.getFailureBundle();
-        }
-        final AccountManager am = AccountManager.get(mContext);
-        final String password = am.getPassword(account);
-        if (password != null) {
-            final Bundle result = new Bundle();
-            result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
-            result.putString(AccountManager.KEY_ACCOUNT_TYPE, ACCOUNT_TYPE);
-            result.putString(AccountManager.KEY_AUTHTOKEN, password);
-            return result;
-        }
-
-        final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
-        intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
-                response);
-        intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
-        intent.putExtra(KEY_LOGIN_OPTIONS, options);
-        intent.putExtra(AuthenticatorActivity.PARAM_USERNAME, account.name);
-
-        final Bundle bundle = new Bundle();
-        bundle.putParcelable(AccountManager.KEY_INTENT, intent);
-        return bundle;
-    }
-
-    @Override
-    public String getAuthTokenLabel(String authTokenType) {
-        return null;
-    }
-
-    @Override
-    public Bundle hasFeatures(AccountAuthenticatorResponse response,
-            Account account, String[] features) throws NetworkErrorException {
-        final Bundle result = new Bundle();
-        result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
-        return result;
-    }
-
-    @Override
-    public Bundle updateCredentials(AccountAuthenticatorResponse response,
-            Account account, String authTokenType, Bundle options)
-            throws NetworkErrorException {
-        final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
-        intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
-                response);
-        intent.putExtra(KEY_ACCOUNT, account);
-        intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
-        intent.putExtra(KEY_LOGIN_OPTIONS, options);
-        setIntentFlags(intent);
-
-        final Bundle bundle = new Bundle();
-        bundle.putParcelable(AccountManager.KEY_INTENT, intent);
-        return bundle;
-    }
-
-    @Override
-    public Bundle getAccountRemovalAllowed(
-            AccountAuthenticatorResponse response, Account account)
-            throws NetworkErrorException {
-        return super.getAccountRemovalAllowed(response, account);
-    }
-
-    private void setIntentFlags(Intent intent) {
-        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
-        intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
-        intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-        intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
-    }
-
-    private void validateAccountType(String type)
-            throws UnsupportedAccountTypeException {
-        if (!type.equals(ACCOUNT_TYPE)) {
-            throw new UnsupportedAccountTypeException();
-        }
-    }
-
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Bundle getAuthToken(AccountAuthenticatorResponse response,
+            Account account, String authTokenType, Bundle options)
+            throws NetworkErrorException {
+        /// validate parameters
+        try {
+            validateAccountType(account.type);
+            validateAuthTokenType(authTokenType);
+        } catch (AuthenticatorException e) {
+            Log_OC.e(TAG, "Failed to validate account type " + account.type + ": "
+                    + e.getMessage());
+            e.printStackTrace();
+            return e.getFailureBundle();
+        }
+        
+        /// check if required token is stored
+        final AccountManager am = AccountManager.get(mContext);
+        String accessToken;
+        if (authTokenType.equals(AUTH_TOKEN_TYPE_PASSWORD)) {
+            accessToken = am.getPassword(account);
+        } else {
+            accessToken = am.peekAuthToken(account, authTokenType);
+        }
+        if (accessToken != null) {
+            final Bundle result = new Bundle();
+            result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
+            result.putString(AccountManager.KEY_ACCOUNT_TYPE, ACCOUNT_TYPE);
+            result.putString(AccountManager.KEY_AUTHTOKEN, accessToken);
+            return result;
+        }
+        
+        /// if not stored, return Intent to access the AuthenticatorActivity and UPDATE the token for the account
+        final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
+        intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
+        intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
+        intent.putExtra(KEY_LOGIN_OPTIONS, options);
+        intent.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
+        intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
+        
+
+        final Bundle bundle = new Bundle();
+        bundle.putParcelable(AccountManager.KEY_INTENT, intent);
+        return bundle;
+    }
+
+    @Override
+    public String getAuthTokenLabel(String authTokenType) {
+        return null;
+    }
+
+    @Override
+    public Bundle hasFeatures(AccountAuthenticatorResponse response,
+            Account account, String[] features) throws NetworkErrorException {
+        final Bundle result = new Bundle();
+        result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
+        return result;
+    }
+
+    @Override
+    public Bundle updateCredentials(AccountAuthenticatorResponse response,
+            Account account, String authTokenType, Bundle options)
+            throws NetworkErrorException {
+        final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
+        intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
+                response);
+        intent.putExtra(KEY_ACCOUNT, account);
+        intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
+        intent.putExtra(KEY_LOGIN_OPTIONS, options);
+        setIntentFlags(intent);
+
+        final Bundle bundle = new Bundle();
+        bundle.putParcelable(AccountManager.KEY_INTENT, intent);
+        return bundle;
+    }
+
+    @Override
+    public Bundle getAccountRemovalAllowed(
+            AccountAuthenticatorResponse response, Account account)
+            throws NetworkErrorException {
+        return super.getAccountRemovalAllowed(response, account);
+    }
+
+    private void setIntentFlags(Intent intent) {
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+        intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
+    }
+
+    private void validateAccountType(String type)
+            throws UnsupportedAccountTypeException {
+        if (!type.equals(ACCOUNT_TYPE)) {
+            throw new UnsupportedAccountTypeException();
+        }
+    }
+
     private void validateAuthTokenType(String authTokenType)
             throws UnsupportedAuthTokenTypeException {
-        if (!authTokenType.equals(AUTH_TOKEN_TYPE)) {
+        if (!authTokenType.equals(AUTH_TOKEN_TYPE) &&
+            !authTokenType.equals(AUTH_TOKEN_TYPE_PASSWORD) &&
+            !authTokenType.equals(AUTH_TOKEN_TYPE_ACCESS_TOKEN) &&
+            !authTokenType.equals(AUTH_TOKEN_TYPE_REFRESH_TOKEN) ) {
             throw new UnsupportedAuthTokenTypeException();
         }
     }

+ 3 - 4
src/com/owncloud/android/authenticator/AccountAuthenticatorService.java → src/com/owncloud/android/authentication/AccountAuthenticatorService.java

@@ -3,9 +3,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +16,7 @@
  *
  */
 
-package com.owncloud.android.authenticator;
+package com.owncloud.android.authentication;
 
 import android.app.Service;
 import android.content.Intent;

+ 1085 - 0
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -0,0 +1,1085 @@
+/* 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 version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.authentication;
+
+import com.owncloud.android.AccountUtils;
+import com.owncloud.android.Log_OC;
+import com.owncloud.android.ui.dialog.SslValidatorDialog;
+import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;
+import com.owncloud.android.utils.OwnCloudVersion;
+import com.owncloud.android.network.OwnCloudClientUtils;
+import com.owncloud.android.operations.OwnCloudServerCheckOperation;
+import com.owncloud.android.operations.ExistenceCheckOperation;
+import com.owncloud.android.operations.OAuth2GetAccessToken;
+import com.owncloud.android.operations.OnRemoteOperationListener;
+import com.owncloud.android.operations.RemoteOperation;
+import com.owncloud.android.operations.RemoteOperationResult;
+import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
+
+import android.accounts.Account;
+import android.accounts.AccountAuthenticatorActivity;
+import android.accounts.AccountManager;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ProgressDialog;
+import android.content.ContentResolver;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.preference.PreferenceManager;
+import android.text.InputType;
+import android.view.View;
+import android.view.View.OnFocusChangeListener;
+import android.view.Window;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.owncloud.android.R;
+
+import eu.alefzero.webdav.WebdavClient;
+
+/**
+ * This Activity is used to add an ownCloud account to the App
+ * 
+ * @author Bartek Przybylski
+ * @author David A. Velasco
+ */
+public class AuthenticatorActivity extends AccountAuthenticatorActivity
+        implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeListener {
+
+    private static final String TAG = AuthenticatorActivity.class.getSimpleName();
+
+    public static final String EXTRA_ACCOUNT = "ACCOUNT";
+    public static final String EXTRA_USER_NAME = "USER_NAME";
+    public static final String EXTRA_HOST_NAME = "HOST_NAME";
+    public static final String EXTRA_ACTION = "ACTION";
+    
+    private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";
+    private static final String KEY_OC_VERSION = "OC_VERSION";
+    private static final String KEY_ACCOUNT = "ACCOUNT";
+    private static final String KEY_STATUS_TEXT = "STATUS_TEXT";
+    private static final String KEY_STATUS_ICON = "STATUS_ICON";
+    private static final String KEY_STATUS_CORRECT = "STATUS_CORRECT";
+    private static final String KEY_IS_SSL_CONN = "IS_SSL_CONN";
+    private static final String KEY_OAUTH2_STATUS_TEXT = "OAUTH2_STATUS_TEXT";
+    private static final String KEY_OAUTH2_STATUS_ICON = "OAUTH2_STATUS_ICON";
+    
+    private static final String OAUTH_MODE_ON = "on";
+    private static final String OAUTH_MODE_OFF = "off";
+    private static final String OAUTH_MODE_OPTIONAL = "optional";
+
+    private static final int DIALOG_LOGIN_PROGRESS = 0;
+    private static final int DIALOG_SSL_VALIDATOR = 1;
+    private static final int DIALOG_CERT_NOT_SAVED = 2;
+    private static final int DIALOG_OAUTH2_LOGIN_PROGRESS = 3;
+
+    public static final byte ACTION_CREATE = 0;
+    public static final byte ACTION_UPDATE_TOKEN = 1;
+
+    
+    private String mHostBaseUrl;
+    private OwnCloudVersion mDiscoveredVersion;
+    
+    private int mStatusText, mStatusIcon;
+    private boolean mStatusCorrect, mIsSslConn;
+    private int mOAuth2StatusText, mOAuth2StatusIcon;    
+    
+    private final Handler mHandler = new Handler();
+    private Thread mOperationThread;
+    private OwnCloudServerCheckOperation mOcServerChkOperation;
+    private ExistenceCheckOperation mAuthCheckOperation;
+    private RemoteOperationResult mLastSslUntrustedServerResult;
+
+    private Uri mNewCapturedUriFromOAuth2Redirection;
+    
+    private AccountManager mAccountMgr;
+    private boolean mJustCreated;
+    private byte mAction;
+    private Account mAccount;
+    
+    private ImageView mRefreshButton;
+    private ImageView mViewPasswordButton;
+    private EditText mHostUrlInput;
+    private EditText mUsernameInput;
+    private EditText mPasswordInput;
+    private CheckBox mOAuth2Check;
+    private String mOAuthAccessToken;
+    private View mOkButton;
+    private TextView mAuthStatusLayout;
+    
+    private TextView mOAuthAuthEndpointText;
+    private TextView mOAuthTokenEndpointText;
+    
+    
+    /**
+     * {@inheritDoc}
+     * 
+     * IMPORTANT ENTRY POINT 1: activity is shown to the user
+     */
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+        
+        /// set view and get references to view elements
+        setContentView(R.layout.account_setup);
+        mRefreshButton = (ImageView) findViewById(R.id.refreshButton);
+        mViewPasswordButton = (ImageView) findViewById(R.id.viewPasswordButton);
+        mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);
+        mUsernameInput = (EditText) findViewById(R.id.account_username);
+        mPasswordInput = (EditText) findViewById(R.id.account_password);
+        mOAuthAuthEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_1);
+        mOAuthTokenEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_2);
+        mOAuth2Check = (CheckBox) findViewById(R.id.oauth_onOff_check);
+        mOkButton = findViewById(R.id.buttonOK);
+        mAuthStatusLayout = (TextView) findViewById(R.id.auth_status_text); 
+        
+        /// complete label for 'register account' button
+        Button b = (Button) findViewById(R.id.account_register);
+        if (b != null) {
+            b.setText(String.format(getString(R.string.auth_register), getString(R.string.app_name)));
+        }
+
+        /// bind view elements to listeners
+        mHostUrlInput.setOnFocusChangeListener(this);
+        mPasswordInput.setOnFocusChangeListener(this);
+        
+        /// initialization
+        mAccountMgr = AccountManager.get(this);
+        mNewCapturedUriFromOAuth2Redirection = null;
+        mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); 
+        mAccount = null;
+
+        if (savedInstanceState == null) {
+            /// connection state and info
+            mStatusText = mStatusIcon = 0;
+            mStatusCorrect = false;
+            mIsSslConn = false;
+            
+            /// retrieve extras from intent
+            String tokenType = getIntent().getExtras().getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE);
+            boolean oAuthRequired = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(tokenType) || OAUTH_MODE_ON.equals(getString(R.string.oauth2_mode));
+            
+            mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);
+            if (mAccount != null) {
+                String ocVersion = mAccountMgr.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION);
+                if (ocVersion != null) {
+                    mDiscoveredVersion = new OwnCloudVersion(ocVersion);
+                }
+                mHostBaseUrl = mAccountMgr.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL);
+                mHostUrlInput.setText(mHostBaseUrl);
+                String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));
+                mUsernameInput.setText(userName);
+                oAuthRequired = (mAccountMgr.getUserData(mAccount, AccountAuthenticator.KEY_SUPPORTS_OAUTH2) != null);
+            }
+            mOAuth2Check.setChecked(oAuthRequired);
+            changeViewByOAuth2Check(oAuthRequired);
+            
+
+        } else {
+            loadSavedInstanceState(savedInstanceState);
+        }
+        
+        if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) {
+            mOAuth2Check.setVisibility(View.GONE);
+        }
+        
+        if (mAction == ACTION_UPDATE_TOKEN) {
+            /// lock things that should not change
+            mHostUrlInput.setEnabled(false);
+            mUsernameInput.setEnabled(false);
+            mOAuth2Check.setVisibility(View.GONE);
+            checkOcServer(); 
+        }
+        
+        mPasswordInput.setText("");     // clean password to avoid social hacking (disadvantage: password in removed if the device is turned aside)
+        mJustCreated = true;
+    }
+
+
+    /**
+     * Saves relevant state before {@link #onPause()}
+     * 
+     * Do NOT save {@link #mNewCapturedUriFromOAuth2Redirection}; it keeps a temporal flag, intended to defer the 
+     * processing of the redirection caught in {@link #onNewIntent(Intent)} until {@link #onResume()} 
+     * 
+     * See {@link #loadSavedInstanceState(Bundle)}
+     */
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        
+        /// connection state and info
+        outState.putInt(KEY_STATUS_TEXT, mStatusText);
+        outState.putInt(KEY_STATUS_ICON, mStatusIcon);
+        outState.putBoolean(KEY_STATUS_CORRECT, mStatusCorrect);
+        outState.putBoolean(KEY_IS_SSL_CONN, mIsSslConn);
+
+        /// server data
+        if (mDiscoveredVersion != null) 
+            outState.putString(KEY_OC_VERSION, mDiscoveredVersion.toString());
+        outState.putString(KEY_HOST_URL_TEXT, mHostBaseUrl);
+        
+        /// account data, if updating
+        if (mAccount != null)
+            outState.putParcelable(KEY_ACCOUNT, mAccount);
+        
+        // Saving the state of oAuth2 components.
+        outState.putInt(KEY_OAUTH2_STATUS_ICON, mOAuth2StatusIcon);
+        outState.putInt(KEY_OAUTH2_STATUS_TEXT, mOAuth2StatusText);
+        
+    }
+
+
+    /**
+     * Loads saved state
+     * 
+     * See {@link #onSaveInstanceState(Bundle)}.
+     * 
+     * @param savedInstanceState    Saved state, as received in {@link #onCreate(Bundle)}.
+     */
+    private void loadSavedInstanceState(Bundle savedInstanceState) {
+        /// connection state and info
+        mStatusCorrect = savedInstanceState.getBoolean(KEY_STATUS_CORRECT);
+        mIsSslConn = savedInstanceState.getBoolean(KEY_IS_SSL_CONN);
+        mStatusText = savedInstanceState.getInt(KEY_STATUS_TEXT);
+        mStatusIcon = savedInstanceState.getInt(KEY_STATUS_ICON);
+        updateConnStatus();
+        
+        /// UI settings depending upon connection
+        mOkButton.setEnabled(mStatusCorrect);   // TODO really necessary?
+        if (!mStatusCorrect)
+            mRefreshButton.setVisibility(View.VISIBLE); // seems that setting visibility is necessary
+        else
+            mRefreshButton.setVisibility(View.INVISIBLE);
+        
+        /// server data
+        String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);
+        if (ocVersion != null)
+            mDiscoveredVersion = new OwnCloudVersion(ocVersion);
+        mHostBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);
+        
+        // account data, if updating
+        mAccount = savedInstanceState.getParcelable(KEY_ACCOUNT);
+        
+        // state of oAuth2 components
+        mOAuth2StatusIcon = savedInstanceState.getInt(KEY_OAUTH2_STATUS_ICON);
+        mOAuth2StatusText = savedInstanceState.getInt(KEY_OAUTH2_STATUS_TEXT);
+        // END of getting the state of oAuth2 components.
+    }
+
+    
+    /**
+     * The redirection triggered by the OAuth authentication server as response to the GET AUTHORIZATION request
+     * is caught here.
+     * 
+     * To make this possible, this activity needs to be qualified with android:launchMode = "singleTask" in the
+     * AndroidManifest.xml file.
+     */
+    @Override
+    protected void onNewIntent (Intent intent) {
+        Log_OC.d(TAG, "onNewIntent()");
+        Uri data = intent.getData();
+        if (data != null && data.toString().startsWith(getString(R.string.oauth2_redirect_uri))) {
+            mNewCapturedUriFromOAuth2Redirection = data;
+        }
+    }
+
+    
+    /**
+     * The redirection triggered by the OAuth authentication server as response to the GET AUTHORIZATION, and 
+     * deferred in {@link #onNewIntent(Intent)}, is processed here.
+     */
+    @Override
+    protected void onResume() {
+        super.onResume();
+        // the state of mOAuth2Check is automatically recovered between configuration changes, but not before onCreate() finishes; so keep the next lines here
+        changeViewByOAuth2Check(mOAuth2Check.isChecked());  
+        if (mAction == ACTION_UPDATE_TOKEN && mJustCreated) {
+            if (mOAuth2Check.isChecked())
+                Toast.makeText(this, R.string.auth_expired_oauth_token_toast, Toast.LENGTH_LONG).show();
+            else
+                Toast.makeText(this, R.string.auth_expired_basic_auth_toast, Toast.LENGTH_LONG).show();
+        }
+        
+        if (mNewCapturedUriFromOAuth2Redirection != null) {
+            getOAuth2AccessTokenFromCapturedRedirection();            
+        }
+        
+        mJustCreated = false;
+    }
+    
+    
+    /**
+     * Parses the redirection with the response to the GET AUTHORIZATION request to the 
+     * oAuth server and requests for the access token (GET ACCESS TOKEN)
+     */
+    private void getOAuth2AccessTokenFromCapturedRedirection() {
+        /// Parse data from OAuth redirection
+        String queryParameters = mNewCapturedUriFromOAuth2Redirection.getQuery();
+        mNewCapturedUriFromOAuth2Redirection = null;
+        
+        /// Showing the dialog with instructions for the user.
+        showDialog(DIALOG_OAUTH2_LOGIN_PROGRESS);
+
+        /// GET ACCESS TOKEN to the oAuth server 
+        RemoteOperation operation = new OAuth2GetAccessToken(   getString(R.string.oauth2_client_id), 
+                                                                getString(R.string.oauth2_redirect_uri), // TODO check - necessary here?      
+                                                                getString(R.string.oauth2_grant_type),
+                                                                queryParameters);
+        //WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(getString(R.string.oauth2_url_endpoint_access)), getApplicationContext());
+        WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(mOAuthTokenEndpointText.getText().toString().trim()), getApplicationContext());
+        operation.execute(client, this, mHandler);
+    }
+    
+
+    
+    /**
+     * Handles the change of focus on the text inputs for the server URL and the password
+     */
+    public void onFocusChange(View view, boolean hasFocus) {
+        if (view.getId() == R.id.hostUrlInput) {
+            onUrlInputFocusChanged((TextView) view, hasFocus);
+            
+        } else if (view.getId() == R.id.account_password) {
+            onPasswordFocusChanged((TextView) view, hasFocus);
+        }
+    }
+    
+
+    /**
+     * Handles changes in focus on the text input for the server URL.
+     * 
+     * IMPORTANT ENTRY POINT 2: When (!hasFocus), user wrote the server URL and changed to 
+     * other field. The operation to check the existence of the server in the entered URL is
+     * started. 
+     * 
+     * When hasFocus:    user 'comes back' to write again the server URL.
+     * 
+     * @param hostInput     TextView with the URL input field receiving the change of focus.
+     * @param hasFocus      'True' if focus is received, 'false' if is lost
+     */
+    private void onUrlInputFocusChanged(TextView hostInput, boolean hasFocus) {
+        if (!hasFocus) {
+            checkOcServer();
+            
+        } else {
+            // avoids that the 'connect' button can be clicked if the test was previously passed
+            mOkButton.setEnabled(false); 
+        }
+    }
+
+
+    private void checkOcServer() {
+        String uri = mHostUrlInput.getText().toString().trim();
+        if (uri.length() != 0) {
+            mStatusText = R.string.auth_testing_connection;
+            mStatusIcon = R.drawable.progress_small;
+            updateConnStatus();
+            /** TODO cancel previous connection check if the user tries to ammend a wrong URL  
+            if(mConnChkOperation != null) {
+                mConnChkOperation.cancel();
+            } */
+            mOcServerChkOperation = new  OwnCloudServerCheckOperation(uri, this);
+            WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(uri), this);
+            mHostBaseUrl = "";
+            mDiscoveredVersion = null;
+            mOperationThread = mOcServerChkOperation.execute(client, this, mHandler);
+        } else {
+            mRefreshButton.setVisibility(View.INVISIBLE);
+            mStatusText = 0;
+            mStatusIcon = 0;
+            updateConnStatus();
+        }
+    }
+
+
+    /**
+     * Handles changes in focus on the text input for the password (basic authorization).
+     * 
+     * When (hasFocus), the button to toggle password visibility is shown.
+     * 
+     * When (!hasFocus), the button is made invisible and the password is hidden.
+     * 
+     * @param passwordInput    TextView with the password input field receiving the change of focus.
+     * @param hasFocus          'True' if focus is received, 'false' if is lost
+     */
+    private void onPasswordFocusChanged(TextView passwordInput, boolean hasFocus) {
+        if (hasFocus) {
+            mViewPasswordButton.setVisibility(View.VISIBLE);
+        } else {
+            int input_type = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
+            passwordInput.setInputType(input_type);
+            mViewPasswordButton.setVisibility(View.INVISIBLE);
+        }
+    }
+
+
+    
+    /**
+     * Cancels the authenticator activity
+     * 
+     * IMPORTANT ENTRY POINT 3: Never underestimate the importance of cancellation
+     * 
+     * This method is bound in the layout/acceoun_setup.xml resource file.
+     * 
+     * @param view      Cancel button
+     */
+    public void onCancelClick(View view) {
+        setResult(RESULT_CANCELED);     // TODO review how is this related to AccountAuthenticator (debugging)
+        finish();
+    }
+    
+    
+    
+    /**
+     * Checks the credentials of the user in the root of the ownCloud server
+     * before creating a new local account.
+     * 
+     * For basic authorization, a check of existence of the root folder is
+     * performed.
+     * 
+     * For OAuth, starts the flow to get an access token; the credentials test 
+     * is postponed until it is available.
+     * 
+     * IMPORTANT ENTRY POINT 4
+     * 
+     * @param view      OK button
+     */
+    public void onOkClick(View view) {
+        // this check should be unnecessary
+        if (mDiscoveredVersion == null || !mDiscoveredVersion.isVersionValid()  || mHostBaseUrl == null || mHostBaseUrl.length() == 0) {
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_wtf_reenter_URL;
+            updateConnStatus();
+            mOkButton.setEnabled(false);
+            Log_OC.wtf(TAG,  "The user was allowed to click 'connect' to an unchecked server!!");
+            return;
+        }
+        
+        if (mOAuth2Check.isChecked()) {
+            startOauthorization();
+            
+        } else {
+            checkBasicAuthorization();
+        }
+    }
+    
+    
+    /**
+     * Tests the credentials entered by the user performing a check of existence on 
+     * the root folder of the ownCloud server.
+     */
+    private void checkBasicAuthorization() {
+        /// get the path to the root folder through WebDAV from the version server
+        String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, false);
+        
+        /// get basic credentials entered by user
+        String username = mUsernameInput.getText().toString();
+        String password = mPasswordInput.getText().toString();
+        
+        /// be gentle with the user
+        showDialog(DIALOG_LOGIN_PROGRESS);
+        
+        /// test credentials accessing the root folder
+        mAuthCheckOperation = new  ExistenceCheckOperation("", this, false);
+        WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this);
+        client.setBasicCredentials(username, password);
+        mOperationThread = mAuthCheckOperation.execute(client, this, mHandler);
+    }
+
+
+    /**
+     * Starts the OAuth 'grant type' flow to get an access token, with 
+     * a GET AUTHORIZATION request to the BUILT-IN authorization server. 
+     */
+    private void startOauthorization() {
+        // be gentle with the user
+        mStatusIcon = R.drawable.progress_small;
+        mStatusText = R.string.oauth_login_connection;
+        updateAuthStatus();
+        
+        // GET AUTHORIZATION request
+        //Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth));
+        Uri uri = Uri.parse(mOAuthAuthEndpointText.getText().toString().trim());
+        Uri.Builder uriBuilder = uri.buildUpon();
+        uriBuilder.appendQueryParameter(OAuth2Constants.KEY_RESPONSE_TYPE, getString(R.string.oauth2_response_type));
+        uriBuilder.appendQueryParameter(OAuth2Constants.KEY_REDIRECT_URI, getString(R.string.oauth2_redirect_uri));   
+        uriBuilder.appendQueryParameter(OAuth2Constants.KEY_CLIENT_ID, getString(R.string.oauth2_client_id));
+        uriBuilder.appendQueryParameter(OAuth2Constants.KEY_SCOPE, getString(R.string.oauth2_scope));
+        //uriBuilder.appendQueryParameter(OAuth2Constants.KEY_STATE, whateverwewant);
+        uri = uriBuilder.build();
+        Log_OC.d(TAG, "Starting browser to view " + uri.toString());
+        Intent i = new Intent(Intent.ACTION_VIEW, uri);
+        startActivity(i);
+    }
+
+    
+    /**
+     * Callback method invoked when a RemoteOperation executed by this Activity finishes.
+     * 
+     * Dispatches the operation flow to the right method.
+     */
+    @Override
+    public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
+
+        if (operation instanceof OwnCloudServerCheckOperation) {
+            onOcServerCheckFinish((OwnCloudServerCheckOperation) operation, result);
+            
+        } else if (operation instanceof OAuth2GetAccessToken) {
+            onGetOAuthAccessTokenFinish((OAuth2GetAccessToken)operation, result);
+                
+        } else if (operation instanceof ExistenceCheckOperation)  {
+            onAuthorizationCheckFinish((ExistenceCheckOperation)operation, result);
+                
+        }
+    }
+    
+
+    /**
+     * Processes the result of the server check performed when the user finishes the enter of the
+     * server URL.
+     * 
+     * @param operation     Server check performed.
+     * @param result        Result of the check.
+     */
+    private void onOcServerCheckFinish(OwnCloudServerCheckOperation operation, RemoteOperationResult result) {
+        /// update status icon and text
+        updateStatusIconAndText(result);
+        updateConnStatus();
+
+        /// save result state
+        mStatusCorrect = result.isSuccess();
+        mIsSslConn = (result.getCode() == ResultCode.OK_SSL);
+        
+        /// very special case (TODO: move to a common place for all the remote operations)
+        if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {
+            mLastSslUntrustedServerResult = result;
+            showDialog(DIALOG_SSL_VALIDATOR); 
+        }
+        
+        /// update the visibility of the 'retry connection' button
+        if (!mStatusCorrect)
+            mRefreshButton.setVisibility(View.VISIBLE);
+        else
+            mRefreshButton.setVisibility(View.INVISIBLE);
+        
+        /// retrieve discovered version and normalize server URL
+        mDiscoveredVersion = operation.getDiscoveredVersion();
+        mHostBaseUrl = mHostUrlInput.getText().toString().trim();
+        if (!mHostBaseUrl.toLowerCase().startsWith("http://") &&
+            !mHostBaseUrl.toLowerCase().startsWith("https://")) {
+            
+            if (mIsSslConn) {
+                mHostBaseUrl = "https://" + mHostBaseUrl;
+            } else {
+                mHostBaseUrl = "http://" + mHostBaseUrl;
+            }
+            
+        }
+        if (mHostBaseUrl.endsWith("/"))
+            mHostBaseUrl = mHostBaseUrl.substring(0, mHostBaseUrl.length() - 1);
+        
+        /// allow or not the user try to access the server
+        mOkButton.setEnabled(mStatusCorrect);
+    }
+
+
+    /**
+     * Chooses the right icon and text to show to the user for the received operation result.
+     * 
+     * @param result    Result of a remote operation performed in this activity
+     */
+    private void updateStatusIconAndText(RemoteOperationResult result) {
+        mStatusText = mStatusIcon = 0;
+
+        switch (result.getCode()) {
+        case OK_SSL:
+            mStatusIcon = android.R.drawable.ic_secure;
+            mStatusText = R.string.auth_secure_connection;
+            break;
+            
+        case OK_NO_SSL:
+        case OK:
+            if (mHostUrlInput.getText().toString().trim().toLowerCase().startsWith("http://") ) {
+                mStatusText = R.string.auth_connection_established;
+                mStatusIcon = R.drawable.ic_ok;
+            } else {
+                mStatusText = R.string.auth_nossl_plain_ok_title;
+                mStatusIcon = android.R.drawable.ic_partial_secure;
+            }
+            break;
+            
+        case SSL_RECOVERABLE_PEER_UNVERIFIED:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_ssl_unverified_server_title;
+            break;
+                
+        case BAD_OC_VERSION:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_bad_oc_version_title;
+            break;
+        case WRONG_CONNECTION:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_wrong_connection_title;
+            break;
+        case TIMEOUT:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_timeout_title;
+            break;
+        case INCORRECT_ADDRESS:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_incorrect_address_title;
+            break;
+            
+        case SSL_ERROR:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_ssl_general_error_title;
+            break;
+            
+        case UNAUTHORIZED:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_unauthorized;
+            break;
+        case HOST_NOT_AVAILABLE:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_unknown_host_title;
+            break;
+        case NO_NETWORK_CONNECTION:
+            mStatusIcon = R.drawable.no_network;
+            mStatusText = R.string.auth_no_net_conn_title;
+            break;
+        case INSTANCE_NOT_CONFIGURED:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_not_configured_title;
+            break;
+        case FILE_NOT_FOUND:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_incorrect_path_title;
+            break;
+        case OAUTH2_ERROR:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_oauth_error;
+            break;
+        case OAUTH2_ERROR_ACCESS_DENIED:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_oauth_error_access_denied;
+            break;
+        case UNHANDLED_HTTP_CODE:
+        case UNKNOWN_ERROR:
+            mStatusIcon = R.drawable.common_error;
+            mStatusText = R.string.auth_unknown_error_title;
+            break;
+            
+        default:
+            break;
+        }
+    }
+
+
+    /**
+     * Processes the result of the request for and access token send 
+     * to an OAuth authorization server.
+     * 
+     * @param operation     Operation performed requesting the access token.
+     * @param result        Result of the operation.
+     */
+    private void onGetOAuthAccessTokenFinish(OAuth2GetAccessToken operation, RemoteOperationResult result) {
+        try {
+            dismissDialog(DIALOG_OAUTH2_LOGIN_PROGRESS);
+        } catch (IllegalArgumentException e) {
+            // NOTHING TO DO ; can't find out what situation that leads to the exception in this code, but user logs signal that it happens
+        }
+
+        String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, true);
+        if (result.isSuccess() && webdav_path != null) {
+            /// be gentle with the user
+            showDialog(DIALOG_LOGIN_PROGRESS);
+            
+            /// time to test the retrieved access token on the ownCloud server
+            mOAuthAccessToken = ((OAuth2GetAccessToken)operation).getResultTokenMap().get(OAuth2Constants.KEY_ACCESS_TOKEN);
+            Log_OC.d(TAG, "Got ACCESS TOKEN: " + mOAuthAccessToken);
+            mAuthCheckOperation = new ExistenceCheckOperation("", this, false);
+            WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this);
+            client.setBearerCredentials(mOAuthAccessToken);
+            mAuthCheckOperation.execute(client, this, mHandler);
+            
+        } else {
+            updateStatusIconAndText(result);
+            updateAuthStatus();
+            Log_OC.d(TAG, "Access failed: " + result.getLogMessage());
+        }
+    }
+
+    
+    /**
+     * Processes the result of the access check performed to try the user credentials.
+     * 
+     * Creates a new account through the AccountManager.
+     * 
+     * @param operation     Access check performed.
+     * @param result        Result of the operation.
+     */
+    private void onAuthorizationCheckFinish(ExistenceCheckOperation operation, RemoteOperationResult result) {
+        try {
+            dismissDialog(DIALOG_LOGIN_PROGRESS);
+        } catch (IllegalArgumentException e) {
+            // NOTHING TO DO ; can't find out what situation that leads to the exception in this code, but user logs signal that it happens
+        }
+        
+        if (result.isSuccess()) {
+            Log_OC.d(TAG, "Successful access - time to save the account");
+
+            if (mAction == ACTION_CREATE) {
+                createAccount();
+                
+            } else {
+                updateToken();
+            }
+            
+            finish();
+            
+        } else {
+            updateStatusIconAndText(result);
+            updateAuthStatus();
+            Log_OC.d(TAG, "Access failed: " + result.getLogMessage());
+        }
+    }
+
+    
+    /**
+     * Sets the proper response to get that the Account Authenticator that started this activity saves 
+     * a new authorization token for mAccount.
+     */
+    private void updateToken() {
+        Bundle response = new Bundle();
+        response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name);
+        response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);
+        boolean isOAuth = mOAuth2Check.isChecked();
+        if (isOAuth) {
+            response.putString(AccountManager.KEY_AUTHTOKEN, mOAuthAccessToken);
+            // the next line is necessary; by now, notifications are calling directly to the AuthenticatorActivity to update, without AccountManager intervention
+            mAccountMgr.setAuthToken(mAccount, AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN, mOAuthAccessToken);
+        } else {
+            response.putString(AccountManager.KEY_AUTHTOKEN, mPasswordInput.getText().toString());
+            mAccountMgr.setPassword(mAccount, mPasswordInput.getText().toString());
+        }
+        setAccountAuthenticatorResult(response);
+    }
+
+
+    /**
+     * Creates a new account through the Account Authenticator that started this activity. 
+     * 
+     * This makes the account permanent.
+     * 
+     * TODO Decide how to name the OAuth accounts
+     */
+    private void createAccount() {
+        /// create and save new ownCloud account
+        boolean isOAuth = mOAuth2Check.isChecked();
+        
+        Uri uri = Uri.parse(mHostBaseUrl);
+        String username = mUsernameInput.getText().toString().trim();
+        if (isOAuth) {
+            username = "OAuth_user" + (new java.util.Random(System.currentTimeMillis())).nextLong();
+        }            
+        String accountName = username + "@" + uri.getHost();
+        if (uri.getPort() >= 0) {
+            accountName += ":" + uri.getPort();
+        }
+        mAccount = new Account(accountName, AccountAuthenticator.ACCOUNT_TYPE);
+        if (isOAuth) {
+            mAccountMgr.addAccountExplicitly(mAccount, "", null);  // with our implementation, the password is never input in the app
+        } else {
+            mAccountMgr.addAccountExplicitly(mAccount, mPasswordInput.getText().toString(), null);
+        }
+
+        /// add the new account as default in preferences, if there is none already
+        Account defaultAccount = AccountUtils.getCurrentOwnCloudAccount(this);
+        if (defaultAccount == null) {
+            SharedPreferences.Editor editor = PreferenceManager
+                    .getDefaultSharedPreferences(this).edit();
+            editor.putString("select_oc_account", accountName);
+            editor.commit();
+        }
+
+        /// prepare result to return to the Authenticator
+        //  TODO check again what the Authenticator makes with it; probably has the same effect as addAccountExplicitly, but it's not well done
+        final Intent intent = new Intent();       
+        intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE,    AccountAuthenticator.ACCOUNT_TYPE);
+        intent.putExtra(AccountManager.KEY_ACCOUNT_NAME,    mAccount.name);
+        if (!isOAuth)
+            intent.putExtra(AccountManager.KEY_AUTHTOKEN,   AccountAuthenticator.ACCOUNT_TYPE); // TODO check this; not sure it's right; maybe
+        intent.putExtra(AccountManager.KEY_USERDATA,        username);
+        if (isOAuth) {
+            mAccountMgr.setAuthToken(mAccount, AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN, mOAuthAccessToken);
+        }
+        /// add user data to the new account; TODO probably can be done in the last parameter addAccountExplicitly, or in KEY_USERDATA
+        mAccountMgr.setUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION,    mDiscoveredVersion.toString());
+        mAccountMgr.setUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL,   mHostBaseUrl);
+        if (isOAuth)
+            mAccountMgr.setUserData(mAccount, AccountAuthenticator.KEY_SUPPORTS_OAUTH2, "TRUE");  // TODO this flag should be unnecessary
+    
+        setAccountAuthenticatorResult(intent.getExtras());
+        setResult(RESULT_OK, intent);
+        
+        /// immediately request for the synchronization of the new account
+        Bundle bundle = new Bundle();
+        bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
+        ContentResolver.requestSync(mAccount, AccountAuthenticator.AUTHORITY, bundle);
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Necessary to update the contents of the SSL Dialog
+     * 
+     * TODO move to some common place for all possible untrusted SSL failures
+     */
+    @Override
+    protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
+        switch (id) {
+        case DIALOG_LOGIN_PROGRESS:
+        case DIALOG_CERT_NOT_SAVED:
+        case DIALOG_OAUTH2_LOGIN_PROGRESS:
+            break;
+        case DIALOG_SSL_VALIDATOR: {
+            ((SslValidatorDialog)dialog).updateResult(mLastSslUntrustedServerResult);
+            break;
+        }
+        default:
+            Log_OC.e(TAG, "Incorrect dialog called with id = " + id);
+        }
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Dialog onCreateDialog(int id) {
+        Dialog dialog = null;
+        switch (id) {
+        case DIALOG_LOGIN_PROGRESS: {
+            /// simple progress dialog
+            ProgressDialog working_dialog = new ProgressDialog(this);
+            working_dialog.setMessage(getResources().getString(R.string.auth_trying_to_login));
+            working_dialog.setIndeterminate(true);
+            working_dialog.setCancelable(true);
+            working_dialog
+                    .setOnCancelListener(new DialogInterface.OnCancelListener() {
+                        @Override
+                        public void onCancel(DialogInterface dialog) {
+                            /// TODO study if this is enough
+                            Log_OC.i(TAG, "Login canceled");
+                            if (mOperationThread != null) {
+                                mOperationThread.interrupt();
+                                finish();
+                            }
+                        }
+                    });
+            dialog = working_dialog;
+            break;
+        }
+        case DIALOG_OAUTH2_LOGIN_PROGRESS: {
+            ProgressDialog working_dialog = new ProgressDialog(this);
+            working_dialog.setMessage(String.format("Getting authorization")); 
+            working_dialog.setIndeterminate(true);
+            working_dialog.setCancelable(true);
+            working_dialog
+            .setOnCancelListener(new DialogInterface.OnCancelListener() {
+                @Override
+                public void onCancel(DialogInterface dialog) {
+                    Log_OC.i(TAG, "Login canceled");
+                    finish();
+                }
+            });
+            dialog = working_dialog;
+            break;
+        }
+        case DIALOG_SSL_VALIDATOR: {
+            /// TODO start to use new dialog interface, at least for this (it is a FragmentDialog already)
+            dialog = SslValidatorDialog.newInstance(this, mLastSslUntrustedServerResult, this);
+            break;
+        }
+        case DIALOG_CERT_NOT_SAVED: {
+            AlertDialog.Builder builder = new AlertDialog.Builder(this);
+            builder.setMessage(getResources().getString(R.string.ssl_validator_not_saved));
+            builder.setCancelable(false);
+            builder.setPositiveButton(R.string.common_ok, new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+                        dialog.dismiss();
+                    };
+                });
+            dialog = builder.create();
+            break;
+        }
+        default:
+            Log_OC.e(TAG, "Incorrect dialog called with id = " + id);
+        }
+        return dialog;
+    }
+
+    
+    /**
+     * Starts and activity to open the 'new account' page in the ownCloud web site
+     * 
+     * @param view      'Account register' button
+     */
+    public void onRegisterClick(View view) {
+        Intent register = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.url_account_register)));
+        setResult(RESULT_CANCELED);
+        startActivity(register);
+    }
+
+    
+    /**
+     * Updates the content and visibility state of the icon and text associated
+     * to the last check on the ownCloud server.
+     */
+    private void updateConnStatus() {
+        ImageView iv = (ImageView) findViewById(R.id.action_indicator);
+        TextView tv = (TextView) findViewById(R.id.status_text);
+
+        if (mStatusIcon == 0 && mStatusText == 0) {
+            iv.setVisibility(View.INVISIBLE);
+            tv.setVisibility(View.INVISIBLE);
+        } else {
+            iv.setImageResource(mStatusIcon);
+            tv.setText(mStatusText);
+            iv.setVisibility(View.VISIBLE);
+            tv.setVisibility(View.VISIBLE);
+        }
+    }
+    
+    
+    /**
+     * Updates the content and visibility state of the icon and text associated
+     * to the interactions with the OAuth authorization server.
+     */
+    private void updateAuthStatus() {
+        if (mStatusIcon == 0 && mStatusText == 0) {
+            mAuthStatusLayout.setVisibility(View.INVISIBLE);
+        } else {
+            mAuthStatusLayout.setText(mStatusText);
+            mAuthStatusLayout.setCompoundDrawablesWithIntrinsicBounds(mStatusIcon, 0, 0, 0);
+            mAuthStatusLayout.setVisibility(View.VISIBLE);
+        }
+    }     
+
+    
+    /**
+     * Called when the refresh button in the input field for ownCloud host is clicked.
+     * 
+     * Performs a new check on the URL in the input field.
+     * 
+     * @param view      Refresh 'button'
+     */
+    public void onRefreshClick(View view) {
+        onFocusChange(mRefreshButton, false);
+    }
+    
+    
+    /**
+     * Called when the eye icon in the password field is clicked.
+     * 
+     * Toggles the visibility of the password in the field. 
+     * 
+     * @param view      'View password' 'button'
+     */
+    public void onViewPasswordClick(View view) {
+        int selectionStart = mPasswordInput.getSelectionStart();
+        int selectionEnd = mPasswordInput.getSelectionEnd();
+        int input_type = mPasswordInput.getInputType();
+        if ((input_type & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
+            input_type = InputType.TYPE_CLASS_TEXT
+                    | InputType.TYPE_TEXT_VARIATION_PASSWORD;
+        } else {
+            input_type = InputType.TYPE_CLASS_TEXT
+                    | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
+        }
+        mPasswordInput.setInputType(input_type);
+        mPasswordInput.setSelection(selectionStart, selectionEnd);
+    }    
+    
+    
+    /**
+     * Called when the checkbox for OAuth authorization is clicked.
+     * 
+     * Hides or shows the input fields for user & password. 
+     * 
+     * @param view      'View password' 'button'
+     */
+    public void onCheckClick(View view) {
+        CheckBox oAuth2Check = (CheckBox)view;      
+        changeViewByOAuth2Check(oAuth2Check.isChecked());
+
+    }
+    
+    /**
+     * Changes the visibility of input elements depending upon the kind of authorization
+     * chosen by the user: basic or OAuth
+     * 
+     * @param checked       'True' when OAuth is selected.
+     */
+    public void changeViewByOAuth2Check(Boolean checked) {
+        
+        if (checked) {
+            mOAuthAuthEndpointText.setVisibility(View.VISIBLE);
+            mOAuthTokenEndpointText.setVisibility(View.VISIBLE);
+            mUsernameInput.setVisibility(View.GONE);
+            mPasswordInput.setVisibility(View.GONE);
+            mViewPasswordButton.setVisibility(View.GONE);
+        } else {
+            mOAuthAuthEndpointText.setVisibility(View.GONE);
+            mOAuthTokenEndpointText.setVisibility(View.GONE);
+            mUsernameInput.setVisibility(View.VISIBLE);
+            mPasswordInput.setVisibility(View.VISIBLE);
+            mViewPasswordButton.setVisibility(View.INVISIBLE);
+        }     
+
+    }    
+    
+    /**
+     * Called from SslValidatorDialog when a new server certificate was correctly saved.
+     */
+    public void onSavedCertificate() {
+        mOperationThread = mOcServerChkOperation.retry(this, mHandler);                
+    }
+
+    /**
+     * Called from SslValidatorDialog when a new server certificate could not be saved 
+     * when the user requested it.
+     */
+    @Override
+    public void onFailedSavingCertificate() {
+        showDialog(DIALOG_CERT_NOT_SAVED);
+    }
+
+}

+ 53 - 0
src/com/owncloud/android/authentication/OAuth2Constants.java

@@ -0,0 +1,53 @@
+/* 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 version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.authentication;
+
+/** 
+ * Constant values for OAuth 2 protocol.
+ * 
+ * Includes required and optional parameter NAMES used in the 'authorization code' grant type.
+ *  
+ * @author David A. Velasco
+ */
+
+public class OAuth2Constants {
+    
+    /// Parameters to send to the Authorization Endpoint
+    public static final String KEY_RESPONSE_TYPE = "response_type";
+    public static final String KEY_REDIRECT_URI = "redirect_uri";
+    public static final String KEY_CLIENT_ID = "client_id";
+    public static final String KEY_SCOPE = "scope";
+    public static final String KEY_STATE = "state"; 
+    
+    /// Additional parameters to send to the Token Endpoint
+    public static final String KEY_GRANT_TYPE = "grant_type";
+    public static final String KEY_CODE = "code";
+    
+    /// Parameters received in an OK response from the Token Endpoint 
+    public static final String KEY_ACCESS_TOKEN = "access_token";
+    public static final String KEY_TOKEN_TYPE = "token_type";
+    public static final String KEY_EXPIRES_IN = "expires_in";
+    public static final String KEY_REFRESH_TOKEN = "refresh_token";
+    
+    /// Parameters in an ERROR response
+    public static final String KEY_ERROR = "error";
+    public static final String KEY_ERROR_DESCRIPTION = "error_description";
+    public static final String KEY_ERROR_URI = "error_uri";
+    public static final String VALUE_ERROR_ACCESS_DENIED = "access_denied";
+    
+}

+ 0 - 89
src/com/owncloud/android/authenticator/AuthenticationRunnable.java

@@ -1,89 +0,0 @@
-/* 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-package com.owncloud.android.authenticator;
-
-import java.net.URL;
-
-import org.apache.commons.httpclient.HttpStatus;
-
-import com.owncloud.android.R;
-import com.owncloud.android.network.OwnCloudClientUtils;
-
-import eu.alefzero.webdav.WebdavClient;
-
-import android.content.Context;
-import android.net.Uri;
-import android.os.Handler;
-
-public class AuthenticationRunnable implements Runnable {
-
-    private OnAuthenticationResultListener mListener;
-    private Handler mHandler;
-    private URL mUrl;
-    private String mUsername;
-    private String mPassword;
-    private Context mContext;
-
-    public AuthenticationRunnable(URL url, String username, String password, Context context) {
-        mListener = null;
-        mUrl = url;
-        mUsername = username;
-        mPassword = password;
-        mContext = context;
-    }
-
-    public void setOnAuthenticationResultListener(
-            OnAuthenticationResultListener listener, Handler handler) {
-        mListener = listener;
-        mHandler = handler;
-    }
-
-    @Override
-    public void run() {
-        Uri uri;
-        uri = Uri.parse(mUrl.toString());
-        WebdavClient wdc = OwnCloudClientUtils.createOwnCloudClient(uri, mUsername, mPassword, mContext);
-        int login_result = wdc.tryToLogin();
-        switch (login_result) {
-        case HttpStatus.SC_OK:
-            postResult(true, uri.toString());
-            break;
-        case HttpStatus.SC_UNAUTHORIZED:
-            postResult(false, mContext.getString(R.string.auth_unauthorized));
-            break;
-        case HttpStatus.SC_NOT_FOUND:
-            postResult(false, mContext.getString(R.string.auth_not_found));
-            break;
-        default:
-            postResult(false, String.format(mContext.getString(R.string.auth_internal), login_result));
-        }
-    }
-
-    private void postResult(final boolean success, final String message) {
-        if (mHandler != null && mListener != null) {
-            mHandler.post(new Runnable() {
-                @Override
-                public void run() {
-                    mListener.onAuthenticationResult(success, message);
-                }
-            });
-        }
-    }
-}

+ 0 - 26
src/com/owncloud/android/authenticator/OnAuthenticationResultListener.java

@@ -1,26 +0,0 @@
-/* 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-package com.owncloud.android.authenticator;
-
-public interface OnAuthenticationResultListener {
-
-    public void onAuthenticationResult(boolean success, String message);
-
-}

+ 0 - 30
src/com/owncloud/android/authenticator/OnConnectCheckListener.java

@@ -1,30 +0,0 @@
-/* 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 <http://www.gnu.org/licenses/>.
- *
- */
-
-package com.owncloud.android.authenticator;
-
-public interface OnConnectCheckListener {
-
-    enum ResultType {
-        OK_SSL, OK_NO_SSL, SSL_INIT_ERROR, HOST_NOT_AVAILABLE, TIMEOUT, NO_NETWORK_CONNECTION, INCORRECT_ADDRESS, INSTANCE_NOT_CONFIGURED, FILE_NOT_FOUND, UNKNOWN_ERROR, WRONG_CONNECTION,  SSL_UNVERIFIED_SERVER, BAD_OC_VERSION
-    }
-
-    public void onConnectionCheckResult(ResultType type);
-
-}

+ 2 - 3
src/com/owncloud/android/datamodel/DataStorageManager.java

@@ -3,9 +3,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of

+ 14 - 15
src/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -3,9 +3,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,6 +25,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
 
+import com.owncloud.android.Log_OC;
 import com.owncloud.android.db.ProviderMeta;
 import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
 import com.owncloud.android.utils.FileStorageUtils;
@@ -40,7 +40,6 @@ import android.content.OperationApplicationException;
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.RemoteException;
-import android.util.Log;
 
 public class FileDataStorageManager implements DataStorageManager {
 
@@ -156,7 +155,7 @@ public class FileDataStorageManager implements DataStorageManager {
                             cv, ProviderTableMeta._ID + "=?",
                             new String[] { String.valueOf(file.getFileId()) });
                 } catch (RemoteException e) {
-                    Log.e(TAG,
+                    Log_OC.e(TAG,
                             "Fail to insert insert file to database "
                                     + e.getMessage());
                 }
@@ -171,7 +170,7 @@ public class FileDataStorageManager implements DataStorageManager {
                     result_uri = getContentProvider().insert(
                             ProviderTableMeta.CONTENT_URI_FILE, cv);
                 } catch (RemoteException e) {
-                    Log.e(TAG,
+                    Log_OC.e(TAG,
                             "Fail to insert insert file to database "
                                     + e.getMessage());
                 }
@@ -256,10 +255,10 @@ public class FileDataStorageManager implements DataStorageManager {
             }
             
         } catch (OperationApplicationException e) {
-            Log.e(TAG, "Fail to update/insert list of files to database " + e.getMessage());
+            Log_OC.e(TAG, "Fail to update/insert list of files to database " + e.getMessage());
             
         } catch (RemoteException e) {
-            Log.e(TAG, "Fail to update/insert list of files to database " + e.getMessage());
+            Log_OC.e(TAG, "Fail to update/insert list of files to database " + e.getMessage());
         }
         
         // update new id in file objects for insertions
@@ -269,7 +268,7 @@ public class FileDataStorageManager implements DataStorageManager {
                 if (results[i].uri != null) {
                     newId = Long.parseLong(results[i].uri.getPathSegments().get(1));
                     files.get(i).setFileId(newId);
-                    //Log.v(TAG, "Found and added id in insertion for " + files.get(i).getRemotePath());
+                    //Log_OC.v(TAG, "Found and added id in insertion for " + files.get(i).getRemotePath());
                 }
             }
         }
@@ -321,7 +320,7 @@ public class FileDataStorageManager implements DataStorageManager {
                             ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
                             new String[] { mAccount.name }, null);
                 } catch (RemoteException e) {
-                    Log.e(TAG, e.getMessage());
+                    Log_OC.e(TAG, e.getMessage());
                     return ret;
                 }
             } else {
@@ -364,7 +363,7 @@ public class FileDataStorageManager implements DataStorageManager {
                                 + ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
                         new String[] { value, mAccount.name }, null);
             } catch (RemoteException e) {
-                Log.e(TAG,
+                Log_OC.e(TAG,
                         "Couldn't determine file existance, assuming non existance: "
                                 + e.getMessage());
                 return false;
@@ -394,7 +393,7 @@ public class FileDataStorageManager implements DataStorageManager {
                                 + "=?", new String[] { value, mAccount.name },
                         null);
             } catch (RemoteException e) {
-                Log.e(TAG, "Could not get file details: " + e.getMessage());
+                Log_OC.e(TAG, "Could not get file details: " + e.getMessage());
                 c = null;
             }
         }
@@ -517,7 +516,7 @@ public class FileDataStorageManager implements DataStorageManager {
                                                     ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " + ProviderTableMeta.FILE_PATH + " LIKE ?",
                                                     new String[] { mAccount.name, dir.getRemotePath() + "%" }, null);
                 } catch (RemoteException e) {
-                    Log.e(TAG, e.getMessage());
+                    Log_OC.e(TAG, e.getMessage());
                 }
             } else {
                 c = getContentResolver().query(ProviderTableMeta.CONTENT_URI, 
@@ -558,10 +557,10 @@ public class FileDataStorageManager implements DataStorageManager {
                 }
                 
             } catch (OperationApplicationException e) {
-                Log.e(TAG, "Fail to update descendants of " + dir.getFileId() + " in database", e);
+                Log_OC.e(TAG, "Fail to update descendants of " + dir.getFileId() + " in database", e);
                 
             } catch (RemoteException e) {
-                Log.e(TAG, "Fail to update desendants of " + dir.getFileId() + " in database", e);
+                Log_OC.e(TAG, "Fail to update desendants of " + dir.getFileId() + " in database", e);
             }
             
         }

+ 6 - 8
src/com/owncloud/android/datamodel/OCFile.java

@@ -3,9 +3,8 @@
  *   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.
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,11 +20,10 @@ package com.owncloud.android.datamodel;
 
 import java.io.File;
 
-import android.content.Intent;
-import android.net.Uri;
+import com.owncloud.android.Log_OC;
+
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.util.Log;
 import android.webkit.MimeTypeMap;
 
 public class OCFile implements Parcelable, Comparable<OCFile> {
@@ -265,7 +263,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
      * Does nothing if the new name is null, empty or includes "/" ; or if the file is the root directory 
      */
     public void setFileName(String name) {
-        Log.d(TAG, "OCFile name changin from " + mRemotePath);
+        Log_OC.d(TAG, "OCFile name changin from " + mRemotePath);
         if (name != null && name.length() > 0 && !name.contains(PATH_SEPARATOR) && !mRemotePath.equals(PATH_SEPARATOR)) {
             String parent = (new File(getRemotePath())).getParent();
             parent = (parent.endsWith(PATH_SEPARATOR)) ? parent : parent + PATH_SEPARATOR;
@@ -273,7 +271,7 @@ public class OCFile implements Parcelable, Comparable<OCFile> {
             if (isDirectory()) {
                 mRemotePath += PATH_SEPARATOR;
             }
-            Log.d(TAG, "OCFile name changed to " + mRemotePath);
+            Log_OC.d(TAG, "OCFile name changed to " + mRemotePath);
         }
     }
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно