Browse Source

changed to default
only "on wifi" is in settings

tobiasKaminsky 8 năm trước cách đây
mục cha
commit
7103fea76d

+ 25 - 14
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,11 +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.FolderSyncActivity;
+import com.owncloud.android.ui.activity.Preferences;
 import com.owncloud.android.utils.FileStorageUtils;
 
 import org.apache.commons.io.monitor.FileAlterationListener;
@@ -139,21 +142,16 @@ public class AdvancedFileAlterationListener implements FileAlterationListener {
                         ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(context
                                 .getContentResolver());
 
-                        remotePath = arbitraryDataProvider.getValue(accountName,
-                                FolderSyncActivity.SYNCED_FOLDER_LIGHT_REMOTE_FOLDER) + OCFile.PATH_SEPARATOR +
-                                new File(syncedFolder.getLocalPath()).getName() + OCFile.PATH_SEPARATOR;
-
-                        subfolderByDate = arbitraryDataProvider.getBooleanValue(accountName,
-                                FolderSyncActivity.SYNCED_FOLDER_LIGHT_USE_SUBFOLDERS);
-
-                        chargingOnly = arbitraryDataProvider.getBooleanValue(accountName,
-                                FolderSyncActivity.SYNCED_FOLDER_LIGHT_UPLOAD_ON_CHARGING);
+                        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,
-                                FolderSyncActivity.SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI);
-
-                        uploadAction = arbitraryDataProvider.getIntegerValue(accountName,
-                                FolderSyncActivity.SYNCED_FOLDER_LIGHT_UPLOAD_BEHAVIOUR);
+                                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();
@@ -193,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);

+ 22 - 182
src/main/java/com/owncloud/android/ui/activity/FolderSyncActivity.java

@@ -22,7 +22,6 @@
 package com.owncloud.android.ui.activity;
 
 import android.accounts.Account;
-import android.content.DialogInterface;
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.Handler;
@@ -30,19 +29,17 @@ 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.v7.app.AlertDialog;
+import android.support.v4.widget.DrawerLayout;
 import android.support.v7.widget.GridLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.MenuItem;
 import android.view.View;
-import android.widget.CheckBox;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
 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.MediaFolder;
 import com.owncloud.android.datamodel.MediaProvider;
 import com.owncloud.android.datamodel.OCFile;
@@ -76,18 +73,12 @@ 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 int REQUEST_CODE__SELECT_REMOTE_FOLDER = 0;
+    public static final String EXTRA_SHOW_SIDEBAR = "SHOW_SIDEBAR";
 
     private static final String SCREEN_NAME = "Auto upload";
 
     private static final String TAG = FolderSyncActivity.class.getSimpleName();
 
-    public static final String SYNCED_FOLDER_LIGHT_REMOTE_FOLDER = "SYNCED_FOLDER_LIGHT_REMOTE_FOLDER";
-    public static final String SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI = "SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI";
-    public static final String SYNCED_FOLDER_LIGHT_UPLOAD_ON_CHARGING = "SYNCED_FOLDER_LIGHT_UPLOAD_ON_CHARGING";
-    public static final String SYNCED_FOLDER_LIGHT_USE_SUBFOLDERS = "SYNCED_FOLDER_LIGHT_USE_SUBFOLDERS";
-    public static final String SYNCED_FOLDER_LIGHT_UPLOAD_BEHAVIOUR = "SYNCED_FOLDER_LIGHT_UPLOAD_BEHAVIOUR";
-
     private RecyclerView mRecyclerView;
     private FolderSyncAdapter mAdapter;
     private LinearLayout mProgress;
@@ -95,185 +86,33 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
     private SyncedFolderProvider mSyncedFolderProvider;
     private List<SyncedFolderDisplayItem> syncFolderItems;
     private SyncedFolderPreferencesDialogFragment mSyncedFolderPreferencesDialogFragment;
