Example usage for twitter4j.conf Configuration getOAuthConsumerKey

List of usage examples for twitter4j.conf Configuration getOAuthConsumerKey

Introduction

In this page you can find the example usage for twitter4j.conf Configuration getOAuthConsumerKey.

Prototype

@Override
    String getOAuthConsumerKey();

Source Link

Usage

From source file:de.vanita5.twittnuker.loader.support.StatusConversationLoader.java

License:Open Source License

@Override
public List<Status> getStatuses(final Twitter twitter, final Paging paging) throws TwitterException {
    final Context context = getContext();
    final Configuration conf = twitter.getConfiguration();
    final Authorization auth = twitter.getAuthorization();
    final boolean isOAuth = auth instanceof OAuthAuthorization || auth instanceof XAuthAuthorization;
    final String consumerKey = conf.getOAuthConsumerKey(), consumerSecret = conf.getOAuthConsumerSecret();
    if (shouldForceUsingPrivateAPIs(context)
            || isOAuth && isOfficialConsumerKeySecret(context, consumerKey, consumerSecret))
        return twitter.showConversation(mInReplyToStatusId, paging);
    return Collections.emptyList();
}

From source file:de.vanita5.twittnuker.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues makeAccountContentValuesOAuth(final Configuration conf,
        final AccessToken accessToken, final User user, final int authType, final int color,
        final String apiUrlFormat, final boolean sameOAuthSigningUrl, final boolean noVersionSuffix) {
    if (user == null || user.getId() <= 0 || accessToken == null || user.getId() != accessToken.getUserId())
        return null;
    final ContentValues values = new ContentValues();
    values.put(Accounts.OAUTH_TOKEN, accessToken.getToken());
    values.put(Accounts.OAUTH_TOKEN_SECRET, accessToken.getTokenSecret());
    values.put(Accounts.CONSUMER_KEY, conf.getOAuthConsumerKey());
    values.put(Accounts.CONSUMER_SECRET, conf.getOAuthConsumerSecret());
    values.put(Accounts.AUTH_TYPE, authType);
    values.put(Accounts.ACCOUNT_ID, user.getId());
    values.put(Accounts.SCREEN_NAME, user.getScreenName());
    values.put(Accounts.NAME, user.getName());
    values.put(Accounts.PROFILE_IMAGE_URL, ParseUtils.parseString(user.getProfileImageUrlHttps()));
    values.put(Accounts.PROFILE_BANNER_URL, ParseUtils.parseString(user.getProfileBannerImageUrl()));
    values.put(Accounts.COLOR, color);/*from w  w  w  . j  a v  a 2 s.c  om*/
    values.put(Accounts.IS_ACTIVATED, 1);
    values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
    values.put(Accounts.SAME_OAUTH_SIGNING_URL, sameOAuthSigningUrl);
    values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix);
    return values;
}

From source file:de.vanita5.twittnuker.util.Utils.java

License:Open Source License

public static boolean isOfficialTwitterInstance(final Context context, final Twitter twitter) {
    if (context == null || twitter == null)
        return false;
    final Configuration conf = twitter.getConfiguration();
    final Authorization auth = twitter.getAuthorization();
    final boolean isOAuth = auth instanceof OAuthAuthorization || auth instanceof XAuthAuthorization;
    final String consumerKey = conf.getOAuthConsumerKey(), consumerSecret = conf.getOAuthConsumerSecret();
    return isOAuth && isOfficialConsumerKeySecret(context, consumerKey, consumerSecret);
}

From source file:org.getlantern.firetweet.util.ContentValuesCreator.java

License:Open Source License

public static ContentValues createAccount(final Configuration conf, final AccessToken accessToken,
        final User user, final int authType, final int color, final String apiUrlFormat,
        final boolean sameOAuthSigningUrl, final boolean noVersionSuffix) {
    if (user == null || user.getId() <= 0 || accessToken == null || user.getId() != accessToken.getUserId())
        return null;
    final ContentValues values = new ContentValues();
    values.put(Accounts.OAUTH_TOKEN, accessToken.getToken());
    values.put(Accounts.OAUTH_TOKEN_SECRET, accessToken.getTokenSecret());
    values.put(Accounts.CONSUMER_KEY, conf.getOAuthConsumerKey());
    values.put(Accounts.CONSUMER_SECRET, conf.getOAuthConsumerSecret());
    values.put(Accounts.AUTH_TYPE, authType);
    values.put(Accounts.ACCOUNT_ID, user.getId());
    values.put(Accounts.SCREEN_NAME, user.getScreenName());
    values.put(Accounts.NAME, user.getName());
    values.put(Accounts.PROFILE_IMAGE_URL, user.getProfileImageUrlHttps());
    values.put(Accounts.PROFILE_BANNER_URL, user.getProfileBannerImageUrl());
    values.put(Accounts.COLOR, color);/*from  w  w w. j a v a2s.c  o  m*/
    values.put(Accounts.IS_ACTIVATED, 1);
    values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
    values.put(Accounts.SAME_OAUTH_SIGNING_URL, sameOAuthSigningUrl);
    values.put(Accounts.NO_VERSION_SUFFIX, noVersionSuffix);
    return values;
}

From source file:org.getlantern.firetweet.util.Utils.java

License:Open Source License

public static boolean isOfficialTwitterInstance(final Context context, final Twitter twitter) {
    if (context == null || twitter == null)
        return false;
    final Configuration conf = twitter.getConfiguration();
    final Authorization auth = twitter.getAuthorization();
    final boolean isOAuth = auth instanceof OAuthAuthorization || auth instanceof XAuthAuthorization;
    final String consumerKey = conf.getOAuthConsumerKey(), consumerSecret = conf.getOAuthConsumerSecret();
    return isOAuth && TwitterContentUtils.isOfficialKey(context, consumerKey, consumerSecret);
}