Code Monkey home page Code Monkey logo

chipslayoutmanager'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  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

chipslayoutmanager's Issues

Wrong items count

In my case it doesn't show all items from adapter.
I tried different configurations of ChipsLayoutManager, but i can see all items only when setMaxViewsInRow(1)
Items layout has fixed height and width. And when i have add 8 items then i see only 6 of them.
When i changing ChipsLayoutManager to LinearLayoutManager then all items appears.

RecyclerView defined as:

<android.support.v7.widget.RecyclerView
        android:id="@+id/child_list"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        app:layout_constraintTop_toBottomOf="@id/locker_bw_icon"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintBottom_toTopOf="@id/copyright" />

Each element has layout like:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="100dp"
    android:layout_height="80dp"
    android:background="@drawable/lock_available">
    <Button
        android:id="@+id/reserve_button"
        android:text="@string/map_booking_reserve"
        android:textSize="8sp"
        android:textColor="@android:color/white"
        android:layout_width="82dp"
        android:layout_height="26dp"
        android:background="@drawable/button_gradient"
        android:layout_gravity="center" />
</FrameLayout>

ChipsLayoutManager config is basic(but i tried different cases):

ChipsLayoutManager layoutManager = ChipsLayoutManager.newBuilder(getContext())
                .build();

有谁能修改下让每行可以居中显示

自动换行,每行限制个数都不错,唯一不足的就是每行的内容不可以设置居中显示。貌似都只能居左或者用rtl居右,都不是我们想要的,求高手修改,看作者貌似不维护这个了。

Reverse item order?

Any ideas how to reverse order of items? I tried to make it happen for the whole day without success.

Please set minSdkVersion to 14

Seems to still work well when I set it.

I ask this because the support library of Google is from API 14, and so is our app at the office, and I want to use this library on it.

Scrolling gets stuck on second to last row when no padding on recyclerview

If there is no padding on the RecyclerView using the ChipsLayoutManager, you will not be able to scroll past the second to last row under the following scenario:

  • Scroll down to the last row
  • Scroll up past the last row so that the second to last row is the last visible row in the RecyclerView
  • Attempt to scroll down to the last row
    At this point the RecyclerView will not scroll past the second to last row. This behavior also occurs with columns when using the horizontal orientation setting.

IllegalArgumentException: top point of input rect can't be lower than minTop

I don't know what causes this, it's possibly when populating, but I don't have a solid repro.

java.lang.IllegalArgumentException: top point of input rect can't be lower than minTop
   at com.beloo.widget.chipslayoutmanager.gravity.BottomGravityModifier.modifyChildRect(BottomGravityModifier.java:9)
   at com.beloo.widget.chipslayoutmanager.layouter.AbstractLayouter.applyChildGravity(AbstractLayouter.java:277)
   at com.beloo.widget.chipslayoutmanager.layouter.AbstractLayouter.layoutRow(AbstractLayouter.java:250)
   at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fillWithLayouter(ChipsLayoutManager.java:893)
   at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fill(ChipsLayoutManager.java:821)
   at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.onScrolled(ChipsLayoutManager.java:1165)
   at com.beloo.widget.chipslayoutmanager.ScrollingController.scrollBy(ScrollingController.java:159)
   at com.beloo.widget.chipslayoutmanager.ScrollingController.scrollVerticallyBy(ScrollingController.java:152)
   at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.scrollVerticallyBy(ChipsLayoutManager.java:1138)
   at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4838)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
   at android.view.Choreographer.doCallbacks(Choreographer.java:723)
   at android.view.Choreographer.doFrame(Choreographer.java:655)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
   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)

How to use same spacing for auto-spacing between views and on sides?

Is it possible to set the spacing between the items (and on the edges), so that it will be even? Something like the weight used on LinearLayout?
Is it STRATEGY_FILL_SPACE or STRATEGY_FILL_VIEW?

I tried to use :

    ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder(getActivity())
            .setChildGravity(Gravity.CENTER)
            .setScrollingEnabled(true)
            .setRowStrategy(ChipsLayoutManager.STRATEGY_FILL_SPACE).withLastRow(true)
            .setMaxViewsInRow(3)
            .build();

But it doesn't put space at the edges of the items, only between them:

image

Using STRATEGY_FILL_VIEW, it's almost what I wrote, but it puts half of the space at the edges:

image

Combine notifyItemMoved() and notifyItemChanged()

Sometimes I have an item which moves position and also changes appearance at the same time. I've tried calling both notify methods but this totally messes up the animation.

I imagine this is quite a common scenario.

Ideally, the item would animate to the new appearance as it moves. However, the appearance changing suddenly at the start or end of the move would also be acceptable to me.

Is there any workaround?

Support Gravity.FILL

It would be nice if we could fill the whole width of the line. It would also be nice if we could do it two ways

  1. Add more spacing
  2. Increase the width of the items.

Bug : setMaxViewsInRow doesn't work

I use this:

    ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder(getActivity())
            .setChildGravity(Gravity.CENTER)
            .setScrollingEnabled(true)
            .setRowStrategy(ChipsLayoutManager.STRATEGY_FILL_VIEW ).withLastRow(true)
            .setMaxViewsInRow(3)
            .build();

Yet I can still see 4 in a single row:

image

Not only that, but the last item is truncated, while the first item has a lot of space compared to the others...

TopGravityModifier checks improper values

Hi
I have a app I've been playing with and had this library on 0.2.3, I just attempted to update to the latest 0.3.7, and receive a crash.

I experience this when I set:

setGravityResolver(new IChildGravityResolver() {
                    @Override
                    public int getItemGravity(int position) { 
                        return Gravity.TOP;
                    }
                })

Using other Gravitys work fine (BOTTOM, CENTER)

From looking in the source i see that the TopGravityModifier class was modified to check the left/right edges of the rect against the minStart and minEnd, whereas the BOTTOM layout checks the top and bottom, and I do not experience the issue using BOTTOM.

class TopGravityModifier implements IGravityModifier {
    TopGravityModifier() {
    }

    public Rect modifyChildRect(int minStart, int maxEnd, Rect childRect) {
        if(childRect.**left** < minStart) {
            throw new IllegalArgumentException("top point of input rect can\'t be lower than minTop");
        } else if(childRect.**right** > maxEnd) {
            throw new IllegalArgumentException("bottom point of input rect can\'t be bigger than maxTop");
        } else {
            childRect = new Rect(childRect);
            if(childRect.top > minStart) {
                childRect.bottom -= childRect.top - minStart;
                childRect.top = minStart;
            }

            return childRect;
        }
    }
}
class BottomGravityModifier implements IGravityModifier {
    BottomGravityModifier() {
    }

    public Rect modifyChildRect(int minStart, int maxEnd, Rect childRect) {
        if(childRect.**top** < minStart) {
            throw new IllegalArgumentException("top point of input rect can\'t be lower than minTop");
        } else if(childRect.**bottom** > maxEnd) {
            throw new IllegalArgumentException("bottom point of input rect can\'t be bigger than maxTop");
        } else {
            Rect modified = new Rect(childRect);
            if(modified.bottom < maxEnd) {
                modified.top += maxEnd - modified.bottom;
                modified.bottom = maxEnd;
            }

            return modified;
        }
    }
}

I'm not certain that this is a mistake, but it looks fishy. Eitherway something changed and I can't seem to figure out how to use Gravity.TOP again.

The crash I see when using Gravity.TOP is as follows:

FATAL EXCEPTION: main Process: com.foo, PID: 22659 java.lang.IllegalArgumentException: bottom point of input rect can't be bigger than maxTop at com.beloo.widget.chipslayoutmanager.gravity.TopGravityModifier.modifyChildRect(TopGravityModifier.java:13) at com.beloo.widget.chipslayoutmanager.layouter.AbstractLayouter.applyChildGravity(AbstractLayouter.java:277) at com.beloo.widget.chipslayoutmanager.layouter.AbstractLayouter.layoutRow(AbstractLayouter.java:250) at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fillWithLayouter(ChipsLayoutManager.java:893) 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:3535) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3264) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3796) at android.view.View.layout(View.java:16694) at android.view.ViewGroup.layout(ViewGroup.java:5481) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16694) at android.view.ViewGroup.layout(ViewGroup.java:5481) at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1795) at android.view.View.layout(View.java:16694) at android.view.ViewGroup.layout(ViewGroup.java:5481) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16694) at android.view.ViewGroup.layout(ViewGroup.java:5481) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16694) at android.view.ViewGroup.layout(ViewGroup.java:5481) at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:493) at android.view.View.layout(View.java:16694) at android.view.ViewGroup.layout(ViewGroup.java:5481) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2697) at android.view.View.layout(View.java:16694) at android.view.ViewGroup.layout(ViewGroup.java:5481) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2228) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1981) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1140) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6232) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858) at android.view.Choreographer.doCallbacks(Choreographer.java:670) at android.view.Choreographer.doFrame(Choreographer.java:606) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) 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:5551) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)

