X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/a2de2f28ab6167e4003f0283b50b98dd0e73a598..09a56d3c6010eefad4ec8d4372a2a0132388f3ac:/src/com/owncloud/android/ui/activity/Preferences.java diff --git a/src/com/owncloud/android/ui/activity/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java index 3a5c5b4d..9c11f0a8 100644 --- a/src/com/owncloud/android/ui/activity/Preferences.java +++ b/src/com/owncloud/android/ui/activity/Preferences.java @@ -70,7 +70,6 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa 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; @@ -255,6 +254,9 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa 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); @@ -269,6 +271,9 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa 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); @@ -406,7 +411,13 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa 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 || resultCode == UploadPathActivity.RESULT_OK_SET_UPLOAD_PATH)){ @@ -414,6 +425,11 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa mUploadVideoPath = folderToUploadVideo.getRemotePath(); + mUploadVideoPath = DisplayUtils.getPathWithoutLastSlash(mUploadVideoPath); + + // Show the video path on summary preference + mPrefInstantVideoUploadPath.setSummary(mUploadVideoPath); + saveInstantUploadVideoPathOnPreferences(); } } @@ -540,7 +556,6 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa * Save the "Instant Upload Path" on preferences */ private void saveInstantUploadPathOnPreferences() { - mPrefInstantUploadPath.setSummary(mUploadPath); SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences.Editor editor = appPrefs.edit(); editor.putString("instant_upload_path", mUploadPath); @@ -560,7 +575,6 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa * Save the "Instant Video Upload Path" on preferences */ private void saveInstantUploadVideoPathOnPreferences() { - mPrefInstantVideoUploadPath.setSummary(mUploadVideoPath); SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences.Editor editor = appPrefs.edit(); editor.putString("instant_video_upload_path", mUploadVideoPath);