{"id":21524101,"url":"https://github.com/iamriajul/onlinespinner","last_synced_at":"2025-03-17T17:46:00.917Z","repository":{"id":130558939,"uuid":"144441985","full_name":"iamriajul/OnlineSpinner","owner":"iamriajul","description":"OnlineSpinnerView Android library to help you with Loading data into Spinner from server/online, with Support of Search, Default Value Selection, Loading callback.","archived":false,"fork":false,"pushed_at":"2018-11-06T03:46:15.000Z","size":169,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T05:11:25.218Z","etag":null,"topics":["android-library","android-view","online-spinner","select2","select2-android","spinner"],"latest_commit_sha":null,"homepage":"","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/iamriajul.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-12T06:00:51.000Z","updated_at":"2019-11-27T00:53:37.000Z","dependencies_parsed_at":"2023-04-01T07:34:31.185Z","dependency_job_id":null,"html_url":"https://github.com/iamriajul/OnlineSpinner","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamriajul%2FOnlineSpinner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamriajul%2FOnlineSpinner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamriajul%2FOnlineSpinner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamriajul%2FOnlineSpinner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamriajul","download_url":"https://codeload.github.com/iamriajul/OnlineSpinner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244082481,"owners_count":20395279,"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-library","android-view","online-spinner","select2","select2-android","spinner"],"created_at":"2024-11-24T01:20:51.951Z","updated_at":"2025-03-17T17:46:00.894Z","avatar_url":"https://github.com/iamriajul.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://jitpack.io/v/iamriajul/OnlineSpinner.svg)](https://jitpack.io/#iamriajul/OnlineSpinner)\n\n# OnlineSpinnerView\n\nhelp you to implement Spinner view with Online Data support + Searchable + callback and more.\n\nThis Library was Inspired by the [Select2](https://select2.org) web library.\n\nUsage:\n---\n\nlayout:\n\nSearchable\n---\n```xml\n\u003cio.github.iamriajul.onlinespinner.OnlineSpinner\n    android:id=\"@+id/example\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    app:hint=\"Example hint\"\n    app:title=\"Select a Example\" /\u003e\n```\n\nNot Searchable\n---\n```xml\n\u003cio.github.iamriajul.onlinespinner.OnlineSpinner\n    android:id=\"@+id/example2\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    app:hint=\"Example2 hint\"\n    app:isSearchable=\"false\" /\u003e\n```\ncode:\n\nYour api url must return json, with id, second_column (second_column can be custom specified when using load method or you can leave null to detect automatically) field like this  \n```json\n[\n    {\"id\":\"0\", \"second_column\":\"Item 1\"},\n    {\"id\":\"1\", \"second_column\":\"Item 2\"},\n    {\"id\":\"2\", \"second_column\":\"Item 3\"}\n]\n```\n####**If you have have multiple column in a row like this**\n ```json\n [\n     {\"id\":\"0\", \"timestamp\":\"1534216256\", \"lang\": \"Arabic\"},\n     {\"id\":\"1\", \"timestamp\":\"1534216256\", \"lang\": \"English\"},\n     {\"id\":\"2\", \"timestamp\":\"1534216256\", \"lang\": \"Bengali\"}\n ]\n ```\n#####**Then you can specify which column to use in user interface, like this: **\n```kotlin\nexample2.load(this, \"http://example.com/language/all\", 0, \"lang\") // custom specified column name and selected is Arabic\n```\n\nYour Activity or Fragment must `ActivityWithOnlineSpinner` interface.\n\nKotlin\n======\nLoading Data\n---\n```kotlin\nshowLoader()\n// Change dataUrl with your real data url\nexample.load(this, \"http://example.com/country/all\", 5)\nexample2.load(this, \"http://example.com/language/all\", 0, \"lang\") // custom specified column name\n// It will call hideLoader when all spinner successfully loaded with data.\n```\n\nGetting Selected Item Id (Example On Submit Handle)\n---\n```kotlin\nsubmitBtn.setOnClickListener{\n    val exampleId: Int = example.getSelectedItemId()\n    val example2Id: Int = example2.getSelectedItemId(\"lang\")\n    // Here is your data, You can process this data as you want.\n}\n```\n\nSelection Change Listener with Lambda\n---\n```kotlin\nexample.setOnItemSelectedListener { id, item -\u003e \n    \n}\n```\n\nSelection Change Listener without Lambda\n---\n```kotlin\nexample.setOnItemSelectedListener(object : AdapterView.OnItemSelectedListener {\n    override fun onNothingSelected(parent: AdapterView\u003c*\u003e?) {\n        TODO(\"not implemented\") //To change body of created functions use File | Settings | File Templates.\n    }\n\n    override fun onItemSelected(parent: AdapterView\u003c*\u003e?, view: View?, position: Int, id: Long) {\n        TODO(\"not implemented\") //To change body of created functions use File | Settings | File Templates.\n    }\n})\n```\n\nImplementing Callback\n---\n```kotlin\noverride var totalFieldsCount: Int = 2 // Total OnlineSpinner fields in this activity is using\noverride var fieldsLoaded: Int = 0 // it should be 0\n\noverride fun hideLoader() {\n    // Hide loading animation, or anything you want.\n}\n\noverride fun showLoader() {\n    // Show loading animation, or anything you want.\n}\n\n// Optional Callback // this is same as hideLoader()\noverride fun onOnlineSpinnerCompleted() {\n    // Loading other text fields\n}\n\n```\n\nJava\n======\n```java\nshowLoader()\nOnlineSpinner example = (OnlineSpinner) findViewById(R.id.example);\nOnlineSpinner example2 = (OnlineSpinner) findViewById(R.id.example2);\n// Change dataUrl with your real data url\nexample.load(this, \"http://example.com/country/all\", 5)\nexample2.load(this, \"http://example.com/language/all\", 3, \"lang\") // custom specified column name\n// It will call hideLoader when all spinner successfully loaded with data.\n```\n\nFields\n======================\nName | Type | Description\n--- | --- | ---\n`totalFieldsCount` | Integer | Count of OnlineSpinner in your current Activity, this field is to help the library to detect if all Spinner loaded or not to trigger `hideLoader()`\n`fieldsLoaded` | Integer | This field should be init with 0, It will be incremented by the Library with each OnlineSpinner loaded.\n\n\nMethods\n======================\nName | Description\n--- | ---\n`showLoader()` | Call this method once before start calling `OnlineSpinner.load()`\n`hideLoader()` | This method will be called by the Library when all the Spinner loading will complete successfully.\n`onOnlineSpinnerCompleted()` | (Optional Override) This method will be called by the Library when all the Spinner loading will complete successfully.\n\n\ndependency\n---\nAdd it in your root build.gradle at the end of repositories:\n\n```groovy\nallprojects {\n    repositories {\n\t// ...\n\tmaven { url 'https://jitpack.io' }\n    }\n}\n```\nadd dependency：\n\n```groovy\ndependencies {\n        implementation 'com.github.iamriajul:OnlineSpinner:2.0'\n}\n```\n\nThanks...","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamriajul%2Fonlinespinner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamriajul%2Fonlinespinner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamriajul%2Fonlinespinner/lists"}