Package eltos.simpledialogfragment.form
Class FormElement<T extends FormElement,V extends FormElementViewHolder>
java.lang.Object
eltos.simpledialogfragment.form.FormElement<T,V>
- All Implemented Interfaces:
android.os.Parcelable
public abstract class FormElement<T extends FormElement,V extends FormElementViewHolder>
extends Object
implements android.os.Parcelable
Base-class for form elements to be used with
SimpleFormDialog
Each form element holds a resultKey
that is used to receive element
specific results in SimpleFormDialog.onResult(int)
Created by eltos on 20.02.17.-
Nested Class Summary
-
Field Summary
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
ModifierConstructorDescriptionprotected
FormElement
(android.os.Parcel in) protected
FormElement
(String resultKey) -
Method Summary
Modifier and TypeMethodDescriptionabstract V
Return your custom implementation ofFormElementViewHolder
hereint
protected String
getText
(android.content.Context context) label
(int textResourceId) Sets the labelSets the labelrequired()
Mark this Field as required.required
(boolean required) Set the required flag for this field.void
writeToParcel
(android.os.Parcel dest, int flags)
-
Field Details
-
NO_ID
protected static final int NO_ID- See Also:
-
resultKey
-
required
protected boolean required
-
-
Constructor Details
-
FormElement
-
FormElement
protected FormElement(android.os.Parcel in)
-
-
Method Details
-
buildViewHolder
Return your custom implementation ofFormElementViewHolder
here- Returns:
- The view holder that can represent this form element
-
required
Mark this Field as required. Seerequired(boolean)
- Returns:
- this instance
-
required
Set the required flag for this field. This has different meanings depending on the element type Input fields will display an error message if their input is empty. Check fields will be required to be checked- Parameters:
required
- whether this field is required- Returns:
- this instance
-
label
Sets the label- Parameters:
text
- label text as string- Returns:
- this instance
-
label
Sets the label- Parameters:
textResourceId
- label text as android string resource- Returns:
- this instance
-
getText
-
describeContents
public int describeContents()- Specified by:
describeContents
in interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags) - Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-