<string name="prefs_recommend">Recommander à un ami</string>
<string name="prefs_feedback">Commentaires</string>
<string name="prefs_imprint">Empreinte</string>
- <string name="recommend_subject">Essayez %1$s sur votre smartphone !</string>
+ <string name="prefs_remember_last_share_location">Mémoriser l\'emplacement de partage</string>
+ <string name="prefs_remember_last_upload_location_summary">Mémoriser le dernier emplacement d\'upload</string>
+ <string name="recommend_subject">Essayez %1$s sur votre smartphone&nbsp;!</string>
- <string name="recommend_text">J'aimerais vous inviter à utiliser %1$s sur votre smartphone !
+ <string name="recommend_text">J\'aimerais vous inviter à utiliser %1$s sur votre smartphone !
- Téléchargez-le ici : %2$s</string>
+ Téléchargez-le ici&nbsp;: %2$s</string>
<string name="auth_check_server">Vérifier le serveur</string>
- <string name="auth_host_url">Adresse du serveur https://...</string>
+ <string name="auth_host_url">Adresse du serveur https://…</string>
<string name="auth_username">Nom d\'utilisateur</string>
<string name="auth_password">Mot de passe</string>
- <string name="auth_register">Nouveau dans %1$s ?</string>
+ <string name="auth_register">Nouveau dans %1$s&nbsp;?</string>
<string name="sync_string_files">Fichiers</string>
<string name="setup_btn_connect">Connecter</string>
<string name="uploader_btn_upload_text">Téléverser</string>
- <string name="uploader_top_message">Sélectionner le dossier d\'envoi :</string>
- <string name="uploader_top_message">Sélectionner le dossier d'envoi&nbsp;:</string>
++ <string name="uploader_top_message">Sélectionner le dossier d\'envoi&nbsp;:</string>
<string name="uploader_wrn_no_account_title">Aucun compte n\'a été trouvé</string>
<string name="uploader_wrn_no_account_text">Aucun compte %1$s n\'a été trouvé. Veuillez commencer par en configurer un.</string>
<string name="uploader_wrn_no_account_setup_btn_text">Paramètres</string>
<string name="uploader_wrn_no_content_text">Aucun contenu reçu. Rien à envoyer.</string>
<string name="uploader_error_forbidden_content">%1$s n\'est pas autorisé à accéder au contenu partagé</string>
<string name="uploader_info_uploading">Téléversement</string>
- <string name="file_list_empty">Il n\'y a rien ici ! Envoyez donc quelque chose :)</string>
+ <string name="file_list_seconds_ago">il y a quelques secondes</string>
- <string name="file_list_empty">Il n'y a rien ici&nbsp;! Envoyez donc quelque chose :)</string>
++ <string name="file_list_empty">Il n\'y a rien ici&nbsp;! Envoyez donc quelque chose :)</string>
<string name="file_list_loading">Chargement…</string>
<string name="local_file_list_empty">Aucun fichier n\'est présent dans ce dossier.</string>
<string name="filedetails_select_file">Effleurez un fichier pour afficher les informations complémentaires</string>
<string name="common_cancel">Annuler</string>
<string name="common_save_exit">Sauvegarder & Quitter</string>
<string name="common_error">Erreur</string>
- <string name="common_loading">Chargement ...</string>
- <string name="common_error_unknown">Erreur Inconnue </string>
+ <string name="common_loading">Chargement…</string>
+ <string name="common_error_unknown">Erreur inconnue </string>
<string name="about_title">À propos de</string>
<string name="change_password">Changer de mot de passe</string>
<string name="delete_account">Effacer ce compte</string>
<string name="upload_chooser_title">Téléverser un fichier depuis…</string>
<string name="uploader_info_dirname">Nom du dossier</string>
<string name="uploader_upload_in_progress_ticker">Téléversement…</string>
- <string name="uploader_upload_in_progress_content">Envoi du fichier %2$s en cours, %1$d%% effectués</string>
+ <string name="uploader_upload_in_progress_content">Envoi du fichier %2$s : %1$d%% effectués</string>
<string name="uploader_upload_succeeded_ticker">Téléversement réussi</string>
<string name="uploader_upload_succeeded_content_single">Le fichier %1$s a été envoyé avec succès</string>
<string name="uploader_upload_failed_ticker">Échec de l\'envoi</string>
<string name="sync_conflicts_in_favourites_ticker">Des conflits ont été trouvés</string>
<string name="sync_conflicts_in_favourites_content">%1$d fichiers à garder synchronisés n\'ont put être synchronisé</string>
<string name="sync_fail_in_favourites_ticker">La synchronisation des fichiers a échoué</string>
- <string name="sync_fail_in_favourites_content">Le contenu de %1$d fichiers n\'a put être synchronisé (%2$d conflits)</string>
+ <string name="sync_fail_in_favourites_content">Le contenu de %1$d fichiers n\'a pu être synchronisé (%2$d conflits)</string>
<string name="sync_foreign_files_forgotten_ticker">Certains fichiers locaux ont été oubliés</string>
<string name="sync_foreign_files_forgotten_content">%1$d fichiers du dossier %2$s n\'ont pas pu être copiés dans</string>
<string name="sync_foreign_files_forgotten_explanation">Depuis la version 1.3.16, les fichiers envoyé depuis ce périphérique sont copiés dans le dossier local %1$s pour éviter une perte de données lorsqu\'un même fichier est synchronisé avec plusieurs comptes.
<string name="foreign_files_move">Tout déplacer</string>
<string name="foreign_files_success">Tous les fichiers ont été déplacés</string>
<string name="foreign_files_fail">Certains fichiers n\'ont pu être déplacés</string>
- <string name="foreign_files_local_text">Local: %1$s</string>
- <string name="foreign_files_remote_text">Distant: %1$s</string>
+ <string name="foreign_files_local_text">Local&nbsp;: %1$s</string>
+ <string name="foreign_files_remote_text">Distant : %1$s</string>
<string name="upload_query_move_foreign_files">Il n\'y a pas assez de place disponible pour copier les fichiers sélectionnés dans le dossier %1$s. Voulez-vous quand même les déplacer ?</string>
<string name="pincode_enter_pin_code">Veuillez saisir votre code de sécurité</string>
<string name="pincode_configure_your_pin">Veuillez saisir votre code de sécurité </string>
<string name="media_err_nothing_to_play">Fichier média introuvable </string>
<string name="media_err_no_account">Aucun compte n\'a été trouvé</string>
<string name="media_err_not_in_owncloud">Le fichier n\'est pas dans un compte valide</string>
- <string name="media_err_unsupported">Le codec de ce média n\'est pas supporté </string>
+ <string name="media_err_unsupported">Le codec de ce média n\'est pas pris en charge </string>
<string name="media_err_io">Le fichier média ne peut pas être lu</string>
<string name="media_err_malformed">Le fichier média n\'est pas correctement encodé</string>
<string name="media_err_timeout">Délai dépassé pour la lecture du morceau.</string>
<string name="media_err_invalid_progressive_playback">Le fichier média ne peut pas être diffusé</string>
- <string name="media_err_unknown">Fichier média ne peut être joué avec le stock de media player</string>
- <string name="media_err_security_ex">taux %1$s erreurs de sécurité essayant de jouer</string>
- <string name="media_err_io_ex">Taux %1$s d\'erreurs de saisie essayant de jouer</string>
- <string name="media_err_unexpected">Taux %1$s d\'erreurs inattendues essayant de jouer</string>
- <string name="media_rewind_description">Bouton de rem-bobinage</string>
- <string name="media_play_pause_description">Bouton de Lecture ou de Pause</string>
+ <string name="media_err_unknown">Le fichier média ne peut être joué avec le lecteur standard</string>
+ <string name="media_err_security_ex">Erreur de sécurité à la lecture de %1$s</string>
+ <string name="media_err_io_ex">Erreur de lecture de fichier à la lecture de %1$s</string>
+ <string name="media_err_unexpected">Erreur inattendue à la lecture de %1$s </string>
+ <string name="media_rewind_description">Bouton de rembobinage</string>
+ <string name="media_play_pause_description">Bouton de lecture ou de pause</string>
<string name="media_forward_description">Bouton d\'avance rapide</string>
- <string name="auth_getting_authorization">Demande d\'autorisation...</string>
- <string name="auth_trying_to_login">Tentative de connexion …</string>
+ <string name="auth_getting_authorization">Demande d\'autorisation…</string>
+ <string name="auth_trying_to_login">Tentative de connexion…</string>
<string name="auth_no_net_conn_title">Pas de connexion réseau</string>
<string name="auth_nossl_plain_ok_title">Connexion sécurisée non disponible</string>
<string name="auth_connection_established">Connexion établie</string>
<string name="auth_timeout_title">Le serveur met trop longtemps à répondre</string>
<string name="auth_incorrect_address_title">Adresse invalide</string>
<string name="auth_ssl_general_error_title">Échec de l\'initialisation SSL</string>
- <string name="auth_ssl_unverified_server_title">Impossible de vérifier l\'identité du serveur SSL.</string>
+ <string name="auth_ssl_unverified_server_title">Impossible de vérifier l\'identité du serveur SSL</string>
<string name="auth_bad_oc_version_title">La version du serveur n\'est pas reconnue</string>
<string name="auth_wrong_connection_title">Impossible d\'établir la connexion</string>
<string name="auth_secure_connection">Connexion sécurisée établie</string>
<string name="auth_unauthorized">Nom d\'utilisateur ou mot de passe incorrect</string>
<string name="auth_oauth_error">Échec d\'autorisation</string>
<string name="auth_oauth_error_access_denied">Accès refusé par le serveur d\'autorisation</string>
- <string name="auth_wtf_reenter_URL">État inattendu ; veuillez entrer à nouveau l\'URL du serveur</string>
- <string name="auth_wtf_reenter_URL">État inattendu&nbsp;; veuillez entrer à nouveau l'URL du serveur</string>
++ <string name="auth_wtf_reenter_URL">État inattendu&nbsp;; veuillez entrer à nouveau l\'URL du serveur</string>
<string name="auth_expired_oauth_token_toast">Votre autorisation a expiré. Merci de vous authentifier à nouveau</string>
<string name="auth_expired_basic_auth_toast">Veuillez saisir le mot de passe courant</string>
<string name="auth_expired_saml_sso_token_toast">Votre session a expiré. Merci de vous reconnecter</string>
- <string name="auth_connecting_auth_server">Connexion au serveur d\'authentification...</string>
- <string name="auth_unsupported_auth_method">Le serveur ne supporte pas cette méthode d\'authentification</string>
- <string name="auth_unsupported_multiaccount">%1$s ne supporte pas les comptes multiples</string>
+ <string name="auth_connecting_auth_server">Connexion au serveur d\'authentification…</string>
+ <string name="auth_unsupported_auth_method">Le serveur ne prend pas en charge pas cette méthode d\'authentification</string>
+ <string name="auth_unsupported_multiaccount">%1$s ne prend pas en charge les comptes multiples</string>
<string name="auth_fail_get_user_name">Votre serveur a retourné un identifiant d\'utilisateur incorrect. Veuillez prendre contact avec votre administrateur
</string>
<string name="auth_can_not_auth_against_server">Impossible de s\'authentifier sur ce serveur</string>
<string name="fd_keep_in_sync">Maintenir le fichier à jour</string>
<string name="common_rename">Renommer</string>
<string name="common_remove">Supprimer</string>
- <string name="confirmation_remove_alert">Voulez-vous vraiment supprimer %1$s ?</string>
- <string name="confirmation_remove_folder_alert">Voulez-vous vraiment supprimer %1$s et son contenu ?</string>
+ <string name="confirmation_remove_alert">Voulez-vous vraiment supprimer %1$s&nbsp;?</string>
+ <string name="confirmation_remove_folder_alert">Voulez-vous vraiment supprimer %1$s et son contenu&nbsp;?</string>
<string name="confirmation_remove_local">Local seulement</string>
<string name="confirmation_remove_folder_local">Le contenu local uniquement</string>
<string name="confirmation_remove_remote">Effacer du serveur</string>
<string name="sync_file_fail_msg">Le fichier distant n\'a pu être vérifié</string>
<string name="sync_file_nothing_to_do_msg">Le contenu des fichiers est déjà synchronisé</string>
<string name="create_dir_fail_msg">Le dossier n\'a pas pu être créé</string>
- <string name="filename_forbidden_characters">Caractères interdits : / \\ < > : \" | ? *</string>
+ <string name="filename_forbidden_characters">Caractères interdits&nbsp;: / \\ &lt; &gt; : " | ? *</string>
<string name="filename_empty">Le nom du fichier ne peut pas être vide</string>
<string name="wait_a_moment">Veuillez patienter</string>
- <string name="filedisplay_unexpected_bad_get_content">Problème inattendu ; veuillez essayer une autre app pour la sélection du fichier</string>
+ <string name="filedisplay_unexpected_bad_get_content">Problème inattendu. Veuillez essayer une autre application pour la sélection du fichier</string>
<string name="filedisplay_no_file_selected">Aucun fichier sélectionné</string>
<string name="activity_chooser_title">Envoyer un lien à…</string>
- <string name="oauth_check_onoff">Connexion avec aAuth2.</string>
- <string name="oauth_login_connection">Connexion au serveur aAuth2...</string>
+ <string name="oauth_check_onoff">Connexion avec oAuth2</string>
+ <string name="oauth_login_connection">Connexion au serveur oAuth2…</string>
<string name="ssl_validator_header">L\'identité du site ne peut être vérifiée</string>
<string name="ssl_validator_reason_cert_not_trusted">- Le certificat du serveur n\'est pas sûr</string>
<string name="ssl_validator_reason_cert_expired">- Le certificat du serveur a expiré</string>
<string name="ssl_validator_reason_cert_not_yet_valid">- Le certificat du serveur n\'est pas encore valide</string>
<string name="ssl_validator_reason_hostname_not_verified">- L\'URL ne correspond pas au nom d\'hôte du certificat</string>
- <string name="ssl_validator_question">Voulez-vous tout de même faire confiance à ce certificat ?</string>
+ <string name="ssl_validator_question">Voulez-vous tout de même faire confiance à ce certificat&nbsp;?</string>
<string name="ssl_validator_not_saved">Impossible de sauvegarder le certificat</string>
<string name="ssl_validator_btn_details_see">Détails</string>
<string name="ssl_validator_btn_details_hide">Masquer</string>
- <string name="ssl_validator_label_subject">Délivré à :</string>
- <string name="ssl_validator_label_issuer">Délivré par :</string>
- <string name="ssl_validator_label_CN">Nom d\'usage :</string>
- <string name="ssl_validator_label_O">Organisation :</string>
- <string name="ssl_validator_label_OU">Unité organisationnelle :</string>
- <string name="ssl_validator_label_C">Pays :</string>
- <string name="ssl_validator_label_ST">Région :</string>
- <string name="ssl_validator_label_L">Localisation :</string>
- <string name="ssl_validator_label_validity">Validité :</string>
- <string name="ssl_validator_label_validity_from">De :</string>
- <string name="ssl_validator_label_validity_to">À :</string>
- <string name="ssl_validator_label_signature">Signature :</string>
- <string name="ssl_validator_label_signature_algorithm">Algorithme :</string>
+ <string name="ssl_validator_label_subject">Délivré à&nbsp;:</string>
+ <string name="ssl_validator_label_issuer">Délivré par&nbsp;:</string>
- <string name="ssl_validator_label_CN">Nom d'usage&nbsp;:</string>
++ <string name="ssl_validator_label_CN">Nom d\'usage&nbsp;:</string>
+ <string name="ssl_validator_label_O">Organisation&nbsp;:</string>
+ <string name="ssl_validator_label_OU">Unité organisationnelle&nbsp;:</string>
+ <string name="ssl_validator_label_C">Pays&nbsp;:</string>
+ <string name="ssl_validator_label_ST">Région&nbsp;:</string>
+ <string name="ssl_validator_label_L">Localisation&nbsp;:</string>
+ <string name="ssl_validator_label_validity">Validité&nbsp;:</string>
+ <string name="ssl_validator_label_validity_from">De&nbsp;:</string>
+ <string name="ssl_validator_label_validity_to">À&nbsp;:</string>
+ <string name="ssl_validator_label_signature">Signature&nbsp;:</string>
+ <string name="ssl_validator_label_signature_algorithm">Algorithme&nbsp;:</string>
<string name="ssl_validator_null_cert">Impossible d\'afficher le certificat.</string>
<string name="ssl_validator_no_info_about_error">- Aucune information sur l\'erreur</string>
<string name="placeholder_sentence">Ceci est un espace réservé</string>
<string name="preview_image_error_unknown_format">Cette image ne peut pas être affichée</string>
<string name="error__upload__local_file_not_copied">%1$s n\'a pas pu être copié dans le dossier local %2$s</string>
<string name="prefs_instant_upload_path_title">Chemin d\'accès pour le téléversement</string>
- <string name="share_link_no_support_share_api">Désolé, le partage n\'est pas disponible sur votre serveur. Contactez votre administrateur, s\'il vous plait.</string>
+ <string name="share_link_no_support_share_api">Désolé, le partage n\'est pas disponible sur votre serveur. Veuillez contacter votre administrateur.</string>
<string name="share_link_file_no_exist">Impossible de partager. Vérifiez que le fichier est bien présent</string>
<string name="share_link_file_error">Une erreur est survenue lors de la tentative de partage de ce fichier ou répertoire</string>
<string name="unshare_link_file_no_exist">Impossible de supprimer le partage. Vérifiez que le fichier est bien présent</string>
<string name="activity_chooser_send_file_title">Envoyer</string>
<string name="copy_link">Copier le lien</string>
<string name="clipboard_text_copied">Copié dans le presse-papiers</string>
- <string name="error_cant_bind_to_operations_service">Erreur critique : impossible de réaliser des opérations</string>
+ <string name="error_cant_bind_to_operations_service">Erreur critique&nbsp;: impossible de réaliser des opérations</string>
<string name="network_error_socket_exception">Une erreur s\'est produite pendant la connection au serveur</string>
<string name="network_error_socket_timeout_exception">Une erreur est survenue pendant l\'attente du serveur. L\'opération n\'a pas pu être effectuée.</string>
<string name="network_error_connect_timeout_exception">Une erreur est survenue pendant l\'attente du serveur. L\'opération n\'a pas pu être effectuée.</string>
import android.content.Context;\r
import android.content.SharedPreferences;\r
import android.graphics.Bitmap;\r
+import android.graphics.BitmapFactory;\r
+import android.media.ThumbnailUtils;\r
import android.preference.PreferenceManager;\r
+ import android.text.format.DateUtils;\r
import android.view.LayoutInflater;\r
import android.view.View;\r
import android.view.ViewGroup;\r
import android.widget.BaseAdapter;\r
+import android.widget.Filter;\r
+import android.widget.Filterable;\r
+import android.widget.GridView;\r
import android.widget.ImageView;\r
import android.widget.ListAdapter;\r
-import android.widget.ListView;\r
import android.widget.TextView;\r
\r
import com.owncloud.android.R;\r
import com.owncloud.android.datamodel.ThumbnailsCacheManager.AsyncDrawable;\r
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;\r
import com.owncloud.android.files.services.FileUploader.FileUploaderBinder;\r
+ import com.owncloud.android.lib.common.utils.Log_OC;\r
import com.owncloud.android.ui.activity.ComponentsGetter;\r
import com.owncloud.android.utils.DisplayUtils;\r
import com.owncloud.android.utils.FileStorageUtils;\r
private Context mContext;\r
private OCFile mFile = null;\r
private Vector<OCFile> mFiles = null;\r
+ private Vector<OCFile> mFilesOrig = new Vector<OCFile>();\r
private boolean mJustFolders;\r
\r
private FileDataStorageManager mStorageManager;
private Account mAccount;
private ComponentsGetter mTransferServiceGetter;\r
+ private enum ViewType {LIST_ITEM, GRID_IMAGE, GRID_ITEM };\r
private Integer mSortOrder;\r
public static final Integer SORT_NAME = 0;\r
public static final Integer SORT_DATE = 1;\r
Context context, \r
ComponentsGetter transferServiceGetter\r
) {\r
-\r
+ \r
mJustFolders = justFolders;\r
mContext = context;\r
mAccount = AccountUtils.getCurrentOwnCloudAccount(mContext);\r
-
mTransferServiceGetter = transferServiceGetter;
\r
mAppPreferences = PreferenceManager\r
\r
// initialise thumbnails cache on background thread\r
new ThumbnailsCacheManager.InitDiskCacheTask().execute();\r
-\r
}\r
@Override\r
\r
@Override\r
public View getView(int position, View convertView, ViewGroup parent) {\r
- double count = 0;\r
- \r
+ // decide image vs. file view\r
- if (file.isImage()){\r
- count++;\r
++ double countImages = 0;\r
++ double countFiles = 0;\r
+ \r
+ for (OCFile file : mFiles){\r
- if ((count / mFiles.size()) >= 0.5){\r
++ if (!file.isFolder()){\r
++ countFiles++;\r
++ \r
++ if (file.isImage()){\r
++ countImages++;\r
++ }\r
+ }\r
+ }\r
+ \r
+ // TODO threshold as constant in Preferences\r
+ // > 50% Images --> image view\r
+ boolean fileView = true;\r
++ if ((countImages / countFiles) >= 0.5){\r
+ fileView = false;\r
+ } else {\r
+ fileView = true;\r
+ }\r
+ \r
View view = convertView;\r
- if (view == null) {\r
- LayoutInflater inflator = (LayoutInflater) mContext\r
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r
+ OCFile file = null;\r
+ LayoutInflater inflator = (LayoutInflater) mContext\r
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r
+ \r
+ if (mFiles != null && mFiles.size() > position) {\r
+ file = mFiles.get(position);\r
+ }\r
+ \r
+ // Find out which layout should be displayed\r
+ ViewType viewType;\r
+ if (fileView){\r
+ viewType = ViewType.LIST_ITEM;\r
+ } else if (file.isImage()){\r
+ viewType = ViewType.GRID_IMAGE;\r
+ } else {\r
+ viewType = ViewType.GRID_ITEM;\r
+ }\r
+\r
+ // Create View\r
+ switch (viewType){\r
+ case GRID_IMAGE:\r
+ view = inflator.inflate(R.layout.grid_image, null);\r
+ break;\r
+ case GRID_ITEM:\r
+ view = inflator.inflate(R.layout.grid_item, null);\r
+ break;\r
+ case LIST_ITEM:\r
view = inflator.inflate(R.layout.list_item, null);\r
+ break;\r
}\r
- \r
- if (mFiles != null && mFiles.size() > position) {\r
- OCFile file = mFiles.get(position);\r
- TextView fileName = (TextView) view.findViewById(R.id.Filename); \r
- String name = file.getFileName();\r
\r
- fileName.setText(name);\r
- ImageView fileIcon = (ImageView) view.findViewById(R.id.imageView1);\r
- fileIcon.setTag(file.getFileId());\r
- ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon);\r
- ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon);\r
- sharedWithMeIconV.setVisibility(View.GONE);\r
+ view.invalidate();\r
\r
- ImageView localStateView = (ImageView) view.findViewById(R.id.imageView2);\r
- localStateView.bringToFront();\r
- FileDownloaderBinder downloaderBinder = \r
- mTransferServiceGetter.getFileDownloaderBinder();\r
- FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder();\r
- if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) {\r
- localStateView.setImageResource(R.drawable.downloading_file_indicator);\r
- localStateView.setVisibility(View.VISIBLE);\r
- } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) {\r
- localStateView.setImageResource(R.drawable.uploading_file_indicator);\r
- localStateView.setVisibility(View.VISIBLE);\r
- } else if (file.isDown()) {\r
- localStateView.setImageResource(R.drawable.local_file_indicator);\r
- localStateView.setVisibility(View.VISIBLE);\r
- } else {\r
- localStateView.setVisibility(View.INVISIBLE);\r
- }\r
- \r
- TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);\r
- TextView lastModV = (TextView) view.findViewById(R.id.last_mod);\r
- ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);\r
+ if (file != null){\r
+\r
+ ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);\r
+ TextView fileName;\r
+ String name;\r
\r
- if (!file.isFolder()) {\r
- fileSizeV.setVisibility(View.VISIBLE);\r
- fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));\r
+ switch (viewType){\r
+ case LIST_ITEM:\r
+ fileName = (TextView) view.findViewById(R.id.Filename);\r
+ name = file.getFileName();\r
+ fileName.setText(name);\r
+ \r
+ TextView fileSizeV = (TextView) view.findViewById(R.id.file_size);\r
+ TextView lastModV = (TextView) view.findViewById(R.id.last_mod);\r
+ ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);\r
+ \r
lastModV.setVisibility(View.VISIBLE);\r
- lastModV.setText(DisplayUtils.unixTimeToHumanReadable(file.getModificationTimestamp()));\r
+ lastModV.setText(showRelativeTimestamp(file));\r
- // this if-else is needed even thoe fav icon is visible by default\r
- // because android reuses views in listview\r
- if (!file.keepInSync()) {\r
- view.findViewById(R.id.imageView3).setVisibility(View.GONE);\r
+ \r
+ checkBoxV.setVisibility(View.GONE);\r
+ \r
+ fileSizeV.setVisibility(View.VISIBLE);\r
+ fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength()));\r
+ \r
+ ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon);\r
+ \r
+\r
+ if (file.isShareByLink()) {\r
+ sharedIconV.setVisibility(View.VISIBLE);\r
} else {\r
- view.findViewById(R.id.imageView3).setVisibility(View.VISIBLE);\r
+ sharedIconV.setVisibility(View.GONE);\r
}\r
\r
- ListView parentList = (ListView)parent;\r
- if (parentList.getChoiceMode() == ListView.CHOICE_MODE_NONE) { \r
- checkBoxV.setVisibility(View.GONE);\r
- } else {\r
- if (parentList.isItemChecked(position)) {\r
- checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);\r
+ ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator);\r
+ \r
+ if (!file.isFolder()) {\r
+ GridView parentList = (GridView)parent;\r
+ if (parentList.getChoiceMode() == GridView.CHOICE_MODE_NONE) { \r
+ checkBoxV.setVisibility(View.GONE);\r
+ } else {\r
+ if (parentList.isItemChecked(position)) {\r
+ checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);\r
+ } else {\r
+ checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);\r
+ }\r
+ checkBoxV.setVisibility(View.VISIBLE);\r
+ }\r
+ \r
+ localStateView.bringToFront();\r
+ FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder();\r
+ FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder();\r
+ if (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) {\r
+ localStateView.setImageResource(R.drawable.downloading_file_indicator);\r
+ localStateView.setVisibility(View.VISIBLE);\r
+ } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) {\r
+ localStateView.setImageResource(R.drawable.uploading_file_indicator);\r
+ localStateView.setVisibility(View.VISIBLE);\r
+ } else if (file.isDown()) {\r
+ localStateView.setImageResource(R.drawable.local_file_indicator);\r
+ localStateView.setVisibility(View.VISIBLE);\r
} else {\r
- checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);\r
+ localStateView.setVisibility(View.INVISIBLE);\r
}\r
- checkBoxV.setVisibility(View.VISIBLE);\r
- } \r
- \r
- // get Thumbnail if file is image\r
+ \r
+ ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon);\r
+ if (checkIfFileIsSharedWithMe(file)) {\r
+ sharedWithMeIconV.setVisibility(View.VISIBLE);\r
+ } else {\r
+ sharedWithMeIconV.setVisibility(View.GONE);\r
+ }\r
+ } else {\r
+ localStateView.setVisibility(View.INVISIBLE);\r
+ }\r
+ break;\r
+ case GRID_ITEM:\r
+ fileName = (TextView) view.findViewById(R.id.Filename);\r
+ name = file.getFileName();\r
+ fileName.setText(name);\r
+ break;\r
+ case GRID_IMAGE:\r
+ break;\r
+ }\r
+ \r
+ // For all Views\r
+ \r
+ // this if-else is needed even though favorite icon is visible by default\r
+ // because android reuses views in listview\r
+ if (!file.keepInSync()) {\r
+ view.findViewById(R.id.favoriteIcon).setVisibility(View.GONE);\r
+ } else {\r
+ view.findViewById(R.id.favoriteIcon).setVisibility(View.VISIBLE);\r
+ }\r
+ \r
+ // No Folder\r
+ if (!file.isFolder()) {\r
if (file.isImage() && file.getRemoteId() != null){\r
- // Thumbnail in Cache?\r
+ // Thumbnail in Cache?\r
Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(\r
String.valueOf(file.getRemoteId())\r
- );\r
+ );\r
if (thumbnail != null && !file.needsUpdateThumbnail()){\r
fileIcon.setImageBitmap(thumbnail);\r
} else {\r
// generate new Thumbnail\r
if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) {\r
- final ThumbnailsCacheManager.ThumbnailGenerationTask task = \r
+ final ThumbnailsCacheManager.ThumbnailGenerationTask task =\r
new ThumbnailsCacheManager.ThumbnailGenerationTask(\r
fileIcon, mStorageManager, mAccount\r
- );\r
+ );\r
if (thumbnail == null) {\r
thumbnail = ThumbnailsCacheManager.mDefaultImg;\r
}\r
final AsyncDrawable asyncDrawable = new AsyncDrawable(\r
- mContext.getResources(), \r
- thumbnail, \r
+ mContext.getResources(),\r
+ thumbnail,\r
task\r
- );\r
+ );\r
fileIcon.setImageDrawable(asyncDrawable);\r
task.execute(file);\r
+\r
}\r
}\r
- } else {\r
- fileIcon.setImageResource(\r
- DisplayUtils.getResourceId(file.getMimetype(), file.getFileName())\r
- );\r
}\r
-
- if (checkIfFileIsSharedWithMe(file)) {\r
- sharedWithMeIconV.setVisibility(View.VISIBLE);\r
+ else {\r
+ fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype(), file.getFileName()));\r
}\r
- } \r
- else {\r
- // TODO Re-enable when server supports folder-size calculation\r
-// if (FileStorageUtils.getDefaultSavePathFor(mAccount.name, file) != null){\r
-// fileSizeV.setVisibility(View.VISIBLE);\r
-// fileSizeV.setText(getFolderSizeHuman(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file)));\r
-// } else {\r
- fileSizeV.setVisibility(View.INVISIBLE);\r
-// }\r
-
- lastModV.setVisibility(View.VISIBLE);\r
- lastModV.setText(showRelativeTimestamp(file));\r
- checkBoxV.setVisibility(View.GONE);\r
- view.findViewById(R.id.imageView3).setVisibility(View.GONE);\r
-\r
+ } else {\r
+ // Folder\r
if (checkIfFileIsSharedWithMe(file)) {\r
fileIcon.setImageResource(R.drawable.shared_with_me_folder);\r
- sharedWithMeIconV.setVisibility(View.VISIBLE);\r
- } else {\r
- fileIcon.setImageResource(\r
- DisplayUtils.getResourceId(file.getMimetype(), file.getFileName())\r
- );\r
- }\r
-\r
- // If folder is sharedByLink, icon folder must be changed to\r
- // folder-public one\r
- if (file.isShareByLink()) {\r
+ } else if (file.isShareByLink()) {\r
+ // If folder is sharedByLink, icon folder must be changed to\r
+ // folder-public one\r
fileIcon.setImageResource(R.drawable.folder_public);\r
+ } else {\r
+ fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype(), file.getFileName()));\r
}\r
- }\r
-\r
- if (file.isShareByLink()) {\r
- sharedIconV.setVisibility(View.VISIBLE);\r
- } else {\r
- sharedIconV.setVisibility(View.GONE);\r
- }\r
+ } \r
}\r
\r
return view;\r
}\r
if (mStorageManager != null) {\r
mFiles = mStorageManager.getFolderContent(mFile);\r
+ mFilesOrig.clear();\r
+ mFilesOrig.addAll(mFiles);\r
+ \r
if (mJustFolders) {\r
mFiles = getFolders(mFiles);\r
}\r
mSortAscending = ascending;\r
\r
sortDirectory();\r
- } \r
+ }
+ \r
+ private CharSequence showRelativeTimestamp(OCFile file){\r
+ return DisplayUtils.getRelativeDateTimeString(mContext, file.getModificationTimestamp(),\r
+ DateUtils.SECOND_IN_MILLIS, DateUtils.WEEK_IN_MILLIS, 0);\r
+ }
}\r
package com.owncloud.android.ui.fragment;
import java.io.File;
+import java.util.Vector;
import android.app.Activity;
import android.content.Intent;
);
setListAdapter(mAdapter);
- registerForContextMenu(getListView());
- getListView().setOnCreateContextMenuListener(this);
+ registerForContextMenu(getGridView());
+ getGridView().setOnCreateContextMenuListener(this);
}
/**
mAdapter.swapDirectory(directory, storageManager);
if (mFile == null || !mFile.equals(directory)) {
- mList.setSelectionFromTop(0, 0);
+ imageView.setSelection(0);
}
mFile = directory;
- double count = 0;
+
+ // decide image vs. file view
- if (file.isImage()){
- count++;
++ double countImages = 0;
++ double countFiles = 0;
+
+ Vector<OCFile> files = storageManager.getFolderContent(directory);
+ for (OCFile file : files){
- if ((count / files.size()) >= 0.5){
++ if (!file.isFolder()){
++ countFiles++;
++
++ if (file.isImage()){
++ countImages++;
++ }
+ }
+ }
+
+ // > 50% Images --> image view
+ // TODO threshold as constant in Preferences
++ if ((countImages / countFiles) >= 0.5){
+ Log_OC.i(TAG, "Image View");
+ switchImageView();
+ } else {
+ Log_OC.i(TAG, "Folder View");
+ switchFileView();
+ }
}
}