Giter Site home page Giter Site logo

tylersuehr7 / chips-input-layout Goto Github PK

View Code? Open in Web Editor NEW
582.0 13.0 68.0 12.98 MB

A customizable Android ViewGroup for displaying Chips (specified in the Material Design Guide).

License: MIT License

Java 100.00%
android view viewgroup chips chips-view chip material design android-viewgroup filter-existing-chips

chips-input-layout's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chips-input-layout's Issues

Unable to update runtime data

java.lang.NullPointerException
at java.text.RuleBasedCollator.compare(RuleBasedCollator.java:365)
at com.tylersuehr.chips.Chip$1.compare(Chip.java:58)
at com.tylersuehr.chips.Chip$1.compare(Chip.java:52)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:360)
at java.util.TimSort.sort(TimSort.java:220)
at java.util.Arrays.sort(Arrays.java:1492)
at java.util.ArrayList.sort(ArrayList.java:1470)
at java.util.Collections.sort(Collections.java:206)
at com.tylersuehr.chips.ListChipDataSource.setFilterableChips(ListChipDataSource.java:81)
at com.tylersuehr.chips.ChipsInputLayout.setFilterableChipList(ChipsInputLayout.java:113)
at (TextEditorDialogFragment.java:555)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:71)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

CircleImageView ClassCastException

java.lang.ClassCastException: de.hdodenhof.circleimageview.CircleImageView cannot be cast to com.tylersuehr.chips.CircleImageView
at com.tylersuehr.chips.ChipView.(ChipView.java:54)
at com.tylersuehr.chips.ChipView.(ChipView.java:46)
at com.tylersuehr.chips.ChipView.newInstance(ChipView.java:330)
at com.tylersuehr.chips.ChipView.access$000(ChipView.java:25)
at com.tylersuehr.chips.ChipView$Builder.build(ChipView.java:325)
at com.tylersuehr.chips.ChipsInputLayout.getThemedChipView(ChipsInputLayout.java:651)
at com.tylersuehr.chips.ChipsAdapter.onCreateViewHolder(ChipsAdapter.java:55)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6493)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5680)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5563)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5559)
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:3693)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3410)
at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1680)
at android.support.v7.widget.RecyclerView.focusSearch(RecyclerView.java:2411)
at android.view.View.focusSearch(View.java:7346)
at android.widget.TextView.onCreateInputConnection(TextView.java:6013)
at com.tylersuehr.chips.ChipEditText.onCreateInputConnection(ChipEditText.java:43)
at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:1179)
at android.view.inputmethod.InputMethodManager.restartInput(InputMethodManager.java:1129)
at android.widget.TextView.setText(TextView.java:4003)
at android.widget.TextView.setText(TextView.java:3941)
at android.widget.EditText.setText(EditText.java:85)
at android.widget.TextView.setText(TextView.java:3916)
at com.tylersuehr.chips.ChipsInputLayout.onFilteredChipClick(ChipsInputLayout.java:100)
at com.tylersuehr.chips.FilterableChipsAdapter$Holder.onClick(FilterableChipsAdapter.java:142)
at android.view.View.performClick(View.java:4832)
at android.view.View$PerformClick.run(View.java:19844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5319)
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:1016)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)

I meet this when I click the FilterableChipList, this is awesome lib of complement the dynamic filter !

XML example in Readme should be updated

Hey Mate,

Thanks for making the library available. Just a minor thing. In your readme XML example you have

<com.tylersuehr.library.ChipsInputLayout
android:id="@+id/chips_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Start typing for chips... "
android:textColorHint="#757575"
android:textColor="#212121"
app:detailedChipsEnabled="true"
app:customChipsEnabled="true"/>

Which is fine for the way you have setup your example app where the library is local in a folder.

But if you add the library via gradle, then you need to use

<com.tylersuehr.chips.ChipsInputLayout
android:id="@+id/chips_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Start typing for chips... "
android:textColorHint="#757575"
android:textColor="#212121"
app:detailedChipsEnabled="true"
app:customChipsEnabled="true"/>

