Skip to content

alenkart/guacamole

Repository files navigation

Guacamole

Guacamole is a library to build forms dynamically in android.

Components Demo

alt text

Each of the components has the following properties: icon, title, and subTitle.

Title

val titleText = TitlePreference("title")
titleText.title = "Text"

Text

Creates a single line text editor in alert.

val titlePref = TextPreference("titlePref")
titlePref.title = "Title"
titlePref.subTitle = "Lorem Ipsum"

Description

Creates a multi line text editor.

val descriptionPref = DescriptionPreference("descriptionPref")
descriptionPref.title = "Description"
descriptionPref.subTitle = "Lorem Ipsum"

Description

Creates a multi line text editor.

val descriptionPref = DescriptionPreference("descriptionPref")
descriptionPref.title = "Description"
descriptionPref.subTitle = "Lorem Ipsum"

Single choice list

val categoryPref = SingleListPreference("categoryPref")
categoryPref.itemList = arrayOf("A", "B", "C", "D", "E", "F", "G")
categoryPref.title = "Category"
categoryPref.alertButton = "Save"
categoryPref.selectedItem = 3

Multi choice list

val weeksPref = MultiListPreference("categoryPref")
weeksPref.title = "Working days"
weeksPref.alertButton = "Save"
weeksPref.itemList = hashMapOf(
    "Monday" to true,
    "Tuesday" to true,
    "Wednesday" to false,
    "Thursday" to false,
    "Friday" to false,
    "Saturday" to true,
    "Saturday" to false,
    "Sunday" to true
)

Date Picker

val datePickerPref = DatePickerPreference("datePickerPref")
datePickerPref.title = "Date"
datePickerPref.year = 1995
datePickerPref.month = 1
datePickerPref.month = 25

Time Picker

val fromTimePickerPref = TimePickerPreference("timePickerPref")
fromTimePickerPref.title = "From"
fromTimePickerPref.hours = 22
fromTimePickerPref.minutes = 22

Switch

val statusPref =  SwitchPreference("statusPref")
statusPref.title = "Status"
statusPref.subTitle = "Lorem Ipsum"
statusPref.statusOff = "Inactive"
statusPref.statusOn = "Active"

CheckBox

val checkPref =  CheckBoxPreference("statusPref")
checkPref.title = "Status"
checkPref.subTitle = "Lorem Ipsum"