Browse Source

Merge branch 'develop' into release-1.5.5

David A. Velasco 11 years ago
parent
commit
d2ff7d4755
32 changed files with 1091 additions and 574 deletions
  1. 1 1
      owncloud-android-library
  2. BIN
      res/drawable-hdpi-v11/notification_icon.png
  3. BIN
      res/drawable-hdpi/notification_icon.png
  4. BIN
      res/drawable-mdpi-v11/notification_icon.png
  5. BIN
      res/drawable-mdpi/notification_icon.png
  6. BIN
      res/drawable-xhdpi-v11/notification_icon.png
  7. BIN
      res/drawable-xhdpi/notification_icon.png
  8. 69 0
      res/layout-v11/notification_with_progress_bar.xml
  9. 71 0
      res/layout/notification_with_progress_bar.xml
  10. 0 40
      res/layout/progressbar_layout.xml
  11. 127 100
      res/values-ar/strings.xml
  12. 3 0
      res/values-ca/strings.xml
  13. 4 1
      res/values-cs-rCZ/strings.xml
  14. 5 0
      res/values-da/strings.xml
  15. 13 0
      res/values-v11/versioned_styles.xml
  16. 12 0
      res/values-v9/versioned_styles.xml
  17. 2 0
      res/values/strings.xml
  18. 12 0
      res/values/versioned_styles.xml
  19. 4 4
      res/xml/preferences.xml
  20. 177 113
      src/com/owncloud/android/authentication/AuthenticatorActivity.java
  21. 0 156
      src/com/owncloud/android/files/managers/OCNotificationManager.java
  22. 41 26
      src/com/owncloud/android/files/services/FileDownloader.java
  23. 55 56
      src/com/owncloud/android/files/services/FileUploader.java
  24. 41 29
      src/com/owncloud/android/operations/CreateShareOperation.java
  25. 145 0
      src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java
  26. 4 5
      src/com/owncloud/android/operations/SynchronizeFolderOperation.java
  27. 74 42
      src/com/owncloud/android/syncadapter/FileSyncAdapter.java
  28. 47 0
      src/com/owncloud/android/ui/CheckBoxPreferenceWithLongTitle.java
  29. 53 0
      src/com/owncloud/android/ui/PreferenceMultiline.java
  30. 0 1
      src/com/owncloud/android/ui/activity/FileDisplayActivity.java
  31. 131 0
      src/com/owncloud/android/utils/NotificationBuilderWithProgressBar.java
  32. BIN
      third_party/android-support-library/android-support-v4.jar

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit 30acd4875dda3fd0bec83daaad522f3d5a02ead6
+Subproject commit 25c53f3bf978f53cceed125edfb9a37eecfa15a8

BIN
res/drawable-hdpi-v11/notification_icon.png


BIN
res/drawable-hdpi/notification_icon.png


BIN
res/drawable-mdpi-v11/notification_icon.png


BIN
res/drawable-mdpi/notification_icon.png


BIN
res/drawable-xhdpi-v11/notification_icon.png


BIN
res/drawable-xhdpi/notification_icon.png


+ 69 - 0
res/layout-v11/notification_with_progress_bar.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+    ownCloud Android client application
+    Copyright (C) 2014 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/>.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    >
+    <ImageView android:id="@+id/icon"
+        android:layout_width="@android:dimen/notification_large_icon_width"
+        android:layout_height="@android:dimen/notification_large_icon_height"
+        android:scaleType="center"
+        />
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:minHeight="64dp"
+        android:orientation="vertical"
+        android:paddingRight="12dp"
+        android:paddingLeft="12dp"
+        >
+		<TextView android:id="@+id/title"
+			android:layout_width="match_parent"
+			android:layout_height="wrap_content"
+			android:singleLine="true"
+			android:ellipsize="marquee"
+            android:fadingEdge="horizontal"
+            style="@style/Theme.ownCloud.NotificationText.Title"
+        	/>
+        <TextView android:id="@+id/text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="-2dp"
+            android:layout_marginBottom="-2dp"
+            android:singleLine="true"
+            android:fadingEdge="horizontal"
+            android:ellipsize="marquee"
+            style="@style/Theme.ownCloud.NotificationText.Content"
+            />
+        <FrameLayout android:id="@+id/progressHolder"
+            android:layout_width="match_parent"
+            android:layout_height="12dp"
+            >
+            <!--  the FrameLayout is needed to change visibility of the
+            	progress bar in Android 2.2, even though 
+            	https://code.google.com/p/android/issues/detail?id=11040 -->
+	        <ProgressBar
+	            android:id="@+id/progress"
+	            android:layout_width="match_parent"
+	            android:layout_height="match_parent"
+	            style="?android:attr/progressBarStyleHorizontal"
+	            />
+        </FrameLayout>
+    </LinearLayout>
+</LinearLayout>

+ 71 - 0
res/layout/notification_with_progress_bar.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+    ownCloud Android client application
+    Copyright (C) 2014 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/>.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical"
+        android:paddingTop="5dp"
+        android:paddingLeft="5dp"
+        >
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingTop="3dp"
+        >
+        <ImageView android:id="@+id/icon"
+            android:layout_width="25dp"
+            android:layout_height="25dp"
+            android:scaleType="centerInside"
+            />
+        <TextView android:id="@+id/title"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:singleLine="true"
+            android:ellipsize="marquee"
+            android:fadingEdge="horizontal"
+            android:paddingLeft="4dp"
+        	style="@style/Theme.ownCloud.NotificationText.Title"
+            />
+    </LinearLayout>
+	<TextView android:id="@+id/text"
+	    android:layout_width="match_parent"
+	    android:layout_height="wrap_content"
+	    android:singleLine="true"
+	    android:ellipsize="marquee"
+	    android:fadingEdge="horizontal"
+        style="@style/Theme.ownCloud.NotificationText.Content"
+	    />
+    <FrameLayout android:id="@+id/progressHolder"
+        android:layout_width="match_parent"
+        android:layout_height="10dp"
+        android:paddingTop="2dp"
+        android:paddingBottom="2dp"
+        >
+        <!--  the FrameLayout is needed to change visibility of the
+        	progress bar in Android 2.2, even though 
+        	https://code.google.com/p/android/issues/detail?id=11040 -->
+		<ProgressBar
+    		android:id="@+id/progress"
+    		android:layout_width="match_parent"
+    		android:layout_height="match_parent"
+    		style="?android:attr/progressBarStyleHorizontal"
+    	/>
+    </FrameLayout>
+</LinearLayout>

+ 0 - 40
res/layout/progressbar_layout.xml

@@ -1,40 +0,0 @@
-<?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/>.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="fill_parent" android:layout_height="fill_parent"
-  android:padding="5dp">
-  <ImageView android:id="@+id/status_icon"
-    android:layout_width="wrap_content" android:layout_height="fill_parent"
-    android:layout_alignParentLeft="true" />
-
-  <RelativeLayout android:layout_width="fill_parent"
-    android:layout_height="fill_parent" android:layout_toRightOf="@id/status_icon">
-
-    <TextView android:id="@+id/status_text" android:layout_width="fill_parent"
-      android:layout_height="wrap_content" android:layout_alignParentTop="true" />
-    <ProgressBar android:id="@+id/status_progress"
-      android:layout_width="fill_parent" android:layout_height="wrap_content"
-      android:layout_below="@id/status_text"
-      android:progressDrawable="@android:drawable/progress_horizontal"
-      android:indeterminate="false" android:indeterminateOnly="false" />
-
-  </RelativeLayout>
-
-</RelativeLayout>

+ 127 - 100
res/values-ar/strings.xml

@@ -7,18 +7,18 @@
   <string name="actionbar_upload_from_apps">محتويات من تطبيقات أخرى</string>
   <string name="actionbar_upload_files">الملفات</string>
   <string name="actionbar_open_with">فتح باستخدام</string>
-  <string name="actionbar_mkdir">إنشاء دليل</string>
+  <string name="actionbar_mkdir">إنشاء مجلد</string>
   <string name="actionbar_settings">إعدادات</string>
   <string name="actionbar_see_details">تفاصيل</string>
   <string name="actionbar_send_file">أرسل</string>
   <string name="prefs_category_general">عام</string>
   <string name="prefs_category_more">المزيد</string>
   <string name="prefs_accounts">حسابات</string>
-  <string name="prefs_manage_accounts">ادارة الحسابات</string>
-  <string name="prefs_pincode">كلمه السر للتطبيق</string>
-  <string name="prefs_pincode_summary">حمايه العميل</string>
+  <string name="prefs_manage_accounts">إدارة الحسابات</string>
+  <string name="prefs_pincode">كلمة سر التطبيق</string>
+  <string name="prefs_pincode_summary">حماية العميل</string>
   <string name="prefs_instant_upload">تفعيل الرفع الفوري</string>
-  <string name="prefs_instant_upload_summary">رفع الصور الماخوذة عن طريق الكاميرا تلقائياً</string>
+  <string name="prefs_instant_upload_summary">رفع الصور فور التقاطها بالكاميرا </string>
   <string name="prefs_log_title">تفعيل الدخول</string>
   <string name="prefs_log_summary">يستخدم هذا لتسجيل المشاكل</string>
   <string name="prefs_log_title_history">تاريخ الدخول</string>
@@ -34,113 +34,124 @@
   <string name="auth_host_url">عنوان الخادم https://…</string>
   <string name="auth_username">إسم المستخدم</string>
   <string name="auth_password">كلمة السر</string>
-  <string name="auth_register">جديد لـ %1$s ؟</string>
+  <string name="auth_register">جديد في %1$s ؟</string>
   <string name="sync_string_files">الملفات</string>
   <string name="setup_btn_connect">اتصال</string>
-  <string name="uploader_btn_upload_text">إرفع</string>
-  <string name="uploader_top_message">اختر مجلد الرفع:</string>
+  <string name="uploader_btn_upload_text">رفع</string>
+  <string name="uploader_top_message">اختر مجلد الرفع :</string>
   <string name="uploader_wrn_no_account_title">لم يتم العثور على أي حساب</string>
-  <string name="uploader_wrn_no_account_text">لا يوجد جسابات للـ %1$s في جهازك. يرجى إعداد حساب أولاَ.</string>
-  <string name="uploader_wrn_no_account_setup_btn_text">إعداد</string>
+  <string name="uploader_wrn_no_account_text">لا توجد حسابات  %1$s على جهازك. يرجى تهيئة حساب أولاً.</string>
+  <string name="uploader_wrn_no_account_setup_btn_text">تهيئة</string>
   <string name="uploader_wrn_no_account_quit_btn_text">خروج</string>
-  <string name="uploader_wrn_no_content_title">لا يوجد محتويات للرفع</string>
-  <string name="uploader_wrn_no_content_text">لم يتم استلام أي محتويات.</string>
-  <string name="uploader_error_forbidden_content">%1$s  غير مسموح له بالوصول للمحتوى المشترك</string>
+  <string name="uploader_wrn_no_content_title">لا يوجد محتوى للرفع</string>
+  <string name="uploader_wrn_no_content_text">لم يتم استلام أي محتوى. لا شيء للرفع.</string>
+  <string name="uploader_error_forbidden_content">%1$s  غير مسموح له بالوصول للمحتوى المشارك</string>
   <string name="uploader_info_uploading">يتم الرفع</string>
-  <string name="file_list_empty">لا يوجد ملفات في هذا المجلد.\nيمكن انشاء ملف جديد عن طريق خيارات قائمة \"رفع\". </string>
+  <string name="file_list_empty">لا توجد ملفات في هذا المجلد.\nيمكن إنشاء ملف جديد  باختيار \"رفع\" القائمة.</string>
   <string name="filedetails_select_file">اضغظ على الملف ليتم عرض خيارات أكثر</string>
-  <string name="filedetails_size">الحجم:</string>
-  <string name="filedetails_type">النوع:</string>
-  <string name="filedetails_created">انشئ:</string>
-  <string name="filedetails_modified">عُدل:</string>
-  <string name="filedetails_download">انزال</string>
-  <string name="filedetails_sync_file">تحديث ملف</string>
+  <string name="filedetails_size">الحجم :</string>
+  <string name="filedetails_type">النوع :</string>
+  <string name="filedetails_created">انشئ في :</string>
+  <string name="filedetails_modified">عُدل في :</string>
+  <string name="filedetails_download">تحميل</string>
+  <string name="filedetails_sync_file">تحديث الملف</string>
   <string name="filedetails_renamed_in_upload_msg">تم تغيير اسم الملف إلى  %1$s أثناء الرفع</string>
   <string name="action_share_file">شارك الرابط</string>
   <string name="action_unshare_file">الغاء مشاركة الرابط</string>
   <string name="common_yes">نعم</string>
   <string name="common_no">لا</string>
   <string name="common_ok">تم</string>
-  <string name="common_cancel_download">إلغاء تحميل</string>
-  <string name="common_cancel_upload">إلغاء رفع الملفات</string>
-  <string name="common_cancel">الغاء</string>
-  <string name="common_save_exit">احفظ &amp; خروج</string>
+  <string name="common_cancel_download">إلغاء التحميل</string>
+  <string name="common_cancel_upload">إلغاء الرفع</string>
+  <string name="common_cancel">إلغاء</string>
+  <string name="common_save_exit">حفظ + خروج</string>
   <string name="common_error">خطأ</string>
   <string name="common_loading">تحميل ...</string>
-  <string name="common_error_unknown">حدث خطأ غير معروف. </string>
+  <string name="common_error_unknown">خطأ غير معروف. </string>
   <string name="about_title">حول</string>
   <string name="change_password">عدل كلمة السر</string>
   <string name="delete_account">حذف الحساب</string>
   <string name="create_account">حساب جديد</string>
-  <string name="upload_chooser_title">رفع من</string>
+  <string name="upload_chooser_title">الرفع من ...</string>
   <string name="uploader_info_dirname">اسم المجلد</string>
   <string name="uploader_upload_in_progress_ticker">يتم الرفع ...</string>
   <string name="uploader_upload_in_progress_content">%1$d%% رفع %2$s</string>
   <string name="uploader_upload_succeeded_ticker">تم الرفع بنجاح</string>
   <string name="uploader_upload_succeeded_content_single">تم رفع %1$s  بنجاح </string>
