Browse Source

introduce upload subfolders configuration variable

Timo Witte 8 years ago
parent
commit
f68b53ba61

+ 2 - 0
res/values/strings.xml

@@ -307,6 +307,8 @@
 
     <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="prefs_instant_upload_path_use_subfolders_title">Use subfolders</string>
+    <string name="prefs_instant_upload_path_use_subfolders_summary">Store in subfolders based on year and month</string>
 
 	<string name="share_link_no_support_share_api">Sorry, sharing is not enabled on your server. Please contact your
 		administrator.</string>

+ 5 - 1
res/xml/preferences.xml

@@ -25,9 +25,13 @@
 		<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
 	                        android:title="@string/prefs_instant_upload"
 	                        android:summary="@string/prefs_instant_upload_summary"/>
-         <com.owncloud.android.ui.PreferenceWithLongSummary
+        <com.owncloud.android.ui.PreferenceWithLongSummary
 							android:title="@string/prefs_instant_upload_path_title"
 							android:key="instant_upload_path" />
+		<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
+							android:title="@string/prefs_instant_upload_path_use_subfolders_title"
+                            android:summary="@string/prefs_instant_upload_path_use_subfolders_summary"
+							android:key="instant_upload_path_use_subfolders" />
 	    <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
 	        				android:title="@string/instant_upload_on_wifi"
 	        				android:key="instant_upload_on_wifi"/>

+ 5 - 0
src/com/owncloud/android/db/PreferenceManager.java

@@ -37,6 +37,7 @@ public abstract class PreferenceManager {
     private static final String AUTO_PREF__SORT_ASCENDING = "sort_ascending";
     private static final String PREF__INSTANT_UPLOADING = "instant_uploading";
     private static final String PREF__INSTANT_VIDEO_UPLOADING = "instant_video_uploading";
+    private static final String PREF__INSTANT_UPLOAD_PATH_USE_SUBFOLDERS = "instant_upload_path_use_subfolders";
     private static final String PREF__INSTANT_UPLOAD_ON_WIFI = "instant_upload_on_wifi";
     private static final String PREF__INSTANT_VIDEO_UPLOAD_ON_WIFI = "instant_video_upload_on_wifi";
 
@@ -48,6 +49,10 @@ public abstract class PreferenceManager {
         return getDefaultSharedPreferences(context).getBoolean(PREF__INSTANT_VIDEO_UPLOADING, false);
     }
 
+    public static boolean instantPictureUploadPathUseSubfolders(Context context) {
+        return getDefaultSharedPreferences(context).getBoolean(PREF__INSTANT_UPLOAD_PATH_USE_SUBFOLDERS, false);
+    }
+
     public static boolean instantPictureUploadViaWiFiOnly(Context context) {
         return getDefaultSharedPreferences(context).getBoolean(PREF__INSTANT_UPLOAD_ON_WIFI, false);
     }

+ 5 - 1
src/com/owncloud/android/ui/activity/Preferences.java

@@ -110,6 +110,7 @@ public class Preferences extends PreferenceActivity
     private Preference mPrefInstantUpload;
     private Preference mPrefInstantUploadBehaviour;
     private Preference mPrefInstantUploadPath;
+    private Preference mPrefInstantUploadUseSubfolders;
     private Preference mPrefInstantUploadPathWiFi;
     private Preference mPrefInstantVideoUpload;
     private Preference mPrefInstantVideoUploadPath;
@@ -391,7 +392,8 @@ public class Preferences extends PreferenceActivity
         
         mPrefInstantUploadCategory =
                 (PreferenceCategory) findPreference("instant_uploading_category");
-        
+
+        mPrefInstantUploadUseSubfolders = findPreference("instant_upload_path_use_subfolders");
         mPrefInstantUploadPathWiFi =  findPreference("instant_upload_on_wifi");
         mPrefInstantUpload = findPreference("instant_uploading");
         
@@ -477,9 +479,11 @@ public class Preferences extends PreferenceActivity
         if (value){
             mPrefInstantUploadCategory.addPreference(mPrefInstantUploadPathWiFi);
             mPrefInstantUploadCategory.addPreference(mPrefInstantUploadPath);
+            mPrefInstantUploadCategory.addPreference(mPrefInstantUploadUseSubfolders);
         } else {
             mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPathWiFi);
             mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPath);
+            mPrefInstantUploadCategory.removePreference(mPrefInstantUploadUseSubfolders);
         }
     }