Show ProgressBar while Twitter is loading Timeline

android
fabric
embeddedtimeline

#1

Simplest example from documentation for showing timeline is as following:

final UserTimeline userTimeline = new UserTimeline.Builder()
            .screenName("fabric")
            .build();
        final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(this)
            .setTimeline(userTimeline)
            .build();
        setListAdapter(adapter);

It does show Tweets in a list. It does a background network call to download data and then shows it. So until API is doing network call there’s blank screen with no indication that something is happening.
Is there any Callback we can add in above example for Success and Error where we can update our own implementation of ProgressBar?

Documentation does have an example of using SwipeRefreshLayout but that works when there’s already Loaded List (2nd time loading). I am looking for showing Progress when application is loading data for the first time using code posted above.


#2

Hey @Sharj,

Awesome question - for loading for the first time there isn’t a progress bar or loading indicator built out currently, though you could have a flag that was set if this was the first load for a user and display something until the timeline is ready.

-Mike


#3

Hi @bonnell,

Yes, I am trying to add my own progress indicator but the problem is how to know when the Twitter Timeline is downloaded. I couldn’t find a callback function that notify that Timeline has downloaded so we can hide loading indicator.

Using following code and couldn’t find a way to add a callback function that notify tweets have downloaded:

final UserTimeline userTimeline = new UserTimeline.Builder()
            .screenName("fabric")
            .build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(this)
            .setTimeline(userTimeline)
            .build();
setListAdapter(adapter);

#4

Thanks @Sharj, I did misunderstand slightly, but you raise up a great point. I’ve shared this with the team to see if we can add a callback in a future release.


#5