-  <string name="uploader_upload_failed_ticker">عملية الرفع فشلت</string>
-  <string name="uploader_upload_failed_content_single">رفع %1$s قد لا يكون كاملاً</string>
-  <string name="downloader_download_in_progress_ticker">يتم التحميل</string>
-  <string name="downloader_download_in_progress_content">%1$d%% تنزيل  %2$s</string>
+  <string name="uploader_upload_failed_ticker">فشل الرفع</string>
+  <string name="uploader_upload_failed_content_single">لم يكتمل رفع  %1$s </string>
+  <string name="downloader_download_in_progress_ticker">يتم التحميل ...</string>
+  <string name="downloader_download_in_progress_content">%1$d%% تحميل  %2$s</string>
   <string name="downloader_download_succeeded_ticker">تم التحميل بنجاح</string>
   <string name="downloader_download_succeeded_content">تم تحميل %1$s  بنجاح </string>
   <string name="downloader_download_failed_ticker">فشل التحميل</string>
-  <string name="downloader_download_failed_content"> تحميل %1$s قد لا يكون كاملاَ</string>
+  <string name="downloader_download_failed_content"> لم يكتمل تحميل %1$s</string>
   <string name="downloader_not_downloaded_yet">لم يتم تحميلها بعد</string>
-  <string name="common_choose_account">اختر حساب</string>
-  <string name="sync_fail_ticker">فشل في المزامنة</string>
-  <string name="sync_fail_content">تعذر إكمال التزامن لـ %1$s  </string>
+  <string name="common_choose_account">اختر حسابا</string>
+  <string name="sync_fail_ticker">فشلت المزامنة.</string>
+  <string name="sync_fail_content">لم تكتمل مزامنة %1$s  </string>
   <string name="sync_fail_content_unauthorized">كلمة السر غير صالحة لـ %1$s</string>
-  <string name="sync_conflicts_in_favourites_ticker">يوجد تعارض</string>
-  <string name="sync_fail_in_favourites_content"> جهات الاتصال لـ %1$d لا يمكن مزامنتها ( %2$d تعارض) </string>
+  <string name="sync_conflicts_in_favourites_ticker">هناك تعارض</string>
+  <string name="sync_conflicts_in_favourites_content">لم تنجح المزامنة الدائمة لـ %1$d ملفات</string>
+  <string name="sync_fail_in_favourites_ticker">لم تنجح المزامنة التلقائية للملفات</string>
+  <string name="sync_fail_in_favourites_content"> لا يمكن مزامنة جهات اتصال %1$d  ( %2$d تعارض) </string>
+  <string name="sync_foreign_files_forgotten_ticker">تم نسيان بعض الملفات المحلية</string>
+  <string name="sync_foreign_files_forgotten_content">لم ينجح نقل %1$d ملفات إلى المجلد  %2$s</string>
+  <string name="sync_foreign_files_forgotten_explanation">اعتبارا من اﻹصدار 1.3.16, الملفات المرفوعة من هذا الجهاز يتم نسخها إلى المجلد المحلي %1$s تفاديا لفقدان البيانات حينما تتم مزامنة ملف واحد مع عدة حسابات.\n\nنظرا لهذا التغيير، تم نسخ كل الملفات المرفوعة في اﻹصدارات السابقة إلى المجلد %2$s. لكن خطأً ما حال دون إتمام العملية أثناء مزامنة الحسابات. يمكنك إما ترك هذه الملفات و حذف الرابط إلى %3$s، و إما نقل الملفات إلى المجلد %1$s و الاحتفاظ بالرابط إلى %4$s \n\nفيما يلي الملفات المحلية، و المفات الخارجية المرتبطة بها في %5$s</string>
   <string name="sync_current_folder_was_removed">لا يوجد مجلد %1$s بعد الان</string>
   <string name="foreign_files_move">نقل الكل</string>
   <string name="foreign_files_success">تم نقل جميع الملفات</string>
-  <string name="foreign_files_fail">بعض الملفات لا يمكن نقلها</string>
-  <string name="foreign_files_local_text">محلي:%1$s</string>
-  <string name="upload_query_move_foreign_files">لا يوجد مساحة كافية لنسخ الملفات المحددة لمجلد  %1$s . هل ترغب بنقلهم للمجلد بدلاَ من ذلك؟</string>
-  <string name="pincode_enter_pin_code">فضلا, ادخل كلمة السر</string>
-  <string name="pincode_configure_your_pin">فضلا, ادخل كلمة السر</string>
+  <string name="foreign_files_fail">لم ينجح نقل بعض الملفات</string>
+  <string name="foreign_files_local_text">محلي :%1$s</string>
+  <string name="foreign_files_remote_text">خارجي : %1$s</string>
+  <string name="upload_query_move_foreign_files">لا يوجد مساحة كافية لنسخ الملفات المحددة إلى مجلد  %1$s . هل ترغب بنقلها بدلاَ من ذلك؟</string>
+  <string name="pincode_enter_pin_code">يرجى إدخال كلمة السر</string>
+  <string name="pincode_configure_your_pin">أدخل كلمة السر</string>
   <string name="pincode_configure_your_pin_explanation">سيتم طلب PIN في كل مرة يتم فيها تشغيل التطبيق</string>
-  <string name="pincode_reenter_your_pincode">فضلا, ادخل كلمة السر مره اخري</string>
-  <string name="pincode_remove_your_pincode">ازاله كلمة السر</string>
-  <string name="pincode_mismatch">كلمات السر غير متطابقه</string>
-  <string name="pincode_wrong">كلمه السر غير صحيحه</string>
-  <string name="pincode_removed">تم ازاله كلمه السر</string>
-  <string name="pincode_stored">تم تسجيل كلمه السر</string>
-  <string name="media_notif_ticker">%1$s مشغل الموسيقى</string>
-  <string name="media_state_playing">%1$s  (عرض)</string>
-  <string name="media_state_loading">%1$s (تحميل)</string>
-  <string name="media_event_done">تم الانتهاء من تشغيل %1$s </string>
+  <string name="pincode_reenter_your_pincode">يرجى إدخال كلمة السر مرة أخرى</string>
+  <string name="pincode_remove_your_pincode">إزالة كلمة السر</string>
+  <string name="pincode_mismatch">كلمتا السر غير متطابقتين</string>
+  <string name="pincode_wrong">كلمه السر غير صحيحة</string>
+  <string name="pincode_removed">تمت إزالة كلمه السر</string>
+  <string name="pincode_stored">تم تسجيل كلمت السر</string>
+  <string name="media_notif_ticker">مشغل الموسيقى %1$s </string>
+  <string name="media_state_playing">%1$s  (يتم التشغيل)</string>
+  <string name="media_state_loading">%1$s (يتم التحميل)</string>
+  <string name="media_event_done">انتهى تشغيل %1$s </string>
   <string name="media_err_nothing_to_play">لا يوجد ملف وسائط</string>
-  <string name="media_err_no_account">لم يتم تقديم اي حساب</string>
-  <string name="media_err_not_in_owncloud">الملف ليس في حساب فعال</string>
-  <string name="media_err_unsupported">ترميز غير مدعوم</string>
+  <string name="media_err_no_account">لم يتم تقديم أي حساب</string>
+  <string name="media_err_not_in_owncloud">الملف ليس في حساب صحيح</string>
+  <string name="media_err_unsupported">ترميز غير مدعّم</string>
   <string name="media_err_io">لا يمكن قراءة ملف الوسائط</string>
-  <string name="media_err_malformed">لم يتم فك ترميز ملف الوسائط بشكل صحيح</string>
+  <string name="media_err_malformed">الملف غير مرمز بشكل صحيح</string>
   <string name="media_err_timeout">انتهت المهلة أثناء محاولة العرض</string>
+  <string name="media_err_invalid_progressive_playback">لا يمكن بث ملف الوسائط</string>
   <string name="media_err_unknown">لا يمكن عرض ملف الوسائط مع عارض الوسائط المستعمل</string>
   <string name="media_err_security_ex">خطا امني اثناء محاولة عرض %1$s</string>
   <string name="media_err_io_ex">خطا في المدخلات اثناء محاولة عرض %1$s</string>
   <string name="media_err_unexpected">خطا غير متوقع اثناء محاولة عرض %1$s</string>
+  <string name="media_rewind_description">زر الترجيع</string>
+  <string name="media_play_pause_description">زر التشغيل أو الإيقاف</string>
+  <string name="media_forward_description">زر التقدم للأمام</string>
   <string name="auth_trying_to_login">محاولة الدخول ...</string>
   <string name="auth_no_net_conn_title">لا يتوفر اتصال</string>
   <string name="auth_nossl_plain_ok_title">الاتصال الآمن غير متاح</string>
-  <string name="auth_connection_established">يتم إنشاء الاتصال</string>
+  <string name="auth_connection_established">تم الاتصال</string>
   <string name="auth_testing_connection">اختبار الاتصال ...</string>
-  <string name="auth_not_configured_title">اعدادات الخاد تالفة </string>
+  <string name="auth_not_configured_title">إعداد الخادم غير صحيحة</string>
   <string name="auth_account_not_new">الحساب لنفس المستخدم والخادم موجود مسبقا على الجهاز </string>
   <string name="auth_account_not_the_same">المستخدم المدخل لا يتوافق مع المستخدم الموجود في الحساب </string>
-  <string name="auth_unknown_error_title">حدث خطأ غير معروف!</string>
+  <string name="auth_unknown_error_title">حدث خطأ غير معروف !</string>
   <string name="auth_unknown_host_title">فشل في العثور على المضيف</string>
-  <string name="auth_incorrect_path_title">تعذر إيجاد جهة الاتصال للسيرفر.</string>
-  <string name="auth_timeout_title">الخادم اخذ الكثير من الوقت للرد</string>
-  <string name="auth_incorrect_address_title">رابط تالف</string>
-  <string name="auth_ssl_general_error_title">فشل في انشاء SSL</string>
-  <string name="auth_bad_oc_version_title">لم يتم التعرف على اصدار الخادم</string>
-  <string name="auth_wrong_connection_title">لا يمكن إنشاء اتصال</string>
-  <string name="auth_secure_connection">تم إنشاء اتصال آمن</string>
-  <string name="auth_unauthorized">خطا في الاسم او كلمة المرور</string>
+  <string name="auth_incorrect_path_title">لم يتم إيجاد الخادم</string>
+  <string name="auth_timeout_title">الخادم أخذ كثيرا من الوقت للرد</string>
+  <string name="auth_incorrect_address_title">رابط غير سليم</string>
+  <string name="auth_ssl_general_error_title">فشل في تهيئة SSL</string>
+  <string name="auth_ssl_unverified_server_title">لا يمكن التحقق من هوية خادم SSL</string>
+  <string name="auth_bad_oc_version_title">إصدار الخادم غير معروف</string>
+  <string name="auth_wrong_connection_title">لم ينجح الاتصال</string>
+  <string name="auth_secure_connection">نجح الاتصال آمن</string>
+  <string name="auth_unauthorized">اسم المستخدم أو كلمة المرور خاطئة</string>
   <string name="auth_oauth_error">فشل في التحقق</string>
   <string name="auth_oauth_error_access_denied">تم رفض الوصول من قبل الخادم المرخص</string>
   <string name="auth_wtf_reenter_URL">حالة غير متوقعة: الرجاء, ادخال عنوان الخادم مرة اخرى</string>
@@ -150,58 +161,71 @@
   <string name="auth_connecting_auth_server">يتم الاتصال بالخادم للتحقق</string>
   <string name="auth_unsupported_auth_method">الخادم لا يدعم طريقة التحقق هذه</string>
   <string name="auth_unsupported_multiaccount">%1$s لا يدعم الحسابات المتعددة </string>
-  <string name="fd_keep_in_sync">اجعل الملف محدث</string>
-  <string name="common_rename">إعادة تسميه</string>
-  <string name="common_remove">الغى</string>
+  <string name="auth_fail_get_user_name">الخادم لا يجيب بمعرف صحيح للمستخدم، الرجاء الاتصال بالمدير</string>
+  <string name="fd_keep_in_sync"> جعل الملف محدثا</string>
+  <string name="common_rename">إعادة التسمية</string>
+  <string name="common_remove">حذف</string>
   <string name="confirmation_remove_alert">هل تود حقاَ إزالة %1$s ؟ </string>
-  <string name="confirmation_remove_folder_alert">هل ترغب في إزالة %1$s و جهات الاتصال التابعة له؟ </string>
-  <string name="confirmation_remove_local">محلي فقط</string>
+  <string name="confirmation_remove_folder_alert">هل ترغب حقا في إزالة %1$s و محتوياته ؟</string>
+  <string name="confirmation_remove_local">محليا فقط</string>
   <string name="confirmation_remove_folder_local">المحتويات المحلية فقط</string>
-  <string name="confirmation_remove_remote">حذف من الخادم</string>
-  <string name="confirmation_remove_remote_and_local">شبكي و محلي</string>
-  <string name="remove_success_msg">يتم الحذف بنجاح</string>
-  <string name="remove_fail_msg">لقد فشل الحذف</string>
+  <string name="confirmation_remove_remote">الحذف من الخادم</string>
+  <string name="confirmation_remove_remote_and_local">محليا و عن بعد</string>
+  <string name="remove_success_msg">تم الحذف بنجاح</string>
+  <string name="remove_fail_msg">فشل الحذف</string>
   <string name="rename_dialog_title">أدخل اسما جديدا</string>
-  <string name="rename_local_fail_msg">لايمكن اعادة تسمية النسخ المحلي  ,حاول باسم آخر </string>
-  <string name="rename_server_fail_msg">اعادة التسمية لم تكتمل</string>
-  <string name="sync_file_nothing_to_do_msg">محتويات الملفات متزامنة سابقا</string>
-  <string name="create_dir_fail_msg">لم يتمكن من انشاء المجلد</string>
+  <string name="rename_local_fail_msg">لم تنجح إعادة تسمية النسخة المحلية، جرب اسما آخر</string>
+  <string name="rename_server_fail_msg">لم تكتمل إعادة التسمية</string>
+  <string name="sync_file_fail_msg">لا يمكن التحقق من الملف الخارجي</string>
+  <string name="sync_file_nothing_to_do_msg">تمت  مزامنة محتويات الملفات من قبل</string>
+  <string name="create_dir_fail_msg">لم ينجح إنشاء المجلد</string>
   <string name="filename_forbidden_characters">رموز ممنوعة: / \\ &lt; &gt; : \" | ? *</string>
-  <string name="wait_a_moment">فضلاً, انتظر</string>
-  <string name="filedisplay_unexpected_bad_get_content">خطا غير متوقع : الرجاء اختيار الملف من برنامج آخر</string>
+  <string name="wait_a_moment">انتظر للحظة</string>
+  <string name="filedisplay_unexpected_bad_get_content">خطا غير متوقع : الرجاء اختيار الملف من تطبيق آخر</string>
   <string name="filedisplay_no_file_selected">لم يتم اختيار أي ملف</string>
   <string name="activity_chooser_title">ارسل الرابط الى ...</string>
   <string name="oauth_check_onoff">تسجيل الدخول باستخدام oAuth2</string>
   <string name="oauth_login_connection">الاتصال مع خادم oAuth2</string>
-  <string name="ssl_validator_header">تعذر التحقق من هوية الموقع</string>
+  <string name="ssl_validator_header">لا يمكن التحقق من هوية الموقع</string>
   <string name="ssl_validator_reason_cert_not_trusted">شهادة الخادم غير موثوقة</string>
-  <string name="ssl_validator_reason_cert_expired">شهادة الخادم منتهية</string>
-  <string name="ssl_validator_reason_cert_not_yet_valid">تاريخ صلاحية شهادة الخادم في المستقبل</string>
-  <string name="ssl_validator_reason_hostname_not_verified">هذه الوصله غير متطابقه مع السيرفر فى  شهاده الحمايه </string>
-  <string name="ssl_validator_question">هل تريد ان تثق في هذه الشهادة على اي حال ؟</string>
-  <string name="ssl_validator_not_saved">لم يتمكن من حفظ الشهادة </string>
+  <string name="ssl_validator_reason_cert_expired">شهادة الخادم منتهية الصلاحية</string>
+  <string name="ssl_validator_reason_cert_not_yet_valid">وقت صلاحية شهادة الخادم لم يحن بعد</string>
+  <string name="ssl_validator_reason_hostname_not_verified">الرابط لا يوافق اسم المضيف فى  شهاده الحماية </string>
+  <string name="ssl_validator_question">هل تريد أن تثق في هذه الشهادة على اي حال ؟</string>
+  <string name="ssl_validator_not_saved">لم ينجح حفظ الشهادة </string>
   <string name="ssl_validator_btn_details_see">تفاصيل</string>
   <string name="ssl_validator_btn_details_hide">إخفاء</string>
-  <string name="ssl_validator_label_subject">أصدرت ل:</string>
-  <string name="ssl_validator_label_CN">الاسم الشائع:</string>
-  <string name="ssl_validator_label_O">منظمة:</string>
-  <string name="ssl_validator_label_OU">الوحدة التنظيمية:</string>
-  <string name="ssl_validator_label_C">البلد:</string>
-  <string name="ssl_validator_label_ST">حالة:</string>
-  <string name="ssl_validator_label_L">المكان:</string>
-  <string name="ssl_validator_label_validity_from">من:</string>
-  <string name="ssl_validator_label_validity_to">إلى:</string>
-  <string name="ssl_validator_label_signature">التوقيع:</string>
-  <string name="ssl_validator_label_signature_algorithm">الخوارزمية:</string>
+  <string name="ssl_validator_label_subject">أصدرت لـ :</string>
+  <string name="ssl_validator_label_issuer">أصدرت بواسطة</string>
+  <string name="ssl_validator_label_CN">الاسم الشائع :</string>
+  <string name="ssl_validator_label_O">منظمة :</string>
+  <string name="ssl_validator_label_OU">الوحدة التنظيمية :</string>
+  <string name="ssl_validator_label_C">البلد :</string>
+  <string name="ssl_validator_label_ST">الحالة :</string>
+  <string name="ssl_validator_label_L">المكان :</string>
+  <string name="ssl_validator_label_validity">الصلاحية :</string>
+  <string name="ssl_validator_label_validity_from">من :</string>
+  <string name="ssl_validator_label_validity_to">إلى :</string>
+  <string name="ssl_validator_label_signature">التوقيع :</string>
+  <string name="ssl_validator_label_signature_algorithm">الخوارزمية :</string>
+  <string name="ssl_validator_null_cert">لا يمكن إظهار الشهادة</string>
+  <string name="ssl_validator_no_info_about_error">- لا معلومات عن الخطأ.</string>
+  <string name="placeholder_sentence">هذه مساحة محجوزة</string>
+  <string name="placeholder_filename">placeholder.txt</string>
   <string name="placeholder_filetype">صورة PNG</string>
   <string name="placeholder_filesize">389 KB</string>
+  <string name="placeholder_timestamp">2012/05/18 12:23 مساء</string>
   <string name="placeholder_media_time">12:23:45</string>
-  <string name="instant_upload_on_wifi">رفع الصور من خلال الواي فاي فقط</string>
+  <string name="instant_upload_on_wifi">رفع الصور من خلال الـ WiFi فقط</string>
+  <string name="instant_upload_path">/InstantUpload</string>
   <string name="conflict_title">تعارض في التحديث </string>
+  <string name="conflict_message">الملف %s غير </string>
+  <string name="conflict_keep_both">الاحتفاظ بالنسختين</string>
+  <string name="conflict_overwrite">استبدال</string>
   <string name="conflict_dont_upload">عدم الرفع</string>
   <string name="preview_image_description">معاينة الصورة</string>
   <string name="preview_image_error_unknown_format">هذه الصورة لا يمكن أن تظهر</string>
-  <string name="error__upload__local_file_not_copied">%1$s لم يتمكن من النسخ الى %2$s في المجلد المحلي</string>
+  <string name="error__upload__local_file_not_copied">لم ينجح نسخ %1$s  إلى المجلد المحلي %2$s </string>
   <string name="actionbar_failed_instant_upload">فشل في محاولة الرفع الفوري</string>
   <string name="failed_upload_headline_text">فشل في الرفع الفوري</string>
   <string name="failed_upload_headline_hint">ملخص لكل الاخطاء في عملية الرفع الفوري</string>
@@ -210,6 +234,7 @@
   <string name="failed_upload_headline_delete_all_btn">حذف كل المختارات من قائمة انتظار الرفع</string>
   <string name="failed_upload_retry_text">اعادة المحاولة لرفع الصورة:</string>
   <string name="failed_upload_load_more_images">تحميل المزيد من الصور</string>
+  <string name="failed_upload_retry_do_nothing_text">do nothing you are not online for instant upload</string>
   <string name="failed_upload_failure_text">رسالة خطا:</string>
   <string name="failed_upload_quota_exceeded_text">الرجاء التاكد من اعدادات الخادم, من الممكن انك تعديت الحد في quota</string>
   <string name="share_link_no_support_share_api">عذرا , المشاركة غير مفعلة في الخادم. الرجاء التواصل مع المدير</string>
@@ -218,4 +243,6 @@
   <string name="unshare_link_file_no_exist">غير قادر على إلغاء مشاركة هذا الملف أو المجلد.لا وجود له</string>
   <string name="unshare_link_file_error">حدث خطأ ما أثناء محاولة إلغاء مشاركة هذا الملف أو المجلد</string>
   <string name="activity_chooser_send_file_title">أرسل</string>
+  <string name="copy_link">نسخ الرابط</string>
+  <string name="clipboard_text_copied">تم النسخ للحافظة</string>
 </resources>

+ 3 - 0
res/values-ca/strings.xml

@@ -161,6 +161,7 @@
   <string name="auth_connecting_auth_server">S\'està connectant a un servidor d\'autenticació...</string>
   <string name="auth_unsupported_auth_method">El serivdor no permet aquest mètode d\'autenticació</string>
   <string name="auth_unsupported_multiaccount">%1$s no permet comptes múltiples</string>
+  <string name="auth_fail_get_user_name">El servidor no retorna una id d\'usuari correcta, contacteu amb l\'administrador.</string>
   <string name="fd_keep_in_sync">Mantén el fitxer actualitzat</string>
   <string name="common_rename">Reanomena</string>
   <string name="common_remove">Elimina</string>
@@ -207,6 +208,8 @@
   <string name="ssl_validator_label_validity_to">A:</string>
   <string name="ssl_validator_label_signature">Signatura:</string>
   <string name="ssl_validator_label_signature_algorithm">Algoritme:</string>
+  <string name="ssl_validator_null_cert">No s\'ha pogut mostrar el certificat.</string>
+  <string name="ssl_validator_no_info_about_error">- No hi ha informació de l\'error</string>
   <string name="placeholder_sentence">Això és un text variable</string>
   <string name="placeholder_filename">placeholder.txt</string>
   <string name="placeholder_filetype">Imatge PNG</string>

+ 4 - 1
res/values-cs-rCZ/strings.xml

@@ -97,7 +97,7 @@
   <string name="sync_fail_in_favourites_content">Obsah %1$d souborů nemohl být synchronizován (počet konfliktů: %2$d)</string>
   <string name="sync_foreign_files_forgotten_ticker">Některé místní soubory byly zapomenuty</string>
   <string name="sync_foreign_files_forgotten_content">%1$d souborů z adresáře %2$s nelze zkopírovat do</string>
-  <string name="sync_foreign_files_forgotten_explanation">Od verze 1.3.16 jsou soubory nahrané z tohoto zařízení kopírovány do místní %1$s složky, aby se zabránilo ztrátě dat při synchronizaci jednoho souboru s více účty.\n\nVšechny soubory nahrané předchozími verzemi aplikace byly z tohoto důvodu překopírovány do složky %2$s. Přesto se objevila chyba zabraňující dokončení této operace v průběhu synchronizace účtu. Buď můžete soubor(y) ponechat jak jsou a odebrat odkaz do složky %3$s nebo přesunout soubor(y) do složky %1$s a zachovat odkaz na %4$s.\n\nNíže je seznam místních a vzdálených souborů ve složce %5$s, do které byly odkázány.</string>
+  <string name="sync_foreign_files_forgotten_explanation">Od verze 1.3.16 jsou soubory nahrané z tohoto zařízení kopírovány do místní %1$s složky, aby se zabránilo ztrátě dat při synchronizaci jednoho souboru s více účty.\n\nVšechny soubory nahrané předchozími verzemi aplikace byly z tohoto důvodu překopírovány do složky %2$s. Bohužel se objevila chyba zabraňující dokončení této operace v průběhu synchronizace účtu. Buď můžete soubor(y) ponechat jak jsou a odebrat odkaz do složky %3$s nebo přesunout soubor(y) do složky %1$s a zachovat odkaz na %4$s.\n\nNíže je seznam místních a vzdálených souborů ve složce %5$s, do které byly odkázány.</string>
   <string name="sync_current_folder_was_removed">Složka %1$s již neexistuje</string>
   <string name="foreign_files_move">Přesunout vše</string>
   <string name="foreign_files_success">Všechny soubory byly přesunuty</string>
@@ -161,6 +161,7 @@
   <string name="auth_connecting_auth_server">Připojuji se k přihlašovacímu serveru...</string>
   <string name="auth_unsupported_auth_method">Server nepodporuje tuto přihlašovací metodu</string>
   <string name="auth_unsupported_multiaccount">%1$s nepodporuje více účtů</string>
+  <string name="auth_fail_get_user_name">Váš server nevrací správné přihlašovací ID, kontaktujte vašeho administrátora</string>
   <string name="fd_keep_in_sync">Udržovat soubor aktuální</string>
   <string name="common_rename">Přejmenovat</string>
   <string name="common_remove">Odstranit</string>
@@ -207,6 +208,8 @@
   <string name="ssl_validator_label_validity_to">Pro:</string>
   <string name="ssl_validator_label_signature">Podpis:</string>
   <string name="ssl_validator_label_signature_algorithm">Alogritmus:</string>
+  <string name="ssl_validator_null_cert">Certifikát nemohl být zobrazen.</string>
+  <string name="ssl_validator_no_info_about_error">- Žádné informace o této chybě</string>
   <string name="placeholder_sentence">Zástupný text</string>
   <string name="placeholder_filename">placeholder.txt</string>
   <string name="placeholder_filetype">Obrázek PNG</string>

+ 5 - 0
res/values-da/strings.xml

@@ -97,6 +97,7 @@
   <string name="sync_fail_in_favourites_content">Indholdet af %1$d filer ikke kunne synkroniseres (%2$d konflikter)</string>
   <string name="sync_foreign_files_forgotten_ticker">Visse lokale filer blev glemt</string>
   <string name="sync_foreign_files_forgotten_content">%1$d filer ud af %2$s mappe kunne ikke kopieres ind i</string>
+  <string name="sync_foreign_files_forgotten_explanation">Fra version 1.3.16 bliver filer uploadet fra denne enhed kopieret til mappen %1$s for at forhindre datatab når en enkelt fil synkroniseres med flere konti.\n\nPå grund af denne ændring er alle filer som var uploadet i tidligere versioner af denne app kopieret til mappen %2$s. Imidlertid forhindrede en fejl færdiggørelsen af denne operation under konto-synkronisering. Du kan enten lade filerne være som de er og fjerne linket til %3$s eller flytte filerne til mappen %1$s og beholde linket til %4$s.\n\nHerunder er en liste med de lokale og eksterne filer i %5$s, som de var knyttet til.</string>
   <string name="sync_current_folder_was_removed">Mappen %1$s eksistere ikke længere</string>
   <string name="foreign_files_move">Flyt alle</string>
   <string name="foreign_files_success">Alle filer blev flyttet</string>
@@ -160,6 +161,7 @@
   <string name="auth_connecting_auth_server">Forbinder til godkendelsesserver ...</string>
   <string name="auth_unsupported_auth_method">Serveren understøtter ikke denne godkendelsesmetode</string>
   <string name="auth_unsupported_multiaccount">%1$s understøtter ikke multiple konti</string>
