Coder Social home page Coder Social logo

morristech / universalpickerdialog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stfalcon-studio/universalpickerdialog

0.0 0.0 0.0 908 KB

Dialog with auto generated pickers inside, which depends on count of dataset.

Home Page: http://stfalcon.com

Java 100.00%

universalpickerdialog's Introduction

UniversalPickerDialog

Customizable dialog with auto generated pickers inside that depend on the dataset count.

alt tag

Who we are

Need iOS and Android apps, MVP development or prototyping? Contact us via [email protected]. We develop software since 2009, and we're known experts in this field. Check out our portfolio and see more libraries from stfalcon-studio.

Download

Download via Gradle:

compile 'com.github.stfalcon:universalpickerdialog:0.1.0'

or Maven:

<dependency>
  <groupId>com.github.stfalcon</groupId>
  <artifactId>universalpickerdialog</artifactId>
  <version>0.1.0</version>
  <type>pom</type>
</dependency>

Usage

Implement callback interface:

public class MainActivity extends AppCompatActivity
        implements View.OnClickListener, UniversalPickerDialog.OnPickListener {

Then implement OnPickListener.onPick(int[], int) method:

@Override
public void onPick(int[] selectedValues, int key) {
    String str = list.get(selectedValues[0]);
    Object obj = array[selectedValues[0]];

    /*do some logic*/
}

Now you can build the dialog and show it. Just add these few lines:

new UniversalPickerDialog.Builder(this)
                .setTitle(R.string.hello)
                .setListener(this)
                .setInputs(
                        new UniversalPickerDialog.Input(0, list),
                        new UniversalPickerDialog.Input(2, array)
                )
                .show();

Data set is passing to Picker using Input class that supports lists as well as arrays, so no data conversion is required :)). It takes in constructor default item position in carousel as the first argument and data set as the second.

Builder was extended by a many methods for more flexibility and convenience of use. Here's the full list (you can find the javadoc on each of these methods):

new UniversalPickerDialog.Builder(this)
                .setTitle(R.string.hello)
                .setTitle("Hello!")
                .setTitleColorRes(R.color.green)
                .setTitleColor(Color.GREEN)
                .setBackgroundColorRes(R.color.white)
                .setBackgroundColor(Color.WHITE)
                .setContentTextColorRes(R.color.green)
                .setContentTextColor(Color.GREEN)
                .setPositiveButtonText(R.string.yep)
                .setPositiveButtonText("Yep!")
                .setNegativeButtonText(R.string.nope)
                .setNegativeButtonText("Nope!")
                .setButtonsColor(R.color.green)
                .setButtonsColorRes(Color.GREEN)
                .setPositiveButtonColorRes(R.color.green)
                .setPositiveButtonColor(Color.GREEN)
                .setNegativeButtonColorRes(R.color.red)
                .setNegativeButtonColor(Color.RED)
                .setContentTextSize(16)
                .setListener(this)
                .setInputs(
                        new UniversalPickerDialog.Input(2, list),
                        new UniversalPickerDialog.Input(0, array)
                )
                .setKey(123)
                .build()
                .show();

Look [Sample project] sample for more information.

License

Copyright (C) 2016 stfalcon.com

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.

universalpickerdialog's People

Contributors

alexz89ua avatar troy379 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.