Comments (3)
I found a workaround to the issue.
When picker2 is initialized, I insert empty items, and before that declare the dialog in Listener I check if the items are empty, like that:
mPicker2.setAvailableItems(new ArrayList<String>());
mPicker2.setWidgetListener(new FloatingLabelItemPicker.OnWidgetEventListener<String>() {
@Override
public void onShowItemPickerDialog(FloatingLabelItemPicker<String> picker) {
if (!picker.getAvailableItems().isEmpty()) {
StringPickerDialogFragment dialog = StringPickerDialogFragment.newInstance(
picker.getId(),
getString(R.string.label_picker_2),
getString(android.R.string.ok), getString(android.R.string.cancel),
false,
picker.getSelectedIndices(),
new ArrayList<>(picker.getAvailableItems())
);
dialog.setTargetFragment(MyFragment.this, 0);
dialog.show(getChildFragmentManager(), "Picker2");
}
}
});
It's no ideal way, but it's works for now!
from android-floatinglabel-widgets.
Hi,
Feel free to implement this as a proper feature in the library and submit a pull request. That would cover a good use case.
from android-floatinglabel-widgets.
Closing, I have added a sample in the demo about how to handle this case.
Proper way to do it is to add empty list and check before showing the fragment (we don't want to show an empty fragment)
from android-floatinglabel-widgets.
Related Issues (20)
- Text misaligned with text cursor HOT 2
- Vertical alignment of text not consistent HOT 11
- Gradle support HOT 1
- Style contains key with bad entry HOT 2
- Gradle error: Library is not a library itself HOT 2
- Limited to minSdkVersion 15 HOT 2
- Specify hint size when textview not empty HOT 1
- Date picker month is -1 HOT 1
- Implement setOnFocusChangeListener() for text fields HOT 1
- Use the new AppCompat widgets
- Labels not animated properly after #29
- NPE with FloatingLabelAutoCompleteTextView and AppCompat 22.1.1 on API 21+ HOT 2
- support for RTL Language HOT 4
- Different date format for JavaDateInstant HOT 4
- Is it possible to disable drawableRight for pickers? HOT 2
- Label is not floating away when setInputWidgetText() is used HOT 5
- Error in license
- Compatibility with Saaripaar Validation Library
- import to android studio
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-floatinglabel-widgets.