Skip to content

Commit

Permalink
Merge pull request #55 from jmpascal/master
Browse files Browse the repository at this point in the history
Android 1.0.1 : Bug fix
  • Loading branch information
JM.PASCAL committed Jan 16, 2013
2 parents e44efcb + cce75b5 commit ca1436a
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,10 @@ else if (intent.getCategories().contains(IntentIntegrator.CATEGORY_OAUTH))
}
else
{
addNavigationFragment((Folder) currentNode);
// Uncomment this part to enable quick access to specific
// folder.
// NB : Issue can occurs with top quick navigation dropdown.
// addNavigationFragment((Folder) currentNode);
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@
******************************************************************************/
package org.alfresco.mobile.android.application.fragments.activities;

import java.util.ArrayList;

import org.alfresco.mobile.android.api.asynchronous.LoaderResult;
import org.alfresco.mobile.android.api.constants.CloudConstant;
import org.alfresco.mobile.android.api.model.ActivityEntry;
import org.alfresco.mobile.android.api.model.PagingResult;
import org.alfresco.mobile.android.application.MenuActionItem;
import org.alfresco.mobile.android.application.R;
import org.alfresco.mobile.android.application.exception.CloudExceptionUtils;
Expand All @@ -31,11 +27,11 @@
import org.alfresco.mobile.android.application.loaders.NodeLoader;
import org.alfresco.mobile.android.application.loaders.NodeLoaderCallback;
import org.alfresco.mobile.android.application.utils.SessionUtils;
import org.alfresco.mobile.android.ui.activitystream.ActivityEventAdapter;
import org.alfresco.mobile.android.ui.activitystream.ActivityStreamFragment;
import org.alfresco.mobile.android.ui.fragments.BaseListAdapter;

import android.app.LoaderManager;
import android.content.Loader;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
Expand All @@ -44,7 +40,6 @@

public class ActivitiesFragment extends ActivityStreamFragment implements RefreshFragment
{

public static final String TAG = "ActivitiesFragment";

public ActivitiesFragment()
Expand Down Expand Up @@ -81,6 +76,9 @@ public void onListItemClick(ListView l, View v, int position, long id)
{
ActivityEntry item = (ActivityEntry) l.getItemAtPosition(position);

if (item.getType() != null && item.getType().startsWith(ActivityEventAdapter.PREFIX_DATALIST)
|| item.getType().startsWith(ActivityEventAdapter.PREFIX_FOLDER)) { return; }

// Inconsistency between cloud and on premise.
String identifier = item.getData(CloudConstant.NODEREF_VALUE);
if (identifier == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.alfresco.mobile.android.application.fragments.actions.NodeActions.onFinishModeListerner;
import org.alfresco.mobile.android.application.intent.IntentIntegrator;
import org.alfresco.mobile.android.application.manager.ActionManager;
import org.alfresco.mobile.android.application.utils.AndroidVersion;
import org.alfresco.mobile.android.application.utils.SessionUtils;
import org.alfresco.mobile.android.intent.PublicIntent;
import org.alfresco.mobile.android.ui.documentfolder.NavigationFragment;
Expand Down Expand Up @@ -479,8 +480,13 @@ public static void getMenu(AlfrescoSession session, Menu menu, Folder parentFold

devCaptureMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_PHOTO, Menu.FIRST
+ MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_PHOTO, R.string.take_photo);
devCaptureMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_VIDEO, Menu.FIRST
+ MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_VIDEO, R.string.make_video);

if (AndroidVersion.isICSOrAbove())
{
devCaptureMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_VIDEO, Menu.FIRST
+ MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_VIDEO, R.string.make_video);
}

devCaptureMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_MIC_AUDIO, Menu.FIRST
+ MenuActionItem.MENU_DEVICE_CAPTURE_MIC_AUDIO, R.string.record_audio);
devCaptureMenu.add(Menu.NONE, MenuActionItem.MENU_UPLOAD, Menu.FIRST + MenuActionItem.MENU_UPLOAD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DialogFragment;
import android.app.Fragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
Expand Down Expand Up @@ -453,9 +454,15 @@ public void onClick(DialogInterface dialog, int item)
{
UpdateContentCallback up = new UpdateContentCallback(alfSession, getActivity(),
(Document) node, dlFile);
up.setOnUpdateListener(listener);
getLoaderManager().initLoader(UpdateContentLoader.ID, null, up);
getLoaderManager().getLoader(UpdateContentLoader.ID).forceLoad();
up.setOnUpdateListener(updateListener);
if (getLoaderManager().getLoader(UpdateContentLoader.ID) == null)
{
getLoaderManager().initLoader(UpdateContentLoader.ID, null, up);
}
else
{
getLoaderManager().restartLoader(UpdateContentLoader.ID, null, up);
}
dialog.dismiss();
}
});
Expand All @@ -479,9 +486,15 @@ public void onClick(DialogInterface dialog, int item)
File f = new File(ActionManager.getPath(getActivity(), data.getData()));
UpdateContentCallback up = new UpdateContentCallback(alfSession, getActivity(),
(Document) node, f);
up.setOnUpdateListener(listener);
getLoaderManager().initLoader(UpdateContentLoader.ID, null, up);
getLoaderManager().getLoader(UpdateContentLoader.ID).forceLoad();
up.setOnUpdateListener(updateListener);
if (getLoaderManager().getLoader(UpdateContentLoader.ID) == null)
{
getLoaderManager().initLoader(UpdateContentLoader.ID, null, up);
}
else
{
getLoaderManager().restartLoader(UpdateContentLoader.ID, null, up);
}
}
else
{
Expand All @@ -498,20 +511,9 @@ public void onClick(DialogInterface dialog, int item)
}
}