+  <string name="auth_fail_get_user_name">Din server retunere ikke et korrekt bruger-id. Kontakt venligst din administrator</string>
   <string name="fd_keep_in_sync">Hold fil opdateret</string>
   <string name="common_rename">Omdøb</string>
   <string name="common_remove">Fjern</string>
@@ -206,6 +208,8 @@
   <string name="ssl_validator_label_validity_to">Til:</string>
   <string name="ssl_validator_label_signature">Signatur:</string>
   <string name="ssl_validator_label_signature_algorithm">Algoritme:</string>
+  <string name="ssl_validator_null_cert">Certifikatet kunne ikke vises.</string>
+  <string name="ssl_validator_no_info_about_error">- Ingen information om fejlen</string>
   <string name="placeholder_sentence">Dette er en pladsholder</string>
   <string name="placeholder_filename">stedfortræder.txt</string>
   <string name="placeholder_filetype">PNG Billede</string>
@@ -236,6 +240,7 @@
   <string name="share_link_no_support_share_api">Beklager, deling er ikke slået til på din server. Kontakt venligst din administrator.</string>
   <string name="share_link_file_no_exist">Kan ikke dele denne fil eller mappe. Find venligst ud af om den eksisterer</string>
   <string name="share_link_file_error">Der opstod en fejl ved deling af denne fil eller mappe</string>
+  <string name="unshare_link_file_no_exist">Kan ikke fjerne delingen af denne fil eller mappe. Den findes ikke.</string>
   <string name="unshare_link_file_error">Der opstod en fejl ved stopning af deling af denne mappe.</string>
   <string name="activity_chooser_send_file_title">Send</string>
   <string name="copy_link">Kopier link</string>

+ 13 - 0
res/values-v11/versioned_styles.xml

@@ -6,4 +6,17 @@
 		<item name="android:textColor">@color/button_text_color</item>
 	</style>
 
+	<!-- Notifications -->
+	<!-- Notifications -->
+	<style 	name="Theme.ownCloud.NotificationText.Title" 
+	    	parent="@android:style/TextAppearance.StatusBar.EventContent.Title" > 
+		<item name="android:textSize">18sp</item>
+        <item name="android:textStyle">bold</item>
+	</style>
+
+	<style 	name="Theme.ownCloud.NotificationText.Content" 
+	    	parent="@android:style/TextAppearance.StatusBar.EventContent"	>
+        <item name="android:textSize">16sp</item>
+	</style>
+	
 </resources>

+ 12 - 0
res/values-v9/versioned_styles.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+	
+	<!-- Notifications -->
+	<style name="Theme.ownCloud.NotificationText.Title" 
+	    parent="@android:style/TextAppearance.StatusBar.EventContent.Title" 
+	    />
+	<style name="Theme.ownCloud.NotificationText.Content" 
+	    parent="@android:style/TextAppearance.StatusBar.EventContent" 
+	    />
+	
+</resources>

+ 2 - 0
res/values/strings.xml

@@ -167,6 +167,7 @@
 	<string name="auth_unsupported_auth_method">The server does not support this authentication method</string>    
 	<string name="auth_unsupported_multiaccount">%1$s does not support multiple accounts</string>
 	<string name="auth_fail_get_user_name">Your server is not returning a correct user id, please contact an administrator</string>
+	<string name="auth_can_not_auth_against_server">Can not authenticate against this server</string>
     
     <string name="fd_keep_in_sync">Keep file up to date</string>
     <string name="common_rename">Rename</string>
@@ -260,4 +261,5 @@
 
 	<string name="copy_link">Copy link</string>	
 	<string name="clipboard_text_copied">Copied to clipboard</string>
+	
 </resources>

+ 12 - 0
res/values/versioned_styles.xml

@@ -16,4 +16,16 @@
 	    <item name="android:indeterminateDrawable">@drawable/abs__progress_medium_holo</item>
 	</style>
 
+	<!-- Notifications -->
+	<style 	name="Theme.ownCloud.NotificationText.Title" 
+	    	parent="@android:style/TextAppearance">
+        <item name="android:textColor">#ff000000</item>
+		<item name="android:textSize">18sp</item>
+        <item name="android:textStyle">bold</item>
+	</style>
+	<style 	name="Theme.ownCloud.NotificationText.Content" 
+	    	parent="@android:style/TextAppearance">
+        <item name="android:textColor">#ff000000</item>
+		<item name="android:textSize">14sp</item>
+	</style>
 </resources>

+ 4 - 4
res/xml/preferences.xml

@@ -25,13 +25,13 @@
         android:title="@string/prefs_select_oc_account"
         android:summary="@string/prefs_summary_select_oc_account" 
         / -->
-    <Preference android:title="@string/prefs_manage_accounts" android:key="manage_account" />
-    <CheckBoxPreference android:title="@string/prefs_pincode" android:key="set_pincode" 
+    <com.owncloud.android.ui.PreferenceMultiline android:title="@string/prefs_manage_accounts" android:key="manage_account" />
+    <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:title="@string/prefs_pincode" android:key="set_pincode" 
                         android:summary="@string/prefs_pincode_summary"/>
-    <CheckBoxPreference android:key="instant_uploading" 
+    <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading" 
                         android:title="@string/prefs_instant_upload"  
                         android:summary="@string/prefs_instant_upload_summary"/>
-    <CheckBoxPreference android:dependency="instant_uploading" 
+    <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:dependency="instant_uploading" 
         				android:disableDependentsState="true" 
         				android:title="@string/instant_upload_on_wifi" 
         				android:key="instant_upload_on_wifi"/>

+ 177 - 113
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -63,6 +63,8 @@ import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
 import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
 import com.owncloud.android.lib.common.OwnCloudClientFactory;
 import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.operations.DetectAuthenticationMethodOperation;
+import com.owncloud.android.operations.DetectAuthenticationMethodOperation.AuthenticationMethod;
 import com.owncloud.android.operations.OAuth2GetAccessToken;
 
 import com.owncloud.android.lib.common.network.CertificateCombinedException;
@@ -73,7 +75,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
 import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
-
+
 import com.owncloud.android.ui.dialog.SamlWebViewDialog;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
@@ -87,8 +89,8 @@ import com.owncloud.android.lib.resources.status.OwnCloudVersion;
  * @author David A. Velasco
  */
 public class AuthenticatorActivity extends AccountAuthenticatorActivity
-    implements  OnRemoteOperationListener, OnFocusChangeListener, OnEditorActionListener, 
-    SsoWebViewClientListener, OnSslUntrustedCertListener {
+implements  OnRemoteOperationListener, OnFocusChangeListener, OnEditorActionListener, 
+SsoWebViewClientListener, OnSslUntrustedCertListener {
 
     private static final String TAG = AuthenticatorActivity.class.getSimpleName();
 
@@ -119,7 +121,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private static final String AUTH_ON = "on";
     private static final String AUTH_OFF = "off";
     private static final String AUTH_OPTIONAL = "optional";
-    
+
     private static final int DIALOG_LOGIN_PROGRESS = 0;
     private static final int DIALOG_CERT_NOT_SAVED = 1;
     private static final int DIALOG_OAUTH2_LOGIN_PROGRESS = 2;
@@ -128,7 +130,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     public static final byte ACTION_UPDATE_TOKEN = 1;
 
     private static final String TAG_SAML_DIALOG = "samlWebViewDialog";
-    
+
     private String mHostBaseUrl;
     private OwnCloudVersion mDiscoveredVersion;
 
@@ -151,31 +153,33 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private Account mAccount;
 
     private TextView mAuthMessage;
-    
+
     private EditText mHostUrlInput;
     private boolean mHostUrlInputEnabled;
     private View mRefreshButton;
 
     private String mAuthTokenType;
-    
+
     private EditText mUsernameInput;
     private EditText mPasswordInput;
-    
+
     private CheckBox mOAuth2Check;
-    
+
     private TextView mOAuthAuthEndpointText;
     private TextView mOAuthTokenEndpointText;
-    
+
     private SamlWebViewDialog mSamlDialog;
-    
+
     private View mOkButton;
-    
+
     private String mAuthToken;
-    
+
     private boolean mResumed; // Control if activity is resumed
 
     public static String DIALOG_UNTRUSTED_CERT = "DIALOG_UNTRUSTED_CERT";
 
+    private DetectAuthenticationMethodOperation mDetectAuthenticationOperation;
+
 
     /**
      * {@inheritDoc}
@@ -199,10 +203,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mOAuth2Check = (CheckBox) findViewById(R.id.oauth_onOff_check);
         mOkButton = findViewById(R.id.buttonOK);
         mAuthStatusLayout = (TextView) findViewById(R.id.auth_status_text); 
-        
+
         /// set Host Url Input Enabled
         mHostUrlInputEnabled = getResources().getBoolean(R.bool.show_server_url_input);
-        
+
         /// set visibility of link for new users
         boolean accountRegisterVisibility = getResources().getBoolean(R.bool.show_welcome_link);
         Button welcomeLink = (Button) findViewById(R.id.welcome_link);
@@ -222,7 +226,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mAccount = null;
         mHostBaseUrl = "";
         boolean refreshButtonEnabled = false;
-        
+
         // URL input configuration applied
         if (!mHostUrlInputEnabled)
         {
@@ -255,15 +259,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 mHostUrlInput.setText(mHostBaseUrl);
                 String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));
                 mUsernameInput.setText(userName);
-                
+
             }
             initAuthorizationMethod();  // checks intent and setup.xml to determine mCurrentAuthorizationMethod
             mJustCreated = true;
-            
+
             if (mAction == ACTION_UPDATE_TOKEN || !mHostUrlInputEnabled) {
                 checkOcServer(); 
             }
-            
+
         } else {
             mResumed = true;
             /// connection state and info
@@ -279,7 +283,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             if (savedInstanceState.getBoolean(KEY_PASSWORD_VISIBLE, false)) {
                 showPassword();
             }
-            
+
             /// server data
             String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);
             String ocVersionString = savedInstanceState.getString(KEY_OC_VERSION_STRING);
@@ -293,17 +297,17 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mAuthTokenType = savedInstanceState.getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE);
             if (mAuthTokenType == null) {
                 mAuthTokenType =  AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());
-                
+
             }
 
             // check if server check was interrupted by a configuration change
             if (savedInstanceState.getBoolean(KEY_SERVER_CHECK_IN_PROGRESS, false)) {
                 checkOcServer();
             }            
-            
+
             // refresh button enabled
             refreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);
-            
+
 
         }
 
@@ -316,7 +320,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         adaptViewAccordingToAuthenticationMethod();
         showServerStatus();
         showAuthStatus();
-        
+
         if (mAction == ACTION_UPDATE_TOKEN) {
             /// lock things that should not change
             mHostUrlInput.setEnabled(false);
@@ -325,7 +329,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mUsernameInput.setFocusable(false);
             mOAuth2Check.setVisibility(View.GONE);
         }
-        
+
         //if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled) showRefreshButton();
         if (mServerIsChecked && !mServerIsValid && refreshButtonEnabled) showRefreshButton();
         mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes
@@ -364,7 +368,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 mResumed = false;
             }
         });
-        
+
         mPasswordInput.setOnFocusChangeListener(this);
         mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
         mPasswordInput.setOnEditorActionListener(this);
@@ -377,7 +381,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 return true;
             }
         });
-        
+
         findViewById(R.id.scroll).setOnTouchListener(new OnTouchListener() {
             @Override
             public boolean onTouch(View view, MotionEvent event) {
@@ -391,8 +395,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             }
         });
     }
-    
-   
+
+
 
     private void initAuthorizationMethod() {
         boolean oAuthRequired = false;
@@ -400,15 +404,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 
         mAuthTokenType = getIntent().getExtras().getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE);
         mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);
-        
+
         // TODO could be a good moment to validate the received token type, if not null
-        
+
         if (mAuthTokenType == null) {    
             if (mAccount != null) {
                 /// same authentication method than the one used to create the account to update
                 oAuthRequired = (mAccountMgr.getUserData(mAccount, Constants.KEY_SUPPORTS_OAUTH2) != null);
                 samlWebSsoRequired = (mAccountMgr.getUserData(mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null);
-            
+
             } else {
                 /// use the one set in setup.xml
                 oAuthRequired = AUTH_ON.equals(getString(R.string.auth_method_oauth2));
@@ -422,14 +426,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 mAuthTokenType = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());
             }
         }
-    
+
         if (mAccount != null) {
             String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));
             mUsernameInput.setText(userName);
         }
-        
+
         mOAuth2Check.setChecked(AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(mAuthTokenType));
-        
+
     }
 
     /**
@@ -469,10 +473,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             outState.putParcelable(KEY_ACCOUNT, mAccount);
         }
         outState.putString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE, mAuthTokenType);
-        
+
         // refresh button enabled
         outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, (mRefreshButton.getVisibility() == View.VISIBLE));
-        
+
 
     }
 
@@ -519,7 +523,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         }
 
         mJustCreated = false;
-        
+
     }
 
 
@@ -590,11 +594,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 
     private void checkOcServer() {
         String uri = trimUrlWebdav(mHostUrlInput.getText().toString().trim());
-        
+
         if (!mHostUrlInputEnabled){
             uri = getString(R.string.server_url);
         }
-        
+
         mServerIsValid = false;
         mServerIsChecked = false;
         mOkButton.setEnabled(false);
@@ -648,7 +652,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private boolean isPasswordVisible() {
         return ((mPasswordInput.getInputType() & InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
     }
-    
+
     private void hidePasswordButton() {
         mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
     }
@@ -657,13 +661,13 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mPasswordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
         showViewPasswordButton();
     }
-    
+
     private void hidePassword() {
         mPasswordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
         showViewPasswordButton();
     }
-    
-    
+
+
     /**
      * Cancels the authenticator activity
      * 
@@ -747,7 +751,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mAuthStatusIcon = R.drawable.progress_small;
         mAuthStatusText = R.string.oauth_login_connection;
         showAuthStatus();
-        
+
 
         // GET AUTHORIZATION request
         //Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth));
@@ -775,7 +779,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mAuthStatusText = R.string.auth_connecting_auth_server;
         showAuthStatus();
         showDialog(DIALOG_LOGIN_PROGRESS);
-        
+
         /// get the path to the root folder through WebDAV from the version server
         String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, mAuthTokenType);
 
@@ -783,7 +787,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         mAuthCheckOperation = new  ExistenceCheckRemoteOperation("", this, false);
         OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, false);
         mOperationThread = mAuthCheckOperation.execute(client, this, mHandler);
-      
+
     }
 
     /**
@@ -803,28 +807,60 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         } else if (operation instanceof ExistenceCheckRemoteOperation)  {
             if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType)) {
                 onSamlBasedFederatedSingleSignOnAuthorizationStart(operation, result);
-                
+
             } else {
                 onAuthorizationCheckFinish((ExistenceCheckRemoteOperation)operation, result);
             }
         } else if (operation instanceof GetRemoteUserNameOperation) {
             onGetUserNameFinish((GetRemoteUserNameOperation) operation, result);
-             
+
+        } else if (operation instanceof DetectAuthenticationMethodOperation) {
+            onDetectAutheticationFinish((DetectAuthenticationMethodOperation) operation, result);
+        }
+
+    }
+
+    private void onDetectAutheticationFinish(DetectAuthenticationMethodOperation operation, RemoteOperationResult result) {
+        // Read authentication method
+        if (result.getData().size() > 0) {
+            AuthenticationMethod authMethod = (AuthenticationMethod) result.getData().get(0);
+            String basic = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());
+            String oAuth = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());
+            String saml =  AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType());
+
+            if ( ( mAuthTokenType.equals(basic) && !authMethod.equals(AuthenticationMethod.BASIC_HTTP_AUTH) ) ||
+                    ( mAuthTokenType.equals(oAuth) && !authMethod.equals(AuthenticationMethod.BEARER_TOKEN) ) || 
+                    ( mAuthTokenType.equals(saml)  && !authMethod.equals(AuthenticationMethod.SAML_WEB_SSO) ) ) {
+
+                mOkButton.setEnabled(false);
+                mServerIsValid = false;
+                //show an alert message ( Server Status )
+                updateServerStatusIconNoRegularAuth();
+                showServerStatus();
+
+            } else {
+                mOkButton.setEnabled(true);
+
+                // Show server status
+                showServerStatus();
+            }
+
         }
-        
     }
 
+
+
     private void onGetUserNameFinish(GetRemoteUserNameOperation operation, RemoteOperationResult result) {
-        
+
         if (result.isSuccess()) {
             boolean success = false;
             String username = operation.getUserName();
-            
+
             if ( mAction == ACTION_CREATE) {
                 mUsernameInput.setText(username);
                 success = createAccount();
             } else {
-                
+
                 if (!mUsernameInput.getText().toString().equals(username)) {
                     // fail - not a new account, but an existing one; disallow
                     result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME); 
@@ -832,11 +868,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                     showAuthStatus();
                     Log_OC.d(TAG, result.getLogMessage());
                 } else {
-                  updateToken();
-                  success = true;
+                    updateToken();
+                    success = true;
                 }
             }
-            
+
             if (success)
                 finish();
         } else {
@@ -844,7 +880,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             showAuthStatus();
             Log_OC.e(TAG, "Access to user name failed: " + result.getLogMessage());
         }
-        
+
     }
 
     private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperation operation, RemoteOperationResult result) {
@@ -853,23 +889,23 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         } 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.isTemporalRedirection() && result.isIdPRedirection()) {
         if (result.isIdPRedirection()) {
             String url = result.getRedirectedLocation();
             String targetUrl = mHostBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, mAuthTokenType);
-            
+
             // Show dialog
             mSamlDialog = SamlWebViewDialog.newInstance(url, targetUrl);            
             mSamlDialog.show(getSupportFragmentManager(), TAG_SAML_DIALOG);
-            
+
             mAuthStatusIcon = 0;
             mAuthStatusText = 0;
-            
+
         } else {
             mAuthStatusIcon = R.drawable.common_error;
             mAuthStatusText = R.string.auth_unsupported_auth_method;
-            
+
         }
         showAuthStatus();
     }
@@ -890,32 +926,54 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mIsSslConn = (result.getCode() == ResultCode.OK_SSL);
             mOcServerChkOperation = null;
 
+
+            /// retrieve discovered version and normalize server URL
+            mDiscoveredVersion = operation.getDiscoveredVersion();
+            mHostBaseUrl = normalizeUrl(mHostUrlInput.getText().toString());
+
+            // Refresh server status, but don't show it
+            updateServerStatusIconAndText(result);
+
             /// update status icon and text
             if (mServerIsValid) {
                 hideRefreshButton();
+                // Try to create an account with user and pass "", to know if it is a regular server
+                // Update connect button in the answer of this method
+                detectAuthorizationMethod();
             } else {
                 showRefreshButton();
+                // Show server status
+                showServerStatus();
             }
-            updateServerStatusIconAndText(result);
-            showServerStatus();
 
             /// very special case (TODO: move to a common place for all the remote operations)
             if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {
                 showUntrustedCertDialog(result);
             }
 
-            /// retrieve discovered version and normalize server URL
-            mDiscoveredVersion = operation.getDiscoveredVersion();
-            mHostBaseUrl = normalizeUrl(mHostUrlInput.getText().toString());
 
-            /// allow or not the user try to access the server
-            mOkButton.setEnabled(mServerIsValid);
-            
         }   // else nothing ; only the last check operation is considered; 
         // multiple can be triggered if the user amends a URL before a previous check can be triggered
     }
 
 
+    /**
+     *  Try to access with  user/pass ""/"", to know if it is a regular server
+     */
+    private void detectAuthorizationMethod() {
+
+        Log_OC.d(TAG, "Trying empty authorization to detect authentication method");
+
+        /// get the path to the root folder through WebDAV from the version server
+        String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, mAuthTokenType);
+
+        /// test credentials 
+        mDetectAuthenticationOperation = new DetectAuthenticationMethodOperation(this);
+        OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, true);
+        mOperationThread = mDetectAuthenticationOperation.execute(client, this, mHandler);
+    }
+
+
     private String normalizeUrl(String url) {
         if (url != null && url.length() > 0) {
             url = url.trim();
@@ -950,8 +1008,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         } 
         return (url != null ? url : "");
     }
