Android library to display a list of items for pick one

Related tags

UI/UX PickerUI
Overview

PickerUI

Android Arsenal Maven Central

Android library to display a list of items for pick one with blur effect (if you wish). Support for Android 3.0 and up. It supports portrait and landscape mode, saving the state.

Example screenshot

Try out the sample application on Google Play.

PickerUI Sample on Google Play

Demo

Example gif

Including in Your Project

Last version is 1.0.1

Just add the following statement in your build.gradle

compile 'com.github.davidpizarro:pickerui:VERSION'

You may also add the library as an Android Library to your project. All the library files live in library.

Usage

To add the PickerUI to your layout add this to your xml

<com.dpizarro.uipicker.library.picker.PickerUI
        android:id="@+id/picker_ui_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

You can add custom attributes in your xml to customize: background, colors, behaviors, elements, blur, blur effects...

<com.dpizarro.uipicker.library.picker.PickerUI
        android:id="@+id/picker_ui_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        pickerui:backgroundColor="#4cffa5"
        pickerui:linesCenterColor="#3941ff"
        pickerui:autoDismiss="true"
        pickerui:itemsClickables="true"
        pickerui:entries="@array/months"
        pickerui:textCenterColor="#000000"
        pickerui:textNoCenterColor="#737373"
        pickerui:blur="true"
        pickerui:blur_downScaleFactor="@integer/blur_downscale_min"
        pickerui:blur_FilterColor="#ff5e48"
        pickerui:blur_radius="@integer/blur_radius_min"
        pickerui:blur_use_renderscript="true"/>
        

Review attrs.xml file to know the list of shapes ready to be used in the library.

This configuration can be also provided programmatically. You can use PickerUI programatically, using the Builder class to set the settings and the desired functionalities of panel to make easy:

PickerUI mPickerUI = (PickerUI) findViewById(R.id.picker_ui_view);

List<String> options = Arrays.asList(getResources().getStringArray(R.array.months));

PickerUISettings pickerUISettings = new PickerUISettings.Builder()
                                                      .withItems(options)
                                                      .withBackgroundColor(getRandomColor())
                                                      .withAutoDismiss(true)
                                                      .withItemsClickables(false)
                                                      .withUseBlur(false)
                                                      .build();

mPickerUI.setSettings(pickerUISettings);

You can set/get values programatically:

mPickerUI.setItems(this, options);
mPickerUI.setColorTextCenter(R.color.background_picker);
mPickerUI.setColorTextNoCenter(R.color.background_picker);
mPickerUI.setBackgroundColorPanel(R.color.background_picker);
mPickerUI.setLinesColor(R.color.background_picker);
mPickerUI.setItemsClickables(false);
mPickerUI.setAutoDismiss(false);
mPickerUI.isPanelShown();

To slide (show/hide) PickerUI, you only have to use slide() method, selecting none (by default, center) or some position.

mPickerUI.slide();
//or
mPickerUI.slide(8);

In order to receive the value selected in the picker, you will need to implement the onItemClickPickerUI interface.

mPickerUI.setOnClickItemPickerUIListener(new PickerUI.PickerUIItemClickListener() {
                    @Override
                    public void onItemClickPickerUI(int which, int position, String valueResult) {
                        Toast.makeText(MainActivity.this, valueResult, Toast.LENGTH_SHORT).show();
                    }
                });

Or browse the source code of the sample application for a complete example of use.

Blur effect

This library applies a blur effect when you slide the picker, but it is optional and optimized. You can choose Java algorithm (slower) or RenderScript (a quick and efficient solution to blur images). Available since API 11 (Honeycomb), RenderScript allows to take advantage of the GPU acceleration and is targeted at high-performance 3D rendering and compute operations.

For the integration of the RenderScript support library you just have to add two lines to your build.gradle. You do not need to declare any dependencies. Depending on the gradle version you are running, the commands are slightly different:

1. Gradle version 0.14+ and newer

android {
    defaultConfig {
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
    }
}

2. Older Gradle versions up to 0.13

android {
  defaultConfig {
      renderscriptTargetApi 19
      renderscriptSupportMode true
  }
}

Contribution

Pull requests are welcome!

I'd like to improve this library with your help! If you've fixed a bug or have a feature you've added, just create a pull request. Issues can be reported on the github issue tracker.

Who's using it

Does your app use AutoLabelUI? If you want to be featured on this list drop me a line.

Author

David Pizarro ([email protected])

Follow me on Google+ Follow me on Twitter Follow me on LinkedIn

License

Copyright 2015 David Pizarro

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

You might also like...
An Android custom view to display digits rendered as dots in a grid, with a style like a 1970s LED clock.
An Android custom view to display digits rendered as dots in a grid, with a style like a 1970s LED clock.

