Browse Source

Merge branch 'master' into develop

David A. Velasco 10 years ago
parent
commit
50e39f044f

+ 7 - 3
AndroidManifest.xml

@@ -18,8 +18,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->
 <manifest package="com.owncloud.android"
-    android:versionCode="10600100"
-    android:versionName="1.6.1" xmlns:android="http://schemas.android.com/apk/res/android">
+    android:versionCode="10600200"
+    android:versionName="1.6.2" xmlns:android="http://schemas.android.com/apk/res/android">
 
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />
     <uses-permission android:name="android.permission.USE_CREDENTIALS" />
@@ -191,7 +191,11 @@
 			android:icon="@drawable/copy_link"/>
 
         <activity 
-			android:name=".ui.activity.MoveActivity"
+			android:name=".ui.activity.FolderPickerActivity"
+			android:label="@string/app_name"/>
+
+        <activity 
+			android:name=".ui.activity.UploadPathActivity"
 			android:label="@string/app_name"/>
         
     </application>

+ 1 - 1
README.md

@@ -5,4 +5,4 @@ The app performs file synchronization with an ownCloud server. Other ownCloud fe
 Make sure you read [SETUP.md][1] when you start working on this project.
 
 [0]: https://github.com/owncloud/core
-[1]: https://raw.github.com/owncloud/android/master/SETUP.md
+[1]: https://github.com/owncloud/android/blob/master/SETUP.md

+ 2 - 2
oc_jb_workaround/AndroidManifest.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.owncloud.android.workaround.accounts"
-    android:versionCode="0100019"
-    android:versionName="1.0.19" >
+    android:versionCode="0100020"
+    android:versionName="1.0.20" >
 
     <uses-sdk
         android:minSdkVersion="16"

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit 5bd0d7387712ce3f53869294761ac4d8537841cd
+Subproject commit 8261865ff24c1bfc05be19ae9364a66dac8f26c3

+ 3 - 3
res/layout/files_move.xml → res/layout/files_folder_picker.xml

@@ -18,18 +18,18 @@
         android:orientation="horizontal" >
 
         <Button
-            android:id="@+id/move_files_btn_cancel"
+            android:id="@+id/folder_picker_btn_cancel"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:text="@string/common_cancel" />
 
 		<Button
-		    android:id="@+id/move_files_btn_choose"
+		    android:id="@+id/folder_picker_btn_choose"
 		    android:layout_width="wrap_content"
 		    android:layout_height="wrap_content"
 		    android:layout_weight="1"
-		    android:text="@string/move_choose_button_text" />
+		    android:text="@string/folder_picker_choose_button_text" />
 
 	</LinearLayout>
 

+ 4 - 1
res/values/strings.xml

@@ -311,7 +311,7 @@
 	<string name="saml_authentication_wrong_pass">Wrong password</string>
 	<string name="actionbar_move">Move</string>
 	<string name="file_list_empty_moving">Nothing in here. You can add a folder!</string>
-	<string name="move_choose_button_text">Choose</string>
+	<string name="folder_picker_choose_button_text">Choose</string>
 
 	<string name="move_file_not_found">Unable to move. Please check whether the file exists</string>
 	<string name="move_file_invalid_into_descendent">It is not possible to move a folder into a descendant</string>
@@ -321,4 +321,7 @@
 
 	<string name="prefs_category_instant_uploading">Instant Uploads</string>
 	<string name="prefs_category_security">Security</string>
+
+	<string name="prefs_instant_video_upload_path_title">Upload Video Path</string>
+
 </resources>

+ 6 - 3
res/xml/preferences.xml

@@ -32,9 +32,9 @@
 	</PreferenceCategory>
 
     <PreferenceCategory android:title="@string/prefs_category_instant_uploading">
-	    <EditTextPreference android:title="@string/prefs_instant_upload_path_title"
-	        				android:defaultValue="@string/instant_upload_path"
-	        				android:key="instant_upload_path"/>
+        <com.owncloud.android.ui.PreferenceWithLongSummary
+							android:title="@string/prefs_instant_upload_path_title"
+							android:key="instant_upload_path" />
 	    <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
 	                        android:title="@string/prefs_instant_upload"
 	                        android:summary="@string/prefs_instant_upload_summary"/>