RecyclerView height wrap_content

So my problem is what when I use android:layout_height="wrap_content" for my RecyclerView, he just cut off instead of expanding. Or I doing something wrong or it is just a bug.

Margin between items

Hello
How can I add margin between items? Currently I add margins for every item in my adapter onCreateView() method but it is not work when I use ChipsLayoutManger.

Thanks

Animation bug when moving items

I made a short screencast of the problem and appended it as a gif, here's a short description:

My ChipsLayoutManager looks like following:

ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder(getActivity())
            .setChildGravity(Gravity.TOP)
            .setScrollingEnabled(true)
            .setGravityResolver(new IChildGravityResolver() {
                @Override
                public int getItemGravity(int position) {
                    return Gravity.CENTER;
                }
            })
            .build();

I add my chips (they have wrap_content as width) and my two headers to distinct between selected and not selected items (the headers have a width of match_parent so they automatically take the space of a row). Selecting an item does just move it under the selected items header and notifies the adapter about this move.

demo

Few problems

  • gradle import is not working - even after adding maven { url "http://dl.bintray.com/beloo/widget" }
  • if I download your project and use it in my app, the id "me.tatarka.retrolambda" version "3.3.1" is interfering with the definition in my project. I think this plugin should be defined in the root project, not in the library project
  • I'm using timber myself, so this is no problem for me, but I suggest removing timber from the library. It's an unnecessary extra dependency...

Crash with ClassCastException

To reproduce:

  1. In device developer options turn on Don't keep activities.
  2. Open activity with ChipsLayoutManager.
  3. Press device home button.
  4. Open activity with ChipsLayoutManager again.

This happens when you leave the app in the background for a while and activity is killed by the system.

If you cannot reproduce like that, let me know, I'll provide more detailed setup.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.emoticast.tunemoji.android.debug/com.emoticast.tunemoji.feature.main.MainActivity}: java.lang.ClassCastException: android.support.v7.widget.LinearLayoutManager$SavedState cannot be cast to com.beloo.widget.chipslayoutmanager.ParcelableContainer
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
       at android.app.ActivityThread.-wrap12(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6119)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by java.lang.ClassCastException: android.support.v7.widget.LinearLayoutManager$SavedState cannot be cast to com.beloo.widget.chipslayoutmanager.ParcelableContainer
       at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.onRestoreInstanceState(ChipsLayoutManager.java:413)
       at android.support.v7.widget.RecyclerView.onRestoreInstanceState(RecyclerView.java:1188)
       at android.view.View.dispatchRestoreInstanceState(View.java:15751)
       at android.view.ViewGroup.dispatchThawSelfOnly(ViewGroup.java:3251)
       at android.support.v7.widget.RecyclerView.dispatchRestoreInstanceState(RecyclerView.java:1205)
       at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
       at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
       at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
       at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
       at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
       at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
       at android.view.View.restoreHierarchyState(View.java:15729)
       at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2106)
       at android.app.Activity.onRestoreInstanceState(Activity.java:1047)
       at android.app.Activity.performRestoreInstanceState(Activity.java:1002)
       at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1174)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2638)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
       at android.app.ActivityThread.-wrap12(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6119)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

IllegalArgumentException: you can't move above of maxItemCount

I'm getting the following error from users on many api's and many different devices. Any idea why?

Fatal Exception: java.lang.IllegalArgumentException: you can't move above of maxItemCount
       at com.beloo.widget.chipslayoutmanager.layouter.AbstractPositionIterator.move(AbstractPositionIterator.java:17)
       at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fillWithLayouter(ChipsLayoutManager.java:852)
       at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fill(ChipsLayoutManager.java:815)
       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:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1458)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:746)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:18799)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:898)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
       at android.view.View.measure(View.java:18799)
       at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1658)
       at android.view.View.measure(View.java:18799)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:898)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
       at android.view.View.measure(View.java:18799)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1458)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:746)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2899)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2108)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1224)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1460)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6023)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
       at android.view.Choreographer.doCallbacks(Choreographer.java:670)
       at android.view.Choreographer.doFrame(Choreographer.java:606)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
       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:5461)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Scrolling issue

