From: Magnus Sjoqvist Date: Wed, 8 Oct 2014 13:15:57 +0000 (+0200) Subject: Added feature for remembering last upload location when sharing a file. Also added... X-Git-Tag: oc-android-1.7.0_signed~119^2~2^2~11 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/ebe0f73068f8934742013b65ea0674f19ac82a2d?ds=inline;hp=--cc Added feature for remembering last upload location when sharing a file. Also added an option to turn it off in prefrences. --- ebe0f73068f8934742013b65ea0674f19ac82a2d diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index b21685e5..bbd3c4f1 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 ad usare %1$s sul tuo smartphone!\nScaricalo qui: %2$s\"\n\t Verifica server diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml index 8be33d92..10727c06 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 vill bjuda in dig att använda %1$s på din smartphone\nLadda ner här: %2$s\"\n\t Kontrollera Server diff --git a/res/values/strings.xml b/res/values/strings.xml index c1a1e2cb..cf4dffbd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -31,8 +31,11 @@ Recommend to a friend Feedback Imprint - - "Try %1$s on your smartphone!" + 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" @@ -269,5 +272,4 @@ 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 - diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 69b4b284..8aa945cf 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -31,6 +31,9 @@ + (); - mParents.add(""); + + + + + SharedPreferences appPreferences = PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()); + + mSaveUploadLocation = appPreferences.getBoolean("save_last_upload_location", false); + + if(mSaveUploadLocation) + { + String last_path = appPreferences.getString("last_upload_path", ""); + + if(last_path.equals("/")) { + mParents.add(""); + } + else{ + String[] dir_names = last_path.split("/"); + for (String dir : dir_names) + mParents.add(dir); + } + } + else { + mParents.add(""); + } + if (prepareStreamsToUpload()) { mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE); Account[] accounts = mAccountManager.getAccountsByType(MainApp.getAccountType()); @@ -289,6 +317,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro setContentView(R.layout.uploader_layout); String full_path = ""; + for (String a : mParents) full_path += a + "/"; @@ -408,6 +437,14 @@ 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(mSaveUploadLocation){ + SharedPreferences.Editor appPrefs = PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()).edit(); + appPrefs.putString("last_upload_path", mUploadPath); + appPrefs.commit(); + } + finish(); }