Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Invalid ActionBar look after adjusting of indeterminate progress visibility and calling invalidateOptionsMenu and updating list model in onPostExecute #887

Open
httpdispatch opened this issue Apr 3, 2013 · 3 comments

Comments

@httpdispatch
Copy link

I've noticed this issue a long time ago but only now i was able to prepare demo which demonstrates it.
In application i have AsyncTask which may adjust visibility of actionbar indeterminate progress and reinit menu by calling invalidateOptionsMenu . This should hide refresh icon. This is working ok until i modify listView data model and call notifyDataSetChanged on adapter. After such action Actionbar may have broken view.
Expected view:
image

Broken view (Last item disappears or blank space added insted of in some cases):
image
image

The causing code is in onPostExecute

    @Override
        protected void onPostExecute(Void result)
        {
            super.onPostExecute(result);
            for (int i = 0; i < 10; i++)
            {
                adapter.items.add(i);
            }
            adapter.notifyDataSetChanged();
            activity.stopLoading();
        }
...
    void stopLoading()
    {
        if (loaders.decrementAndGet() == 0)
        {
            setSupportProgressBarIndeterminateVisibility(false);
            invalidateOptionsMenu();
        }
    }

Any idea why is this happening and in most cases because of updating listview adapter? If i remove line adapter.notifyDataSetChanged(); actionbar will not be broken.

Project demonstrating an issue: http://goo.gl/ZbMTU (Updated, previous url was wrong)

@httpdispatch
Copy link
Author

updated project url, previous was wrong

@httpdispatch
Copy link
Author

The demo may repeat the issue on android 2.1 emulator also. Original shots was from my ICS 4.0.3 device. The last menu item should not disappear and be unavailable even via menu button.

@httpdispatch
Copy link
Author

Keep digging on this issue. Seems that not exactly adapter.notifyDataSetChanged() causes invalid look, but the requestLayout call by the AdapterView.AdapterDataSetObserver which is listening for the data set changed event in the ListView. @JakeWharton any ideas?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant