Modified some messages of download notifications

This commit is contained in:
Helena Rodriguez 2012-12-14 21:13:02 +01:00
parent 49376e08a8
commit bb02d6dad2
7 changed files with 35 additions and 18 deletions

View File

@ -144,6 +144,6 @@
<string name="selectZone">Seleccioneu zona</string>
<string name="fileTitle">Fitxer:</string>
<string name="noConnectionMsg">No hi ha connexió. Ho sentim però aquesta funció necessita connexió.</string>
<string name="noApp">There is not any app that can open this file. Location:</string>
<string name="noApp">No Es Pot obrir this Arxiu.</string>
</resources>

View File

@ -176,6 +176,6 @@
<string name="selectZone">Wählen Sie Bereich</string>
<string name="fileTitle">Datei:</string>
<string name="noConnectionMsg">Es gibt nicht conection.Sorry, aber diese Funktion muss conection.</string>
<string name="noApp">Es kann diese Datei nicht öffnen. Location:</string>
<string name="noApp">Es kann diese Datei nicht öffnen.</string>
</resources>

View File

@ -269,7 +269,7 @@ Seleccione: Sesiones de prácticas - Nueva</string>
<string name="selectZoneTitle">Seleccione zona</string>
<string name="fileTitle">Archivo:</string>
<string name="noConnectionMsg">No hay conexión. Lo sentimos pero esta función necesita conexión. </string>
<string name="noApp">No se puede abrir este archivo. Ubicación:</string>
<string name="noApp">No se puede abrir este archivo.</string>
</resources>

View File

@ -280,5 +280,5 @@ configuration anytime using the "Clean Database" option\n\nDo you want to contin
<string name="selectZoneTitle">Select zone</string>
<string name="fileTitle">File:</string>
<string name="noConnectionMsg">There is not connection. Sorry but this function needs connection. </string>
<string name="noApp">No Es Pot obrir this Arxiu. ubicació:</string>
<string name="noApp">No application can open this file</string>
</resources>

View File

@ -31,7 +31,6 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import android.util.Log;
/**
* Class used to navigate around the XML file. That XML file contains the

View File

@ -129,14 +129,16 @@ public class DownloadNotification {
//build up the new status message
CharSequence contentText;
if(notificationIntent != null)
if(notificationIntent != null){
contentText = mContext.getString(R.string.clickToOpenFile);
else
contentText = mContext.getString(R.string.noApp) + " " + directoryPath + File.separator+ fileName;
mContentTitle = fileName; //Full title of the notification in the pull down
}else{
contentText = mContext.getString(R.string.noApp);
mContentTitle = directoryPath + File.separator+ fileName;
}
//publish it to the status bar
mNotification.setLatestEventInfo(mContext, mContentTitle, contentText, mContentIntent);
//create the content which is shown in the notification pulldown
mContentTitle = fileName;; //Full title of the notification in the pull down
//add the additional content and intent to the notification
mNotification.setLatestEventInfo(mContext, mContentTitle, contentText, mContentIntent);

View File

@ -189,6 +189,14 @@ public class FileDownloaderAsyncTask extends AsyncTask<String,Integer,Boolean> {
ucon = url.openConnection();
} catch (IOException e) {
//Log.i(TAG, "Error connection");
try {
fos.close();
} catch (IOException e1) {
//Log.i(TAG, "no se puede cerrar fichero de salida");
e1.printStackTrace();
notifyFailed();
return false;
}
e.printStackTrace();
notifyFailed();
return false;
@ -202,6 +210,14 @@ public class FileDownloaderAsyncTask extends AsyncTask<String,Integer,Boolean> {
is = ucon.getInputStream();
} catch (IOException e) {
//Log.i(TAG, "Error connection");
try {
fos.close();
} catch (IOException e1) {
//Log.i(TAG, "no se puede cerrar fichero de salida");
e1.printStackTrace();
notifyFailed();
return false;
}
notifyFailed();
e.printStackTrace();
return false;
@ -211,14 +227,6 @@ public class FileDownloaderAsyncTask extends AsyncTask<String,Integer,Boolean> {
/* Read bytes to the buffer until there is nothing more to read(-1) */
ByteArrayBuffer baf = new ByteArrayBuffer(50);
int current = 0;
int total = 100;
try {
total = bis.available();
} catch (IOException e1) {
Log.i(TAG, "Error lectura bytes");mNotification.eraseNotification(this.fileName);
e1.printStackTrace();
};
if(notification){
@ -234,6 +242,14 @@ public class FileDownloaderAsyncTask extends AsyncTask<String,Integer,Boolean> {
baf.clear();
} catch (IOException e) {
// Log.i(TAG, "no se puede escribir fichero de salida");
try {
fos.close();
} catch (IOException e1) {
//Log.i(TAG, "no se puede cerrar fichero de salida");
e1.printStackTrace();
notifyFailed();
return false;
}
notifyFailed();
e.printStackTrace();
return false;