-    
-    
+
+
     /**
      * Chooses the right icon and text to show to the user for the received operation result.
      * 
@@ -1113,10 +1171,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 
 
     private void updateStatusIconFailUserName(){
-        mAuthStatusIcon = android.R.drawable.ic_secure;
+        mAuthStatusIcon = R.drawable.common_error;
         mAuthStatusText = R.string.auth_fail_get_user_name;
     }
-    
+
+    private void updateServerStatusIconNoRegularAuth(){
+        mServerStatusIcon = R.drawable.common_error;
+        mServerStatusText = R.string.auth_can_not_auth_against_server;
+    }
+
     /**
      * Processes the result of the request for and access token send 
      * to an OAuth authorization server.
@@ -1182,8 +1245,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             if (success) {
                 finish();
             }
-
-        } else if (result.isServerFail() || result.isException()) {
+            
+        } else if (result.isServerFail() || result.isException()) {
             /// if server fail or exception in authorization, the UI is updated as when a server check failed
             mServerIsChecked = true;
             mServerIsValid = false;
@@ -1198,7 +1261,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mAuthStatusIcon = 0;
             mAuthStatusText = 0;
             showAuthStatus();
-            
+
             // update input controls state
             showRefreshButton();
             mOkButton.setEnabled(false);
@@ -1213,10 +1276,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             showAuthStatus();
             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.
@@ -1225,24 +1289,24 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         Bundle response = new Bundle();
         response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name);
         response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);
-        
+
         if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(mAuthTokenType)) { 
             response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);
             // the next line is necessary; by now, notifications are calling directly to the AuthenticatorActivity to update, without AccountManager intervention
             mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);
-            
+
         } else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType)) {
-            
+
             response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);
             // the next line is necessary; by now, notifications are calling directly to the AuthenticatorActivity to update, without AccountManager intervention
             mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);
-            
+
         } else {
             response.putString(AccountManager.KEY_AUTHTOKEN, mPasswordInput.getText().toString());
             mAccountMgr.setPassword(mAccount, mPasswordInput.getText().toString());
         }
         setAccountAuthenticatorResult(response);
-        
+
     }
 
 
@@ -1275,15 +1339,15 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             showAuthStatus();
             Log_OC.d(TAG, result.getLogMessage());
             return false;
-            
+
         } else {
-        
+
             if (isOAuth || isSaml) {
                 mAccountMgr.addAccountExplicitly(mAccount, "", null);  // with external authorizations, 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) {
@@ -1292,7 +1356,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 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();       
@@ -1308,16 +1372,16 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION,         mDiscoveredVersion.getVersion());
             mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION_STRING,  mDiscoveredVersion.getVersionString());
             mAccountMgr.setUserData(mAccount, Constants.KEY_OC_BASE_URL,   mHostBaseUrl);
-            
+
             if (isSaml) {
                 mAccountMgr.setUserData(mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO, "TRUE"); 
             } else if (isOAuth) {
                 mAccountMgr.setUserData(mAccount, Constants.KEY_SUPPORTS_OAUTH2, "TRUE");  
             }
-    
+
             setAccountAuthenticatorResult(intent.getExtras());
             setResult(RESULT_OK, intent);
-    
+
             return true;
         }
     }
@@ -1472,8 +1536,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     public void onRefreshClick(View view) {
         checkOcServer();
     }
-    
-    
+
+
     /**
      * Called when the eye icon in the password field is clicked.
      * 
@@ -1508,7 +1572,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         adaptViewAccordingToAuthenticationMethod();
     }
 
-    
+
     /**
      * Changes the visibility of input elements depending on
      * the current authorization method.
@@ -1520,7 +1584,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mOAuthTokenEndpointText.setVisibility(View.VISIBLE);
             mUsernameInput.setVisibility(View.GONE);
             mPasswordInput.setVisibility(View.GONE);
-            
+
         } else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType)) {
             // SAML-based web Single Sign On
             mOAuthAuthEndpointText.setVisibility(View.GONE);
@@ -1535,7 +1599,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             mPasswordInput.setVisibility(View.VISIBLE);
         }
     }
-    
+
     /**
      *  Called when the 'action' button in an IME is pressed ('enter' in software keyboard).
      * 
@@ -1548,7 +1612,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             if (mOkButton.isEnabled()) {
                 mOkButton.performClick();
             }
-            
+
         } else if (actionId == EditorInfo.IME_ACTION_NEXT && inputField != null && inputField.equals(mHostUrlInput)) {
             if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType)) {
                 checkOcServer();
@@ -1561,7 +1625,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private abstract static class RightDrawableOnTouchListener implements OnTouchListener  {
 
         private int fuzz = 75;
-        
+
         /**
          * {@inheritDoc}
          */
@@ -1579,8 +1643,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 final int y = (int) event.getY();
                 final Rect bounds = rightDrawable.getBounds();
                 if (x >= (view.getRight() - bounds.width() - fuzz) && x <= (view.getRight() - view.getPaddingRight() + fuzz)
-                    && y >= (view.getPaddingTop() - fuzz) && y <= (view.getHeight() - view.getPaddingBottom()) + fuzz) {
-                    
+                        && y >= (view.getPaddingTop() - fuzz) && y <= (view.getHeight() - view.getPaddingBottom()) + fuzz) {
+
                     return onDrawableTouch(event);
                 }
             }
@@ -1593,7 +1657,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 
     public void onSamlDialogSuccess(String sessionCookie) {
         mAuthToken = sessionCookie;
-        
+
         if (sessionCookie != null && sessionCookie.length() > 0) {
             mAuthToken = sessionCookie;
 
@@ -1603,7 +1667,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             getUserOperation.execute(client, this, mHandler);
         }
 
-            
+
     }
 
 
@@ -1626,18 +1690,18 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             // TODO - show fail
             Log_OC.d(TAG, "SSO failed");
         }
-    
+
     }
-    
+
     /** Show auth_message 
      * 
      * @param message
      */
     private void showAuthMessage(String message) {
-       mAuthMessage.setVisibility(View.VISIBLE);
-       mAuthMessage.setText(message);
+        mAuthMessage.setVisibility(View.VISIBLE);
+        mAuthMessage.setText(message);
     }
-    
+
     private void hideAuthMessage() {
         mAuthMessage.setVisibility(View.GONE);
     }
@@ -1668,7 +1732,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         ft.addToBackStack(null);
         dialog.show(ft, DIALOG_UNTRUSTED_CERT);
     }
-    
+
     /**
      * Show untrusted cert dialog 
      */
@@ -1679,9 +1743,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         FragmentTransaction ft = fm.beginTransaction();
         ft.addToBackStack(null);
         dialog.show(ft, DIALOG_UNTRUSTED_CERT);
-        
+
     }
-    
+
     /**
      * Dismiss untrusted cert dialog
      */
@@ -1691,9 +1755,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             SslErrorViewAdapter dialog = (SslErrorViewAdapter) frag;
             dialog.dismiss();
         }
-        */
+         */
     }
-    
+
     /**
      * Called from SslValidatorDialog when a new server certificate was correctly saved.
      */
@@ -1719,7 +1783,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     public void onCancelCertificate() {
         cancelWebView();
     }
-    
+
 
     public void cancelWebView() {
         Fragment fd = getSupportFragmentManager().findFragmentByTag(TAG_SAML_DIALOG);
@@ -1729,7 +1793,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 d.dismiss();
             }
         }
-        
+
     }
 
 }

+ 0 - 156
src/com/owncloud/android/files/managers/OCNotificationManager.java

