Code Monkey home page Code Monkey logo

androidstaggeredgrid's People

Contributors

ajpolt avatar ataulm avatar davejohncole avatar denizmveli avatar dougsimonton avatar eddieringle avatar emilsjolander avatar gabrielemariotti avatar googolmo avatar jakewharton avatar jstralko avatar juliendn avatar kirwan avatar lzanita09 avatar seanponeil avatar slapsys avatar swanhtet1992 avatar xrigau avatar

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

androidstaggeredgrid's Issues

Some warnings in logcat.

 15041               dalvikvm  W  method Lcom/etsy/android/grid/ExtendableListView;.fillGap incorrectly overrides package-private method with same name in Landroid/widget/AbsListView;
 15041               dalvikvm  W  method Lcom/etsy/android/grid/ExtendableListView;.getFooterViewsCount incorrectly overrides package-private method with same name in Landroid/widget/AbsListView;
 15041               dalvikvm  W  method Lcom/etsy/android/grid/ExtendableListView;.getHeaderViewsCount incorrectly overrides package-private method with same name in Landroid/widget/AbsListView;
 15041               dalvikvm  W  method Lcom/etsy/android/grid/ExtendableListView;.invokeOnItemScrollListener incorrectly overrides package-private method with same name in Landroid/widget/AbsListView;
 15041               dalvikvm  W  method Lcom/etsy/android/grid/ExtendableListView;.rememberSyncState incorrectly overrides package-private method with same name in Landroid/widget/AdapterView;
 15041               dalvikvm  W  method Lcom/etsy/android/grid/ExtendableListView;.reportScrollStateChange incorrectly overrides package-private method with same name in Landroid/widget/AbsListView;

I am just using the library normally. No steps to reproduce except for using this library. There is no code of mine mentioned.

grid_paddingTop Gets ignored

In layout file I have the attribute
app:grid_paddingTop="200dp"
But it is ignored

The attributes:
app:grid_paddingLeft="200dp"
and
app:grid_paddingRight="200dp"
are applied properly.

Why are there two column count attributes?

There are two column count attributes - portrait and landscape. Are they needed?

I would expect only columnCount, and if I needed a different number for landscape, I'd include another layout in my layout-land directory which would have a different value for columnCount (if that was the only difference in my layout for landscape, I could use @integer/columnCount, so I'd have two resource files for integers instead).

It suggests that the view checks for device orientation; should that be the view's responsibility?

Add support for multi-column items

I would like to see support for multi-column items. I wanted to open this topic up to discussion because I understand it would be a large change.

For my particular use-case I mostly want to implement some full-width rows in between the staggered columns (think section headers). You can sort of get this effect by claiming the header rows are of type ITEM_VIEW_TYPE_HEADER_OR_FOOTER but of course that's a hack right now and comes with a host of problems.

The general solution would be supporting multi-column items. Alternatively, a more specific solution (for me) would be to support a section header of sorts (full rows), implement similarly to header/footer rows but the code adjusts for them being in the middle.

I'd be willing to work on it myself and enter it through a pull request, but I wanted to gather thoughts first. Does this go outside the scope of the library, or is it something worth adding? And if it's worth adding, do you have any tips for how to get started?

Grid incorrectly overscroll's beyond last item

Occurs on master commit b81c1c6

Video can be found here: http://dai.ly/x1dj5iy

Test App to reproduce is at https://github.com/venkat230278/AndroidStaggeredGridViewOverscrollBug.git

Place app at same level as "library", "sample", import into Android studio and build.

Test App has a StaggeredGridView with 2 columns. Its adapter supplies 3 text views. Eventually, the three text views are laid out by the GridView as below.

A B
C

All text views (A, B, C) are of equal height H. H is greater than screen height. In above layout, A and B are clipped by the screen.

Slowly start scrolling towards and beyond C. Note that it is possible to scroll beyond C. Scroll in reverse towards A. Notice that B has disappeared. Notice after a while that A too disappears.

This issue is also encountered if the user flings on A or B towards C.

