Merge remote-tracking branch 'remotes/upstream/master' into beta
authortobiasKaminsky <tobias@kaminsky.me>
Fri, 27 Nov 2015 16:37:34 +0000 (17:37 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Fri, 27 Nov 2015 16:37:34 +0000 (17:37 +0100)
89 files changed:
build.gradle
owncloud-android-library
res/layout/share_file_layout.xml
res/menu/file_actions_menu.xml
res/values-ar/strings.xml
res/values-az/strings.xml
res/values-bg-rBG/strings.xml
res/values-bn-rBD/strings.xml
res/values-bs/strings.xml
res/values-ca/strings.xml
res/values-cs-rCZ/strings.xml
res/values-da/strings.xml
res/values-de-rAT/strings.xml
res/values-de-rDE/strings.xml
res/values-de/strings.xml
res/values-el/strings.xml
res/values-en-rGB/strings.xml
res/values-eo/strings.xml
res/values-es-rAR/strings.xml
res/values-es-rMX/strings.xml
res/values-es/strings.xml
res/values-et-rEE/strings.xml
res/values-eu/strings.xml
res/values-fa/strings.xml
res/values-fi-rFI/strings.xml
res/values-fr/strings.xml
res/values-gl/strings.xml
res/values-he/strings.xml
res/values-hr/strings.xml
res/values-hu-rHU/strings.xml
res/values-hy/strings.xml
res/values-ia/strings.xml
res/values-id/strings.xml
res/values-is/strings.xml
res/values-it/strings.xml
res/values-ja-rJP/strings.xml
res/values-kn/strings.xml
res/values-ko/strings.xml
res/values-lb/strings.xml
res/values-lt-rLT/strings.xml
res/values-lv/strings.xml
res/values-mk/strings.xml
res/values-nb-rNO/strings.xml
res/values-nl/strings.xml
res/values-nn-rNO/strings.xml
res/values-oc/strings.xml
res/values-pl/strings.xml
res/values-pt-rBR/strings.xml
res/values-pt-rPT/strings.xml
res/values-ro/strings.xml
res/values-ru/strings.xml
res/values-sk-rSK/strings.xml
res/values-sl/strings.xml
res/values-sq/strings.xml
res/values-sr-rSP/strings.xml
res/values-sr/strings.xml
res/values-sv/strings.xml
res/values-th-rTH/strings.xml
res/values-tr/strings.xml
res/values-uk/strings.xml
res/values-ur-rPK/strings.xml
res/values-vi/strings.xml
res/values-zh-rCN/strings.xml
res/values-zh-rHK/strings.xml
res/values-zh-rTW/strings.xml
res/values/strings.xml
src/com/owncloud/android/datamodel/FileDataStorageManager.java
src/com/owncloud/android/files/FileMenuFilter.java
src/com/owncloud/android/files/FileOperationsHelper.java
src/com/owncloud/android/operations/CreateShareViaLinkOperation.java
src/com/owncloud/android/operations/GetSharesForFileOperation.java
src/com/owncloud/android/operations/RefreshFolderOperation.java
src/com/owncloud/android/operations/UnshareOperation.java
src/com/owncloud/android/operations/UpdateShareViaLinkOperation.java [new file with mode: 0644]
src/com/owncloud/android/services/OperationsService.java
src/com/owncloud/android/ui/activity/FileActivity.java
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
src/com/owncloud/android/ui/activity/ShareActivity.java
src/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.java [new file with mode: 0644]
src/com/owncloud/android/ui/dialog/ShareLinkToDialog.java
src/com/owncloud/android/ui/dialog/SharePasswordDialogFragment.java
src/com/owncloud/android/ui/fragment/FileDetailFragment.java
src/com/owncloud/android/ui/fragment/OCFileListFragment.java
src/com/owncloud/android/ui/fragment/ShareFileFragment.java
src/com/owncloud/android/ui/preview/PreviewImageActivity.java
src/com/owncloud/android/ui/preview/PreviewImageFragment.java
src/com/owncloud/android/ui/preview/PreviewMediaFragment.java
src/com/owncloud/android/ui/preview/PreviewTextFragment.java
src/com/owncloud/android/utils/ErrorMessageAdapter.java

index 15b8ff6..23816a1 100644 (file)
@@ -75,10 +75,10 @@ android {
 
     signingConfigs {
         release {
-            storeFile file("../beta.jks")
-            storePassword KSTOREPWD
-            keyAlias "beta"
-            keyPassword KSTOREPWD
+            storeFile file(RELEASE_STORE_FILE)
+            storePassword RELEASE_STORE_PASSWORD
+            keyAlias RELEASE_KEY_ALIAS
+            keyPassword RELEASE_KEY_PASSWORD
         }
     }
 
index 2d9ab65..8966dbc 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2d9ab65553e8f4b85aa10cb636921df9976e9878
+Subproject commit 8966dbcee044cec726633fdfd208ea106cf176c0
index feaddb3..27a6133 100644 (file)
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context="com.owncloud.android.ui.fragment.ShareFileFragment">
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+            xmlns:tools="http://schemas.android.com/tools"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            tools:context="com.owncloud.android.ui.fragment.ShareFileFragment"
+            android:id="@+id/shareScroll">
 
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:background="@color/background_material_light"
-        android:orientation="vertical">
+        android:orientation="vertical"
+        >
 
         <RelativeLayout
             android:id="@+id/shareHeaderContainer"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="@string/placeholder_filename"
-                android:textSize="16dip"
+                android:textSize="16sp"
                 android:layout_gravity="center_vertical"
                 android:layout_marginLeft="4dp"
+                android:layout_marginStart="4dp"
                 android:layout_marginRight="8dp"
+                android:layout_marginEnd="8dp"
                 android:layout_toRightOf="@+id/shareFileIcon"
                 android:layout_toEndOf="@+id/shareFileIcon"
                 android:singleLine="true"
@@ -64,7 +68,7 @@
             <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:textSize="12dip"
+                android:textSize="12sp"
                 android:text="@string/placeholder_filesize"
                 android:id="@+id/shareFileSize"
                 android:layout_below="@+id/shareFileName"
@@ -72,6 +76,7 @@
                 android:layout_toEndOf="@+id/shareFileIcon"
                 android:layout_marginTop="4dp"
                 android:layout_marginLeft="4dp"
+                android:layout_marginStart="4dp"
                 android:layout_marginBottom="12dp"
                 android:layout_gravity="center_vertical"/>
 
         <TextView
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:textSize="16dip"
+            android:textSize="16sp"
             android:text="@string/share_with_user_section_title"
             android:id="@+id/shareWithUsersSectionTitle"
-            android:layout_gravity="left"
+            android:layout_gravity="start"
             android:padding="8dp"
             android:background="@color/actionbar_start_color"
             android:textColor="@color/white"/>
             android:layout_height="wrap_content"
             android:id="@+id/shareNoUsers"
             android:text="@string/share_no_users"
-            android:textSize="12dip"
+            android:textSize="12sp"
             android:padding="12dp" />
 
         <android.support.v7.widget.AppCompatButton
             android:text="@string/share_add_user_or_group"
             android:contentDescription="shareAddUserButton"/>
 
+        <Switch
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textSize="16sp"
+            android:text="@string/share_via_link_section_title"
+            android:id="@+id/shareViaLinkSectionSwitch"
+            android:layout_gravity="start"
+            android:padding="8dp"
+            android:background="@color/actionbar_start_color"
+            android:textColor="@color/white"/>
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:id="@+id/shareViaLinkExpirationSection"
+            >
+
+            <Switch
+                android:id="@+id/shareViaLinkExpirationSwitch"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:layout_alignParentEnd="true"
+                android:layout_centerInParent="true"
+                android:padding="8dp"
+                />
+
+            <TextView
+                android:id="@+id/shareViaLinkExpirationLabel"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentLeft="true"
+                android:layout_alignParentStart="true"
+                android:layout_toLeftOf="@id/shareViaLinkExpirationSwitch"
+                android:layout_toStartOf="@id/shareViaLinkExpirationSwitch"
+                android:paddingTop="8dp"
+                android:paddingLeft="8dp"
+                android:paddingRight="8dp"
+                android:text="@string/share_via_link_expiration_date_label"
+                android:textSize="16sp"
+                />
+
+            <TextView
+                android:id="@+id/shareViaLinkExpirationValue"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentLeft="true"
+                android:layout_alignParentStart="true"
+                android:layout_toLeftOf="@id/shareViaLinkExpirationSwitch"
+                android:layout_toStartOf="@id/shareViaLinkExpirationSwitch"
+                android:layout_below="@id/shareViaLinkExpirationLabel"
+                android:paddingLeft="8dp"
+                android:paddingRight="8dp"
+                android:paddingBottom="8dp"
+                android:textSize="12sp"
+                />
+
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:id="@+id/shareViaLinkPasswordSection"
+            >
+
+            <Switch
+                android:id="@+id/shareViaLinkPasswordSwitch"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentRight="true"
+                android:layout_alignParentEnd="true"
+                android:layout_centerInParent="true"
+                android:padding="8dp"
+            />
+
+            <TextView
+                android:id="@+id/shareViaLinkPasswordLabel"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentLeft="true"
+                android:layout_alignParentStart="true"
+                android:layout_toLeftOf="@id/shareViaLinkPasswordSwitch"
+                android:layout_toStartOf="@id/shareViaLinkPasswordSwitch"
+                android:paddingTop="8dp"
+                android:paddingLeft="8dp"
+                android:paddingRight="8dp"
+                android:text="@string/share_via_link_password_label"
+                android:textSize="16sp"
+                />
+
+            <TextView
+                android:id="@+id/shareViaLinkPasswordValue"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentLeft="true"
+                android:layout_alignParentStart="true"
+                android:layout_toLeftOf="@id/shareViaLinkPasswordSwitch"
+                android:layout_toStartOf="@id/shareViaLinkPasswordSwitch"
+                android:layout_below="@id/shareViaLinkPasswordLabel"
+                android:paddingLeft="8dp"
+                android:paddingRight="8dp"
+                android:paddingBottom="8dp"
+                android:text="@string/share_via_link_password_title"
+                android:textSize="12sp"
+                android:visibility="invisible"
+                />
+
+        </RelativeLayout>
+
+        <android.support.v7.widget.AppCompatButton
+            android:id="@+id/shareViaLinkGetLinkButton"
+            style="@style/ownCloud.Button"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:text="@string/share_get_public_link_button"
+            android:contentDescription="shareGetLinkButton"/>
+
     </LinearLayout>
-</FrameLayout>
+
+</ScrollView>
\ No newline at end of file
index 4d24759..894dc33 100644 (file)
@@ -21,7 +21,7 @@
 
     <item
         android:id="@+id/action_share_file"
-        android:title="@string/action_share_file"
+        android:title="@string/action_share"
         android:icon="@android:drawable/ic_menu_share"
         android:orderInCategory="1" />
     <item
         android:icon="@android:drawable/ic_menu_view"
         android:orderInCategory="1" />
     <item
-        android:id="@+id/action_unshare_file"
-        android:title="@string/action_unshare_file"
-        android:icon="@android:drawable/ic_menu_share"
-        android:orderInCategory="1" />
-    <item
-        android:id="@+id/action_share_with_users"
-        android:title="@string/action_share_with_users"
-        android:orderInCategory="1" />
-
-    <item
         android:id="@+id/action_open_file_with"
         android:title="@string/actionbar_open_with"
         android:icon="@android:drawable/ic_menu_set_as"
index 81613ea..5d2b531 100644 (file)
@@ -78,8 +78,6 @@
   <string name="filedetails_modified">عُدل في :</string>
   <string name="filedetails_download">تحميل</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>
index d3cd832..9fc528b 100644 (file)
@@ -73,8 +73,6 @@
   <string name="filedetails_modified">Dəyişdirildi:</string>
   <string name="filedetails_download">Yüklə</string>
   <string name="filedetails_renamed_in_upload_msg">Yüklənmə müddətində fayl buna %1$s yeniləndi</string>
-  <string name="action_share_file">Linki yayımla</string>
-  <string name="action_unshare_file">Link yayımlanmasını dayandır</string>
   <string name="common_yes">Bəli</string>
   <string name="common_no">Xeyir</string>
   <string name="common_ok">Oldu</string>
index eea53c9..555aee8 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">Изтегляне</string>
   <string name="filedetails_renamed_in_upload_msg">Файлът беше преименуван на %1$s по време на качването.</string>
   <string name="list_layout">Списък с изгледи</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>
index 49df5a6..643a77a 100644 (file)
@@ -64,8 +64,6 @@
   <string name="filedetails_modified">পরিবর্তিতঃ</string>
   <string name="filedetails_download">ডাউনলোড</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>
index 4ce4a45..0047e35 100644 (file)
@@ -20,7 +20,6 @@
   <string name="uploader_btn_upload_text">Učitaj</string>
   <string name="uploader_btn_new_folder_text">Novi direktorij</string>
   <string name="filedetails_download">Preuzmite</string>
-  <string name="action_share_file">Podijelite vezu</string>
   <string name="common_yes">Da</string>
   <string name="common_no">Ne</string>
   <string name="common_ok">Ok</string>
index b860271..f4259ee 100644 (file)
@@ -73,8 +73,6 @@
   <string name="filedetails_modified">Modificat:</string>
   <string name="filedetails_download">Baixa</string>
   <string name="filedetails_renamed_in_upload_msg">L\'arxiu s\'ha canviat de nom a %1$s durant la càrrega</string>
-  <string name="action_share_file">Enllaç de compartició</string>
-  <string name="action_unshare_file">Deixa de compartir l\'enllaç</string>
   <string name="common_yes">Sí</string>
   <string name="common_no">No</string>
   <string name="common_ok">D\'acord</string>
index 5941be1..17b824b 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">Synchronizovat</string>
   <string name="filedetails_renamed_in_upload_msg">Soubor byl v průběhu odesílání přejmenován na %1$s</string>
   <string name="list_layout">Náhled seznamu</string>
-  <string name="action_share_file">Sdílet odkaz</string>
-  <string name="action_unshare_file">Zrušit sdílení odkazu</string>
-  <string name="action_share_with_users">Sdílet s uživateli</string>
   <string name="common_yes">Ano</string>
   <string name="common_no">Ne</string>
   <string name="common_ok">OK</string>
@@ -336,7 +333,6 @@ správce systému.</string>
   <string name="file_list__footer__files_and_folder">%1$d soubory(ů), 1 adresář</string>
   <string name="file_list__footer__files_and_folders">%1$d soubory(ů), %2$d adresáře(ů)</string>
   <string name="share_dialog_title">Sdílení</string>
-  <string name="share_with_user_section_title">Sdílet s uživateli a skupinami</string>
   <string name="share_no_users">Zatím nebyla s uživateli sdílena žádná data</string>
   <string name="share_add_user_or_group">Přidat uživatele nebo skupinu</string>
   <string name="share_search">Hledat</string>
index be4c942..ba66f24 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">Hent</string>
   <string name="filedetails_renamed_in_upload_msg">Filen blev omdøbt til %1$s under upload</string>
   <string name="list_layout">Listevisning</string>
-  <string name="action_share_file">Del link</string>
-  <string name="action_unshare_file">Ophæv deling</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nej</string>
   <string name="common_ok">OK</string>
index 4396346..5a16179 100644 (file)
@@ -59,8 +59,6 @@
   <string name="filedetails_created">Erstellt am:</string>
   <string name="filedetails_modified">Verändert am:</string>
   <string name="filedetails_download">Herunterladen</string>
-  <string name="action_share_file">Link teilen</string>
-  <string name="action_unshare_file">Link nicht mehr teilen</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nein</string>
   <string name="common_ok">OK</string>
index 45e371e..26614c1 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">Herunterladen</string>
   <string name="filedetails_renamed_in_upload_msg">Datei wurde wärend des Uploads zu %1$s umbenannt</string>
   <string name="list_layout">Listen-Layout</string>
-  <string name="action_share_file">Link teilen</string>
-  <string name="action_unshare_file">Link nicht mehr teilen</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nein</string>
   <string name="common_ok">OK</string>
index c84258d..e402cd3 100644 (file)
@@ -81,8 +81,6 @@
   <string name="filedetails_download">Herunterladen</string>
   <string name="filedetails_renamed_in_upload_msg">Datei wurde wärend des Uploads zu %1$s umbenannt</string>
   <string name="list_layout">Listen-Layout</string>
-  <string name="action_share_file">Link teilen</string>
-  <string name="action_unshare_file">Link nicht mehr freigeben</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nein</string>
   <string name="common_ok">OK</string>
   <string name="file_list__footer__files_and_folder">%1$d Dateien, 1 Ordner</string>
   <string name="file_list__footer__files_and_folders">%1$d Dateien, %2$d Ordner</string>
   <string name="share_dialog_title">Teilen</string>
+  <string name="share_no_users">Es wurden noch keine Dateien mit Benutzern geteilt</string>
+  <string name="share_add_user_or_group">Benutzer oder Gruppe hinzufügen</string>
   <string name="share_search">Suche</string>
 </resources>
index 66df5fd..e18a37b 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">Συγχρονισμός</string>
   <string name="filedetails_renamed_in_upload_msg">Το αρχείο μετονομάστηκε σε %1$s κατά τη μεταφόρτωση</string>
   <string name="list_layout">Διάταξη Λίστας</string>
-  <string name="action_share_file">Διαμοιρασμός συνδέσμου</string>
-  <string name="action_unshare_file">Ακύρωση διαμοιρασμού συνδέσμου</string>
-  <string name="action_share_with_users">Διαμοιρασμός με χρήστες</string>
   <string name="common_yes">Ναι</string>
   <string name="common_no">Όχι</string>
   <string name="common_ok">ΟΚ</string>
   <string name="file_list__footer__files_and_folder">%1$d αρχεία, 1 φάκελος</string>
   <string name="file_list__footer__files_and_folders">%1$d αρχεία, %2$d φάκελοι</string>
   <string name="share_dialog_title">Διαμοιρασμός</string>
-  <string name="share_with_user_section_title">Διαμοιρασμός με χρήστες και ομάδες</string>
   <string name="share_no_users">Δεν έχουν διαμοιραστεί ακόμα δεδομένα με τους χρήστες</string>
   <string name="share_add_user_or_group">Προσθήκη χρήστη ή ομάδας</string>
   <string name="share_search">Αναζήτηση</string>
index 5fc8dfd..d6db6cc 100644 (file)
@@ -74,8 +74,6 @@
   <string name="filedetails_modified">Modified:</string>
   <string name="filedetails_download">Download</string>
   <string name="filedetails_renamed_in_upload_msg">File was renamed to %1$s during upload</string>
-  <string name="action_share_file">Share link</string>
-  <string name="action_unshare_file">Unshare link</string>
   <string name="common_yes">Yes</string>
   <string name="common_no">No</string>
   <string name="common_ok">OK</string>
index 4d98b49..a5d948a 100644 (file)
@@ -48,8 +48,6 @@
   <string name="filedetails_modified">Modifita je:</string>
   <string name="filedetails_download">Elŝuti</string>
   <string name="filedetails_renamed_in_upload_msg">La dosiero alinomiĝis al %1$s dum alŝuto</string>
-  <string name="action_share_file">Konhavigi ligilon</string>
-  <string name="action_unshare_file">Malkunhavigi ligilon</string>
   <string name="common_yes">Jes</string>
   <string name="common_no">Ne</string>
   <string name="common_ok">Akcepti</string>
index 6165582..734f875 100644 (file)
@@ -21,6 +21,7 @@
        <item>Biggest - Smallest</item>-->
   <!--TODO re-enable when "Accounts" is available in Navigation Drawer-->
   <!--<string name="drawer_item_accounts">Accounts</string>-->
+  <string name="drawer_item_all_files">Todos los archivos</string>
   <!--TODO re-enable when "On Device" is available
     <string name="drawer_item_on_device">On device</string>-->
   <string name="drawer_open">Abrir</string>
@@ -73,8 +74,6 @@
   <string name="filedetails_modified">Modificado:</string>
   <string name="filedetails_download">Descargar</string>
   <string name="filedetails_renamed_in_upload_msg">El archivo fue renombrado como %1$s durante la subida</string>
-  <string name="action_share_file">Compartir vínculo</string>
-  <string name="action_unshare_file">Dejar de compartir vínculo</string>
   <string name="common_yes">Sí</string>
   <string name="common_no">No</string>
   <string name="common_ok">Aceptar</string>
index dc31f88..e694581 100644 (file)
@@ -59,7 +59,6 @@
   <string name="filedetails_modified">Modificado:</string>
   <string name="filedetails_download">Descargar</string>
   <string name="filedetails_renamed_in_upload_msg">El archivo fue renombrado como %1$s durante la subida</string>
-  <string name="action_share_file">Enlace compartido</string>
   <string name="common_yes">Sí</string>
   <string name="common_no">No</string>
   <string name="common_ok">Aceptar</string>
index 0f77b14..6a515b2 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">Sincronizar</string>
   <string name="filedetails_renamed_in_upload_msg">El fichero fue renombrado como %1$s durante la subida</string>
   <string name="list_layout">Diseño de lista</string>
-  <string name="action_share_file">Compartir con enlace</string>
-  <string name="action_unshare_file">Dejar de compartir</string>
-  <string name="action_share_with_users">Compartir con usuarios</string>
   <string name="common_yes">Sí</string>
   <string name="common_no">No</string>
   <string name="common_ok">Aceptar</string>
   <string name="file_list__footer__files_and_folder">%1$d archivos, 1 carpeta</string>
   <string name="file_list__footer__files_and_folders">%1$d archivos, %2$d carpetas</string>
   <string name="share_dialog_title">Compartiendo</string>
-  <string name="share_with_user_section_title">Compartir con Usuarios y Grupos</string>
   <string name="share_no_users">Aún no se ha compartido con ningún usuario.</string>
   <string name="share_add_user_or_group">Añadir usuario o grupo</string>
   <string name="share_search">Buscar</string>
index 7167dc5..79d4135 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">Lae alla</string>
   <string name="filedetails_renamed_in_upload_msg">Fail nimetati üleslaadimise käigus ümber %1$ </string>
   <string name="list_layout">Nimekirja paigutus</string>
-  <string name="action_share_file">Jaga linki</string>
-  <string name="action_unshare_file">Tühista lingi jagamine</string>
   <string name="common_yes">Jah</string>
   <string name="common_no">Ei</string>
   <string name="common_ok">OK</string>
index 7cb8302..c65857d 100644 (file)
@@ -71,8 +71,6 @@
   <string name="filedetails_modified">Aldatuta:</string>
   <string name="filedetails_download">Deskargatu</string>
   <string name="filedetails_renamed_in_upload_msg">Fitxategiaren izena %1$sra aldatu da igotzean</string>
-  <string name="action_share_file">Elkarbanatu lotura</string>
-  <string name="action_unshare_file">Lotura partekatzeari utzi</string>
   <string name="common_yes">Bai</string>
   <string name="common_no">Ez</string>
   <string name="common_ok">Ados</string>
index 35696da..c8d95de 100644 (file)
@@ -71,8 +71,6 @@
   <string name="filedetails_modified">تغییر یافته توسط:</string>
   <string name="filedetails_download">بارگیری</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>
index 7db8066..0be584d 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">Synkronoi</string>
   <string name="filedetails_renamed_in_upload_msg">Tiedoston nimeksi muutettiin %1$s siirron yhteydessä</string>
   <string name="list_layout">Luettelon asettelu</string>
-  <string name="action_share_file">Jaa linkki</string>
-  <string name="action_unshare_file">Poista linkin jako</string>
-  <string name="action_share_with_users">Jaa käyttäjien kanssa</string>
   <string name="common_yes">Kyllä</string>
   <string name="common_no">Ei</string>
   <string name="common_ok">OK</string>
   <string name="file_list__footer__files_and_folder">%1$d tiedostoa, 1 kansio</string>
   <string name="file_list__footer__files_and_folders">%1$d tiedostoa, %2$d kansiota</string>
   <string name="share_dialog_title">Jakaminen</string>
-  <string name="share_with_user_section_title">Jaa käyttäjien tai ryhmien kanssa</string>
   <string name="share_add_user_or_group">Lisää käyttäjä tai ryhmä</string>
   <string name="share_search">Etsi</string>
   <string name="search_users_and_groups_hint">Etsi käyttäjiä ja ryhmiä</string>
index 260ffbd..a9e4c43 100644 (file)
@@ -83,9 +83,6 @@ Téléchargez-le ici : %2$s</string>
   <string name="filedetails_sync_file">Synchroniser</string>
   <string name="filedetails_renamed_in_upload_msg">Le fichier a été renommé en %s pendant le téléversement</string>
   <string name="list_layout">Affichage en liste</string>
-  <string name="action_share_file">Partager le lien</string>
-  <string name="action_unshare_file">Ne plus partager ce lien</string>
-  <string name="action_share_with_users">Partager avec des utilisateurs</string>
   <string name="common_yes">Oui</string>
   <string name="common_no">Non</string>
   <string name="common_ok">OK</string>
@@ -341,7 +338,6 @@ Ci-dessous la liste des fichiers locaux, et les fichiers distants dans %5$s auxq
   <string name="file_list__footer__files_and_folder">%1$d fichiers, 1 dossier</string>
   <string name="file_list__footer__files_and_folders">%1$d fichiers, %2$d dossiers</string>
   <string name="share_dialog_title">Partage</string>
-  <string name="share_with_user_section_title">Partager avec des Utilisateurs et des Groupes</string>
   <string name="share_no_users">Aucune donnée partagée avec des utilisateurs pour le moment</string>
   <string name="share_add_user_or_group">Ajouter un Utilisateur ou un Groupe</string>
   <string name="share_search">Rechercher</string>
index 68ad0a4..f8061b8 100644 (file)
@@ -83,9 +83,6 @@ Descárgueo de aquí: %2$s</string>
   <string name="filedetails_sync_file">Sincronizar</string>
   <string name="filedetails_renamed_in_upload_msg">O ficheiro foi renomeado a %1$s durante o envío</string>
   <string name="list_layout">Deseño da lista</string>
-  <string name="action_share_file">Ligazón para compartir</string>
-  <string name="action_unshare_file">Deixar de compartir a ligazón</string>
-  <string name="action_share_with_users">Compartir con usuarios</string>
   <string name="common_yes">Si</string>
   <string name="common_no">Non</string>
   <string name="common_ok">Aceptar</string>
@@ -335,7 +332,6 @@ Descárgueo de aquí: %2$s</string>
   <string name="file_list__footer__files_and_folder">%1$d ficheiros, 1 cartafol</string>
   <string name="file_list__footer__files_and_folders">%1$d ficheiros, %2$d cartafoles</string>
   <string name="share_dialog_title">Compartindo</string>
-  <string name="share_with_user_section_title">Compartir con Usuarios e Grupos</string>
   <string name="share_no_users">Aínda non hai datos compartidos con usuarios</string>
   <string name="share_add_user_or_group">Engadir Usuario ou Grupo</string>
   <string name="share_search">Buscar</string>
index 14c8156..9361e43 100644 (file)
@@ -64,8 +64,6 @@
   <string name="filedetails_modified">מועד השינוי:</string>
   <string name="filedetails_download">הורדה</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>
index 6fba8ee..444158a 100644 (file)
@@ -43,7 +43,6 @@
   <string name="file_list_seconds_ago">prije par sekundi</string>
   <string name="file_list_empty">Nema ničega u ovoj mapi. Pošalji nešto!</string>
   <string name="filedetails_download">Preuzimanje</string>
-  <string name="action_share_file">Podijelite vezu</string>
   <string name="common_yes">Da</string>
   <string name="common_no">Ne</string>
   <string name="common_ok">U redu</string>
index 25967de..2add8a2 100644 (file)
@@ -78,8 +78,6 @@
   <string name="filedetails_sync_file">Szinkronizálás</string>
   <string name="filedetails_renamed_in_upload_msg">A feltöltés során az állmányt erre neveztük át: %1$s</string>
   <string name="list_layout">Lista Elrendezés</string>
-  <string name="action_share_file">Megosztás hivatkozással</string>
-  <string name="action_unshare_file">Megosztás visszavonása</string>
   <string name="common_yes">Igen</string>
   <string name="common_no">Nem</string>
   <string name="common_ok">OK</string>
index ef78c1f..aae25ab 100644 (file)
@@ -20,7 +20,6 @@
   <string name="file_list_seconds_ago">վրկ. առաջ</string>
   <string name="filedetails_size">Չափս.</string>
   <string name="filedetails_download">Բեռնել</string>
-  <string name="action_share_file">Կիսվել հղմամբ</string>
   <string name="common_yes">Այո</string>
   <string name="common_no">Ոչ</string>
   <string name="common_cancel">Չեղարկել</string>
index 666c923..48378a7 100644 (file)
@@ -29,7 +29,6 @@
   <string name="filedetails_size">Dimension:</string>
   <string name="filedetails_type">Typo:</string>
   <string name="filedetails_download">Discargar</string>
-  <string name="action_share_file">Compartir ligamine</string>
   <string name="common_yes">Si</string>
   <string name="common_no">No</string>
   <string name="common_ok">Ok</string>
index f1f7d9f..0937215 100644 (file)
@@ -81,8 +81,6 @@
   <string name="filedetails_download">Unduh</string>
   <string name="filedetails_renamed_in_upload_msg">Berkas diubah namanya menjadi %1$s saat pengunggahan</string>
   <string name="list_layout">Daftar Tata Letak</string>
-  <string name="action_share_file">Bagikan tautan</string>
-  <string name="action_unshare_file">Batal bagikan tautan</string>
   <string name="common_yes">Ya</string>
   <string name="common_no">Tidak</string>
   <string name="common_ok">Oke</string>
   <string name="file_list__footer__files_and_folder">%1$d berkas, 1 folder</string>
   <string name="file_list__footer__files_and_folders">%1$d berkas, %2$d folder</string>
   <string name="share_dialog_title">Berbagi</string>
-  <string name="share_with_user_section_title">Bagikan dengan Pengguna dan Grup</string>
   <string name="share_no_users">Tidak ada data yang dibagikan dengan pengguna</string>
   <string name="share_add_user_or_group">Tambah Pengguna atau Grup</string>
   <string name="share_search">Cari</string>
index 046a796..18b0ce4 100644 (file)
@@ -20,7 +20,6 @@
   <string name="file_list_seconds_ago">sek.</string>
   <string name="file_list_empty">Ekkert hér. Settu eitthvað inn!</string>
   <string name="filedetails_download">Niðurhal</string>
-  <string name="action_share_file">Deila hlekk</string>
   <string name="common_yes">Já</string>
   <string name="common_no">Nei</string>
   <string name="common_ok">Í lagi</string>
index 3a2e02c..94986c6 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">Sincronizza</string>
   <string name="filedetails_renamed_in_upload_msg">Il file è stato rinominato in %1$s durante il caricamento</string>
   <string name="list_layout">Struttura elenco</string>
-  <string name="action_share_file">Condividi collegamento</string>
-  <string name="action_unshare_file">Rimuovi condivisione collegamento</string>
-  <string name="action_share_with_users">Condividi con utenti</string>
   <string name="common_yes">Sì</string>
   <string name="common_no">No</string>
   <string name="common_ok">OK</string>
   <string name="file_list__footer__files_and_folder">%1$d file, 1 cartella</string>
   <string name="file_list__footer__files_and_folders">%1$d file, %2$d cartelle</string>
   <string name="share_dialog_title">Condivisione</string>
-  <string name="share_with_user_section_title">Condividi con utenti e gruppi</string>
   <string name="share_no_users">Ancora nessun dato condiviso con gli utenti </string>
   <string name="share_add_user_or_group">Aggiungi utente o gruppo</string>
   <string name="share_search">Cerca</string>
index d17876a..cb7a2a9 100644 (file)
@@ -83,9 +83,6 @@
   <string name="filedetails_sync_file">ファイルを同期</string>
   <string name="filedetails_renamed_in_upload_msg">アップロード中にファイル名を %1$s に変更しました</string>
   <string name="list_layout">リストレイアウト</string>
-  <string name="action_share_file">URLで共有</string>
-  <string name="action_unshare_file">未共有のリンク</string>
-  <string name="action_share_with_users">ユーザーと共有</string>
   <string name="common_yes">はい</string>
   <string name="common_no">いいえ</string>
   <string name="common_ok">OK</string>
   <string name="file_list__footer__files_and_folder">%1$d ファイル、1 フォルダー</string>
   <string name="file_list__footer__files_and_folders">%1$d ファイル、%2$d フォルダー</string>
   <string name="share_dialog_title">共有</string>
-  <string name="share_with_user_section_title">ユーザーまたはグループに共有</string>
   <string name="share_no_users">ユーザーと共有されているデータはありません</string>
   <string name="share_add_user_or_group">ユーザーまたはグループを追加</string>
   <string name="share_search">検索</string>
index 4ca45b1..0b62100 100644 (file)
@@ -21,7 +21,6 @@
   <string name="uploader_btn_upload_text">ಪೇರಿಸು</string>
   <string name="uploader_btn_new_folder_text">ಹೊಸ ಕಡತಕೋಶ</string>
   <string name="filedetails_download">ಪ್ರತಿಯನ್ನು ಸ್ಥಳೀಯವಾಗಿ ಉಳಿಸಿಕೊಳ್ಳಿ</string>
-  <string name="action_share_file">ಸಂಪರ್ಕ ಕೊಂಡಿಯನ್ನು  ಹಂಚಿಕೊಳ್ಳಬಹುದು</string>
   <string name="common_yes">ಹೌದು</string>
   <string name="common_no">ಇಲ್ಲ</string>
   <string name="common_ok">ಸರಿ</string>
index c856bf3..3947cc3 100644 (file)
@@ -81,8 +81,6 @@
   <string name="filedetails_download">다운로드</string>
   <string name="filedetails_renamed_in_upload_msg">업로드 중 파일 이름을 %1$s(으)로 변경하였습니다</string>
   <string name="list_layout">목록 레이아웃</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="file_list__footer__files_and_folder">파일 %1$d개, 폴더 1개</string>
   <string name="file_list__footer__files_and_folders">파일 %1$d개, 폴더 %2$d개</string>
   <string name="share_dialog_title">공유</string>
-  <string name="share_with_user_section_title">Share with Users and Groups</string>
   <string name="share_no_users">No data shared with users yet</string>
   <string name="share_add_user_or_group">Add User or Group</string>
   <string name="share_search">검색</string>
index 1c958f3..0e29ce5 100644 (file)
@@ -62,7 +62,6 @@
   <string name="filedetails_created">Erstallt:</string>
   <string name="filedetails_modified">Geännert:</string>
   <string name="filedetails_download">Eroflueden</string>
-  <string name="action_share_file">Link deelen</string>
   <string name="common_yes">Jo</string>
   <string name="common_no">Nee</string>
   <string name="common_ok">OK</string>
index 1459761..c736132 100644 (file)
@@ -82,8 +82,6 @@
   <string name="filedetails_sync_file">Sinchronizuojama</string>
   <string name="filedetails_renamed_in_upload_msg">Įkėlimo metu failas buvo pervadintas į %1$s</string>
   <string name="list_layout">Sąrašo išdėstymas</string>
-  <string name="action_share_file">Dalintis nuoroda</string>
-  <string name="action_unshare_file">Nebesidalinti nuoroda</string>
   <string name="common_yes">Taip</string>
   <string name="common_no">Ne</string>
   <string name="common_ok">Gerai</string>
   <string name="uploader_info_dirname">Katalogo pavadinimas</string>
   <string name="uploader_upload_in_progress_ticker">Įkeliama ...</string>
   <string name="uploader_upload_in_progress_content">%1$d%% Siunčiama %2$s</string>
-  <string name="uploader_upload_succeeded_ticker">Nusiuntimas pavyko</string>
+  <string name="uploader_upload_succeeded_ticker">Įkėlimas pavyko</string>
   <string name="uploader_upload_succeeded_content_single">%1$s buvo sėkmingai nusiųstas</string>
   <string name="uploader_upload_failed_ticker">Nusiuntimas nepavyko</string>
   <string name="uploader_upload_failed_content_single">Nepavyko baigti %1$s nusiuntimo</string>
   <string name="ssl_validator_label_validity_to">Iki:</string>
   <string name="ssl_validator_label_signature">Parašas:</string>
   <string name="ssl_validator_label_signature_algorithm">Algoritmas:</string>
+  <string name="digest_algorithm_not_available">Tavo telefonas nepalaiko digest algoritmo.</string>
+  <string name="ssl_validator_label_certificate_fingerprint">Kontrolinis kodas:</string>
+  <string name="certificate_load_problem">Klaida įkeliant sertifikatą.</string>
   <string name="ssl_validator_null_cert">Sertifikatas negali būti parodytas.</string>
   <string name="ssl_validator_no_info_about_error">- Nėra informacijos apie klaidą</string>
   <string name="placeholder_sentence">Rezervas</string>
   <string name="file_list__footer__files_and_folder">%1$d failai, 1 aplankas</string>
   <string name="file_list__footer__files_and_folders">%1$d failai, %2$d aplankai</string>
   <string name="share_dialog_title">Dalijimasis</string>
+  <string name="share_no_users">Su vartotojais niekuo nesidalinama</string>
+  <string name="share_add_user_or_group">Pridėti vartotoją ar grupę</string>
   <string name="share_search">Ieškoti</string>
+  <string name="search_users_and_groups_hint">Surasti vartotoją ar grupę</string>
+  <string name="share_group_clarification">%1$s (grupė)</string>
+  <string name="share_sharee_unavailable">Serveris nepalaiko dalinimosi su vartotojais kliente.
+\nSusisiekite su administratoriumi.</string>
 </resources>
index 42cb5bb..47f2845 100644 (file)
@@ -70,8 +70,6 @@
   <string name="filedetails_modified">Modificēta:</string>
   <string name="filedetails_download">Lejupielādēt</string>
   <string name="filedetails_renamed_in_upload_msg">Datne tika pārsaukta uz %1$s augšupielādes laikā</string>
-  <string name="action_share_file">Dalīt saiti</string>
-  <string name="action_unshare_file">Pārtraukt dalīt saiti</string>
   <string name="common_yes">Jā</string>
   <string name="common_no">Nē</string>
   <string name="common_ok">Labi</string>
index a2708d3..f1bc009 100644 (file)
@@ -74,8 +74,6 @@
   <string name="filedetails_modified">Изменето:</string>
   <string name="filedetails_download">Преземање</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>
index 95ad2e5..a18743a 100644 (file)
@@ -81,8 +81,6 @@
   <string name="filedetails_download">Last ned</string>
   <string name="filedetails_renamed_in_upload_msg">Filnavnet ble endret til  %1$s under opplasting</string>
   <string name="list_layout">Listeoppsett</string>
-  <string name="action_share_file">Del lenke</string>
-  <string name="action_unshare_file">Avslutt deling av lenke</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nei</string>
   <string name="common_ok">OK</string>
   <string name="file_list__footer__files_and_folder">%1$d filer, 1 mappe</string>
   <string name="file_list__footer__files_and_folders">%1$d filer, %2$d mapper</string>
   <string name="share_dialog_title">Deling</string>
-  <string name="share_with_user_section_title">Del med brukere og grupper</string>
   <string name="share_no_users">Ingen data delt med brukere ennå</string>
   <string name="share_add_user_or_group">Legg til bruker eller gruppe</string>
   <string name="share_search">Søk</string>
index 9a3fa84..8161fba 100644 (file)
@@ -83,9 +83,6 @@ Download hier: %2$s</string>
   <string name="filedetails_sync_file">Synchroniseren</string>
   <string name="filedetails_renamed_in_upload_msg">Bestand is tijdens het uploaden hernoemd naar %1$s</string>
   <string name="list_layout">Lijst layout</string>
-  <string name="action_share_file">Deel link</string>
-  <string name="action_unshare_file">Link niet meer delen</string>
-  <string name="action_share_with_users">Delen met gebruiker</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nee</string>
   <string name="common_ok">OK</string>
@@ -340,7 +337,6 @@ Hieronder staan de lokale bestanden en de externe bestanden in %5$s waar ze naar
   <string name="file_list__footer__files_and_folder">%1$d bestanden, 1 map</string>
   <string name="file_list__footer__files_and_folders">%1$d bestanden, %2$d mappen</string>
   <string name="share_dialog_title">Delen</string>
-  <string name="share_with_user_section_title">Delen met gebruikers en groepen</string>
   <string name="share_no_users">Nog geen gegevens met gebruikers gedeeld</string>
   <string name="share_add_user_or_group">Toevoegen gebruiker of groep</string>
   <string name="share_search">Zoeken</string>
index aa846e3..ad53fb8 100644 (file)
@@ -58,7 +58,6 @@
   <string name="filedetails_created">Oppretta:</string>
   <string name="filedetails_modified">Endra:</string>
   <string name="filedetails_download">Last ned</string>
-  <string name="action_share_file">Del lenkje</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nei</string>
   <string name="common_ok">Greitt</string>
index 5ba832c..9ef2793 100644 (file)
@@ -83,9 +83,6 @@ Telecargatz-lo aicí : %2$s</string>
   <string name="filedetails_sync_file">Sincronizar</string>
   <string name="filedetails_renamed_in_upload_msg">Lo fichièr es estat renomenat en %s pendent lo mandadís</string>
   <string name="list_layout">Afichatge en lista</string>
-  <string name="action_share_file">Partejar lo ligam</string>
-  <string name="action_unshare_file">Partejar pas mai aqueste ligam</string>
-  <string name="action_share_with_users">Partejar amb d\'Utilizaires</string>
   <string name="common_yes">Òc</string>
   <string name="common_no">Non</string>
   <string name="common_ok">D\'acòrdi</string>
@@ -338,7 +335,6 @@ En rason d\'aquesta modificacion, totes los fichièrs mandats amb de versions an
   <string name="file_list__footer__files_and_folder">%1$d fichièrs, 1 dorsièr</string>
   <string name="file_list__footer__files_and_folders">%1$d fichièrs, %2$d dorsièrs</string>
   <string name="share_dialog_title">Partiment</string>
-  <string name="share_with_user_section_title">Partejar amb d\'utilizaires e de gropes</string>
   <string name="share_no_users">Cap de donada es pas partejada amb d\'utilizaires pel moment</string>
   <string name="share_add_user_or_group">Apondre un utilizaire o un grop</string>
   <string name="share_search">Recercar</string>
index f6a6f45..ed223e9 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">Pobierz</string>
   <string name="filedetails_renamed_in_upload_msg">Podczas wysyłania nazwa pliku została zmieniona na %1$s</string>
   <string name="list_layout">Lista szablonów wyglądu</string>
-  <string name="action_share_file">Udostępnij link</string>
-  <string name="action_unshare_file">Anuluj udostępnianie</string>
   <string name="common_yes">Tak</string>
   <string name="common_no">Nie</string>
   <string name="common_ok">OK</string>
index 7b494cd..a0333fe 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">Sincronizar</string>
   <string name="filedetails_renamed_in_upload_msg">Arquivo foi renomeado para %1$s durante o envio</string>
   <string name="list_layout">Lista de Layout</string>
-  <string name="action_share_file">Compartilhar link</string>
-  <string name="action_unshare_file">Descompartilhar o link</string>
-  <string name="action_share_with_users">Compartilhado com usuários</string>
   <string name="common_yes">Sim</string>
   <string name="common_no">Não</string>
   <string name="common_ok">OK</string>
   <string name="file_list__footer__files_and_folder">%1$d arquivos, 1 pasta</string>
   <string name="file_list__footer__files_and_folders">%1$d arquivos, %2$d pastas</string>
   <string name="share_dialog_title">Compartilhamento</string>
-  <string name="share_with_user_section_title">Compartilhar com Usuários e Grupos</string>
   <string name="share_no_users">Ainda não existe nenhum dado compartilhado com usuários</string>
   <string name="share_add_user_or_group">Adicionar Usuário ou Grupo</string>
   <string name="share_search">Perquisar</string>
index a1adba9..ae23c23 100644 (file)
@@ -82,8 +82,6 @@
   <string name="filedetails_sync_file">Sincronizar</string>
   <string name="filedetails_renamed_in_upload_msg">O ficheiro foi renomeado para %1$s durante o envio.</string>
   <string name="list_layout">Apresentação da Lista</string>
-  <string name="action_share_file">Partilhar a hiperligação</string>
-  <string name="action_unshare_file">Cancelar partilha da hiperligação</string>
   <string name="common_yes">Sim</string>
   <string name="common_no">Não</string>
   <string name="common_ok">ACEITAR</string>
   <string name="file_list__footer__files_and_folder">%1$d ficheiros, 1 pasta</string>
   <string name="file_list__footer__files_and_folders">%1$d ficheiros, %2$d pastas</string>
   <string name="share_dialog_title">Partilha</string>
-  <string name="share_with_user_section_title">Partilhar com Utilizadores e Grupos</string>
   <string name="share_no_users">Ainda não foram partilhados os dados com os utilizadores</string>
   <string name="share_add_user_or_group">Adicionar Utilziador ou Grupo</string>
   <string name="share_search">Procurar</string>
index b997bc9..195a31f 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">Descarcă</string>
   <string name="filedetails_renamed_in_upload_msg">Fișierul a fost redenumit %1$s în timpul încărcării</string>
   <string name="list_layout">Aspect listă</string>
-  <string name="action_share_file">Partajază legătură</string>
-  <string name="action_unshare_file">Departajează legătura</string>
   <string name="common_yes">Da</string>
   <string name="common_no">Nu</string>
   <string name="common_ok">OK</string>
index 5f12453..7d2886d 100644 (file)
@@ -82,8 +82,6 @@
   <string name="filedetails_download">Скачать</string>
   <string name="filedetails_renamed_in_upload_msg">Файл был переименован в %1$s во время загрузки</string>
   <string name="list_layout">Макет списка</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="file_list__footer__files_and_folder">%1$d файлов, 1 каталог</string>
   <string name="file_list__footer__files_and_folders">%1$d файлов, %2$d каталогов</string>
   <string name="share_dialog_title">Общий доступ</string>
-  <string name="share_with_user_section_title">Поделиться с пользователями или группами</string>
   <string name="share_no_users">Нет данных используемых совместно с другими пользователями</string>
   <string name="share_add_user_or_group">Добавить пользователя или группу</string>
   <string name="share_search">Найти</string>
index b48dc6e..13acac2 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">Synchronizovať</string>
   <string name="filedetails_renamed_in_upload_msg">Súbor bol premenovaný na %1$s počas nahrávania</string>
   <string name="list_layout">Rozvrhnutie zoznamu</string>
-  <string name="action_share_file">Zdieľať linku</string>
-  <string name="action_unshare_file">Zrušiť zdieľanie odkazu</string>
-  <string name="action_share_with_users">Zdieľať s používateľmi</string>
   <string name="common_yes">Áno</string>
   <string name="common_no">Nie</string>
   <string name="common_ok">OK</string>
   <string name="file_list__footer__files_and_folder">%1$d súb., 1 priečinok</string>
   <string name="file_list__footer__files_and_folders">%1$d súb., %2$d prieč.</string>
   <string name="share_dialog_title">Zdieľanie</string>
-  <string name="share_with_user_section_title">Zdieľať s používateľmi alebo skupinami</string>
   <string name="share_no_users">Zatiaľ s používateľmi nezdieľate žiadne dáta.</string>
   <string name="share_add_user_or_group">Pridať používateľa alebo skupinu</string>
   <string name="share_search">Hľadať</string>
index 0b5a4a6..1c4c26f 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">Prejmi</string>
   <string name="filedetails_renamed_in_upload_msg">Datoteka je bila med nalaganjem preimenovana v %1$s</string>
   <string name="list_layout">Postavitev seznama</string>
-  <string name="action_share_file">Povezava za souporabo</string>
-  <string name="action_unshare_file">Odstrani možnost souporabe</string>
   <string name="common_yes">Da</string>
   <string name="common_no">Ne</string>
   <string name="common_ok">V redu</string>
index c4a9dec..b6ccd8e 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">Njëkohëso</string>
   <string name="filedetails_renamed_in_upload_msg">Kartela u riemërtua si %1$s gjatë ngarkimit</string>
   <string name="list_layout">Skemë Liste</string>
-  <string name="action_share_file">Ndajeni lidhjen me të tjerët</string>
-  <string name="action_unshare_file">Zhbëjeni ndarjen e lidhjes me të tjerët</string>
-  <string name="action_share_with_users">Ndajeni me përdoruesit</string>
   <string name="common_yes">Po</string>
   <string name="common_no">Jo</string>
   <string name="common_ok">OK</string>
   <string name="file_list__footer__files_and_folder">%1$d kartela, 1 dosje</string>
   <string name="file_list__footer__files_and_folders">%1$d kartela, %2$d dosje</string>
   <string name="share_dialog_title">Ndarje me të tjerët</string>
-  <string name="share_with_user_section_title">Ndani me Përdorues dhe Grupe</string>
   <string name="share_no_users">Ende pa të dhëna të ndara me përdorues</string>
   <string name="share_add_user_or_group">Shtoni Përdorues ose Grup</string>
   <string name="share_search">Kërko</string>
index cde6c3d..24bc8eb 100644 (file)
@@ -30,7 +30,6 @@
   <string name="filedetails_size">Veličina:</string>
   <string name="filedetails_type">Tip:</string>
   <string name="filedetails_download">Preuzmi</string>
-  <string name="action_share_file">Podeli prečicu</string>
   <string name="common_yes">Da</string>
   <string name="common_no">Ne</string>
   <string name="common_ok">Ok</string>
index f38facb..f30a6ad 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">Преузми</string>
   <string name="filedetails_renamed_in_upload_msg">Фајл је преименован у %1$s током отпремања</string>
   <string name="list_layout">Распоред листе</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>
index 6766749..4c2c962 100644 (file)
@@ -73,8 +73,6 @@
   <string name="filedetails_modified">Ändrad:</string>
   <string name="filedetails_download">Ladda ner</string>
   <string name="filedetails_renamed_in_upload_msg">Filen bytte namn till %1$s under uppladdningen</string>
-  <string name="action_share_file">Dela länk</string>
-  <string name="action_unshare_file">Sluta dela länk</string>
   <string name="common_yes">Ja</string>
   <string name="common_no">Nej</string>
   <string name="common_ok">OK</string>
index 1dc33c1..adb5208 100644 (file)
@@ -82,9 +82,6 @@
   <string name="filedetails_sync_file">ประสานข้อมูล</string>
   <string name="filedetails_renamed_in_upload_msg">ไฟล์ได้ถูกเปลี่ยนชื่อเป็น %1$s ในระหว่างการอัพโหลด</string>
   <string name="list_layout">เค้าโครงรายการ</string>
-  <string name="action_share_file">แชร์ลิงค์</string>
-  <string name="action_unshare_file">ยกเลิกการแชร์ลิงค์</string>
-  <string name="action_share_with_users">แชร์กับผู้ใช้</string>
   <string name="common_yes">ตกลง</string>
   <string name="common_no">ไม่ตกลง</string>
   <string name="common_ok">ตกลง</string>
   <string name="file_list__footer__files_and_folder">%1$d ไฟล์, 1 โฟลเดอร์</string>
   <string name="file_list__footer__files_and_folders">%1$d ไฟล์, %2$d โฟลเดอร์</string>
   <string name="share_dialog_title">การแชร์ข้อมูล</string>
-  <string name="share_with_user_section_title">แชร์ไปยังผู้ใช้หรือกลุ่ม</string>
   <string name="share_no_users">ยังไม่มีข้อมูลที่แชร์กับผู้ใช้ในตอนนี้</string>
   <string name="share_add_user_or_group">เพิ่มผู้ใช่หรือกลุ่ม</string>
   <string name="share_search">ค้นหา</string>
index 918e5e3..1dea4b8 100644 (file)
@@ -71,6 +71,7 @@
   <string name="file_list_seconds_ago">saniyeler önce</string>
   <string name="file_list_empty">Burada hiçbir şey yok. Bir şeyler yükleyin!</string>
   <string name="file_list_loading">Yükleniyor...</string>
+  <string name="file_list_no_app_for_file_type">Dosya tipi için uygulama bulunamadı!</string>
   <string name="local_file_list_empty">Bu klasörde dosya yok.</string>
   <string name="filedetails_select_file">Ek bilgileri görmek için dosyaya dokunun.</string>
   <string name="filedetails_size">Boyut:</string>
   <string name="filedetails_created">Oluşturulma:</string>
   <string name="filedetails_modified">Değiştirilme:</string>
   <string name="filedetails_download">İndir</string>
+  <string name="filedetails_sync_file">Eşitleme</string>
   <string name="filedetails_renamed_in_upload_msg">Dosya adı, yükleme sırasında %1$s olarak değiştirildi</string>
   <string name="list_layout">Liste Yerleşimi</string>
-  <string name="action_share_file">Paylaşma bağlantısı</string>
-  <string name="action_unshare_file">Bağlantı paylaşımını kaldır</string>
   <string name="common_yes">Evet</string>
   <string name="common_no">Hayır</string>
   <string name="common_ok">Tamam</string>
+  <string name="common_cancel_sync">Eşitlemeyi iptal et</string>
   <string name="common_cancel">İptal</string>
   <string name="common_save_exit">Kaydet ve Çık</string>
   <string name="common_error">Hata</string>
   <string name="ssl_validator_label_validity_to">Bitiş:</string>
   <string name="ssl_validator_label_signature">İmza:</string>
   <string name="ssl_validator_label_signature_algorithm">Algoritma:</string>
+  <string name="digest_algorithm_not_available">Özümlenen algoritma telefonunuz için mevcut değil</string>
+  <string name="ssl_validator_label_certificate_fingerprint">Parmak izi:</string>
+  <string name="certificate_load_problem">Sertifika yüklemesinde problem var.</string>
   <string name="ssl_validator_null_cert">Sertifika gösterilemedi.</string>
   <string name="ssl_validator_no_info_about_error">- Hata hakkında bilgi yok</string>
   <string name="placeholder_sentence">Bu bir yer tutucudur</string>
   <string name="prefs_category_instant_uploading">Anında Yüklemeler</string>
   <string name="prefs_category_security">Güvenlik</string>
   <string name="prefs_instant_video_upload_path_title">Video Yükleme Yolu</string>
+  <string name="sync_folder_failed_content">%1$s klasörünün eşitlemesi tamamlanamadı</string>
   <string name="shared_subject_header">sizinle</string>
   <string name="with_you_subject_header">paylaştı</string>
   <string name="subject_user_shared_with_you">%1$s, sizinle \"%2$s\" paylaşımını yaptı</string>
   <string name="file_list__footer__files_and_folder">%1$d dosya, 1 klasör</string>
   <string name="file_list__footer__files_and_folders">%1$d dosya, %2$d klasör</string>
   <string name="share_dialog_title">Paylaşım</string>
+  <string name="share_no_users">Henüz kullanıcılara paylaşılan veri yok</string>
+  <string name="share_add_user_or_group">Kullanıcı veya Grup ekle</string>
   <string name="share_search">Ara</string>
+  <string name="search_users_and_groups_hint">Kullanıcı ve Grupları Ara</string>
+  <string name="share_group_clarification">%1$s (grup)</string>
+  <string name="share_sharee_unavailable">Üzgünüz sunucu versiyonunuz istemcilerdeki kullanıcılara paylaşıma izin vermiyor.
+\nLütfen yöneticinize başvurun</string>
 </resources>
index fed88ce..ebe436b 100644 (file)
@@ -81,8 +81,6 @@
   <string name="filedetails_download">Завантажити</string>
   <string name="filedetails_renamed_in_upload_msg">Файл був переіменований в %1$s протягом вивантаження</string>
   <string name="list_layout">Вигляд списку</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">OK</string>
index 111a866..e1ffd9f 100644 (file)
@@ -16,7 +16,6 @@
   <string name="setup_btn_connect">منسلک</string>
   <string name="file_list_seconds_ago">سیکنڈز پہلے</string>
   <string name="filedetails_download">ڈاؤن لوڈ،</string>
-  <string name="action_share_file">اشتراک لنک</string>
   <string name="common_yes">ہاں</string>
   <string name="common_no">نہیں</string>
   <string name="common_ok">اوکے</string>
index 6ec7515..419d212 100644 (file)
@@ -58,8 +58,6 @@
   <string name="filedetails_modified">Đã chỉnh sửa:</string>
   <string name="filedetails_download">Tải về</string>
   <string name="filedetails_renamed_in_upload_msg">Tập tin đã bị đổi tên thành %1$s trong quá trình tải lên</string>
-  <string name="action_share_file">Chia sẻ liên kết</string>
-  <string name="action_unshare_file">Liên kết không chia sẻ</string>
   <string name="common_yes">Yes</string>
   <string name="common_no">Không</string>
   <string name="common_ok">Chấp nhận</string>
index 39d4ea9..322abda 100644 (file)
@@ -81,8 +81,6 @@
   <string name="filedetails_download">下载</string>
   <string name="filedetails_renamed_in_upload_msg">上传过程中文件被更名为了 %1$s</string>
   <string name="list_layout">列表布局</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>
index 50f708a..176f283 100644 (file)
@@ -38,8 +38,6 @@
   <string name="filedetails_created">建立時間:</string>
   <string name="filedetails_modified">修改時間:</string>
   <string name="filedetails_download">下載</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>
index c783957..58e64ba 100644 (file)
@@ -80,8 +80,6 @@
   <string name="filedetails_download">下載</string>
   <string name="filedetails_renamed_in_upload_msg">檔案名稱在上傳時已被更改為 %1$s</string>
   <string name="list_layout">列表版型</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="file_list__footer__files_and_folder">%1$d 個檔案, 1 個資料夾</string>
   <string name="file_list__footer__files_and_folders">%1$d 個檔案, %2$d 個資料夾</string>
   <string name="share_dialog_title">分享</string>
-  <string name="share_with_user_section_title">與用戶或群組分享</string>
   <string name="share_no_users">目前沒有任何您分享的內容</string>
   <string name="share_add_user_or_group">新增使用者或是群組</string>
   <string name="share_search">搜尋</string>
index 7625c94..68597bf 100644 (file)
@@ -84,9 +84,7 @@
     <string name="filedetails_sync_file">Synchronize</string>
     <string name="filedetails_renamed_in_upload_msg">File was renamed to %1$s during upload</string>
     <string name="list_layout">List Layout</string>
-    <string name="action_share_file">Share link</string>
-    <string name="action_unshare_file">Unshare link</string>
-    <string name="action_share_with_users">Share with users</string>
+    <string name="action_share">Share</string>
     <string name="common_yes">Yes</string>
     <string name="common_no">No</string>
     <string name="common_ok">OK</string>
        <string name="share_link_file_error">An error occurred while trying to share this file or folder</string>
        <string name="unshare_link_file_no_exist">Unable to unshare. Please check whether the file exists</string>
        <string name="unshare_link_file_error">An error occurred while trying to unshare this file or folder</string>
+    <string name="update_link_file_no_exist">Unable to update. Please check whether the file exists </string>
+    <string name="update_link_file_error">An error occurred while trying to update the shared link</string>
     <string name="share_link_password_title">Enter a password</string>
     <string name="share_link_empty_password">You must enter a password</string>
 
     <string name="forbidden_permissions_delete">to delete this file</string>
     <string name="share_link_forbidden_permissions">to share this file</string>
     <string name="unshare_link_forbidden_permissions">to unshare this file</string>
+    <string name="update_link_forbidden_permissions">to update this shared link</string>
     <string name="forbidden_permissions_create">to create the file</string>
     <string name="uploader_upload_forbidden_permissions">to upload in this folder</string>
     <string name="downloader_download_file_not_found">The file is no longer available on the server</string>
     <string name="set_as">Set As</string>
 
     <string name="share_dialog_title">Sharing</string>
-    <string name="share_with_user_section_title">Share with Users and Groups</string>
+    <string name="share_with_user_section_title">Share with users and groups</string>
     <string name="share_no_users">No data shared with users yet</string>
     <string name="share_add_user_or_group">Add User or Group</string>
+    <string name="share_via_link_section_title">Share link</string>
+    <string name="share_via_link_expiration_date_label">Set expiration date</string>
+    <string name="share_via_link_password_label">Password protect</string>
+    <string name="share_via_link_password_title">Secured</string>
+    <string name="share_get_public_link_button">Get link</string>
+
     <string name="share_search">Search</string>
 
     <string name="search_users_and_groups_hint">Search users and groups</string>
index 4ce3d42..3e07375 100644 (file)
 
 package com.owncloud.android.datamodel;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
 import android.accounts.Account;
 import android.content.ContentProviderClient;
 import android.content.ContentProviderOperation;
@@ -53,6 +43,21 @@ import com.owncloud.android.lib.resources.status.CapabilityBooleanType;
 import com.owncloud.android.lib.resources.status.OCCapability;
 import com.owncloud.android.utils.FileStorageUtils;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
 public class FileDataStorageManager {
 
     public static final int ROOT_PARENT_ID = 0;
@@ -956,20 +961,20 @@ public class FileDataStorageManager {
         );
         cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
         cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
-        cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getIdRemoteShared());
+        cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
         cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
 
-        if (shareExists(share.getIdRemoteShared())) {// for renamed files; no more delete and create
+        if (shareExists(share.getRemoteId())) {// for renamed files; no more delete and create
             overriden = true;
             if (getContentResolver() != null) {
                 getContentResolver().update(ProviderTableMeta.CONTENT_URI_SHARE, cv,
                         ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + "=?",
-                        new String[]{String.valueOf(share.getIdRemoteShared())});
+                        new String[]{String.valueOf(share.getRemoteId())});
             } else {
                 try {
                     getContentProviderClient().update(ProviderTableMeta.CONTENT_URI_SHARE,
                             cv, ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + "=?",
-                            new String[]{String.valueOf(share.getIdRemoteShared())});
+                            new String[]{String.valueOf(share.getRemoteId())});
                 } catch (RemoteException e) {
                     Log_OC.e(TAG,
                             "Fail to insert insert file to database "
@@ -1002,16 +1007,42 @@ public class FileDataStorageManager {
     }
 
 
+    /**
+     * Get first share bound to a file with a known path and given {@link ShareType}.
+     *
+     * @param path          Path of the file.
+     * @param type          Type of the share to get
+     * @param shareWith     Target of the share. Ignored in type is {@link ShareType#PUBLIC_LINK}
+     * @return              First {@OCShare} instance found in DB bound to the file in 'path'
+     */
     public OCShare getFirstShareByPathAndType(String path, ShareType type, String shareWith) {
         Cursor c = null;
+        if (shareWith == null) {
+            shareWith = "";
+        }
 
         String selection = ProviderTableMeta.OCSHARES_PATH + "=? AND "
                 + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? AND "
-                + ProviderTableMeta.OCSHARES_SHARE_WITH + "=? AND "
                 + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?" ;
+        if (!ShareType.PUBLIC_LINK.equals(type)) {
+            selection += " AND " + ProviderTableMeta.OCSHARES_SHARE_WITH + "=?";
+        }
 
-        String [] selectionArgs =  new String[]{path, Integer.toString(type.getValue()),
-                shareWith, mAccount.name};
+        String [] selectionArgs;
+        if (ShareType.PUBLIC_LINK.equals(type)) {
+            selectionArgs = new String[]{
+                    path,
+                    Integer.toString(type.getValue()),
+                    mAccount.name
+            };
+        } else {
+            selectionArgs = new String[]{
+                    path,
+                    Integer.toString(type.getValue()),
+                    mAccount.name,
+                    shareWith
+            };
+        }
 
         if (getContentResolver() != null) {
             c = getContentResolver().query(
@@ -1211,16 +1242,16 @@ public class FileDataStorageManager {
                 );
                 cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
                 cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
-                cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getIdRemoteShared());
+                cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
                 cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
 
-                if (shareExists(share.getIdRemoteShared())) {
+                if (shareExists(share.getRemoteId())) {
                     // updating an existing file
                     operations.add(
                             ContentProviderOperation.newUpdate(ProviderTableMeta.CONTENT_URI_SHARE).
                                     withValues(cv).
                                     withSelection(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + "=?",
-                                            new String[]{String.valueOf(share.getIdRemoteShared())})
+                                            new String[]{String.valueOf(share.getRemoteId())})
                                     .build());
                 } else {
                     // adding a new file
@@ -1424,6 +1455,30 @@ public class FileDataStorageManager {
 //        updateSharedFiles(sharedFiles);
     }
 
+    public void removeSharesForFile(String remotePath) {
+        resetShareFlagInAFile(remotePath);
+        ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>();
+        operations = prepareRemoveSharesInFile(remotePath, operations);
+        // apply operations in batch
+        if (operations.size() > 0) {
+            Log_OC.d(TAG, "Sending " + operations.size() + " operations to FileContentProvider");
+            try {
+                if (getContentResolver() != null) {
+                    getContentResolver().applyBatch(MainApp.getAuthority(), operations);
+
+                } else {
+                    getContentProviderClient().applyBatch(operations);
+                }
+
+            } catch (OperationApplicationException e) {
+                Log_OC.e(TAG, "Exception in batch of operations " + e.getMessage());
+
+            } catch (RemoteException e) {
+                Log_OC.e(TAG, "Exception in batch of operations  " + e.getMessage());
+            }
+        }
+    }
+
 
     public void saveSharesInFolder(ArrayList<OCShare> shares, OCFile folder) {
         resetShareFlagsInFolder(folder);
@@ -1484,7 +1539,7 @@ public class FileDataStorageManager {
                 );
                 cv.put(ProviderTableMeta.OCSHARES_IS_DIRECTORY, share.isFolder() ? 1 : 0);
                 cv.put(ProviderTableMeta.OCSHARES_USER_ID, share.getUserId());
-                cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getIdRemoteShared());
+                cv.put(ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED, share.getRemoteId());
                 cv.put(ProviderTableMeta.OCSHARES_ACCOUNT_OWNER, mAccount.name);
 
                 // adding a new share resource
@@ -1882,6 +1937,8 @@ public class FileDataStorageManager {
 
         if (c.moveToFirst()) {
             capability = createCapabilityInstance(c);
+        } else {
+            capability = new OCCapability();    // return default with all UNKNOWN
         }
         c.close();
         return capability;
index 0b7eb81..6525303 100644 (file)
@@ -184,34 +184,19 @@ public class FileMenuFilter {
         }
 
         // SHARE FILE
-        // TODO add check on SHARE available on server side?
         boolean shareAllowed = (mContext != null  &&
                 mContext.getString(R.string.share_feature).equalsIgnoreCase("on"));
-        if (!shareAllowed || mFile == null) {
-            toHide.add(R.id.action_share_file);
-        } else {
-            toShow.add(R.id.action_share_file);
-        }
-
-        // UNSHARE FILE
-        // TODO add check on SHARE available on server side?
-        if ( !shareAllowed || (mFile == null || !mFile.isSharedViaLink())) {
-            toHide.add(R.id.action_unshare_file);
-        } else {
-            toShow.add(R.id.action_unshare_file);
-        }
-
-        // SHARE FILE, with Users
         OCCapability capability = mComponentsGetter.getStorageManager().getCapability(mAccount.name);
         boolean shareApiEnabled  = capability != null &&
-                (capability.getFilesSharingApiEnabled().isTrue() || capability.getFilesSharingApiEnabled().isUnknown());
-        if (!shareAllowed ||  mFile == null || !shareApiEnabled ) {
-            toHide.add(R.id.action_share_with_users);
+                (capability.getFilesSharingApiEnabled().isTrue() ||
+                        capability.getFilesSharingApiEnabled().isUnknown()
+                );
+        if (!shareAllowed ||  mFile == null || !shareApiEnabled) {
+            toHide.add(R.id.action_share_file);
         } else {
-            toShow.add(R.id.action_share_with_users);
+            toShow.add(R.id.action_share_file);
         }
 
-
         // SEE DETAILS
         if (mFile == null || mFile.isFolder()) {
             toHide.add(R.id.action_see_details);
index f5050d4..989b848 100644 (file)
@@ -51,8 +51,8 @@ import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.adapter.DiskLruImageCacheFileProvider;
 import com.owncloud.android.ui.activity.ShareActivity;
 import com.owncloud.android.ui.dialog.ShareLinkToDialog;
+import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
 
-import org.apache.http.protocol.HTTP;
 
 import java.io.File;
 import java.util.List;
@@ -156,19 +156,32 @@ public class FileOperationsHelper {
                 .show();
     }
 
-    public void shareFileWithLink(OCFile file) {
 
+    /**
+     * Helper method to share a file via a public link. Starts a request to do it in {@link OperationsService}
+     *
+     * @param file          The file to share.
+     * @param password      Optional password to protect the public share.
+     */
+    public void shareFileViaLink(OCFile file, String password) {
         if (isSharedSupported()) {
             if (file != null) {
-                String link = "https://fake.url";
-                Intent intent = createShareWithLinkIntent(link);
-                String[] packagesToExclude = new String[]{mFileActivity.getPackageName()};
-                DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intent,
-                        packagesToExclude, file);
-                chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
+                mFileActivity.showLoadingDialog(
+                        mFileActivity.getApplicationContext().
+                                getString(R.string.wait_a_moment)
+                );
+                Intent service = new Intent(mFileActivity, OperationsService.class);
+                service.setAction(OperationsService.ACTION_CREATE_SHARE_VIA_LINK);
+                service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
+                if (password != null && password.length() > 0) {
+                    service.putExtra(OperationsService.EXTRA_SHARE_PASSWORD, password);
+                }
+                service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
+                mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
 
             } else {
                 Log_OC.wtf(TAG, "Trying to share a NULL OCFile");
+                // TODO user-level error?
             }
 
         } else {
@@ -181,6 +194,30 @@ public class FileOperationsHelper {
         }
     }
 
+    public void getFileWithLink(OCFile file){
+        if (isSharedSupported()) {
+            if (file != null) {
+                mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
+                        getString(R.string.wait_a_moment));
+
+                Intent service = new Intent(mFileActivity, OperationsService.class);
+                service.setAction(OperationsService.ACTION_CREATE_SHARE_VIA_LINK);
+                service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
+                service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
+                mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
+
+            } else {
+                Log_OC.wtf(TAG, "Trying to share a NULL OCFile");
+            }
+        } else {
+            // Show a Message
+            Toast t = Toast.makeText(
+                    mFileActivity, mFileActivity.getString(R.string.share_link_no_support_share_api),
+                    Toast.LENGTH_LONG
+            );
+            t.show();
+        }
+    }
 
     public void shareFileWithLinkToApp(OCFile file, String password, Intent sendIntent) {
         
@@ -192,7 +229,7 @@ public class FileOperationsHelper {
             service.setAction(OperationsService.ACTION_CREATE_SHARE_VIA_LINK);
             service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
             service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
-            service.putExtra(OperationsService.EXTRA_PASSWORD_SHARE, password);
+            service.putExtra(OperationsService.EXTRA_SHARE_PASSWORD, password);
             service.putExtra(OperationsService.EXTRA_SEND_INTENT, sendIntent);
             mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service);
             
@@ -201,17 +238,8 @@ public class FileOperationsHelper {
         }
     }
 
-
-    private Intent createShareWithLinkIntent(String link) {
-        Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
-        intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
-        intentToShareLink.setType(HTTP.PLAIN_TEXT_TYPE);
-        return intentToShareLink;
-    }
-
-
     /**
-     * Helper method to share a file with a know sharee. Starts a request to do it in {@link OperationsService}
+     * Helper method to share a file with a known sharee. Starts a request to do it in {@link OperationsService}
      *
      * @param file          The file to share.
      * @param shareeName    Name (user name or group name) of the target sharee.
@@ -249,7 +277,13 @@ public class FileOperationsHelper {
     }
 
 
-    public void unshareFileWithLink(OCFile file) {
+    /**
+     * Helper method to unshare a file publicly shared via link.
+     * Starts a request to do it in {@link OperationsService}
+     *
+     * @param file      The file to unshare.
+     */
+    public void unshareFileViaLink(OCFile file) {
 
         // Unshare the file: Create the intent
         Intent unshareService = new Intent(mFileActivity, OperationsService.class);
@@ -259,7 +293,7 @@ public class FileOperationsHelper {
         unshareService.putExtra(OperationsService.EXTRA_SHARE_TYPE, ShareType.PUBLIC_LINK);
         unshareService.putExtra(OperationsService.EXTRA_SHARE_WITH, "");
 
-        unshareFile(unshareService);
+        queueShareIntent(unshareService);
     }
 
     public void unshareFileWithUserOrGroup(OCFile file, ShareType shareType, String userOrGroup){
@@ -272,15 +306,15 @@ public class FileOperationsHelper {
         unshareService.putExtra(OperationsService.EXTRA_SHARE_TYPE, shareType);
         unshareService.putExtra(OperationsService.EXTRA_SHARE_WITH, userOrGroup);
 
-        unshareFile(unshareService);
+        queueShareIntent(unshareService);
     }
 
 
-    private void unshareFile(Intent unshareService){
+    private void queueShareIntent(Intent shareIntent){
         if (isSharedSupported()) {
             // Unshare the file
             mWaitingForOpId = mFileActivity.getOperationsServiceBinder().
-                    queueNewOperation(unshareService);
+                    queueNewOperation(shareIntent);
 
             mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext().
                     getString(R.string.wait_a_moment));
@@ -310,6 +344,67 @@ public class FileOperationsHelper {
 
 
     /**
+     * Starts a dialog that requests a password to the user to protect a share link.
+     *
+     * @param   file            File which public share will be protected by the requested password
+     * @param   createShare     When 'true', the request for password will be followed by the creation of a new
+     *                          public link; when 'false', a public share is assumed to exist, and the password
+     *                          is bound to it.
+     */
+    public void requestPasswordForShareViaLink(OCFile file, boolean createShare) {
+        SharePasswordDialogFragment dialog =
+                SharePasswordDialogFragment.newInstance(file, createShare);
+        dialog.show(
+                mFileActivity.getSupportFragmentManager(),
+                SharePasswordDialogFragment.PASSWORD_FRAGMENT
+        );
+    }
+
+    /**
+     * Updates a public share on a file to set its password.
+     * Starts a request to do it in {@link OperationsService}
+     *
+     * @param file          File which public share will be protected with a password.
+     * @param password      Password to set for the public link; null or empty string to clear
+     *                      the current password
+     */
+    public void setPasswordToShareViaLink(OCFile file, String password) {
+        // Set password updating share
+        Intent updateShareIntent = new Intent(mFileActivity, OperationsService.class);
+        updateShareIntent.setAction(OperationsService.ACTION_UPDATE_SHARE);
+        updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
+        updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
+        updateShareIntent.putExtra(
+                OperationsService.EXTRA_SHARE_PASSWORD,
+                (password == null) ? "" : password
+        );
+
+        queueShareIntent(updateShareIntent);
+    }
+
+
+    /**
+     * Updates a public share on a file to set its expiration date.
+     * Starts a request to do it in {@link OperationsService}
+     *
+     * @param file                      File which public share will be constrained with an expiration date.
+     * @param expirationTimeInMillis    Expiration date to set. A negative value clears the current expiration
+     *                                  date, leaving the link unrestricted. Zero makes no change.
+     */
+    public void setExpirationDateToShareViaLink(OCFile file, long expirationTimeInMillis) {
+        Intent updateShareIntent = new Intent(mFileActivity, OperationsService.class);
+        updateShareIntent.setAction(OperationsService.ACTION_UPDATE_SHARE);
+        updateShareIntent.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount());
+        updateShareIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
+        updateShareIntent.putExtra(
+                OperationsService.EXTRA_SHARE_EXPIRATION_DATE_IN_MILLIS,
+                expirationTimeInMillis
+        );
+        queueShareIntent(updateShareIntent);
+    }
+
+
+    /**
      * @return 'True' if the server supports the Search Users API
      */
     public boolean isSearchUsersSupportedSupported() {
@@ -332,8 +427,7 @@ public class FileOperationsHelper {
 
             // Show dialog, without the own app
             String[] packagesToExclude = new String[]{mFileActivity.getPackageName()};
-            DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent,
-                    packagesToExclude, file);
+            DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude);
             chooserDialog.show(mFileActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
 
         } else {
@@ -575,4 +669,5 @@ public class FileOperationsHelper {
         }
         return false;
     }
+
 }
index 373c57d..e9cb7d2 100644 (file)
@@ -30,7 +30,6 @@ import android.content.Context;
 import android.content.Intent;
 
 import com.owncloud.android.R;
-import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -42,9 +41,9 @@ import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.operations.common.SyncOperation;
 
-public class CreateShareViaLinkOperation extends SyncOperation {
+import java.util.ArrayList;
 
-    protected FileDataStorageManager mStorageManager;
+public class CreateShareViaLinkOperation extends SyncOperation {
 
     private String mPath;
     private String mPassword;
@@ -76,10 +75,21 @@ public class CreateShareViaLinkOperation extends SyncOperation {
         // Check if the share link already exists
         RemoteOperation operation = new GetRemoteSharesForFileOperation(mPath, false, false);
         RemoteOperationResult result = operation.execute(client);
-        // TODO - fix this check; if the user already shared the file with users or group, a share via link will not be created
 
-        if (!result.isSuccess() || result.getData().size() <= 0) {
-            operation = new CreateRemoteShareOperation(
+        boolean shareByLink = false;
+        // Check if the file is shared by link
+        if (result.isSuccess() && result.getData().size() > 0){
+            ArrayList<Object> shares = result.getData();
+            for(Object object: shares){
+                if (((OCShare) object).getShareType() == ShareType.PUBLIC_LINK){
+                    shareByLink = true;
+                    break;
+                }
+            }
+        }
+
+        if (!result.isSuccess() || !shareByLink) {
+            CreateRemoteShareOperation createOp = new CreateRemoteShareOperation(
                     mPath,
                     ShareType.PUBLIC_LINK,
                     "",
@@ -87,7 +97,8 @@ public class CreateShareViaLinkOperation extends SyncOperation {
                     mPassword,
                     OCShare.DEFAULT_PERMISSION
             );
-            result = operation.execute(client);
+            createOp.setGetShareDetails(true);
+            result = createOp.execute(client);
         }
         
         if (result.isSuccess()) {
@@ -148,10 +159,12 @@ public class CreateShareViaLinkOperation extends SyncOperation {
         // 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.setShareViaLink(true);
             getStorageManager().saveFile(file);
+            if (mSendIntent != null) {
+                mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink());
+            }
         }
     }
 
index 62c3be1..a04d415 100644 (file)
@@ -72,6 +72,11 @@ public class GetSharesForFileOperation extends SyncOperation {
             }
 
             getStorageManager().saveSharesDB(shares);
+
+        } else if (result.getCode() == RemoteOperationResult.ResultCode.SHARE_NOT_FOUND) {
+            // no share on the file - remove local shares
+            getStorageManager().removeSharesForFile(mPath);
+
         }
 
         return result;
index 87dde21..f9f9e8c 100644 (file)
@@ -246,7 +246,7 @@ public class RefreshFolderOperation extends RemoteOperation {
         GetCapabilitiesOperarion getCapabilities = new GetCapabilitiesOperarion();
         RemoteOperationResult  result = getCapabilities.execute(mStorageManager,mContext);
         if (!result.isSuccess()){
-            Log_OC.d(TAG, "Update Capabilities unsuccessfully");
+            Log_OC.w(TAG, "Update Capabilities unsuccessfully");
         }
     }
 
index 4167831..d819abf 100644 (file)
@@ -69,11 +69,11 @@ public class UnshareOperation extends SyncOperation {
         if (share != null) {
             OCFile file = getStorageManager().getFileByPath(mRemotePath);
             RemoveRemoteShareOperation operation =
-                    new RemoveRemoteShareOperation((int) share.getIdRemoteShared());
+                    new RemoveRemoteShareOperation((int) share.getRemoteId());
             result = operation.execute(client);
 
             if (result.isSuccess()) {
-                Log_OC.d(TAG, "Share id = " + share.getIdRemoteShared() + " deleted");
+                Log_OC.d(TAG, "Share id = " + share.getRemoteId() + " deleted");
 
                 if (mShareType == ShareType.PUBLIC_LINK) {
                     file.setShareViaLink(false);
diff --git a/src/com/owncloud/android/operations/UpdateShareViaLinkOperation.java b/src/com/owncloud/android/operations/UpdateShareViaLinkOperation.java
new file mode 100644 (file)
index 0000000..14b60e8
--- /dev/null
@@ -0,0 +1,152 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.operations;
+
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.operations.RemoteOperation;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.files.FileUtils;
+import com.owncloud.android.lib.resources.shares.GetRemoteShareOperation;
+import com.owncloud.android.lib.resources.shares.OCShare;
+import com.owncloud.android.lib.resources.shares.ShareType;
+import com.owncloud.android.lib.resources.shares.UpdateRemoteShareOperation;
+import com.owncloud.android.operations.common.SyncOperation;
+
+import java.util.Calendar;
+
+
+/**
+ * Updates an existing public share for a given file
+ */
+
+public class UpdateShareViaLinkOperation extends SyncOperation {
+
+    private String mPath;
+    private String mPassword;
+    private long mExpirationDateInMillis;
+
+    /**
+     * Constructor
+     *
+     * @param path          Full path of the file/folder being shared. Mandatory argument
+     */
+    public UpdateShareViaLinkOperation(String path) {
+
+        mPath = path;
+        mPassword = null;
+        mExpirationDateInMillis = 0;
+    }
+
+
+    /**
+     * Set password to update in public link.
+     *
+     * @param password      Password to set to the public link.
+     *                      Empty string clears the current password.
+     *                      Null results in no update applied to the password.
+     */
+    public void setPassword(String password) {
+        mPassword = password;
+    }
+
+
+    /**
+     * Set expiration date to update in Share resource.
+     *
+     * @param expirationDateInMillis    Expiration date to set to the public link.
+     *                                  A negative value clears the current expiration date.
+     *                                  Zero value (start-of-epoch) results in no update done on
+     *                                  the expiration date.
+     */
+    public void setExpirationDate(long expirationDateInMillis) {
+        mExpirationDateInMillis = expirationDateInMillis;
+    }
+
+
+    @Override
+    protected RemoteOperationResult run(OwnCloudClient client) {
+
+        OCShare publicShare = getStorageManager().getFirstShareByPathAndType(
+                mPath,
+                ShareType.PUBLIC_LINK,
+                ""
+        );
+
+        if (publicShare == null) {
+            // TODO try to get remote share before failing?
+            return new RemoteOperationResult(
+                    RemoteOperationResult.ResultCode.SHARE_NOT_FOUND
+            );
+        }
+
+        // Update remote share with password
+        UpdateRemoteShareOperation udpateOp = new UpdateRemoteShareOperation(
+            publicShare.getRemoteId()
+        );
+        udpateOp.setPassword(mPassword);
+        udpateOp.setExpirationDate(mExpirationDateInMillis);
+        RemoteOperationResult result = udpateOp.execute(client);
+
+        if (result.isSuccess()) {
+            // Retrieve updated share / save directly with password? -> no; the password is not be saved
+            RemoteOperation getShareOp = new GetRemoteShareOperation(publicShare.getRemoteId());
+            result = getShareOp.execute(client);
+            if (result.isSuccess()) {
+                OCShare share = (OCShare) result.getData().get(0);
+                updateData(share);
+            }
+        }
+
+        return result;
+    }
+
+    public String getPath() {
+        return mPath;
+    }
+
+    public String getPassword() {
+        return mPassword;
+    }
+
+    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);
+        }
+
+        getStorageManager().saveShare(share);   // TODO info about having a password? ask to Gonzalo
+
+        // Update OCFile with data from share: ShareByLink  and publicLink
+        // TODO check & remove if not needed
+        OCFile file = getStorageManager().getFileByPath(mPath);
+        if (file != null) {
+            file.setPublicLink(share.getShareLink());
+            file.setShareViaLink(true);
+            getStorageManager().saveFile(file);
+        }
+    }
+
+}
+
index eff8e03..b8658c9 100644 (file)
@@ -64,9 +64,11 @@ import com.owncloud.android.operations.RenameFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;
 import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareOperation;
+import com.owncloud.android.operations.UpdateShareViaLinkOperation;
 import com.owncloud.android.operations.common.SyncOperation;
 
 import java.io.IOException;
+import java.util.Calendar;
 import java.util.Iterator;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
@@ -88,15 +90,19 @@ public class OperationsService extends Service {
     public static final String EXTRA_RESULT = "RESULT";
     public static final String EXTRA_NEW_PARENT_PATH = "NEW_PARENT_PATH";
     public static final String EXTRA_FILE = "FILE";
-    public static final String EXTRA_PASSWORD_SHARE = "PASSWORD_SHARE";
+    public static final String EXTRA_SHARE_PASSWORD = "SHARE_PASSWORD";
     public static final String EXTRA_SHARE_TYPE = "SHARE_TYPE";
     public static final String EXTRA_SHARE_WITH = "SHARE_WITH";
+    public static final String EXTRA_SHARE_EXPIRATION_DATE_IN_MILLIS = "SHARE_EXPIRATION_YEAR";
+    public static final String EXTRA_SHARE_EXPIRATION_MONTH_OF_YEAR = "SHARE_EXPIRATION_MONTH_OF_YEAR";
+    public static final String EXTRA_SHARE_EXPIRATION_DAY_OF_MONTH = "SHARE_EXPIRATION_DAY_OF_MONTH";
 
     public static final String EXTRA_COOKIE = "COOKIE";
 
     public static final String ACTION_CREATE_SHARE_VIA_LINK = "CREATE_SHARE_VIA_LINK";
     public static final String ACTION_CREATE_SHARE_WITH_SHAREE = "CREATE_SHARE_WITH_SHAREE";
     public static final String ACTION_UNSHARE = "UNSHARE";
+    public static final String ACTION_UPDATE_SHARE = "UPDATE_SHARE";
     public static final String ACTION_GET_SERVER_INFO = "GET_SERVER_INFO";
     public static final String ACTION_OAUTH2_GET_ACCESS_TOKEN = "OAUTH2_GET_ACCESS_TOKEN";
     public static final String ACTION_GET_USER_NAME = "GET_USER_NAME";
@@ -553,7 +559,7 @@ public class OperationsService extends Service {
                 String action = operationIntent.getAction();
                 if (action.equals(ACTION_CREATE_SHARE_VIA_LINK)) {  // Create public share via link
                     String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                    String password = operationIntent.getStringExtra(EXTRA_PASSWORD_SHARE);
+                    String password = operationIntent.getStringExtra(EXTRA_SHARE_PASSWORD);
                     Intent sendIntent = operationIntent.getParcelableExtra(EXTRA_SEND_INTENT);
                     if (remotePath.length() > 0) {
                         operation = new CreateShareViaLinkOperation(
@@ -563,17 +569,35 @@ public class OperationsService extends Service {
                         );
                     }
 
-                } else if (action.equals(ACTION_CREATE_SHARE_WITH_SHAREE)) {  // Create private share with user or group
-                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
-                        String shareeName = operationIntent.getStringExtra(EXTRA_SHARE_WITH);
-                        ShareType shareType = (ShareType) operationIntent.getSerializableExtra(EXTRA_SHARE_TYPE);
-                        if (remotePath.length() > 0) {
-                            operation = new CreateShareWithShareeOperation(
-                                    remotePath,
-                                    shareeName,
-                                    shareType
-                            );
-                        }
+                } else if (ACTION_UPDATE_SHARE.equals(action)) {
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    if (remotePath.length() > 0) {
+                        operation = new UpdateShareViaLinkOperation(remotePath);
+
+                        String password = operationIntent.getStringExtra(EXTRA_SHARE_PASSWORD);
+                        ((UpdateShareViaLinkOperation)operation).setPassword(password);
+
+                        long expirationDate = operationIntent.getLongExtra(
+                                EXTRA_SHARE_EXPIRATION_DATE_IN_MILLIS,
+                                0
+                        );
+                        ((UpdateShareViaLinkOperation)operation).setExpirationDate(
+                                expirationDate
+                        );
+                    }
+
+                } else if (action.equals(ACTION_CREATE_SHARE_WITH_SHAREE)) {
+                    // Create private share with user or group
+                    String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                    String shareeName = operationIntent.getStringExtra(EXTRA_SHARE_WITH);
+                    ShareType shareType = (ShareType) operationIntent.getSerializableExtra(EXTRA_SHARE_TYPE);
+                    if (remotePath.length() > 0) {
+                        operation = new CreateShareWithShareeOperation(
+                                remotePath,
+                                shareeName,
+                                shareType
+                        );
+                    }
 
                 } else if (action.equals(ACTION_UNSHARE)) {  // Unshare file
                     String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
index 275f5d6..8a79443 100644 (file)
@@ -67,12 +67,14 @@ 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.common.utils.Log_OC;
+import com.owncloud.android.lib.resources.status.OCCapability;
 import com.owncloud.android.operations.CreateShareViaLinkOperation;
 import com.owncloud.android.operations.CreateShareWithShareeOperation;
 import com.owncloud.android.operations.GetSharesForFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;
 import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareOperation;
+import com.owncloud.android.operations.UpdateShareViaLinkOperation;
 import com.owncloud.android.services.OperationsService;
 import com.owncloud.android.services.OperationsService.OperationsServiceBinder;
 import com.owncloud.android.ui.NavigationDrawerItem;
@@ -93,8 +95,6 @@ public class FileActivity extends AppCompatActivity
 
     public static final String EXTRA_FILE = "com.owncloud.android.ui.activity.FILE";
     public static final String EXTRA_ACCOUNT = "com.owncloud.android.ui.activity.ACCOUNT";
-    public static final String EXTRA_WAITING_TO_PREVIEW =
-            "com.owncloud.android.ui.activity.WAITING_TO_PREVIEW";
     public static final String EXTRA_FROM_NOTIFICATION =
             "com.owncloud.android.ui.activity.FROM_NOTIFICATION";
 
@@ -113,9 +113,13 @@ public class FileActivity extends AppCompatActivity
     /** OwnCloud {@link Account} where the main {@link OCFile} handled by the activity is located.*/
     private Account mAccount;
 
-    /** Main {@link OCFile} handled by the activity.*/
+    /** Capabilites of the server where {@link #mAccount} lives */
+     private OCCapability mCapabilities;
+
+     /** Main {@link OCFile} handled by the activity.*/
     private OCFile mFile;
 
+
     /** Flag to signal that the activity will is finishing to enforce the creation of an ownCloud
      * {@link Account} */
     private boolean mRedirectingToSetupAccount = false;
@@ -141,12 +145,12 @@ public class FileActivity extends AppCompatActivity
 
     private OperationsServiceBinder mOperationsServiceBinder = null;
 
+    private boolean mResumed = false;
+
     protected FileDownloaderBinder mDownloaderBinder = null;
     protected FileUploaderBinder mUploaderBinder = null;
     private ServiceConnection mDownloadServiceConnection, mUploadServiceConnection = null;
 
-    private boolean mTryShareAgain = false;
-
     // Navigation Drawer
     protected DrawerLayout mDrawerLayout;
     protected ActionBarDrawerToggle mDrawerToggle;
@@ -161,6 +165,7 @@ public class FileActivity extends AppCompatActivity
     protected NavigationDrawerListAdapter mNavigationDrawerAdapter = null;
 
 
+
     // TODO re-enable when "Accounts" is available in Navigation Drawer
 //    protected boolean mShowAccounts = false;
 
@@ -183,7 +188,6 @@ public class FileActivity extends AppCompatActivity
             mFileOperationsHelper.setOpIdWaitingFor(
                     savedInstanceState.getLong(KEY_WAITING_FOR_OP_ID, Long.MAX_VALUE)
                     );
-            mTryShareAgain = savedInstanceState.getBoolean(KEY_TRY_SHARE_AGAIN);
             if (getSupportActionBar() != null) {
                 getSupportActionBar().setTitle(savedInstanceState.getString(KEY_ACTION_BAR_TITLE));
             }
@@ -255,7 +259,7 @@ public class FileActivity extends AppCompatActivity
     @Override
     protected void onResume() {
         super.onResume();
-
+        mResumed = true;
         if (mOperationsServiceBinder != null) {
             doOnResumeAndBound();
         }
@@ -266,7 +270,7 @@ public class FileActivity extends AppCompatActivity
         if (mOperationsServiceBinder != null) {
             mOperationsServiceBinder.removeOperationListener(this);
         }
-
+        mResumed = false;
         super.onPause();
     }
 
@@ -563,7 +567,6 @@ public class FileActivity extends AppCompatActivity
         outState.putParcelable(FileActivity.EXTRA_FILE, mFile);
         outState.putBoolean(FileActivity.EXTRA_FROM_NOTIFICATION, mFromNotification);
         outState.putLong(KEY_WAITING_FOR_OP_ID, mFileOperationsHelper.getOpIdWaitingFor());
-        outState.putBoolean(KEY_TRY_SHARE_AGAIN, mTryShareAgain);
         if(getSupportActionBar() != null && getSupportActionBar().getTitle() != null) {
             // Null check in case the actionbar is used in ActionBar.NAVIGATION_MODE_LIST
             // since it doesn't have a title then
@@ -607,6 +610,18 @@ public class FileActivity extends AppCompatActivity
         mAccount = account;
     }
 
+
+    /**
+     * Getter for the capabilities of the server where the current OC account lives.
+     *
+     * @return  Capabilities of the server where the current OC account lives. Null if the account is not
+     *          set yet.
+     */
+    public OCCapability getCapabilities() {
+        return mCapabilities;
+    }
+
+
     /**
      * @return Value of mFromNotification: True if the Activity is launched by a notification
      */
@@ -621,14 +636,6 @@ public class FileActivity extends AppCompatActivity
         return mRedirectingToSetupAccount;
     }
 
-    public boolean isTryShareAgain(){
-        return mTryShareAgain;
-    }
-
-    public void setTryShareAgain(boolean tryShareAgain) {
-       mTryShareAgain = tryShareAgain;
-    }
-
     public OperationsServiceBinder getOperationsServiceBinder() {
         return mOperationsServiceBinder;
     }
@@ -685,6 +692,7 @@ public class FileActivity extends AppCompatActivity
     protected void onAccountSet(boolean stateWasRecovered) {
         if (getAccount() != null) {
             mStorageManager = new FileDataStorageManager(getAccount(), getContentResolver());
+            mCapabilities = mStorageManager.getCapability(mAccount.name);
 
         } else {
             Log_OC.wtf(TAG, "onAccountChanged was called with NULL account associated!");
@@ -739,12 +747,12 @@ public class FileActivity extends AppCompatActivity
                         Toast.LENGTH_LONG);
                 t.show();
             }
-            mTryShareAgain = false;
 
         } else if (operation == null ||
                 operation instanceof CreateShareWithShareeOperation ||
                 operation instanceof UnshareOperation ||
-                operation instanceof SynchronizeFolderOperation
+                operation instanceof SynchronizeFolderOperation ||
+                operation instanceof UpdateShareViaLinkOperation
                 ) {
             if (result.isSuccess()) {
                 updateFileFromDB();
@@ -763,10 +771,10 @@ public class FileActivity extends AppCompatActivity
             onSynchronizeFileOperationFinish((SynchronizeFileOperation) operation, result);
 
         } else if (operation instanceof GetSharesForFileOperation) {
-            if (result.isSuccess()) {
+            if (result.isSuccess() || result.getCode() == ResultCode.SHARE_NOT_FOUND) {
                 updateFileFromDB();
 
-            } else if (result.getCode() != ResultCode.SHARE_NOT_FOUND) {
+            } else {
                 Toast t = Toast.makeText(this,
                         ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
                         Toast.LENGTH_LONG);
@@ -790,25 +798,31 @@ public class FileActivity extends AppCompatActivity
     private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation operation,
                                                      RemoteOperationResult result) {
         if (result.isSuccess()) {
-            mTryShareAgain = false;
             updateFileFromDB();
 
             Intent sendIntent = operation.getSendIntentWithSubject(this);
-            startActivity(sendIntent);
+            if (sendIntent != null) {
+                startActivity(sendIntent);
+            }
+
         } else {
             // Detect Failure (403) --> needs Password
             if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
-                if (!isTryShareAgain()) {
+                String password = operation.getPassword();
+                if ((password == null || password.length() == 0) &&
+                    getCapabilities().getFilesSharingPublicEnabled().isUnknown())
+                    {
+                    // Was tried without password, but not sure that it's optional. Try with password.
+                    // Try with password before giving up.
+                    // See also ShareFileFragment#OnShareViaLinkListener
                     SharePasswordDialogFragment dialog =
-                            SharePasswordDialogFragment.newInstance(new OCFile(operation.getPath()),
-                                    operation.getSendIntent());
+                            SharePasswordDialogFragment.newInstance(new OCFile(operation.getPath()), true);
                     dialog.show(getSupportFragmentManager(), DIALOG_SHARE_PASSWORD);
                 } else {
                     Toast t = Toast.makeText(this,
                         ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
                         Toast.LENGTH_LONG);
                     t.show();
-                    mTryShareAgain = false;
                 }
             } else {
                 Toast t = Toast.makeText(this,
@@ -901,7 +915,9 @@ public class FileActivity extends AppCompatActivity
                 /*if (!mOperationsServiceBinder.isPerformingBlockingOperation()) {
                     dismissLoadingDialog();
                 }*/
-                doOnResumeAndBound();
+                if (mResumed) {
+                    doOnResumeAndBound();
+                }
 
             } else {
                 return;
index 39649ef..e69eb04 100644 (file)
@@ -51,6 +51,7 @@ import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.view.GravityCompat;
+import android.support.v7.app.AlertDialog;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
@@ -80,14 +81,11 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.CopyFileOperation;
 import com.owncloud.android.operations.CreateFolderOperation;
-import com.owncloud.android.operations.CreateShareViaLinkOperation;
-import com.owncloud.android.operations.CreateShareWithShareeOperation;
 import com.owncloud.android.operations.MoveFileOperation;
 import com.owncloud.android.operations.RefreshFolderOperation;
 import com.owncloud.android.operations.RemoveFileOperation;
 import com.owncloud.android.operations.RenameFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;
-import com.owncloud.android.operations.UnshareOperation;
 import com.owncloud.android.services.observer.FileObserverService;
 import com.owncloud.android.syncadapter.FileSyncAdapter;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
@@ -1441,15 +1439,6 @@ public class FileDisplayActivity extends HookActivity
         } else if (operation instanceof CreateFolderOperation) {
             onCreateFolderOperationFinish((CreateFolderOperation) operation, result);
 
-        } else if (operation instanceof CreateShareViaLinkOperation ||
-                    operation instanceof CreateShareWithShareeOperation ) {
-
-            refreshShowDetails();
-            refreshListOfFilesFragment();
-
-        } else if (operation instanceof UnshareOperation) {
-            onUnshareLinkOperationFinish((UnshareOperation) operation, result);
-
         } else if (operation instanceof MoveFileOperation) {
             onMoveFileOperationFinish((MoveFileOperation) operation, result);
 
@@ -1459,18 +1448,6 @@ public class FileDisplayActivity extends HookActivity
 
     }
 
-    private void onUnshareLinkOperationFinish(UnshareOperation operation,
-                                              RemoteOperationResult result) {
-        if (result.isSuccess()) {
-            refreshShowDetails();
-            refreshListOfFilesFragment();
-
-        } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
-            cleanSecondFragment();
-            refreshListOfFilesFragment();
-        }
-    }
-
     private void refreshShowDetails() {
         FileFragment details = getSecondFragment();
         if (details != null) {
index 180b2a0..bf6e37a 100644 (file)
@@ -25,11 +25,14 @@ import android.app.SearchManager;
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
+import android.support.v4.app.DialogFragment;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentTransaction;
 
 import com.owncloud.android.R;
 import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.operations.CreateShareViaLinkOperation;
+import com.owncloud.android.operations.GetSharesForFileOperation;
 import com.owncloud.android.providers.UsersAndGroupsSearchProvider;
 
 import com.owncloud.android.lib.common.operations.RemoteOperation;
@@ -37,10 +40,13 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.resources.shares.OCShare;
 import com.owncloud.android.lib.resources.shares.ShareType;
+import com.owncloud.android.ui.dialog.ShareLinkToDialog;
 import com.owncloud.android.ui.fragment.SearchShareesFragment;
 import com.owncloud.android.ui.fragment.ShareFileFragment;
 import com.owncloud.android.utils.GetShareWithUsersAsyncTask;
 
+import org.apache.http.protocol.HTTP;
+
 
 /**
  * Activity for sharing files
@@ -55,6 +61,8 @@ public class ShareActivity extends FileActivity
     private static final String TAG_SHARE_FRAGMENT = "SHARE_FRAGMENT";
     private static final String TAG_SEARCH_FRAGMENT = "SEARCH_USER_AND_GROUPS_FRAGMENT";
 
+    /** Tag for dialog */
+    private static final String FTAG_CHOOSER_DIALOG = "CHOOSER_DIALOG";
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -78,7 +86,7 @@ public class ShareActivity extends FileActivity
 
         // Load data into the list
         Log_OC.d(TAG, "Refreshing lists on account set");
-        refreshUsersInLists();
+        refreshSharesFromStorageManager();
 
         // Request for a refresh of the data through the server (starts an Async Task)
         refreshUsersOrGroupsListFromServer();
@@ -153,26 +161,48 @@ public class ShareActivity extends FileActivity
     public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
         super.onRemoteOperationFinish(operation, result);
 
-        if (result.isSuccess()) {
-            Log_OC.d(TAG, "Refreshing lists on successful sync");
-            refreshUsersInLists();
+        if (result.isSuccess() ||
+            (operation instanceof GetSharesForFileOperation &&
+                result.getCode() == RemoteOperationResult.ResultCode.SHARE_NOT_FOUND
+            )
+        ) {
+            Log_OC.d(TAG, "Refreshing view on successful operation or finished refresh");
+            refreshSharesFromStorageManager();
+        }
+
+        if (operation instanceof CreateShareViaLinkOperation) {
+            // Send link to the app
+            String link = ((OCShare) (result.getData().get(0))).getShareLink();
+            Log_OC.d(TAG, "Share link = " + link);
+
+            Intent intentToShareLink = new Intent(Intent.ACTION_SEND);
+            intentToShareLink.putExtra(Intent.EXTRA_TEXT, link);
+            intentToShareLink.setType(HTTP.PLAIN_TEXT_TYPE);
+            String[] packagesToExclude = new String[]{getPackageName()};
+            DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intentToShareLink, packagesToExclude);
+            chooserDialog.show(getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
         }
 
     }
 
-    private void refreshUsersInLists() {
+
+    /**
+     * Updates the view, reading data from {@link com.owncloud.android.datamodel.FileDataStorageManager}
+     */
+    private void refreshSharesFromStorageManager() {
+
         ShareFileFragment shareFileFragment = getShareFileFragment();
-        if (shareFileFragment != null) {          // only if added to the view hierarchy!!
-            if (shareFileFragment.isAdded()) {
-                shareFileFragment.refreshUsersOrGroupsListFromDB();
-            }
+        if (shareFileFragment != null
+                && shareFileFragment.isAdded()) {   // only if added to the view hierarchy!!
+            shareFileFragment.refreshCapabilitiesFromDB();
+            shareFileFragment.refreshUsersOrGroupsListFromDB();
+            shareFileFragment.refreshPublicShareFromDB();
         }
 
         SearchShareesFragment searchShareesFragment = getSearchFragment();
-        if (searchShareesFragment != null) {
-            if (searchShareesFragment.isAdded()) {  // only if added to the view hierarchy!!
-                searchShareesFragment.refreshUsersOrGroupsListFromDB();
-            }
+        if (searchShareesFragment != null &&
+                searchShareesFragment.isAdded()) {  // only if added to the view hierarchy!!
+            searchShareesFragment.refreshUsersOrGroupsListFromDB();
         }
     }
 
diff --git a/src/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.java b/src/com/owncloud/android/ui/dialog/ExpirationDatePickerDialogFragment.java
new file mode 100644 (file)
index 0000000..502e18a
--- /dev/null
@@ -0,0 +1,138 @@
+/**
+ *   ownCloud Android client application
+ *
+ *   @author David A. Velasco
+ *   Copyright (C) 2015 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.ui.dialog;
+
+
+import android.app.DatePickerDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.v4.app.DialogFragment;
+import android.text.format.DateUtils;
+import android.widget.DatePicker;
+import android.widget.Toast;
+
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.ui.activity.FileActivity;
+
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ *  Dialog requesting a date after today.
+ */
+public class ExpirationDatePickerDialogFragment
+        extends DialogFragment
+        implements DatePickerDialog.OnDateSetListener {
+
+    /** Tag for FragmentsManager */
+    public static final String DATE_PICKER_DIALOG = "DATE_PICKER_DIALOG";
+
+    /** Parameter constant for {@link OCFile} instance to set the expiration date */
+    private static final String ARG_FILE = "FILE";
+
+    /** Parameter constant for date chosen initially */
+    private static final String ARG_CHOSEN_DATE_IN_MILLIS = "CHOSEN_DATE_IN_MILLIS";
+
+    /** File to bind an expiration date */
+    private OCFile mFile;
+
+    /**
+     *  Factory method to create new instances
+     *
+     *  @param file                 File to bind an expiration date
+     *  @param chosenDateInMillis   Date chosen when the dialog appears
+     *  @return                     New dialog instance
+     */
+    public static ExpirationDatePickerDialogFragment newInstance(OCFile file, long chosenDateInMillis) {
+        Bundle arguments = new Bundle();
+        arguments.putParcelable(ARG_FILE, file);
+        arguments.putLong(ARG_CHOSEN_DATE_IN_MILLIS, chosenDateInMillis);
+
+        ExpirationDatePickerDialogFragment dialog = new ExpirationDatePickerDialogFragment();
+        dialog.setArguments(arguments);
+        return dialog;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @return      A new dialog to let the user choose an expiration date that will be bound to a share link.
+     */
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        // Load arguments
+        mFile = getArguments().getParcelable(ARG_FILE);
+
+        // Chosen date received as an argument must be later than tomorrow ; default to tomorrow in other case
+        final Calendar chosenDate = Calendar.getInstance();
+        long tomorrowInMillis = chosenDate.getTimeInMillis() + DateUtils.DAY_IN_MILLIS;
+        long chosenDateInMillis = getArguments().getLong(ARG_CHOSEN_DATE_IN_MILLIS);
+        if (chosenDateInMillis > tomorrowInMillis) {
+            chosenDate.setTimeInMillis(chosenDateInMillis);
+        } else {
+            chosenDate.setTimeInMillis(tomorrowInMillis);
+        }
+
+        // Create a new instance of DatePickerDialog
+        DatePickerDialog dialog = new DatePickerDialog(
+                getActivity(),
+                this,
+                chosenDate.get(Calendar.YEAR),
+                chosenDate.get(Calendar.MONTH),
+                chosenDate.get(Calendar.DAY_OF_MONTH)
+        );
+
+        // Prevent days in the past may be chosen
+        DatePicker picker = dialog.getDatePicker();
+        picker.setMinDate(tomorrowInMillis - 1000);
+
+        // Enforce spinners view; ignored by MD-based theme in Android >=5, but calendar is REALLY buggy
+        // in Android < 5, so let's be sure it never appears (in tablets both spinners and calendar are
+        // shown by default)
+        picker.setCalendarViewShown(false);
+
+        return dialog;
+    }
+
+    /**
+     * Called when the user choses an expiration date.
+     *
+     * @param view              View instance where the date was chosen
+     * @param year              Year of the date chosen.
+     * @param monthOfYear       Month of the date chosen [0, 11]
+     * @param dayOfMonth        Day of the date chosen
+     */
+    @Override
+    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
+
+        Calendar chosenDate = Calendar.getInstance();
+        chosenDate.set(Calendar.YEAR, year);
+        chosenDate.set(Calendar.MONTH, monthOfYear);
+        chosenDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
+        long chosenDateInMillis = chosenDate.getTimeInMillis();
+
+        ((FileActivity)getActivity()).getFileOperationsHelper().setExpirationDateToShareViaLink(
+                mFile,
+                chosenDateInMillis
+        );
+    }
+}
index a315a1d..29eaac2 100644 (file)
@@ -44,11 +44,8 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 import com.owncloud.android.R;
-import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.ui.activity.ComponentsGetter;
 import com.owncloud.android.ui.activity.CopyToClipboardActivity;
-import com.owncloud.android.ui.activity.FileActivity;
 
 /**
  * Dialog showing a list activities able to resolve a given Intent, 
@@ -61,20 +58,15 @@ public class ShareLinkToDialog  extends DialogFragment {
             ".ARG_INTENT";
     private final static String ARG_PACKAGES_TO_EXCLUDE =  ShareLinkToDialog.class.getSimpleName() +
             ".ARG_PACKAGES_TO_EXCLUDE";
-    private final static String ARG_FILE_TO_SHARE = ShareLinkToDialog.class.getSimpleName() +
-            ".FILE_TO_SHARE";
-    
+
     private ActivityAdapter mAdapter;
-    private OCFile mFile;
     private Intent mIntent;
     
-    public static ShareLinkToDialog newInstance(Intent intent, String[] packagesToExclude,
-                                                OCFile fileToShare) {
+    public static ShareLinkToDialog newInstance(Intent intent, String[] packagesToExclude) {
         ShareLinkToDialog f = new ShareLinkToDialog();
         Bundle args = new Bundle();
         args.putParcelable(ARG_INTENT, intent);
         args.putStringArray(ARG_PACKAGES_TO_EXCLUDE, packagesToExclude);
-        args.putParcelable(ARG_FILE_TO_SHARE, fileToShare);
         f.setArguments(args);
         return f;
     }
@@ -90,8 +82,7 @@ public class ShareLinkToDialog  extends DialogFragment {
         String[] packagesToExclude = getArguments().getStringArray(ARG_PACKAGES_TO_EXCLUDE);
         List<String> packagesToExcludeList = Arrays.asList(packagesToExclude != null ?
                 packagesToExclude : new String[0]);
-        mFile = getArguments().getParcelable(ARG_FILE_TO_SHARE);
-        
+
         PackageManager pm= getActivity().getPackageManager();
         List<ResolveInfo> activities = pm.queryIntentActivities(mIntent,
                 PackageManager.MATCH_DEFAULT_ONLY);
@@ -142,19 +133,10 @@ public class ShareLinkToDialog  extends DialogFragment {
                             ComponentName name=new ComponentName(
                                     actInfo.applicationInfo.packageName, 
                                     actInfo.name);
-                            mIntent.setComponent(name);                               
-
-                            if (sendAction) {
-                                dialog.dismiss();    // explicitly added for Android 2.x devices
-
-                                // Send the file
-                                ((FileActivity)getActivity()).startActivity(mIntent);
+                            mIntent.setComponent(name);
 
-                            } else {
-                                // Create a new share resource
-                                ((ComponentsGetter)getActivity()).getFileOperationsHelper()
-                                    .shareFileWithLinkToApp(mFile, "", mIntent);
-                            }
+                            // Send the file
+                            getActivity().startActivity(mIntent);
                         }
         })
         .create();
index d069b5a..1b7def2 100644 (file)
@@ -21,7 +21,6 @@ package com.owncloud.android.ui.dialog;
 import android.support.v7.app.AlertDialog;
 import android.app.Dialog;
 import android.content.DialogInterface;
-import android.content.Intent;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
 import android.view.LayoutInflater;
@@ -45,25 +44,26 @@ public class SharePasswordDialogFragment extends DialogFragment
         implements DialogInterface.OnClickListener {
 
     private static final String ARG_FILE = "FILE";
-    private static final String ARG_SEND_INTENT = "SEND_INTENT";
+    private static final String ARG_CREATE_SHARE = "CREATE_SHARE";
 
     public static final String PASSWORD_FRAGMENT = "PASSWORD_FRAGMENT";
 
     private OCFile mFile;
-    private Intent mSendIntent;
+    private boolean mCreateShare;
 
     /**
      * Public factory method to create new SharePasswordDialogFragment instances.
      *
-     * @param file
-     * @param sendIntent
-     * @return              Dialog ready to show.
+     * @param   file            OCFile bound to the public share that which password will be set or updated
+     * @param   createShare     When 'true', the public share will be created; when 'false', will be assumed
+     *                          that the public share already exists, and its state will be directly updated.
+     * @return                  Dialog ready to show.
      */
-    public static SharePasswordDialogFragment newInstance(OCFile file, Intent sendIntent) {
+    public static SharePasswordDialogFragment newInstance(OCFile file, boolean createShare) {
         SharePasswordDialogFragment frag = new SharePasswordDialogFragment();
         Bundle args = new Bundle();
         args.putParcelable(ARG_FILE, file);
-        args.putParcelable(ARG_SEND_INTENT, sendIntent);
+        args.putBoolean(ARG_CREATE_SHARE, createShare);
         frag.setArguments(args);
         return frag;
     }
@@ -71,7 +71,7 @@ public class SharePasswordDialogFragment extends DialogFragment
     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState) {
         mFile = getArguments().getParcelable(ARG_FILE);
-        mSendIntent = getArguments().getParcelable(ARG_SEND_INTENT);
+        mCreateShare = getArguments().getBoolean(ARG_CREATE_SHARE, false);
 
         // Inflate the layout for the dialog
         LayoutInflater inflater = getActivity().getLayoutInflater();
@@ -97,9 +97,6 @@ public class SharePasswordDialogFragment extends DialogFragment
     @Override
     public void onClick(DialogInterface dialog, int which) {
         if (which == AlertDialog.BUTTON_POSITIVE) {
-            // Enable the flag "Share again"
-            ((FileActivity) getActivity()).setTryShareAgain(true);
-
             String password =
                     ((TextView)(getDialog().findViewById(R.id.share_password)))
                         .getText().toString();
@@ -112,13 +109,16 @@ public class SharePasswordDialogFragment extends DialogFragment
                 return;
             }
 
-            // Share the file
-            ((FileActivity)getActivity()).getFileOperationsHelper()
-                                    .shareFileWithLinkToApp(mFile, password, mSendIntent);
+            if (mCreateShare) {
+                // Share the file
+                ((FileActivity) getActivity()).getFileOperationsHelper().
+                        shareFileViaLink(mFile, password);
 
-        } else {
-            // Disable the flag "Share again"
-            ((FileActivity) getActivity()).setTryShareAgain(false);
+            } else {
+                // updat existing link
+                ((FileActivity) getActivity()).getFileOperationsHelper().
+                        setPasswordToShareViaLink(mFile, password);
+            }
         }
     }
 }
index 1362a12..e9cd916 100644 (file)
@@ -245,18 +245,9 @@ public class FileDetailFragment extends FileFragment implements OnClickListener
     public boolean onOptionsItemSelected(MenuItem item) {
         switch (item.getItemId()) {
             case R.id.action_share_file: {
-                mContainerActivity.getFileOperationsHelper().shareFileWithLink(getFile());
-                return true;
-            }
-            case R.id.action_share_with_users: {
                 mContainerActivity.getFileOperationsHelper().showShareFile(getFile());
                 return true;
             }
-            case R.id.action_unshare_file: {
-                mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile());
-                return true;
-            }
-
             case R.id.action_open_file_with: {
                 mContainerActivity.getFileOperationsHelper().openFile(getFile());
                 return true;
index 9a1f9ee..c606e67 100644 (file)
@@ -559,10 +559,6 @@ public class OCFileListFragment extends ExtendedListFragment {
 
             switch (menuId) {
                 case R.id.action_share_file: {
-                    mContainerActivity.getFileOperationsHelper().shareFileWithLink(mTargetFile);
-                    return true;
-                }
-                case R.id.action_share_with_users: {
                     mContainerActivity.getFileOperationsHelper().showShareFile(mTargetFile);
                     return true;
                 }
@@ -570,10 +566,6 @@ public class OCFileListFragment extends ExtendedListFragment {
                     mContainerActivity.getFileOperationsHelper().openFile(mTargetFile);
                     return true;
                 }
-                case R.id.action_unshare_file: {
-                    mContainerActivity.getFileOperationsHelper().unshareFileWithLink(mTargetFile);
-                    return true;
-                }
                 case R.id.action_rename_file: {
                     RenameFileDialogFragment dialog = RenameFileDialogFragment.newInstance(mTargetFile);
                     dialog.show(getFragmentManager(), FileDetailFragment.FTAG_RENAME_FILE);
index a029653..46382a6 100644 (file)
@@ -26,12 +26,17 @@ import android.app.Activity;
 import android.graphics.Bitmap;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
+import android.support.v7.widget.AppCompatButton;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
+import android.widget.CompoundButton;
 import android.widget.ImageView;
+import android.widget.ListAdapter;
 import android.widget.ListView;
+import android.widget.ScrollView;
+import android.widget.Switch;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -41,16 +46,22 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.datamodel.ThumbnailsCacheManager;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.shares.OCShare;
+import com.owncloud.android.lib.resources.shares.ShareType;
+import com.owncloud.android.lib.resources.status.OCCapability;
 import com.owncloud.android.ui.activity.FileActivity;
-import com.owncloud.android.ui.activity.ShareActivity;
 import com.owncloud.android.ui.adapter.ShareUserListAdapter;
+import com.owncloud.android.ui.dialog.ExpirationDatePickerDialogFragment;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.MimetypeIconUtil;
 
+import java.text.SimpleDateFormat;
+
 import java.util.ArrayList;
+import java.util.Date;
 
 /**
- * Fragment for Sharing a file with sharees (users or groups)
+ * Fragment for Sharing a file with sharees (users or groups) or creating
+ * a public link.
  *
  * A simple {@link Fragment} subclass.
  *
@@ -66,19 +77,48 @@ public class ShareFileFragment extends Fragment
 
     private static final String TAG = ShareFileFragment.class.getSimpleName();
 
-    // the fragment initialization parameters
+    /** The fragment initialization parameters */
     private static final String ARG_FILE = "FILE";
     private static final String ARG_ACCOUNT = "ACCOUNT";
 
-    // Parameters
+//    /** Tag for dialog */
+//    private static final String FTAG_CHOOSER_DIALOG = "CHOOSER_DIALOG";
+
+    /** File to share, received as a parameter in construction time */
     private OCFile mFile;
+
+    /** OC account holding the file to share, received as a parameter in construction time */
     private Account mAccount;
 
-    // other members
-    private ArrayList<OCShare> mShares;
-    private ShareUserListAdapter mUserGroupsAdapter = null;
+    /** Reference to parent listener */
     private OnShareFragmentInteractionListener mListener;
 
+    /** List of private shares bound to the file */
+    private ArrayList<OCShare> mPrivateShares;
+
+    /** Capabilities of the server */
+    private OCCapability mCapabilities;
+
+    /** Adapter to show private shares */
+    private ShareUserListAdapter mUserGroupsAdapter = null;
+
+    /** Public share bound to the file */
+    private OCShare mPublicShare;
+
+    /** Listener for changes on switch to share / unshare publicly */
+    private CompoundButton.OnCheckedChangeListener mOnShareViaLinkSwitchCheckedChangeListener;
+
+    /**
+     * Listener for user actions to set, update or clear password on public link
+     */
+    private OnPasswordInteractionListener mOnPasswordInteractionListener = null;
+
+    /**
+     * Listener for user actions to set, update or clear expiration date on public link
+     */
+    private OnExpirationDateInteractionListener mOnExpirationDateInteractionListener = null;
+
+
     /**
      * Public factory method to create new ShareFileFragment instances.
      *
@@ -105,18 +145,22 @@ public class ShareFileFragment extends Fragment
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        Log_OC.d(TAG, "onCreate");
         if (getArguments() != null) {
             mFile = getArguments().getParcelable(ARG_FILE);
             mAccount = getArguments().getParcelable(ARG_ACCOUNT);
         }
     }
 
+
     /**
      * {@inheritDoc}
      */
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
+        Log_OC.d(TAG, "onCreateView");
+
         // Inflate the layout for this fragment
         View view = inflater.inflate(R.layout.share_file_layout, container, false);
 
@@ -149,7 +193,7 @@ public class ShareFileFragment extends Fragment
         addUserGroupButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                 boolean shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount);
+                boolean shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount);
                 if (shareWithUsersEnable) {
                     // Show Search Fragment
                     mListener.showSearchUsersAndGroups();
@@ -160,15 +204,253 @@ public class ShareFileFragment extends Fragment
             }
         });
 
+        // Switch to create public share
+        mOnShareViaLinkSwitchCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton switchView, boolean isChecked) {
+            }
+        };
+
+        // Set listener for user actions on switch for sharing/unsharing via link
+        initShareViaLinkListener(view);
+
+        // Set listener for user actions on expiration date
+        initExpirationListener(view);
+
+        // Set listener for user actions on password
+        initPasswordListener(view);
+
         return view;
     }
 
+
+    /**
+     * Binds listener for user actions to create or delete a public share
+     * to the views receiving the user events.
+     *
+     * @param shareView     Root view in the fragment.
+     */
+    private void initShareViaLinkListener(View shareView) {
+        mOnShareViaLinkSwitchCheckedChangeListener = new OnShareViaLinkListener();
+        Switch shareViaLinkSwitch = (Switch) shareView.findViewById(R.id.shareViaLinkSectionSwitch);
+        shareViaLinkSwitch.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener);
+    }
+
+    /**
+     * Listener for user actions that create or delete a public share.
+     */
+    private class OnShareViaLinkListener
+            implements CompoundButton.OnCheckedChangeListener {
+
+        /**
+         * Called by R.id.shareViaLinkSectionSwitch to create or delete a public link.
+         *
+         * @param switchView    {@link Switch} toggled by the user, R.id.shareViaLinkSectionSwitch
+         * @param isChecked     New switch state.
+         */
+        @Override
+        public void onCheckedChanged(CompoundButton switchView, boolean isChecked) {
+            if (!isResumed()) {
+                // very important, setCheched(...) is called automatically during
+                // Fragment recreation on device rotations
+                return;
+            }
+            if (isChecked) {
+                if (mCapabilities != null &&
+                        mCapabilities.getFilesSharingPublicPasswordEnforced().isTrue()) {
+                    // password enforced by server, request to the user before trying to create
+                    ((FileActivity) getActivity()).getFileOperationsHelper().
+                            requestPasswordForShareViaLink(mFile, true);
+
+                } else {
+                    // create without password if not enforced by server or we don't know if enforced;
+                    ((FileActivity) getActivity()).getFileOperationsHelper().
+                            shareFileViaLink(mFile, null);
+
+                    // FileActivtiy#onCreateShareViaLinkOperationFinish still handles the guess of enforcement
+                    // for server in versions previous to OwnCloudVersion#MINIMUM_VERSION_CAPABILITIES_API
+                }
+
+            } else {
+                ((FileActivity) getActivity()).getFileOperationsHelper().
+                        unshareFileViaLink(mFile);
+            }
+
+            // undo the toggle to grant the view will be correct if any intermediate dialog is cancelled or
+            // the create/delete operation fails
+            switchView.setOnCheckedChangeListener(null);
+            switchView.toggle();
+            switchView.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener);
+        }
+    }
+
+
+    /**
+     * Binds listener for user actions that start any update on a expiration date
+     * for the public link to the views receiving the user events.
+     *
+     * @param shareView     Root view in the fragment.
+     */
+    private void initExpirationListener(View shareView) {
+        mOnExpirationDateInteractionListener = new OnExpirationDateInteractionListener();
+
+        ((Switch) shareView.findViewById(R.id.shareViaLinkExpirationSwitch)).
+                setOnCheckedChangeListener(mOnExpirationDateInteractionListener);
+
+        shareView.findViewById(R.id.shareViaLinkExpirationLabel).
+                setOnClickListener(mOnExpirationDateInteractionListener);
+
+        shareView.findViewById(R.id.shareViaLinkExpirationValue).
+                setOnClickListener(mOnExpirationDateInteractionListener);
+    }
+
+    /**
+     * Listener for user actions that start any update on the expiration date for the public link.
+     */
+    private class OnExpirationDateInteractionListener
+            implements CompoundButton.OnCheckedChangeListener, View.OnClickListener {
+
+        /**
+         * Called by R.id.shareViaLinkExpirationSwitch to set or clear the expiration date.
+         *
+         * @param switchView    {@link Switch} toggled by the user, R.id.shareViaLinkExpirationSwitch
+         * @param isChecked     New switch state.
+         */
+        @Override
+        public void onCheckedChanged(CompoundButton switchView, boolean isChecked) {
+            if (!isResumed()) {
+                // very important, setCheched(...) is called automatically during
+                // Fragment recreation on device rotations
+                return;
+            }
+            if (isChecked) {
+                ExpirationDatePickerDialogFragment dialog =
+                        ExpirationDatePickerDialogFragment.newInstance(mFile, -1);
+                dialog.show(
+                        getActivity().getSupportFragmentManager(),
+                        ExpirationDatePickerDialogFragment.DATE_PICKER_DIALOG
+                );
+
+            } else {
+                ((FileActivity) getActivity()).getFileOperationsHelper().
+                        setExpirationDateToShareViaLink(mFile, -1);
+            }
+
+            // undo the toggle to grant the view will be correct if the dialog is cancelled
+            switchView.setOnCheckedChangeListener(null);
+            switchView.toggle();
+            switchView.setOnCheckedChangeListener(mOnExpirationDateInteractionListener);
+        }
+
+        /**
+         * Called by R.id.shareViaLinkExpirationLabel or R.id.shareViaLinkExpirationValue
+         * to change the current expiration date.
+         *
+         * @param expirationView      Label or value view touched by the user.
+         */
+        @Override
+        public void onClick(View expirationView) {
+            if (mPublicShare != null && mPublicShare.getExpirationDate() > 0) {
+                long chosenDateInMillis = -1;
+                if (mPublicShare != null) {
+                    chosenDateInMillis = mPublicShare.getExpirationDate();
+                }
+                ExpirationDatePickerDialogFragment dialog =
+                        ExpirationDatePickerDialogFragment.newInstance(
+                                mFile,
+                                chosenDateInMillis
+                        );
+                dialog.show(
+                        getActivity().getSupportFragmentManager(),
+                        ExpirationDatePickerDialogFragment.DATE_PICKER_DIALOG
+                );
+            }
+        }
+    }
+
+
+    /**
+     * Binds listener for user actions that start any update on a password for the public link
+     * to the views receiving the user events.
+     *
+     * @param shareView     Root view in the fragment.
+     */
+    private void initPasswordListener(View shareView) {
+        mOnPasswordInteractionListener = new OnPasswordInteractionListener();
+
+        ((Switch) shareView.findViewById(R.id.shareViaLinkPasswordSwitch)).
+                setOnCheckedChangeListener(mOnPasswordInteractionListener);
+
+        shareView.findViewById(R.id.shareViaLinkPasswordLabel).
+                setOnClickListener(mOnPasswordInteractionListener);
+
+        shareView.findViewById(R.id.shareViaLinkPasswordValue).
+                setOnClickListener(mOnPasswordInteractionListener);
+    }
+
+
+    /**
+     * Listener for user actions that start any update on a password for the public link.
+     */
+    private class OnPasswordInteractionListener
+            implements CompoundButton.OnCheckedChangeListener, View.OnClickListener {
+
+        /**
+         * Called by R.id.shareViaLinkPasswordSwitch to set or clear the password.
+         *
+         * @param switchView    {@link Switch} toggled by the user, R.id.shareViaLinkPasswordSwitch
+         * @param isChecked     New switch state.
+         */
+        @Override
+        public void onCheckedChanged(CompoundButton switchView, boolean isChecked) {
+            if (!isResumed()) {
+                // very important, setCheched(...) is called automatically during
+                // Fragment recreation on device rotations
+                return;
+            }
+            if (isChecked) {
+                ((FileActivity) getActivity()).getFileOperationsHelper().
+                        requestPasswordForShareViaLink(mFile, false);
+            } else {
+                ((FileActivity) getActivity()).getFileOperationsHelper().
+                        setPasswordToShareViaLink(mFile, "");   // "" clears
+            }
+
+            // undo the toggle to grant the view will be correct if the dialog is cancelled
+            switchView.setOnCheckedChangeListener(null);
+            switchView.toggle();
+            switchView.setOnCheckedChangeListener(mOnPasswordInteractionListener);
+        }
+
+        /**
+         * Called by R.id.shareViaLinkPasswordLabel or R.id.shareViaLinkPasswordValue
+         * to change the current password.
+         *
+         * @param passwordView      Label or value view touched by the user.
+         */
+        @Override
+        public void onClick(View passwordView) {
+            if (mPublicShare != null && mPublicShare.isPasswordProtected()) {
+                ((FileActivity) getActivity()).getFileOperationsHelper().
+                        requestPasswordForShareViaLink(mFile, false);
+            }
+        }
+    }
+
+
     @Override
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
+        Log_OC.d(TAG, "onActivityCreated");
+
+        // Load known capabilities of the server from DB
+        refreshCapabilitiesFromDB();
 
-        // Load data into the list
+        // Load data into the list of private shares
         refreshUsersOrGroupsListFromDB();
+
+        // Load data of public share, if exists
+        refreshPublicShareFromDB();
     }
 
     @Override
@@ -188,8 +470,23 @@ public class ShareFileFragment extends Fragment
         mListener = null;
     }
 
+
+    /**
+     * Get known server capabilities from DB
+     *
+     * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
+     * instance ready to use. If not ready, does nothing.
+     */
+    public void refreshCapabilitiesFromDB() {
+        if (((FileActivity)mListener).getStorageManager() != null) {
+            mCapabilities = ((FileActivity)mListener).getStorageManager().
+                    getCapability(mAccount.name);
+        }
+    }
+
+
     /**
-     * Get users and groups from the DB to fill in the "share with" list
+     * Get users and groups from the DB to fill in the "share with" list.
      *
      * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
      * instance ready to use. If not ready, does nothing.
@@ -197,7 +494,7 @@ public class ShareFileFragment extends Fragment
     public void refreshUsersOrGroupsListFromDB (){
         if (((FileActivity) mListener).getStorageManager() != null) {
             // Get Users and Groups
-            mShares = ((FileActivity) mListener).getStorageManager().getSharesWithForAFile(
+            mPrivateShares = ((FileActivity) mListener).getStorageManager().getSharesWithForAFile(
                     mFile.getRemotePath(),
                     mAccount.name
             );
@@ -213,7 +510,7 @@ public class ShareFileFragment extends Fragment
         mUserGroupsAdapter = new ShareUserListAdapter(
                 getActivity(),
                 R.layout.share_user_item,
-                mShares,
+                mPrivateShares,
                 this
         );
 
@@ -221,15 +518,19 @@ public class ShareFileFragment extends Fragment
         TextView noShares = (TextView) getView().findViewById(R.id.shareNoUsers);
         ListView usersList = (ListView) getView().findViewById(R.id.shareUsersList);
 
-        if (mShares.size() > 0) {
+        if (mPrivateShares.size() > 0) {
             noShares.setVisibility(View.GONE);
             usersList.setVisibility(View.VISIBLE);
             usersList.setAdapter(mUserGroupsAdapter);
-
+            setListViewHeightBasedOnChildren(usersList);
         } else {
             noShares.setVisibility(View.VISIBLE);
             usersList.setVisibility(View.GONE);
         }
+
+        // Set Scroll to initial position
+        ScrollView scrollView = (ScrollView) getView().findViewById(R.id.shareScroll);
+        scrollView.scrollTo(0, 0);
     }
 
     @Override
@@ -240,6 +541,201 @@ public class ShareFileFragment extends Fragment
     }
 
 
+
+    /**
+     * Get public link from the DB to fill in the "Share link" section in the UI.
+     *
+     * Takes into account server capabilities before reading database.
+     *
+     * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
+     * instance ready to use. If not ready, does nothing.
+     */
+    public void refreshPublicShareFromDB() {
+        if (isPublicShareDisabled()) {
+            hidePublicShare();
+
+        } else if (((FileActivity) mListener).getStorageManager() != null) {
+            // Get public share
+            mPublicShare = ((FileActivity) mListener).getStorageManager().getFirstShareByPathAndType(
+                    mFile.getRemotePath(),
+                    ShareType.PUBLIC_LINK,
+                    ""
+            );
+
+            // Update public share section
+            updatePublicShareSection();
+        }
+    }
+
+    /**
+     * @return  'True' when public share is disabled in the server
+     */
+    private boolean isPublicShareDisabled() {
+        return (mCapabilities != null &&
+                mCapabilities.getFilesSharingPublicEnabled().isFalse()
+        );
+    }
+
+    /**
+     * Updates in the UI the section about public share with the information in the current
+     * public share bound to mFile, if any
+     */
+    private void updatePublicShareSection() {
+        if (mPublicShare != null && ShareType.PUBLIC_LINK.equals(mPublicShare.getShareType())) {
+            /// public share bound -> expand section
+            Switch shareViaLinkSwitch = getShareViaLinkSwitch();
+            if (!shareViaLinkSwitch.isChecked()) {
+                // set null listener before setChecked() to prevent infinite loop of calls
+                shareViaLinkSwitch.setOnCheckedChangeListener(null);
+                shareViaLinkSwitch.setChecked(true);
+                shareViaLinkSwitch.setOnCheckedChangeListener(
+                        mOnShareViaLinkSwitchCheckedChangeListener
+                );
+            }
+            getExpirationDateSection().setVisibility(View.VISIBLE);
+            getPasswordSection().setVisibility(View.VISIBLE);
+            // GetLink button
+            AppCompatButton getLinkButton = getGetLinkButton();
+            getLinkButton.setVisibility(View.VISIBLE);
+            getLinkButton.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    //GetLink from the server and show ShareLinkToDialog
+                    ((FileActivity) getActivity()).getFileOperationsHelper().
+                            getFileWithLink(mFile);
+
+                }
+            });
+
+            /// update state of expiration date switch and message depending on expiration date
+            Switch expirationDateSwitch = getExpirationDateSwitch();
+            // set null listener before setChecked() to prevent infinite loop of calls
+            expirationDateSwitch.setOnCheckedChangeListener(null);
+            long expirationDate = mPublicShare.getExpirationDate();
+            if (expirationDate > 0) {
+                if (!expirationDateSwitch.isChecked()) {
+                    expirationDateSwitch.toggle();
+                }
+                String formattedDate =
+                        SimpleDateFormat.getDateInstance().format(
+                                new Date(expirationDate)
+                        );
+                getExpirationDateValue().setText(formattedDate);
+            } else {
+                if (expirationDateSwitch.isChecked()) {
+                    expirationDateSwitch.toggle();
+                }
+                getExpirationDateValue().setText(R.string.empty);
+            }
+            // recover listener
+            expirationDateSwitch.setOnCheckedChangeListener(
+                    mOnExpirationDateInteractionListener
+            );
+
+            /// update state of password switch and message depending on password protection
+            Switch passwordSwitch = getPasswordSwitch();
+            // set null listener before setChecked() to prevent infinite loop of calls
+            passwordSwitch.setOnCheckedChangeListener(null);
+            if (mPublicShare.isPasswordProtected()) {
+                if (!passwordSwitch.isChecked()) {
+                    passwordSwitch.toggle();
+                }
+                getPasswordValue().setVisibility(View.VISIBLE);
+            } else {
+                if (passwordSwitch.isChecked()) {
+                    passwordSwitch.toggle();
+                }
+                getPasswordValue().setVisibility(View.INVISIBLE);
+            }
+            // recover listener
+            passwordSwitch.setOnCheckedChangeListener(
+                    mOnPasswordInteractionListener
+            );
+
+
+        } else {
+            /// no public share -> collapse section
+            Switch shareViaLinkSwitch = getShareViaLinkSwitch();
+            if (shareViaLinkSwitch.isChecked()) {
+                shareViaLinkSwitch.setOnCheckedChangeListener(null);
+                getShareViaLinkSwitch().setChecked(false);
+                shareViaLinkSwitch.setOnCheckedChangeListener(
+                        mOnShareViaLinkSwitchCheckedChangeListener
+                );
+            }
+            getExpirationDateSection().setVisibility(View.GONE);
+            getPasswordSection().setVisibility(View.GONE);
+            getGetLinkButton().setVisibility(View.GONE);
+        }
+    }
+
+
+    /// BEWARE: next methods will failed with NullPointerException if called before onCreateView() finishes
+
+    private Switch getShareViaLinkSwitch() {
+        return (Switch) getView().findViewById(R.id.shareViaLinkSectionSwitch);
+    }
+
+    private View getExpirationDateSection() {
+        return getView().findViewById(R.id.shareViaLinkExpirationSection);
+    }
+
+    private Switch getExpirationDateSwitch() {
+        return (Switch) getView().findViewById(R.id.shareViaLinkExpirationSwitch);
+    }
+
+    private TextView getExpirationDateValue() {
+        return (TextView) getView().findViewById(R.id.shareViaLinkExpirationValue);
+    }
+
+    private View getPasswordSection() {
+        return getView().findViewById(R.id.shareViaLinkPasswordSection);
+    }
+
+    private Switch getPasswordSwitch() {
+        return (Switch) getView().findViewById(R.id.shareViaLinkPasswordSwitch);
+    }
+
+    private TextView getPasswordValue() {
+        return (TextView) getView().findViewById(R.id.shareViaLinkPasswordValue);
+    }
+
+    private AppCompatButton getGetLinkButton() {
+        return (AppCompatButton) getView().findViewById(R.id.shareViaLinkGetLinkButton);
+    }
+
+    /**
+     * Hides all the UI elements related to public share
+     */
+    private void hidePublicShare() {
+        getShareViaLinkSwitch().setVisibility(View.GONE);
+        getExpirationDateSection().setVisibility(View.GONE);
+        getPasswordSection().setVisibility(View.GONE);
+        getGetLinkButton().setVisibility(View.GONE);
+    }
+
+    public static void setListViewHeightBasedOnChildren(ListView listView) {
+        ListAdapter listAdapter = listView.getAdapter();
+        if (listAdapter == null) {
+            return;
+        }
+        int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.AT_MOST);
+        int totalHeight = 0;
+        View view = null;
+        for (int i = 0; i < listAdapter.getCount(); i++) {
+            view = listAdapter.getView(i, view, listView);
+            if (i == 0) {
+                view.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth, ViewGroup.LayoutParams.WRAP_CONTENT));
+            }
+            view.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
+            totalHeight += view.getMeasuredHeight();
+        }
+        ViewGroup.LayoutParams params = listView.getLayoutParams();
+        params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
+        listView.setLayoutParams(params);
+        listView.requestLayout();
+    }
+
     /**
      * This interface must be implemented by activities that contain this
      * fragment to allow an interaction in this fragment to be communicated
index f797fe2..6a260dd 100644 (file)
@@ -52,16 +52,11 @@ import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;
 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.common.utils.Log_OC;
-import com.owncloud.android.operations.CreateShareViaLinkOperation;
-import com.owncloud.android.operations.CreateShareWithShareeOperation;
 import com.owncloud.android.operations.RemoveFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;
-import com.owncloud.android.operations.UnshareOperation;
 import com.owncloud.android.ui.activity.FileActivity;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
-import com.owncloud.android.ui.activity.ShareActivity;
 import com.owncloud.android.ui.fragment.FileFragment;
 
 
@@ -230,14 +225,7 @@ public class PreviewImageActivity extends FileActivity implements
     public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) {
         super.onRemoteOperationFinish(operation, result);
         
-        if (operation instanceof CreateShareViaLinkOperation ||
-                operation instanceof CreateShareWithShareeOperation) {
-            onCreateShareOperationFinish(result);
-
-        } else if (operation instanceof UnshareOperation) {
-            onUnshareLinkOperationFinish((UnshareOperation) operation, result);
-            
-        } else if (operation instanceof RemoveFileOperation) {
+        if (operation instanceof RemoveFileOperation) {
             finish();
         } else if (operation instanceof SynchronizeFileOperation) {
             onSynchronizeFileOperationFinish((SynchronizeFileOperation) operation, result);
@@ -245,31 +233,6 @@ public class PreviewImageActivity extends FileActivity implements
         }
     }
     
-    
-    private void onUnshareLinkOperationFinish(UnshareOperation operation,
-                                              RemoteOperationResult result) {
-        if (result.isSuccess()) {
-            OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
-            if (file != null) {
-                setFile(file);
-            }
-            invalidateOptionsMenu();
-        } else if  (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
-            backToDisplayActivity();
-        }
-            
-    }
-    
-    private void onCreateShareOperationFinish(RemoteOperationResult result) {
-        if (result.isSuccess()) {
-            OCFile file = getStorageManager().getFileByPath(getFile().getRemotePath());
-            if (file != null) {
-                setFile(file);
-            }
-            invalidateOptionsMenu();
-        }
-    }
-
     private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation,
                                                   RemoteOperationResult result) {
         if (result.isSuccess()) {
index bdbfa1f..1ef0377 100644 (file)
@@ -341,17 +341,9 @@ public class PreviewImageFragment extends FileFragment {
     public boolean onOptionsItemSelected(MenuItem item) {
         switch (item.getItemId()) {
             case R.id.action_share_file: {
-                mContainerActivity.getFileOperationsHelper().shareFileWithLink(getFile());
-                return true;
-            }
-            case R.id.action_share_with_users: {
                 mContainerActivity.getFileOperationsHelper().showShareFile(getFile());
                 return true;
             }
-            case R.id.action_unshare_file: {
-                mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile());
-                return true;
-            }
             case R.id.action_open_file_with: {
                 openFile();
                 return true;
index ba80ace..b6ee12b 100644 (file)
@@ -361,19 +361,9 @@ public class PreviewMediaFragment extends FileFragment implements
     public boolean onOptionsItemSelected(MenuItem item) {
         switch (item.getItemId()) {
             case R.id.action_share_file: {
-                stopPreview(false);
-                mContainerActivity.getFileOperationsHelper().shareFileWithLink(getFile());
-                return true;
-            }
-            case R.id.action_share_with_users: {
                 seeShareFile();
                 return true;
             }
-            case R.id.action_unshare_file: {
-                stopPreview(false);
-                mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile());
-                return true;
-            }
             case R.id.action_open_file_with: {
                 openFile();
                 return true;
index a37a1bb..f071469 100644 (file)
@@ -311,17 +311,9 @@ public class PreviewTextFragment extends FileFragment {
     public boolean onOptionsItemSelected(MenuItem item) {
         switch (item.getItemId()) {
             case R.id.action_share_file: {
-                mContainerActivity.getFileOperationsHelper().shareFileWithLink(getFile());
-                return true;
-            }
-            case R.id.action_share_with_users: {
                 mContainerActivity.getFileOperationsHelper().showShareFile(getFile());
                 return true;
             }
-            case R.id.action_unshare_file: {
-                mContainerActivity.getFileOperationsHelper().unshareFileWithLink(getFile());
-                return true;
-            }
             case R.id.action_open_file_with: {
                 openFile();
                 return true;
index 37b2fba..be74386 100644 (file)
@@ -27,6 +27,7 @@ import com.owncloud.android.R;
 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.shares.UpdateRemoteShareOperation;
 import com.owncloud.android.operations.CopyFileOperation;
 import com.owncloud.android.operations.CreateFolderOperation;
 import com.owncloud.android.operations.CreateShareViaLinkOperation;
@@ -38,6 +39,7 @@ import com.owncloud.android.operations.RenameFileOperation;
 import com.owncloud.android.operations.SynchronizeFileOperation;
 import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UnshareOperation;
+import com.owncloud.android.operations.UpdateShareViaLinkOperation;
 import com.owncloud.android.operations.UploadFileOperation;
 
 import org.apache.commons.httpclient.ConnectTimeoutException;
@@ -189,7 +191,7 @@ public class ErrorMessageAdapter {
             if (result.getData() != null && result.getData().size() > 0) {
                 message = (String) result.getData().get(0);     // share API sends its own error messages
 
-            } else  if (result.getCode() == ResultCode.SHARE_NOT_FOUND)  {
+            } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
                 message = res.getString(R.string.unshare_link_file_no_exist);
 
             } else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
@@ -201,6 +203,25 @@ public class ErrorMessageAdapter {
                 // Show a Message, operation finished without success
                 message = res.getString(R.string.unshare_link_file_error);
             }
+
+        } else if (operation instanceof UpdateShareViaLinkOperation) {
+
+            if (result.getData() != null && result.getData().size() > 0) {
+                message = (String) result.getData().get(0);     // share API sends its own error messages
+
+            } else if (result.getCode() == ResultCode.SHARE_NOT_FOUND) {
+                message = res.getString(R.string.update_link_file_no_exist);
+
+            } else if (result.getCode() == ResultCode.SHARE_FORBIDDEN) {
+                // Error --> No permissions
+                message = String.format(res.getString(R.string.forbidden_permissions),
+                        res.getString(R.string.update_link_forbidden_permissions));
+
+            } else {    // Generic error
+                // Show a Message, operation finished without success
+                message = res.getString(R.string.update_link_file_error);
+            }
+
         } else if (operation instanceof MoveFileOperation) {
 
             if (result.getCode() == ResultCode.FILE_NOT_FOUND) {