Additional UI Frameworks

Android SDK Integration

Updated: October 16, 2020

The Nuxeo Android SDK tries, as much as possible, to expose Nuxeo services in a natural Android way. The idea is that the SDK should it's features via standard Android concepts and patterns.

DocumentsListAdapter

DocumentsListAdapter is a dedicated implementation of the standard Android interface ListAdapter. It allows to bind an Android ListView to a LazyDocumentsList.


// get the document list
LazyDocumentsList documentsList = getDocumentList(data);

// define the mapping between document attributes and widgets
Map<Integer, String> mapping = new HashMap<Integer,String>();
mapping.put(R.id.title_entry, "dc:title");
mapping.put(R.id.status_entry, "status");
mapping.put(R.id.iconView, "iconUri");
mapping.put(R.id.description, "dc:description");
mapping.put(R.id.id_entry, "uuid");

// create the adapter passing it the list, the mapping and the layout
DocumentsListAdapter adapter = new DocumentsListAdapter(this, documentsList, R.layout.list_item, mapping, R.layout.list_item_loading);

// bind to the ListView
listView.setAdapter(adapter);

Starting from there you can use your Nuxeo doculent list like any simple list. The documents list will be fetched and refreshed automaticaly as needed.

If scrolling goes faster than fetching from the server, a waiting item will be displayed with a specific layout ( R.layout.list_item_loading in the above exemple).

ContentProvider

Nuxeo's SDK try to expose as much as possible of the content via the Android ContentProvider system.

The provider authority is nuxeo and depending on the requested URI content, the call will be directed to a nuxeo service. Basically :

URI pattern Target Content
content://nuxeo/documents returns all documents of the repository via an Android Cursor
content://nuxeo/documents/<UUID> access to document with given UUID
   
content://nuxeo/<providername> Android cursor documents in the given provider
content://nuxeo/<providername>/UUID access to document with UUID in the given provider
   
content://nuxeo/icons/<subPath> download and cache icon of the given sub path
content://nuxeo/blobs/<UUID> download and cache the main blob of the doc with the given UUID
content://nuxeo/blobs/<UUID>/<idx> download and cache the blob of the doc with the given UUID
content://nuxeo/blobs/<UUID>/<subPath> download and cache the blob contained in the field of the doc with the given UUID

This ContentProvider allows :

  • to easily bind Nuxeo resources (like images) to Androids Views (like an ImageView)
  • to easily use Nuxeo content from an external application
    • Interprocess marshaling is handled by the ContentProvider system
    • you don't need to depend on Nuxeo API

Event system

Android built-in event system is used by the SDK to notify for :

  • Network status changes: when the Nuxeo server becomes reachable or when offline mode is required

  • Configuration changes : when the settings of the NuxeoAutomationClient have been changed

  • Document events : A notification is sent for Create/Update/Delete operations on LazyDocumentsLists (with 3 states Local, Server, Failed)

Service binding

TBD