It appears that the grid view considers empty columns in scroll math. We tried to put in a quick hack fix for this issue for our product.

Patch can be found here: https://github.com/venkat230278/AndroidStaggeredGridViewOverscrollBug/blob/master/patch/sg.patch

Apply patch as follows:

[Some dir]/AndroidStaggeredGrid/library/src/main$ patch -p1 < sg.patch

Things to note about the above patch:

  1. Tested only for 2 columns.
  2. Not tested with other staggered grid features such as headers or footers.
  3. Might introduce other bugs.
  4. No guarantee / warranty of any kind. Use at your own risk.
  5. Might make the staggered grid less efficient.

Janky(messy) re-layout when scrolling up the SGV

Everything works as expected when scrolling down but when I scroll up there is a lot of re-layouting done for elements that had previously been loaded.
I tried using just a classic DynamicHeightImageView :

<com.etsy.android.grid.util.DynamicHeightImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/deviation_list_item_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />

Then I tried to load images into it using Picasso and UIL. Both had the same problem.
The re-layouting comes across as jank since it seems that views are measured again and everything.
Is there any way to remember the height of every element so it does not have to be re-layouted?

onScrollStateChanged never get called

I set a OnScrollListener on StaggeredGrid, but the listener never get called. So i dive into source code and find that newState always equal to mTouchMode.

void reportScrollStateChange(int newState) {
        Log.d("staggeredGrid", "newState = " + newState + " mTouchMode = " + mTouchMode);
        if (newState != mTouchMode) {
            mTouchMode = newState;
            if (mOnScrollListener != null) {
                mOnScrollListener.onScrollStateChanged(this, newState);
            }
        }
    }

NullPointerException on make view

java.lang.NullPointerException
at com.etsy.android.grid.ExtendableListView.getLastVisiblePosition(ExtendableListView.java:1830)
at android.widget.AdapterView.onInitializeAccessibilityEvent(AdapterView.java:957)
at android.widget.AbsListView.onInitializeAccessibilityEvent(AbsListView.java:1488)
at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:4936)
at android.view.View.sendAccessibilityEventUnchecked(View.java:4923)
at android.view.View$SendViewStateChangedAccessibilityEvent.run(View.java:19486)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5086)
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:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)

NullPointerException ListAdapter.getCount();

I'm getting an error just doing setContentView.

Here is my list layout:

<com.etsy.android.grid.StaggeredGridView
      android:id="@+id/product_grid"
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:column_count_landscape="3"
      app:column_count_portrait="2"
      app:grid_paddingBottom="@dimen/padding_medium"
      app:grid_paddingLeft="@dimen/padding_medium"
      app:grid_paddingRight="@dimen/padding_medium"
      app:grid_paddingTop="@dimen/padding_medium"
      app:item_margin="@dimen/padding_medium"/>

Here the staktrace:

java.lang.NullPointerException: Attempt to invoke interface method 'int android.widget.ListAdapter.getCount()' on a null object reference
            at com.etsy.android.grid.ExtendableListView.getLastVisiblePosition(ExtendableListView.java:1828)
            at android.widget.AdapterView.onInitializeAccessibilityEvent(AdapterView.java:957)
            at android.widget.AbsListView.onInitializeAccessibilityEvent(AbsListView.java:1443)
            at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:4946)
            at android.view.View.sendAccessibilityEventUnchecked(View.java:4933)
            at android.view.View$SendViewStateChangedAccessibilityEvent.run(View.java:19472)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5019)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)

Thanks!!

Incorret item spacing after rotating without recreate activity

Hello!

Here my first post on github!

Manifest:

 <activity
            android:name="com.ambrosettilive.app.CardViewActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:launchMode="singleTop"
            android:theme="@style/AppBaseTheme" >
        </activity>

Layout:

<com.etsy.android.grid.StaggeredGridView

        android:id="@+id/staggeredGridView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:item_margin="8dp"
        app:column_count="@integer/column_number" />
<!-- 4 column landscape and 3 on portrait-->

Before rotating:
screen1
After rotating:
screen2

Ask me whatever yout want.

