implemented some api

This commit is contained in:
Mariotaku Lee 2015-05-10 01:26:48 +08:00
parent fa14be1f8e
commit 92727151cd
4 changed files with 17 additions and 13 deletions

View File

@ -22,6 +22,7 @@ package org.mariotaku.twidere.api.twitter.model.impl;
import android.support.annotation.NonNull;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.mariotaku.twidere.api.twitter.model.Trends;
import org.mariotaku.twidere.api.twitter.util.TwitterTrendsDateConverter;
@ -31,6 +32,7 @@ import java.util.Date;
/**
* Created by mariotaku on 15/5/10.
*/
@JsonObject
public class TrendsImpl extends TwitterResponseImpl implements Trends {
@JsonField(name = "as_of", typeConverter = TwitterTrendsDateConverter.class)

View File

@ -51,6 +51,7 @@ import org.mariotaku.twidere.api.twitter.model.SavedSearch;
import org.mariotaku.twidere.api.twitter.model.Status;
import org.mariotaku.twidere.api.twitter.model.TranslationResult;
import org.mariotaku.twidere.api.twitter.model.Trend;
import org.mariotaku.twidere.api.twitter.model.Trends;
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
import org.mariotaku.twidere.api.twitter.model.User;
import org.mariotaku.twidere.api.twitter.model.UserList;
@ -76,6 +77,7 @@ import org.mariotaku.twidere.api.twitter.model.impl.SavedSearchImpl;
import org.mariotaku.twidere.api.twitter.model.impl.StatusImpl;
import org.mariotaku.twidere.api.twitter.model.impl.TranslationResultImpl;
import org.mariotaku.twidere.api.twitter.model.impl.TrendImpl;
import org.mariotaku.twidere.api.twitter.model.impl.TrendsImpl;
import org.mariotaku.twidere.api.twitter.model.impl.TwitterResponseImpl;
import org.mariotaku.twidere.api.twitter.model.impl.TypeConverterMapper;
import org.mariotaku.twidere.api.twitter.model.impl.UrlEntityImpl;
@ -128,6 +130,7 @@ public class TwitterConverter implements Converter {
TypeConverterMapper.register(TranslationResult.class, TranslationResultImpl.class);
TypeConverterMapper.register(Language.class, LanguageImpl.class);
TypeConverterMapper.register(Trend.class, TrendImpl.class);
TypeConverterMapper.register(Trends.class, TrendsImpl.class);
TypeConverterMapper.register(Location.class, LocationImpl.class);
TypeConverterMapper.register(Location.PlaceType.class, LocationImpl.PlaceTypeImpl.class);
TypeConverterMapper.register(IDs.class, IDsImpl.class, IDsImpl.MAPPER);

View File

@ -10,7 +10,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public abstract class TwitterTrendsDateConverter implements TypeConverter<Date> {
public class TwitterTrendsDateConverter implements TypeConverter<Date> {
private static final Object FORMATTER_LOCK = new Object();
private static final SimpleDateFormat DATE_FORMAT_1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH);

View File

@ -29,6 +29,16 @@ import org.json.JSONObject;
import org.mariotaku.twidere.TwidereConstants;
import org.mariotaku.twidere.api.twitter.auth.OAuthAuthorization;
import org.mariotaku.twidere.api.twitter.auth.OAuthToken;
import org.mariotaku.twidere.api.twitter.model.DirectMessage;
import org.mariotaku.twidere.api.twitter.model.GeoLocation;
import org.mariotaku.twidere.api.twitter.model.Place;
import org.mariotaku.twidere.api.twitter.model.Relationship;
import org.mariotaku.twidere.api.twitter.model.SavedSearch;
import org.mariotaku.twidere.api.twitter.model.Status;
import org.mariotaku.twidere.api.twitter.model.Trend;
import org.mariotaku.twidere.api.twitter.model.Trends;
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
import org.mariotaku.twidere.api.twitter.model.User;
import org.mariotaku.twidere.model.ParcelableAccount;
import org.mariotaku.twidere.model.ParcelableDirectMessage;
import org.mariotaku.twidere.model.ParcelableLocation;
@ -54,17 +64,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.mariotaku.twidere.api.twitter.model.DirectMessage;
import org.mariotaku.twidere.api.twitter.model.GeoLocation;
import org.mariotaku.twidere.api.twitter.model.Place;
import org.mariotaku.twidere.api.twitter.model.Relationship;
import org.mariotaku.twidere.api.twitter.model.SavedSearch;
import org.mariotaku.twidere.api.twitter.model.Status;
import org.mariotaku.twidere.api.twitter.model.Trend;
import org.mariotaku.twidere.api.twitter.model.Trends;
import org.mariotaku.twidere.api.twitter.model.UrlEntity;
import org.mariotaku.twidere.api.twitter.model.User;
import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText;
public final class ContentValuesCreator implements TwidereConstants {
@ -463,7 +462,7 @@ public final class ContentValuesCreator implements TwidereConstants {
if (trendsList == null) return new ContentValues[0];
final List<ContentValues> resultList = new ArrayList<>();
for (final Trends trends : trendsList) {
final long timestamp = trends.getTrendAt().getTime();
final long timestamp = trends.getAsOf().getTime();
for (final Trend trend : trends.getTrends()) {
final ContentValues values = new ContentValues();
values.put(CachedTrends.NAME, trend.getName());