private OnNodeUpdateListener saveBackListener = new OnNodeUpdateListener()
private OnNodeUpdateListener updateListener = new OnNodeUpdateListener()
{
@Override
public void afterUpdate(Node node)
{
((MainActivity) getActivity()).setCurrentNode(node);
ActionManager.actionRefresh(DetailsFragment.this, IntentIntegrator.CATEGORY_REFRESH_ALL,
PublicIntent.NODE_TYPE);
MessengerManager.showToast(getActivity(),
node.getName() + " " + getResources().getString(R.string.save_back_sucess));
refreshThumbnail(node);
}

boolean hasWaiting = false;
public boolean hasWaiting = false;

@Override
public void beforeUpdate(Node node)
Expand All @@ -524,35 +526,25 @@ public void beforeUpdate(Node node)
}

@Override
public void onExeceptionDuringUpdate(Exception e)
public void afterUpdate(Node node)
{
ActionManager.actionDisplayError(DetailsFragment.this, e);
}
};

private OnNodeUpdateListener listener = new OnNodeUpdateListener()
{
public boolean hasWaiting = false;

@Override
public void beforeUpdate(Node node)
{
if (!hasWaiting && getFragmentManager().findFragmentByTag(WaitingDialogFragment.TAG) == null)
DetailsFragment lf = (DetailsFragment) getFragmentManager().findFragmentByTag(DetailsFragment.TAG);
if (lf != null)
{
new WaitingDialogFragment().show(getFragmentManager(), WaitingDialogFragment.TAG);
Node n = (Node) lf.getArguments().get(ARGUMENT_NODE);
if (n != null
&& NodeRefUtils.getCleanIdentifier(n.getIdentifier()).equals(
NodeRefUtils.getCleanIdentifier(node.getIdentifier())))
{
((MainActivity) getActivity()).setCurrentNode(node);
ActionManager.actionRefresh(DetailsFragment.this, IntentIntegrator.CATEGORY_REFRESH_ALL,
PublicIntent.NODE_TYPE);
MessengerManager.showToast(getActivity(),
node.getName() + " " + getResources().getString(R.string.update_sucess));
refreshThumbnail(node);
}
}
hasWaiting = true;
}

@Override
public void afterUpdate(Node node)
{
((MainActivity) getActivity()).setCurrentNode(node);
ActionManager.actionRefresh(DetailsFragment.this, IntentIntegrator.CATEGORY_REFRESH_ALL,
PublicIntent.NODE_TYPE);
MessengerManager.showToast(getActivity(),
node.getName() + " " + getResources().getString(R.string.update_sucess));
refreshThumbnail(node);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,18 @@ public LoaderResult<Node> loadInBackground()
}
catch (Exception e)
{
Log.e(TAG, Log.getStackTraceString(e));
if (idpwc == null)
{
idpwc = cmisDoc.checkOut().getId();
try
{
idpwc = cmisDoc.checkOut().getId();
}
catch (Exception ee)
{
Log.e(TAG, Log.getStackTraceString(ee));
throw ee;
}
}
}

Expand All @@ -124,14 +133,7 @@ public LoaderResult<Node> loadInBackground()

resultNode = (Document) session.getServiceRegistry().getDocumentFolderService()
.getNodeByIdentifier(cmisDoc.getId());

/*
* resultNode =
* session.getServiceRegistry().getDocumentFolderService()
* .updateContent(document, contentFile);
*/
}

}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ public void onCancel(DialogInterface dialog)
});

if (session != null)
{
return new NodeLoader(activity, session, url);
}
else
{
return new NodeLoader(activity, accounts, url);
}
}

@Override
Expand Down

0 comments on commit ca1436a

Please sign in to comment.