Thank you,
Daniele

Unintentional onClick event on scroll down

I registered an setOnItemClickListener to the StaggeredGridView which works as expected besides one exception:

If I scroll up as far as possible (i. e. scroll up just after initialization) and lift the finger, an onItemClick event is triggered for the item of my current finger position. It looks like there is a missinterpretation of the scroll gesture by the GridView.

Impelement OnItemClickListener

In the code that is not yet implemented. I guess just planned to copy over the necessary stuff from AbsListView and modify it correctly. I know this is quite some task to make sure it works correctly.

Or what are the plans for this? Anybody already working on this? Getting only OnItemClickListener working is pretty easy, but getting long click and selectors working takes more time.

can not trigger onScrollStateChanged

I have read the source, in ExtendableListView#reportScrollStateChange method, we check whether newState is equal mTouchMode. However, before invoke reportScrollStateChange, I found that the mTouchMode almost always been set to new state. so reportScrollStateChange can not work. can someone fix it? I have read AbsListView, actually it will set mTouchMode to TOUCH_MODE_REST before report.

How to run in eclipse ?

PLEASE HELP !!!! I am not familiar with Android Studio .Plzz someone help me with the steps to run this successfully on Eclipse .I tried importing it to AS also but its throwing so many notification which are so confusing .

java.lang.NoClassDefFoundError: com.etsy.android.grid.R$styleable

Trying to execute your sample app, When I click on "Staggered Grid View" button I get this error:

01-23 12:10:22.546: E/AndroidRuntime(26874): FATAL EXCEPTION: main
01-23 12:10:22.546: E/AndroidRuntime(26874): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.etsy.android.sample/com.etsy.android.sample.StaggeredGridActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class com.etsy.android.grid.StaggeredGridView
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.os.Looper.loop(Looper.java:130)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.main(ActivityThread.java:3687)
01-23 12:10:22.546: E/AndroidRuntime(26874): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 12:10:22.546: E/AndroidRuntime(26874): at java.lang.reflect.Method.invoke(Method.java:507)
01-23 12:10:22.546: E/AndroidRuntime(26874): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
01-23 12:10:22.546: E/AndroidRuntime(26874): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
01-23 12:10:22.546: E/AndroidRuntime(26874): at dalvik.system.NativeStart.main(Native Method)
01-23 12:10:22.546: E/AndroidRuntime(26874): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class com.etsy.android.grid.StaggeredGridView
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-23 12:10:22.546: E/AndroidRuntime(26874): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:216)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.Activity.setContentView(Activity.java:1660)
01-23 12:10:22.546: E/AndroidRuntime(26874): at com.etsy.android.sample.StaggeredGridActivity.onCreate(StaggeredGridActivity.java:31)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
01-23 12:10:22.546: E/AndroidRuntime(26874): ... 11 more
01-23 12:10:22.546: E/AndroidRuntime(26874): Caused by: java.lang.reflect.InvocationTargetException
01-23 12:10:22.546: E/AndroidRuntime(26874): at java.lang.reflect.Constructor.constructNative(Native Method)
01-23 12:10:22.546: E/AndroidRuntime(26874): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
01-23 12:10:22.546: E/AndroidRuntime(26874): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
01-23 12:10:22.546: E/AndroidRuntime(26874): ... 21 more
01-23 12:10:22.546: E/AndroidRuntime(26874): Caused by: java.lang.NoClassDefFoundError: com.etsy.android.grid.R$styleable
01-23 12:10:22.546: E/AndroidRuntime(26874): at com.etsy.android.grid.StaggeredGridView.(StaggeredGridView.java:153)
01-23 12:10:22.546: E/AndroidRuntime(26874): at com.etsy.android.grid.StaggeredGridView.(StaggeredGridView.java:145)

First item in column is vertically stretched on API 17+

The following works on Genymotion api 16 devices, but fails on api 17 and 18 counterparts. Also fails on Nexus 5 (api 19) and HTC One (18).

activity layout:

