{"id":18995836,"url":"https://github.com/mars885/value-picker","last_synced_at":"2025-04-10T00:06:29.518Z","repository":{"id":52162899,"uuid":"287747523","full_name":"mars885/value-picker","owner":"mars885","description":"An Android library that provides a simple and customizable ValuePicker.","archived":false,"fork":false,"pushed_at":"2025-02-20T19:37:58.000Z","size":596,"stargazers_count":53,"open_issues_count":1,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T00:06:21.051Z","etag":null,"topics":["android","android-library","android-pickers","android-pickerview"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/mars885.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":"2020-08-15T13:01:59.000Z","updated_at":"2025-02-20T19:38:01.000Z","dependencies_parsed_at":"2024-08-18T11:07:59.921Z","dependency_job_id":null,"html_url":"https://github.com/mars885/value-picker","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars885%2Fvalue-picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars885%2Fvalue-picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars885%2Fvalue-picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mars885%2Fvalue-picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mars885","download_url":"https://codeload.github.com/mars885/value-picker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131318,"owners_count":21052819,"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","android-library","android-pickers","android-pickerview"],"created_at":"2024-11-08T17:33:02.756Z","updated_at":"2025-04-10T00:06:29.488Z","avatar_url":"https://github.com/mars885.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ValuePicker\nAn Android library that provides a simple and customizable ValuePicker.\n\n![](https://img.shields.io/badge/API-21%2B-orange.svg?style=flat)\n[![Platform](https://img.shields.io/badge/platform-Android-green.svg)](http://developer.android.com/index.html)\n[![Download](https://img.shields.io/maven-central/v/com.paulrybitskyi.valuepicker/valuepicker.svg?label=Download)](https://search.maven.org/search?q=com.paulrybitskyi.valuepicker)\n[![Build](https://github.com/mars885/value-picker/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/mars885/value-picker/actions)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ValuePicker-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/8212)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n## Contents\n\n* [Demo](#demo-youtube)\n* [Installation](#installation)\n* [Usage](#usage)\n* [Advanced Usage](#advanced-usage)\n* [License](#license)\n\n## Demo (YouTube)\n\n\u003ca href=\"https://www.youtube.com/watch?v=qzoZh3aYlcY\"\u003e\n\u003cimg src=\"/media/demo_thumbnail.png\" width=\"200\" height=\"422\"/\u003e\n\u003c/a\u003e\n\n## Installation\n\n1. Make sure that you've added the `mavenCentral()` repository to your top-level `build.gradle` file.\n\n````groovy\nbuildscript {\n    //...\n    repositories {\n        //...\n        mavenCentral()\n    }\n    //...\n}\n````\n\n2. Add the library dependency to your module-level `build.gradle` file.\n\n````groovy\ndependencies {\n    //...\n    implementation \"com.paulrybitskyi.valuepicker:valuepicker:1.0.3\"\n    //...\n}\n````\n\n## Usage\nBasic usage of the ValuePickerView involves two steps - declaring a widget inside the XML file of your choice and configuring it in one of the Kotlin/Java classes.\n\nLet's see how we can do that by following the steps listed above:\n\n1. Declaring a widget inside the XML file.\n\n    \u003cdetails\u003e\u003csummary\u003e\u003cb\u003eXML (click to expand)\u003c/b\u003e\u003c/summary\u003e\n    \u003cp\u003e\n\n    ````xml\n    \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n    \u003candroidx.constraintlayout.widget.ConstraintLayout\n        xmlns:android=\"http://schemas.android.com/apk/res/android\"\n        xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:background=\"@color/colorPrimary\"\u003e\n\n        \u003c!-- Other widgets here --\u003e\n\n        \u003ccom.paulrybitskyi.valuepicker.ValuePickerView\n            android:id=\"@+id/valuePickerView\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"wrap_content\"\n            app:vpv_areDividersEnabled=\"true\"\n            app:vpv_isInfiniteScrollEnabled=\"true\"\n            app:vpv_maxVisibleItems=\"5\"\n            app:vpv_textColor=\"@color/colorAccent\"\n            app:vpv_dividerColor=\"@color/colorAccent\"\n            app:vpv_flingSpeedFactor=\"0.3\"\n            app:vpv_textSize=\"@dimen/date_picker_text_size\"\n            app:vpv_textTypeface=\"@font/ubuntu_mono_bold\"\n            app:vpv_divider=\"@drawable/custom_divider\"\n            app:vpv_orientation=\"vertical\"/\u003e\n\n    \u003c/androidx.constraintlayout.widget.ConstraintLayout\u003e\n    ````\n    \u003c/p\u003e\u003c/details\u003e\n\n2. Configuring the widget in one of the Kotlin/Java classes.\n\n    \u003cdetails\u003e\u003csummary\u003e\u003cb\u003eKotlin (click to expand)\u003c/b\u003e\u003c/summary\u003e\n    \u003cp\u003e\n\n    ````kotlin\n    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {\n        super.onViewCreated(view, savedInstanceState)\n\n        //...\n\n        with(valuePickerView) {\n            onItemSelectedListener = ValuePickerView.OnItemSelectedListener { item -\u003e\n                // Do something with item\n            }\n\n            val pickerItems = getPickerItems()\n\n            items = pickerItems\n            setSelectedItem(pickerItems[2])\n        }\n    }\n\n\n    private fun getPickerItems(): List\u003cItem\u003e {\n        return buildList {\n            for(number in 1..100) {\n                add(\n                    PickerItem(\n                        id = number,\n                        title = number.toString()\n                    )\n                )\n            }\n        }\n    }\n    ````\n\n    \u003c/p\u003e\u003c/details\u003e\n\n    \u003cdetails\u003e\u003csummary\u003e\u003cb\u003eJava (click to expand)\u003c/b\u003e\u003c/summary\u003e\n    \u003cp\u003e\n\n    ````java\n    @Override\n    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {\n        super.onViewCreated(view, savedInstanceState);\n\n        ValuePickerView valuePickerView = view.findViewById(R.id.valuePickerView);\n        valuePickerView.setOnItemSelectedListener((item) -\u003e {\n            // Do something with item\n        });\n\n        final ArrayList\u003cItem\u003e pickerItems = getPickerItems();\n\n        valuePickerView.setItems(getPickerItems());\n        valuePickerView.setSelectedItem(pickerItems.get(2));\n    }\n\n\n    private ArrayList\u003cItem\u003e getPickerItems() {\n        final ArrayList\u003cItem\u003e pickerItems = new ArrayList\u003c\u003e(100);\n\n        for(int i = 1; i \u003c= 100; i++) {\n            pickerItems.add(\n                new PickerItem(\n                    i,\n                    String.valueOf(i)\n                )\n            );\n        }\n\n        return pickerItems;\n    }\n    ````\n\n    \u003c/p\u003e\u003c/details\u003e\n\n## Advanced Usage\n\nSee the [Sample app](https://github.com/mars885/value-picker/tree/master/sample/src/main/java/com/paulrybitskyi/valuepicker/sample).\n\n## License\n\nValuePicker is licensed under the [Apache 2.0 License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmars885%2Fvalue-picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmars885%2Fvalue-picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmars885%2Fvalue-picker/lists"}