#DotMatrixView This is an Android library project providing a custom view that can display things on a grid of dots. When the displayed value changes,

Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data.
Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data.

Android-ProgressFragment Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the init

Display code with syntax highlighting :sparkles: in native way.
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Sentinel is a simple one screen UI which provides a standardised entry point for tools used in development and QA alongside device, application and permissions data.
Sentinel is a simple one screen UI which provides a standardised entry point for tools used in development and QA alongside device, application and permissions data.

Sentinel Sentinel is a simple one screen UI that provides standardised entry point for tools used in development and QA alongside device, application

A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in Flutter.
A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in Flutter.

Red Screen Of Death What A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in

NeoPOP was created with one simple goal; to create the next generation of a beautiful, affirmative design system
NeoPOP was created with one simple goal; to create the next generation of a beautiful, affirmative design system

NeoPop is CRED's inbuilt library for using NeoPop components in your app

This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementation of a lesson on the Pluralsight platform, but with some code improvements
This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementation of a lesson on the Pluralsight platform, but with some code improvements

NoteKeeper-Custom-Widgets This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementati

A custom view, in which device contact list is displayed
A custom view, in which device contact list is displayed

Getting Started This repository contains a custom view, in which device contact list is displayed Implementation Go to Settings.gradle, inside reposit

A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Comments
  • Attribute conflict

    Attribute conflict

    Hello, When i include your library in my gradle file, it gives error while syncing...

    Error:(2) Attribute "entries" has already been defined

    I cannot figure out what is causing this problem. Please Help!!

    opened by jairook 5
  • Array Index Out of Bound Exception

    Array Index Out of Bound Exception

    java.lang.ArrayIndexOutOfBoundsException: length=10; index=10 at java.util.Arrays$ArrayList.get(Arrays.java:3854) at com.dpizarro.uipicker.library.picker.PickerUIListView$4.run(PickerUIListView.java:218) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6682) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

    opened by fireworkstech 2
  • Change the color of the selected text

    Change the color of the selected text

    Hi,

    I can't change the color of the selected item of the PickerUI. I used: mPickerUI.setColorTextCenter(Color.WHITE); or, I also tried: mPickerUI.setColorTextCenter(android.R.color.white); but these don't work.

    Can you help me please?

    Thanks very much

    opened by dariobrux 2
  • add feature to set picker view popup location

    add feature to set picker view popup location

    When user use picker view in a dialog,the dialog will be enlarged.Because the layout add the params align parent bottom.So I implement user define popup location to avoid the bug.

    opened by zakiso 0
Owner
David Pizarro
David Pizarro
Android App that communicates with a back-end server to display different One Piece characters

About This project is an Android App that communicates with a back-end server to display different One Piece characters. It's roughly based on this co

Sam Garcia 1 Feb 4, 2022
Android Library that lights items for tutorials or walk-throughs etc...

Spotlight Gradle dependencies { implementation 'com.github.takusemba:spotlight:x.x.x' } Usage val spotlight = Spotlight.Builder(this) .setTarg

TakuSemba 3.4k Dec 31, 2022
An Android Widget for selecting items that rotate on a wheel.

Looking for maintainers I'm no longer active on this project but I'll still focus on fixing crashing issues and review any code changes etc. WheelView

Luke Deighton 888 Jan 3, 2023
Spinner with searchable items.

SearchableSpinner Spinner with searchable items. Searchable Spinner is a dialog spinner with the search feature which allows to search the items loade

Mitesh Pithadiya 649 Dec 21, 2022
Overscroll any scrollable items!

ComposeOverscroll Overscroll any scrollable items! Preview compare with iOS demo Preview.for.overscroll.and.nested.invoke.mp4 How to use for column :

null 7 Dec 15, 2022
Android Library to display your changelog

ChangeLog Library ChangeLog Library provides an easy way to display a change log in your Android app. Travis master: Travis dev: Examples Sample appli

Gabriele Mariotti 861 Nov 11, 2022
ckChangeLog - An Android Library to display a Change Log

ckChangeLog - An Android Library to display a Change Log This library provides an easy way to display a change log in your app. Features Displays chan

cketti 182 Dec 3, 2022
Android library implementing a poppy view on scroll, similar to the one found in the Google Plus app

PoppyView PoppyView is a library which implements view on the bottom which come and go relative to the user scroll. It can be seen in the Google plus

Flavien Laurent 409 Nov 23, 2022
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

Feras Alnatsheh 1k Dec 20, 2022
ExpandableSelector is an Android library created to show a list of Button/ImageButton widgets inside a animated container which can be collapsed or expanded.

ExpandableSelector ExpandableSelector is an Android library created to show a list of Button/ImageButton widgets inside a animated container which can

Karumi 699 Nov 19, 2022