@@ -1,156 +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 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.files.managers;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.owncloud.android.R;
-import com.owncloud.android.utils.DisplayUtils;
-
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.content.Context;
-import android.widget.RemoteViews;
-
-
-public class OCNotificationManager {
-
-    enum NotificationType {
-        NOTIFICATION_SIMPLE,
-        NOTIFICATION_PROGRESS
-    }
-    
-    static public class NotificationData {
-        private String mText, mSubtitle;
-        private int mPercent;
-        private boolean mOngoing;
-
-        public NotificationData(String text, String subtitle, boolean ongoing) {
-            this(text, subtitle, -1, ongoing);
-        }
-        
-        public NotificationData(int percent, boolean ongoing) {
-            this(null, null, percent, ongoing);
-        }
-        
-        public NotificationData(String text, int percent, boolean ongoing) {
-            this(text, null, percent, ongoing);
-        }
-        
-        public NotificationData(String text, String subtitle, int percent, boolean ongoing) {
-            mText = text;
-            mPercent = percent;
-            mSubtitle = subtitle;
-            mOngoing = ongoing;
-        }
-        
-        public String getText() { return mText; }
-        public int getPercent() { return mPercent; }
-        public String getSubtitle() { return mSubtitle; }
-        public boolean getOngoing() { return mOngoing; }
-    }
-    
-    static private OCNotificationManager mInstance = null;
-
-    private class NotificationTypePair {
-        public Notification mNotificaiton;
-        public NotificationType mType;
-        public NotificationTypePair(Notification n, NotificationType type) {
-            mNotificaiton = n;
-            mType = type;
-        }
-    }
-    
-    private Context mContext;
-    private Map<Integer, NotificationTypePair> mNotificationMap;
-    private int mNotificationCounter;
-    NotificationManager mNM;
-    
-    static OCNotificationManager getInstance(Context context) {
-        if (mInstance == null)
-            mInstance = new OCNotificationManager(context);
-        return mInstance;
-    }
-    
-    OCNotificationManager(Context context) {
-        mContext = context;
-        mNotificationMap = new HashMap<Integer, NotificationTypePair>();
-        mNM = (NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE);
-        mNotificationCounter = 0;
-    }
-    
-    public int postNotification(NotificationType type, NotificationData data) {
-        mNotificationCounter++;
-        Notification notification = null;
-        
-        switch (type) {
-            case NOTIFICATION_SIMPLE:
-                notification = new Notification(DisplayUtils.getSeasonalIconId(), data.getText(), System.currentTimeMillis());
-                break;
-            case NOTIFICATION_PROGRESS:
-                notification = new Notification();
-                notification.contentView = new RemoteViews(mContext.getPackageName(), R.layout.progressbar_layout);
-                notification.contentView.setTextViewText(R.id.status_text,
-                                                         data.getText());
-                notification.contentView.setImageViewResource(R.id.status_icon,
-                                                              R.id.icon);
-                notification.contentView.setProgressBar(R.id.status_progress,
-                                                        100,
-                                                        data.getPercent(),
-                                                        false);
-                break;
-            default:
-                return -1;
-        }
-        if (data.getOngoing()) {
-            notification.flags |= notification.flags | Notification.FLAG_ONGOING_EVENT;
-        }
-        
-        mNotificationMap.put(mNotificationCounter, new NotificationTypePair(notification, type));
-        return mNotificationCounter;
-    }
-    
-    public boolean updateNotification(int notification_id, NotificationData data) {
-        if (!mNotificationMap.containsKey(notification_id)) {
-            return false;
-        }
-        NotificationTypePair pair = mNotificationMap.get(notification_id);
-        switch (pair.mType) {
-            case NOTIFICATION_PROGRESS:
-                pair.mNotificaiton.contentView.setProgressBar(R.id.status_text,
-                                                              100,
-                                                              data.getPercent(),
-                                                              false);
-                return true;
-            case NOTIFICATION_SIMPLE:
-                pair.mNotificaiton = new Notification(DisplayUtils.getSeasonalIconId(),
-                                                      data.getText(), System.currentTimeMillis());
-                mNM.notify(notification_id, pair.mNotificaiton);
-                return true;
-            default:
-                return false;
-        }
-    }
-    
-    public void discardNotification(int notification_id) {
-        mNM.cancel(notification_id);
-        mNotificationMap.remove(notification_id);
-    }
-}

+ 41 - 26
src/com/owncloud/android/files/services/FileDownloader.java

@@ -44,12 +44,11 @@ import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.ui.preview.PreviewImageActivity;
 import com.owncloud.android.ui.preview.PreviewImageFragment;
-import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.Log_OC;
+import com.owncloud.android.utils.NotificationBuilderWithProgressBar;
 
 import android.accounts.Account;
 import android.accounts.AccountsException;
-import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
@@ -61,7 +60,7 @@ import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
 import android.os.Process;
-import android.widget.RemoteViews;
+import android.support.v4.app.NotificationCompat;
 
 public class FileDownloader extends Service implements OnDatatransferProgressListener {
     
@@ -88,7 +87,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
     private DownloadFileOperation mCurrentDownload = null;
     
     private NotificationManager mNotificationManager;
-    private Notification mNotification;
+    private NotificationCompat.Builder mNotificationBuilder;
     private int mLastPercent;
     
     
@@ -404,13 +403,19 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
     private void notifyDownloadStart(DownloadFileOperation download) {
         /// create status notification with a progress bar
         mLastPercent = 0;
-        mNotification = new Notification(DisplayUtils.getSeasonalIconId(), getString(R.string.downloader_download_in_progress_ticker), System.currentTimeMillis());
-        mNotification.flags |= Notification.FLAG_ONGOING_EVENT;
-        mNotification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.progressbar_layout);
-        mNotification.contentView.setProgressBar(R.id.status_progress, 100, 0, download.getSize() < 0);
-        mNotification.contentView.setTextViewText(R.id.status_text, String.format(getString(R.string.downloader_download_in_progress_content), 0, new File(download.getSavePath()).getName()));
-        mNotification.contentView.setImageViewResource(R.id.status_icon, DisplayUtils.getSeasonalIconId());
-        
+        mNotificationBuilder = 
+                NotificationBuilderWithProgressBar.newNotificationBuilderWithProgressBar(this);
+        mNotificationBuilder
+                .setSmallIcon(R.drawable.notification_icon)
+                .setTicker(getString(R.string.downloader_download_in_progress_ticker))
+                .setContentTitle(getString(R.string.downloader_download_in_progress_ticker))
+                .setOngoing(true)
+                .setProgress(100, 0, download.getSize() < 0)
+                .setContentText(
+                        String.format(getString(R.string.downloader_download_in_progress_content), 0,
+                                new File(download.getSavePath()).getName())
+                );
+                
         /// includes a pending intent in the notification showing the details view of the file
         Intent showDetailsIntent = null;
         if (PreviewImageFragment.canBePreviewed(download.getFile())) {
@@ -421,9 +426,12 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, download.getFile());
         showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, download.getAccount());
         showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-        mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), (int)System.currentTimeMillis(), showDetailsIntent, 0);
         
-        mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotification);
+        mNotificationBuilder.setContentIntent(PendingIntent.getActivity(
+            this, (int) System.currentTimeMillis(), showDetailsIntent, 0
+        ));
+
+        mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotificationBuilder.build());
     }
 
     
@@ -434,11 +442,11 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
     public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer, String filePath) {
         int percent = (int)(100.0*((double)totalTransferredSoFar)/((double)totalToTransfer));
         if (percent != mLastPercent) {
-            mNotification.contentView.setProgressBar(R.id.status_progress, 100, percent, totalToTransfer < 0);
+            mNotificationBuilder.setProgress(100, percent, totalToTransfer < 0);
             String fileName = filePath.substring(filePath.lastIndexOf(FileUtils.PATH_SEPARATOR) + 1);
             String text = String.format(getString(R.string.downloader_download_in_progress_content), percent, fileName);
-            mNotification.contentView.setTextViewText(R.id.status_text, text);
-            mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotification);
+            mNotificationBuilder.setContentText(text);
+            mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotificationBuilder.build());
         }
         mLastPercent = percent;
     }
@@ -455,8 +463,12 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
         if (!downloadResult.isCancelled()) {
             int tickerId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_ticker : R.string.downloader_download_failed_ticker;
             int contentId = (downloadResult.isSuccess()) ? R.string.downloader_download_succeeded_content : R.string.downloader_download_failed_content;
-            Notification finalNotification = new Notification(DisplayUtils.getSeasonalIconId(), getString(tickerId), System.currentTimeMillis());
-            finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;
+            mNotificationBuilder
+                .setTicker(getString(tickerId))
+                .setContentTitle(getString(tickerId))
+                .setAutoCancel(true)
+                .setOngoing(false)
+                .setProgress(0, 0, false);
             boolean needsToUpdateCredentials = (downloadResult.getCode() == ResultCode.UNAUTHORIZED ||
                                                 // (downloadResult.isTemporalRedirection() && downloadResult.isIdPRedirection()
                                                   (downloadResult.isIdPRedirection()
@@ -471,11 +483,11 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                 updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);
-                finalNotification.contentIntent = PendingIntent.getActivity(this, (int)System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT);
-                finalNotification.setLatestEventInfo(   getApplicationContext(), 
-                                                        getString(tickerId), 
-                                                        String.format(getString(contentId), new File(download.getSavePath()).getName()),
-                                                        finalNotification.contentIntent);
+                mNotificationBuilder
+                    .setContentIntent(PendingIntent.getActivity(
+                        this, (int) System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT
+                    ))
+                    .setContentText(String.format(getString(contentId), new File(download.getSavePath()).getName()));
                 mDownloadClient = null;   // grant that future retries on the same account will get the fresh credentials
                 
             } else {
@@ -494,10 +506,13 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
                     // TODO put something smart in showDetailsIntent
                     showDetailsIntent = new Intent();
                 }
-                finalNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), (int)System.currentTimeMillis(), showDetailsIntent, 0);
-                finalNotification.setLatestEventInfo(getApplicationContext(), getString(tickerId), String.format(getString(contentId), new File(download.getSavePath()).getName()), finalNotification.contentIntent);
+                mNotificationBuilder
+                    .setContentIntent(PendingIntent.getActivity(
+                        this, (int) System.currentTimeMillis(), showDetailsIntent, 0
+                    ))
+                    .setContentText(String.format(getString(contentId), new File(download.getSavePath()).getName()));  
             }
-            mNotificationManager.notify(tickerId, finalNotification);
+            mNotificationManager.notify(tickerId, mNotificationBuilder.build());
         }
     }
     

+ 55 - 56
src/com/owncloud/android/files/services/FileUploader.java

@@ -53,13 +53,12 @@ import com.owncloud.android.ui.activity.FileDisplayActivity;
 import com.owncloud.android.ui.activity.InstantUploadActivity;
 import com.owncloud.android.ui.preview.PreviewImageActivity;
 import com.owncloud.android.ui.preview.PreviewImageFragment;
-import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.Log_OC;
+import com.owncloud.android.utils.NotificationBuilderWithProgressBar;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AccountsException;
-import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
@@ -71,8 +70,8 @@ import android.os.IBinder;
 import android.os.Looper;
 import android.os.Message;
 import android.os.Process;
+import android.support.v4.app.NotificationCompat;
 import android.webkit.MimeTypeMap;
-import android.widget.RemoteViews;
 
 
 
@@ -117,9 +116,8 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     private UploadFileOperation mCurrentUpload = null;
 
     private NotificationManager mNotificationManager;
-    private Notification mNotification;
+    private NotificationCompat.Builder mNotificationBuilder;
     private int mLastPercent;
-    private RemoteViews mDefaultNotificationContentView;
 
     
     public static String getUploadFinishMessage() {
@@ -678,30 +676,30 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
      * 
      * @param upload Upload operation starting.
      */
-    @SuppressWarnings("deprecation")
     private void notifyUploadStart(UploadFileOperation upload) {
         // / create status notification with a progress bar
         mLastPercent = 0;
-        mNotification = new Notification(DisplayUtils.getSeasonalIconId(), getString(R.string.uploader_upload_in_progress_ticker),
-                System.currentTimeMillis());
-        mNotification.flags |= Notification.FLAG_ONGOING_EVENT;
-        mDefaultNotificationContentView = mNotification.contentView;
-        mNotification.contentView = new RemoteViews(getApplicationContext().getPackageName(),
-                R.layout.progressbar_layout);
-        mNotification.contentView.setProgressBar(R.id.status_progress, 100, 0, false);
-        mNotification.contentView.setTextViewText(R.id.status_text,
-                String.format(getString(R.string.uploader_upload_in_progress_content), 0, upload.getFileName()));
-        mNotification.contentView.setImageViewResource(R.id.status_icon, DisplayUtils.getSeasonalIconId());
-        
+        mNotificationBuilder = 
+                NotificationBuilderWithProgressBar.newNotificationBuilderWithProgressBar(this);
+        mNotificationBuilder
+                .setOngoing(true)
+                .setSmallIcon(R.drawable.notification_icon)
+                .setTicker(getString(R.string.uploader_upload_in_progress_ticker))
+                .setContentTitle(getString(R.string.uploader_upload_in_progress_ticker))
+                .setProgress(100, 0, false)
+                .setContentText(
+                        String.format(getString(R.string.uploader_upload_in_progress_content), 0, upload.getFileName()));
+
         /// includes a pending intent in the notification showing the details view of the file
         Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class);
         showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, upload.getFile());
         showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, upload.getAccount());
         showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-        mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(),
-                (int) System.currentTimeMillis(), showDetailsIntent, 0);
+        mNotificationBuilder.setContentIntent(PendingIntent.getActivity(
+            this, (int) System.currentTimeMillis(), showDetailsIntent, 0
+        ));
 