When i am scrolling fast the recyclerview is showing some extra space either on top or in the middle

Manager Throws Irrelated Exception when Swaping Adapters

Greetings,

I have 2 recyclerview adapters that are of same class, for example:
val firstAdapter: SomeAdapter
val secondAdapter: SomeAdapter

Lets take, that firstAdapter have 100 values, and secondAdapter has 0 values. Lets also take that first adapter is visible. To produce a bug:

  1. Remove element from firstAdapter and add to secondAdapter.
  2. Make secondAdapter visible via recyclerView.swapAdapter(secondAdapter) or recyclerView.setAdapter(secondAdapter)
  3. An Exception is thrown:
    ava.lang.IllegalArgumentException: you can't move above of maxItemCount
    at com.beloo.widget.chipslayoutmanager.layouter.AbstractPositionIterator.move(AbstractPositionIterator.java:17)
    at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fillWithLayouter(ChipsLayoutManager.java:852)
    at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fill(ChipsLayoutManager.java:815)
    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.onLayout(RecyclerView.java:3962)

However, if you use recyclerView.scrollToPosition(0) and then swapAdapters - everything works fine.

Support initialization throw XML app:layoutManager attribute

Hi,

Can you support the initialization through XML?

Ideally I would like to be able to do something like this:

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layoutManager="com.beloo.widget.chipslayoutmanager.ChipsLayoutManager"
    app:chipsLM_scrollingEnabled="true"
    app:chipsLM_maxViewsInRow="2"
    app:chipsLM_gravityResolver="full.class.name.Here"
    app:chipsLM_rowBreaker="full.class.name.Here"
    app:chipsLM_orientation="horizontal"
    app:chipsLM_rowStrategy="fillSpace"
    app:chipsLM_rowStrategyOnLastRole="false"
    tools:listitem="@layout/item_layout"/>

This should only require implementing a standard constructor (never tried tough):

public ChipsLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ChipsLayoutManager, defStyleAttr, defStyleRes);
    // read attributes here
    a.recycle();
}

I can work on this myself if you are willing to accept contributions.

Could not find 'ChipsLayoutManager'

I correctly setup library but I could not find 'ChipsLayoutManager', when wanted to use it.....

allprojects {
    repositories {
        jcenter()
    }
}

compile 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'

NPE on objects move

That's not related to the library per se, but it'd also be nice to fix for the sample app.
When you delete chips from the recyclerview spinners aren't getting updated and you can get a NPE on Move.

Caused by: java.lang.IndexOutOfBoundsException: Index: 38, Size: 31 at java.util.ArrayList.add(ArrayList.java:457) at beloo.recyclerviewcustomadapter.MainActivity.onMoveClicked(MainActivity.java:162) at java.lang.reflect.Method.invoke(Native Method)  at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288) 

java.lang.IllegalStateException

java.lang.IllegalStateException: Observer com.beloo.widget.chipslayoutmanager.layouter.MeasureSupporter@6c0f5aa is already registered.

When I call setAdapter the second time for my RecyclerView which has ChipsLayoutManager, it will give me this error.

Nested scrolling problem

Seems like it's the LayoutManagers responsibility to handle nested scrolling somehow, because placing a LinearLayoutManager inside a BottomSheetDialogFragment works like a charm but if I use ChipsLayoutManager and try to scroll down the list the BottomSheet is closed...

It needs to consume the scroll events somehow it seems...

Scroll to bottom programmatically