<com.etsy.android.grid.StaggeredGridView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/gridview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:item_margin="5dp"
    app:column_count_portrait="3"
    app:column_count_landscape="4" />

item layout (extends ImageView but no modifications to layout):

<uk.co.ataulm.mijur.app.gallery.GalleryItemView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:scaleType="centerInside"
    android:src="@drawable/ic_launcher"/>

By fail, I mean that on API 17 and above I get the screen on the left, on 16, I get the one on the right:

This may be a usage bug, so I have posted the relevant portions of my code. FWIW, the Etsy app works fine on my Nexus 5 (4.4.2).

SetEmptyView doesn't work properly

Like gridview, if we set emptyview into an adapterview, before we set adapter, the adapter view should show the empty view, until we set the adapter into it.
But AndroidStaggeredGrid doesn't work like this.

Full-Width separator layouts between Grids

I want to use this library in my project but before any implementation I want to know that is it possible to add full-width layouts as a separator between grids through this library or not?

Thanks in advance...

ClassCastException in ExtenableListView#removeFooterView

02-07 17:47:16.355: E/AndroidRuntime(2224): java.lang.ClassCastException: xxx.CustomAdapter cannot be cast to com.etsy.android.grid.HeaderViewListAdapter
02-07 17:47:16.355: E/AndroidRuntime(2224): at com.etsy.android.grid.ExtendableListView.removeFooterView(ExtendableListView.java:450)

I'm using footer views. By trying to remove one of the footer views I get a ClassCastException. Do I have to implement the HeaderListViewAdapter instead of the ArrayAdapter? I thought I could use any common list adapter.

StaggeredGridView ignoring ViewGroup (e.g. RelativeLayout) visibility changes of child views

I have a custom component that extends from a RelativeLayout. The component is relatively simple -- an ImageView with an optional TextView. The TextView's visibility is changed after an AsyncTask is run. Thus, the StaggeredGridView renders the initial view correctly, but ignores (does not honor) the visibility change) after the AsyncTask runs.

I'm using identical code with a ListView and the StaggeredGridView and the ListView runs correctly, but the StaggeredGridView does not. Is this expected behavior or a bug?

ArrayIndexOutOfBoundsException in preLayoutChildren()

It looks like when the tops are copied into the bottom,
there is a mismatch in size between
the array src (mColumnTops) and the array dest (mColumnBottoms).

02-11 14:10:48.628  3518  6271 E AndroidRuntime: Caused by: java.lang.ArrayIndexOutOfBoundsException: src.length=3 srcPos=0 dst.length=0 dstPos=0 length=3
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at java.lang.System.arraycopy(Native Method)
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at com.etsy.android.grid.StaggeredGridView.preLayoutChildren(StaggeredGridView.java:341)
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at com.etsy.android.grid.StaggeredGridView.layoutChildren(StaggeredGridView.java:326)
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at com.etsy.android.grid.ExtendableListView.onLayout(ExtendableListView.java:507)
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at com.etsy.android.grid.ExtendableListView.updateEmptyStatus(ExtendableListView.java:2040)
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at com.etsy.android.grid.ExtendableListView.access$1000(ExtendableListView.java:59)
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at com.etsy.android.grid.ExtendableListView$AdapterDataSetObserver.onChanged(ExtendableListView.java:2078)
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
02-11 14:10:48.628  3518  6271 E AndroidRuntime:    at android.widget.BaseAdapter.notifyDataSetChanged(BaseAdapter.java:50)

setNumColumns

Any chance of getting a variation on setNumColumns?

I allow my users to change the formatting of the standard grid on the fly, setting the columns and list item style. In the current implementation this is hard coded as a layout value, any chance that is welcomed? I can do the work if it's something that is desired.

E.G. setNumColumns(int columnsPortrait, int columnsLandscape); is what would seem most consistent.

Thoughts?

column_count_*

The standard android way to handle this is to only have one attribute named column_count and let the user of the library specify a integer resource which is changed by android's resource system when the app changes from portrait to landscape. Before making a pull request to change this i would like to ask if there is any special thought behind this?

Can an image span multiple columns?