AppCompat library issues and background color problem


This came up when i added this library ( although there are no issues when running the app in an Android 5.1 sdk22 phone) however the app:chip_backgroundColor="..." doesn't seem to work. It shows something like this :

Keep keyboard active when chip added

Currently, when the user enters some text and clicks the DONE/NEXT button on the keyboard, it adds the chip but then closes the keyboard while maintaining focus. Is it possible to keep the keyboard active after a chip has been added?

Add a 'clearInputText' Method in ChipsInputLayout

I need to clear the input text as I need to reset the ChipsInputLayout.
Right now, If there is some text in the Input text, I can't remove it, thus leaving the text (obviously) and the filtered chips visible, as it automatically hides when a chip has been selected or the input text deleted.

I tried in many different ways but none worked so far. I even tried to download the code and implement it as a library and do the fix myself, but the ChipsInputLayout then breaks in the xml
Edit: I also forgot to mention that this is while editing, when the app is installed, it doesn't even start...

I hope you can help me solve this problem!

Change Keyboard option to Done to Next

HI,

I am using this for chips but i want enter on keyboard when chip created. Now it is showing done and when i click on it keyboard hide. So please help me to find the solution.

Thank You

SetText

Hello,

Please let me know how to set the text to chips.

Thank You.

Chip input always receives focus first

I have noticed that the chips input always receives the focus first in an activity. Is this the desired behaviour? I want to be able to disable this functionality so I can handle the focus order in my activity differently.
We could remove the focus from the chips element programmatically afterwards but then the user would notice the cursor switching from one element to another and this is bad user experience.

Has anyone noticed this? Any solution?

thanks

Always show filterable list

Filterable chips list shows up when user starts typing in.
It would be nice to have some settings to make it always visible when the chips view gets focus.
If the user doesn't type anything then all tags should be visible but once the user starts typing then it should follow the normal filter behaviour.

Backspace Abnormal Behaviour

Following are the Steps:

  • Type all numbers in chip input edit text.

  • Long press back space on keyboard,.

  • The cursor on edit text shift to first position and there are still some numbers left not all numbers cleared.

Readonly chips

Is it possible to use the library to show a set of chips which are not deletable by the user?
The readme is unclear on this functionality. If its supported how can it be implemented?

thanks, great library tho ๐Ÿ˜„

ChipsInputLayout not showing suggestion nor chips

Hello,
I'm trying to use the ChipsInputLayout in my project and I'm struggling with it. The problem is that the widgets doesn't show any options, although I have set a proper filterable list. It doesn't even show any chips that I add manually. I suppose it's not really a bug, but probably I'm doing something wrong. Anyway, I'd be thankful if the author of the library can have a look at it.
I inherited the Chip class like this:

public class ContactChip extends Chip {

    private String name;
    private String number;

    public ContactChip(@NonNull String name, @NonNull String number) {
        this.name = name;
        this.number = number;
    }

    @Override
    public Object getId() {
        return number;
    }

    @NonNull
    @Override
    public String getTitle() {
        return name;
    }

    @Override
    public String getSubtitle() {
        return number;
    }

    @Override
    public Uri getAvatarUri() {
        return null;
    }

    @Override
    public Drawable getAvatarDrawable() {
        return MyApplication.getInstance().getDrawable(R.drawable.ic_people_black_24dp);//todo replace
    }
}

Then I added the widgets to my fragment's xml like this:

<com.tylersuehr.chips.ChipsInputLayout
                android:id="@+id/chips_input_recipients"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginStart="@dimen/margin_start_message_editor_column_2"
                app:chipsList="@{viewmodel.chips}"
                app:allowCustomChips="true"
                app:chip_showDetails="true"
                android:hint="@string/hint_chips_input_recipients" />

