public class Step
extends java.lang.Object
implements java.io.Serializable
ViewTaskActivity
object. Each Step object represents one logical
piece of data entry or activity in a larger task.
A step can be a question, an active test, or a simple instruction. An Step subclass is usually
paired with an StepLayout
subclass that
displays the step.
To use a step, instantiate an Step object and populate its properties. Add the step to a task,
such as an OrderedTask
object, and then present the task
using a ViewTaskActivity.
To implement a new type of step, subclass Step and add your additional properties. Separately, subclass StepLayout and implement your user interface.
Constructor and Description |
---|
Step(java.lang.String identifier)
Returns a new step initialized with the specified identifier.
|
Step(java.lang.String identifier,
java.lang.String title)
Returns a new step initialized with the specified identifier and title.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getIdentifier()
A short string that uniquely identifies the step within the task.
|
java.lang.Class |
getStepLayoutClass()
Returns the class that the
ViewTaskActivity should
instantiate to display this step. |
int |
getStepTitle()
Gets the int id for the title to display in the action bar (optional).
|
java.lang.String |
getText()
Additional text to display for the step in a localized string.
|
java.lang.String |
getTitle()
The primary text to display for the step in a localized string.
|
boolean |
isOptional()
A boolean value indicating whether the user can skip the step without providing an answer.
|
void |
setOptional(boolean optional)
Sets whether the step is skippable
|
void |
setStepLayoutClass(java.lang.Class stepLayoutClass)
Sets the class that should be used to display this step
|
void |
setStepTitle(int stepTitle)
Gets the int id for the title to display in the action bar (optional).
|
void |
setText(java.lang.String text)
Sets the additional text for the step.
|
void |
setTitle(java.lang.String title)
Sets the primary text to display for the step in a localized string.
|
public Step(java.lang.String identifier)
identifier
- The unique identifier of the step.public Step(java.lang.String identifier, java.lang.String title)
identifier
- The unique identifier of the step.title
- The primary text to display for this step.public java.lang.String getIdentifier()
The identifier is reproduced in the results of a step. In fact, the only way to link a result
(a StepResult
object) to the step that generated it
is to look at the value of identifier
. To accurately identify step results, you
need to ensure that step identifiers are unique within each task.
In some cases, it can be useful to link the step identifier to a unique identifier in a database; in other cases, it can make sense to make the identifier human readable.
public boolean isOptional()
The default value of this property is true
. When the value is
false
, the Skip button does not appear on this step.
This property may not be meaningful for all steps; for example, an active step might not provide a way to skip, because it requires a timer to finish.
public void setOptional(boolean optional)
optional
- isOptional()
public java.lang.String getTitle()
This text is also used as the label when a step is shown in the more compact version in a
FormStep
.
public void setTitle(java.lang.String title)
title
- the primary text for the question.getTitle()
public java.lang.String getText()
The additional text is displayed in a smaller font below title
. If you need to
display a long question, it can work well to keep the title short and put the additional
content in the text
property.
public void setText(java.lang.String text)
text
- the detail text for the stepgetText()
public int getStepTitle()
public void setStepTitle(int stepTitle)
stepTitle
- the Android resource id for the titlepublic java.lang.Class getStepLayoutClass()
ViewTaskActivity
should
instantiate to display this step.
This method is used within the framework so that steps can define their step view controller pairing.
Outside the framework, developers should instantiate the required view controller in their ViewTaskActivity delegate to override the ViewTaskActivity's default.
StepLayout
for
this steppublic void setStepLayoutClass(java.lang.Class stepLayoutClass)
stepLayoutClass
- the StepLayout
class
to be used to display this step