@@ -42,6 +42,9 @@
 	        				android:disableDependentsState="true"
 	        				android:title="@string/instant_upload_on_wifi"
 	        				android:key="instant_upload_on_wifi"/>
+	    <com.owncloud.android.ui.PreferenceWithLongSummary
+							android:title="@string/prefs_instant_video_upload_path_title"
+							android:key="instant_video_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"/>

+ 1 - 1
src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java

@@ -161,7 +161,7 @@ public class InstantUploadBroadcastReceiver extends BroadcastReceiver {
         Intent i = new Intent(context, FileUploader.class);
         i.putExtra(FileUploader.KEY_ACCOUNT, account);
         i.putExtra(FileUploader.KEY_LOCAL_FILE, file_path);
-        i.putExtra(FileUploader.KEY_REMOTE_FILE, FileStorageUtils.getInstantUploadFilePath(context, file_name));
+        i.putExtra(FileUploader.KEY_REMOTE_FILE, FileStorageUtils.getInstantVideoUploadFilePath(context, file_name));
         i.putExtra(FileUploader.KEY_UPLOAD_TYPE, FileUploader.UPLOAD_SINGLE_FILE);
         i.putExtra(FileUploader.KEY_MIME_TYPE, mime_type);
         i.putExtra(FileUploader.KEY_INSTANT_UPLOAD, true);

+ 48 - 0
src/com/owncloud/android/ui/PreferenceWithLongSummary.java

@@ -0,0 +1,48 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2014 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   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 General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.ui;
+
+import android.content.Context;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
+import android.preference.Preference;
+
+public class PreferenceWithLongSummary extends Preference{
+
+    public PreferenceWithLongSummary(Context context) {
+        super(context);
+    }
+
+    public PreferenceWithLongSummary(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+    public PreferenceWithLongSummary(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    protected void onBindView(View view) {
+        super.onBindView(view);
+        TextView titleView = (TextView) view.findViewById(android.R.id.summary);
+        titleView.setSingleLine(true);
+        titleView.setMaxLines(1);
+        titleView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
+    }
+}

+ 3 - 4
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -615,8 +615,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
         } else if (requestCode == ACTION_SELECT_MULTIPLE_FILES && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
             requestMultipleUpload(data, resultCode);
 
-        } else if (requestCode == ACTION_MOVE_FILES && (resultCode == RESULT_OK || 
-                resultCode == MoveActivity.RESULT_OK_AND_MOVE)){
+        } else if (requestCode == ACTION_MOVE_FILES && resultCode == RESULT_OK){
 
             final Intent fData = data;
             final int fResultCode = resultCode; 
@@ -744,8 +743,8 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
      * @param resultCode        Result code received
      */
     private void requestMoveOperation(Intent data, int resultCode) {
-        OCFile folderToMoveAt = (OCFile) data.getParcelableExtra(MoveActivity.EXTRA_CURRENT_FOLDER);
-        OCFile targetFile = (OCFile) data.getParcelableExtra(MoveActivity.EXTRA_TARGET_FILE);
+        OCFile folderToMoveAt = (OCFile) data.getParcelableExtra(FolderPickerActivity.EXTRA_FOLDER);
+        OCFile targetFile = (OCFile) data.getParcelableExtra(FolderPickerActivity.EXTRA_FILE);
         getFileOperationsHelper().moveFile(folderToMoveAt, targetFile);
     }
 

+ 43 - 34
src/com/owncloud/android/ui/activity/MoveActivity.java → src/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -29,6 +29,7 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.res.Resources.NotFoundException;
 import android.os.Bundle;
+import android.os.Parcelable;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentTransaction;
 import android.util.Log;
@@ -52,6 +53,7 @@ import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundExce
 import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.operations.CreateFolderOperation;
 import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.syncadapter.FileSyncAdapter;
@@ -60,26 +62,26 @@ import com.owncloud.android.ui.fragment.FileFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
 import com.owncloud.android.utils.DisplayUtils;
 import com.owncloud.android.utils.ErrorMessageAdapter;
-import com.owncloud.android.lib.common.utils.Log_OC;
 
-public class MoveActivity extends HookActivity implements FileFragment.ContainerActivity, 
+public class FolderPickerActivity extends FileActivity implements FileFragment.ContainerActivity, 
     OnClickListener, OnEnforceableRefreshListener {
 
-    public static final String EXTRA_CURRENT_FOLDER = UploadFilesActivity.class.getCanonicalName() + ".EXTRA_CURRENT_FOLDER";
-    public static final String EXTRA_TARGET_FILE = UploadFilesActivity.class.getCanonicalName() + "EXTRA_TARGET_FILE";
+    public static final String EXTRA_FOLDER = UploadFilesActivity.class.getCanonicalName()
+                                                            + ".EXTRA_FOLDER";
+    public static final String EXTRA_FILE = UploadFilesActivity.class.getCanonicalName()
+                                                            + ".EXTRA_FILE";
+    //TODO: Think something better
 
-    public static final int RESULT_OK_AND_MOVE = 1;
-    
     private SyncBroadcastReceiver mSyncBroadcastReceiver;
 
-    private static final String TAG = MoveActivity.class.getSimpleName();
+    private static final String TAG = FolderPickerActivity.class.getSimpleName();
     
     private static final String TAG_LIST_OF_FOLDERS = "LIST_OF_FOLDERS";
        
     private boolean mSyncInProgress = false;
 
-    private Button mCancelBtn;
-    private Button mChooseBtn;
+    protected Button mCancelBtn;
+    protected Button mChooseBtn;
 
 
     @Override
@@ -89,7 +91,7 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
 
         super.onCreate(savedInstanceState); 
 
-        setContentView(R.layout.files_move);
+        setContentView(R.layout.files_folder_picker);
         
         if (savedInstanceState == null) {
             createFragments();
@@ -118,11 +120,6 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
         getSupportActionBar().setIcon(DisplayUtils.getSeasonalIconId());
     }
 
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-    }
-
     /**
      *  Called when the ownCloud {@link Account} associated to the Activity was just updated.
      */
@@ -180,8 +177,8 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
         }
     }
 
-    private OCFileListFragment getListOfFilesFragment() {
-        Fragment listOfFiles = getSupportFragmentManager().findFragmentByTag(MoveActivity.TAG_LIST_OF_FOLDERS);
+    protected OCFileListFragment getListOfFilesFragment() {
+        Fragment listOfFiles = getSupportFragmentManager().findFragmentByTag(FolderPickerActivity.TAG_LIST_OF_FOLDERS);
         if (listOfFiles != null) {
             return (OCFileListFragment)listOfFiles;
         }
@@ -267,6 +264,8 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
         menu.findItem(R.id.action_upload).setVisible(false);
         menu.findItem(R.id.action_settings).setVisible(false);
         menu.findItem(R.id.action_sync_account).setVisible(false);
+        menu.findItem(R.id.action_logger).setVisible(false);
+        menu.findItem(R.id.action_sort).setVisible(false);
         return true;
     }
 
@@ -296,7 +295,7 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
         return retval;
     }
 
-    private OCFile getCurrentFolder() {
+    protected OCFile getCurrentFolder() {
         OCFile file = getFile();
         if (file != null) {
             if (file.isFolder()) {
@@ -341,7 +340,7 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
         }
     }
 
-    private void updateNavigationElementsInActionBar() {
+    protected void updateNavigationElementsInActionBar() {
         ActionBar actionBar = getSupportActionBar();
         OCFile currentDir = getCurrentFolder();
         boolean atRoot = (currentDir == null || currentDir.getParentId() == 0);
@@ -358,9 +357,9 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
      * Set per-view controllers
      */
     private void initControls(){
-        mCancelBtn = (Button) findViewById(R.id.move_files_btn_cancel);
+        mCancelBtn = (Button) findViewById(R.id.folder_picker_btn_cancel);
         mCancelBtn.setOnClickListener(this);
-        mChooseBtn = (Button) findViewById(R.id.move_files_btn_choose);
+        mChooseBtn = (Button) findViewById(R.id.folder_picker_btn_choose);
         mChooseBtn.setOnClickListener(this);
     }
     
@@ -370,12 +369,14 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
             finish();
         } else if (v == mChooseBtn) {
             Intent i = getIntent();
-            OCFile targetFile = (OCFile) i.getParcelableExtra(MoveActivity.EXTRA_TARGET_FILE);
+            Parcelable targetFile = i.getParcelableExtra(FolderPickerActivity.EXTRA_FILE);
 
             Intent data = new Intent();
-            data.putExtra(EXTRA_CURRENT_FOLDER, getCurrentFolder());
-            data.putExtra(EXTRA_TARGET_FILE, targetFile);
-            setResult(RESULT_OK_AND_MOVE, data);
+            data.putExtra(EXTRA_FOLDER, getCurrentFolder());
+            if (targetFile != null) {
+                data.putExtra(EXTRA_FILE, targetFile);
+            }
+            setResult(RESULT_OK, data);
             finish();
         }
     }
@@ -409,7 +410,7 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
         } else {
             dismissLoadingDialog();
             try {
-                Toast msg = Toast.makeText(MoveActivity.this, 
+                Toast msg = Toast.makeText(FolderPickerActivity.this, 
                         ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()), 
                         Toast.LENGTH_LONG); 
                 msg.show();
@@ -434,8 +435,10 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
                 Log_OC.d(TAG, "Received broadcast " + event);
                 String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
                 String synchFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH); 
-                RemoteOperationResult synchResult = (RemoteOperationResult)intent.getSerializableExtra(FileSyncAdapter.EXTRA_RESULT);
-                boolean sameAccount = (getAccount() != null && accountName.equals(getAccount().name) && getStorageManager() != null); 
+                RemoteOperationResult synchResult = (RemoteOperationResult)intent.
+                        getSerializableExtra(FileSyncAdapter.EXTRA_RESULT);
+                boolean sameAccount = (getAccount() != null && 
+                        accountName.equals(getAccount().name) && getStorageManager() != null); 
     
                 if (sameAccount) {
                     
@@ -443,13 +446,17 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
                         mSyncInProgress = true;
                         
                     } else {
-                        OCFile currentFile = (getFile() == null) ? null : getStorageManager().getFileByPath(getFile().getRemotePath());
-                        OCFile currentDir = (getCurrentFolder() == null) ? null : getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
+                        OCFile currentFile = (getFile() == null) ? null : 
+                            getStorageManager().getFileByPath(getFile().getRemotePath());
+                        OCFile currentDir = (getCurrentFolder() == null) ? null : 
+                            getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
     
                         if (currentDir == null) {
                             // current folder was removed from the server 
-                            Toast.makeText( MoveActivity.this, 
-                                            String.format(getString(R.string.sync_current_folder_was_removed), getCurrentFolder().getFileName()), 
+                            Toast.makeText( FolderPickerActivity.this, 
+                                            String.format(
+                                                    getString(R.string.sync_current_folder_was_removed), 
+                                                    getCurrentFolder().getFileName()), 
                                             Toast.LENGTH_LONG)
                                 .show();
                             browseToRoot();
@@ -460,7 +467,8 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
                                 currentFile = currentDir;
                             }
 
-                            if (synchFolderRemotePath != null && currentDir.getRemotePath().equals(synchFolderRemotePath)) {
+                            if (synchFolderRemotePath != null && currentDir.getRemotePath().
+                                    equals(synchFolderRemotePath)) {
                                 OCFileListFragment fileListFragment = getListOfFilesFragment();
                                 if (fileListFragment != null) {
                                     fileListFragment.listDirectory(currentDir);
@@ -469,7 +477,8 @@ public class MoveActivity extends HookActivity implements FileFragment.Container
                             setFile(currentFile);
                         }
                         
-                        mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) && !SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
+                        mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) && 
+                                !SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
                                 
                         if (SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.
                                     equals(event) &&

+ 90 - 37
src/com/owncloud/android/ui/activity/Preferences.java

@@ -50,6 +50,7 @@ import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.authentication.AuthenticatorActivity;
+import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.db.DbHandler;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.LongClickableCheckBoxPreference;
@@ -66,6 +67,9 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
     
     private static final String TAG = "OwnCloudPreferences";
 
+    private static final int ACTION_SELECT_UPLOAD_PATH = 1;
+    private static final int ACTION_SELECT_UPLOAD_VIDEO_PATH = 2;
+
     private DbHandler mDbHandler;
     private CheckBoxPreference pCode;
     private Preference pAboutApp;
@@ -75,6 +79,9 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
     private String mAccountName;
     private boolean mShowContextMenu = false;
     private String mUploadPath;
+    private Preference mPrefInstantUploadPath;
+    private Preference mPrefInstantVideoUploadPath;
+    private String mUploadVideoPath;
 
 
     @SuppressWarnings("deprecation")
@@ -89,8 +96,6 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
         actionBar.setDisplayHomeAsUpEnabled(true);
         actionBar.setTitle(R.string.actionbar_settings);
 
-        loadInstantUploadPath();
-
         // Load the accounts category for adding the list of accounts
         mAccountsPrefCategory = (PreferenceCategory) findPreference("accounts_category");
 
@@ -243,15 +248,39 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
             }
         }
 
-        Preference pInstantUploadPathApp = (Preference) findPreference("instant_upload_path");
+        mPrefInstantUploadPath =  findPreference("instant_upload_path");
+        if (mPrefInstantUploadPath != null){
 
-        pInstantUploadPathApp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
-            @Override
-            public boolean onPreferenceChange(Preference preference, Object newValue) {
-                mUploadPath = updateInstantUploadPath(newValue.toString());
-                return true;
-            }
-        });
+            mPrefInstantUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+                    @Override
+                    public boolean onPreferenceClick(Preference preference) {
+                        if (!mUploadPath.endsWith(OCFile.PATH_SEPARATOR)) {
+                            mUploadPath += OCFile.PATH_SEPARATOR;
+                        }
+                        Intent intent = new Intent(Preferences.this, UploadPathActivity.class);
+                        intent.putExtra(UploadPathActivity.KEY_INSTANT_UPLOAD_PATH, mUploadPath);
+                        startActivityForResult(intent, ACTION_SELECT_UPLOAD_PATH);
+                        return true;
+                    }
+                });
+        }
+
+        mPrefInstantVideoUploadPath =  findPreference("instant_video_upload_path");
+        if (mPrefInstantVideoUploadPath != null){
+
+            mPrefInstantVideoUploadPath.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+                    @Override
+                    public boolean onPreferenceClick(Preference preference) {
+                        if (!mUploadVideoPath.endsWith(OCFile.PATH_SEPARATOR)) {
+                            mUploadVideoPath += OCFile.PATH_SEPARATOR;
+                        }
+                        Intent intent = new Intent(Preferences.this, UploadPathActivity.class);
+                        intent.putExtra(UploadPathActivity.KEY_INSTANT_UPLOAD_PATH, mUploadVideoPath);
+                        startActivityForResult(intent, ACTION_SELECT_UPLOAD_VIDEO_PATH);
+                        return true;
+                    }
+                });
+        }
             
         /* About App */
        pAboutApp = (Preference) findPreference("about_app");
@@ -265,11 +294,14 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
                    Log_OC.e(TAG, "Error while showing about dialog", e);
                }
        }
+
+       loadInstantUploadPath();
+       loadInstantUploadVideoPath();
+
     }
 
     @Override
     protected void onPause() {
-        saveInstantUploadPathOnPreferences();
         super.onPause();
     }
 
@@ -371,6 +403,33 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
+
+        if (requestCode == ACTION_SELECT_UPLOAD_PATH && resultCode == RESULT_OK){
+
+            OCFile folderToUpload = (OCFile) data.getParcelableExtra(UploadPathActivity.EXTRA_FOLDER);
+
+            mUploadPath = folderToUpload.getRemotePath();
+
+            mUploadPath = DisplayUtils.getPathWithoutLastSlash(mUploadPath);
+
+            // Show the path on summary preference
+            mPrefInstantUploadPath.setSummary(mUploadPath);
+
+            saveInstantUploadPathOnPreferences();
+
+        } else if (requestCode == ACTION_SELECT_UPLOAD_VIDEO_PATH && resultCode == RESULT_OK){
+
+            OCFile folderToUploadVideo = (OCFile) data.getParcelableExtra(UploadPathActivity.EXTRA_FOLDER);
+
+            mUploadVideoPath = folderToUploadVideo.getRemotePath();
+
+            mUploadVideoPath = DisplayUtils.getPathWithoutLastSlash(mUploadVideoPath);
+
+            // Show the video path on summary preference
+            mPrefInstantVideoUploadPath.setSummary(mUploadVideoPath);
+
+            saveInstantUploadVideoPathOnPreferences();
+        }
     }
 
     @Override
@@ -482,38 +541,13 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
 
     }
 
-    /**
-     * Update the upload path checking that it is a correct path
-     * @param uploadPath: path write by user
-     * @return String: uploadPath
-     */
-    private String updateInstantUploadPath(String uploadPath) {
-        String slashString = "/";
-
-        // If slashes are duplicated, replace them for only one slash
-        uploadPath = uploadPath.replaceAll("/+", slashString);
-
-        // Remove last slash from path
-        if (uploadPath.length() > 0 && uploadPath.charAt(uploadPath.length()-1) == slashString.charAt(0)) {
-            uploadPath = uploadPath.substring(0, uploadPath.length()-1);
-        }
-
-        if (uploadPath.isEmpty()) { // Set default instant upload path
-            uploadPath = getString(R.string.instant_upload_path);
-        }else {
-            if (!uploadPath.startsWith(slashString)) { // Add initial slash on path if necessary
-                uploadPath = slashString.concat(uploadPath);
-            }
-        }
-        return uploadPath;
-    }
-
     /**
      * Load upload path set on preferences
      */
     private void loadInstantUploadPath() {
         SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
         mUploadPath = appPrefs.getString("instant_upload_path", getString(R.string.instant_upload_path));
+        mPrefInstantUploadPath.setSummary(mUploadPath);
     }
 
     /**
@@ -525,4 +559,23 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
         editor.putString("instant_upload_path", mUploadPath);
         editor.commit();
     }
+
+    /**
+     * Load upload video path set on preferences
+     */
+    private void loadInstantUploadVideoPath() {
+        SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
+        mUploadVideoPath = appPrefs.getString("instant_video_upload_path", getString(R.string.instant_upload_path));
+        mPrefInstantVideoUploadPath.setSummary(mUploadVideoPath);
+    }
+
+    /**
+     * Save the "Instant Video Upload Path" on preferences
+     */
+    private void saveInstantUploadVideoPathOnPreferences() {
+        SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());        
+        SharedPreferences.Editor editor = appPrefs.edit();
+        editor.putString("instant_video_upload_path", mUploadVideoPath);
+        editor.commit();
+    }
 }

