Эх сурвалжийг харах

Merge pull request #1039 from nextcloud/autoUploadLight

Auto upload light
Mario Đanić 7 жил өмнө
parent
commit
76f7f5c1ee

+ 43 - 3
src/main/java/com/owncloud/android/datamodel/ArbitraryDataProvider.java

@@ -108,12 +108,44 @@ public class ArbitraryDataProvider {
         }
     }
 
-    public boolean getBooleanValue(Account account, String key) {
-        String value = getValue(account, key);
+    public boolean getBooleanValue(String accountName, String key) {
+        String value = getValue(accountName, key);
 
         return !value.isEmpty() && value.equalsIgnoreCase("true");
     }
 
+    public boolean getBooleanValue(Account account, String key) {
+        return getBooleanValue(account.name, key);
+    }
+
+    /**
+     * returns integer if found else -1
+     *
+     * @param accountName
+     * @param key
+     * @return
+     */
+    public Integer getIntegerValue(String accountName, String key) {
+        String value = getValue(accountName, key);
+
+        if (value.isEmpty()) {
+            return -1;
+        } else {
+            return Integer.valueOf(value);
+        }
+    }
+
+    /**
+     * returns integer if found else -1
+     *
+     * @param account
+     * @param key
+     * @return
+     */
+    public Integer getIntegerValue(Account account, String key) {
+        return getIntegerValue(account.name, key);
+    }
+
     private ArrayList<String> getValues(Account account, String key) {
         Cursor cursor = contentResolver.query(
                 ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
@@ -146,13 +178,21 @@ public class ArbitraryDataProvider {
         return new ArrayList<>();
     }
 
+    /**
+     * Returns stored value as string or empty string
+     * @return string if value found or empty string
+     */
     public String getValue(Account account, String key) {
+        return getValue(account.name, key);
+    }
+
+    public String getValue(String accountName, String key) {
         Cursor cursor = contentResolver.query(
                 ProviderMeta.ProviderTableMeta.CONTENT_URI_ARBITRARY_DATA,
                 null,
                 ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_CLOUD_ID + " = ? and " +
                         ProviderMeta.ProviderTableMeta.ARBITRARY_DATA_KEY + " = ?",
-                new String[]{account.name, key},
+                new String[]{accountName, key},
                 null
         );
 

+ 58 - 7
src/main/java/com/owncloud/android/services/AdvancedFileAlterationListener.java

@@ -20,6 +20,7 @@
 package com.owncloud.android.services;
 
 import android.content.Context;
+import android.content.res.Resources;
 import android.media.ExifInterface;
 import android.os.Handler;
 import android.text.TextUtils;
@@ -27,8 +28,13 @@ import android.text.TextUtils;
 import com.evernote.android.job.JobRequest;
 import com.evernote.android.job.util.support.PersistableBundleCompat;
 import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+import com.owncloud.android.datamodel.ArbitraryDataProvider;
+import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.datamodel.SyncedFolder;
+import com.owncloud.android.files.services.FileUploader;
 import com.owncloud.android.lib.common.utils.Log_OC;
+import com.owncloud.android.ui.activity.Preferences;
 import com.owncloud.android.utils.FileStorageUtils;
 
 import org.apache.commons.io.monitor.FileAlterationListener;
@@ -53,16 +59,18 @@ public class AdvancedFileAlterationListener implements FileAlterationListener {
     public static final String TAG = "AdvancedFileAlterationListener";
     public static final int DELAY_INVOCATION_MS = 2500;
     private Context context;
+    private boolean lightVersion;
 
     private SyncedFolder syncedFolder;
 
     private Map<String, Runnable> uploadMap = new HashMap<>();
     private Handler handler = new Handler();
 
-    public AdvancedFileAlterationListener(SyncedFolder syncedFolder) {
+    public AdvancedFileAlterationListener(SyncedFolder syncedFolder, boolean lightVersion) {
         super();
 
         context = MainApp.getAppContext();
+        this.lightVersion = lightVersion;
         this.syncedFolder = syncedFolder;
     }
 
@@ -122,20 +130,50 @@ public class AdvancedFileAlterationListener implements FileAlterationListener {
             Runnable runnable = new Runnable() {
                 @Override
                 public void run() {
+
+                    String remotePath;
+                    boolean subfolderByDate;
+                    boolean chargingOnly;
+                    boolean wifiOnly;
+                    Integer uploadAction;
+                    String accountName = syncedFolder.getAccount();
+
+                    if (lightVersion) {
+                        ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(context
+                                .getContentResolver());
+
+                        Resources resources = MainApp.getAppContext().getResources();
+
+                        remotePath = resources.getString(R.string.syncedFolder_remote_folder) + OCFile.PATH_SEPARATOR +
+                                new File(syncedFolder.getLocalPath()).getName() + OCFile.PATH_SEPARATOR;
+                        subfolderByDate = resources.getBoolean(R.bool.syncedFolder_light_use_subfolders);
+                        chargingOnly = resources.getBoolean(R.bool.syncedFolder_light_on_charging);
+                        wifiOnly = arbitraryDataProvider.getBooleanValue(accountName,
+                                Preferences.SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI);
+                        String uploadActionString = resources.getString(R.string.syncedFolder_light_upload_behaviour);
+                        uploadAction = getUploadAction(uploadActionString);
+                    } else {
+                        remotePath = syncedFolder.getRemotePath();
+                        subfolderByDate = syncedFolder.getSubfolderByDate();
+                        chargingOnly = syncedFolder.getChargingOnly();
+                        wifiOnly = syncedFolder.getWifiOnly();
+                        uploadAction = syncedFolder.getUploadAction();
+                    }
+
                     PersistableBundleCompat bundle = new PersistableBundleCompat();
                     bundle.putString(AutoUploadJob.LOCAL_PATH, file.getAbsolutePath());
                     bundle.putString(AutoUploadJob.REMOTE_PATH, FileStorageUtils.getInstantUploadFilePath(
                             currentLocale,
-                            syncedFolder.getRemotePath(), file.getName(),
+                            remotePath, file.getName(),
                             finalLastModificationTime,
-                            syncedFolder.getSubfolderByDate()));
-                    bundle.putString(AutoUploadJob.ACCOUNT, syncedFolder.getAccount());
-                    bundle.putInt(AutoUploadJob.UPLOAD_BEHAVIOUR, syncedFolder.getUploadAction());
+                            subfolderByDate));
+                    bundle.putString(AutoUploadJob.ACCOUNT, accountName);
+                    bundle.putInt(AutoUploadJob.UPLOAD_BEHAVIOUR, uploadAction);
 
                     new JobRequest.Builder(AutoUploadJob.TAG)
                             .setExecutionWindow(30_000L, 80_000L)
-                            .setRequiresCharging(syncedFolder.getChargingOnly())
-                            .setRequiredNetworkType(syncedFolder.getWifiOnly() ? JobRequest.NetworkType.UNMETERED :
+                            .setRequiresCharging(chargingOnly)
+                            .setRequiredNetworkType(wifiOnly ? JobRequest.NetworkType.UNMETERED :
                                     JobRequest.NetworkType.ANY)
                             .setExtras(bundle)
                             .setPersisted(false)
@@ -153,6 +191,19 @@ public class AdvancedFileAlterationListener implements FileAlterationListener {
         }
     }
 
+    private Integer getUploadAction(String action) {
+        switch (action) {
+            case "LOCAL_BEHAVIOUR_FORGET":
+                return FileUploader.LOCAL_BEHAVIOUR_FORGET;
+            case "LOCAL_BEHAVIOUR_MOVE":
+                return FileUploader.LOCAL_BEHAVIOUR_MOVE;
+            case "LOCAL_BEHAVIOUR_DELETE":
+                return FileUploader.LOCAL_BEHAVIOUR_DELETE;
+            default:
+                return FileUploader.LOCAL_BEHAVIOUR_FORGET;
+        }
+    }
+
     @Override
     public void onFileChange(File file) {
         onFileChange(file, 2500);

+ 7 - 3
src/main/java/com/owncloud/android/services/observer/SyncedFolderObserverService.java

@@ -28,6 +28,7 @@ import android.os.Binder;
 import android.os.IBinder;
 
 import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
 import com.owncloud.android.datamodel.SyncedFolder;
 import com.owncloud.android.datamodel.SyncedFolderProvider;
 import com.owncloud.android.lib.common.utils.Log_OC;
@@ -69,7 +70,8 @@ public class SyncedFolderObserverService extends Service {
 
                 try {
                     observer.init();
-                    observer.addListener(new AdvancedFileAlterationListener(syncedFolder));
+                    observer.addListener(new AdvancedFileAlterationListener(syncedFolder,
+                            getResources().getBoolean(R.bool.syncedFolder_light)));
                     monitor.addObserver(observer);
                 } catch (Exception e) {
                     Log_OC.d(TAG, "Failed getting an observer to initialize " + e);
@@ -135,7 +137,8 @@ public class SyncedFolderObserverService extends Service {
                     try {
                         advancedFileAlterationObserver = new AdvancedFileAlterationObserver(syncedFolder, fileFilter);
                         advancedFileAlterationObserver.init();
-                        advancedFileAlterationObserver.addListener(new AdvancedFileAlterationListener(syncedFolder));
+                        advancedFileAlterationObserver.addListener(new AdvancedFileAlterationListener(syncedFolder,
+                                getResources().getBoolean(R.bool.syncedFolder_light)));
                         monitor.addObserver(advancedFileAlterationObserver);
                     } catch (Exception e) {
                         Log_OC.d(TAG, "Failed getting an observer to initialize");
@@ -152,7 +155,8 @@ public class SyncedFolderObserverService extends Service {
             try {
                 advancedFileAlterationObserver = new AdvancedFileAlterationObserver(syncedFolder, fileFilter);
                 advancedFileAlterationObserver.init();
-                advancedFileAlterationObserver.addListener(new AdvancedFileAlterationListener(syncedFolder));
+                advancedFileAlterationObserver.addListener(new AdvancedFileAlterationListener(syncedFolder,
+                        getResources().getBoolean(R.bool.syncedFolder_light)));
                 monitor.addObserver(advancedFileAlterationObserver);
             } catch (Exception e) {
                 Log_OC.d(TAG, "Failed getting an observer to initialize");

+ 4 - 0
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -353,6 +353,10 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
             navigationView.getMenu().removeItem(R.id.nav_contacts);
         }
 
+        if (getResources().getBoolean(R.bool.syncedFolder_light)) {
+            navigationView.getMenu().removeItem(R.id.nav_folder_sync);
+        }
+
         if (!getResources().getBoolean(R.bool.show_drawer_logout)) {
             navigationView.getMenu().removeItem(R.id.nav_logout);
         }

+ 27 - 6
src/main/java/com/owncloud/android/ui/activity/FolderSyncActivity.java

@@ -29,6 +29,7 @@ import android.support.annotation.NonNull;
 import android.support.design.widget.BottomNavigationView;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentTransaction;
+import android.support.v4.widget.DrawerLayout;
 import android.support.v7.widget.GridLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.MenuItem;
@@ -72,6 +73,7 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
 
     private static final String SYNCED_FOLDER_PREFERENCES_DIALOG_TAG = "SYNCED_FOLDER_PREFERENCES_DIALOG";
     public static final String PRIORITIZED_FOLDER = "Camera";
+    public static final String EXTRA_SHOW_SIDEBAR = "SHOW_SIDEBAR";
 
     private static final String SCREEN_NAME = "Auto upload";
 
@@ -84,11 +86,16 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
     private SyncedFolderProvider mSyncedFolderProvider;
     private List<SyncedFolderDisplayItem> syncFolderItems;
     private SyncedFolderPreferencesDialogFragment mSyncedFolderPreferencesDialogFragment;
+    private boolean showSidebar = true;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
+        if (getIntent().getExtras() != null) {
+            showSidebar = getIntent().getExtras().getBoolean(EXTRA_SHOW_SIDEBAR);
+        }
+
         setContentView(R.layout.folder_sync_layout);
 
         // setup toolbar
@@ -96,9 +103,16 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
 
         // setup drawer
         setupDrawer(R.id.nav_folder_sync);
-        getSupportActionBar().setTitle(getString(R.string.drawer_folder_sync));
+
+        if (!showSidebar) {
+            setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
+            mDrawerToggle.setDrawerIndicatorEnabled(false);
+        }
 
         setupContent();
+
+        getSupportActionBar().setTitle(getString(R.string.drawer_folder_sync));
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
     }
 
     @Override
@@ -117,7 +131,8 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
         mEmpty = (TextView) findViewById(android.R.id.empty);
 
         final int gridWidth = getResources().getInteger(R.integer.media_grid_width);
-        mAdapter = new FolderSyncAdapter(this, gridWidth, this);
+        boolean lightVersion = getResources().getBoolean(R.bool.syncedFolder_light);
+        mAdapter = new FolderSyncAdapter(this, gridWidth, this, lightVersion);
         mSyncedFolderProvider = new SyncedFolderProvider(getContentResolver());
 
         final GridLayoutManager lm = new GridLayoutManager(this, gridWidth);
@@ -327,6 +342,7 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
         }
         return result;
     }
+
     /**
      * show/hide recycler view list or the empty message / progress info.
      *
@@ -345,10 +361,15 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
         boolean result = true;
         switch (item.getItemId()) {
             case android.R.id.home: {
-                if (isDrawerOpen()) {
-                    closeDrawer();
+                if (showSidebar) {
+                    if (isDrawerOpen()) {
+                        closeDrawer();
+                    } else {
+                        openDrawer();
+                    }
                 } else {
-                    openDrawer();
+                    Intent settingsIntent = new Intent(getApplicationContext(), Preferences.class);
+                    startActivity(settingsIntent);
                 }
                 break;
             }
@@ -431,7 +452,7 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
         }
         mSyncedFolderPreferencesDialogFragment = null;
 
-        if(dirty) {
+        if (dirty) {
             mAdapter.setSyncFolderItem(syncedFolder.getSection(), item);
         }
     }

+ 48 - 0
src/main/java/com/owncloud/android/ui/activity/Preferences.java

@@ -42,6 +42,7 @@ import android.preference.Preference.OnPreferenceClickListener;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceCategory;
 import android.preference.PreferenceManager;
+import android.preference.PreferenceScreen;
 import android.support.annotation.LayoutRes;
 import android.support.annotation.Nullable;
 import android.support.v7.app.ActionBar;
@@ -58,6 +59,7 @@ import com.owncloud.android.BuildConfig;
 import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
+import com.owncloud.android.datamodel.ArbitraryDataProvider;
 import com.owncloud.android.datamodel.ExternalLinksProvider;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.datastorage.DataStorageProvider;
@@ -91,6 +93,8 @@ public class Preferences extends PreferenceActivity
 
     private static final int ACTION_REQUEST_CODE_DAVDROID_SETUP = 10;
 
+    public static final String SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI = "SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI";
+
     /**
      * The user's server base uri.
      */
@@ -161,6 +165,50 @@ public class Preferences extends PreferenceActivity
         // Register context menu for list of preferences.
         registerForContextMenu(getListView());
 
+        // Synced folders
+        PreferenceCategory preferenceCategoryFolderSync = (PreferenceCategory) findPreference("folder_sync");
+
+        if (!getResources().getBoolean(R.bool.syncedFolder_light)) {
+            PreferenceScreen preferenceScreen = (PreferenceScreen) findPreference("preference_screen");
+            preferenceScreen.removePreference(preferenceCategoryFolderSync);
+        } else {
+            // Upload on WiFi
+            final ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
+            final Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
+
+            final CheckBoxPreference pUploadOnWifiCheckbox = (CheckBoxPreference) findPreference("synced_folder_on_wifi");
+            pUploadOnWifiCheckbox.setChecked(
+                    arbitraryDataProvider.getBooleanValue(account, SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI));
+
+            pUploadOnWifiCheckbox.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+                @Override
+                public boolean onPreferenceClick(Preference preference) {
+                    arbitraryDataProvider.storeOrUpdateKeyValue(account, SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI,
+                            String.valueOf(pUploadOnWifiCheckbox.isChecked()));
+
+                    return true;
+                }
+            });
+
+            Preference pSyncedFolder = findPreference("folder_sync_folders");
+            if (pSyncedFolder != null) {
+                if (getResources().getBoolean(R.bool.syncedFolder_light)
+                        && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                    pSyncedFolder.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+                        @Override
+                        public boolean onPreferenceClick(Preference preference) {
+                            Intent folderSyncIntent = new Intent(getApplicationContext(), FolderSyncActivity.class);
+                            folderSyncIntent.putExtra(FolderSyncActivity.EXTRA_SHOW_SIDEBAR, false);
+                            startActivity(folderSyncIntent);
+                            return true;
+                        }
+                    });
+                } else {
+                    preferenceCategoryFolderSync.removePreference(pSyncedFolder);
+                }
+            }
+        }
+
         PreferenceCategory preferenceCategoryDetails = (PreferenceCategory) findPreference("details");
 
 

+ 15 - 9
src/main/java/com/owncloud/android/ui/adapter/FolderSyncAdapter.java

@@ -51,13 +51,15 @@ public class FolderSyncAdapter extends SectionedRecyclerViewAdapter<FolderSyncAd
     private final int mGridTotal;
     private final ClickListener mListener;
     private final List<SyncedFolderDisplayItem> mSyncFolderItems;
+    private final boolean mLight;
 
-    public FolderSyncAdapter(Context context, int gridWidth, ClickListener listener) {
+    public FolderSyncAdapter(Context context, int gridWidth, ClickListener listener, boolean light) {
         mContext = context;
         mGridWidth = gridWidth;
         mGridTotal = gridWidth * 2;
         mListener = listener;
         mSyncFolderItems = new ArrayList<>();
+        mLight = light;
     }
 
     public void setSyncFolderItems(List<SyncedFolderDisplayItem> syncFolderItems) {
@@ -100,14 +102,18 @@ public class FolderSyncAdapter extends SectionedRecyclerViewAdapter<FolderSyncAd
         });
         setSyncButtonActiveIcon(holder.syncStatusButton, mSyncFolderItems.get(section).isEnabled());
 
-        holder.menuButton.setVisibility(View.VISIBLE);
-        holder.menuButton.setTag(section);
-        holder.menuButton.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                mListener.onSyncFolderSettingsClick(section, mSyncFolderItems.get(section));
-            }
-        });
+        if (mLight) {
+            holder.menuButton.setVisibility(View.GONE);
+        } else {
+            holder.menuButton.setVisibility(View.VISIBLE);
+            holder.menuButton.setTag(section);
+            holder.menuButton.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    mListener.onSyncFolderSettingsClick(section, mSyncFolderItems.get(section));
+                }
+            });
+        }
     }
 
     @Override

