浏览代码

Merge branch 'master' of https://github.com/loripino21/android into instant_upload_path_chooseable

jabarros 10 年之前
父节点
当前提交
1e7e893321
共有 3 个文件被更改,包括 13 次插入3 次删除
  1. 1 0
      res/values/strings.xml
  2. 6 1
      res/xml/preferences.xml
  3. 6 2
      src/com/owncloud/android/utils/FileStorageUtils.java

+ 1 - 0
res/values/strings.xml

@@ -251,6 +251,7 @@
     <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>

+ 6 - 1
res/xml/preferences.xml

@@ -36,6 +36,11 @@
         				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>
+</PreferenceScreen>

+ 6 - 2
src/com/owncloud/android/utils/FileStorageUtils.java

@@ -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;
     }
   
-}
+}