mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Added feature for remembering last upload location when sharing a file. Also added an option to turn it off in prefrences.
This commit is contained in:
parent
a03e7e48eb
commit
ebe0f73068
6 changed files with 72 additions and 6 deletions
|
@ -30,6 +30,8 @@
|
|||
<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>
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
<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>
|
||||
|
|
|
@ -31,8 +31,11 @@
|
|||
<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>
|
||||
|
||||
|
@ -269,5 +272,4 @@
|
|||
<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>
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
<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"
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.actionbarsherlock.view.MenuItem;
|
|||
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;
|
||||
|
||||
|
@ -53,6 +54,7 @@ public class Preferences extends SherlockPreferenceActivity {
|
|||
private static final String TAG = "OwnCloudPreferences";
|
||||
private DbHandler mDbHandler;
|
||||
private CheckBoxPreference pCode;
|
||||
private CheckBoxPreference pSaveLocation;
|
||||
//private CheckBoxPreference pLogging;
|
||||
//private Preference pLoggingHistory;
|
||||
private Preference pAboutApp;
|
||||
|
@ -95,8 +97,26 @@ public class Preferences extends SherlockPreferenceActivity {
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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");
|
||||
|
||||
|
|
|
@ -46,10 +46,12 @@ import android.content.DialogInterface;
|
|||
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;
|
||||
|
@ -80,6 +82,7 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
|
|||
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;
|
||||
|
@ -93,7 +96,32 @@ public class Uploader extends ListActivity implements OnItemClickListener, andro
|
|||
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());
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue