{"id":3468,"url":"https://github.com/dkharrat/NexusDialog","last_synced_at":"2025-08-03T20:32:26.683Z","repository":{"id":12226032,"uuid":"14835268","full_name":"dkharrat/NexusDialog","owner":"dkharrat","description":"Library that allows you to easily and quickly create forms in Android with little code","archived":false,"fork":false,"pushed_at":"2018-04-29T21:07:29.000Z","size":775,"stargazers_count":183,"open_issues_count":18,"forks_count":52,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-08-16T14:34:33.267Z","etag":null,"topics":["android","form-builder","form-controls","ui"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dkharrat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-01T07:35:37.000Z","updated_at":"2024-04-13T02:52:39.000Z","dependencies_parsed_at":"2022-08-07T06:16:48.989Z","dependency_job_id":null,"html_url":"https://github.com/dkharrat/NexusDialog","commit_stats":null,"previous_names":["dkharrat/nexus-dialog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkharrat%2FNexusDialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkharrat%2FNexusDialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkharrat%2FNexusDialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkharrat%2FNexusDialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkharrat","download_url":"https://codeload.github.com/dkharrat/NexusDialog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228567009,"owners_count":17937983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","form-builder","form-controls","ui"],"created_at":"2024-01-05T20:16:42.357Z","updated_at":"2024-12-07T05:30:30.848Z","avatar_url":"https://github.com/dkharrat.png","language":"Java","funding_links":[],"categories":["Libraries","库"],"sub_categories":["GUI","[](https://github.com/JStumpp/awesome-android/blob/master/readme.md#gui)GUI"],"readme":"NexusDialog\n===========\n**Simple Form Generator for Android**\n\nNexusDialog is a library that allows you to dynamically generate forms in Android with little code. It's great\nfor apps with many form-based UIs, since it reduces the boilerplate code to setup the view layout and tie things\ntogether in the Activity. Currently, it supports Android API 10+.\n\nThis library follows [semantic versioning](http://semver.org/). Note that since this library is still active in\ndevelopment, new releases might introduce interface-breaking changes, which will be indicated in the changelog.\nNexusDialog 1.0.0 will be the first stable release.\n\nA Simple Example\n----------------\nTo give you an idea of the simplicity of NexusDialog, here's a screenshot of a simple example:\n\n![screenshot](http://dkharrat.github.io/NexusDialog/images/screenshot01.png \"NexusDialog Screenshot\")\n\nHere's the code for that example (less than 7 lines of real code!):\n\n    import java.util.Arrays;\n    import com.github.dkharrat.nexusdialog.FormActivity;\n    import com.github.dkharrat.nexusdialog.controllers.*;\n\n    public class SimpleExample extends FormActivity {\n\n        @Override protected void initForm() {\n            setTitle(\"Simple Example\");\n\n            FormSectionController section = new FormSectionController(this, \"Personal Info\");\n            section.addElement(new EditTextController(this, \"firstName\", \"First name\"));\n            section.addElement(new EditTextController(this, \"lastName\", \"Last name\"));\n            section.addElement(new SelectionController(this, \"gender\", \"Gender\", true, \"Select\", Arrays.asList(\"Male\", \"Female\"), true));\n\n            getFormController().addSection(section);\n        }\n    }\n\nFor more examples, browse the [sample](http://github.com/dkharrat/NexusDialog/tree/master/sample) directory.\n\nFeatures\n--------\nNexusDialog supports many built-in fields for your form, like text boxes, date pickers, spinners, etc. The framework is\nalso designed to be extensible so that you can easily add custom form elements if needed. Contributions are also\nwelcome! If you've implemented a custom control that is useful, pull requests are welcome and appreciated! Currently,\nthe following form elements are supported:\n\n* `ValueController`: Shows a TextView containing a value\n* `EditTextController`: EditText view that allows for free-form text input.\n* `CheckBoxController`: CheckBox view that allows for two-states: either checked or unchecked.\n* `DatePickerController`: Displays a date picker to allow choosing a specific date\n* `TimePickerController`: Displays a time picker to allow choosing a specific time\n* `SelectionController`: Displays a spinner with a list of item to select from\n* `SearchableSelectionController`: Displays a (typically large) list of items to select from, with the ability to\n    search the list and also allow free-form text.\n\nApps Using NexusDialog\n----------------------\nDo you have an app that's utilizing NexusDialog? [Let me know](mailto:dkharrat@gmail.com) and I'll add a link to it here!\n\nHow to Add NexusDialog to Your Project\n--------------------------------------\nThere are multiple ways to include your project, depending on your build environment:\n\n#### Gradle\n\nAdd the following dependency to your build.gradle file for your project:\n\n    dependencies {\n      compile 'com.github.dkharrat.nexusdialog:nexusdialog:0.4.2'\n    }\n\nMake sure your application is using the Android SDK v23 or later in your build.gradle file:\n\n    android {\n        compileSdkVersion 23\n        buildToolsVersion \"23\"\n        ...\n    }\n\n#### Maven\n\nAdd the following dependency to your pom.xml file for your project (requires android-maven-plugin 3.8.0+):\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.dkharrat.nexusdialog\u003c/groupId\u003e\n        \u003cartifactId\u003enexusdialog\u003c/artifactId\u003e\n        \u003cversion\u003e0.4.2\u003c/version\u003e\n        \u003ctype\u003eaar\u003c/type\u003e\n    \u003c/dependency\u003e\n\n#### Android Studio or IntelliJ 13+\n\nAdd the appropriate dependency in your build.gradle file and refresh your project.\n\nHow to Use NexusDialog\n----------------------\nOnce NexusDialog is setup as a dependency in your project (by following the instructions above), you can start creating\nforms right away! The main classes you will be working with the most are:\n\n* `FormActivity` or `FormActivityWithActionBar`: If you wish to use the default Activity implementation for NexusDialog,\n  this is the base class for each activity you wish to display a form in. Your activity must inherit from it. Form setup\n  is done in the `initForm()` method.\n\n* `FormController`: This is the main class that manages the form elements of NexusDialog. It provides simple APIs to\n  quickly create and manage form fields. `FormActivity` creates this class for you, or you can be create one manually\n  for custom Activities.\n\n* `FormElementController`: Although you will not be using this class directly, you will be using its subclasses. All\n  form elements (text boxes, labels, sections, etc.) inherit from this base class, which provides them common\n  functionality and properties they need. Also, you could use `FormSectionController` to group a set of form fields\n  together.\n\n* `FormModel`: This class abstracts the data model your form will use. It's the interface that NexusDialog uses to\n  access and update the underlying data model the form is based on. A `FormActivity` uses it to initialize the field\n  values to the desired values when its first displayed, as well as update the underlying model when values change in\n  the UI. `FromActivity` uses a default generic `FormModel` based on a key-value store that is usually sufficient for\n  most use cases. However, if you need more control over how the form data is retrieved and stored, you can provide your\n  custom implementation (via `FormActivity#setModel`).\n\n#### Add some fields grouped by section\n\n    public class RegistrationForm extends FormActivity {\n        @Override protected void initForm() {\n            setTitle(\"Register Account\");\n\n            FormSectionController section1 = new FormSectionController(this, \"Personal Info\");\n            section1.addElement(new EditTextController(this, \"firstName\", \"First name\"));\n            section1.addElement(new EditTextController(this, \"lastName\", \"Last name\"));\n            getFormController().addSection(section1);\n\n            FormSectionController section2 = new FormSectionController(this, \"Account\");\n            section2.addElement(new EditTextController(this, \"username\", \"Username\"));\n            section2.addElement(new EditTextController(this, \"password\", \"Password\") {{\n                setSecureEntry(true);\n            }});\n            getFormController().addSection(section2);\n        }\n    }\n\n#### Initialize fields to certain values when the form is first displayed\n\n    @Override protected void initForm() {\n        // form setup\n        // ...\n\n        getModel().setValue(\"firstName\", \"John\");\n        getModel().setValue(\"lastName\", \"Smith\");\n    }\n\n#### To retrieve the current field value at any time:\n\n    getModel().getValue(\"firstName\");\n\n#### Listen to changes in fields:\n\n    getModel().addPropertyChangeListener(\"firstName\", new PropertyChangeListener() {\n        @Override public void propertyChange(PropertyChangeEvent event) {\n            LOG.i(\"tag\", \"Value was: \" + event.getOldValue() + \", now: \" + event.getNewValue());\n        }\n    });\n\nPlease browse through the samples included with the project for examples on how NexusDialog can be used.\n\nDocumentation\n-------------\nSee the current [Javadoc](http://dkharrat.github.io/NexusDialog/javadoc/).\n\nStyling\n-------\nTODO\n\nAdding Custom Elements\n----------------------\nIf the built-in form controls provided by NexusDialog don't meet your needs, you can easily extend NexusDialog to\nprovide custom form elements. The common parent class for all form elements is `FormElementController`. Among other\nthings, `FormElementController` tells NexusDialog how to construct the view to display in the form.\n\nTypically your custom element falls under one of these cases:\n\n1. Your custom element needs to show a label before a custom field: in this case, consider inheriting from\n   `LabeledFieldController` which can provide the label functionality for you.\n\n2. Your custom element needs full customization for how it's displayed: in this case, inherit from\n   `FormElementController` and implement the `createView` method to tell NexusDialog how to create the custom view.\n\nBrowse through the _catalog_ sample for an example of implementing a custom element, or go over the code for the\nbuilt-in form elements to get an idea how they work.\n\nPlanned Features\n----------------\nThe framework is constantly being improved and new features are being implemented. The following improvements are\nplanned:\n\n* Support buttons\n* Support sliders\n\nContributing\n------------\nContributions via pull requests are welcome! For suggestions, feedback, or feature requests, please submit an issue.\n\nAuthor\n------\nDia Kharrat - dkharrat@gmail.com\u003cbr/\u003e\nTwitter: [http://twitter.com/dkharrat](http://twitter.com/dkharrat)\n\nLicense\n-------\n    Copyright 2013 Dia Kharrat\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkharrat%2FNexusDialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkharrat%2FNexusDialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkharrat%2FNexusDialog/lists"}