I've noticed that in the categories section of the Etsy android app you have images that span multiple colums (like the screenshot below).

Can this be achieved using the StaggeredGrid library? I noticed that the categories section has a scrollbar where as the StaggeredGrid does not, so my hunch is that you are using a different library. Could you share? I'd like to accomplish something similar.

screenshot_2014-01-20-22-51-45

Touch Selector Workaround

It's quite clearly stated item selector drawables are not supported. Having used the Etsy app I notice that when an item is touched a selector is drawn. How is this implemented? I really need some visual feedback to my grid items when a tap occurs.

Apologies for this not being an issue (I cannot mark as question for some reason).

Thanks!

NPE onSizeChanged

Got this exception from Google Play Developers Console:

java.lang.NullPointerException
    at com.etsy.android.grid.StaggeredGridView.onColumnSync(StaggeredGridView.java:890)
    at com.etsy.android.grid.StaggeredGridView.onSizeChanged(StaggeredGridView.java:846)

Trying to reproduce locally, but not yet succeeded... Can I help with anything else?

Extremely High Fling Velocities Leads To Stopping

It would appear that extremely high fling velocities cause the list to stop altogether.

In the sample, perform three extremely fast, additive upwards flings from the top of the list. If done correctly, the list should be completely stopped partway through the third fling.

Another way to see this behavior is to constantly fling upward as fast as you can and you'll notice that the list pauses every few flings.

Adding header and footer causes Error.

Hi there,
At first, I want to appreciate about this library. It is really great, Thanks :)
By the way, I've tried to add header and footer, but the problem caused.
I follow the example project included in library.

But it causes crash when I use addHeaderView() and addFooterView().
The exception caused by layoutChildren() method in ExtendableListView class.

In the layoutChildren() method, it checks the number of item and adapter like this : else if(mItemCount != mAdapter.getCount()) , and it causes IllegalStateException.

When I put the 6 items for array adapter and putting the header, the mItemCount becomes 6 but mAdapter.getCount() becomes 7. Also, If I put the footer also, then mAdapter.getCount() becomes 8. I think mItemCount should contain the footer and header value, but it doesn't. I changed every XML and code are almost same with example in library, but still have a problem

Did I something wrong? or is there any other rule or advice for using header & footer?

Thanks in advance.

ArrayIndexOutOfBoundsException

Issue in version 1.0.4 (after #53 fix)

Issue occurs if you turn the device and start scrolling

java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
        at com.etsy.android.grid.StaggeredGridView.getChildBottom(StaggeredGridView.java:630)
        at com.etsy.android.grid.ExtendableListView.fillGap(ExtendableListView.java:1261)
        at com.etsy.android.grid.ExtendableListView.moveTheChildren(ExtendableListView.java:1229)
        at com.etsy.android.grid.ExtendableListView.scrollIfNeeded(ExtendableListView.java:1055)
        at com.etsy.android.grid.ExtendableListView.onTouchMove(ExtendableListView.java:876)
        at com.etsy.android.grid.ExtendableListView.onTouchEvent(ExtendableListView.java:696)
        at android.view.View.dispatchTouchEvent(View.java:7350)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2412)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2147)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2418)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2161)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2139)
        at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1476)
        at android.app.Activity.dispatchTouchEvent(Activity.java:2487)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2087)
        at android.view.View.dispatchPointerEvent(View.java:7535)
        at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3415)
        at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3347)
        at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4456)
        at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4434)
        at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4538)
        at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
        at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
        at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:163)
        at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4506)
        at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4557)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
        at android.view.Choreographer.doCallbacks(Choreographer.java:555)
        at android.view.Choreographer.doFrame(Choreographer.java:523)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
        at android.os.Handler.handleCallback(Handler.java:615)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4921)
        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:1027)

setAdapter requires API11

