Skip to content

Commit

Permalink
Merge pull request #92 from jmpascal/master
Browse files Browse the repository at this point in the history
MOBILE-1587
  • Loading branch information
JM.PASCAL committed Apr 12, 2013
2 parents 42a9f13 + d242dbf commit c089b6a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 23 deletions.
9 changes: 8 additions & 1 deletion alfresco-mobile-android/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@
<![CDATA[<p><b>Une erreur de protocole SSL s\'est produite.</b><br/></p>
Vérifiez les paramètres de votre compte et réessayez.<br/> Si le problème persiste, veuillez contacter votre administrateur.]]>
</string>
<string name="error_session_cloud_unavailable">
<![CDATA[<p><b>Alfresco dans le Cloud est en surcharge en ce moment!</b><br/></p>
Veuillez réessayer dans quelques minutes.<br/>]]>
</string>
<string name="error_session_unauthorized_title">Non autorisé.</string>
<string name="error_session_expired">Votre session a expiré. Veuillez vous reconnecter.</string>
<string name="error_session_refresh">Rafraîchissement de la session.</string>
Expand Down Expand Up @@ -247,6 +251,8 @@

<!-- About Message -->
<string name="buildnumber_version">Version : </string>
<string name="sdknumber_version">SDK : </string>

<!-- BuildNumber Bamboo -->
<string name="about_description">
<![CDATA[
Expand Down Expand Up @@ -291,7 +297,8 @@
<string name="create_document_text">Document texte </string>
<string name="create_document_name_hint">Saisissez le nom du document ici</string>
<string name="create_document_filename_error">Ce nom est déjà utilisé.</string>
<string name="create_document_save">Une erreur s\'est produite lors de l\'ajout. Votre document est enregistré dans \"Téléchargements\".</string>
<string name="create_document_save">Une erreur s\'est produite : Votre document est enregistré dans \"Téléchargements\".</string>
<string name="upload_error_alreadyexist">Une erreur s\'est produite: Ce nom est déjà utilisé.</string>
<string name="document_word_extension">.docx</string>
<string name="document_powerpoint_extension">.pptx</string>
<string name="document_excel_extension">.xlsx</string>
Expand Down
7 changes: 4 additions & 3 deletions alfresco-mobile-android/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@
<string name="asset_folder_prefix">en</string>

<!-- About Message -->
<string name="buildnumber_version">Version : </string>
<string name="sdknumber_version">SDK : </string>
<string name="buildnumber_version">Version: </string>
<string name="sdknumber_version">SDK: </string>

<!-- BuildNumber Bamboo -->
<string name="about_description">
Expand Down Expand Up @@ -297,7 +297,8 @@
<string name="create_document_text">Text Document</string>
<string name="create_document_name_hint">Type the document name here</string>
<string name="create_document_filename_error">This name is already in use.</string>
<string name="create_document_save">An error occurred during the upload. Your document is saved inside "Downloads".</string>
<string name="create_document_save">An error occurred: Your document is saved inside "Downloads".</string>
<string name="upload_error_alreadyexist">An error occurred: This name is already in use.</string>
<string name="document_word_extension">.docx</string>
<string name="document_powerpoint_extension">.pptx</string>
<string name="document_excel_extension">.xlsx</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.alfresco.mobile.android.ui.manager.MessengerManager;
import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;

import android.app.Fragment;
import android.app.LoaderManager.LoaderCallbacks;
Expand Down Expand Up @@ -213,15 +214,21 @@ else if (loader instanceof DocumentCreateLoader)
Log.e(TAG, Log.getStackTraceString(results.getException()));
if (contentFile != null)
{
// An error occurs, notify the user.
ProgressNotification.updateProgress(name, ProgressNotification.FLAG_UPLOAD_ERROR);
if (results.hasException() && results.getException() != null && results.getException().getCause() instanceof CmisContentAlreadyExistsException)
{
// An error occurs, notify the user.
ProgressNotification.updateProgress(name, ProgressNotification.FLAG_UPLOAD_ALREADY_EXIST);
}

// During creation process, the content must be available on
// Download area.
// The file is move from capture to download.
if (getArguments() != null
&& getArguments().getBoolean(CreateDocumentDialogFragment.ARGUMENT_IS_CREATION))
{
// An error occurs, notify the user.
ProgressNotification.updateProgress(name, ProgressNotification.FLAG_UPLOAD_CREATION_ERROR);

final File folderStorage = StorageManager.getDownloadFolder(getActivity(), currentAccount.getUrl(),
currentAccount.getUsername());

Expand All @@ -241,6 +248,11 @@ && getArguments().getBoolean(CreateDocumentDialogFragment.ARGUMENT_IS_CREATION))
MessengerManager.showToast(getActivity(), R.string.error_general);
}
}
else
{
// An error occurs, notify the user.
ProgressNotification.updateProgress(name, ProgressNotification.FLAG_UPLOAD_IMPORT_ERROR);
}
}

