Android Open Source - SimpleTwitterClient Third Party Timeline Fragment






From Project

Back to project page SimpleTwitterClient.

License

The source code is released under:

Apache License

If you think the Android project SimpleTwitterClient listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codepath.apps.basictwitter.fragments;
/*  w  ww.j  a  v a2 s. c o  m*/
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.codepath.apps.basictwitter.clients.TwitterClient;
import com.codepath.apps.basictwitter.listeners.EndlessScrollListener;

/**
 * Container for displaying third party (another user's) profile and timeline.
 */
public class ThirdPartyTimelineFragment extends TweetsListFragment {
    private String screenName = null;

    /**
     * Singleton used for inter fragment communication.
     */
    public static ThirdPartyTimelineFragment newInstance(String screenName) {
        ThirdPartyTimelineFragment fragmentInstance = new ThirdPartyTimelineFragment();
        Bundle args = new Bundle();
        args.putString("screenName", screenName);
        fragmentInstance.setArguments(args);
        return fragmentInstance;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        screenName = getArguments().getString("screenName", "");
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = super.onCreateView(inflater, container, savedInstanceState);
        lvTweets.setOnScrollListener(new EndlessScrollListener() {
            @Override
            protected void onLoadMore(@Nullable Long maxId, int totalItemCount) {
                // Triggered only when new data needs to be appended to adapterView.
                if (firstTime) {
                    doLoad(TwitterClient.USER_TIMELINE_ENDPOINT, maxId, screenName, true); // Clear adapter.
                    firstTime = false;
                } else {
                    doLoad(TwitterClient.USER_TIMELINE_ENDPOINT, maxId, screenName, false);
                    // Do not clear adapter. Just append.
                }
            }
        });
        return v;
    }
}




Java Source Code List

com.codepath.apps.basictwitter.TwitterApplication.java
com.codepath.apps.basictwitter.activities.ComposeActivity.java
com.codepath.apps.basictwitter.activities.LoginActivity.java
com.codepath.apps.basictwitter.activities.ProfileActivity.java
com.codepath.apps.basictwitter.activities.ThirdPartyActivity.java
com.codepath.apps.basictwitter.activities.TimelineActivity.java
com.codepath.apps.basictwitter.adapters.TweetAdapter.java
com.codepath.apps.basictwitter.clients.TwitterClient.java
com.codepath.apps.basictwitter.fragments.HomeTimelineFragment.java
com.codepath.apps.basictwitter.fragments.MentionsTimelineFragment.java
com.codepath.apps.basictwitter.fragments.ThirdPartyTimelineFragment.java
com.codepath.apps.basictwitter.fragments.TweetsListFragment.java
com.codepath.apps.basictwitter.fragments.UserTimelineFragment.java
com.codepath.apps.basictwitter.helpers.DateTimeUtils.java
com.codepath.apps.basictwitter.helpers.NetworkUtils.java
com.codepath.apps.basictwitter.helpers.UserUtils.java
com.codepath.apps.basictwitter.listeners.EndlessScrollListener.java
com.codepath.apps.basictwitter.listeners.SupportFragmentTabListener.java
com.codepath.apps.basictwitter.models.Tweet.java
com.codepath.apps.basictwitter.models.User.java