Giter Club home page Giter Club logo

smoothie's Introduction

NOTE: Smoothie's API is not final yet. Although the library is fairly funcional, this is still beta-quality code. Do not rely on it for production code just yet. Feedback is very welcome!

What is it?

Smoothie provides a simple API to load ListView/GridView items asynchronously, off the UI thread.

Features

  • Tiny API to implement asynchonous loading of items in Android's ListView and GridView.
  • Multi-part item support: split the loading of each item into separate asynchronous operations with different global priorities.
  • Tight integration between user interaction and async loading of items i.e. stops loading items on fling, enables loading when panning with finger down, etc.
  • Prefetch items beyond the currently visible items to reduce the number of placeholder-type items while scrolling.

How do I use it?

  1. Add Smoothie's jar as a dependency to your project.

  2. Add an AsyncListView or AsyncGridView to your layout.

  3. Implement an SimpleItemLoader. You're only required to override three methods: getItemParams(), loadItem(), and displayItem(). You can override more methods if you want to handle loading items from memory, preloading items, resetting item views, etc.

  4. On Activity/Fragment creation, attach an ItemManager instance to your AsyncListView/AsyncGridView:

    ItemManager.Builder builder = new ItemManager.Builder(yourItemLoader);
    builder.setPreloadItemsEnabled(true).setPreloadItemsCount(5);
    builder.setThreadPoolSize(4);
    ItemManager itemManager = builder.build();
    
    AsyncListView listView = (AsyncListView) findViewById(R.id.list);
    listView.setItemManager(itemManager);

The sample app has an example of an ItemEngine powered by Android-BitmapCache that fades images in as they finish loading on a ListView.

The API docs contain a more detailed overview of the API.

Download

Grab via Maven:

<dependency>
  <groupId>org.lucasr.smoothie</groupId>
  <artifactId>smoothie</artifactId>
  <version>0.1.0</version>
</dependency>

or Gradle:

compile 'org.lucasr.smoothie:smoothie:0.1.0'

Want to help?

File new issues to discuss specific aspects of the API and to propose new features.

License

Copyright 2012 Lucas Rocha

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

smoothie's People

Contributors

lucasr avatar luciofm avatar sriramramani 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

smoothie's Issues

NPE when touching without adapter

When trying to scroll an AsyncListView without adapter but with Loader you get the following exception.

06-18 17:17:31.852: E/AndroidRuntime(7318): java.lang.NullPointerException
06-18 17:17:31.852: E/AndroidRuntime(7318): at org.lucasr.smoothie.ItemManager.updateItems(ItemManager.java:107)
06-18 17:17:31.852: E/AndroidRuntime(7318): at org.lucasr.smoothie.ItemManager.access$8(ItemManager.java:83)
06-18 17:17:31.852: E/AndroidRuntime(7318): at org.lucasr.smoothie.ItemManager$ItemsListHandler.handleMessage(ItemManager.java:256)

You can fix it by adding a null check in ItemManager's updateItems().

Publish to maven central

Couldn't find the library on maven central, would be more convenient if the library was available in maven central :)

Is this library still supported?

I was just looking through this library and its just awesome, cheers for creating it. I guess its good to use in my recent application but just then i saw your note that it is still in beta? Would development continue on this library?

Runs out of Memory after switching from portrait to landscape orientation

I have found that using the library, my Samsung Tab3 device runs out of memory when scrolling and switching to/from portrait/landscape.
Initially the gridview is populated (with albumart) normally. Flinging up and down uses around 65 to 70Mb. and this level is fairly constant. However, once you have switched orientation, memory usage jumps up and quickly reaches over 90Mb after which the scrolling and refreshing becomes extremely slow. Finallly the app simply stops. (no ANR)
I have taken the sample Gallery app, but instead of images, I display albumart. No other amendments were made.
I have around 600 albums to display.
ps tested with an earlier version but same behaviour

Smoothie items preload on listview in transcript mode

Does Smoothie made assumption that the listview has to be operated in non transcript mode in order for the preload logics to function properly?

http://developer.android.com/reference/android/widget/AbsListView.html#setTranscriptMode(int)

In my testing, it seems that my listview missed some preloading when I scrolling up the listview. In transcript mode we usually scroll up more than scrolling it down.

This seem to be more like a question than issue :-)

Thanks

Issue resolved

Hi lucasr,

Opps - problem with my implementation.

Thanks for this excellent library.

cheers

RuntimeException: Canvas: trying to use a recycled bitmap

Hi,

I'm trying to use your wonderful Smoothie library in a new project, based on the bitmapcache example. It works in the emulator, but on my device (S2 @ Stock 4.0.4), it crashes when I scroll the ListView.