-    private ArbitraryDataProvider arbitraryDataProvider;
-    private TextView mRemoteFolderSummary;
-    private CheckBox mUploadOnWifiCheckbox;
-    private CheckBox mUploadOnChargingCheckbox;
-    private CheckBox mUploadUseSubfoldersCheckbox;
-    private TextView mUploadBehaviorSummary;
-    private CharSequence[] mUploadBehaviorItemStrings;
+    private boolean showSidebar = true;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        arbitraryDataProvider = new ArbitraryDataProvider(getContentResolver());
-
+        if (getIntent().getExtras() != null) {
+            showSidebar = getIntent().getExtras().getBoolean(EXTRA_SHOW_SIDEBAR);
+        }
 
         setContentView(R.layout.folder_sync_layout);
 
-        if (getResources().getBoolean(R.bool.syncedFolder_light)) {
-            setupLightOption();
-        } else {
-            findViewById(R.id.folder_sync_light_linear_layout).setVisibility(View.GONE);
-        }
-
         // setup toolbar
         setupToolbar();
 
         // setup drawer
         setupDrawer(R.id.nav_folder_sync);
-        getSupportActionBar().setTitle(getString(R.string.drawer_folder_sync));
 
-        setupContent();
-    }
-
-    private void setupLightOption() {
-        // Remote folder
-        mRemoteFolderSummary = (TextView) findViewById(R.id.remote_folder_summary);
-
-        String remoteFolder = arbitraryDataProvider.getValue(getAccount(), SYNCED_FOLDER_LIGHT_REMOTE_FOLDER);
-
-        if (remoteFolder.isEmpty()) {
-            remoteFolder = getString(R.string.instant_upload_path) + "/";
-            saveRemoteFolder(remoteFolder);
-        } else {
-            mRemoteFolderSummary.setText(remoteFolder);
+        if (!showSidebar) {
+            setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
+            mDrawerToggle.setDrawerIndicatorEnabled(false);
         }
 
-        findViewById(R.id.remote_folder_container).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                Intent action = new Intent(getBaseContext(), FolderPickerActivity.class);
-                action.putExtra(
-                        FolderPickerActivity.EXTRA_ACTION, getResources().getText(R.string.choose_remote_folder));
-                startActivityForResult(action, REQUEST_CODE__SELECT_REMOTE_FOLDER);
-            }
-        });
-
-        // Upload on WiFi
-        mUploadOnWifiCheckbox = (CheckBox) findViewById(R.id.setting_instant_upload_on_wifi_checkbox);
-        mUploadOnWifiCheckbox.setChecked(
-                arbitraryDataProvider.getBooleanValue(getAccount(), SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI));
-
-        findViewById(R.id.setting_instant_upload_on_wifi_container).setOnClickListener(
-                new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        mUploadOnWifiCheckbox.toggle();
-                        arbitraryDataProvider.storeOrUpdateKeyValue(getAccount(), SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI,
-                                String.valueOf(mUploadOnWifiCheckbox.isChecked()));
-                    }
-                });
-
-        // Upload on charging
-        mUploadOnChargingCheckbox = (CheckBox) findViewById(R.id.setting_instant_upload_on_charging_checkbox);
-        mUploadOnChargingCheckbox.setChecked(
-                arbitraryDataProvider.getBooleanValue(getAccount(), SYNCED_FOLDER_LIGHT_UPLOAD_ON_CHARGING));
-
-        findViewById(R.id.setting_instant_upload_on_charging_container).setOnClickListener(
-                new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        mUploadOnChargingCheckbox.toggle();
-                        arbitraryDataProvider.storeOrUpdateKeyValue(getAccount(), SYNCED_FOLDER_LIGHT_UPLOAD_ON_CHARGING,
-                                String.valueOf(mUploadOnChargingCheckbox.isChecked()));
-                    }
-                });
-
-        // use subfolders
-        mUploadUseSubfoldersCheckbox = (CheckBox) findViewById(R.id.setting_instant_upload_path_use_subfolders_checkbox);
-        mUploadUseSubfoldersCheckbox.setChecked(
-                arbitraryDataProvider.getBooleanValue(getAccount(), SYNCED_FOLDER_LIGHT_USE_SUBFOLDERS));
-
-        findViewById(R.id.setting_instant_upload_path_use_subfolders_container).setOnClickListener(
-                new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        mUploadUseSubfoldersCheckbox.toggle();
-                        arbitraryDataProvider.storeOrUpdateKeyValue(getAccount(), SYNCED_FOLDER_LIGHT_USE_SUBFOLDERS,
-                                String.valueOf(mUploadUseSubfoldersCheckbox.isChecked()));
-                    }
-                });
-
-        // upload behaviour
-        mUploadBehaviorItemStrings = getResources().getTextArray(R.array.pref_behaviour_entries);
-        mUploadBehaviorSummary = (TextView) findViewById(R.id.setting_instant_behaviour_summary);
-
-        Integer uploadBehaviour = arbitraryDataProvider.getIntegerValue(getAccount(), SYNCED_FOLDER_LIGHT_UPLOAD_BEHAVIOUR);
-
-        if (uploadBehaviour == -1) {
-            uploadBehaviour = FileUploader.LOCAL_BEHAVIOUR_FORGET;
-            arbitraryDataProvider.storeOrUpdateKeyValue(getAccount(), SYNCED_FOLDER_LIGHT_UPLOAD_BEHAVIOUR,
-                    uploadBehaviour.toString());
-        }
-        mUploadBehaviorSummary.setText(mUploadBehaviorItemStrings[uploadBehaviour]);
-
-        findViewById(R.id.setting_instant_behaviour_container).setOnClickListener(
-                new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        Integer behaviourId = arbitraryDataProvider.getIntegerValue(getAccount(),
-                                SYNCED_FOLDER_LIGHT_UPLOAD_BEHAVIOUR);
-
-                        Integer behaviour;
-                        switch (behaviourId) {
-                            case FileUploader.LOCAL_BEHAVIOUR_FORGET:
-                                behaviour = 0;
-                                break;
-                            case FileUploader.LOCAL_BEHAVIOUR_MOVE:
-                                behaviour = 1;
-                                break;
-                            case FileUploader.LOCAL_BEHAVIOUR_DELETE:
-                                behaviour = 2;
-                                break;
-                            default:
-                                behaviour = 0;
-                                break;
-                        }
-
-                        AlertDialog.Builder builder = new AlertDialog.Builder(FolderSyncActivity.this);
-                        builder
-                                .setTitle(R.string.prefs_instant_behaviour_dialogTitle)
-                                .setSingleChoiceItems(getResources().getTextArray(R.array.pref_behaviour_entries),
-                                        behaviour,
-                                        new
-                                                DialogInterface.OnClickListener() {
-                                                    public void onClick(DialogInterface dialog, int which) {
-                                                        saveUploadAction(getResources().getTextArray(
-                                                                R.array.pref_behaviour_entryValues)[which].toString());
-                                                        mUploadBehaviorSummary.setText(mUploadBehaviorItemStrings[which]);
-                                                        dialog.dismiss();
-                                                    }
-                                                });
-                        builder.create().show();
-                    }
-                });
-    }
-
-    private void saveRemoteFolder(String newPath) {
-        arbitraryDataProvider.storeOrUpdateKeyValue(getAccount(), SYNCED_FOLDER_LIGHT_REMOTE_FOLDER, newPath);
-        mRemoteFolderSummary.setText(newPath);
-    }
-
-    private void saveUploadAction(String action) {
-        Integer actionId;
-        switch (action) {
-            case "LOCAL_BEHAVIOUR_FORGET":
-                actionId = FileUploader.LOCAL_BEHAVIOUR_FORGET;
-                break;
-            case "LOCAL_BEHAVIOUR_MOVE":
-                actionId = FileUploader.LOCAL_BEHAVIOUR_MOVE;
-                break;
-            case "LOCAL_BEHAVIOUR_DELETE":
-                actionId = FileUploader.LOCAL_BEHAVIOUR_DELETE;
-                break;
-            default:
-                actionId = FileUploader.LOCAL_BEHAVIOUR_FORGET;
-        }
+        setupContent();
 
-        arbitraryDataProvider.storeOrUpdateKeyValue(getAccount(), SYNCED_FOLDER_LIGHT_UPLOAD_BEHAVIOUR,
-                actionId.toString());
+        getSupportActionBar().setTitle(getString(R.string.drawer_folder_sync));
+        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
     }
 
     @Override