+ 5 - 2
src/main/res/layout/folder_sync_item_header.xml

@@ -51,7 +51,10 @@
             android:layout_height="wrap_content"
             android:background="@color/transparent"
             android:clickable="true"
-            android:padding="@dimen/standard_half_padding"
+            android:paddingTop="@dimen/standard_half_padding"
+            android:paddingBottom="@dimen/standard_half_padding"
+            android:paddingLeft="@dimen/standard_half_padding"
+            android:paddingRight="@dimen/standard_padding"
             android:src="@drawable/ic_cloud_sync_off"/>
 
         <ImageButton
@@ -61,7 +64,7 @@
             android:background="@color/transparent"
             android:clickable="true"
             android:paddingBottom="@dimen/standard_half_padding"
-            android:paddingLeft="@dimen/standard_half_padding"
+            android:paddingLeft="0dp"
             android:paddingRight="@dimen/standard_padding"
             android:paddingTop="@dimen/standard_half_padding"
             android:src="@drawable/ic_dots_vertical"/>

+ 4 - 3
src/main/res/layout/folder_sync_layout.xml

@@ -35,11 +35,12 @@
         <include
             layout="@layout/toolbar_standard"/>
 
-        <FrameLayout
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_above="@+id/bottom_navigation_view"
-            android:layout_below="@+id/appbar">
+            android:layout_below="@+id/appbar"
+            android:orientation="vertical">
 
             <android.support.v7.widget.RecyclerView
                 android:id="@android:id/list"
