Java Code Examples for com.twitter.sdk.android.core.TwitterCore#getInstance()

The following examples show how to use com.twitter.sdk.android.core.TwitterCore#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OAuthActivity.java    From twitter-kit-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tw__activity_oauth);

    spinner = findViewById(R.id.tw__spinner);
    webView = findViewById(R.id.tw__web_view);

    final boolean showProgress;
    if (savedInstanceState != null) {
        showProgress = savedInstanceState.getBoolean(STATE_PROGRESS, false);
    } else {
        showProgress = true;
    }
    spinner.setVisibility(showProgress ? View.VISIBLE : View.GONE);

    final TwitterCore kit = TwitterCore.getInstance();
    oAuthController = new OAuthController(spinner, webView,
            getIntent().getParcelableExtra(EXTRA_AUTH_CONFIG),
            new OAuth1aService(kit, new TwitterApi()), this);
    oAuthController.startAuth();
}
 
Example 2
Source File: TweetUi.java    From twitter-kit-android with Apache License 2.0 5 votes vote down vote up
TweetUi() {
    final TwitterCore twitterCore = TwitterCore.getInstance();

    context = Twitter.getInstance().getContext(getIdentifier());
    sessionManager = twitterCore.getSessionManager();
    guestSessionProvider = twitterCore.getGuestSessionProvider();
    tweetRepository = new TweetRepository(new Handler(Looper.getMainLooper()),
            twitterCore.getSessionManager());
    imageLoader = Picasso.with(Twitter.getInstance().getContext(getIdentifier()));
}
 
Example 3
Source File: TwitterLoginButton.java    From twitter-kit-android with Apache License 2.0 5 votes vote down vote up
private void checkTwitterCoreAndEnable() {
    //Default (Enabled) in edit mode
    if (isInEditMode()) return;

    try {
        TwitterCore.getInstance();
    } catch (IllegalStateException ex) {
        //Disable if TwitterCore hasn't started
        Twitter.getLogger().e(TAG, ex.getMessage());
        setEnabled(false);
    }
}
 
Example 4
Source File: TweetsFragment.java    From white-label-event-app with Apache License 2.0 5 votes vote down vote up
private void initTwitterSearch() {
    core = TwitterCore.getInstance();
    session = core.getSessionManager().getActiveSession();
    if (session != null) {
        client = core.getApiClient(session);
    }
    else {
        client = core.getGuestApiClient();
    }

    if (client != null) {
        doSearch();
    }
}
 
Example 5
Source File: TweetRepository.java    From twitter-kit-android with Apache License 2.0 4 votes vote down vote up
TweetRepository(Handler mainHandler, SessionManager<TwitterSession> userSessionManagers) {
    this(mainHandler, userSessionManagers, TwitterCore.getInstance());
}
 
Example 6
Source File: SearchTimeline.java    From twitter-kit-android with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs a Builder.
 */
public Builder() {
    twitterCore = TwitterCore.getInstance();
}
 
Example 7
Source File: CollectionTimeline.java    From twitter-kit-android with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs a Builder.
 */
public Builder() {
    twitterCore = TwitterCore.getInstance();
}
 
Example 8
Source File: UserTimeline.java    From twitter-kit-android with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs a Builder.
 */
public Builder() {
    twitterCore = TwitterCore.getInstance();
}
 
Example 9
Source File: TwitterListTimeline.java    From twitter-kit-android with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs a Builder.
 */
public Builder() {
    twitterCore = TwitterCore.getInstance();
}
 
Example 10
Source File: TwitterAuthClient.java    From twitter-kit-android with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor.
 *
 * @throws java.lang.IllegalStateException if called before starting TwitterKit with
 *                                         Twitter.initialize()
 */
public TwitterAuthClient() {
    this(TwitterCore.getInstance(), TwitterCore.getInstance().getAuthConfig(),
            TwitterCore.getInstance().getSessionManager(), AuthStateLazyHolder.INSTANCE);
}