When I calling recyclerview.scrollToPosition(...) or chipsLayoutManager.scrollToPosition(...) with different arguments or something else, it`s not scroll correctly

onLayoutChildren

the method onLayoutChildren seems getting called again and again, which seems so abnormal.

crash ClassNotFoundException when unmarshalling

android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.beloo.widget.chipslayoutmanager.cache.ParcelableContainer
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2263)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2313)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1226)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:617)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.beloo.widget.chipslayoutmanager.cache.ParcelableContainer
at android.os.Parcel.readParcelableCreator(Parcel.java:2147)
at android.os.Parcel.readParcelable(Parcel.java:2097)
at android.os.Parcel.readValue(Parcel.java:2013)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:2363)
at android.os.Parcel.readSparseArray(Parcel.java:1735)
at com.beloo.widget.chipslayoutmanager.ParcelableContainer.(ParcelableContainer.java:45)
at com.beloo.widget.chipslayoutmanager.ParcelableContainer.(ParcelableContainer.java:13)
at com.beloo.widget.chipslayoutmanager.ParcelableContainer$1.createFromParcel(ParcelableContainer.java:79)
at com.beloo.widget.chipslayoutmanager.ParcelableContainer$1.createFromParcel(ParcelableContainer.java:75)
at android.os.Parcel.readParcelable(Parcel.java:2104)
at android.support.v7.widget.RecyclerView$SavedState.(RecyclerView.java:10003)
at android.support.v7.widget.RecyclerView$SavedState$1.createFromParcel(RecyclerView.java:10027)
at android.support.v7.widget.RecyclerView$SavedState$1.createFromParcel(RecyclerView.java:10024)
at android.os.Parcel.readParcelable(Parcel.java:2104)
at android.os.Parcel.readValue(Parcel.java:2013)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:2363)
at android.os.Parcel.readSparseArray(Parcel.java:1735)
at android.os.Parcel.readValue(Parcel.java:2070)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.getSparseParcelableArray(Bundle.java:1273)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1736)
at android.app.Activity.onRestoreInstanceState(Activity.java:944)
at android.app.Activity.performRestoreInstanceState(Activity.java:916)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1138)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2241)
... 11 more
android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.beloo.widget.chipslayoutmanager.cache.ParcelableContainer
at android.os.Parcel.readParcelableCreator(Parcel.java:2147)
at android.os.Parcel.readParcelable(Parcel.java:2097)
at android.os.Parcel.readValue(Parcel.java:2013)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:2363)
at android.os.Parcel.readSparseArray(Parcel.java:1735)
at com.beloo.widget.chipslayoutmanager.ParcelableContainer.(ParcelableContainer.java:45)
at com.beloo.widget.chipslayoutmanager.ParcelableContainer.(ParcelableContainer.java:13)
at com.beloo.widget.chipslayoutmanager.ParcelableContainer$1.createFromParcel(ParcelableContainer.java:79)
at com.beloo.widget.chipslayoutmanager.ParcelableContainer$1.createFromParcel(ParcelableContainer.java:75)
at android.os.Parcel.readParcelable(Parcel.java:2104)
at android.support.v7.widget.RecyclerView$SavedState.(RecyclerView.java:10003)
at android.support.v7.widget.RecyclerView$SavedState$1.createFromParcel(RecyclerView.java:10027)
at android.support.v7.widget.RecyclerView$SavedState$1.createFromParcel(RecyclerView.java:10024)
at android.os.Parcel.readParcelable(Parcel.java:2104)
at android.os.Parcel.readValue(Parcel.java:2013)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:2363)
at android.os.Parcel.readSparseArray(Parcel.java:1735)
at android.os.Parcel.readValue(Parcel.java:2070)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2314)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.getSparseParcelableArray(Bundle.java:1273)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1736)
at android.app.Activity.onRestoreInstanceState(Activity.java:944)
at android.app.Activity.performRestoreInstanceState(Activity.java:916)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1138)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2241)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2313)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1226)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5137)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:617)
at dalvik.system.NativeStart.main(Native Method)

Duplicated package in uploaded library

Somehow package of library became duplicated after uploading to repository, so ChipsLayoutManager is accessible from com.beloo.widget.spanlayoutmanager.* and from com.beloo.widget.chipslayoutmanager.* packages.
Please use com.beloo.widget.chipslayoutmanager.*. Will be fixed in the next version

Items height issue

How to reproduce:

  1. Use this in ItemsFragment
    private void expand() {
        rvTest.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
        rvTest.requestLayout();
    }

    private void collapse() {
        rvTest.getLayoutParams().height = 100;
        rvTest.requestLayout();
    }
  1. Call collapse
  2. Call expand
  3. Result
    t5bzni4

how to show one line

just title show,if I hava a lot of data,and I just want show one line,do not show others,how do I do ?

Could not find library

I believe that I correctly setup library but gradle could not find library. I already tried jitpack. Same result. Can you fix that.

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.