Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how create two synced picker side by side #2

Closed
AhmadVatani opened this issue Oct 7, 2015 · 2 comments
Closed

how create two synced picker side by side #2

AhmadVatani opened this issue Oct 7, 2015 · 2 comments

Comments

@AhmadVatani
Copy link

I want to creat country picker with postal code and name of country. what can i do?
how can i use two picker side by side??

@DavidPizarro
Copy link
Owner

Hi!

Do you have an image to explain me what do you want exactly? Thanks!

@DavidPizarro
Copy link
Owner

Hi!

No, it is not possible to do that exactly with the library. But with the new version I have uploaded yesterday - compile 'com.github.davidpizarro:pickerui:1.0.1' - you can use an alternative.

Now you can know when is showing PickerUI panel. See #Changelog
In addition PickerUI object can be assigned to multiple components simultaneously, each with a different ID. Example:

private static final int CITY_ID = 0;
private static final int POSTAL_ID = 1;

private PickerUI mPickerUI;

llCity.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
             mPickerUI.setItems(MainActivity.this, cities, CITY_ID, 0);
             if (!mPickerUI.isPanelShown())
                 mPickerUI.slide();
         }
      });

llPostal.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
             mPickerUI.setItems(MainActivity.this, postals, POSTAL_ID, 0);
             if (!mPickerUI.isPanelShown())
                 mPickerUI.slide();
         }
     });

mPickerUI.setOnClickItemPickerUIListener(new PickerUI.PickerUIItemClickListener() {
            @Override
            public void onItemClickPickerUI(int ID, int position, String valueResult) {
                switch (which){
                    case CITY_ID:
                        tvCity.setText(valueResult);
                        break;

                    case POSTAL_ID:
                        tvPostal.setText(valueResult);
                        break;
                }
            }
        });

So you can get the next results:

Example gif

You can download an example with this functionality here.

I hope that will be helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants