Comment Add Screenlet for Android

Requirements

  • Android SDK 4.1 (API Level 16) or above
  • Liferay Portal 6.2 CE/EE, Liferay CE Portal 7.0/7.1, Liferay DXP 7.0+
  • Liferay Screens Compatibility app (CE or EE/DXP). This app is preinstalled in Liferay CE Portal 7.0/7.1 and Liferay DXP 7.0+.

Compatibility

  • Android SDK 4.1 (API Level 16) or above

Xamarin Requirements

  • Visual Studio 7.2
  • Mono .NET framework 5.4.1.6

Features

Comment Add Screenlet can add a comment to an asset in a Liferay instance.

JSON Services Used

Screenlets in Liferay Screens call JSON web services in the portal. This Screenlet calls the following services and methods.

ServiceMethodNotes
ScreenscommentService (Screens compatibility plugin)addComment

Module

  • None

Views

  • Default

The Default View uses Android’s EditText and Button elements to show an add comment dialog. Other Views may use different components to show this dialog.

Figure 1: Comment Add Screenlet using the Default View.

Figure 1: Comment Add Screenlet using the Default View.

Offline

This Screenlet supports offline mode so it can function without a network connection. For more information on how offline mode works, see the tutorial on its architecture. Here are the offline mode policies that you can use with this Screenlet:

PolicyWhat happensWhen to use
REMOTE_ONLYThe Screenlet sends the data to the Liferay instance. If a connection issue occurs, the Screenlet uses the listener to notify the developer about the error. If the Screenlet successfully sends the data, it also stores it in the local cache.Use this policy when you always need to send updated data, and send nothing when there’s no connection.
CACHE_ONLYThe Screenlet sends the data to the local cache. If an error occurs, the Screenlet uses the listener to notify the developer.Use this policy when you always need to store local data without sending remote information under any circumstance.
REMOTE_FIRSTThe Screenlet sends the data to the Liferay instance. If this succeeds, the Screenlet also stores the data in the local cache. If a connection issue occurs, the Screenlet stores the data to the local cache and sends it to the Liferay instance when the connection is restored. If an error occurs, the Screenlet uses the listener to notify the developer.Use this policy to send the most recent version of the data when connected, and store the data for later synchronization when there’s no connection.
CACHE_FIRSTThe Screenlet sends the data to the local cache, then sends it to the Liferay instance. If sending the data to the Liferay instance fails, the Screenlet still stores the data locally and then notifies the developer about any errors that occur (including connectivity errors).Use this policy to save bandwidth and store local (but possibly outdated) data.

Required Attributes

  • className
  • classPK

Attributes

AttributeData typeExplanation
layoutId@layoutThe layout to use to show the View.
classNamestringThe asset’s fully qualified class name. For example, a blog entry’s className is com.liferay.blogs.kernel.model.BlogsEntry. The className and classPK attributes are required to instantiate the Screenlet.
classPKnumberThe asset’s unique identifier. The className and classPK attributes are required to instantiate the Screenlet.
cachePolicystringThe offline mode setting. See the Offline section for details.

Listener

Comment Add Screenlet delegates some events to a class that implements CommentAddListener. This interface lets you implement the following methods:

  • onAddCommentSuccess(CommentEntry commentEntry): Called when the Screenlet successfully adds a comment to the asset.

  • error(Exception e, String userAction): Called when an error occurs in the process. The userAction argument distinguishes the specific action in which the error occurred.

« Comment Display Screenlet for AndroidAsset Display Screenlet for Android »
Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0