Example usage for twitter4j TwitterAPIConfiguration getShortURLLengthHttps

List of usage examples for twitter4j TwitterAPIConfiguration getShortURLLengthHttps

Introduction

In this page you can find the example usage for twitter4j TwitterAPIConfiguration getShortURLLengthHttps.

Prototype

int getShortURLLengthHttps();

Source Link

Usage

From source file:com.freshdigitable.udonroad.module.realm.TwitterAPIConfigurationRealm.java

License:Apache License

TwitterAPIConfigurationRealm(TwitterAPIConfiguration configuration) {
    this.photoSizeLimit = configuration.getPhotoSizeLimit();
    this.shortURLLength = configuration.getShortURLLength();
    this.shortURLLengthHttps = configuration.getShortURLLengthHttps();
    this.charactersReservedPerMedia = configuration.getCharactersReservedPerMedia();
    this.maxMediaPerUpload = configuration.getMaxMediaPerUpload();
}

From source file:com.freshdigitable.udonroad.util.TwitterResponseMock.java

License:Apache License

public static TwitterAPIConfiguration createTwitterAPIConfigMock() {
    final TwitterAPIConfiguration mock = mock(TwitterAPIConfiguration.class);
    when(mock.getShortURLLength()).thenReturn(23);
    when(mock.getShortURLLengthHttps()).thenReturn(23);
    return mock;/* ww  w  . j  a v  a  2 s .c  o m*/
}

From source file:com.javielinux.utils.Utils.java

License:Apache License

static public void saveApiConfiguration(Context cnt) {
    boolean todo = false;
    long time = PreferenceUtils.getDateApiConfiguration(cnt);
    if (time < 0) {
        PreferenceUtils.setDateApiConfiguration(cnt, new Date().getTime());
        todo = true;/*from  ww w . ja v a 2 s  .  com*/
    } else {
        Date dateToday = new Date();
        Date dateRefresh = new Date(time);
        if (dateToday.after(dateRefresh)) {
            todo = true;
            Calendar calToday = Calendar.getInstance();
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd H:m");
            String tomorrow = Utils.getTomorrow(calToday.get(Calendar.YEAR), (calToday.get(Calendar.MONTH) + 1),
                    calToday.get(Calendar.DATE));
            try {
                Date nextDate = format.parse(tomorrow + " 10:00");
                PreferenceUtils.setDateApiConfiguration(cnt, nextDate.getTime());
            } catch (ParseException e) {
                e.printStackTrace();
            }

        }
    }

    if (todo) {

        Log.d(Utils.TAG, "Cargar configuracin");

        ConnectionManager.getInstance().open(cnt);

        try {
            TwitterAPIConfiguration api = ConnectionManager.getInstance().getUserForSearchesTwitter()
                    .getAPIConfiguration();
            PreferenceUtils.setShortURLLength(cnt, api.getShortURLLength());
            PreferenceUtils.setShortURLLengthHttps(cnt, api.getShortURLLengthHttps());
        } catch (TwitterException e1) {
            e1.printStackTrace();
        } catch (Exception e1) {
            e1.printStackTrace();
        }

    }
}