Merge branch 'master' of https://github.com/loripino21/android into instant_upload_pa...
authorjabarros <jabarros@solidgear.es>
Mon, 6 Oct 2014 12:58:34 +0000 (14:58 +0200)
committerjabarros <jabarros@solidgear.es>
Mon, 6 Oct 2014 12:58:34 +0000 (14:58 +0200)
res/values/strings.xml
res/xml/preferences.xml
src/com/owncloud/android/utils/FileStorageUtils.java

index 4c7cf34..0202130 100644 (file)
     <string name="preview_image_error_unknown_format">This image cannot be shown</string>
     
     <string name="error__upload__local_file_not_copied">%1$s could not be copied to %2$s local folder</string>
+    <string name="prefs_instant_upload_path_title">Upload Path</string>
 
        <string name="share_link_no_support_share_api">Sorry, sharing is not enabled on your server. Please contact your
                administrator.</string>
index 945e853..9543cfc 100644 (file)
                                        android:disableDependentsState="true" 
                                        android:title="@string/instant_upload_on_wifi" 
                                        android:key="instant_upload_on_wifi"/>
+        <EditTextPreference android:dependency="instant_uploading" 
+                                       android:disableDependentsState="true"
+                                       android:title="@string/prefs_instant_upload_path_title" 
+                                       android:defaultValue="@string/instant_upload_path"
+                                       android:key="instant_upload_path"/>
     <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_video_uploading" 
                         android:title="@string/prefs_instant_video_upload"  
                         android:summary="@string/prefs_instant_video_upload_summary"/>
@@ -65,4 +70,4 @@
        </PreferenceCategory>
     
 
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
index 58dda0d..3895821 100644 (file)
@@ -26,6 +26,8 @@ import com.owncloud.android.lib.resources.files.RemoteFile;
 
 import android.annotation.SuppressLint;
 import android.content.Context;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
 import android.net.Uri;
 import android.os.Environment;
 import android.os.StatFs;
@@ -73,7 +75,9 @@ public class FileStorageUtils {
     }
 
     public static String getInstantUploadFilePath(Context context, String fileName) {
-        String uploadPath = context.getString(R.string.instant_upload_path);
+        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
+        String uploadPathdef = context.getString(R.string.instant_upload_path);
+        String uploadPath = pref.getString("instant_upload_path", uploadPathdef);
         String value = uploadPath + OCFile.PATH_SEPARATOR +  (fileName == null ? "" : fileName);
         return value;
     }
@@ -120,4 +124,4 @@ public class FileStorageUtils {
         return file;
     }
   
-}
\ No newline at end of file
+}