-        mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotification);
+        mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build());
     }
 
     /**
@@ -711,11 +709,11 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
     public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer, String filePath) {
         int percent = (int) (100.0 * ((double) totalTransferredSoFar) / ((double) totalToTransfer));
         if (percent != mLastPercent) {
-            mNotification.contentView.setProgressBar(R.id.status_progress, 100, percent, false);
+            mNotificationBuilder.setProgress(100, percent, false);
             String fileName = filePath.substring(filePath.lastIndexOf(FileUtils.PATH_SEPARATOR) + 1);
             String text = String.format(getString(R.string.uploader_upload_in_progress_content), percent, fileName);
-            mNotification.contentView.setTextViewText(R.id.status_text, text);
-            mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotification);
+            mNotificationBuilder.setContentText(text);
+            mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build());
         }
         mLastPercent = percent;
     }
@@ -735,12 +733,10 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
         } else if (uploadResult.isSuccess()) {
             // / success -> silent update of progress notification to success
             // message
-            mNotification.flags ^= Notification.FLAG_ONGOING_EVENT; // remove
-                                                                    // the
-                                                                    // ongoing
-                                                                    // flag
-            mNotification.flags |= Notification.FLAG_AUTO_CANCEL;
-            mNotification.contentView = mDefaultNotificationContentView;
+            mNotificationBuilder
+                .setOngoing(false)
+                .setAutoCancel(true)
+                .setProgress(0, 0, false);
             
             /// includes a pending intent in the notification showing the details view of the file
             Intent showDetailsIntent = null;
@@ -751,18 +747,20 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
             }
             showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, upload.getFile());
             showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, upload.getAccount());
-            showDetailsIntent.putExtra(FileActivity.EXTRA_FROM_NOTIFICATION, true);
-            showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-            mNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(),
-                    (int) System.currentTimeMillis(), showDetailsIntent, 0);
-
-            mNotification.setLatestEventInfo(getApplicationContext(),
-                    getString(R.string.uploader_upload_succeeded_ticker),
-                    String.format(getString(R.string.uploader_upload_succeeded_content_single), upload.getFileName()),
-                    mNotification.contentIntent);
-
-            mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotification); // NOT
-                                                                                                     // AN
+            showDetailsIntent.putExtra(FileActivity.EXTRA_FROM_NOTIFICATION, true);;
+            mNotificationBuilder
+                .setContentIntent(PendingIntent.getActivity(
+                        this, (int) System.currentTimeMillis(), showDetailsIntent, 0
+                ))
+                .setTicker(getString(R.string.uploader_upload_succeeded_ticker))
+                .setContentTitle(getString(R.string.uploader_upload_succeeded_ticker))
+                .setContentText(
+                        String.format(getString(R.string.uploader_upload_succeeded_content_single),
+                        upload.getFileName())
+                );
+
+            mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotificationBuilder.build());  // NOT
+                                                                                                                     // AN
             DbHandler db = new DbHandler(this.getBaseContext());
             db.removeIUPendingFile(mCurrentUpload.getOriginalStoragePath());
             db.close();
@@ -771,9 +769,12 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
             // / fail -> explicit failure notification
             mNotificationManager.cancel(R.string.uploader_upload_in_progress_ticker);
-            Notification finalNotification = new Notification(DisplayUtils.getSeasonalIconId(),
-                    getString(R.string.uploader_upload_failed_ticker), System.currentTimeMillis());
-            finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;
+            NotificationCompat.Builder errorBuilder = new NotificationCompat.Builder(this);
+            errorBuilder
+                .setSmallIcon(R.drawable.notification_icon)
+                .setTicker(getString(R.string.uploader_upload_failed_ticker))
+                .setContentTitle(getString(R.string.uploader_upload_failed_ticker))
+                .setAutoCancel(true);
             String content = null;
             
             boolean needsToUpdateCredentials = (uploadResult.getCode() == ResultCode.UNAUTHORIZED ||
@@ -790,15 +791,13 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                 updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);
-                finalNotification.contentIntent = PendingIntent.getActivity(this, (int)System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT);
+                errorBuilder.setContentIntent(PendingIntent.getActivity(
+                    this, (int) System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT
+                ));
                 content =  String.format(getString(R.string.uploader_upload_failed_content_single), upload.getFileName());
-                finalNotification.setLatestEventInfo(getApplicationContext(),
-                        getString(R.string.uploader_upload_failed_ticker), content, finalNotification.contentIntent);
                 mUploadClient = null;   // grant that future retries on the same account will get the fresh credentials
             } else {
                 // TODO put something smart in the contentIntent below
-            //    finalNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
-            //}
             
                 if (uploadResult.getCode() == ResultCode.LOCAL_STORAGE_FULL
                         || uploadResult.getCode() == ResultCode.LOCAL_STORAGE_NOT_COPIED) {
@@ -823,10 +822,12 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                     detailUploadIntent = new Intent(this, FailedUploadActivity.class);
                     detailUploadIntent.putExtra(FailedUploadActivity.MESSAGE, content);
                 }
-                finalNotification.contentIntent = PendingIntent.getActivity(getApplicationContext(),
-                        (int) System.currentTimeMillis(), detailUploadIntent, PendingIntent.FLAG_UPDATE_CURRENT
-                        | PendingIntent.FLAG_ONE_SHOT);
-
+                errorBuilder
+                    .setContentIntent(PendingIntent.getActivity(
+                        this, (int) System.currentTimeMillis(), detailUploadIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT
+                    ))
+                    .setContentText(content);
+    
                 if (upload.isInstant()) {
                     DbHandler db = null;
                     try {
@@ -847,10 +848,8 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                     }
                 }
             }
-            finalNotification.setLatestEventInfo(getApplicationContext(),
-                    getString(R.string.uploader_upload_failed_ticker), content, finalNotification.contentIntent);
             
-            mNotificationManager.notify(R.string.uploader_upload_failed_ticker, finalNotification);
+            mNotificationManager.notify(R.string.uploader_upload_failed_ticker, errorBuilder.build());
         }
 
     }

+ 41 - 29
src/com/owncloud/android/operations/CreateShareOperation.java

@@ -30,7 +30,9 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.resources.shares.OCShare;
+import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
 import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.lib.resources.shares.CreateRemoteShareOperation;
 import com.owncloud.android.lib.resources.files.FileUtils;
@@ -40,6 +42,7 @@ import com.owncloud.android.utils.Log_OC;
 public class CreateShareOperation extends SyncOperation {
 
     private static final String TAG = CreateShareOperation.class.getSimpleName();
+    
 
     protected FileDataStorageManager mStorageManager;
 
@@ -83,39 +86,24 @@ public class CreateShareOperation extends SyncOperation {
 
     @Override
     protected RemoteOperationResult run(OwnCloudClient client) {
-        CreateRemoteShareOperation operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload, mPassword, mPermissions);
-        RemoteOperationResult result = operation.execute(client);
-
+        RemoteOperation operation = null;
+        
+        // Check if the share link already exists
+        operation = new GetRemoteSharesForFileOperation(mPath, false, false);
+        RemoteOperationResult result = ((GetRemoteSharesForFileOperation)operation).execute(client);
+
+        if (!result.isSuccess() || result.getData().size() <= 0) {
+            operation = new CreateRemoteShareOperation(mPath, mShareType, mShareWith, mPublicUpload, mPassword, mPermissions);
+            result = ((CreateRemoteShareOperation)operation).execute(client);
+        }
+        
         if (result.isSuccess()) {
-
             if (result.getData().size() > 0) {
                 OCShare share = (OCShare) result.getData().get(0);
-
-                // Update DB with the response
-                share.setPath(mPath);
-                if (mPath.endsWith(FileUtils.PATH_SEPARATOR)) {
-                    share.setIsFolder(true);
-                } else {
-                    share.setIsFolder(false);
-                }
-                share.setPermissions(mPermissions);
-                
-                getStorageManager().saveShare(share);
-                
-                // Update OCFile with data from share: ShareByLink  and publicLink
-                OCFile file = getStorageManager().getFileByPath(mPath);
-                if (file!=null) {
-                    mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink());
-                    file.setPublicLink(share.getShareLink());
-                    file.setShareByLink(true);
-                    getStorageManager().saveFile(file);
-                    Log_OC.d(TAG, "Public Link = " + file.getPublicLink());
-
-                }
-            }
+                updateData(share);
+            } 
         }
-
-
+        
         return result;
     }
     
@@ -123,5 +111,29 @@ public class CreateShareOperation extends SyncOperation {
     public Intent getSendIntent() {
         return mSendIntent;
     }
+    
+    private void updateData(OCShare share) {
+        // Update DB with the response
+        share.setPath(mPath);
+        if (mPath.endsWith(FileUtils.PATH_SEPARATOR)) {
+            share.setIsFolder(true);
+        } else {
+            share.setIsFolder(false);
+        }
+        share.setPermissions(mPermissions);
+        
+        getStorageManager().saveShare(share);
+        
+        // Update OCFile with data from share: ShareByLink  and publicLink
+        OCFile file = getStorageManager().getFileByPath(mPath);
+        if (file!=null) {
+            mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink());
+            file.setPublicLink(share.getShareLink());
+            file.setShareByLink(true);
+            getStorageManager().saveFile(file);
+            Log_OC.d(TAG, "Public Link = " + file.getPublicLink());
+
+        }
+    }
 
 }

+ 145 - 0
src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java

@@ -0,0 +1,145 @@
+/* ownCloud Android Library is available under MIT license
+ *   Copyright (C) 2014 ownCloud Inc.
+ *   
+ *   Permission is hereby granted, free of charge, to any person obtaining a copy
+ *   of this software and associated documentation files (the "Software"), to deal
+ *   in the Software without restriction, including without limitation the rights
+ *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ *   copies of the Software, and to permit persons to whom the Software is
+ *   furnished to do so, subject to the following conditions:
+ *   
+ *   The above copyright notice and this permission notice shall be included in
+ *   all copies or substantial portions of the Software.
+ *   
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 
+ *   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
+ *   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
+ *   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ *   THE SOFTWARE.
+ *
+ */
+
+package com.owncloud.android.operations;
+
+import java.util.ArrayList;
+
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
+import com.owncloud.android.lib.common.operations.RemoteOperation;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
+
+import android.content.Context;
+import android.net.Uri;
+import android.util.Log;
+
+/**
+ * Operation to find out what authentication method requires
+ * the server to access files.
+ * 
+ * Basically, tries to access to the root folder without authorization
+ * and analyzes the response.
+ * 
+ * When successful, the instance of {@link RemoteOperationResult} passed
+ * through {@link OnRemoteOperationListener#onRemoteOperationFinish(RemoteOperation, 
+ * RemoteOperationResult)} returns in {@link RemoteOperationResult#getData()}
+ * a value of {@link AuthenticationMethod}. 
+ * 
+ * @author David A. Velasco
+ */
+public class DetectAuthenticationMethodOperation extends RemoteOperation {
+    
+    private static final String TAG = DetectAuthenticationMethodOperation.class.getSimpleName();
+    
+    public enum AuthenticationMethod {
+        UNKNOWN,
+        NONE,
+        BASIC_HTTP_AUTH, 
+        SAML_WEB_SSO,
+        BEARER_TOKEN
+    }
+    
+    private Context mContext;
+    
+    /**
+     * Constructor
+     * 
+     * @param context       Android context of the caller.
+     */
+    public DetectAuthenticationMethodOperation(Context context) {
+        mContext = context;
+    }
+    
+
+    /**
+     *  Performs the operation.
+     * 
+     *  Triggers a check of existence on the root folder of the server, granting
+     *  that the request is not authenticated.
+     *  
+     *  Analyzes the result of check to find out what authentication method, if
+     *  any, is requested by the server.
+     */
+	@Override
+	protected RemoteOperationResult run(OwnCloudClient client) {
+        RemoteOperationResult result = null;
+        AuthenticationMethod authMethod = AuthenticationMethod.UNKNOWN;
+        
+        RemoteOperation operation = new ExistenceCheckRemoteOperation("", mContext, false);
+        client.setBasicCredentials("", "");
+        client.setFollowRedirects(false);
+        
+        // try to access the root folder, following redirections but not SAML SSO redirections
+        result = operation.execute(client);
+        while (result.isTemporalRedirection() && !result.isIdPRedirection()) {
+            client.setWebdavUri(Uri.parse(result.getRedirectedLocation()));
+            result = operation.execute(client);
+        } 
+
+        // analyze response  
+        if (result.getCode() == ResultCode.UNAUTHORIZED) {
+            String authRequest = ((result.getAuthenticateHeader()).trim()).toLowerCase();
+            if (authRequest.startsWith("basic")) {
+                authMethod = AuthenticationMethod.BASIC_HTTP_AUTH;
+                
+            } else if (authRequest.startsWith("bearer")) {
+                authMethod = AuthenticationMethod.BEARER_TOKEN;
+            }
+            // else - fall back to UNKNOWN
+                    
+        } else if (result.isSuccess()) {
+            authMethod = AuthenticationMethod.NONE;
+            
+        } else if (result.isIdPRedirection()) {
+            authMethod = AuthenticationMethod.SAML_WEB_SSO;
+        }
+        // else - fall back to UNKNOWN
+        Log.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod));
+        
+        ArrayList<Object> data = new ArrayList<Object>();
+        data.add(authMethod);
+        result.setData(data);
+        return result;  // same result instance, so that other errors can be handled by the caller transparently
+	}
+	
+	
+	private String authenticationMethodToString(AuthenticationMethod value) {
+	    switch (value){
+	    case NONE:
+	        return "NONE";
+	    case BASIC_HTTP_AUTH:
+	        return "BASIC_HTTP_AUTH";
+	    case BEARER_TOKEN:
+	        return "BEARER_TOKEN";
+	    case SAML_WEB_SSO:
+	        return "SAML_WEB_SSO";
+	    default:
+            return "UNKNOWN";
+	    }
+    }
+
+}

+ 4 - 5
src/com/owncloud/android/operations/SynchronizeFolderOperation.java

@@ -192,11 +192,8 @@ public class SynchronizeFolderOperation extends RemoteOperation {
             sendLocalBroadcast(EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), result);
         }
         
