Cleaning up loading view

I was seeing a lot of strange behaviors with loading view, so this CL is
to flush out most of those bugs and make the view showing logic a little
more intuitive.

- Removed listview.setEmptyView calls because we manually handle our
empty view state.
- Removed showEmptyView from onFolderChanged. The empty state will only
be shown whenever the ConversationCursor updates.
- Renamed mJustLoadedNewList -> mInitialCursorLoading and moved it out
of updateAnalyticsData.
- BUG: cursor status not properly updating out of LOADING state, and if
the actual cursor has size of 0, we would continuously try to show the
empty state because isLoadingAndEmpty will return true. I fixed this by
adding mInitialCursorLoading into account.
- The previous change caused a race condition with handler thread and
main thread where the loading view will never get taken down. This
is mainly because after we set mInitialCursorLoading to false, we don't
try to hide loading view. As a result, I moved the logic for
hideLoadingViewAndShowContents to after onCursorUpdated.
- Moved the logic for scheduling the loading view runnable to
onFolderUpdated because we only want to show the loading view once
when we switch folders. It doesn't need to happen every time a cursor
updates.

b/14296125
Change-Id: I5e58b0140b0e6ec275d33d9e5e31d3f83a050a06
1 file changed