pchmn / materialchipsinput Goto Github PK
View Code? Open in Web Editor NEWImplementation of Material Design Chips component for Android
License: Apache License 2.0
Implementation of Material Design Chips component for Android
License: Apache License 2.0
i'm having difficulty in disabling this view i also tried to diable parent view still it is not working.
Hi,
First of all thank you for such an extensive and customizable library.
Can we make the chips input ui also customizable as right now there is no way to fix the ui as per app's need.
Hi there,
I am trying to set background color of chip to a color state list but it isn't working. However, setting color state list for label color is working. Here is the code:
<com.pchmn.materialchips.ChipView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:backgroundColor="@color/chip_color"
app:deletable="false"
app:labelColor="@color/chip_label_color" />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"
android:color="@color/colorPrimary"/>
<item android:state_pressed="true"
android:color="@color/colorPrimary"/>
<item android:color="@color/grey500"/>
</selector>
I get this:
java.lang.IllegalArgumentException: Called attach on a child which is not detached: ViewHolder{15b78fb4 position=4 id=-1, oldPos=-1, pLpos:-1 not recyclable(0)}
whenever I try to:
chipsInput.addChip(contact);
of course contact class implements ChipInterface
sometimes it do work, most of the time it gives me this error
The library's default behavior hides keyboard if a user clicks outside the ChipInput.
I found I way to disable this by removing window callback on my activity with some delay. Since this looks really bad in the project it would be great to have an option to turn off auto keyboard hide feature.
Writing more to help those who will meet the same issue rather than to get fix (since I have working workaround).
In my app I use ChipsInput in the same activity with CollapsingToolbarLayout.
By default I have 4 chips which takes 2 rows on my screen.
When I delete one of the chips or simply tap ChipsInput and then tap away - I'm no longer able to resize toolbar. It only begin to work again after I delete more chips so that there would be only one row left.
After some expirements I have noticed this behaviour does not occur when maxRows is defined (with value of 4 in my case).
I have set filterableList to ChipsInput View, items are coming when I am typing the text but only first item is getting added to view once I search for another item and trying to click on it nothing happens.
I have tried it with your sample application code too, I can only add one item.
Please tell if I am doing something wrong.
<com.pchmn.materialchips.ChipsInput
android:id="@+id/expense_split_contacts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="Enter a friend or group name"
app:maxRows="3"/>
It looks like FilberableList is mandatory to specify before to use component (version 1.0.5)
`public class MainAppActivity extends AppCompatActivity {
private ChipsInput chipsInput;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_app);
this.chipsInput = (ChipsInput) findViewById(R.id.chips_input);
// without the next line of code application will crushed with NPE
chipsInput.setFilterableList(new ArrayList<ChipInterface>());
}
@Override
protected void onResume() {
super.onResume();
chipsInput.setFilterableList(new ArrayList<ChipInterface>());
chipsInput.addChip("Test", null);
chipsInput.addChipsListener(new ChipsInput.ChipsListener() {
@Override
public void onChipAdded(ChipInterface chipInterface, int i) {}
@Override
public void onChipRemoved(ChipInterface chipInterface, int i) {}
@Override
public void onTextChanged(CharSequence charSequence) {
String text = charSequence.toString();
if (text.endsWith(" ")) {
chipsInput.addChip(text, null);
}
}
});
}
}`
NPE stack trace:
E/AndroidRuntime: FATAL EXCEPTION: main java.lang.NullPointerException at com.pchmn.materialchips.views.ChipsInputEditText.isFilterableListVisible(ChipsInputEditText.java:21) at com.pchmn.materialchips.util.MyWindowCallback.dispatchTouchEvent(MyWindowCallback.java:60) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1873) at android.view.View.dispatchPointerEvent(View.java:7307) at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3174) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3119) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4155) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4134) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4226) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:125) at android.os.Looper.loop(Looper.java:124) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)
Is there any way to control the focus getting for the component on application start ?
For example in demo application, let it keyboards appears after user has clicked on the component.
Hi,
Is there any feature to add new chip from UI?
Thanks!
If the chip is manually selected (using addChip(...)), then the chip still appears in the filtered list. If the chip is selected by clicking on the filtered list then it no longer appears in the filtered list. Presence in the filtered list should not be dependent on how the chip was selected.
I'm trying to show this with property max rows: but it is not providing me a scrolling.Please help me
So this is just about the only library I've used so far that looks good and seems to work well for my needs but I have these two 'issues' and a suggestions that I've found from the limitations present with it.
Both the inputType and focus do nothing, whether I change it in the layout or in the code. It looks unprofessional having the EditText view always have the cursor in the EditText. A detail but my mild obsession with details makes me a bit annoyed about this.
InputType doesn't seem to be possible to change. I wanted to use the Enter/New line button has a delimiter to create a chip but in the current state I can't, making me use the comma. Not really an issue as it's still fully usable, but I'd like the option.
Suggestions:
By default there is no way to add a chip without suggestions, making it obligatory to write code in TextChanged and create our own logic and delimiters. This can be worked around but I'd prefer this to be optional, not mandatory if I want to add chips without having suggestions. This includes creating delimiters and letting the ChipsInput deal with the creation and trigger onChipAdded.
Override the comparison method. I don't know if the ChipValidator is supposed to deal with this but it does nothing, there's no mention of the Validator in the readme also which makes me a bit confused and Android Studio doesn't even find usages so any intentions of implementing this soon? I want to use this because my language and main language of the user will contain special chars and I want the user to not have to worry about writing special chars to find an already existing chip, specially when I already implemented this with a search function in other areas - this was also requested by an user, in this case my teacher.
Anyway, I've decided to use your library as it seems to accomplish the task well enough and is better than the ones I've already tried. Even with the complains I have, which are minor, I'll still keep it. Keep up the good work, specially seeing that this does seem to be the best to create chips. :)
You are not able to reference the editText used for entering the input. This means I can't add extra TextWatcher nor can I get the current text input.
How to reproduce on Xperia X Performance:
04-25 23:35:30.861 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@a748111
04-25 23:35:30.926 10895-10895/com.pchmn.sample.materialchipsinput I/Timeline: Timeline: Activity_launch_request id:com.pchmn.sample.materialchipsinput time:29040260
04-25 23:35:31.000 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@fe9ec7c
04-25 23:35:31.001 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@8fa905
04-25 23:35:31.051 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@a944526
04-25 23:35:31.051 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@f973567
04-25 23:35:31.055 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@82ef3bd
04-25 23:35:31.055 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@b6f8db2
04-25 23:35:31.079 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@557c103
04-25 23:35:31.079 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@e7e4880
04-25 23:35:31.317 10895-10895/com.pchmn.sample.materialchipsinput I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@f78e4e4 time:29040651
04-25 23:35:31.506 10895-10956/com.pchmn.sample.materialchipsinput D/OpenGLRenderer: endAllActiveAnimators on 0x7f88aaf000 (RippleDrawable) with handle 0x7f88ab1400
04-25 23:35:34.783 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@bdbe4d3
04-25 23:35:34.784 10895-10895/com.pchmn.sample.materialchipsinput V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@a8ae810
04-25 23:35:34.806 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: io.reactivex.exceptions.OnErrorNotImplementedException
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:74)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:64)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.tryEmitScalar(ObservableFlatMap.java:234)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:146)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.operators.observable.ObservableBuffer$BufferExactObserver.onNext(ObservableBuffer.java:113)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.tryEmit(ObservableFlatMap.java:262)
04-25 23:35:34.807 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onNext(ObservableFlatMap.java:559)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.observers.SerializedObserver.onNext(SerializedObserver.java:112)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.operators.observable.ObservableConcatMap$SourceObserver$InnerObserver.onNext(ObservableConcatMap.java:249)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:265)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.subjects.PublishSubject.onNext(PublishSubject.java:184)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.tbruyelle.rxpermissions2.RxPermissionsFragment.onRequestPermissionsResult(RxPermissionsFragment.java:64)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.tbruyelle.rxpermissions2.RxPermissionsFragment.onRequestPermissionsResult(RxPermissionsFragment.java:49)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.app.Activity.dispatchRequestPermissionsResultToFragment(Activity.java:7120)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.app.Activity.dispatchActivityResult(Activity.java:6966)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.app.ActivityThread.deliverResults(ActivityThread.java:4162)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.app.ActivityThread.handleSendResult(ActivityThread.java:4209)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.app.ActivityThread.-wrap20(ActivityThread.java)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1571)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.os.Looper.loop(Looper.java:241)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6223)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at java.lang.reflect.Method.invoke(Native Method)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
04-25 23:35:34.808 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: Caused by: java.lang.NullPointerException
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at java.text.RuleBasedCollator.compare(RuleBasedCollator.java:356)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.pchmn.materialchips.adapter.FilterableAdapter$1.compare(FilterableAdapter.java:66)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.pchmn.materialchips.adapter.FilterableAdapter$1.compare(FilterableAdapter.java:61)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at java.util.TimSort.countRunAndMakeAscending(TimSort.java:351)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at java.util.TimSort.sort(TimSort.java:230)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at java.util.Arrays.sort(Arrays.java:1523)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at java.util.Collections.sort(Collections.java:238)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.pchmn.materialchips.adapter.FilterableAdapter.<init>(FilterableAdapter.java:61)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.pchmn.materialchips.views.FilterableListView.build(FilterableListView.java:66)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.pchmn.materialchips.ChipsInput.setFilterableList(ChipsInput.java:342)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.pchmn.sample.materialchipsinput.ContactListActivity.getContactList(ContactListActivity.java:124)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.pchmn.sample.materialchipsinput.ContactListActivity.lambda$onCreate$12(ContactListActivity.java:47)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at com.pchmn.sample.materialchipsinput.ContactListActivity$$Lambda$1.accept(Unknown Source)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:60)
04-25 23:35:34.809 10895-10895/com.pchmn.sample.materialchipsinput W/System.err: ... 24 more
04-25 23:35:34.811 10895-10895/com.pchmn.sample.materialchipsinput E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.pchmn.sample.materialchipsinput, PID: 10895
io.reactivex.exceptions.OnErrorNotImplementedException
at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:74)
at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:64)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.tryEmitScalar(ObservableFlatMap.java:234)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:146)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
at io.reactivex.internal.operators.observable.ObservableBuffer$BufferExactObserver.onNext(ObservableBuffer.java:113)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.tryEmit(ObservableFlatMap.java:262)
at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onNext(ObservableFlatMap.java:559)
at io.reactivex.observers.SerializedObserver.onNext(SerializedObserver.java:112)
at io.reactivex.internal.operators.observable.ObservableConcatMap$SourceObserver$InnerObserver.onNext(ObservableConcatMap.java:249)
at io.reactivex.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:265)
at io.reactivex.subjects.PublishSubject.onNext(PublishSubject.java:184)
at com.tbruyelle.rxpermissions2.RxPermissionsFragment.onRequestPermissionsResult(RxPermissionsFragment.java:64)
at com.tbruyelle.rxpermissions2.RxPermissionsFragment.onRequestPermissionsResult(RxPermissionsFragment.java:49)
at android.app.Activity.dispatchRequestPermissionsResultToFragment(Activity.java:7120)
at android.app.Activity.dispatchActivityResult(Activity.java:6966)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4162)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4209)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1571)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6223)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NullPointerException
at java.text.RuleBasedCollator.compare(RuleBasedCollator.java:356)
at com.pchmn.materialchips.adapter.FilterableAdapter$1.compare(FilterableAdapter.java:66)
at com.pchmn.materialchips.adapter.FilterableAdapter$1.compare(FilterableAdapter.java:61)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:351)
at java.util.TimSort.sort(TimSort.java:230)
at java.util.Arrays.sort(Arrays.java:1523)
at java.util.Collections.sort(Collections.java:238)
at com.pchmn.materialchips.adapter.FilterableAdapter.<init>(FilterableAdapter.java:61)
at com.pchmn.materialchips.views.FilterableListView.build(FilterableListView.java:66)
at com.pchmn.materialchips.ChipsInput.setFilterableList(ChipsInput.java:342)
at com.pchmn.sample.materialchipsinput.ContactListActivity.getContactList(ContactListActivity.java:124)
at com.pchmn.sample.materialchipsinput.ContactListActivity.lambda$onCreate$12(ContactListActivity.java:47)
at com.pchmn.sample.materialchipsinput.ContactListActivity$$Lambda$1.accept(Unknown Source)
at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:60)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.tryEmitScalar(ObservableFlatMap.java:234)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:146)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
at io.reactivex.internal.operators.observable.ObservableBuffer$BufferExactObserver.onNext(ObservableBuffer.java:113)
at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.tryEmit(ObservableFlatMap.java:262)
at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onNext(ObservableFlatMap.java:559)
at io.reactivex.observers.SerializedObserver.onNext(SerializedObserver.java:112)
at io.reactivex.internal.operators.observable.ObservableConcatMap$SourceObserver$InnerObserver.onNext(ObservableConcatMap.java:249)
at io.reactivex.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:265)
at io.reactivex.subjects.PublishSubject.onNext(PublishSubject.java:184)
at com.tbruyelle.rxpermissions2.RxPermissionsFragment.onRequestPermissionsResult(RxPermissionsFragment.java:64)
at com.tbruyelle.rxpermissions2.RxPermissionsFragment.onRequestPermissionsResult(RxPermissionsFragment.java:49)
at android.app.Activity.dispatchRequestPermissionsResultToFragment(Activity.java:7120)
at android.app.Activity.dispatchActivityResult(Activity.java:6966)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4162)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4209)
at android.app.ActivityThread.-wrap20(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1571)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:6223)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Could React Java be causing a problem here? I am testing on a Sony Xperia X Performance with Android Nougat. The library seems to work fine in the emulators. What could the problem be on my Android device?
LetterTileProvider should probably be separated from the library. It should either be placed into a separate library or exposed explicitly as a part of the API of just ripped out and thrown away.
The reason for separation is consistency. By using the built-in LetterTileProvider, the MaterialChipsInput forces a certain way of displaying contact icons. The icons are expected to be the same throughout the application. That mean the library forces the entire app to choose one of the two suboptimal choices:
I.e. in both cases LetterTileProvider is somewhat useless. It's also not an essential part of the library functionality.
something like setMaxSelectedChips(int maxNumber)
java.lang.UnsupportedOperationException
at android.content.res.Resources_Delegate.obtainTypedArray(Resources_Delegate.java:509)
at android.content.res.Resources.obtainTypedArray(Resources.java:559)
at com.pchmn.materialchips.util.LetterTileProvider.(LetterTileProvider.java:67)
at com.pchmn.materialchips.ChipView.init(ChipView.java:78)
at com.pchmn.materialchips.ChipView.(ChipView.java:64)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:475)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:262)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:220)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:334)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:345)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:245)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:567)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:549)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$1(RenderTask.java:680)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
after looking at your code and edit it I found lots of bad code and bad performances,
the project could be much better, faster.
If you need help contact me in private
When the user type a bad word and wants to fix it the previous chip is deleted.
Steps to reproduce:
Would like to be able to NOT have the chip focus when entering the activity. I can have keyboard not opened, but I can't disable the blinker from blinking.
app build.gradle
compile 'com.github.pchmn:MaterialChipsInput:1.0.8'
compile 'com.jakewharton:butterknife:8.6.0'
===================================================
<RelativeLayout
android:id="@+id/ll_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<com.pchmn.materialchips.ChipsInput
android:id="@+id/chips_input"
android:layout_width="match_parent"
android:layout_height="200dp"
app:hint="Enter a name"
tools:context=".activity.compose.ComposeActivity" />
=======================================================
EditText size is cut to 20% size if device is RTL but the view itself is working good
I think is a good idea to make it public or even just create a getter method for mChipsAdapter
, it'll make easier to customize the current adapter and have more control on the current list of chips.
How do you feel about that?
When using a DialogFragment (AppCompatDialogFragment) I see this crash when the layout is inflated.
If I get time, I might submit a fix and pull request, but have noted it here until then.
Caused by: java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity
at com.pchmn.materialchips.ChipsInput.init(ChipsInput.java:144)
at com.pchmn.materialchips.ChipsInput.<init>(ChipsInput.java:78)
at java.lang.reflect.Constructor.newInstance0(Native Method)
Hello, thanks for the awesome library.
But is there any way to change the initial height of the ChipsInput? Because I need it a to be a little bit shorter at first and then expanding up to 3 rows after adding some items
For some reasons I got the following error message in Android Studio:
Failed to resolve: com.github.pchmn:MaterialChipsInput:1.0.4
I used step-by-step instructions from here to reproduce the issue:
https://github.com/pchmn/MaterialChipsInput
it seems the edit text keeps measuring layout when it is inside a recyclerview. I found a old posting about this performance issue in google forum: https://issuetracker.google.com/issues/37015285.
the solution it says set the RecyclerView to not focusable, or you can specify the descendantFocusability to afterDescendants
doesn't help because it still need to request focus for filtering chips. Is there any walk around solution?
thanks!
My app is using the ChipsInput view to show contacts (name, email) for a user to select from. As instructed I extend ChipsInterface and insert the required information. Everything looks great, I can see all the contacts I've added and the performance is perfect, except the emails (info fields for the Chips) don't show for any of the suggestions. Once I've selected it and it shows in the ChipsInput view, opening the detailed view shows the email as expected.
I've been able to break point inside of the FilterableAdapter so I know the data gets there and it appears to run the lines to set the text and make the info visible despite it not showing.
I am adding the filterable list on the UIThread and I have tried switching out my custom ChipInterface with the provided Chip object with the same effect.
ChipsInput::setHint(String mHint)
API exists but doesn't work.
Would like to disable dropdown menu. It appears this library requires the chipInput view to be on the top of the screen for room above keyboard and under the text input to show the autocomplete list. Would like to disable this feature and just enter chip by clicking enter on keyboard.
I upgraded to the new version and then I got the below error.
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference at com.pchmn.materialchips.util.LetterTileProvider.getLetterTile(LetterTileProvider.java:83) at com.pchmn.materialchips.ChipView.setHasAvatarIcon(ChipView.java:219) at com.pchmn.materialchips.ChipView.inflateWithAttributes(ChipView.java:122) at com.pchmn.materialchips.ChipView.newInstance(ChipView.java:448) at com.pchmn.materialchips.ChipView.access$000(ChipView.java:29) at com.pchmn.materialchips.ChipView$Builder.build(ChipView.java:432) at com.pchmn.materialchips.ChipsInput.getChipView(ChipsInput.java:207) at com.pchmn.materialchips.adapter.ChipsAdapter.onCreateViewHolder(ChipsAdapter.java:78) at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6367) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5555) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436) at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fillWithLayouter(ChipsLayoutManager.java:858) at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fill(ChipsLayoutManager.java:821) at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.onLayoutChildren(ChipsLayoutManager.java:719) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3025) at android.view.View.measure(View.java:19957) at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1420) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:482) at com.pchmn.materialchips.views.ScrollViewMaxHeight.onMeasure(ScrollViewMaxHeight.java:47) at android.view.View.measure(View.java:19957) at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1420) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:482) at com.pchmn.materialchips.views.ScrollViewMaxHeight.onMeasure(ScrollViewMaxHeight.java:47) at android.view.View.measure(View.java:19957) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6087) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.support.design.widget.TextInputLayout.onMeasure(TextInputLayout.java:1056) at android.view.View.measure(View.java:19957) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6087) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:19957) at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1311) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.widget.ScrollView.onMeasure(ScrollView.java:345) at android.view.View.measure(View.java:19957) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6087) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139) at android.view.View.measure(View.java:19957) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6087) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nouman.winslosses, PID: 3082
java.lang.NullPointerException: Attempt to write to field 'int android.view.ViewGroup$MarginLayoutParams.topMargin' on a null object reference at com.pchmn.materialchips.views.FilterableListView.fadeIn(FilterableListView.java:135)
atcom.pchmn.materialchips.views.FilterableListView$2.onFilterComplete(FilterableListView.java:113)
at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285)
at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
As in AutoCompleteTextView
we setThreshold
to 0, and inside setOnclickListener
we do view.showDropDown()
.
How do I implement the same for your library.
I didn't find any threshold or show drop down list kind methods.
Kindly help,
Thanks.
I alredy set up the library in my project level build.gradle and app level build.gradle, but it doesnt sync
It would be great if the following feature is implemented:
If the filtered list is empty (no item corresponds to the inserted text value), then a default chip is added inside the list with the inserted text as label.
Hi guys. Can i add button to end list when lose focus EditText?
It's possibile to change the Chip textsize an typeface?
Thanks
Hi,
I would like to add text watcher to perform my own filtering to data.
Is it possible?
Thanks
Getting this error when chips_input.setFilterableList(contactChips);
is called after network call
java.lang.NullPointerException: Attempt to write to field 'int android.view.ViewGroup$MarginLayoutParams.topMargin' on a null object reference at com.pchmn.materialchips.views.FilterableListView.fadeIn(FilterableListView.java:135) at com.pchmn.materialchips.views.FilterableListView$2.onFilterComplete(FilterableListView.java:113) at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6121) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
I would like to use Glide to pull the images from URL's and Firebase. Are there any plans to support this? If not, is it okay if I fork this and add support?
Thank you!
Darran
I got his exception when I navigated away from a fragment where com.pchmn.materialchips.ChipsInput
is used.
FATAL EXCEPTION: main
Process: app.contactplus, PID: 3201
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:4310)
at android.view.ViewGroup.addView(ViewGroup.java:4146)
at android.view.ViewGroup.addView(ViewGroup.java:4118)
at com.pchmn.materialchips.views.FilterableListView$1.onGlobalLayout(FilterableListView.java:94)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:912)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1996)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1134)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6050)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860)
at android.view.Choreographer.doCallbacks(Choreographer.java:672)
at android.view.Choreographer.doFrame(Choreographer.java:608)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5438)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Apart from this your library is awesome!!! :)
I want to implement MaterialChipsInput for a search widget linked to a search web service on the api. I tried to use ChipsListener like this :
`final ArrayList contactList = new ArrayList<>();
searchUsersForChatChipsInput.addChipsListener(new ChipsInput.ChipsListener() {
@Override
public void onChipAdded(ChipInterface chipInterface, int i) {
}
@Override
public void onChipRemoved(ChipInterface chipInterface, int i) {
}
@Override
public void onTextChanged(final CharSequence charSequence) {
if (charSequence.toString().length()>= 2) {
StringRequest searchUserForChatRequest = new StringRequest(Request.Method.GET, SingletonApplicationController.URL + "/api/search/users.json?user_id=1&to_search=" + charSequence.toString()
, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject JSONResponse = new JSONObject(response);
JSONArray JSONResultUsers = JSONResponse.getJSONArray("users");
contactList.clear();
for (int i = 0; i < JSONResultUsers.length(); i++) {
String username = JSONResultUsers.getJSONObject(i).getString("username");
String mail = JSONResultUsers.getJSONObject(i).getString("email");
contactList.add(new Chip(username, mail));
}
// pass contact list to chips input
searchUsersForChatChipsInput.setFilterableList(contactList);
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(context, error.toString(), Toast.LENGTH_LONG).show();
}
});
// add the request object to the queue to be executed
SingletonApplicationController.getInstance().addToRequestQueue(searchUserForChatRequest);
}
}
});
`
But it's not really workin the listview for the result is not showing up even though it receives the right data from the web service in the JSONResponse. Even contactList gets well updated.
Any help .. Much Appreciated
For example I want to provide suggestions on the FilteredListView with data from a REST API , but not is possible because the method filterList
into the class ChipsInput is called before of provide the external suggestions.
mProductTags.addChipsListener(new ChipsInput.ChipsListener() {
Handler handler = new Handler(Looper.getMainLooper());
Runnable workRunnable;
@Override
public void onChipAdded(ChipInterface chipInterface, int i) {
}
@Override
public void onChipRemoved(ChipInterface chipInterface, int i) {
}
@Override
public void onTextChanged(final CharSequence charSequence) {
handler.removeCallbacks(workRunnable);
workRunnable = new Runnable() {
@Override
public void run() {
queryTags(charSequence);
}
};
handler.postDelayed(workRunnable, 500);
}
});
Hi,
I added this code in my adapter to add chips programatically, but I am not getting the letter tile when using this. There is a black space for the avatar icon.When I am doing this using xml then it is working perfectly.
ChipView chip=new ChipView(context);
chip.setLabel(sms.getRecieverList().get(i).getLabel());
chip.setLabelColor(context.getColor(R.color.colorPrimaryDark));
chip.setAvatarIcon(sms.getRecieverList().get(i).getAvatarUri());
chip.setHasAvatarIcon(true);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.