It seems, that calling setAdapter on StaggeredGridView requires API11, not 10, which makes me really sad :(

IndexOutOfBounds-Exception

Hi,

I encountered an error while scrolling through the Listview with Genymotion "Galaxy S4" with Android 4.3.

The error is:

E/MessageQueue-JNI(5118): Exception in MessageQueue callback: handleReceiveCallback
E/MessageQueue-JNI(5118): java.lang.IndexOutOfBoundsException: Invalid index 105, size is 1
E/MessageQueue-JNI(5118): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
E/MessageQueue-JNI(5118): at java.util.ArrayList.get(ArrayList.java:308)
E/MessageQueue-JNI(5118): at com.etsy.android.grid.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:169)
E/MessageQueue-JNI(5118): at com.etsy.android.grid.ExtendableListView.onTouchDown(ExtendableListView.java:818)
E/MessageQueue-JNI(5118): at com.etsy.android.grid.ExtendableListView.onTouchEvent(ExtendableListView.java:686)
E/MessageQueue-JNI(5118): at android.view.View.dispatchTouchEvent(View.java:7384)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2205)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1940)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
E/MessageQueue-JNI(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
E/MessageQueue-JNI(5118): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1966)
E/MessageQueue-JNI(5118): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1418)
E/MessageQueue-JNI(5118): at android.app.Activity.dispatchTouchEvent(Activity.java:2424)
E/MessageQueue-JNI(5118): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1914)
E/MessageQueue-JNI(5118): at android.view.View.dispatchPointerEvent(View.java:7564)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3883)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3778)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3483)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3540)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5419)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5399)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5370)
E/MessageQueue-JNI(5118): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5493)
E/MessageQueue-JNI(5118): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:182)
E/MessageQueue-JNI(5118): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MessageQueue-JNI(5118): at android.os.MessageQueue.next(MessageQueue.java:132)
E/MessageQueue-JNI(5118): at android.os.Looper.loop(Looper.java:124)
E/MessageQueue-JNI(5118): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/MessageQueue-JNI(5118): at java.lang.reflect.Method.invokeNative(Native Method)
E/MessageQueue-JNI(5118): at java.lang.reflect.Method.invoke(Method.java:525)
E/MessageQueue-JNI(5118): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/MessageQueue-JNI(5118): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/MessageQueue-JNI(5118): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(5118): FATAL EXCEPTION: main
E/AndroidRuntime(5118): java.lang.IndexOutOfBoundsException: Invalid index 105, size is 1
E/AndroidRuntime(5118): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
E/AndroidRuntime(5118): at java.util.ArrayList.get(ArrayList.java:308)
E/AndroidRuntime(5118): at com.etsy.android.grid.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:169)
E/AndroidRuntime(5118): at com.etsy.android.grid.ExtendableListView.onTouchDown(ExtendableListView.java:818)
E/AndroidRuntime(5118): at com.etsy.android.grid.ExtendableListView.onTouchEvent(ExtendableListView.java:686)
E/AndroidRuntime(5118): at android.view.View.dispatchTouchEvent(View.java:7384)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2205)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1940)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2211)
E/AndroidRuntime(5118): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1912)
E/AndroidRuntime(5118): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1966)
E/AndroidRuntime(5118): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1418)
E/AndroidRuntime(5118): at android.app.Activity.dispatchTouchEvent(Activity.java:2424)
E/AndroidRuntime(5118): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1914)
E/AndroidRuntime(5118): at android.view.View.dispatchPointerEvent(View.java:7564)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3883)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3778)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3483)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3540)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
E/AndroidRuntime(5118): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5419)
E/AndroidRuntime(5118): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5399)
E/AndroidRuntime(5118): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5370)
E/AndroidRuntime(5118): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5493)
E/AndroidRuntime(5118): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:182)
E/AndroidRuntime(5118): at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(5118): at android.os.MessageQueue.next(MessageQueue.java:132)
E/AndroidRuntime(5118): at android.os.Looper.loop(Looper.java:124)
E/AndroidRuntime(5118): at android.app.ActivityThread.main(ActivityThread.java:5103)
E/AndroidRuntime(5118): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(5118): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(5118): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
E/AndroidRuntime(5118): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(5118): at dalvik.system.NativeStart.main(Native Method)

Maybe you can reproduce the error and solve the problem?

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.