// The upload is done even if it's an error.
Expand Down Expand Up @@ -299,8 +311,7 @@ && getArguments().getBoolean(CreateDocumentDialogFragment.ARGUMENT_IS_CREATION))
else
{
Fragment lf = getFragmentManager().findFragmentById(DisplayUtils.getLeftFragmentId(getActivity()));
if (getActivity() instanceof MainActivity
&& lf instanceof ChildrenBrowserFragment)
if (getActivity() instanceof MainActivity && lf instanceof ChildrenBrowserFragment)
{
Folder pFolder = ((ChildrenBrowserFragment) lf).getParent();
if (pFolder == this.parentFolder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ public class ProgressNotification extends Service

private static final int FLAG_UPLOAD_PROCESSING = -2;

public static final int FLAG_UPLOAD_ERROR = -3;

public static final int FLAG_UPLOAD_CREATION_ERROR = -3;

public static final int FLAG_UPLOAD_ALREADY_EXIST = -5;

/** Error happens during import process. */
public static final int FLAG_UPLOAD_IMPORT_ERROR = -4;


private static Notification notification = null;

//private static Activity parent = null;
// private static Activity parent = null;

private static Context ctxt = null;

Expand Down Expand Up @@ -98,7 +99,8 @@ static public synchronized boolean updateProgress(String name, Integer increment
int dataSize = params.getInt(PARAM_DATA_SIZE);

// UPLOAD PROCESS IS FINISHED : Notification Upload Complete<
if (incrementBy != null && (incrementBy == FLAG_UPLOAD_COMPLETED || incrementBy == FLAG_UPLOAD_ERROR || incrementBy == FLAG_UPLOAD_IMPORT_ERROR))
if (incrementBy != null
&& (incrementBy == FLAG_UPLOAD_COMPLETED || incrementBy == FLAG_UPLOAD_ALREADY_EXIST || incrementBy == FLAG_UPLOAD_CREATION_ERROR || incrementBy == FLAG_UPLOAD_IMPORT_ERROR))
{
if (AndroidVersion.isICSOrAbove())
{
Expand All @@ -109,17 +111,17 @@ static public synchronized boolean updateProgress(String name, Integer increment
String title = null;
switch (incrementBy)
{
case FLAG_UPLOAD_ERROR:
title = ctxt.getString(R.string.action_upload_error);
case FLAG_UPLOAD_CREATION_ERROR:
title = ctxt.getString(R.string.action_upload_error);
break;
case FLAG_UPLOAD_COMPLETED:
title = ctxt.getString(R.string.upload_complete);
break;
default:
title = ctxt.getString(R.string.action_upload_error);
break;
}
tmpNotification.contentView.setTextViewText(R.id.status_text,
title);
tmpNotification.contentView.setTextViewText(R.id.status_text, title);
tmpNotification.contentView.setProgressBar(R.id.status_progress, dataSize, dataSize, false);
}
notificationManager.notify((int) progressItem.id, tmpNotification);
Expand All @@ -129,7 +131,8 @@ static public synchronized boolean updateProgress(String name, Integer increment

if (inProgressObjects.isEmpty())
{
ctxt.getApplicationContext().stopService(new Intent(ctxt.getApplicationContext(), ProgressNotification.class).putExtras(params));
ctxt.getApplicationContext().stopService(
new Intent(ctxt.getApplicationContext(), ProgressNotification.class).putExtras(params));
}
}
else
Expand Down Expand Up @@ -184,7 +187,7 @@ public void onCreate()
if (inProgressObjects != null && inProgressObjects.size() > 0 && newItem != null)
{
ctxt = this;
//parent = MainActivity.activity;
// parent = MainActivity.activity;

MessengerManager.showLongToast(this, getString(R.string.upload_in_progress));
}
Expand All @@ -199,7 +202,7 @@ private static Notification createNotification(Context c, Bundle params, int val
// Get the builder to create notification.
Builder builder = new Notification.Builder(c.getApplicationContext());
builder.setContentText(params.getString(PARAM_DATA_NAME));

switch (value)
{
case FLAG_UPLOAD_COMPLETED:
Expand All @@ -210,7 +213,11 @@ private static Notification createNotification(Context c, Bundle params, int val
case FLAG_UPLOAD_PROCESSING:
builder.setContentTitle(c.getText(R.string.action_processing));
break;
case FLAG_UPLOAD_ERROR:
case FLAG_UPLOAD_ALREADY_EXIST:
builder.setContentTitle(params.getString(PARAM_DATA_NAME));
builder.setContentText(c.getText(R.string.upload_error_alreadyexist));
break;
case FLAG_UPLOAD_CREATION_ERROR:
builder.setContentTitle(params.getString(PARAM_DATA_NAME));
builder.setContentText(c.getText(R.string.create_document_save));
break;
Expand All @@ -230,9 +237,10 @@ private static Notification createNotification(Context c, Bundle params, int val
{
switch (value)
{
case FLAG_UPLOAD_ERROR:
case FLAG_UPLOAD_CREATION_ERROR:
case FLAG_UPLOAD_IMPORT_ERROR:
case FLAG_UPLOAD_COMPLETED:
case FLAG_UPLOAD_ALREADY_EXIST:
builder.setProgress(0, 0, false);
break;
case FLAG_UPLOAD_PROCESSING:
Expand Down Expand Up @@ -263,7 +271,7 @@ private static Notification createNotification(Context c, Bundle params, int val
public static void createProgressNotification(Context c, Bundle params, Class clickActivity)
{
ctxt = c;
//parent = MainActivity.activity;
// parent = MainActivity.activity;

if (inProgressObjects == null)
{
Expand Down

0 comments on commit c089b6a

Please sign in to comment.