+ 77 - 0
src/com/owncloud/android/ui/activity/UploadPathActivity.java

@@ -0,0 +1,77 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2012-2014 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2,
+ *   as published by the Free Software Foundation.
+ *
+ *   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 General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.ui.activity;
+
+import android.accounts.Account;
+
+import android.os.Bundle;
+import android.view.View.OnClickListener;
+
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.ui.fragment.FileFragment;
+import com.owncloud.android.ui.fragment.OCFileListFragment;
+
+public class UploadPathActivity extends FolderPickerActivity implements FileFragment.ContainerActivity,
+        OnClickListener, OnEnforceableRefreshListener {
+
+    public static final String KEY_INSTANT_UPLOAD_PATH = "INSTANT_UPLOAD_PATH";
+
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        String instantUploadPath = getIntent().getStringExtra(KEY_INSTANT_UPLOAD_PATH);
+
+        // The caller activity (Preferences) is not a FileActivity, so it has no OCFile, only a path.
+        OCFile folder = new OCFile(instantUploadPath);
+
+        setFile(folder);
+    }
+
+    /**
+     * Called when the ownCloud {@link Account} associated to the Activity was
+     * just updated.
+     */
+    @Override
+    protected void onAccountSet(boolean stateWasRecovered) {
+        super.onAccountSet(stateWasRecovered);
+        if (getAccount() != null) {
+
+            updateFileFromDB();
+
+            OCFile folder = getFile();
+            if (folder == null || !folder.isFolder()) {
+                // fall back to root folder
+                setFile(getStorageManager().getFileByPath(OCFile.ROOT_PATH));
+                folder = getFile();
+            }
+
+            onBrowsedDownTo(folder);
+
+            if (!stateWasRecovered) {
+                OCFileListFragment listOfFolders = getListOfFilesFragment();
+                listOfFolders.listDirectory(folder);
+
+                startSyncFolderOperation(folder, false);
+            }
+
+            updateNavigationElementsInActionBar();
+        }
+    }
+}

+ 3 - 3
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -40,7 +40,7 @@ import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.FileMenuFilter;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.ui.activity.FileDisplayActivity;
-import com.owncloud.android.ui.activity.MoveActivity;
+import com.owncloud.android.ui.activity.FolderPickerActivity;
 import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
 import com.owncloud.android.ui.adapter.FileListListAdapter;
 import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
@@ -331,10 +331,10 @@ public class OCFileListFragment extends ExtendedListFragment {
                 return true;
             }
             case R.id.action_move: {
-                Intent action = new Intent(getActivity(), MoveActivity.class);
+                Intent action = new Intent(getActivity(), FolderPickerActivity.class);
 
                 // Pass mTargetFile that contains info of selected file/folder
-                action.putExtra(MoveActivity.EXTRA_TARGET_FILE, mTargetFile);
+                action.putExtra(FolderPickerActivity.EXTRA_FILE, mTargetFile);
                 getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES);
                 return true;
             }

+ 14 - 0
src/com/owncloud/android/utils/DisplayUtils.java

@@ -33,6 +33,7 @@ import android.text.format.DateUtils;
 
 import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
+import com.owncloud.android.datamodel.OCFile;
 
 /**
  * A helper class for some string operations.
@@ -319,4 +320,17 @@ public class DisplayUtils {
         
         return dateString.toString().split(",")[0];
     }
+
+    /**
+     * Update the passed path removing the last "/" if it is not the root folder
+     * @param path
+     */
+    public static String getPathWithoutLastSlash(String path) {
+
+        // Remove last slash from path
+        if (path.length() > 1 && path.charAt(path.length()-1) == OCFile.PATH_SEPARATOR.charAt(0)) {
+            path = path.substring(0, path.length()-1);
+        }
+        return path;
+    }
 }

+ 14 - 0
src/com/owncloud/android/utils/FileStorageUtils.java

@@ -81,6 +81,20 @@ public class FileStorageUtils {
         String value = uploadPath + OCFile.PATH_SEPARATOR +  (fileName == null ? "" : fileName);
         return value;
     }
+
+    /**
+     * Gets the composed path when video is or must be stored
+     * @param context
+     * @param fileName: video file name
+     * @return String: video file path composed
+     */
+    public static String getInstantVideoUploadFilePath(Context context, String fileName) {
+        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
+        String uploadVideoPathdef = context.getString(R.string.instant_upload_path);
+        String uploadVideoPath = pref.getString("instant_video_upload_path", uploadVideoPathdef);
+        String value = uploadVideoPath + OCFile.PATH_SEPARATOR +  (fileName == null ? "" : fileName);
+        return value;
+    }
     
     public static String getParentPath(String remotePath) {
         String parentPath = new File(remotePath).getParent();