Browse Source

Added help text in background of empty files list

David A. Velasco 12 năm trước cách đây
mục cha
commit
d0f7de3ce0

+ 40 - 0
res/layout/list_fragment.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+  ownCloud Android client application
+
+  Copyright (C) 2012  Bartek Przybylski
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+	<com.owncloud.android.ui.ExtendedListView
+        android:id="@+id/list_root"
+        android:layout_width="match_parent"
+        android:layout_height="0dip"
+        android:layout_weight="1" 
+	/>
+    
+    <TextView
+    	android:id="@+id/empty_list_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:gravity="center_vertical|center_horizontal"
+        android:text="@string/file_list_empty"
+        android:visibility="gone"
+	/>
+
+</LinearLayout>    

+ 0 - 0
res/layout/list_layout.xml → res/layout/list_item.xml


+ 7 - 6
res/values-de/strings.xml

@@ -15,7 +15,7 @@
   <string name="main_tit_accsetup">Konto einrichten</string>
   <string name="main_wrn_accsetup">Auf Deinem Gerät sind keine ownCloud Konten eingerichtet. Bitte erstelle ein Konto, um diese App zu nutzen.</string>
   <string name="actionbar_sync">Aktualisieren</string>
-  <string name="actionbar_upload">Datei hochladen</string>
+  <string name="actionbar_upload">Hochladen</string>
   <string name="actionbar_upload_from_apps">Inhalt von anderen Apps</string>
   <string name="actionbar_upload_files">Dateien</string>
   <string name="actionbar_mkdir">Verzeichnis erstellen</string>
@@ -62,6 +62,7 @@
   <string name="uploader_error_forbidden_content">ownCloud darf den geteilten Inhalt nicht nutzen.</string>
   <string name="uploader_info_uploading">Lade hoch</string>
   <string name="uploader_btn_create_dir_text">Verzeichnis für hochzuladene Dateien erstellen</string>
+  <string name="file_list_empty">Im ausgewählten Ordner befinden sich noch keine Dateien.\nÜber die Schaltfläche „Hochladen“ können neue Dateien hinzugefügt werden.</string>
   <string name="filedetails_select_file">Klicken Sie auf eine Datei für weitere Informationen.</string>
   <string name="filedetails_size">Größe:</string>
   <string name="filedetails_type">Art:</string>
@@ -80,9 +81,9 @@
   <string name="about_title">Über</string>
   <string name="delete_account">Konto löschen</string>
   <string name="create_account">Konto erstellen</string>
-  <string name="upload_chooser_title">Dateien hochladen von...</string>
+  <string name="upload_chooser_title">Dateien hochladen von&#8230;</string>
   <string name="uploader_info_dirname">Verzeichnisname</string>
-  <string name="uploader_upload_in_progress_ticker">Hochladen...</string>
+  <string name="uploader_upload_in_progress_ticker">Hochladen&#8230;</string>
   <string name="uploader_upload_in_progress_content">%1$d%% Hochladen %2$s</string>
   <string name="uploader_upload_succeeded_ticker">Hochladen erfolgreich</string>
   <string name="uploader_upload_succeeded_content_single">%1$s wurde(n) erfolgreich hochgeladen</string>
@@ -90,7 +91,7 @@
   <string name="uploader_upload_failed_ticker">Hochladen fehlgeschlagen</string>
   <string name="uploader_upload_failed_content_single">Hochladen von  %1$s konnte nicht abgeschlossen werden</string>
   <string name="uploader_upload_failed_content_multiple">Hochladen fehlgeschlagen: %1$d/%2$d Dateien wurden hochgeladen</string>
-  <string name="downloader_download_in_progress_ticker">Herunterladen...</string>
+  <string name="downloader_download_in_progress_ticker">Herunterladen&#8230;</string>
   <string name="downloader_download_in_progress_content">%1$d%% Herunterladen %2$s</string>
   <string name="downloader_download_succeeded_ticker">Herunterladen erfolgreich</string>
   <string name="downloader_download_succeeded_content">%1$s wurde erfolgreich heruntergeladen</string>
@@ -121,14 +122,14 @@
     <item>30</item>
     <item>60</item>
   </string-array>
-  <string name="auth_trying_to_login">Anmeldungsversuch...</string>
+  <string name="auth_trying_to_login">Anmeldungsversuch&#8230;</string>
   <string name="auth_no_net_conn_title">Keine Netzwerkverbindung</string>
   <string name="auth_no_net_conn_message">Es konnte keine Netzwerkverbindung gefunden werden, bitte überprüfe Deine Internetverbindung.</string>
   <string name="auth_connect_anyway">Trotzdem verbinden</string>
   <string name="auth_nossl_plain_ok_title">Sichere Verbindung nicht verfügbar.</string>
   <string name="auth_nossl_plain_ok_message">Die App konnte keine sichere Verbindung zum Server herstellen. Eine nicht sichere Verbindung ist nichtsdestotrotz verfügbar. Möchtest Du fortfahren oder abbrechen?</string>
   <string name="auth_connection_established">Verbindung hergestellt</string>
-  <string name="auth_testing_connection">Verbindung testen...</string>
+  <string name="auth_testing_connection">Verbindung testen&#8230;</string>
   <string name="auth_not_configured_title">Falsch konfigurierte ownCloud</string>
   <string name="auth_not_configured_message">Es scheint, als wäre Deine ownCloud-Installation nicht richtig konfiguriert. Bitte kontaktiere Deinen Administrator, um weitere Details zu erhalten.</string>
   <string name="auth_unknown_error_title">Ein unbekannter Fehler ist aufgetreten!</string>

+ 6 - 5
res/values-es-rAR/strings.xml

@@ -62,6 +62,7 @@
   <string name="uploader_error_forbidden_content">ownCloud no está autorizado para acceder al contenido compartido</string>
   <string name="uploader_info_uploading">Subiendo</string>
   <string name="uploader_btn_create_dir_text">Crear directorio para subir</string>
+  <string name="file_list_empty">La carpeta seleccionada no contiene ningún archivo.\nPuede añadir ficheros con la opción de menú \"Subir\".</string>
   <string name="filedetails_select_file">Pulsá sobre un archivo para mostrar información adicional.</string>
   <string name="filedetails_size">Tamaño:</string>
   <string name="filedetails_type">Tipo:</string>
@@ -80,9 +81,9 @@
   <string name="about_title">Acerca de</string>
   <string name="delete_account">Eliminar cuenta</string>
   <string name="create_account">Crear cuenta</string>
-  <string name="upload_chooser_title">Subir desde ...</string>
+  <string name="upload_chooser_title">Subir desde &#8230;</string>
   <string name="uploader_info_dirname">Nombre del directorio</string>
-  <string name="uploader_upload_in_progress_ticker">Subiendo...</string>
+  <string name="uploader_upload_in_progress_ticker">Subiendo&#8230;</string>
   <string name="uploader_upload_in_progress_content">%1$d%% Subiendo %2$s</string>
   <string name="uploader_upload_succeeded_ticker">Subido con éxito</string>
   <string name="uploader_upload_succeeded_content_single">%1$s se ha subido con éxito</string>
@@ -90,7 +91,7 @@
   <string name="uploader_upload_failed_ticker">Error al subir el archivo</string>
   <string name="uploader_upload_failed_content_single">No se pudo completar la subida de %1$s </string>
   <string name="uploader_upload_failed_content_multiple">Error al subir: %1$d/%2$d archivos fueron subidos</string>
-  <string name="downloader_download_in_progress_ticker">Descargando ...</string>
+  <string name="downloader_download_in_progress_ticker">Descargando &#8230;</string>
   <string name="downloader_download_in_progress_content">%1$d%%  descargando %2$s</string>
   <string name="downloader_download_succeeded_ticker">Descarga completa</string>
   <string name="downloader_download_succeeded_content">%1$s fue descargado con éxito</string>
@@ -122,14 +123,14 @@
     <item>30</item>
     <item>60</item>
   </string-array>
-  <string name="auth_trying_to_login">Intentado iniciar sesión...</string>
+  <string name="auth_trying_to_login">Intentado iniciar sesión&#8230;</string>
   <string name="auth_no_net_conn_title">Sin conexión de red</string>
   <string name="auth_no_net_conn_message">No se ha detectado una conexión de red, revisá tu conexión a internet e intentá nuevamente.</string>
   <string name="auth_connect_anyway">Conectar de todos modos</string>
   <string name="auth_nossl_plain_ok_title">Conexión segura no disponible.</string>
   <string name="auth_nossl_plain_ok_message">La aplicación no pudo establecer una conexión segura al servidor. Aunque no haya una conexión segura disponible, podés continuar o cancelar.</string>
   <string name="auth_connection_established">Conexión establecida</string>
-  <string name="auth_testing_connection">Probando conexión...</string>
+  <string name="auth_testing_connection">Probando conexión&#8230;</string>
   <string name="auth_not_configured_title">Configuración de ownCloud en formato incorrecto</string>
   <string name="auth_not_configured_message">Parece ser que la instancia de ownCloud no está configurada correctamente. Comunicate con el administrador para más detalles.</string>
   <string name="auth_unknown_error_title">¡Ocurrió un error desconocido!</string>

+ 6 - 5
res/values-es/strings.xml

@@ -15,7 +15,7 @@
   <string name="main_tit_accsetup">Configuración de cuenta</string>
   <string name="main_wrn_accsetup">No hay cuentas de ownCloud en tu dispositivo. Para usar esta aplicación, necesitas crear una.</string>
   <string name="actionbar_sync">Sincronización de cuenta</string>
-  <string name="actionbar_upload">Subir archivo</string>
+  <string name="actionbar_upload">Subir</string>
   <string name="actionbar_upload_from_apps">Contenido de otras aplicaciones</string>
   <string name="actionbar_upload_files">Archivos</string>
   <string name="actionbar_mkdir">Crear directorio</string>
@@ -62,6 +62,7 @@
   <string name="uploader_error_forbidden_content">ownCloud no está autorizado para acceder al contenido compartido</string>
   <string name="uploader_info_uploading">Enviando</string>
   <string name="uploader_btn_create_dir_text">Crear directorio para envío</string>
+  <string name="file_list_empty">La carpeta seleccionada no contiene ningún archivo.\nPuede añadir ficheros con la opción de menú \"Subir\".</string>
   <string name="filedetails_select_file">Pulsa sobre un archivo para mostrar información adicional.</string>
   <string name="filedetails_size">Tamaño:</string>
   <string name="filedetails_type">Tipo:</string>
@@ -82,7 +83,7 @@
   <string name="create_account">Crear cuenta</string>
   <string name="upload_chooser_title">Subir</string>
   <string name="uploader_info_dirname">Nombre de directorio</string>
-  <string name="uploader_upload_in_progress_ticker">Subiendo...</string>
+  <string name="uploader_upload_in_progress_ticker">Subiendo&#8230;</string>
   <string name="uploader_upload_in_progress_content">%1$d%% Subiendo %2$s</string>
   <string name="uploader_upload_succeeded_ticker">Subido con éxito</string>
   <string name="uploader_upload_succeeded_content_single">%1$s se ha subido con éxito</string>
@@ -90,7 +91,7 @@
   <string name="uploader_upload_failed_ticker">Error en la subida</string>
   <string name="uploader_upload_failed_content_single">La subida de %1$s no se pudo completar</string>
   <string name="uploader_upload_failed_content_multiple">Error de subida: %1$d/%2$d archivos fueron cargados</string>
-  <string name="downloader_download_in_progress_ticker">Descargando ...</string>
+  <string name="downloader_download_in_progress_ticker">Descargando &#8230;</string>
   <string name="downloader_download_in_progress_content">%1$s Descargada de %2$s</string>
   <string name="downloader_download_succeeded_ticker">Descarga completa</string>
   <string name="downloader_download_succeeded_content">%1$s se ha descargado con éxito</string>
@@ -122,14 +123,14 @@
     <item>30</item>
     <item>60</item>
   </string-array>
-  <string name="auth_trying_to_login">Intentado iniciar sesión...</string>
+  <string name="auth_trying_to_login">Intentado iniciar sesión&#8230;</string>
   <string name="auth_no_net_conn_title">Sin conexión de red</string>
   <string name="auth_no_net_conn_message">No se ha detectado una conexión de red, chequea tu conexión a internet e intenta nuevamente.</string>
   <string name="auth_connect_anyway">Conectar de todos modos</string>
   <string name="auth_nossl_plain_ok_title">Conexión segura no disponible.</string>
   <string name="auth_nossl_plain_ok_message">La aplicación no pudo establecer una conexión segura al servidor. Aunque no haya una conexión segura disponible, puedes continuar o cancelar.</string>
   <string name="auth_connection_established">Conexión establecida</string>
-  <string name="auth_testing_connection">Probando conexión...</string>
+  <string name="auth_testing_connection">Probando conexión&#8230;</string>
   <string name="auth_not_configured_title">Configuración de ownCloud en formato incorrecto</string>
   <string name="auth_not_configured_message">Parece que tu instancia de ownCloud no está correctamente configurada. Contacta a tu administrador para más detalles.</string>
   <string name="auth_unknown_error_title">Ocurrió un error desconocido</string>

+ 1 - 0
res/values/strings.xml

@@ -65,6 +65,7 @@
     <string name="uploader_error_forbidden_content">ownCloud is not allowed to access the shared content</string>
     <string name="uploader_info_uploading">Uploading</string>
     <string name="uploader_btn_create_dir_text">Create directory for upload</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="filedetails_select_file">Tap on a file to display additional information.</string>
     <string name="filedetails_size">Size:</string>
     <string name="filedetails_type">Type:</string>

+ 33 - 2
src/com/owncloud/android/ui/FragmentListView.java

@@ -1,6 +1,8 @@
 package com.owncloud.android.ui;
 
 import com.actionbarsherlock.app.SherlockFragment;
+import com.owncloud.android.R;
+import com.owncloud.android.ui.fragment.LocalFileListFragment;
 
 import android.os.Bundle;
 import android.view.LayoutInflater;
@@ -33,10 +35,15 @@ public class FragmentListView extends SherlockFragment implements
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
-        mList = new ExtendedListView(getActivity());
+        //mList = new ExtendedListView(getActivity());
+        View v = inflater.inflate(R.layout.list_fragment, null);
+        mList = (ExtendedListView)(v.findViewById(R.id.list_root));
         mList.setOnItemClickListener(this);
         mList.setOnItemLongClickListener(this);
-        return mList;
+        mList.setEmptyView(v.findViewById(R.id.empty_list_view));
+        mList.setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));
+        mList.setDividerHeight(1);
+        return v;
     }
 
     public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
@@ -48,4 +55,28 @@ public class FragmentListView extends SherlockFragment implements
         return false;
     }
 
+    
+    /**
+     * Calculates the position of the item that will be used as a reference to reposition the visible items in the list when
+     * the device is turned to other position. 
+     * 
+     * THe current policy is take as a reference the visible item in the center of the screen.  
+     * 
+     * @return      The position in the list of the visible item in the center of the screen.
+     */
+    protected int getReferencePosition() {
+        return (mList.getFirstVisiblePosition() + mList.getLastVisiblePosition()) / 2;
+    }
+
+    
+    /**
+     * Sets the visible part of the list from the reference position.
+     * 
+     * @param   position    Reference position previously returned by {@link LocalFileListFragment#getReferencePosition()}
+     */
+    protected void setReferencePosition(int position) {
+        mList.setAndCenterSelection(position);
+    }
+
+    
 }

+ 3 - 2
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -187,11 +187,11 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
         actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
         actionBar.setListNavigationCallbacks(mDirectories, this);
         setSupportProgressBarIndeterminateVisibility(false);        // always AFTER setContentView(...) ; to workaround bug in its implementation
-            
+        
         Log.d(getClass().toString(), "onCreate() end");
     }
 
-
+    
     /**
      * Launches the account creation activity. To use when no ownCloud account is available
      */