@@ -522,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;
             }
@@ -578,14 +422,10 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         if (requestCode == SyncedFolderPreferencesDialogFragment.REQUEST_CODE__SELECT_REMOTE_FOLDER
-                && resultCode == RESULT_OK) {
+                && resultCode == RESULT_OK && mSyncedFolderPreferencesDialogFragment != null) {
             OCFile chosenFolder = data.getParcelableExtra(FolderPickerActivity.EXTRA_FOLDER);
+            mSyncedFolderPreferencesDialogFragment.setRemoteFolderSummary(chosenFolder.getRemotePath());
 
-            if (mSyncedFolderPreferencesDialogFragment != null) {
-                mSyncedFolderPreferencesDialogFragment.setRemoteFolderSummary(chosenFolder.getRemotePath());
-            } else {
-                saveRemoteFolder(chosenFolder.getRemotePath());
-            }
         } else {
             super.onActivityResult(requestCode, resultCode, data);
         }

+ 46 - 15
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,21 +165,48 @@ public class Preferences extends PreferenceActivity
         // Register context menu for list of preferences.
         registerForContextMenu(getListView());
 
-        PreferenceCategory preferenceCategoryGeneral = (PreferenceCategory) findPreference("general");
-        Preference pSyncedFolder = findPreference("folder_sync");
-        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);
-                        startActivity(folderSyncIntent);
-                        return true;
-                    }
-                });
-            } else {
-                preferenceCategoryGeneral.removePreference(pSyncedFolder);
+        // 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.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+                @Override
+                public boolean onPreferenceChange(Preference preference, Object newValue) {
+                    Boolean newBoolean = (Boolean) newValue;
+                    arbitraryDataProvider.storeOrUpdateKeyValue(account, SYNCED_FOLDER_LIGHT_UPLOAD_ON_WIFI,
+                            String.valueOf(newBoolean));
+
+                    return newBoolean;
+                }
+            });
+
+            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);
+                }
             }
         }
 

+ 0 - 2
src/main/res/layout/folder_sync_layout.xml

@@ -42,8 +42,6 @@
             android:layout_below="@+id/appbar"
             android:orientation="vertical">
 
-            <include layout="@layout/folder_sync_light_layout"/>
-
             <android.support.v7.widget.RecyclerView
                 android:id="@android:id/list"
                 android:layout_width="match_parent"

+ 0 - 201
src/main/res/layout/folder_sync_light_layout.xml

@@ -1,201 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Nextcloud Android client application
-
-  Copyright (C) 2017 Tobias Kaminsky
-  Copyright (C) 2017 Nextcloud
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-  License as published by the Free Software Foundation; either
-  version 3 of the License, or any later version.
-
-  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 AFFERO GENERAL PUBLIC LICENSE for more details.
-
-  You should have received a copy of the GNU Affero General Public
-  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/folder_sync_light_linear_layout"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:padding="@dimen/standard_padding"
-    android:orientation="vertical">
-
-    <LinearLayout
-        android:id="@+id/remote_folder_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:baselineAligned="false"
-        android:gravity="center_vertical"
-        android:minHeight="?android:attr/listPreferredItemHeightSmall"
-        android:orientation="vertical"
-        android:paddingBottom="@dimen/standard_padding"
-        android:paddingTop="@dimen/standard_padding">
-
-        <TextView
-            android:id="@+id/remote_folder_title"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:maxLines="1"
-            android:text="@string/prefs_folder_sync_remote_path_title"
-            android:textAppearance="?attr/textAppearanceListItem"/>
-
-        <TextView
-            android:id="@+id/remote_folder_summary"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:ellipsize="middle"
-            android:maxLines="2"
-            android:text="@string/placeholder_filename"
-            android:textColor="?android:attr/textColorSecondary"/>
-
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/setting_instant_upload_on_wifi_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:baselineAligned="false"
-        android:clipToPadding="false"
-        android:gravity="center_vertical"
-        android:minHeight="?attr/listPreferredItemHeightSmall">
-
-        <TextView
-            android:id="@+id/setting_instant_upload_on_wifi_label"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:ellipsize="marquee"
-            android:maxLines="1"
-            android:text="@string/auto_upload_on_wifi"
-            android:textAppearance="?attr/textAppearanceListItem"/>
-
-        <android.support.v7.widget.AppCompatCheckBox
-            android:id="@+id/setting_instant_upload_on_wifi_checkbox"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:focusable="false"/>
-
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/setting_instant_upload_on_charging_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:baselineAligned="false"
-        android:clipToPadding="false"
-        android:gravity="center_vertical"
-        android:minHeight="?attr/listPreferredItemHeightSmall">
-
-        <TextView
-            android:id="@+id/setting_instant_upload_on_charging_label"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:ellipsize="marquee"
-            android:maxLines="1"
-            android:text="@string/instant_upload_on_charging"
-            android:textAppearance="?attr/textAppearanceListItem"/>
-
-        <android.support.v7.widget.AppCompatCheckBox
-            android:id="@+id/setting_instant_upload_on_charging_checkbox"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:focusable="false"/>
-
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/setting_instant_upload_path_use_subfolders_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:baselineAligned="false"
-        android:clipToPadding="false"
-        android:gravity="center_vertical"
-        android:minHeight="?attr/listPreferredItemHeightSmall"
-        android:paddingBottom="16dp"
-        android:paddingTop="16dp">
-
-        <!-- Preference should place its actual preference widget here. -->
-
-        <LinearLayout
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:orientation="vertical">
-
-            <TextView
-                android:id="@+id/setting_instant_upload_path_use_subfolders_label"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:ellipsize="marquee"
-                android:maxLines="1"
-                android:text="@string/prefs_instant_upload_path_use_subfolders_title"
-                android:textAppearance="?attr/textAppearanceListItem"/>
-
-            <TextView
-                android:id="@+id/setting_instant_upload_path_use_subfolders_summary"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_alignLeft="@id/setting_instant_upload_path_use_subfolders_label"
-                android:layout_below="@id/setting_instant_upload_path_use_subfolders_label"
-                android:ellipsize="end"
-                android:maxLines="2"
-                android:text="@string/prefs_instant_upload_path_use_subfolders_summary"
-                android:textColor="?android:attr/textColorSecondary"/>
-
-        </LinearLayout>
-
-        <android.support.v7.widget.AppCompatCheckBox
-            android:id="@+id/setting_instant_upload_path_use_subfolders_checkbox"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:background="@null"
-            android:clickable="false"
-            android:focusable="false"/>
-
-    </LinearLayout>
-
-    <LinearLayout
-        android:id="@+id/setting_instant_behaviour_container"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:baselineAligned="false"
-        android:clipToPadding="false"
-        android:gravity="center_vertical"
-        android:minHeight="?attr/listPreferredItemHeightSmall"
-        android:orientation="vertical"
-        android:paddingBottom="@dimen/standard_padding"
-        android:paddingTop="@dimen/standard_padding">
-
-        <TextView
-            android:id="@+id/setting_instant_behaviour_title"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:ellipsize="marquee"
-            android:maxLines="1"
-            android:text="@string/prefs_instant_behaviour_title"
-            android:textAppearance="?attr/textAppearanceListItem"/>
-
-        <TextView
-            android:id="@+id/setting_instant_behaviour_summary"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:ellipsize="end"
-            android:maxLines="1"
-            android:text="@string/placeholder_filename"
-            android:textColor="?android:attr/textColorSecondary"/>
-
-    </LinearLayout>
-
-</LinearLayout>

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

@@ -103,7 +103,13 @@
     <string name="mail_feedback">"mailto:android@nextcloud.com"</string>
     <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>
-    <bool name="syncedFolder_light">false</bool> <!-- if enabled: in setting & global upload settings -->
+
+    <!-- synced folder light; if enabled: move to setting & global upload settings -->
+    <bool name="syncedFolder_light">false</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>

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

@@ -669,5 +669,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>

+ 12 - 4
src/main/res/xml/preferences.xml

@@ -17,17 +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" >
+<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/drawer_folder_sync"
-            android:id="@+id/folder_sync"
-            android:key="folder_sync"/>
+			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">

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

@@ -103,7 +103,13 @@
     <string name="mail_feedback">"mailto:android@nextcloud.com"</string>
     <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>
-    <bool name="syncedFolder_light">false</bool> <!-- if enabled: in setting & global upload settings -->
+
+    <!-- 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>