(Note that the chipsList attribute is just a custom attribute for Android Data Binding, but I already tried to delete it, the widget didn't work either.)

And then I have this method, which is called in onCreateView() of the fragment's class:

private void initChipsInput(@NonNull final ChipsInputLayout chipsInput) {

        ArrayList<Message.Recipient> contacts = ContactsDataSource.getInstance().getContacts();
        ArrayList<Chip> chips = new ArrayList<>();
        for (int i = 0; i < contacts.size(); i++) {
            Message.Recipient contact = contacts.get(i);
            chips.add(new ContactChip(contact.name, contact.number));
        }

        chipsInput.setFilterableChipList(chips);
        chipsInput.addSelectionObserver(new ChipDataSource.SelectionObserver() {
            @Override
            public void onChipSelected(Chip chip) { updateVM(); }

            @Override
            public void onChipDeselected(Chip chip) { updateVM(); }

            void updateVM() {
                if(viewModel != null) {
                    viewModel.chips.clear();
                    viewModel.chips.addAll(chipsInput.getSelectedChips());
                }
            }
        });
    }

Again, it didn't work even when I deleted the selectionObserver. The mechanism of getting the list of contacts is working correctly, I tried to run it in the debugger and the list passed to setFilterableChipsList() is OK, it contains 64 items with all the names and phone numbers of my contacts. And still it doesn't show any list of options when I type anything. I also tried to manually add some chips by calling addSelectedChip(), and it wasn't shown. It's just behaving like a normal EditText... Thanks for any help.

Crash when app:chip_showDetails is set to false and a chip is clicked

java.lang.NullPointerException: Attempt to invoke interface method 'void com.tylersuehr.chips.ChipView$OnChipClickListener.onChipClicked(com.tylersuehr.chips.ChipView)' on a null object reference
at com.tylersuehr.chips.ChipView$1.onClick(ChipView.java:107)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

setDelimiter method not found

The setDelimiter method is not available with the current version of the library.I checked the source code for version 2.3 and i could not find the setDelimiter

Realm database as CustomDatasource

Hi , i am trying to use realm as a Custom data source but i am a bit confused.The documentation recommends the implmentation of ObservableChipDataSource .So , i created a class and implements the ObservableChipDataSource , but there are lots of overrides methods .I dont know how to connect the sqlite database with this data source.Any help will be greatly appreciated.

Change ChipsInputLayout inputType

Seems like the input type in the ChipsInputLayout is locked and can`t use predictions. I want my users to create custom tags for contents so predictions and autocorrect are very nice features to have.

ChipSelectionObserver method name inconsistent

Thanks for the chips-input-layout i l really like it.
Maybe the ChipSelectionObserver method name onChipDeselected should be called
"onChipDeleted" since that is what happens..

public interface ChipSelectionObserver {
    void onChipSelected(Chip addedChip);

    void onChipDeselected(Chip removedChip);
}

Setting Show Details to False Causes Crash

On Line 228 of ChipsAdapter.java, you are setting either the adapter as the listener, or null, depending upon the selection for mShowDetails. If you look at your implementation of that function 'setOnChipClicked' on Line 103 of ChipView.java you'll see this creates a null pointer exception. You are setting an onClick listener regardless of the parameter's value, which calls on that parameter's expected 'onChipClicked' method, which if that listener is null... Kaboom.

Unable to import library project using Gradle

After following steps to import your library i am getting error
Failed to resolve: com.github.tylersuehr7:chips-input-layout:2.0
Any help would be appreciate. Thanks in Advance.

lines included in project :
project level build.gradle
maven { url "https://jitpack.io" }

app level build.gradle
compile 'com.github.tylersuehr7:chips-input-layout:2.0'

get Deleted chip

Is there a way to get the deleted (removed) chip from the chipInput view?

RecyclerView's onMeasure method is invoked infinitely

If you add one or many chips you can notice that the onMeature method is invoked infinitely in the recyclerview (chips container). Just add a breakpoint. It is the really big problem. Because all UI will be recreated a lot of times it will decrease performance.

Add Support for jitpack

Would love to have support for jitpack.io to use the library. Currently I can't get it to build.

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.