@@ -553,6 +553,7 @@ public class FileDisplayActivity extends SherlockFragmentActivity implements
             try {
                 pkg = getPackageManager().getPackageInfo(getPackageName(), 0);
                 builder.setMessage("ownCloud android client\n\nversion: " + pkg.versionName );
+                //builder.setMessage(String.format(getString(R.string.aboout_message), pkg.versionName));
                 builder.setIcon(android.R.drawable.ic_menu_info_details);
                 dialog = builder.create();
             } catch (NameNotFoundException e) {

+ 1 - 1
src/com/owncloud/android/ui/adapter/FileListListAdapter.java

@@ -106,7 +106,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
         if (view == null) {
             LayoutInflater inflator = (LayoutInflater) mContext
                     .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-            view = inflator.inflate(R.layout.list_layout, null);
+            view = inflator.inflate(R.layout.list_item, null);
         }
         if (mFiles != null && mFiles.size() > position) {
             OCFile file = mFiles.get(position);

+ 1 - 1
src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java

@@ -90,7 +90,7 @@ public class LocalFileListAdapter extends BaseAdapter implements ListAdapter {
         if (view == null) {
             LayoutInflater inflator = (LayoutInflater) mContext
                     .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-            view = inflator.inflate(R.layout.list_layout, null);
+            view = inflator.inflate(R.layout.list_item, null);
         }
         if (mFiles != null && mFiles.length > position) {
             File file = mFiles[position];

+ 2 - 29
src/com/owncloud/android/ui/fragment/LocalFileListFragment.java

@@ -19,7 +19,6 @@ package com.owncloud.android.ui.fragment;
 
 import java.io.File;
 
-import com.owncloud.android.ui.ExtendedListView;
 import com.owncloud.android.ui.FragmentListView;
 import com.owncloud.android.ui.adapter.LocalFileListAdapter;
 
@@ -77,13 +76,10 @@ public class LocalFileListFragment extends FragmentListView {
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         Log.i(TAG, "onCreateView() start");
-        super.onCreateView(inflater, container, savedInstanceState);
-        getListView().setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));
-        getListView().setDividerHeight(1);
+        View v = super.onCreateView(inflater, container, savedInstanceState);
         getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
-        
         Log.i(TAG, "onCreateView() end");
-        return getListView();
+        return v;
     }    
 
 
@@ -119,29 +115,6 @@ public class LocalFileListFragment extends FragmentListView {
     }
     
     
-    /**
-     * Calculates the position of the item that will be used as a reference to reposition the visible items in the list when
-     * the device is turned to other position. 
-     * 
-     * THe current policy is take as a reference the visible item in the center of the screen.  
-     * 
-     * @return      The position in the list of the visible item in the center of the screen.
-     */
-    private int getReferencePosition() {
-        return (getListView().getFirstVisiblePosition() + getListView().getLastVisiblePosition()) / 2;
-    }
-
-    
-    /**
-     * Sets the visible part of the list from the reference position.
-     * 
-     * @param   position    Reference position previously returned by {@link LocalFileListFragment#getReferencePosition()}
-     */
-    private void setReferencePosition(int position) {
-        ((ExtendedListView)getListView()).setAndCenterSelection(position);
-    }
-    
-
     /**
      * Checks the file clicked over. Browses inside if it is a directory. Notifies the container activity in any case.
      */

+ 0 - 43
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -19,7 +19,6 @@ package com.owncloud.android.ui.fragment;
 
 import com.owncloud.android.datamodel.DataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.ui.ExtendedListView;
 import com.owncloud.android.ui.FragmentListView;
 import com.owncloud.android.ui.activity.TransferServiceGetter;
 import com.owncloud.android.ui.adapter.FileListListAdapter;
@@ -27,11 +26,8 @@ import com.owncloud.android.ui.adapter.FileListListAdapter;
 import android.app.Activity;
 import android.os.Bundle;
 import android.util.Log;
-import android.view.LayoutInflater;
 import android.view.View;
-import android.view.ViewGroup;
 import android.widget.AdapterView;
-import com.owncloud.android.R;
 
 /**
  * A Fragment that lists all files and folders in a given path.
@@ -63,22 +59,6 @@ public class OCFileListFragment extends FragmentListView {
     }
     
     
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        Log.i(TAG, "onCreateView() start");
-        super.onCreateView(inflater, container, savedInstanceState);
-        getListView().setDivider(getResources().getDrawable(R.drawable.uploader_list_separator));
-        getListView().setDividerHeight(1);
-        
-        Log.i(TAG, "onCreateView() end");
-        return getListView();
-    }    
-
-
     /**
      * {@inheritDoc}
      */
@@ -111,29 +91,6 @@ public class OCFileListFragment extends FragmentListView {
     }
     
     
-    /**
-     * Calculates the position of the item that will be used as a reference to reposition the visible items in the list when
-     * the device is turned to other position. 
-     * 
-     * THe current policy is take as a reference the visible item in the center of the screen.  
-     * 
-     * @return      The position in the list of the visible item in the center of the screen.
-     */
-    private int getReferencePosition() {
-        return (getListView().getFirstVisiblePosition() + getListView().getLastVisiblePosition()) / 2;
-    }
-
-    
-    /**
-     * Sets the visible part of the list from the reference position.
-     * 
-     * @param   position    Reference position previously returned by {@link OCFileListFragment#getReferencePosition()}
-     */
-    private void setReferencePosition(int position) {
-        ((ExtendedListView)getListView()).setAndCenterSelection(position);
-    }
-
-    
     @Override
     public void onItemClick(AdapterView<?> l, View v, int position, long id) {
         OCFile file = (OCFile) mAdapter.getItem(position);