@@ -86,7 +87,7 @@
                 android:gravity="center"
                 android:text="@string/folder_sync_no_results"
                 android:visibility="gone" />
-        </FrameLayout>
+        </LinearLayout>
 
         <android.support.design.widget.BottomNavigationView
             android:id="@+id/bottom_navigation_view"

+ 7 - 0
src/main/res/values/setup.xml

@@ -104,6 +104,13 @@
     <string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
     <string name="url_server_install">https://nextcloud.com/install</string>
 
+    <!-- synced folder light; if enabled: move to setting & global upload settings -->
+    <bool name="syncedFolder_light">false</bool>
+    <string name="syncedFolder_remote_folder">@string/auto_upload_path</string>
+    <bool name="syncedFolder_light_on_charging">false</bool>
+    <bool name="syncedFolder_light_use_subfolders">false</bool>
+    <string name="syncedFolder_light_upload_behaviour">FileUploader.LOCAL_BEHAVIOUR_FORGET</string>
+
     <!--Destination mail for sending log files -->
     <string name="mail_logger"></string>
 

+ 3 - 0
src/main/res/values/strings.xml

@@ -349,6 +349,7 @@
     <string name="instant_video_upload_on_charging">Only upload when charging</string>
     <string name="instant_upload_on_charging">Only upload when charging</string>
     <string name="instant_upload_path">/InstantUpload</string>
+    <string name="auto_upload_path">/Auto Upload</string>
     <string name="conflict_title">File conflict</string>
     <string name="conflict_message">Which files do you want to keep? If you select both versions, the local file will have a number appended to its name.</string>
     <string name="conflict_keep_both">Keep both</string>
@@ -669,5 +670,7 @@
     <string name="privacy">Privacy</string>
     <string name="file_not_found">File not found!</string>
 
+    <string name="folder_sync_folders">Configure folders</string>
+
   <string name="empty" translatable="false"/>
 </resources>

+ 20 - 6
src/main/res/xml/preferences.xml

@@ -17,11 +17,25 @@
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
-	<PreferenceCategory android:title="@string/prefs_category_general">
-		<ListPreference
-			android:title="@string/prefs_storage_path"
-			android:key="storage_path" />
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+				  android:key="preference_screen">
+    <PreferenceCategory
+        android:title="@string/prefs_category_general"
+        android:key="general">
+        <ListPreference
+            android:title="@string/prefs_storage_path"
+            android:key="storage_path"/>
+	</PreferenceCategory>
+	<PreferenceCategory
+		android:title="@string/drawer_folder_sync"
+		android:key="folder_sync">
+		<android.preference.CheckBoxPreference
+			android:title="@string/auto_upload_on_wifi"
+			android:key="synced_folder_on_wifi"/>
+        <Preference
+			android:title="@string/folder_sync_folders"
+			android:id="@+id/folder_sync_folders"
+			android:key="folder_sync_folders"/>
 	</PreferenceCategory>
 
     <PreferenceCategory android:title="@string/prefs_category_instant_uploading" android:key="instant_uploading_category">
@@ -75,7 +89,7 @@
 		<Preference 		android:key="log_history"
 	                        android:title="@string/prefs_log_title_history"
 	                        android:summary="@string/prefs_log_summary_history"/ -->
-                        
+
     </PreferenceCategory>
 
 	<PreferenceCategory android:title="@string/prefs_category_details" android:key="details">

+ 7 - 0
src/modified/res/values/setup.xml

@@ -104,6 +104,13 @@
     <string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
     <string name="url_server_install">https://nextcloud.com/install</string>
 
+    <!-- synced folder light; if enabled: move to setting & global upload settings -->
+    <bool name="syncedFolder_light">true</bool>
+    <string name="syncedFolder_remote_folder">@string/instant_upload_path</string>
+    <bool name="syncedFolder_light_on_charging">false</bool>
+    <bool name="syncedFolder_light_use_subfolders">false</bool>
+    <string name="syncedFolder_light_upload_behaviour">FileUploader.LOCAL_BEHAVIOUR_FORGET</string>
+
     <!--Destination mail for sending log files -->
     <string name="mail_logger"></string>