<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="recommend_text">Vorrei invitarti a usare %1$s sul tuo smartphone!\nScarica qui: %2$s</string>
<string name="auth_check_server">Verifica server</string>
<string name="auth_host_url">Indirizzo server https://...</string>
<string name="auth_username">Nome utente</string>
<string name="uploader_wrn_no_content_text">Non è stato ricevuto alcun contenuto. Niente da caricare.</string>
<string name="uploader_error_forbidden_content">%1$s non è abilitato ad accedere al contenuto condiviso</string>
<string name="uploader_info_uploading">Caricamento in corso</string>
- <string name="file_list_empty">Non ci sono file in questa cartella.\nNuovi file possono essere aggiunti con l\'opzione di menu \"Carica\".</string>
+ <string name="file_list_empty">Non c\'è niente qui. Carica qualcosa!</string>
+ <string name="file_list_loading">Caricamento in corso...</string>
+ <string name="local_file_list_empty">Non ci sono file in questa cartella.</string>
<string name="filedetails_select_file">Tocca un file per visualizzare informazioni aggiuntive.</string>
<string name="filedetails_size">Dimensione:</string>
<string name="filedetails_type">Tipo:</string>
<string name="sync_fail_in_favourites_content">I contenuti di %1$d file non possono essere sincronizzati (%2$d conflitti)</string>
<string name="sync_foreign_files_forgotten_ticker">Alcuni file locali sono stati trascurati</string>
<string name="sync_foreign_files_forgotten_content">%1$d file della cartella %2$s non possono essere copiati</string>
- <string name="sync_foreign_files_forgotten_explanation">Nella versione 1.3.16, i file caricati da questo dispositivo vengono copiati nella cartella locale %1$s per evitare la perdita dei dati quando un singolo file è sincronizzato con diversi account.\n\nA causa di questo cambiamento, tutti i file caricati nelle versioni precedenti di questa applicazione sono stati copiati nella cartella %2$s. Tuttavia, un errore non ha permesso il completamento di questa operazione durante la sincronizzazione dell\'account. Puoi, dunque, sia lasciare i file come sono e rimuovere il collegamento a %3$s, o spostare i file nella cartella %1$s e mantenere il collegamento a %4$s.\n\nIn basso sono elencati i file locali e i file remoti in %5$s ai quali sono collegati.</string>
+ <string name="sync_foreign_files_forgotten_explanation">Dalla versione 1.3.16, i file caricati da questo dispositivo sono copiati nella cartella locale %1$s per evitare perdite di dati in caso di sincronizzazione di un singolo file con più account.\n\nA causa di questa modifica, tutti i file caricati nelle versioni precedenti di questa applicazione sono copiati nella cartella %2$s. In ogni caso, un errore ha impedito il completamento di questa operazione durante la sincronizzazione dell\'account. Puoi mantenere i file intatti e rimuovere il collegamento a %3$s o spostare i file nella cartella %1$s e mantenere il collegamento a %4$s.\n\nQui sotto sono elencati i file locali e i file remoti in %5$s ai quali sono collegati.</string>
<string name="sync_current_folder_was_removed">La cartella %1$s non esiste più</string>
<string name="foreign_files_move">Sposta tutto</string>
<string name="foreign_files_success">Tutti i file sono stati spostati</string>
<string name="auth_connecting_auth_server">Connessione al server di autenticazione in corso...</string>
<string name="auth_unsupported_auth_method">Il server non supporta questo metodo di autenticazione</string>
<string name="auth_unsupported_multiaccount">%1$s non supporta account multipli</string>
- <string name="auth_fail_get_user_name">Il tuo server non ha restituito un id utente corretto, contatta un amministratore\n\t</string>
+ <string name="auth_fail_get_user_name">Il tuo server non ha restituito un id utente corretto, contatta un amministratore
+ </string>
<string name="auth_can_not_auth_against_server">Impossibile eseguire l\'autenticazione su questo server</string>
<string name="fd_keep_in_sync">Tieni aggiornato il file</string>
<string name="common_rename">Rinomina</string>
<string name="preview_image_description">Anteprima dell\'immagine</string>
<string name="preview_image_error_unknown_format">Questa immagine non può essere mostrata</string>
<string name="error__upload__local_file_not_copied">%1$s non può essere copiato nella cartella locale %2$s</string>
- <string name="actionbar_failed_instant_upload">Caricamento istantaneo non riuscito</string>
- <string name="failed_upload_headline_text">Caricamenti istantanei non riusciti</string>
- <string name="failed_upload_headline_hint">Riepilogo dei caricamenti istantanei non riusciti</string>
- <string name="failed_upload_all_cb">seleziona tutto</string>
- <string name="failed_upload_headline_retryall_btn">riprova tutti i selezionati</string>
- <string name="failed_upload_headline_delete_all_btn">elimina tutti i selezionati dalla coda di caricamento</string>
- <string name="failed_upload_retry_text">riprova a caricare l\'immagine:</string>
- <string name="failed_upload_load_more_images">Carica altre immagini</string>
- <string name="failed_upload_retry_do_nothing_text">non fare niente, non sei collegato per i caricamenti istantanei</string>
- <string name="failed_upload_failure_text">Messaggio d\'errore:</string>
- <string name="failed_upload_quota_exceeded_text">Controlla la configurazione del server, forse hai superato la tua quota.</string>
- <string name="share_link_no_support_share_api">Spiacenti, la condivisione non è abilitata sul tuo server. Contatta il tuo\n\t\tamministratore.</string>
- <string name="share_link_file_no_exist">Impossibile condividere il file o la cartella. Assicurati che esista.</string>
+ <string name="share_link_no_support_share_api">Spiacenti, la condivisione non è abilitata sul tuo server. Contatta il tuo
+ amministratore.</string>
+ <string name="share_link_file_no_exist">Impossibile condividere. Assicurati che il file esista</string>
<string name="share_link_file_error">Si è verificato un errore durante il tentativo di condivisione del file o della cartella</string>
- <string name="unshare_link_file_no_exist">Impossibile rimuovere dalla condivisione il file o la cartella. Non esiste.</string>
+ <string name="unshare_link_file_no_exist">Impossibile rimuovere dalla condivisione. Assicurati che il file esista</string>
<string name="unshare_link_file_error">Si è verificato un errore durante il tentativo di rimuovere la condivisione del file o della cartella</string>
<string name="activity_chooser_send_file_title">Invia</string>
<string name="copy_link">Copia collegamento</string>
<string name="network_error_socket_timeout_exception">Si è verificato un errore in attesa della risposta del server, l\'operazione non è stata completata</string>
<string name="network_error_connect_timeout_exception">Si è verificato un errore in attesa della risposta del server, l\'operazione non è stata completata</string>
<string name="network_host_not_available">L\'operazione non è stata completata, il server non è disponibile</string>
+ <string name="empty"></string>
+ <string name="forbidden_permissions">Non hai i permessi %s</string>
+ <string name="forbidden_permissions_rename">per rinominare questo file</string>
+ <string name="forbidden_permissions_delete">per eliminare questo file</string>
+ <string name="share_link_forbidden_permissions">per condividere questo file</string>
+ <string name="unshare_link_forbidden_permissions">per rimuovere la condivisione di questo file</string>
+ <string name="forbidden_permissions_create">per creare il file</string>
+ <string name="uploader_upload_forbidden_permissions">per caricare in questa cartella</string>
+ <string name="downloader_download_file_not_found">Il file non è più disponibile sul server</string>
+ <string name="prefs_category_accounts">Account</string>
+ <string name="prefs_add_account">Aggiungi account</string>
+ <string name="auth_redirect_non_secure_connection_title">La connessione sicura è rediretta attraverso un percorso non sicuro.</string>
+ <string name="actionbar_logger">Registri</string>
+ <string name="log_send_history_button">Invia cronologia</string>
+ <string name="log_mail_subject">Registri applicazione ownCloud Android</string>
+ <string name="log_progress_dialog_text">Caricamento dati...</string>
+ <string name="saml_authentication_required_text">Autenticazione richiesta</string>
+ <string name="saml_authentication_wrong_pass">Password errata</string>
+ <string name="actionbar_move">Sposta</string>
+ <string name="file_list_empty_moving">Qui non c\'è niente. Puoi aggiungere una cartella.</string>
+ <string name="move_choose_button_text">Scegli</string>
+ <string name="move_file_not_found">Impossibile spostare. Assicurati che il file esista</string>
+ <string name="move_file_invalid_into_descendent">Impossibile spostare una cartella in una cartella inferiore</string>
+ <string name="move_file_invalid_overwrite">Il file esiste già nella cartella di destinazione</string>
+ <string name="move_file_error">Si è verificato un errore durante il tentativo di spostare il file o la cartella</string>
+ <string name="forbidden_permissions_move">per spostare questo file</string>
</resources>
<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="recommend_text">Jag skulle vilja bjuda in dig till att använda %1$s på din smartphone!\nLadda ner här: %2$s</string>
<string name="auth_check_server">Kontrollera Server</string>
<string name="auth_host_url">Serveradress https://...</string>
<string name="auth_username">Användarnamn</string>
<string name="uploader_wrn_no_content_text">Inget innehåll mottaget. Inget att ladda upp.</string>
<string name="uploader_error_forbidden_content">%1$s har inte rättighet till det delade innehållet</string>
<string name="uploader_info_uploading">Laddar upp</string>
- <string name="file_list_empty">Det finns inga filer i denna mapp.\nNya filer kan läggas till med \"Ladda upp\" i menyn.</string>
+ <string name="file_list_empty">Ingenting här. Ladda upp något!</string>
+ <string name="file_list_loading">Laddar...</string>
+ <string name="local_file_list_empty">Det finns inga filer i den här mappen.</string>
<string name="filedetails_select_file">Peka på en fil för att visa mer information.</string>
<string name="filedetails_size">Storlek:</string>
<string name="filedetails_type">Typ:</string>
<string name="downloader_download_failed_credentials_error">Nerladda misslyckades, måste du logga in igen</string>
<string name="common_choose_account">Välj konto</string>
<string name="sync_fail_ticker">Synkroniseringen misslyckades</string>
+ <string name="sync_fail_ticker_unauthorized">Synkroniseringen misslyckades, du måste logga in på nytt.</string>
<string name="sync_fail_content">Synkronisering av %1$s kunde inte slutföras</string>
<string name="sync_fail_content_unauthorized">Felaktigt lösenord för %1$s</string>
<string name="sync_conflicts_in_favourites_ticker">Konflikter uppstod</string>
<string name="sync_fail_in_favourites_content">Innehållet i %1$d filer kunde inte synkas (%2$d konflikter)</string>
<string name="sync_foreign_files_forgotten_ticker">Vissa lokala filer glömdes</string>
<string name="sync_foreign_files_forgotten_content">%1$d filer från %2$s mappar kunde inte kopieras till</string>
- <string name="sync_foreign_files_forgotten_explanation">Från och med version 1.3.16, kopieras uppladdade filer från den här enheten till den lokala %1$s mappen för att förhindra förlust av data när en enda fil synkroniseras med flera konton.\n\nPå grund av denna förändring har alla filer som laddats upp i tidigare versioner av denna app kopierats till %2$s mappen. Men ett fel förhindrade slutförande av denna operation under synkronisering. Du kan antingen lämna fil(er) som det är och ta bort länken till %3$s, eller flytta fil(er) till %1$s mappen och behålla länken till %4$s.\n\nNedan listas dom lokala fil(er) och fjärrfil(er) i %5$s dom var länkade till.</string>
<string name="sync_current_folder_was_removed">Mappen %1$s existerar inte längre</string>
<string name="foreign_files_move">Flytta allt</string>
<string name="foreign_files_success">Alla filer flyttades</string>
<string name="auth_connecting_auth_server">Ansluter till autentiseringsservern...</string>
<string name="auth_unsupported_auth_method">Servern har inte stöd för denna autentiseringsmetod</string>
<string name="auth_unsupported_multiaccount">%1$s har inte stöd för multipla konton</string>
- <string name="auth_fail_get_user_name">Din server returnerar inte ett korrekt användare id, vänligen kontakta en administratör\n\t</string>
+ <string name="auth_fail_get_user_name">Din server returnerar inte ett korrekt användare id, vänligen kontakta en administratör
+ </string>
<string name="auth_can_not_auth_against_server">Kan inte autentisera mot servern</string>
<string name="fd_keep_in_sync">Håll filen uppdaterad</string>
<string name="common_rename">Byt namn</string>
<string name="preview_image_description">Förhandsvisa bild</string>
<string name="preview_image_error_unknown_format">Denna bild kan inte visas</string>
<string name="error__upload__local_file_not_copied">%1$s kunde inte kopieras till %2$s lokal mapp</string>
- <string name="actionbar_failed_instant_upload">Fel vid direktuppladdning\"</string>
- <string name="failed_upload_headline_text">Misslyckades vid direktuppladdning</string>
- <string name="failed_upload_headline_hint">Sammanfattning av alla misslyckade uppladdningar</string>
- <string name="failed_upload_all_cb">välj alla</string>
- <string name="failed_upload_headline_retryall_btn">försökt igen med alla valda</string>
- <string name="failed_upload_headline_delete_all_btn">radera alla valda från uppladdningskön</string>
- <string name="failed_upload_retry_text">försök igen att ladda upp bilden:</string>
- <string name="failed_upload_load_more_images">Ladda fler bilder</string>
- <string name="failed_upload_retry_do_nothing_text">Du är inte ansluten, direktuppladdning ej möjligt</string>
- <string name="failed_upload_failure_text">Felmeddelande:</string>
- <string name="failed_upload_quota_exceeded_text">Vänligen kontrollera dina serverkonfiguration. Din kvot kan ha överskridits.</string>
- <string name="share_link_no_support_share_api">Ledsen, delning är inte aktiverat på din server. Vänligen kontakta din\n\t\tadministratör.</string>
- <string name="share_link_file_no_exist">Kan inte dela denna fil eller mapp. Se till att den existerar</string>
+ <string name="share_link_no_support_share_api">Ledsen, delning är inte aktiverat på din server. Vänligen kontakta din
+ administratör.</string>
<string name="share_link_file_error">Ett fel uppstod vid försök att dela denna fil eller mapp</string>
- <string name="unshare_link_file_no_exist">Kan inte ta bort delningen för denna fil eller mapp. Den existerar inte.</string>
<string name="unshare_link_file_error">Ett fel uppstod vid försök att sluta dela denna fil eller mapp</string>
<string name="activity_chooser_send_file_title">Skicka</string>
<string name="copy_link">Kopiera länk</string>
<string name="network_error_socket_timeout_exception">Ett fel uppstod i väntan på servern, operationen kunde inte ha gjorts</string>
<string name="network_error_connect_timeout_exception">Ett fel uppstod i väntan på servern, operationen kunde inte ha gjorts</string>
<string name="network_host_not_available">Åtgärden kunte inte slutföras, servern är ej tillgänglig</string>
+ <string name="empty"></string>
+ <string name="forbidden_permissions">Du har inga rättigheter %s</string>
+ <string name="forbidden_permissions_rename">att döpa om denna fil</string>
+ <string name="forbidden_permissions_delete">att radera denna fil</string>
+ <string name="share_link_forbidden_permissions">att dela denna fil</string>
+ <string name="unshare_link_forbidden_permissions">att avbryta delningen utav denna fil</string>
+ <string name="forbidden_permissions_create">att skapa filen</string>
+ <string name="uploader_upload_forbidden_permissions">att ladda upp i den här mappen</string>
+ <string name="downloader_download_file_not_found">Filen är inte längre tillgänglig på servern</string>
+ <string name="prefs_category_accounts">Konton</string>
+ <string name="prefs_add_account">Lägg till konto</string>
+ <string name="log_progress_dialog_text">Laddar data...</string>
+ <string name="saml_authentication_required_text">Autentisering krävs</string>
+ <string name="saml_authentication_wrong_pass">Fel lösenord</string>
+ <string name="actionbar_move">Flytta</string>
+ <string name="file_list_empty_moving">Ingenting här. Du kan skapa en mapp!</string>
+ <string name="move_choose_button_text">Välj</string>
+ <string name="move_file_not_found">Gick inte att flytta. Vänligen kontrollera att filen existerar</string>
+ <string name="forbidden_permissions_move">att flytta den här filen</string>
</resources>
<string name="prefs_recommend">Recommend to a friend</string>
<string name="prefs_feedback">Feedback</string>
<string name="prefs_imprint">Imprint</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="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="auth_check_server">Check Server</string>
<string name="auth_host_url">Server address https://…</string>
<string name="uploader_wrn_no_content_text">No content was received. Nothing to upload.</string>
<string name="uploader_error_forbidden_content">%1$s is not allowed to access the shared content</string>
<string name="uploader_info_uploading">Uploading</string>
- <string name="file_list_empty">There are no files in this folder.\nNew files can be added with the \"Upload\" menu option.</string>
+ <string name="file_list_empty">Nothing in here. Upload something!</string>
+ <string name="file_list_loading">Loading...</string>
+ <string name="local_file_list_empty">There are no files in this folder.</string>
<string name="filedetails_select_file">Tap on a file to display additional information.</string>
<string name="filedetails_size">Size:</string>
<string name="filedetails_type">Type:</string>
<string name="share_link_no_support_share_api">Sorry, sharing is not enabled on your server. Please contact your
administrator.</string>
- <string name="share_link_file_no_exist">Unable to share this file or folder. Please, make sure it exists</string>
+ <string name="share_link_file_no_exist">Unable to share. Please check whether the file exists</string>
<string name="share_link_file_error">An error occurred while trying to share this file or folder</string>
- <string name="unshare_link_file_no_exist">Unable to unshare this file or folder. It does not exist.</string>
+ <string name="unshare_link_file_no_exist">Unable to unshare. Please check whether the file exists</string>
<string name="unshare_link_file_error">An error occurred while trying to unshare this file or folder</string>
<string name="activity_chooser_send_file_title">Send</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>
-
++
+ <string name="empty"></string>
+
+ <string name="forbidden_permissions">You do not have permission %s</string>
+ <string name="forbidden_permissions_rename">to rename this file</string>
+ <string name="forbidden_permissions_delete">to delete this file</string>
+ <string name="share_link_forbidden_permissions">to share this file</string>
+ <string name="unshare_link_forbidden_permissions">to unshare this file</string>
+ <string name="forbidden_permissions_create">to create the file</string>
+ <string name="uploader_upload_forbidden_permissions">to upload in this folder</string>
+ <string name="downloader_download_file_not_found">The file is no longer available on the server</string>
+
+ <string name="prefs_category_accounts">Accounts</string>
+ <string name="prefs_add_account">Add account</string>
+ <string name="auth_redirect_non_secure_connection_title">Secure connection is redirected through an unsecured route.</string>
+
+ <string name="actionbar_logger">Logs</string>
+ <string name="log_send_history_button">Send History</string>
+ <string name="log_mail_subject">ownCloud Android app logs</string>
+ <string name="log_progress_dialog_text">Loading data...</string>
+
+ <string name="saml_authentication_required_text">Authentication required</string>
+ <string name="saml_authentication_wrong_pass">Wrong password</string>
+ <string name="actionbar_move">Move</string>
+ <string name="file_list_empty_moving">Nothing in here. You can add a folder!</string>
+ <string name="move_choose_button_text">Choose</string>
+
+ <string name="move_file_not_found">Unable to move. Please check whether the file exists</string>
+ <string name="move_file_invalid_into_descendent">It is not possible to move a folder into a descendant</string>
+ <string name="move_file_invalid_overwrite">The file exists already in the destination folder</string>
+ <string name="move_file_error">An error occurred while trying to move this file or folder</string>
+ <string name="forbidden_permissions_move">to move this file</string>
</resources>
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
- <PreferenceCategory android:title="@string/prefs_category_general">
+ <PreferenceCategory android:title="@string/prefs_category_accounts" android:key="accounts_category">
+ </PreferenceCategory>
+ <PreferenceCategory android:title="@string/prefs_category_general">
<!-- ListPreference
android:key="select_oc_account"
android:title="@string/prefs_select_oc_account"
android:summary="@string/prefs_summary_select_oc_account"
/ -->
- <com.owncloud.android.ui.PreferenceMultiline android:title="@string/prefs_manage_accounts" android:key="manage_account" />
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:title="@string/prefs_pincode" android:key="set_pincode"
android:summary="@string/prefs_pincode_summary"/>
<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"
package com.owncloud.android.ui.activity;
import android.accounts.Account;
+ import android.accounts.AccountManager;
+ import android.accounts.AccountManagerCallback;
+ import android.accounts.AccountManagerFuture;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
+ import android.os.Handler;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
+ import android.view.ContextMenu;
+ import android.view.ContextMenu.ContextMenuInfo;
+ import android.view.View;
+ import android.widget.AdapterView;
+ import android.widget.AdapterView.OnItemLongClickListener;
+ import android.widget.ListAdapter;
+ import android.widget.ListView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
+ import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
+ import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.db.DbHandler;
+import com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle;
+ import com.owncloud.android.lib.common.utils.Log_OC;
+ import com.owncloud.android.ui.LongClickableCheckBoxPreference;
import com.owncloud.android.utils.DisplayUtils;
- import com.owncloud.android.utils.Log_OC;
/**
* @author Bartek Przybylski
* @author David A. Velasco
*/
- public class Preferences extends SherlockPreferenceActivity {
+ public class Preferences extends SherlockPreferenceActivity implements AccountManagerCallback<Boolean> {
private static final String TAG = "OwnCloudPreferences";
+
private DbHandler mDbHandler;
private CheckBoxPreference pCode;
- //private CheckBoxPreference pLogging;
- //private Preference pLoggingHistory;
+ private CheckBoxPreference pSaveLocation;
private Preference pAboutApp;
+ private PreferenceCategory mAccountsPrefCategory = null;
+ private final Handler mHandler = new Handler();
+ private String mAccountName;
+ private boolean mShowContextMenu = false;
+
@SuppressWarnings("deprecation")
@Override
super.onCreate(savedInstanceState);
mDbHandler = new DbHandler(getBaseContext());
addPreferencesFromResource(R.xml.preferences);
- //populateAccountList();
+
ActionBar actionBar = getSherlock().getActionBar();
actionBar.setIcon(DisplayUtils.getSeasonalIconId());
actionBar.setDisplayHomeAsUpEnabled(true);
+ actionBar.setTitle(R.string.actionbar_settings);
- Preference p = findPreference("manage_account");
- if (p != null)
- p.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ // Load the accounts category for adding the list of accounts
+ mAccountsPrefCategory = (PreferenceCategory) findPreference("accounts_category");
+
+ ListView listView = getListView();
+ listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
- public boolean onPreferenceClick(Preference preference) {
- Intent i = new Intent(getApplicationContext(), AccountSelectActivity.class);
- startActivity(i);
- return true;
+ public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
+ ListView listView = (ListView) parent;
+ ListAdapter listAdapter = listView.getAdapter();
+ Object obj = listAdapter.getItem(position);
+
+ if (obj != null && obj instanceof LongClickableCheckBoxPreference) {
+ mShowContextMenu = true;
+ mAccountName = obj.toString();
+
+ Preferences.this.openContextMenu(listView);
+
+ View.OnLongClickListener longListener = (View.OnLongClickListener) obj;
+ return longListener.onLongClick(view);
+ }
+ return false;
}
});
-
+
+ // Register context menu for list of preferences.
+ registerForContextMenu(getListView());
+
pCode = (CheckBoxPreference) findPreference("set_pincode");
if (pCode != null){
pCode.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
}
- appPrefs.apply();
+ pSaveLocation = (CheckBoxPreferenceWithLongTitle) findPreference("save_last_upload_location");
+ if(pSaveLocation != null){
+ pSaveLocation.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ //The saved path is removed when the preference is turned off
+ if( newValue instanceof Boolean && !(Boolean) newValue) {
+ SharedPreferences.Editor appPrefs = PreferenceManager
+ .getDefaultSharedPreferences(getApplicationContext()).edit();
+ appPrefs.remove("last_upload_path");
++ appPrefs.commit();
+ }
+ return true;
+ }
+ });
+ }
+
++
PreferenceCategory preferenceCategory = (PreferenceCategory) findPreference("more");
boolean helpEnabled = getResources().getBoolean(R.bool.help_enabled);
Log_OC.e(TAG, "Error while showing about dialog", e);
}
}
-
- /* DISABLED FOR RELEASE UNTIL FIXED
- pLogging = (CheckBoxPreference) findPreference("log_to_file");
- if (pLogging != null) {
- pLogging.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
-
- String logpath = Environment.getExternalStorageDirectory()+File.separator+"owncloud"+File.separator+"log";
-
- if(!pLogging.isChecked()) {
- Log_OC.d("Debug", "start logging");
- Log_OC.v("PATH", logpath);
- Log_OC.startLogging(logpath);
- }
- else {
- Log_OC.d("Debug", "stop logging");
- Log_OC.stopLogging();
- }
- return true;
- }
- });
- }
-
- pLoggingHistory = (Preference) findPreference("log_history");
- if (pLoggingHistory != null) {
- pLoggingHistory.setOnPreferenceClickListener(new OnPreferenceClickListener() {
-
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Intent intent = new Intent(getApplicationContext(),LogHistoryActivity.class);
- startActivity(intent);
- return true;
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
+
+ // Filter for only showing contextual menu when long press on the
+ // accounts
+ if (mShowContextMenu) {
+ getMenuInflater().inflate(R.menu.account_picker_long_click, menu);
+ mShowContextMenu = false;
+ }
+ super.onCreateContextMenu(menu, v, menuInfo);
+ }
+
+ /**
+ * Called when the user clicked on an item into the context menu created at
+ * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} for
+ * every ownCloud {@link Account} , containing 'secondary actions' for them.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onContextItemSelected(android.view.MenuItem item) {
+ AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
+ Account accounts[] = am.getAccountsByType(MainApp.getAccountType());
+ for (Account a : accounts) {
+ if (a.name.equals(mAccountName)) {
+ if (item.getItemId() == R.id.change_password) {
+
+ // Change account password
+ Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
+ updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, a);
+ updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION,
+ AuthenticatorActivity.ACTION_UPDATE_TOKEN);
+ startActivity(updateAccountCredentials);
+
+ } else if (item.getItemId() == R.id.delete_account) {
+
+ // Remove account
+ am.removeAccount(a, this, mHandler);
+ }
}
- });
- }
- */
-
+ }
+
+ return true;
+ }
+
+ @Override
+ public void run(AccountManagerFuture<Boolean> future) {
+ if (future.isDone()) {
+ Account a = AccountUtils.getCurrentOwnCloudAccount(this);
+ String accountName = "";
+ if (a == null) {
+ Account[] accounts = AccountManager.get(this).getAccountsByType(MainApp.getAccountType());
+ if (accounts.length != 0)
+ accountName = accounts[0].name;
+ AccountUtils.setCurrentOwnCloudAccount(this, accountName);
+ }
+ addAccountsCheckboxPreferences();
+ }
}
@Override
SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
boolean state = appPrefs.getBoolean("set_pincode", false);
pCode.setChecked(state);
+
+ // Populate the accounts category with the list of accounts
+ addAccountsCheckboxPreferences();
}
@Override
mDbHandler.close();
super.onDestroy();
}
-
+
+ /**
+ * Create the list of accounts that has been added into the app
+ */
+ @SuppressWarnings("deprecation")
+ private void addAccountsCheckboxPreferences() {
+
+ // Remove accounts in case list is refreshing for avoiding to have
+ // duplicate items
+ if (mAccountsPrefCategory.getPreferenceCount() > 0) {
+ mAccountsPrefCategory.removeAll();
+ }
+
+ AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
+ Account accounts[] = am.getAccountsByType(MainApp.getAccountType());
+ Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
+
+ if (am.getAccountsByType(MainApp.getAccountType()).length == 0) {
+ // Show create account screen if there isn't any account
+ am.addAccount(MainApp.getAccountType(), null, null, null, this,
+ null,
+ null);
+ }
+ else {
+
+ for (Account a : accounts) {
+ LongClickableCheckBoxPreference accountPreference = new LongClickableCheckBoxPreference(this);
+ accountPreference.setKey(a.name);
+ accountPreference.setTitle(a.name);
+ mAccountsPrefCategory.addPreference(accountPreference);
+
+ // Check the current account that is being used
+ if (a.name.equals(currentAccount.name)) {
+ accountPreference.setChecked(true);
+ } else {
+ accountPreference.setChecked(false);
+ }
+
+ accountPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ String key = preference.getKey();
+ AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
+ Account accounts[] = am.getAccountsByType(MainApp.getAccountType());
+ for (Account a : accounts) {
+ CheckBoxPreference p = (CheckBoxPreference) findPreference(a.name);
+ if (key.equals(a.name)) {
+ boolean accountChanged = !p.isChecked();
+ p.setChecked(true);
+ AccountUtils.setCurrentOwnCloudAccount(
+ getApplicationContext(),
+ a.name
+ );
+ if (accountChanged) {
+ // restart the main activity
+ Intent i = new Intent(
+ Preferences.this,
+ FileDisplayActivity.class
+ );
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ } else {
+ finish();
+ }
+ } else {
+ p.setChecked(false);
+ }
+ }
+ return (Boolean) newValue;
+ }
+ });
+
+ }
+
+ // Add Create Account preference at the end of account list if
+ // Multiaccount is enabled
+ if (getResources().getBoolean(R.bool.multiaccount_support)) {
+ createAddAccountPreference();
+ }
+
+ }
+ }
+
+ /**
+ * Create the preference for allow adding new accounts
+ */
+ private void createAddAccountPreference() {
+ Preference addAccountPref = new Preference(this);
+ addAccountPref.setKey("add_account");
+ addAccountPref.setTitle(getString(R.string.prefs_add_account));
+ mAccountsPrefCategory.addPreference(addAccountPref);
+
+ addAccountPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ AccountManager am = AccountManager.get(getApplicationContext());
+ am.addAccount(MainApp.getAccountType(), null, null, null, Preferences.this, null, null);
+ return true;
+ }
+ });
+
+ }
+
}
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileUploader;
- import com.owncloud.android.utils.Log_OC;
+ import com.owncloud.android.lib.common.utils.Log_OC;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
-import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Context;
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;
import android.view.View;
-import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.SimpleAdapter;
import android.widget.Toast;
+import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.app.SherlockListActivity;
+import com.owncloud.android.MainApp;
+import com.owncloud.android.R;
+import com.owncloud.android.authentication.AccountAuthenticator;
+import com.owncloud.android.datamodel.FileDataStorageManager;
+import com.owncloud.android.datamodel.OCFile;
+import com.owncloud.android.files.services.FileUploader;
+import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.Log_OC;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+import java.util.Vector;
+
/**
* This can be used to upload things to an ownCloud instance.
* @author Bartek Przybylski
*
*/
-public class Uploader extends ListActivity implements OnItemClickListener, android.view.View.OnClickListener {
+public class Uploader extends SherlockListActivity implements OnItemClickListener, android.view.View.OnClickListener {
private static final String TAG = "ownCloudUploader";
private Account mAccount;
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;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- getWindow().requestFeature(Window.FEATURE_NO_TITLE);
mParents = new Stack<String>();
- mParents.add("");
+
+ ActionBar actionBar = getSherlock().getActionBar();
+ actionBar.setIcon(DisplayUtils.getSeasonalIconId());
+
if (prepareStreamsToUpload()) {
mAccountManager = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
Account[] accounts = mAccountManager.getAccountsByType(MainApp.getAccountType());
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 {
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<OCFile> files = mStorageManager.getFolderContent(mFile);
}
}
+ private String generatePath(Stack<String> 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<Parcelable>();
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();
}