From: Magnus Sjoqvist Date: Fri, 17 Oct 2014 09:06:30 +0000 (+0200) Subject: Merge with develop X-Git-Tag: oc-android-1.7.0_signed~119^2~2^2~7 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/b6c7719415ce87d905996a4def50066415786c3e?hp=95a02855eeb20c88acab1a8c19d09df7cadb2bb0 Merge with develop --- diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index d4507602..7423cbfe 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -30,6 +30,8 @@ Consiglia ad un amico Segnalazioni Imprint + Salvare l\'ultimo percorso usata per l\'upload + Salva la posizione Prova %1$s sul tuo smartphone! Vorrei invitarti a usare %1$s sul tuo smartphone!\nScarica qui: %2$s Verifica server diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml index be006747..7328f8ea 100644 --- a/res/values-sv/strings.xml +++ b/res/values-sv/strings.xml @@ -30,6 +30,8 @@ Rekommendera till en vän Feedback Imprint + Kom ihåg uppladdningsplats + Kom ihåg senaste uppladdningsplatsen för delning Försök %1$s på din smarttelefon! Jag skulle vilja bjuda in dig till att använda %1$s på din smartphone!\nLadda ner här: %2$s Kontrollera Server diff --git a/res/values/strings.xml b/res/values/strings.xml index 4c7cf34d..30c9557b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -31,7 +31,9 @@ Recommend to a friend Feedback Imprint - + Remember share location + Remember last share upload location + "Try %1$s on your smartphone!" "I want to invite you to use %1$s on your smartphone!\nDownload here: %2$s" @@ -270,6 +272,7 @@ An error occurred while waiting for the server, the operation couldn\'t have been done An error occurred while waiting for the server, the operation couldn\'t have been done The operation couldn\'t be completed, server is unavailable + You do not have permission %s @@ -301,5 +304,4 @@ The file exists already in the destination folder An error occurred while trying to move this file or folder to move this file - diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 945e853c..77ef6ed1 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -32,6 +32,9 @@ + (); - mParents.add(""); + + ActionBar actionBar = getSherlock().getActionBar(); + actionBar.setIcon(DisplayUtils.getSeasonalIconId()); + if (prepareStreamsToUpload()) { mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE); Account[] accounts = mAccountManager.getAccountsByType(MainApp.getAccountType()); @@ -104,8 +126,37 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro Log_OC.i(TAG, "More then one ownCloud is available"); showDialog(DIALOG_MULTIPLE_ACCOUNT); } else { + mAccount = accounts[0]; mStorageManager = new FileDataStorageManager(mAccount, getContentResolver()); + + SharedPreferences appPreferences = PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()); + + mSaveUploadLocation = appPreferences.getBoolean("save_last_upload_location", false); + + //If the users has enabled last upload path saving then populate mParents with the previous path + if(mSaveUploadLocation) + { + String last_path = appPreferences.getString("last_upload_path", ""); + // "/" equals root-directory + if(last_path.equals("/")) { + mParents.add(""); + } + else{ + String[] dir_names = last_path.split("/"); + for (String dir : dir_names) + mParents.add(dir); + } + //Make sure that path still exists, if it doesn't pop the stack and try the previous path + while(!mStorageManager.fileExists(generatePath(mParents))){ + mParents.pop(); + } + } + else { + mParents.add(""); + } + populateDirectoryList(); } } else { @@ -288,12 +339,18 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro private void populateDirectoryList() { setContentView(R.layout.uploader_layout); - String full_path = ""; - for (String a : mParents) - full_path += a + "/"; + String current_dir = mParents.peek(); + if(current_dir.equals("")){ + getActionBar().setTitle(getString(R.string.default_display_name_for_root_folder)); + } + else{ + getActionBar().setTitle(current_dir); + } + + String full_path = generatePath(mParents); Log_OC.d(TAG, "Populating view with content of : " + full_path); - + mFile = mStorageManager.getFileByPath(full_path); if (mFile != null) { Vector files = mStorageManager.getFolderContent(mFile); @@ -317,6 +374,14 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro } } + private String generatePath(Stack dirs) { + String full_path = ""; + + for (String a : dirs) + full_path += a + "/"; + return full_path; + } + private boolean prepareStreamsToUpload() { if (getIntent().getAction().equals(Intent.ACTION_SEND)) { mStreamsToUpload = new ArrayList(); @@ -408,6 +473,15 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro intent.putExtra(FileUploader.KEY_REMOTE_FILE, remote.toArray(new String[remote.size()])); intent.putExtra(FileUploader.KEY_ACCOUNT, mAccount); startService(intent); + + //If the user has enabled last upload path then save the path to shared preferences + if(mSaveUploadLocation){ + SharedPreferences.Editor appPrefs = PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()).edit(); + appPrefs.putString("last_upload_path", mUploadPath); + appPrefs.apply(); + } + finish(); }