Maybe it has something to do with the bitmapcache fade in thingy?

Thanks in advance for checking out.

Cheers,
Martijn

02-09 02:57:41.600 E/AndroidRuntime(18033): FATAL EXCEPTION: main
02-09 02:57:41.600 E/AndroidRuntime(18033): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@415aaf40
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1038)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.graphics.Canvas.drawBitmap(Canvas.java:1142)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:394)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.graphics.drawable.TransitionDrawable.draw(TransitionDrawable.java:198)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.widget.ImageView.onDraw(ImageView.java:910)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.View.draw(View.java:11184)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.drawChild(ViewGroup.java:2892)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2494)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.drawChild(ViewGroup.java:2890)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2494)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.drawChild(ViewGroup.java:2890)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2494)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.drawChild(ViewGroup.java:2890)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.widget.ListView.drawChild(ListView.java:3231)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2494)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.widget.AbsListView.dispatchDraw(AbsListView.java:2277)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.widget.ListView.dispatchDraw(ListView.java:3226)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.View.draw(View.java:11187)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.widget.AbsListView.draw(AbsListView.java:3760)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.drawChild(ViewGroup.java:2892)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2494)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.View.draw(View.java:11187)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.drawChild(ViewGroup.java:2892)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2494)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.View.draw(View.java:11187)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.widget.FrameLayout.draw(FrameLayout.java:450)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.drawChild(ViewGroup.java:2892)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2494)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.drawChild(ViewGroup.java:2890)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2494)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.View.draw(View.java:11187)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.widget.FrameLayout.draw(FrameLayout.java:450)
02-09 02:57:41.600 E/AndroidRuntime(18033): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2291)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewRootImpl.draw(ViewRootImpl.java:2210)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1816)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2628)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.os.Handler.dispatchMessage(Handler.java:99)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.os.Looper.loop(Looper.java:137)
02-09 02:57:41.600 E/AndroidRuntime(18033): at android.app.ActivityThread.main(ActivityThread.java:4511)
02-09 02:57:41.600 E/AndroidRuntime(18033): at java.lang.reflect.Method.invokeNative(Native Method)
02-09 02:57:41.600 E/AndroidRuntime(18033): at java.lang.reflect.Method.invoke(Method.java:511)
02-09 02:57:41.600 E/AndroidRuntime(18033): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
02-09 02:57:41.600 E/AndroidRuntime(18033): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
02-09 02:57:41.600 E/AndroidRuntime(18033): at dalvik.system.NativeStart.main(Native Method)

Help required

I am using the library in my app "Playlist Manager" The implementation of displaying albumart is more or less similar to the example. However, smoothie never seems to get it 100% correct. It seems to decide not to display according to some arbitary rules. I do not have the technical understanding to fully understand managing threads etc so have done my best to understand the process. I do not seem to get closer to resolving this.

For example, without touching, displaying 5 tracks from the same album (id = 12) albumart icon on the left, track detail, track duration and checkbox, produces different results each time. Never are all tracks displayed with its albumart. When flinging and moving up/down, smoothie is never able to be 100% correct and often displays the incorrect albumart (related to the previous page)
Below the sequence of events from ItemLoader using Log.i:

performLoadItem for position 0 - shouldDisplayItem = true
No pending item request, creating new: 12
performLoadItem - shouldDisplayItem = true|| isItemInMemory(itemParams)
performLoadItem for position 1 - shouldDisplayItem = true
No pending item request, creating new: 12
performLoadItem - shouldDisplayItem = true|| isItemInMemory(itemParams)
performLoadItem for position 2 - shouldDisplayItem = true
There's a pending item request, reusing: 12
performLoadItem - shouldDisplayItem = true|| isItemInMemory(itemParams)
performLoadItem for position 3 - shouldDisplayItem = true
There's a pending item request, reusing: 12
performLoadItem - shouldDisplayItem = true|| isItemInMemory(itemParams)
performLoadItem for position 4 - shouldDisplayItem = true
There's a pending item request, reusing: 12
performLoadItem - shouldDisplayItem = true|| isItemInMemory(itemParams)
mRequest.itemView != null - Done loading image:
mRequest.itemView != null - Done loading image:
mRequest.itemView != null - Done loading image:
mItemLoader.mHandler.post - run the display routine
mItemLoader.mHandler.post - run the display routine
mItemLoader.itemViewReused
mRequest.itemView != null - Done loading image:
mItemLoader.itemViewReused
mRequest.itemView != null - Done loading image:
mItemLoader.mHandler.post - run the display routine

The end result is shown
image

The outcome is different each time.

