<string name="prefs_recommend">Consiglia ad un amico</string>
<string name="prefs_feedback">Segnalazioni</string>
<string name="prefs_imprint">Imprint</string>
+ <string name="prefs_remember_last_upload_location_summary">Salvare l\'ultimo percorso usata per l\'upload</string>
+ <string name="prefs_remember_last_share_location">Salva la posizione</string>
<string name="recommend_subject">Prova %1$s sul tuo smartphone!</string>
<string name="recommend_text">\"Vorrei invitarti ad usare %1$s sul tuo smartphone!\nScaricalo qui: %2$s\"\n\t</string>
<string name="auth_check_server">Verifica server</string>
<string name="prefs_recommend">Rekommendera till en vän</string>
<string name="prefs_feedback">Feedback</string>
<string name="prefs_imprint">Imprint</string>
+ <string name="prefs_remember_last_share_location">Kom ihåg uppladdningsplats</string>
+ <string name="prefs_remember_last_upload_location_summary">Kom ihåg senaste uppladdningsplatsen för delning</string>
<string name="recommend_subject">Försök %1$s på din smarttelefon!</string>
<string name="recommend_text">\"Jag vill bjuda in dig att använda %1$s på din smartphone\nLadda ner här: %2$s\"\n\t</string>
<string name="auth_check_server">Kontrollera Server</string>
<string name="prefs_recommend">Recommend to a friend</string>
<string name="prefs_feedback">Feedback</string>
<string name="prefs_imprint">Imprint</string>
-
- <string name="recommend_subject">"Try %1$s on your smartphone!"</string>
+ <string name="prefs_remember_last_share_location">Remember share location</string>
+ <string name="prefs_remember_last_upload_location_summary">Remember last share upload location</string>
+
+
+ <string name="recommend_subject">"Try %1$s on your smartphone!"</string>
<string name="recommend_text">"I want to invite you to use %1$s on your smartphone!\nDownload here: %2$s"
</string>
<string name="network_error_socket_timeout_exception">An error occurred while waiting for the server, the operation couldn\'t have been done</string>
<string name="network_error_connect_timeout_exception">An error occurred while waiting for the server, the operation couldn\'t have been done</string>
<string name="network_host_not_available">The operation couldn\'t be completed, server is unavailable</string>
-
</resources>
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
android:title="@string/prefs_instant_upload"
android:summary="@string/prefs_instant_upload_summary"/>
+ <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="save_last_upload_location"
+ android:title="@string/prefs_remember_last_share_location"
+ android:summary="@string/prefs_remember_last_upload_location_summary"/>
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:dependency="instant_uploading"
android:disableDependentsState="true"
android:title="@string/instant_upload_on_wifi"
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.db.DbHandler;
+import com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.Log_OC;
private static final String TAG = "OwnCloudPreferences";
private DbHandler mDbHandler;
private CheckBoxPreference pCode;
+ private CheckBoxPreference pSaveLocation;
//private CheckBoxPreference pLogging;
//private Preference pLoggingHistory;
private Preference pAboutApp;
});
}
-
-
+
+ pSaveLocation = (CheckBoxPreferenceWithLongTitle) findPreference("save_last_upload_location");
+ if(pSaveLocation != null){
+ pSaveLocation.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if( newValue instanceof Boolean)
+ {
+ if(!(Boolean) newValue)
+ {
+ SharedPreferences.Editor appPrefs = PreferenceManager
+ .getDefaultSharedPreferences(getApplicationContext()).edit();
+ appPrefs.remove("last_upload_path");
+ appPrefs.commit();
+ }
+ }
+ return true;
+ }
+ });
+ }
PreferenceCategory preferenceCategory = (PreferenceCategory) findPreference("more");
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
+import android.preference.PreferenceManager;
import android.provider.MediaStore.Audio;
import android.provider.MediaStore.Images;
import android.provider.MediaStore.Video;
private String mUploadPath;
private FileDataStorageManager mStorageManager;
private OCFile mFile;
+ private boolean mSaveUploadLocation;
private final static int DIALOG_NO_ACCOUNT = 0;
private final static int DIALOG_WAITING = 1;
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
mParents = new Stack<String>();
- 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());
setContentView(R.layout.uploader_layout);
String full_path = "";
+
for (String a : mParents)
full_path += a + "/";
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();
}