-        if (result.isSuccess() && mIsShareSupported) {
-            RemoteOperationResult shareResult = refreshSharesForFolder(client);
-            if (shareResult.getCode() != ResultCode.FILE_NOT_FOUND) {
-                result = shareResult;
-            } // else , keep the previous result ; being conservative for servers where Sharing API is supported, but disabled
+        if (result.isSuccess() && mIsShareSupported && !mSyncFullAccount) {
+            refreshSharesForFolder(client); // share result is ignored 
         }
         
         if (!mSyncFullAccount) {            
@@ -339,6 +336,8 @@ public class SynchronizeFolderOperation extends RemoteOperation {
                 if (remoteFile.isFolder()) {
                     remoteFile.setFileLength(localFile.getFileLength()); // TODO move operations about size of folders to FileContentProvider
                 }
+                remoteFile.setPublicLink(localFile.getPublicLink());
+                remoteFile.setShareByLink(localFile.isShareByLink());
             } else {
                 remoteFile.setEtag(""); // remote eTag will not be updated unless contents are synchronized (Synchronize[File|Folder]Operation with remoteFile as parameter)
             }

+ 74 - 42
src/com/owncloud/android/syncadapter/FileSyncAdapter.java

@@ -35,13 +35,10 @@ import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UpdateOCVersionOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
-import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.Log_OC;
 
-
 import android.accounts.Account;
 import android.accounts.AccountsException;
-import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.content.AbstractThreadedSyncAdapter;
@@ -51,7 +48,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.SyncResult;
 import android.os.Bundle;
-//import android.support.v4.content.LocalBroadcastManager;
+import android.support.v4.app.NotificationCompat;
 
 /**
  * Implementation of {@link AbstractThreadedSyncAdapter} responsible for synchronizing 
@@ -385,8 +382,8 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
      * Notifies the user about a failed synchronization through the status notification bar 
      */
     private void notifyFailedSynchronization() {
-        Notification notification = new Notification(DisplayUtils.getSeasonalIconId(), getContext().getString(R.string.sync_fail_ticker), System.currentTimeMillis());
-        notification.flags |= Notification.FLAG_AUTO_CANCEL;
+        NotificationCompat.Builder notificationBuilder = createNotificationBuilder();
+        notificationBuilder.setTicker(i18n(R.string.sync_fail_ticker));
         boolean needsToUpdateCredentials = (mLastFailedResult != null && 
                                              (  mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED ||
                                                 ( mLastFailedResult.isIdPRedirection() && 
@@ -395,7 +392,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
                                              )
                                            );
         // TODO put something smart in the contentIntent below for all the possible errors
-        notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
+        notificationBuilder.setContentTitle(i18n(R.string.sync_fail_ticker));
         if (needsToUpdateCredentials) {
             // let the user update credentials with one click
             Intent updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class);
@@ -405,18 +402,17 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
             updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
             updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);
-            notification.contentIntent = PendingIntent.getActivity(getContext(), (int)System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT);
-            notification.setLatestEventInfo(getContext().getApplicationContext(), 
-                    getContext().getString(R.string.sync_fail_ticker), 
-                    String.format(getContext().getString(R.string.sync_fail_content_unauthorized), getAccount().name), 
-                    notification.contentIntent);
+            notificationBuilder
+                .setContentIntent(PendingIntent.getActivity(
+                    getContext(), (int)System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT
+                ))
+                .setContentText(i18n(R.string.sync_fail_content_unauthorized, getAccount().name));
         } else {
-            notification.setLatestEventInfo(getContext().getApplicationContext(), 
-                                            getContext().getString(R.string.sync_fail_ticker), 
-                                            String.format(getContext().getString(R.string.sync_fail_content), getAccount().name), 
-                                            notification.contentIntent);
+            notificationBuilder
+                .setContentText(i18n(R.string.sync_fail_content, getAccount().name));
         }
-        ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_fail_ticker, notification);
+        
+        showNotification(R.string.sync_fail_ticker, notificationBuilder);
     }
 
 
@@ -427,26 +423,31 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
      */
     private void notifyFailsInFavourites() {
         if (mFailedResultsCounter > 0) {
-            Notification notification = new Notification(DisplayUtils.getSeasonalIconId(), getContext().getString(R.string.sync_fail_in_favourites_ticker), System.currentTimeMillis());
-            notification.flags |= Notification.FLAG_AUTO_CANCEL;
+            NotificationCompat.Builder notificationBuilder = createNotificationBuilder();
+            notificationBuilder.setTicker(i18n(R.string.sync_fail_in_favourites_ticker));
+                
             // TODO put something smart in the contentIntent below
-            notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
-            notification.setLatestEventInfo(getContext().getApplicationContext(), 
-                                            getContext().getString(R.string.sync_fail_in_favourites_ticker), 
-                                            String.format(getContext().getString(R.string.sync_fail_in_favourites_content), mFailedResultsCounter + mConflictsFound, mConflictsFound), 
-                                            notification.contentIntent);
-            ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_fail_in_favourites_ticker, notification);
+            notificationBuilder
+                .setContentIntent(PendingIntent.getActivity(
+                    getContext(), (int) System.currentTimeMillis(), new Intent(), 0
+                ))
+                .setContentTitle(i18n(R.string.sync_fail_in_favourites_ticker))
+                .setContentText(i18n(R.string.sync_fail_in_favourites_content, mFailedResultsCounter + mConflictsFound, mConflictsFound));
             
+            showNotification(R.string.sync_fail_in_favourites_ticker, notificationBuilder);
         } else {
-            Notification notification = new Notification(DisplayUtils.getSeasonalIconId(), getContext().getString(R.string.sync_conflicts_in_favourites_ticker), System.currentTimeMillis());
-            notification.flags |= Notification.FLAG_AUTO_CANCEL;
+            NotificationCompat.Builder notificationBuilder = createNotificationBuilder();
+            notificationBuilder.setTicker(i18n(R.string.sync_conflicts_in_favourites_ticker));
+          
             // TODO put something smart in the contentIntent below
-            notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
-            notification.setLatestEventInfo(getContext().getApplicationContext(), 
-                                            getContext().getString(R.string.sync_conflicts_in_favourites_ticker), 
-                                            String.format(getContext().getString(R.string.sync_conflicts_in_favourites_content), mConflictsFound), 
-                                            notification.contentIntent);
-            ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_conflicts_in_favourites_ticker, notification);
+            notificationBuilder
+                .setContentIntent(PendingIntent.getActivity(
+                    getContext(), (int) System.currentTimeMillis(), new Intent(), 0
+                ))
+                .setContentTitle(i18n(R.string.sync_conflicts_in_favourites_ticker))
+                .setContentText(i18n(R.string.sync_conflicts_in_favourites_ticker, mConflictsFound));
+            
+            showNotification(R.string.sync_conflicts_in_favourites_ticker, notificationBuilder);
         } 
     }
     
@@ -460,9 +461,9 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
      * We won't consider a synchronization as failed when foreign files can not be copied to the ownCloud local directory.
      */
     private void notifyForgottenLocalFiles() {
-        Notification notification = new Notification(DisplayUtils.getSeasonalIconId(), getContext().getString(R.string.sync_foreign_files_forgotten_ticker), System.currentTimeMillis());
-        notification.flags |= Notification.FLAG_AUTO_CANCEL;
-
+        NotificationCompat.Builder notificationBuilder = createNotificationBuilder();
+        notificationBuilder.setTicker(i18n(R.string.sync_foreign_files_forgotten_ticker));
+      
         /// includes a pending intent in the notification showing a more detailed explanation
         Intent explanationIntent = new Intent(getContext(), ErrorsWhileCopyingHandlerActivity.class);
         explanationIntent.putExtra(ErrorsWhileCopyingHandlerActivity.EXTRA_ACCOUNT, getAccount());
@@ -474,14 +475,45 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
         explanationIntent.putExtra(ErrorsWhileCopyingHandlerActivity.EXTRA_REMOTE_PATHS, remotePaths);  
         explanationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         
-        notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), explanationIntent, 0);
-        notification.setLatestEventInfo(getContext().getApplicationContext(), 
-                                        getContext().getString(R.string.sync_foreign_files_forgotten_ticker), 
-                                        String.format(getContext().getString(R.string.sync_foreign_files_forgotten_content), mForgottenLocalFiles.size(), getContext().getString(R.string.app_name)), 
-                                        notification.contentIntent);
-        ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_foreign_files_forgotten_ticker, notification);
+        notificationBuilder
+            .setContentIntent(PendingIntent.getActivity(
+                getContext(), (int) System.currentTimeMillis(), explanationIntent, 0
+            ))
+            .setContentTitle(i18n(R.string.sync_foreign_files_forgotten_ticker))
+            .setContentText(i18n(R.string.sync_foreign_files_forgotten_content, mForgottenLocalFiles.size(), i18n(R.string.app_name)));
         
+        showNotification(R.string.sync_foreign_files_forgotten_ticker, notificationBuilder);
     }
     
+    /**
+     * Creates a notification builder with some commonly used settings
+     * 
+     * @return
+     */
+    private NotificationCompat.Builder createNotificationBuilder() {
+        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext());
+        notificationBuilder.setSmallIcon(R.drawable.notification_icon).setAutoCancel(true);
+        return notificationBuilder;
+    }
     
+    /**
+     * Builds and shows the notification
+     * 
+     * @param id
+     * @param builder
+     */
+    private void showNotification(int id, NotificationCompat.Builder builder) {
+        ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE))
+            .notify(id, builder.build());
+    }
+    /**
+     * Shorthand translation
+     * 
+     * @param key
+     * @param args
+     * @return
+     */
+    private String i18n(int key, Object... args) {
+        return getContext().getString(key, args);
+    }
 }

+ 47 - 0
src/com/owncloud/android/ui/CheckBoxPreferenceWithLongTitle.java

@@ -0,0 +1,47 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2014 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.ui;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
+import android.preference.CheckBoxPreference;
+
+public class CheckBoxPreferenceWithLongTitle extends CheckBoxPreference{
+
+    public CheckBoxPreferenceWithLongTitle(Context context) {
+        super(context);
+    }
+
+    public CheckBoxPreferenceWithLongTitle(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+    public CheckBoxPreferenceWithLongTitle(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    protected void onBindView(View view) {
+        super.onBindView(view);
+        TextView titleView = (TextView) view.findViewById(android.R.id.title);
+        titleView.setSingleLine(false);
+        titleView.setMaxLines(3);
+        titleView.setEllipsize(null);
+    }
+}

+ 53 - 0
src/com/owncloud/android/ui/PreferenceMultiline.java

@@ -0,0 +1,53 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2014 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.ui;
+
+import android.content.Context;
+import android.preference.Preference;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
+
+/**
+ * Allow multiline titles in preferences
+ * 
+ * @author masensio
+ *
+ */
+public class PreferenceMultiline extends Preference {
+
+    public PreferenceMultiline(Context context) {
+        super(context);
+    }
+
+    public PreferenceMultiline(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public PreferenceMultiline(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    protected void onBindView(View view) {
+        super.onBindView(view);
+        TextView titleView = (TextView) view.findViewById(android.R.id.title);
+        titleView.setSingleLine(false);
+        titleView.setMaxLines(3);
+    }
+}

+ 0 - 1
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -79,7 +79,6 @@ import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareLinkOperation;
 import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.syncadapter.FileSyncAdapter;
-import com.owncloud.android.ui.adapter.SslErrorViewAdapter;
 import com.owncloud.android.ui.dialog.EditNameDialog;
 import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;
 import com.owncloud.android.ui.dialog.EditNameDialog.EditNameDialogListener;

+ 131 - 0
src/com/owncloud/android/utils/NotificationBuilderWithProgressBar.java

@@ -0,0 +1,131 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2014 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.utils;
+
+import com.owncloud.android.R;
+
+import android.app.Notification;
+import android.content.Context;
+import android.os.Build;
+import android.support.v4.app.NotificationCompat;
+import android.view.View;
+import android.widget.RemoteViews;
+
+/**
+ * Extends the support class {@link NotificationCompat.Builder} to grant that
+ * a progress bar is available in every Android version, because 
+ * {@link NotificationCompat.Builder#setProgress(int, int, boolean)} has no
+ * real effect for Android < 4.0
+ * 
+ * @author David A. Velasco
+ */
+public class NotificationBuilderWithProgressBar extends NotificationCompat.Builder {
+
+    /**
+     * Custom view to replace the original layout of the notifications
+     */
+    private RemoteViews mContentView = null;
+    
+    /**
+     * Fatory method.
+     * 
+     * Instances of this class will be only returned in Android versions needing it.
+     * 
+     * @param context       Context that will use the builder to create notifications
+     * @return              An instance of this class, or of the regular 
+     *                      {@link NotificationCompat.Builder}, when it is good enough.
+     */
+    public static NotificationCompat.Builder newNotificationBuilderWithProgressBar(Context context) {
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+            return new NotificationBuilderWithProgressBar(context); 
+        } else {
+            return new NotificationCompat.Builder(context);
+        }
+    }
+    
+    /**
+     * Constructor.
+     * 
+     * @param context       Context that will use the builder to create notifications.
+     */
+    private NotificationBuilderWithProgressBar(Context context) {
+        super(context);
+        mContentView = new RemoteViews(context.getPackageName(), R.layout.notification_with_progress_bar);
+        setContent(mContentView);
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public NotificationCompat.Builder setProgress(int max, int progress, boolean indeterminate) {
+        mContentView.setProgressBar(R.id.progress, max, progress, indeterminate);
+        if (max > 0) {
+            mContentView.setViewVisibility(R.id.progressHolder, View.VISIBLE);
+        } else {
+            mContentView.setViewVisibility(R.id.progressHolder, View.GONE);
+        }
+        return this;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public NotificationCompat.Builder setSmallIcon(int icon) {
+        super.setSmallIcon(icon);   // necessary
+        mContentView.setImageViewResource(R.id.icon, icon);
+        return this;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public NotificationCompat.Builder setContentTitle(CharSequence title) {
+        super.setContentTitle(title);
+        mContentView.setTextViewText(R.id.title, title);
+        return this;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public NotificationCompat.Builder setContentText(CharSequence text) {
+        super.setContentText(text);
+        mContentView.setTextViewText(R.id.text, text);
+        if (text != null && text.length() > 0) {
+            mContentView.setViewVisibility(R.id.text, View.VISIBLE);
+        } else {
+            mContentView.setViewVisibility(R.id.text, View.GONE);
+        }
+        return this;
+    }
+
+    @Override
+    public Notification build() {
+        Notification result = super.build();
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
+            // super.build() in Android 2.x totally ruins whatever was made #setContent 
+            result.contentView = mContentView;
+        }
+        return result;
+    }
+    
+}

BIN
third_party/android-support-library/android-support-v4.jar