also
During my investigation I found the following code line 705
if (mItemLoader.itemViewReused(mRequest)) {
return;
}
but further on Line 719 the same test is made. Is one of these redundant?

Who can help me out here?

Random elements re-appearing when flinging

Hello lucasr,

I like your project very much, and I'd love to see it hit production! I don't know if the following is a bug or I'm doing something wrong, please advise.

I use list items with some text and an imageview, data coming from db. If I scroll slowly, everything seems to work fine. However, when I fling the list, and there's no chance of preloading items fast enough, instead of seeing the default (empty) placeholder view, I see random, already left behind elements re-appearing until the loading finishes and correct data and images replace them.

Could you please help me track down the source of this problem? It looks really annoying. Is there any place where the placeholder view gets cached? Where exactly does it get displayed until loading finishes?

Thanks & regards,
zsoltk

use not only on listviews

Why can't we use it to display the image on any imageview? Do we have to use AsyncListView? What will happen if we already using extended version of a listview? And how can we use it in a detail page for example?

AsyncGridView don't show Bitmap on left column if fastScrollEnabled="true"

I don't know what I am doing wrong, but when set fastScrollEnabled - true, and use this fast scroll images don't display on left column, but on right all good, and when I change to AsyncListView all works good too.

To reproduce this issue set in this sample https://github.com/lucasr/smoothie/tree/master/samples/gallery
fastScrollEnabled="true" in XML-layout

Could, somebody, give me some solution of this issue?

Thanks a lot, DavyJonesUA.

setItemManager prevents preview letter when implementing sectionIndexer

I have a ViewPager with 3 tabs, Tracks, Albums, Artists. Each fragment (alltracks, allalbums, allartists) is more or less identical apart from getting and displaying different media detail.
For the fragments where I display albumart, the preview letter when fastscrolling does not show.
However for the allartist tab, I do not display any albumart and have omitted mListView.setItemManager(builder.build()); The preview letter shows.
Adding the ListView.setItemManager(builder.build()); code, preview letter dissappears.

The SectionIndexer callbacks are not being called:
public Object[] getSections();
public int getPositionForSection(int sectionIndex)
public int getSectionForPosition(int position)

Is there anyhing that can be done?

multiple images per list item

any thoughts as to how to go about loading multiple images in a single row? looking through the code, i can't tell if it would be a rather complicated mess to handle or if it is pretty much baked in. sorry if this is an inappropriate forum for this question, but i figured it would be a good publicly answered question for others who are curious.

Loading additional data after first load

Sorry if this isn't the right place to ask, but in your BitmapCache example, you only load data the json for the patterns once, in my use case, I need to load additional pages after the first load (Each page has 20 results for example), would this be possible if so any hint how?

addFooterView cause IllegalStateException

When i use AsyncListView with addFooterView for a endless listview always got

IllegalStateException: The content of the adapter has changed but ListView did not receive a notification.

I found a hacky way to solve this.

change AsyncListView as fellow:

@OverRide
public ListAdapter getAdapter() {
// if (mItemManaged != null) {
// return mItemManaged.getWrappedAdapter();
// } else {
// return super.getAdapter();
// }
return super.getAdapter();
}

please fix this.

Horizontal Scrolling

Are there any ways to use AsyncListView or AsyncGridView with horizontal scrolling?

Cannot draw recycled bitmaps

Hello,

I'm using your lib with bitmap-cache on a ListView.
On some devices (and randomly), I get this kind of error.
My code is just a copy/paste of the example code, so I think the bug is on your side :)

E/AndroidRuntime( 1669): FATAL EXCEPTION: main
E/AndroidRuntime( 1669): java.lang.IllegalArgumentException: Cannot draw recycled bitmaps
E/AndroidRuntime( 1669): at android.view.GLES20Canvas.drawBitmap(GLES20Canvas.java:778)
E/AndroidRuntime( 1669): at android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:117)
E/AndroidRuntime( 1669): at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:393)
E/AndroidRuntime( 1669): at android.graphics.drawable.TransitionDrawable.draw(TransitionDrawable.java:216)
E/AndroidRuntime( 1669): at android.widget.ImageView.onDraw(ImageView.java:961)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13458)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12409)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2911)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12345)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13182)
E/AndroidRuntime( 1669): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13461)
E/AndroidRuntime( 1669): at android.widget.FrameLayout.draw(FrameLayout.java:467)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12409)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13182)
E/AndroidRuntime( 1669): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
E/AndroidRuntime( 1669): at android.widget.ListView.drawChild(ListView.java:3226)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
E/AndroidRuntime( 1669): at android.widget.AbsListView.dispatchDraw(AbsListView.java:2433)
E/AndroidRuntime( 1669): at android.widget.ListView.dispatchDraw(ListView.java:3221)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13461)
E/AndroidRuntime( 1669): at android.widget.AbsListView.draw(AbsListView.java:3759)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12409)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2911)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12345)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2911)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12345)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2911)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12345)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13182)
E/AndroidRuntime( 1669): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13461)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12409)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13182)
E/AndroidRuntime( 1669): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12407)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13182)
E/AndroidRuntime( 1669): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13461)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12409)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13182)
E/AndroidRuntime( 1669): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13461)
E/AndroidRuntime( 1669): at android.widget.FrameLayout.draw(FrameLayout.java:467)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12409)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13182)
E/AndroidRuntime( 1669): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12407)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12453)
E/AndroidRuntime( 1669): at android.view.View.draw(View.java:13182)
E/AndroidRuntime( 1669): at android.view.ViewGroup.drawChild(ViewGroup.java:2929)
E/AndroidRuntime( 1669): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2799)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12407)
E/AndroidRuntime( 1669): at android.view.View.getDisplayList(View.java:12

Multi-part items not loading

We have a 2-part item in our ListView, a big image with a small profile picture.

Some big images (first priority) don't load when the user is looking at them. Edit: What I mean here, if you scroll slowly, the off-screen images load properly, but if an image is not loaded, and the user has that ListView item visible on the screen, it never loads.

I enabled logging in Smoothie, and this is what I get on those items:

"Item should not load, bailing: ..." (line 243 in ItemLoader)

But they are null/set to placeholder, and should load. If I switch to single-item, the big images load properly.

The current hack is commenting out the entire block starting with:
if (!itemState.shouldLoadItem) {...}

Everything works as it should then, but I'm guessing there's a good reason that block is there, and it's definitely not the proper way :).

Runtime Exception when inflating AsyncListView

When i try to inflate the AsyncListView, like this:

AsyncListView mListView = (AsyncListView) findViewById(android.R.id.list);

This is the xml:

          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@android:id/list"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />```


It gives me this error: 

01-30 23:57:50.765: E/AndroidRuntime(11847): FATAL EXCEPTION: main
01-30 23:57:50.765: E/AndroidRuntime(11847): java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.giscar/br.com.giscar.ui.ACTDeviceSelectAsync}: android.view.InflateException: Binary XML file line #20: Error inflating class org.lucasr.smoothie.AsyncListView
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.os.Handler.dispatchMessage(Handler.java:99)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.os.Looper.loop(Looper.java:123)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.app.ActivityThread.main(ActivityThread.java:3687)
01-30 23:57:50.765: E/AndroidRuntime(11847): at java.lang.reflect.Method.invokeNative(Native Method)
01-30 23:57:50.765: E/AndroidRuntime(11847): at java.lang.reflect.Method.invoke(Method.java:507)
01-30 23:57:50.765: E/AndroidRuntime(11847): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
01-30 23:57:50.765: E/AndroidRuntime(11847): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
01-30 23:57:50.765: E/AndroidRuntime(11847): at dalvik.system.NativeStart.main(Native Method)
01-30 23:57:50.765: E/AndroidRuntime(11847): Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class org.lucasr.smoothie.AsyncListView
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-30 23:57:50.765: E/AndroidRuntime(11847): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.app.Activity.setContentView(Activity.java:1657)
01-30 23:57:50.765: E/AndroidRuntime(11847): at br.com.giscar.ui.ACTDeviceSelectAsync.onCreate(ACTDeviceSelectAsync.java:41)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
01-30 23:57:50.765: E/AndroidRuntime(11847): ... 11 more
01-30 23:57:50.765: E/AndroidRuntime(11847): Caused by: java.lang.reflect.InvocationTargetException
01-30 23:57:50.765: E/AndroidRuntime(11847): at java.lang.reflect.Constructor.constructNative(Native Method)
01-30 23:57:50.765: E/AndroidRuntime(11847): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
01-30 23:57:50.765: E/AndroidRuntime(11847): ... 21 more
01-30 23:57:50.765: E/AndroidRuntime(11847): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f06009b a=1 r=0x7f06009b}
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.content.res.Resources.loadDrawable(Resources.java:1681)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.widget.AbsListView.(AbsListView.java:658)
01-30 23:57:50.765: E/AndroidRuntime(11847): at android.widget.ListView.(ListView.java:201)
01-30 23:57:50.765: E/AndroidRuntime(11847): at org.lucasr.smoothie.AsyncListView.(AsyncListView.java:63)
01-30 23:57:50.765: E/AndroidRuntime(11847): at org.lucasr.smoothie.AsyncListView.(AsyncListView.java:58)



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.