restarts activity when tabs changed.
improved quote feature fixed media preview in status screen
This commit is contained in:
parent
afccb39a43
commit
1371bb901c
|
@ -26,7 +26,6 @@ import android.os.Parcelable;
|
|||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.DirectMessages;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.SimpleValueSerializer;
|
||||
import org.mariotaku.twidere.util.TwitterContentUtils;
|
||||
|
||||
|
@ -122,10 +121,8 @@ public class ParcelableDirectMessage implements Parcelable, Comparable<Parcelabl
|
|||
this.account_id = account_id;
|
||||
this.is_outgoing = is_outgoing;
|
||||
final User sender = message.getSender(), recipient = message.getRecipient();
|
||||
final String sender_profile_image_url_string = sender != null ? ParseUtils.parseString(sender
|
||||
.getProfileImageUrlHttps()) : null;
|
||||
final String recipient_profile_image_url_string = recipient != null ? ParseUtils.parseString(recipient
|
||||
.getProfileImageUrlHttps()) : null;
|
||||
final String sender_profile_image_url = sender != null ? sender.getProfileImageUrlHttps() : null;
|
||||
final String recipient_profile_image_url = recipient != null ? recipient.getProfileImageUrlHttps() : null;
|
||||
id = message.getId();
|
||||
timestamp = getTime(message.getCreatedAt());
|
||||
sender_id = sender != null ? sender.getId() : -1;
|
||||
|
@ -136,8 +133,8 @@ public class ParcelableDirectMessage implements Parcelable, Comparable<Parcelabl
|
|||
recipient_name = recipient != null ? recipient.getName() : null;
|
||||
sender_screen_name = sender != null ? sender.getScreenName() : null;
|
||||
recipient_screen_name = recipient != null ? recipient.getScreenName() : null;
|
||||
sender_profile_image_url = sender_profile_image_url_string;
|
||||
recipient_profile_image_url = recipient_profile_image_url_string;
|
||||
this.sender_profile_image_url = sender_profile_image_url;
|
||||
this.recipient_profile_image_url = recipient_profile_image_url;
|
||||
text_unescaped = toPlainText(text_html);
|
||||
media = ParcelableMedia.fromEntities(message);
|
||||
}
|
||||
|
|
|
@ -8,14 +8,12 @@ import android.support.annotation.Nullable;
|
|||
import org.mariotaku.jsonserializer.JSONParcel;
|
||||
import org.mariotaku.jsonserializer.JSONParcelable;
|
||||
import org.mariotaku.twidere.util.MediaPreviewUtils;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.SimpleValueSerializer;
|
||||
import org.mariotaku.twidere.util.SimpleValueSerializer.Reader;
|
||||
import org.mariotaku.twidere.util.SimpleValueSerializer.SerializationException;
|
||||
import org.mariotaku.twidere.util.SimpleValueSerializer.SimpleValueSerializable;
|
||||
import org.mariotaku.twidere.util.SimpleValueSerializer.Writer;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -96,8 +94,8 @@ public class ParcelableMedia implements Parcelable, JSONParcelable, SimpleValueS
|
|||
}
|
||||
|
||||
public ParcelableMedia(final MediaEntity entity) {
|
||||
page_url = ParseUtils.parseString(entity.getMediaURL());
|
||||
media_url = ParseUtils.parseString(entity.getMediaURL());
|
||||
page_url = entity.getMediaURL();
|
||||
media_url = entity.getMediaURL();
|
||||
start = entity.getStart();
|
||||
end = entity.getEnd();
|
||||
type = getTypeInt(entity.getType());
|
||||
|
@ -284,7 +282,7 @@ public class ParcelableMedia implements Parcelable, JSONParcelable, SimpleValueS
|
|||
}
|
||||
if (mediaEntities != null) {
|
||||
for (final MediaEntity media : mediaEntities) {
|
||||
final URL mediaURL = media.getMediaURL();
|
||||
final String mediaURL = media.getMediaURL();
|
||||
if (mediaURL != null) {
|
||||
list.add(new ParcelableMedia(media));
|
||||
}
|
||||
|
@ -293,7 +291,7 @@ public class ParcelableMedia implements Parcelable, JSONParcelable, SimpleValueS
|
|||
final URLEntity[] urlEntities = entities.getURLEntities();
|
||||
if (urlEntities != null) {
|
||||
for (final URLEntity url : urlEntities) {
|
||||
final String expanded = ParseUtils.parseString(url.getExpandedURL());
|
||||
final String expanded = url.getExpandedURL();
|
||||
final String media_url = MediaPreviewUtils.getSupportedLink(expanded);
|
||||
if (expanded != null && media_url != null) {
|
||||
list.add(new ParcelableMedia(media_url, expanded, url.getStart(), url.getEnd(), TYPE_IMAGE));
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.mariotaku.twidere.model;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
@ -34,10 +33,8 @@ import org.mariotaku.jsonserializer.JSONParcelable;
|
|||
import org.mariotaku.jsonserializer.JSONSerializer;
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Statuses;
|
||||
import org.mariotaku.twidere.util.HtmlEscapeHelper;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.SimpleValueSerializer;
|
||||
import org.mariotaku.twidere.util.TwitterContentUtils;
|
||||
import org.mariotaku.twidere.util.content.ContentValuesUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
@ -90,9 +87,6 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
return (int) diff;
|
||||
}
|
||||
};
|
||||
public final long id, account_id, timestamp, user_id, retweet_id, retweeted_by_id, retweet_timestamp,
|
||||
retweet_count, favorite_count, reply_count, descendent_reply_count, in_reply_to_status_id,
|
||||
in_reply_to_user_id, my_retweet_id, quote_id, quote_timestamp, quoted_by_user_id;
|
||||
public static final Comparator<ParcelableStatus> REVERSE_ID_COMPARATOR = new Comparator<ParcelableStatus>() {
|
||||
|
||||
@Override
|
||||
|
@ -103,13 +97,19 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
return (int) diff;
|
||||
}
|
||||
};
|
||||
|
||||
public final long id, account_id, timestamp, user_id, retweet_id, retweeted_by_id, retweet_timestamp,
|
||||
retweet_count, favorite_count, reply_count, descendent_reply_count, in_reply_to_status_id,
|
||||
in_reply_to_user_id, my_retweet_id, quote_id, quote_timestamp, quoted_by_user_id;
|
||||
|
||||
public final boolean is_gap, is_retweet, is_favorite, is_possibly_sensitive, user_is_following, user_is_protected,
|
||||
user_is_verified, is_quote;
|
||||
user_is_verified, is_quote, quoted_by_user_is_protected, quoted_by_user_is_verified;
|
||||
|
||||
public final String retweeted_by_name, retweeted_by_screen_name, retweeted_by_profile_image,
|
||||
text_html, text_plain, user_name, user_screen_name, in_reply_to_name, in_reply_to_screen_name,
|
||||
source, user_profile_image_url, text_unescaped, card_name, quote_text_html, quote_text_plain,
|
||||
quote_text_unescaped, quoted_by_user_name, quoted_by_user_screen_name, quoted_by_user_profile_image;
|
||||
quote_text_unescaped, quote_source, quoted_by_user_name, quoted_by_user_screen_name,
|
||||
quoted_by_user_profile_image;
|
||||
|
||||
public final ParcelableLocation location;
|
||||
|
||||
|
@ -121,58 +121,6 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
|
||||
public final ParcelableCardEntity card;
|
||||
|
||||
public ParcelableStatus(final ContentValues values) {
|
||||
id = ContentValuesUtils.getAsLong(values, Statuses.STATUS_ID, -1);
|
||||
account_id = ContentValuesUtils.getAsLong(values, Statuses.ACCOUNT_ID, -1);
|
||||
timestamp = ContentValuesUtils.getAsLong(values, Statuses.STATUS_TIMESTAMP, -1);
|
||||
user_id = ContentValuesUtils.getAsLong(values, Statuses.USER_ID, -1);
|
||||
retweet_id = ContentValuesUtils.getAsLong(values, Statuses.RETWEET_ID, -1);
|
||||
retweet_timestamp = ContentValuesUtils.getAsLong(values, Statuses.RETWEET_TIMESTAMP, -1);
|
||||
retweeted_by_id = ContentValuesUtils.getAsLong(values, Statuses.RETWEETED_BY_USER_ID, -1);
|
||||
user_name = values.getAsString(Statuses.USER_NAME);
|
||||
user_screen_name = values.getAsString(Statuses.USER_SCREEN_NAME);
|
||||
text_html = values.getAsString(Statuses.TEXT_HTML);
|
||||
text_plain = values.getAsString(Statuses.TEXT_PLAIN);
|
||||
user_profile_image_url = values.getAsString(Statuses.USER_PROFILE_IMAGE_URL);
|
||||
is_favorite = ContentValuesUtils.getAsBoolean(values, Statuses.IS_FAVORITE, false);
|
||||
is_retweet = ContentValuesUtils.getAsBoolean(values, Statuses.IS_RETWEET, false);
|
||||
is_gap = ContentValuesUtils.getAsBoolean(values, Statuses.IS_GAP, false);
|
||||
location = ParcelableLocation.fromString(values.getAsString(Statuses.LOCATION));
|
||||
user_is_protected = ContentValuesUtils.getAsBoolean(values, Statuses.IS_PROTECTED, false);
|
||||
user_is_verified = ContentValuesUtils.getAsBoolean(values, Statuses.IS_VERIFIED, false);
|
||||
in_reply_to_status_id = ContentValuesUtils.getAsLong(values, Statuses.IN_REPLY_TO_STATUS_ID, -1);
|
||||
in_reply_to_user_id = ContentValuesUtils.getAsLong(values, Statuses.IN_REPLY_TO_USER_ID, -1);
|
||||
in_reply_to_name = values.getAsString(Statuses.IN_REPLY_TO_USER_NAME);
|
||||
in_reply_to_screen_name = values.getAsString(Statuses.IN_REPLY_TO_USER_SCREEN_NAME);
|
||||
my_retweet_id = ContentValuesUtils.getAsLong(values, Statuses.MY_RETWEET_ID, -1);
|
||||
retweeted_by_name = values.getAsString(Statuses.RETWEETED_BY_USER_NAME);
|
||||
retweeted_by_screen_name = values.getAsString(Statuses.RETWEETED_BY_USER_SCREEN_NAME);
|
||||
retweeted_by_profile_image = values.getAsString(Statuses.RETWEETED_BY_USER_PROFILE_IMAGE);
|
||||
source = values.getAsString(Statuses.SOURCE);
|
||||
retweet_count = ContentValuesUtils.getAsInteger(values, Statuses.RETWEET_COUNT, 0);
|
||||
favorite_count = ContentValuesUtils.getAsInteger(values, Statuses.FAVORITE_COUNT, 0);
|
||||
reply_count = ContentValuesUtils.getAsInteger(values, Statuses.REPLY_COUNT, 0);
|
||||
descendent_reply_count = ContentValuesUtils.getAsInteger(values, Statuses.DESCENDENT_REPLY_COUNT, 0);
|
||||
text_unescaped = values.getAsString(Statuses.TEXT_UNESCAPED);
|
||||
media = SimpleValueSerializer.fromSerializedString(values.getAsString(Statuses.MEDIA_LIST), ParcelableMedia.SIMPLE_CREATOR);
|
||||
is_possibly_sensitive = ContentValuesUtils.getAsBoolean(values, Statuses.IS_POSSIBLY_SENSITIVE, false);
|
||||
user_is_following = ContentValuesUtils.getAsBoolean(values, Statuses.IS_FOLLOWING, false);
|
||||
mentions = SimpleValueSerializer.fromSerializedString(values.getAsString(Statuses.MENTIONS_LIST), ParcelableUserMention.SIMPLE_CREATOR);
|
||||
card = ParcelableCardEntity.fromJSONString(values.getAsString(Statuses.CARD));
|
||||
place_full_name = values.getAsString(Statuses.PLACE_FULL_NAME);
|
||||
is_quote = ContentValuesUtils.getAsBoolean(values, Statuses.IS_QUOTE, false);
|
||||
quote_id = ContentValuesUtils.getAsLong(values, Statuses.QUOTE_ID, -1);
|
||||
quote_timestamp = ContentValuesUtils.getAsLong(values, Statuses.QUOTE_TIMESTAMP, -1);
|
||||
quote_text_html = values.getAsString(Statuses.QUOTE_TEXT_HTML);
|
||||
quote_text_plain = values.getAsString(Statuses.QUOTE_TEXT_PLAIN);
|
||||
quote_text_unescaped = values.getAsString(Statuses.QUOTE_TEXT_UNESCAPED);
|
||||
quoted_by_user_id = ContentValuesUtils.getAsLong(values, Statuses.QUOTED_BY_USER_ID, -1);
|
||||
quoted_by_user_name = values.getAsString(Statuses.QUOTED_BY_USER_NAME);
|
||||
quoted_by_user_screen_name = values.getAsString(Statuses.QUOTED_BY_USER_SCREEN_NAME);
|
||||
quoted_by_user_profile_image = values.getAsString(Statuses.QUOTED_BY_USER_PROFILE_IMAGE);
|
||||
card_name = card != null ? card.name : null;
|
||||
}
|
||||
|
||||
public ParcelableStatus(final Cursor c, final CursorIndices idx) {
|
||||
id = idx.status_id != -1 ? c.getLong(idx.status_id) : -1;
|
||||
account_id = idx.account_id != -1 ? c.getLong(idx.account_id) : -1;
|
||||
|
@ -225,6 +173,9 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
quoted_by_user_name = idx.quoted_by_user_name != -1 ? c.getString(idx.quoted_by_user_name) : null;
|
||||
quoted_by_user_screen_name = idx.quoted_by_user_screen_name != -1 ? c.getString(idx.quoted_by_user_screen_name) : null;
|
||||
quoted_by_user_profile_image = idx.quoted_by_user_profile_image != -1 ? c.getString(idx.quoted_by_user_profile_image) : null;
|
||||
quoted_by_user_is_protected = idx.quoted_by_user_is_protected != -1 && c.getShort(idx.quoted_by_user_is_protected) == 1;
|
||||
quoted_by_user_is_verified = idx.quoted_by_user_is_verified != -1 && c.getShort(idx.quoted_by_user_is_verified) == 1;
|
||||
quote_source = idx.quote_source != -1 ? c.getString(idx.quote_source) : null;
|
||||
card_name = card != null ? card.name : null;
|
||||
}
|
||||
|
||||
|
@ -277,6 +228,9 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
quoted_by_user_name = in.readString("quoted_by_user_name");
|
||||
quoted_by_user_screen_name = in.readString("quoted_by_user_screen_name");
|
||||
quoted_by_user_profile_image = in.readString("quoted_by_user_profile_image");
|
||||
quoted_by_user_is_protected = in.readBoolean("quoted_by_user_is_protected");
|
||||
quoted_by_user_is_verified = in.readBoolean("quoted_by_user_is_verified");
|
||||
quote_source = in.readString("quote_source");
|
||||
card_name = card != null ? card.name : null;
|
||||
}
|
||||
|
||||
|
@ -329,6 +283,9 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
quoted_by_user_name = in.readString();
|
||||
quoted_by_user_screen_name = in.readString();
|
||||
quoted_by_user_profile_image = in.readString();
|
||||
quoted_by_user_is_protected = in.readByte() == 1;
|
||||
quoted_by_user_is_verified = in.readByte() == 1;
|
||||
quote_source = in.readString();
|
||||
card_name = card != null ? card.name : null;
|
||||
}
|
||||
|
||||
|
@ -382,6 +339,9 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
quote_text_html = orig.quote_text_html;
|
||||
quote_text_plain = orig.quote_text_plain;
|
||||
quote_text_unescaped = orig.quote_text_unescaped;
|
||||
quote_source = orig.quote_source;
|
||||
quoted_by_user_is_protected = orig.quoted_by_user_is_protected;
|
||||
quoted_by_user_is_verified = orig.quoted_by_user_is_verified;
|
||||
card_name = card != null ? card.name : null;
|
||||
}
|
||||
|
||||
|
@ -399,8 +359,7 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
retweeted_by_id = retweet_user != null ? retweet_user.getId() : -1;
|
||||
retweeted_by_name = retweet_user != null ? retweet_user.getName() : null;
|
||||
retweeted_by_screen_name = retweet_user != null ? retweet_user.getScreenName() : null;
|
||||
retweeted_by_profile_image = retweet_user != null ?
|
||||
ParseUtils.parseString(retweet_user.getProfileImageUrlHttps()) : null;
|
||||
retweeted_by_profile_image = retweet_user != null ? retweet_user.getProfileImageUrlHttps() : null;
|
||||
|
||||
final Status quoted = orig.getQuotedStatus();
|
||||
final User quote_user = quoted != null ? orig.getUser() : null;
|
||||
|
@ -409,11 +368,15 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
quote_text_html = TwitterContentUtils.formatStatusText(orig);
|
||||
quote_text_plain = orig.getText();
|
||||
quote_text_unescaped = HtmlEscapeHelper.toPlainText(quote_text_html);
|
||||
quote_timestamp = quoted != null ? quoted.getCreatedAt().getTime() : -1;
|
||||
quote_timestamp = orig.getCreatedAt().getTime();
|
||||
quote_source = orig.getSource();
|
||||
|
||||
quoted_by_user_id = quote_user != null ? quote_user.getId() : -1;
|
||||
quoted_by_user_name = quote_user != null ? quote_user.getName() : null;
|
||||
quoted_by_user_screen_name = quote_user != null ? quote_user.getScreenName() : null;
|
||||
quoted_by_user_profile_image = quote_user != null ? ParseUtils.parseString(quote_user.getProfileImageUrlHttps()) : null;
|
||||
quoted_by_user_profile_image = quote_user != null ? quote_user.getProfileImageUrlHttps() : null;
|
||||
quoted_by_user_is_protected = quote_user != null && quote_user.isProtected();
|
||||
quoted_by_user_is_verified = quote_user != null && quote_user.isVerified();
|
||||
|
||||
final Status status;
|
||||
if (quoted != null) {
|
||||
|
@ -427,7 +390,7 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
user_id = user.getId();
|
||||
user_name = user.getName();
|
||||
user_screen_name = user.getScreenName();
|
||||
user_profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
|
||||
user_profile_image_url = user.getProfileImageUrlHttps();
|
||||
user_is_protected = user.isProtected();
|
||||
user_is_verified = user.isVerified();
|
||||
user_is_following = user.isFollowing();
|
||||
|
@ -502,6 +465,9 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
", in_reply_to_status_id=" + in_reply_to_status_id +
|
||||
", in_reply_to_user_id=" + in_reply_to_user_id +
|
||||
", my_retweet_id=" + my_retweet_id +
|
||||
", quote_id=" + quote_id +
|
||||
", quote_timestamp=" + quote_timestamp +
|
||||
", quoted_by_user_id=" + quoted_by_user_id +
|
||||
", is_gap=" + is_gap +
|
||||
", is_retweet=" + is_retweet +
|
||||
", is_favorite=" + is_favorite +
|
||||
|
@ -509,6 +475,9 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
", user_is_following=" + user_is_following +
|
||||
", user_is_protected=" + user_is_protected +
|
||||
", user_is_verified=" + user_is_verified +
|
||||
", is_quote=" + is_quote +
|
||||
", quoted_by_user_is_protected=" + quoted_by_user_is_protected +
|
||||
", quoted_by_user_is_verified=" + quoted_by_user_is_verified +
|
||||
", retweeted_by_name='" + retweeted_by_name + '\'' +
|
||||
", retweeted_by_screen_name='" + retweeted_by_screen_name + '\'' +
|
||||
", retweeted_by_profile_image='" + retweeted_by_profile_image + '\'' +
|
||||
|
@ -522,7 +491,15 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
", user_profile_image_url='" + user_profile_image_url + '\'' +
|
||||
", text_unescaped='" + text_unescaped + '\'' +
|
||||
", card_name='" + card_name + '\'' +
|
||||
", quote_text_html='" + quote_text_html + '\'' +
|
||||
", quote_text_plain='" + quote_text_plain + '\'' +
|
||||
", quote_text_unescaped='" + quote_text_unescaped + '\'' +
|
||||
", quote_source='" + quote_source + '\'' +
|
||||
", quoted_by_user_name='" + quoted_by_user_name + '\'' +
|
||||
", quoted_by_user_screen_name='" + quoted_by_user_screen_name + '\'' +
|
||||
", quoted_by_user_profile_image='" + quoted_by_user_profile_image + '\'' +
|
||||
", location=" + location +
|
||||
", place_full_name='" + place_full_name + '\'' +
|
||||
", mentions=" + Arrays.toString(mentions) +
|
||||
", media=" + Arrays.toString(media) +
|
||||
", card=" + card +
|
||||
|
@ -579,6 +556,9 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
out.writeString("quoted_by_user_name", quoted_by_user_name);
|
||||
out.writeString("quoted_by_user_screen_name", quoted_by_user_screen_name);
|
||||
out.writeString("quoted_by_user_profile_image", quoted_by_user_profile_image);
|
||||
out.writeBoolean("quoted_by_user_is_protected", quoted_by_user_is_protected);
|
||||
out.writeBoolean("quoted_by_user_is_verified", quoted_by_user_is_verified);
|
||||
out.writeString("quote_source", quote_source);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -601,8 +581,8 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
retweeted_by_user_id, user_id, source, retweet_count, favorite_count, reply_count,
|
||||
descendent_reply_count, is_possibly_sensitive, is_following, media, mentions, card_name,
|
||||
card, place_full_name, is_quote, quote_id, quote_text_html, quote_text_plain, quote_text_unescaped,
|
||||
quote_timestamp, quoted_by_user_id, quoted_by_user_name, quoted_by_user_screen_name,
|
||||
quoted_by_user_profile_image;
|
||||
quote_timestamp, quote_source, quoted_by_user_id, quoted_by_user_name, quoted_by_user_screen_name,
|
||||
quoted_by_user_profile_image, quoted_by_user_is_protected, quoted_by_user_is_verified;
|
||||
|
||||
public CursorIndices(final Cursor cursor) {
|
||||
_id = cursor.getColumnIndex(Statuses._ID);
|
||||
|
@ -638,10 +618,13 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
quote_text_plain = cursor.getColumnIndex(Statuses.QUOTE_TEXT_PLAIN);
|
||||
quote_text_unescaped = cursor.getColumnIndex(Statuses.QUOTE_TEXT_UNESCAPED);
|
||||
quote_timestamp = cursor.getColumnIndex(Statuses.QUOTE_TIMESTAMP);
|
||||
quote_source = cursor.getColumnIndex(Statuses.QUOTE_SOURCE);
|
||||
quoted_by_user_id = cursor.getColumnIndex(Statuses.QUOTED_BY_USER_ID);
|
||||
quoted_by_user_name = cursor.getColumnIndex(Statuses.QUOTED_BY_USER_NAME);
|
||||
quoted_by_user_screen_name = cursor.getColumnIndex(Statuses.QUOTED_BY_USER_SCREEN_NAME);
|
||||
quoted_by_user_profile_image = cursor.getColumnIndex(Statuses.QUOTED_BY_USER_PROFILE_IMAGE);
|
||||
quoted_by_user_is_protected = cursor.getColumnIndex(Statuses.QUOTED_BY_USER_IS_PROTECTED);
|
||||
quoted_by_user_is_verified = cursor.getColumnIndex(Statuses.QUOTED_BY_USER_IS_VERIFIED);
|
||||
user_id = cursor.getColumnIndex(Statuses.USER_ID);
|
||||
source = cursor.getColumnIndex(Statuses.SOURCE);
|
||||
retweet_count = cursor.getColumnIndex(Statuses.RETWEET_COUNT);
|
||||
|
@ -1091,6 +1074,9 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
|
|||
out.writeString(quoted_by_user_name);
|
||||
out.writeString(quoted_by_user_screen_name);
|
||||
out.writeString(quoted_by_user_profile_image);
|
||||
out.writeByte((byte) (quoted_by_user_is_protected ? 1 : 0));
|
||||
out.writeByte((byte) (quoted_by_user_is_verified ? 1 : 0));
|
||||
out.writeString(quote_source);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -224,11 +224,10 @@ public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableU
|
|||
description_expanded = TwitterContentUtils.formatExpandedUserDescription(user);
|
||||
description_unescaped = HtmlEscapeHelper.toPlainText(description_html);
|
||||
location = user.getLocation();
|
||||
profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
|
||||
profile_image_url = user.getProfileImageUrlHttps();
|
||||
profile_banner_url = user.getProfileBannerImageUrl();
|
||||
url = ParseUtils.parseString(user.getURL());
|
||||
url_expanded = url != null && urls_url_entities != null && urls_url_entities.length > 0 ? ParseUtils
|
||||
.parseString(urls_url_entities[0].getExpandedURL()) : null;
|
||||
url = user.getURL();
|
||||
url_expanded = url != null && urls_url_entities != null && urls_url_entities.length > 0 ? urls_url_entities[0].getExpandedURL() : null;
|
||||
is_follow_request_sent = user.isFollowRequestSent();
|
||||
followers_count = user.getFollowersCount();
|
||||
friends_count = user.getFriendsCount();
|
||||
|
|
|
@ -21,181 +21,180 @@ package org.mariotaku.twidere.model;
|
|||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.mariotaku.jsonserializer.JSONParcel;
|
||||
import org.mariotaku.jsonserializer.JSONParcelable;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
|
||||
import twitter4j.User;
|
||||
import twitter4j.UserList;
|
||||
|
||||
public class ParcelableUserList implements Parcelable, JSONParcelable, Comparable<ParcelableUserList> {
|
||||
|
||||
public static final Parcelable.Creator<ParcelableUserList> CREATOR = new Parcelable.Creator<ParcelableUserList>() {
|
||||
@Override
|
||||
public ParcelableUserList createFromParcel(final Parcel in) {
|
||||
return new ParcelableUserList(in);
|
||||
}
|
||||
public static final Parcelable.Creator<ParcelableUserList> CREATOR = new Parcelable.Creator<ParcelableUserList>() {
|
||||
@Override
|
||||
public ParcelableUserList createFromParcel(final Parcel in) {
|
||||
return new ParcelableUserList(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParcelableUserList[] newArray(final int size) {
|
||||
return new ParcelableUserList[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public ParcelableUserList[] newArray(final int size) {
|
||||
return new ParcelableUserList[size];
|
||||
}
|
||||
};
|
||||
|
||||
public static final JSONParcelable.Creator<ParcelableUserList> JSON_CREATOR = new JSONParcelable.Creator<ParcelableUserList>() {
|
||||
@Override
|
||||
public ParcelableUserList createFromParcel(final JSONParcel in) {
|
||||
return new ParcelableUserList(in);
|
||||
}
|
||||
public static final JSONParcelable.Creator<ParcelableUserList> JSON_CREATOR = new JSONParcelable.Creator<ParcelableUserList>() {
|
||||
@Override
|
||||
public ParcelableUserList createFromParcel(final JSONParcel in) {
|
||||
return new ParcelableUserList(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParcelableUserList[] newArray(final int size) {
|
||||
return new ParcelableUserList[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public ParcelableUserList[] newArray(final int size) {
|
||||
return new ParcelableUserList[size];
|
||||
}
|
||||
};
|
||||
|
||||
public final int members_count, subscribers_count;
|
||||
public final int members_count, subscribers_count;
|
||||
|
||||
public final long account_id, id, user_id, position;
|
||||
public final long account_id, id, user_id, position;
|
||||
|
||||
public final boolean is_public, is_following;
|
||||
public final boolean is_public, is_following;
|
||||
|
||||
public final String description, name, user_screen_name, user_name, user_profile_image_url;
|
||||
public final String description, name, user_screen_name, user_name, user_profile_image_url;
|
||||
|
||||
public ParcelableUserList(final JSONParcel in) {
|
||||
position = in.readLong("position");
|
||||
account_id = in.readLong("account_id");
|
||||
id = in.readLong("list_id");
|
||||
is_public = in.readBoolean("is_public");
|
||||
is_following = in.readBoolean("is_following");
|
||||
name = in.readString("name");
|
||||
description = in.readString("description");
|
||||
user_id = in.readLong("user_id");
|
||||
user_name = in.readString("user_name");
|
||||
user_screen_name = in.readString("user_screen_name");
|
||||
user_profile_image_url = in.readString("user_profile_image_url");
|
||||
members_count = in.readInt("members_count");
|
||||
subscribers_count = in.readInt("subscribers_count");
|
||||
}
|
||||
public ParcelableUserList(final JSONParcel in) {
|
||||
position = in.readLong("position");
|
||||
account_id = in.readLong("account_id");
|
||||
id = in.readLong("list_id");
|
||||
is_public = in.readBoolean("is_public");
|
||||
is_following = in.readBoolean("is_following");
|
||||
name = in.readString("name");
|
||||
description = in.readString("description");
|
||||
user_id = in.readLong("user_id");
|
||||
user_name = in.readString("user_name");
|
||||
user_screen_name = in.readString("user_screen_name");
|
||||
user_profile_image_url = in.readString("user_profile_image_url");
|
||||
members_count = in.readInt("members_count");
|
||||
subscribers_count = in.readInt("subscribers_count");
|
||||
}
|
||||
|
||||
public ParcelableUserList(final Parcel in) {
|
||||
position = in.readLong();
|
||||
account_id = in.readLong();
|
||||
id = in.readLong();
|
||||
is_public = in.readInt() == 1;
|
||||
is_following = in.readInt() == 1;
|
||||
name = in.readString();
|
||||
description = in.readString();
|
||||
user_id = in.readLong();
|
||||
user_name = in.readString();
|
||||
user_screen_name = in.readString();
|
||||
user_profile_image_url = in.readString();
|
||||
members_count = in.readInt();
|
||||
subscribers_count = in.readInt();
|
||||
}
|
||||
public ParcelableUserList(final Parcel in) {
|
||||
position = in.readLong();
|
||||
account_id = in.readLong();
|
||||
id = in.readLong();
|
||||
is_public = in.readInt() == 1;
|
||||
is_following = in.readInt() == 1;
|
||||
name = in.readString();
|
||||
description = in.readString();
|
||||
user_id = in.readLong();
|
||||
user_name = in.readString();
|
||||
user_screen_name = in.readString();
|
||||
user_profile_image_url = in.readString();
|
||||
members_count = in.readInt();
|
||||
subscribers_count = in.readInt();
|
||||
}
|
||||
|
||||
public ParcelableUserList(final UserList list, final long account_id) {
|
||||
this(list, account_id, 0);
|
||||
}
|
||||
public ParcelableUserList(final UserList list, final long account_id) {
|
||||
this(list, account_id, 0);
|
||||
}
|
||||
|
||||
public ParcelableUserList(final UserList list, final long account_id, final long position) {
|
||||
this(list, account_id, position, list.isFollowing());
|
||||
}
|
||||
public ParcelableUserList(final UserList list, final long account_id, final long position) {
|
||||
this(list, account_id, position, list.isFollowing());
|
||||
}
|
||||
|
||||
public ParcelableUserList(final UserList list, final long account_id, final long position,
|
||||
final boolean is_following) {
|
||||
final User user = list.getUser();
|
||||
this.position = position;
|
||||
this.account_id = account_id;
|
||||
id = list.getId();
|
||||
is_public = list.isPublic();
|
||||
this.is_following = is_following;
|
||||
name = list.getName();
|
||||
description = list.getDescription();
|
||||
user_id = user.getId();
|
||||
user_name = user.getName();
|
||||
user_screen_name = user.getScreenName();
|
||||
user_profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
|
||||
members_count = list.getMemberCount();
|
||||
subscribers_count = list.getSubscriberCount();
|
||||
}
|
||||
public ParcelableUserList(final UserList list, final long account_id, final long position,
|
||||
final boolean is_following) {
|
||||
final User user = list.getUser();
|
||||
this.position = position;
|
||||
this.account_id = account_id;
|
||||
id = list.getId();
|
||||
is_public = list.isPublic();
|
||||
this.is_following = is_following;
|
||||
name = list.getName();
|
||||
description = list.getDescription();
|
||||
user_id = user.getId();
|
||||
user_name = user.getName();
|
||||
user_screen_name = user.getScreenName();
|
||||
user_profile_image_url = user.getProfileImageUrlHttps();
|
||||
members_count = list.getMemberCount();
|
||||
subscribers_count = list.getSubscriberCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(final ParcelableUserList another) {
|
||||
if (another == null) return 0;
|
||||
final long diff = position - another.position;
|
||||
if (diff > Integer.MAX_VALUE) return Integer.MAX_VALUE;
|
||||
if (diff < Integer.MIN_VALUE) return Integer.MIN_VALUE;
|
||||
return (int) diff;
|
||||
}
|
||||
@Override
|
||||
public int compareTo(@NonNull final ParcelableUserList another) {
|
||||
final long diff = position - another.position;
|
||||
if (diff > Integer.MAX_VALUE) return Integer.MAX_VALUE;
|
||||
if (diff < Integer.MIN_VALUE) return Integer.MIN_VALUE;
|
||||
return (int) diff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (!(obj instanceof ParcelableUserList)) return false;
|
||||
final ParcelableUserList other = (ParcelableUserList) obj;
|
||||
if (account_id != other.account_id) return false;
|
||||
if (id != other.id) return false;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (!(obj instanceof ParcelableUserList)) return false;
|
||||
final ParcelableUserList other = (ParcelableUserList) obj;
|
||||
if (account_id != other.account_id) return false;
|
||||
if (id != other.id) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (account_id ^ account_id >>> 32);
|
||||
result = prime * result + (int) (id ^ id >>> 32);
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (account_id ^ account_id >>> 32);
|
||||
result = prime * result + (int) (id ^ id >>> 32);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParcelableUserList{members_count=" + members_count + ", subscribers_count=" + subscribers_count
|
||||
+ ", account_id=" + account_id + ", id=" + id + ", user_id=" + user_id + ", position=" + position
|
||||
+ ", is_public=" + is_public + ", is_following=" + is_following + ", description=" + description
|
||||
+ ", name=" + name + ", user_screen_name=" + user_screen_name + ", user_name=" + user_name
|
||||
+ ", user_profile_image_url=" + user_profile_image_url + "}";
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParcelableUserList{members_count=" + members_count + ", subscribers_count=" + subscribers_count
|
||||
+ ", account_id=" + account_id + ", id=" + id + ", user_id=" + user_id + ", position=" + position
|
||||
+ ", is_public=" + is_public + ", is_following=" + is_following + ", description=" + description
|
||||
+ ", name=" + name + ", user_screen_name=" + user_screen_name + ", user_name=" + user_name
|
||||
+ ", user_profile_image_url=" + user_profile_image_url + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(final JSONParcel out) {
|
||||
out.writeLong("position", position);
|
||||
out.writeLong("account_id", account_id);
|
||||
out.writeLong("list_id", id);
|
||||
out.writeBoolean("is_public", is_public);
|
||||
out.writeBoolean("is_following", is_following);
|
||||
out.writeString("name", name);
|
||||
out.writeString("description", description);
|
||||
out.writeLong("user_id", user_id);
|
||||
out.writeString("user_name", user_name);
|
||||
out.writeString("user_screen_name", user_screen_name);
|
||||
out.writeString("user_profile_image_url", user_profile_image_url);
|
||||
out.writeInt("members_count", members_count);
|
||||
out.writeInt("subscribers_count", subscribers_count);
|
||||
}
|
||||
@Override
|
||||
public void writeToParcel(final JSONParcel out) {
|
||||
out.writeLong("position", position);
|
||||
out.writeLong("account_id", account_id);
|
||||
out.writeLong("list_id", id);
|
||||
out.writeBoolean("is_public", is_public);
|
||||
out.writeBoolean("is_following", is_following);
|
||||
out.writeString("name", name);
|
||||
out.writeString("description", description);
|
||||
out.writeLong("user_id", user_id);
|
||||
out.writeString("user_name", user_name);
|
||||
out.writeString("user_screen_name", user_screen_name);
|
||||
out.writeString("user_profile_image_url", user_profile_image_url);
|
||||
out.writeInt("members_count", members_count);
|
||||
out.writeInt("subscribers_count", subscribers_count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(final Parcel out, final int flags) {
|
||||
out.writeLong(position);
|
||||
out.writeLong(account_id);
|
||||
out.writeLong(id);
|
||||
out.writeInt(is_public ? 1 : 0);
|
||||
out.writeInt(is_following ? 1 : 0);
|
||||
out.writeString(name);
|
||||
out.writeString(description);
|
||||
out.writeLong(user_id);
|
||||
out.writeString(user_name);
|
||||
out.writeString(user_screen_name);
|
||||
out.writeString(user_profile_image_url);
|
||||
out.writeInt(members_count);
|
||||
out.writeInt(subscribers_count);
|
||||
}
|
||||
@Override
|
||||
public void writeToParcel(final Parcel out, final int flags) {
|
||||
out.writeLong(position);
|
||||
out.writeLong(account_id);
|
||||
out.writeLong(id);
|
||||
out.writeInt(is_public ? 1 : 0);
|
||||
out.writeInt(is_following ? 1 : 0);
|
||||
out.writeString(name);
|
||||
out.writeString(description);
|
||||
out.writeLong(user_id);
|
||||
out.writeString(user_name);
|
||||
out.writeString(user_screen_name);
|
||||
out.writeString(user_profile_image_url);
|
||||
out.writeInt(members_count);
|
||||
out.writeInt(subscribers_count);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -138,15 +138,15 @@ public interface TwidereDataStore {
|
|||
String SAME_OAUTH_SIGNING_URL = "same_oauth_signing_url";
|
||||
String NO_VERSION_SUFFIX = "no_version_suffix";
|
||||
|
||||
String[] COLUMNS_NO_CREDENTIALS = new String[]{_ID, NAME, SCREEN_NAME, ACCOUNT_ID,
|
||||
String[] COLUMNS_NO_CREDENTIALS = {_ID, NAME, SCREEN_NAME, ACCOUNT_ID,
|
||||
PROFILE_IMAGE_URL, PROFILE_BANNER_URL, COLOR, IS_ACTIVATED};
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, NAME, SCREEN_NAME, ACCOUNT_ID, AUTH_TYPE,
|
||||
String[] COLUMNS = {_ID, NAME, SCREEN_NAME, ACCOUNT_ID, AUTH_TYPE,
|
||||
BASIC_AUTH_USERNAME, BASIC_AUTH_PASSWORD, OAUTH_TOKEN, OAUTH_TOKEN_SECRET, CONSUMER_KEY,
|
||||
CONSUMER_SECRET, API_URL_FORMAT, SAME_OAUTH_SIGNING_URL, NO_VERSION_SUFFIX, PROFILE_IMAGE_URL, PROFILE_BANNER_URL, COLOR,
|
||||
IS_ACTIVATED, SORT_POSITION};
|
||||
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_TEXT_NOT_NULL, TYPE_TEXT_NOT_NULL,
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT_NOT_NULL, TYPE_TEXT_NOT_NULL,
|
||||
TYPE_INT_UNIQUE, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_BOOLEAN, TYPE_INT};
|
||||
|
||||
|
@ -154,8 +154,8 @@ public interface TwidereDataStore {
|
|||
|
||||
public static interface CachedHashtags extends CachedValues {
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, NAME};
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_TEXT};
|
||||
String[] COLUMNS = {_ID, NAME};
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT};
|
||||
|
||||
String TABLE_NAME = "cached_hashtags";
|
||||
String CONTENT_PATH = TABLE_NAME;
|
||||
|
@ -173,9 +173,9 @@ public interface TwidereDataStore {
|
|||
|
||||
String PATH = "path";
|
||||
|
||||
String[] MATRIX_COLUMNS = new String[]{URL, PATH};
|
||||
String[] MATRIX_COLUMNS = {URL, PATH};
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, URL, PATH};
|
||||
String[] COLUMNS = {_ID, URL, PATH};
|
||||
}
|
||||
|
||||
public static interface CachedStatuses extends Statuses {
|
||||
|
@ -189,8 +189,8 @@ public interface TwidereDataStore {
|
|||
|
||||
String TIMESTAMP = "timestamp";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, NAME, TIMESTAMP};
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_TEXT, TYPE_INT};
|
||||
String[] COLUMNS = {_ID, NAME, TIMESTAMP};
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT, TYPE_INT};
|
||||
|
||||
public static interface Local extends CachedTrends {
|
||||
String TABLE_NAME = "local_trends";
|
||||
|
@ -273,16 +273,16 @@ public interface TwidereDataStore {
|
|||
|
||||
String LAST_SEEN = "last_seen";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, USER_ID, CREATED_AT, NAME, SCREEN_NAME,
|
||||
String[] COLUMNS = {_ID, USER_ID, CREATED_AT, NAME, SCREEN_NAME,
|
||||
DESCRIPTION_PLAIN, LOCATION, URL, PROFILE_IMAGE_URL, PROFILE_BANNER_URL, IS_PROTECTED,
|
||||
IS_VERIFIED, IS_FOLLOWING, FOLLOWERS_COUNT, FRIENDS_COUNT, STATUSES_COUNT, FAVORITES_COUNT,
|
||||
LISTED_COUNT, DESCRIPTION_HTML, DESCRIPTION_EXPANDED, URL_EXPANDED, BACKGROUND_COLOR,
|
||||
LINK_COLOR, TEXT_COLOR, LAST_SEEN};
|
||||
|
||||
String[] BASIC_COLUMNS = new String[]{_ID, USER_ID,
|
||||
String[] BASIC_COLUMNS = {_ID, USER_ID,
|
||||
NAME, SCREEN_NAME, PROFILE_IMAGE_URL};
|
||||
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_INT_UNIQUE, TYPE_INT,
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_INT_UNIQUE, TYPE_INT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_BOOLEAN,
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_TEXT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT};
|
||||
|
@ -304,9 +304,9 @@ public interface TwidereDataStore {
|
|||
|
||||
String PATH = "path";
|
||||
|
||||
String[] MATRIX_COLUMNS = new String[]{NAME, PATH};
|
||||
String[] MATRIX_COLUMNS = {NAME, PATH};
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, NAME, PATH};
|
||||
String[] COLUMNS = {_ID, NAME, PATH};
|
||||
}
|
||||
|
||||
public static interface DirectMessages extends BaseColumns {
|
||||
|
@ -337,11 +337,11 @@ public interface TwidereDataStore {
|
|||
|
||||
String MEDIA_LIST = "media_list";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, ACCOUNT_ID, MESSAGE_ID, MESSAGE_TIMESTAMP,
|
||||
String[] COLUMNS = {_ID, ACCOUNT_ID, MESSAGE_ID, MESSAGE_TIMESTAMP,
|
||||
SENDER_ID, RECIPIENT_ID, CONVERSATION_ID, IS_OUTGOING, TEXT_HTML, TEXT_PLAIN, TEXT_UNESCAPED,
|
||||
SENDER_NAME, RECIPIENT_NAME, SENDER_SCREEN_NAME, RECIPIENT_SCREEN_NAME, SENDER_PROFILE_IMAGE_URL,
|
||||
RECIPIENT_PROFILE_IMAGE_URL, MEDIA_LIST};
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_INT, TYPE_INT, TYPE_INT,
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_INT, TYPE_INT, TYPE_INT,
|
||||
TYPE_INT, TYPE_INT, TYPE_INT, TYPE_BOOLEAN, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT};
|
||||
|
||||
|
@ -434,8 +434,8 @@ public interface TwidereDataStore {
|
|||
|
||||
String RECENT_QUERY = "recent_query";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, RECENT_QUERY, QUERY};
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_INT, TYPE_TEXT_NOT_NULL_UNIQUE};
|
||||
String[] COLUMNS = {_ID, RECENT_QUERY, QUERY};
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_INT, TYPE_TEXT_NOT_NULL_UNIQUE};
|
||||
String DEFAULT_SORT_ORDER = RECENT_QUERY + " DESC";
|
||||
}
|
||||
|
||||
|
@ -449,9 +449,9 @@ public interface TwidereDataStore {
|
|||
|
||||
String ADDRESS = "address";
|
||||
|
||||
String[] MATRIX_COLUMNS = new String[]{HOST, ADDRESS};
|
||||
String[] MATRIX_COLUMNS = {HOST, ADDRESS};
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, HOST, ADDRESS};
|
||||
String[] COLUMNS = {_ID, HOST, ADDRESS};
|
||||
}
|
||||
|
||||
public static interface SavedSearches extends BaseColumns {
|
||||
|
@ -468,9 +468,9 @@ public interface TwidereDataStore {
|
|||
String NAME = "name";
|
||||
String CREATED_AT = "created_at";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, ACCOUNT_ID, SEARCH_ID, CREATED_AT,
|
||||
String[] COLUMNS = {_ID, ACCOUNT_ID, SEARCH_ID, CREATED_AT,
|
||||
QUERY, NAME};
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_INT, TYPE_INT,
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_INT, TYPE_INT,
|
||||
TYPE_INT, TYPE_TEXT, TYPE_TEXT};
|
||||
String DEFAULT_SORT_ORDER = CREATED_AT + " DESC";
|
||||
}
|
||||
|
@ -514,10 +514,10 @@ public interface TwidereDataStore {
|
|||
|
||||
String ACTION_EXTRAS = "action_extras";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, TEXT, ACCOUNT_IDS, LOCATION, MEDIA,
|
||||
String[] COLUMNS = {_ID, TEXT, ACCOUNT_IDS, LOCATION, MEDIA,
|
||||
IN_REPLY_TO_STATUS_ID, IS_POSSIBLY_SENSITIVE, TIMESTAMP, ACTION_TYPE, ACTION_EXTRAS};
|
||||
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT,
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_INT, TYPE_INT, TYPE_BOOLEAN, TYPE_INT, TYPE_INT, TYPE_TEXT};
|
||||
|
||||
}
|
||||
|
@ -536,9 +536,9 @@ public interface TwidereDataStore {
|
|||
|
||||
String ENABLE_FOR_RETWEETS = "enable_for_retweets";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, VALUE};
|
||||
String[] COLUMNS = {_ID, VALUE};
|
||||
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_TEXT_NOT_NULL_UNIQUE};
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT_NOT_NULL_UNIQUE};
|
||||
|
||||
public static interface Keywords extends Filters {
|
||||
|
||||
|
@ -575,9 +575,9 @@ public interface TwidereDataStore {
|
|||
String NAME = "name";
|
||||
String SCREEN_NAME = "screen_name";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, USER_ID, NAME, SCREEN_NAME};
|
||||
String[] COLUMNS = {_ID, USER_ID, NAME, SCREEN_NAME};
|
||||
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_INT_UNIQUE, TYPE_TEXT_NOT_NULL,
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_INT_UNIQUE, TYPE_TEXT_NOT_NULL,
|
||||
TYPE_TEXT_NOT_NULL};
|
||||
}
|
||||
}
|
||||
|
@ -603,9 +603,9 @@ public interface TwidereDataStore {
|
|||
|
||||
String COUNT = "count";
|
||||
|
||||
String[] MATRIX_COLUMNS = new String[]{ID, COUNT};
|
||||
String[] MATRIX_COLUMNS = {ID, COUNT};
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, ID, COUNT};
|
||||
String[] COLUMNS = {_ID, ID, COUNT};
|
||||
}
|
||||
|
||||
public static interface Permissions extends BaseColumns {
|
||||
|
@ -618,9 +618,9 @@ public interface TwidereDataStore {
|
|||
|
||||
String PACKAGE_NAME = "package_name";
|
||||
|
||||
String[] MATRIX_COLUMNS = new String[]{PACKAGE_NAME, PERMISSION};
|
||||
String[] MATRIX_COLUMNS = {PACKAGE_NAME, PERMISSION};
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, PACKAGE_NAME, PERMISSION};
|
||||
String[] COLUMNS = {_ID, PACKAGE_NAME, PERMISSION};
|
||||
}
|
||||
|
||||
public static interface Preferences extends BaseColumns {
|
||||
|
@ -649,9 +649,9 @@ public interface TwidereDataStore {
|
|||
|
||||
String TYPE = "type";
|
||||
|
||||
String[] MATRIX_COLUMNS = new String[]{KEY, VALUE, TYPE};
|
||||
String[] MATRIX_COLUMNS = {KEY, VALUE, TYPE};
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, KEY, VALUE, TYPE};
|
||||
String[] COLUMNS = {_ID, KEY, VALUE, TYPE};
|
||||
}
|
||||
|
||||
public static interface Statuses extends BaseColumns {
|
||||
|
@ -803,30 +803,34 @@ public interface TwidereDataStore {
|
|||
String QUOTE_TEXT_PLAIN = "quote_text_plain";
|
||||
String QUOTE_TEXT_UNESCAPED = "quote_text_unescaped";
|
||||
String QUOTE_TIMESTAMP = "quote_timestamp";
|
||||
String QUOTE_SOURCE = "quote_source";
|
||||
String QUOTED_BY_USER_ID = "quoted_by_user_id";
|
||||
String QUOTED_BY_USER_NAME = "quoted_by_user_name";
|
||||
String QUOTED_BY_USER_SCREEN_NAME = "quoted_by_user_screen_name";
|
||||
String QUOTED_BY_USER_PROFILE_IMAGE = "quoted_by_user_profile_image";
|
||||
String QUOTED_BY_USER_IS_VERIFIED = "quoted_by_user_is_verified";
|
||||
String QUOTED_BY_USER_IS_PROTECTED = "quoted_by_user_is_protected";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, ACCOUNT_ID, STATUS_ID, USER_ID,
|
||||
String[] COLUMNS = {_ID, ACCOUNT_ID, STATUS_ID, USER_ID,
|
||||
STATUS_TIMESTAMP, TEXT_HTML, TEXT_PLAIN, TEXT_UNESCAPED, USER_NAME, USER_SCREEN_NAME,
|
||||
USER_PROFILE_IMAGE_URL, IN_REPLY_TO_STATUS_ID, IN_REPLY_TO_USER_ID, IN_REPLY_TO_USER_NAME,
|
||||
IN_REPLY_TO_USER_SCREEN_NAME, SOURCE, LOCATION, RETWEET_COUNT, FAVORITE_COUNT, REPLY_COUNT,
|
||||
DESCENDENT_REPLY_COUNT, RETWEET_ID, RETWEET_TIMESTAMP, RETWEETED_BY_USER_ID,
|
||||
RETWEETED_BY_USER_NAME, RETWEETED_BY_USER_SCREEN_NAME, RETWEETED_BY_USER_PROFILE_IMAGE,
|
||||
QUOTE_ID, QUOTE_TEXT_HTML, QUOTE_TEXT_PLAIN, QUOTE_TEXT_UNESCAPED, QUOTE_TIMESTAMP,
|
||||
QUOTED_BY_USER_ID, QUOTED_BY_USER_NAME, QUOTED_BY_USER_SCREEN_NAME, QUOTED_BY_USER_PROFILE_IMAGE,
|
||||
MY_RETWEET_ID, IS_RETWEET, IS_QUOTE, IS_FAVORITE, IS_PROTECTED, IS_VERIFIED, IS_FOLLOWING, IS_GAP,
|
||||
IS_POSSIBLY_SENSITIVE, MEDIA_LIST, MENTIONS_LIST, CARD_NAME, CARD, PLACE_FULL_NAME};
|
||||
QUOTE_SOURCE, QUOTED_BY_USER_ID, QUOTED_BY_USER_NAME, QUOTED_BY_USER_SCREEN_NAME,
|
||||
QUOTED_BY_USER_PROFILE_IMAGE, QUOTED_BY_USER_IS_VERIFIED, QUOTED_BY_USER_IS_PROTECTED,
|
||||
MY_RETWEET_ID, IS_RETWEET, IS_QUOTE, IS_FAVORITE, IS_PROTECTED, IS_VERIFIED, IS_FOLLOWING,
|
||||
IS_GAP, IS_POSSIBLY_SENSITIVE, MEDIA_LIST, MENTIONS_LIST, CARD_NAME, CARD, PLACE_FULL_NAME};
|
||||
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_INT, TYPE_INT,
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_INT, TYPE_INT,
|
||||
TYPE_INT, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_INT, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_INT,
|
||||
TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_TEXT, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_INT, TYPE_TEXT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN,
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_TEXT, TYPE_TEXT};
|
||||
TYPE_TEXT, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_TEXT, TYPE_INT,
|
||||
TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_INT, TYPE_BOOLEAN,
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_BOOLEAN,
|
||||
TYPE_BOOLEAN, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT};
|
||||
|
||||
}
|
||||
|
||||
|
@ -848,10 +852,10 @@ public interface TwidereDataStore {
|
|||
|
||||
String POSITION = "position";
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, NAME, ICON, TYPE, ARGUMENTS, EXTRAS,
|
||||
String[] COLUMNS = {_ID, NAME, ICON, TYPE, ARGUMENTS, EXTRAS,
|
||||
POSITION};
|
||||
|
||||
String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_TEXT, TYPE_TEXT,
|
||||
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_TEXT_NOT_NULL, TYPE_TEXT, TYPE_TEXT, TYPE_INT};
|
||||
|
||||
String DEFAULT_SORT_ORDER = POSITION + " ASC";
|
||||
|
@ -898,9 +902,9 @@ public interface TwidereDataStore {
|
|||
|
||||
String COUNT = "count";
|
||||
|
||||
String[] MATRIX_COLUMNS = new String[]{TAB_POSITION, TAB_TYPE, COUNT};
|
||||
String[] MATRIX_COLUMNS = {TAB_POSITION, TAB_TYPE, COUNT};
|
||||
|
||||
String[] COLUMNS = new String[]{_ID, TAB_POSITION, TAB_TYPE, COUNT};
|
||||
String[] COLUMNS = {_ID, TAB_POSITION, TAB_TYPE, COUNT};
|
||||
|
||||
public static interface ByType extends UnreadCounts {
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
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.PROFILE_IMAGE_URL, user.getProfileImageUrlHttps());
|
||||
values.put(Accounts.PROFILE_BANNER_URL, user.getProfileBannerImageUrl());
|
||||
values.put(Accounts.COLOR, color);
|
||||
values.put(Accounts.IS_ACTIVATED, 1);
|
||||
values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
|
||||
|
@ -102,8 +102,8 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
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.PROFILE_IMAGE_URL, user.getProfileImageUrlHttps());
|
||||
values.put(Accounts.PROFILE_BANNER_URL, user.getProfileBannerImageUrl());
|
||||
values.put(Accounts.COLOR, color);
|
||||
values.put(Accounts.IS_ACTIVATED, 1);
|
||||
values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
|
||||
|
@ -120,8 +120,8 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
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.PROFILE_IMAGE_URL, (user.getProfileImageUrlHttps()));
|
||||
values.put(Accounts.PROFILE_BANNER_URL, (user.getProfileBannerImageUrl()));
|
||||
values.put(Accounts.COLOR, color);
|
||||
values.put(Accounts.IS_ACTIVATED, 1);
|
||||
values.put(Accounts.API_URL_FORMAT, apiUrlFormat);
|
||||
|
@ -144,8 +144,8 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
|
||||
public static ContentValues createCachedUser(final User user) {
|
||||
if (user == null || user.getId() <= 0) return null;
|
||||
final String profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
|
||||
final String url = ParseUtils.parseString(user.getURL());
|
||||
final String profile_image_url = user.getProfileImageUrlHttps();
|
||||
final String url = user.getURL();
|
||||
final URLEntity[] urls = user.getURLEntities();
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(CachedUsers.USER_ID, user.getId());
|
||||
|
@ -168,7 +168,7 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
values.put(CachedUsers.DESCRIPTION_EXPANDED, TwitterContentUtils.formatExpandedUserDescription(user));
|
||||
values.put(CachedUsers.URL, url);
|
||||
if (url != null && urls != null && urls.length > 0) {
|
||||
values.put(CachedUsers.URL_EXPANDED, ParseUtils.parseString(urls[0].getExpandedURL()));
|
||||
values.put(CachedUsers.URL_EXPANDED, urls[0].getExpandedURL());
|
||||
}
|
||||
values.put(CachedUsers.BACKGROUND_COLOR, ParseUtils.parseColor("#" + user.getProfileBackgroundColor(), 0));
|
||||
values.put(CachedUsers.LINK_COLOR, ParseUtils.parseColor("#" + user.getProfileLinkColor(), 0));
|
||||
|
@ -182,8 +182,8 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
final ContentValues values = new ContentValues();
|
||||
final User sender = message.getSender(), recipient = message.getRecipient();
|
||||
if (sender == null || recipient == null) return null;
|
||||
final String sender_profile_image_url = ParseUtils.parseString(sender.getProfileImageUrlHttps());
|
||||
final String recipient_profile_image_url = ParseUtils.parseString(recipient.getProfileImageUrlHttps());
|
||||
final String sender_profile_image_url = sender.getProfileImageUrlHttps();
|
||||
final String recipient_profile_image_url = recipient.getProfileImageUrlHttps();
|
||||
values.put(DirectMessages.ACCOUNT_ID, accountId);
|
||||
values.put(DirectMessages.MESSAGE_ID, message.getId());
|
||||
values.put(DirectMessages.MESSAGE_TIMESTAMP, message.getCreatedAt().getTime());
|
||||
|
@ -317,7 +317,7 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
values.put(Statuses.RETWEETED_BY_USER_ID, retweetedById);
|
||||
values.put(Statuses.RETWEETED_BY_USER_NAME, retweetUser.getName());
|
||||
values.put(Statuses.RETWEETED_BY_USER_SCREEN_NAME, retweetUser.getScreenName());
|
||||
values.put(Statuses.RETWEETED_BY_USER_PROFILE_IMAGE, ParseUtils.parseString(retweetUser.getProfileImageUrlHttps()));
|
||||
values.put(Statuses.RETWEETED_BY_USER_PROFILE_IMAGE, (retweetUser.getProfileImageUrlHttps()));
|
||||
values.put(Statuses.IS_RETWEET, true);
|
||||
if (retweetedById == accountId) {
|
||||
values.put(Statuses.MY_RETWEET_ID, orig.getId());
|
||||
|
@ -334,11 +334,15 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
values.put(Statuses.QUOTE_TEXT_HTML, textHtml);
|
||||
values.put(Statuses.QUOTE_TEXT_PLAIN, orig.getText());
|
||||
values.put(Statuses.QUOTE_TEXT_UNESCAPED, toPlainText(textHtml));
|
||||
values.put(Statuses.QUOTE_TIMESTAMP, quotedStatus.getCreatedAt().getTime());
|
||||
values.put(Statuses.QUOTE_TIMESTAMP, orig.getCreatedAt().getTime());
|
||||
values.put(Statuses.QUOTE_SOURCE, orig.getSource());
|
||||
|
||||
values.put(Statuses.QUOTED_BY_USER_ID, quotedById);
|
||||
values.put(Statuses.QUOTED_BY_USER_NAME, quoteUser.getName());
|
||||
values.put(Statuses.QUOTED_BY_USER_SCREEN_NAME, quoteUser.getScreenName());
|
||||
values.put(Statuses.QUOTED_BY_USER_PROFILE_IMAGE, ParseUtils.parseString(quoteUser.getProfileImageUrlHttps()));
|
||||
values.put(Statuses.QUOTED_BY_USER_PROFILE_IMAGE, quoteUser.getProfileImageUrlHttps());
|
||||
values.put(Statuses.QUOTED_BY_USER_IS_VERIFIED, quoteUser.isVerified());
|
||||
values.put(Statuses.QUOTED_BY_USER_IS_PROTECTED, quoteUser.isProtected());
|
||||
values.put(Statuses.IS_QUOTE, true);
|
||||
if (quotedById == accountId) {
|
||||
values.put(Statuses.MY_QUOTE_ID, orig.getId());
|
||||
|
@ -352,7 +356,7 @@ public final class ContentValuesCreator implements TwidereConstants {
|
|||
}
|
||||
final User user = status.getUser();
|
||||
final long userId = user.getId();
|
||||
final String profileImageUrl = ParseUtils.parseString(user.getProfileImageUrlHttps());
|
||||
final String profileImageUrl = (user.getProfileImageUrlHttps());
|
||||
final String name = user.getName(), screenName = user.getScreenName();
|
||||
values.put(Statuses.USER_ID, userId);
|
||||
values.put(Statuses.USER_NAME, name);
|
||||
|
|
|
@ -164,7 +164,7 @@ public class MediaPreviewUtils {
|
|||
private static final Pattern[] SUPPORTED_PATTERNS = {PATTERN_TWITTER_IMAGES, PATTERN_INSTAGRAM,
|
||||
PATTERN_GOOGLE_IMAGES, PATTERN_GOOGLE_PROXY_IMAGES, PATTERN_SINA_WEIBO_IMAGES, PATTERN_TWITPIC,
|
||||
PATTERN_IMGUR, PATTERN_IMGLY, PATTERN_YFROG, PATTERN_LOCKERZ, PATTERN_PLIXI, PATTERN_TWITGOO,
|
||||
PATTERN_MOBYPICTURE, PATTERN_PHOTOZOU,PATTERN_TWITTER_DM_IMAGES};
|
||||
PATTERN_MOBYPICTURE, PATTERN_PHOTOZOU, PATTERN_TWITTER_DM_IMAGES};
|
||||
|
||||
private static final String URL_PHOTOZOU_PHOTO_INFO = "https://api.photozou.jp/rest/photo_info.json";
|
||||
|
||||
|
@ -241,14 +241,14 @@ public class MediaPreviewUtils {
|
|||
final MediaEntity[] mediaEntities = status.getMediaEntities();
|
||||
if (mediaEntities != null) {
|
||||
for (final MediaEntity mediaEntity : mediaEntities) {
|
||||
final String expanded = ParseUtils.parseString(mediaEntity.getMediaURLHttps());
|
||||
final String expanded = mediaEntity.getMediaURLHttps();
|
||||
if (getSupportedLink(expanded) != null) return expanded;
|
||||
}
|
||||
}
|
||||
final URLEntity[] urlEntities = status.getURLEntities();
|
||||
if (urlEntities != null) {
|
||||
for (final URLEntity urlEntity : urlEntities) {
|
||||
final String expanded = ParseUtils.parseString(urlEntity.getExpandedURL());
|
||||
final String expanded = urlEntity.getExpandedURL();
|
||||
if (getSupportedLink(expanded) != null) return expanded;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,6 +161,11 @@ public final class ParseUtils {
|
|||
return def;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String parseString(final String object) {
|
||||
return object;
|
||||
}
|
||||
|
||||
public static String parseString(final Object object) {
|
||||
return parseString(object, null);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import android.support.annotation.NonNull;
|
|||
|
||||
import org.mariotaku.twidere.common.R;
|
||||
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
|
@ -59,7 +58,7 @@ public class TwitterContentUtils {
|
|||
final URLEntity[] urls = user.getDescriptionEntities();
|
||||
if (urls != null) {
|
||||
for (final URLEntity url : urls) {
|
||||
final String expanded_url = ParseUtils.parseString(url.getExpandedURL());
|
||||
final String expanded_url = url.getExpandedURL();
|
||||
if (expanded_url != null) {
|
||||
builder.addLink(expanded_url, expanded_url, url.getStart(), url.getEnd());
|
||||
}
|
||||
|
@ -85,10 +84,9 @@ public class TwitterContentUtils {
|
|||
final URLEntity[] urls = user.getDescriptionEntities();
|
||||
if (urls != null) {
|
||||
for (final URLEntity url : urls) {
|
||||
final URL expanded_url = url.getExpandedURL();
|
||||
final String expanded_url = url.getExpandedURL();
|
||||
if (expanded_url != null) {
|
||||
builder.addLink(ParseUtils.parseString(expanded_url), url.getDisplayURL(), url.getStart(),
|
||||
url.getEnd());
|
||||
builder.addLink(expanded_url, url.getDisplayURL(), url.getStart(), url.getEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,10 +126,9 @@ public class TwitterContentUtils {
|
|||
if (mediaEntities != null) {
|
||||
for (final MediaEntity mediaEntity : mediaEntities) {
|
||||
final int start = mediaEntity.getStart(), end = mediaEntity.getEnd();
|
||||
final URL mediaUrl = mediaEntity.getMediaURL();
|
||||
final String mediaUrl = mediaEntity.getMediaURL();
|
||||
if (mediaUrl != null && start >= 0 && end >= 0) {
|
||||
builder.addLink(ParseUtils.parseString(mediaUrl), mediaEntity.getDisplayURL(),
|
||||
start, end);
|
||||
builder.addLink(mediaUrl, mediaEntity.getDisplayURL(), start, end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,10 +136,9 @@ public class TwitterContentUtils {
|
|||
if (urlEntities != null) {
|
||||
for (final URLEntity urlEntity : urlEntities) {
|
||||
final int start = urlEntity.getStart(), end = urlEntity.getEnd();
|
||||
final URL expandedUrl = urlEntity.getExpandedURL();
|
||||
final String expandedUrl = urlEntity.getExpandedURL();
|
||||
if (expandedUrl != null && start >= 0 && end >= 0) {
|
||||
builder.addLink(ParseUtils.parseString(expandedUrl), urlEntity.getDisplayURL(),
|
||||
start, end);
|
||||
builder.addLink(expandedUrl, urlEntity.getDisplayURL(), start, end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,14 +37,14 @@ public interface MediaEntity extends URLEntity, Serializable {
|
|||
*
|
||||
* @return the media URL
|
||||
*/
|
||||
URL getMediaURL();
|
||||
String getMediaURL();
|
||||
|
||||
/**
|
||||
* Returns the media secure URL.
|
||||
*
|
||||
* @return the media secure URL
|
||||
*/
|
||||
URL getMediaURLHttps();
|
||||
String getMediaURLHttps();
|
||||
|
||||
/**
|
||||
* Returns size variations of the media.
|
||||
|
|
|
@ -48,7 +48,7 @@ public interface URLEntity extends Serializable {
|
|||
* @return the expanded URL if mentioned URL is shorten, or null if no
|
||||
* shorten URL was mentioned.
|
||||
*/
|
||||
URL getExpandedURL();
|
||||
String getExpandedURL();
|
||||
|
||||
/**
|
||||
* Returns the index of the start character of the URL mentioned in the
|
||||
|
@ -64,5 +64,5 @@ public interface URLEntity extends Serializable {
|
|||
*
|
||||
* @return the mentioned URL
|
||||
*/
|
||||
URL getURL();
|
||||
String getURL();
|
||||
}
|
||||
|
|
|
@ -100,14 +100,14 @@ public interface User extends Comparable<User>, TwitterResponse, Serializable {
|
|||
*
|
||||
* @return the profile image url of the user
|
||||
*/
|
||||
URL getProfileImageURL();
|
||||
String getProfileImageURL();
|
||||
|
||||
/**
|
||||
* Returns the profile image url of the user, served over SSL
|
||||
*
|
||||
* @return the profile image url of the user, served over SSL
|
||||
*/
|
||||
URL getProfileImageUrlHttps();
|
||||
String getProfileImageUrlHttps();
|
||||
|
||||
String getProfileLinkColor();
|
||||
|
||||
|
@ -142,7 +142,7 @@ public interface User extends Comparable<User>, TwitterResponse, Serializable {
|
|||
*
|
||||
* @return the url of the user
|
||||
*/
|
||||
URL getURL();
|
||||
String getURL();
|
||||
|
||||
URLEntity[] getURLEntities();
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@ import org.json.JSONArray;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -47,10 +45,10 @@ public class MediaEntityJSONImpl implements MediaEntity {
|
|||
private long id;
|
||||
private int start = -1;
|
||||
private int end = -1;
|
||||
private URL url;
|
||||
private URL mediaURL;
|
||||
private URL mediaURLHttps;
|
||||
private URL expandedURL;
|
||||
private String url;
|
||||
private String mediaURL;
|
||||
private String mediaURLHttps;
|
||||
private String expandedURL;
|
||||
private String displayURL;
|
||||
private Map<Integer, MediaEntity.Size> sizes;
|
||||
private Type type;
|
||||
|
@ -67,28 +65,16 @@ public class MediaEntityJSONImpl implements MediaEntity {
|
|||
end = indicesArray.getInt(1);
|
||||
id = getLong("id", json);
|
||||
|
||||
try {
|
||||
url = new URL(json.getString("url"));
|
||||
} catch (final MalformedURLException ignore) {
|
||||
}
|
||||
url = (json.getString("url"));
|
||||
|
||||
if (!json.isNull("expanded_url")) {
|
||||
try {
|
||||
expandedURL = new URL(json.getString("expanded_url"));
|
||||
} catch (final MalformedURLException ignore) {
|
||||
}
|
||||
expandedURL = json.getString("expanded_url");
|
||||
}
|
||||
if (!json.isNull("media_url")) {
|
||||
try {
|
||||
mediaURL = new URL(json.getString("media_url"));
|
||||
} catch (final MalformedURLException ignore) {
|
||||
}
|
||||
mediaURL = (json.getString("media_url"));
|
||||
}
|
||||
if (!json.isNull("media_url_https")) {
|
||||
try {
|
||||
mediaURLHttps = new URL(json.getString("media_url_https"));
|
||||
} catch (final MalformedURLException ignore) {
|
||||
}
|
||||
mediaURLHttps = (json.getString("media_url_https"));
|
||||
}
|
||||
if (!json.isNull("display_url")) {
|
||||
displayURL = json.getString("display_url");
|
||||
|
@ -148,7 +134,7 @@ public class MediaEntityJSONImpl implements MediaEntity {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getExpandedURL() {
|
||||
public String getExpandedURL() {
|
||||
return expandedURL;
|
||||
}
|
||||
|
||||
|
@ -164,7 +150,7 @@ public class MediaEntityJSONImpl implements MediaEntity {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getMediaURL() {
|
||||
public String getMediaURL() {
|
||||
return mediaURL;
|
||||
}
|
||||
|
||||
|
@ -172,7 +158,7 @@ public class MediaEntityJSONImpl implements MediaEntity {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getMediaURLHttps() {
|
||||
public String getMediaURLHttps() {
|
||||
return mediaURLHttps;
|
||||
}
|
||||
|
||||
|
@ -201,7 +187,7 @@ public class MediaEntityJSONImpl implements MediaEntity {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getURL() {
|
||||
public String getURL() {
|
||||
return url;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,159 +23,138 @@ import org.json.JSONArray;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import twitter4j.TwitterException;
|
||||
import twitter4j.URLEntity;
|
||||
|
||||
/**
|
||||
* A data class representing one single URL entity.
|
||||
*
|
||||
*
|
||||
* @author Mocel - mocel at guma.jp
|
||||
* @since Twitter4J 2.1.9
|
||||
*/
|
||||
/* package */final class URLEntityJSONImpl implements URLEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1326410198426703277L;
|
||||
private int start = -1;
|
||||
private int end = -1;
|
||||
private URL url;
|
||||
private URL expandedURL;
|
||||
private String displayURL;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1326410198426703277L;
|
||||
private int start = -1;
|
||||
private int end = -1;
|
||||
private String url;
|
||||
private String expandedURL;
|
||||
private String displayURL;
|
||||
|
||||
/* For serialization purposes only. */
|
||||
/* package */URLEntityJSONImpl() {
|
||||
/* For serialization purposes only. */
|
||||
/* package */URLEntityJSONImpl() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* package */URLEntityJSONImpl(final int start, final int end, final String url, final String expandedURL,
|
||||
final String displayURL) {
|
||||
super();
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
try {
|
||||
this.url = new URL(url);
|
||||
} catch (final MalformedURLException e) {
|
||||
try {
|
||||
this.url = new URL("http://example.com/");
|
||||
} catch (final MalformedURLException ignore) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.expandedURL = new URL(expandedURL);
|
||||
} catch (final MalformedURLException e) {
|
||||
try {
|
||||
this.expandedURL = new URL("http://example.com/");
|
||||
} catch (final MalformedURLException ignore) {
|
||||
}
|
||||
}
|
||||
this.displayURL = displayURL;
|
||||
}
|
||||
/* package */URLEntityJSONImpl(final int start, final int end, final String url, final String expandedURL,
|
||||
final String displayURL) {
|
||||
super();
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
this.url = url;
|
||||
this.expandedURL = expandedURL;
|
||||
this.displayURL = displayURL;
|
||||
}
|
||||
|
||||
/* package */URLEntityJSONImpl(final JSONObject json) throws TwitterException {
|
||||
super();
|
||||
init(json);
|
||||
}
|
||||
/* package */URLEntityJSONImpl(final JSONObject json) throws TwitterException {
|
||||
super();
|
||||
init(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
final URLEntityJSONImpl that = (URLEntityJSONImpl) o;
|
||||
final URLEntityJSONImpl that = (URLEntityJSONImpl) o;
|
||||
|
||||
if (end != that.end) return false;
|
||||
if (start != that.start) return false;
|
||||
if (displayURL != null ? !displayURL.equals(that.displayURL) : that.displayURL != null) return false;
|
||||
if (expandedURL != null ? !expandedURL.toString().equalsIgnoreCase(that.expandedURL.toString())
|
||||
: that.expandedURL != null) return false;
|
||||
if (url != null ? !url.toString().equalsIgnoreCase(that.url.toString()) : that.url != null) return false;
|
||||
if (end != that.end) return false;
|
||||
if (start != that.start) return false;
|
||||
if (displayURL != null ? !displayURL.equals(that.displayURL) : that.displayURL != null)
|
||||
return false;
|
||||
if (expandedURL != null ? !expandedURL.equalsIgnoreCase(that.expandedURL)
|
||||
: that.expandedURL != null) return false;
|
||||
if (url != null ? !url.equalsIgnoreCase(that.url) : that.url != null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getDisplayURL() {
|
||||
return displayURL;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getDisplayURL() {
|
||||
return displayURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getEnd() {
|
||||
return end;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getExpandedURL() {
|
||||
return expandedURL;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getExpandedURL() {
|
||||
return expandedURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getStart() {
|
||||
return start;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getURL() {
|
||||
return url;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getURL() {
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = start;
|
||||
result = 31 * result + end;
|
||||
result = 31 * result + (url != null ? url.toString().hashCode() : 0);
|
||||
result = 31 * result + (expandedURL != null ? expandedURL.toString().hashCode() : 0);
|
||||
result = 31 * result + (displayURL != null ? displayURL.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = start;
|
||||
result = 31 * result + end;
|
||||
result = 31 * result + (url != null ? url.hashCode() : 0);
|
||||
result = 31 * result + (expandedURL != null ? expandedURL.hashCode() : 0);
|
||||
result = 31 * result + (displayURL != null ? displayURL.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "URLEntityJSONImpl{" + "start=" + start + ", end=" + end + ", url=" + url + ", expandedURL="
|
||||
+ expandedURL + ", displayURL=" + displayURL + '}';
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "URLEntityJSONImpl{" + "start=" + start + ", end=" + end + ", url=" + url + ", expandedURL="
|
||||
+ expandedURL + ", displayURL=" + displayURL + '}';
|
||||
}
|
||||
|
||||
private void init(final JSONObject json) throws TwitterException {
|
||||
try {
|
||||
final JSONArray indicesArray = json.getJSONArray("indices");
|
||||
start = indicesArray.getInt(0);
|
||||
end = indicesArray.getInt(1);
|
||||
private void init(final JSONObject json) throws TwitterException {
|
||||
try {
|
||||
final JSONArray indicesArray = json.getJSONArray("indices");
|
||||
start = indicesArray.getInt(0);
|
||||
end = indicesArray.getInt(1);
|
||||
|
||||
try {
|
||||
url = new URL(json.getString("url"));
|
||||
} catch (final MalformedURLException ignore) {
|
||||
}
|
||||
url = json.getString("url");
|
||||
|
||||
if (!json.isNull("expanded_url")) {
|
||||
try {
|
||||
expandedURL = new URL(json.getString("expanded_url"));
|
||||
} catch (final MalformedURLException ignore) {
|
||||
}
|
||||
}
|
||||
if (!json.isNull("display_url")) {
|
||||
displayURL = json.getString("display_url");
|
||||
}
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
}
|
||||
}
|
||||
if (!json.isNull("expanded_url")) {
|
||||
expandedURL = json.getString("expanded_url");
|
||||
}
|
||||
if (!json.isNull("display_url")) {
|
||||
displayURL = json.getString("display_url");
|
||||
}
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@ import org.json.JSONArray;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
|
||||
import twitter4j.PageableResponseList;
|
||||
|
@ -44,529 +42,516 @@ import static twitter4j.internal.util.InternalParseUtil.getRawString;
|
|||
|
||||
/**
|
||||
* A data class representing Basic user information element
|
||||
*
|
||||
*
|
||||
* @author Yusuke Yamamoto - yusuke at mac.com
|
||||
*/
|
||||
/* package */final class UserJSONImpl extends TwitterResponseImpl implements User {
|
||||
private static final long serialVersionUID = 1401119968489672262L;
|
||||
private long id;
|
||||
private String name;
|
||||
private static final long serialVersionUID = 1401119968489672262L;
|
||||
private long id;
|
||||
private String name;
|
||||
|
||||
private String screenName;
|
||||
private String location;
|
||||
private String description;
|
||||
private boolean isContributorsEnabled;
|
||||
private String profileImageUrl;
|
||||
private String profileImageUrlHttps;
|
||||
private String url;
|
||||
private boolean isProtected;
|
||||
private int followersCount;
|
||||
private Status status;
|
||||
private String profileBackgroundColor;
|
||||
private String profileTextColor;
|
||||
private String screenName;
|
||||
private String location;
|
||||
private String description;
|
||||
private boolean isContributorsEnabled;
|
||||
private String profileImageUrl;
|
||||
private String profileImageUrlHttps;
|
||||
private String url;
|
||||
private boolean isProtected;
|
||||
private int followersCount;
|
||||
private Status status;
|
||||
private String profileBackgroundColor;
|
||||
private String profileTextColor;
|
||||
|
||||
private String profileLinkColor;
|
||||
private String profileLinkColor;
|
||||
|
||||
private String profileSidebarFillColor;
|
||||
private String profileSidebarBorderColor;
|
||||
private boolean profileUseBackgroundImage;
|
||||
private boolean showAllInlineMedia;
|
||||
private int friendsCount;
|
||||
private Date createdAt;
|
||||
private int favouritesCount;
|
||||
private int utcOffset;
|
||||
private String timeZone;
|
||||
private String profileBackgroundImageUrl;
|
||||
private String profileBackgroundImageUrlHttps;
|
||||
private boolean profileBackgroundTiled;
|
||||
private String lang;
|
||||
private int statusesCount;
|
||||
private boolean isGeoEnabled;
|
||||
private boolean isVerified;
|
||||
private boolean isTranslator;
|
||||
private boolean isFollowing;
|
||||
private int listedCount;
|
||||
private boolean isFollowRequestSent;
|
||||
private String profileBannerImageUrl;
|
||||
private boolean isDefaultProfileImage;
|
||||
private URLEntity[] urlEntities;
|
||||
private URLEntity[] descriptionEntities;
|
||||
private String profileSidebarFillColor;
|
||||
private String profileSidebarBorderColor;
|
||||
private boolean profileUseBackgroundImage;
|
||||
private boolean showAllInlineMedia;
|
||||
private int friendsCount;
|
||||
private Date createdAt;
|
||||
private int favouritesCount;
|
||||
private int utcOffset;
|
||||
private String timeZone;
|
||||
private String profileBackgroundImageUrl;
|
||||
private String profileBackgroundImageUrlHttps;
|
||||
private boolean profileBackgroundTiled;
|
||||
private String lang;
|
||||
private int statusesCount;
|
||||
private boolean isGeoEnabled;
|
||||
private boolean isVerified;
|
||||
private boolean isTranslator;
|
||||
private boolean isFollowing;
|
||||
private int listedCount;
|
||||
private boolean isFollowRequestSent;
|
||||
private String profileBannerImageUrl;
|
||||
private boolean isDefaultProfileImage;
|
||||
private URLEntity[] urlEntities;
|
||||
private URLEntity[] descriptionEntities;
|
||||
|
||||
/* package */UserJSONImpl(final HttpResponse res, final Configuration conf) throws TwitterException {
|
||||
super(res);
|
||||
final JSONObject json = res.asJSONObject();
|
||||
init(json);
|
||||
}
|
||||
/* package */UserJSONImpl(final HttpResponse res, final Configuration conf) throws TwitterException {
|
||||
super(res);
|
||||
final JSONObject json = res.asJSONObject();
|
||||
init(json);
|
||||
}
|
||||
|
||||
/* package */UserJSONImpl(final JSONObject json) throws TwitterException {
|
||||
super();
|
||||
init(json);
|
||||
}
|
||||
/* package */UserJSONImpl(final JSONObject json) throws TwitterException {
|
||||
super();
|
||||
init(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(final User that) {
|
||||
return (int) (id - that.getId());
|
||||
}
|
||||
@Override
|
||||
public int compareTo(final User that) {
|
||||
return (int) (id - that.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (null == obj) return false;
|
||||
if (this == obj) return true;
|
||||
return obj instanceof User && ((User) obj).getId() == id;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (null == obj) return false;
|
||||
if (this == obj) return true;
|
||||
return obj instanceof User && ((User) obj).getId() == id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Date getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URLEntity[] getDescriptionEntities() {
|
||||
return descriptionEntities;
|
||||
}
|
||||
@Override
|
||||
public URLEntity[] getDescriptionEntities() {
|
||||
return descriptionEntities;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getFavouritesCount() {
|
||||
return favouritesCount;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getFavouritesCount() {
|
||||
return favouritesCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getFollowersCount() {
|
||||
return followersCount;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getFollowersCount() {
|
||||
return followersCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getFriendsCount() {
|
||||
return friendsCount;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getFriendsCount() {
|
||||
return friendsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getLang() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getListedCount() {
|
||||
return listedCount;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getListedCount() {
|
||||
return listedCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileBackgroundColor() {
|
||||
return profileBackgroundColor;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileBackgroundColor() {
|
||||
return profileBackgroundColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileBackgroundImageUrl() {
|
||||
return profileBackgroundImageUrl;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileBackgroundImageUrl() {
|
||||
return profileBackgroundImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileBackgroundImageUrlHttps() {
|
||||
return profileBackgroundImageUrlHttps;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileBackgroundImageUrlHttps() {
|
||||
return profileBackgroundImageUrlHttps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProfileBannerImageUrl() {
|
||||
return profileBannerImageUrl;
|
||||
}
|
||||
@Override
|
||||
public String getProfileBannerImageUrl() {
|
||||
return profileBannerImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getProfileImageURL() {
|
||||
try {
|
||||
return new URL(profileImageUrl);
|
||||
} catch (final MalformedURLException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileImageURL() {
|
||||
return profileImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getProfileImageUrlHttps() {
|
||||
if (null == profileImageUrlHttps) return null;
|
||||
try {
|
||||
return new URL(profileImageUrlHttps);
|
||||
} catch (final MalformedURLException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileImageUrlHttps() {
|
||||
return profileImageUrlHttps;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileLinkColor() {
|
||||
return profileLinkColor;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileLinkColor() {
|
||||
return profileLinkColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileSidebarBorderColor() {
|
||||
return profileSidebarBorderColor;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileSidebarBorderColor() {
|
||||
return profileSidebarBorderColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileSidebarFillColor() {
|
||||
return profileSidebarFillColor;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getProfileSidebarFillColor() {
|
||||
return profileSidebarFillColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProfileTextColor() {
|
||||
return profileTextColor;
|
||||
}
|
||||
@Override
|
||||
public String getProfileTextColor() {
|
||||
return profileTextColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getScreenName() {
|
||||
return screenName;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getScreenName() {
|
||||
return screenName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getStatusesCount() {
|
||||
return statusesCount;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getStatusesCount() {
|
||||
return statusesCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getTimeZone() {
|
||||
return timeZone;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getTimeZone() {
|
||||
return timeZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public URL getURL() {
|
||||
try {
|
||||
return new URL(url);
|
||||
} catch (final MalformedURLException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getURL() {
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URLEntity[] getURLEntities() {
|
||||
return urlEntities;
|
||||
}
|
||||
@Override
|
||||
public URLEntity[] getURLEntities() {
|
||||
return urlEntities;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getUtcOffset() {
|
||||
return utcOffset;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getUtcOffset() {
|
||||
return utcOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int) id;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int) id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isContributorsEnabled() {
|
||||
return isContributorsEnabled;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isContributorsEnabled() {
|
||||
return isContributorsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefaultProfileImage() {
|
||||
return isDefaultProfileImage;
|
||||
}
|
||||
@Override
|
||||
public boolean isDefaultProfileImage() {
|
||||
return isDefaultProfileImage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFollowing() {
|
||||
return isFollowing;
|
||||
}
|
||||
@Override
|
||||
public boolean isFollowing() {
|
||||
return isFollowing;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isFollowRequestSent() {
|
||||
return isFollowRequestSent;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isFollowRequestSent() {
|
||||
return isFollowRequestSent;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isGeoEnabled() {
|
||||
return isGeoEnabled;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isGeoEnabled() {
|
||||
return isGeoEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isProfileBackgroundTiled() {
|
||||
return profileBackgroundTiled;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isProfileBackgroundTiled() {
|
||||
return profileBackgroundTiled;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isProfileUseBackgroundImage() {
|
||||
return profileUseBackgroundImage;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isProfileUseBackgroundImage() {
|
||||
return profileUseBackgroundImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isProtected() {
|
||||
return isProtected;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isProtected() {
|
||||
return isProtected;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isShowAllInlineMedia() {
|
||||
return showAllInlineMedia;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isShowAllInlineMedia() {
|
||||
return showAllInlineMedia;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isTranslator() {
|
||||
return isTranslator;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isTranslator() {
|
||||
return isTranslator;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isVerified() {
|
||||
return isVerified;
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isVerified() {
|
||||
return isVerified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserJSONImpl{" + "id=" + id + ", name='" + name + '\'' + ", screenName='" + screenName + '\''
|
||||
+ ", location='" + location + '\'' + ", description='" + description + '\''
|
||||
+ ", isContributorsEnabled=" + isContributorsEnabled + ", profileImageUrl='" + profileImageUrl + '\''
|
||||
+ ", profileImageUrlHttps='" + profileImageUrlHttps + '\'' + ", url='" + url + '\'' + ", isProtected="
|
||||
+ isProtected + ", followersCount=" + followersCount + ", status=" + status
|
||||
+ ", profileBackgroundColor='" + profileBackgroundColor + '\'' + ", profileTextColor='"
|
||||
+ profileTextColor + '\'' + ", profileLinkColor='" + profileLinkColor + '\''
|
||||
+ ", profileSidebarFillColor='" + profileSidebarFillColor + '\'' + ", profileSidebarBorderColor='"
|
||||
+ profileSidebarBorderColor + '\'' + ", profileUseBackgroundImage=" + profileUseBackgroundImage
|
||||
+ ", showAllInlineMedia=" + showAllInlineMedia + ", friendsCount=" + friendsCount + ", createdAt="
|
||||
+ createdAt + ", favouritesCount=" + favouritesCount + ", utcOffset=" + utcOffset + ", timeZone='"
|
||||
+ timeZone + '\'' + ", profileBackgroundImageUrl='" + profileBackgroundImageUrl + '\''
|
||||
+ ", profileBackgroundImageUrlHttps='" + profileBackgroundImageUrlHttps + '\''
|
||||
+ ", profileBackgroundTiled=" + profileBackgroundTiled + ", lang='" + lang + '\'' + ", statusesCount="
|
||||
+ statusesCount + ", isGeoEnabled=" + isGeoEnabled + ", isVerified=" + isVerified + ", isTranslator="
|
||||
+ isTranslator + ", listedCount=" + listedCount + ", isFollowRequestSent=" + isFollowRequestSent + '}';
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserJSONImpl{" + "id=" + id + ", name='" + name + '\'' + ", screenName='" + screenName + '\''
|
||||
+ ", location='" + location + '\'' + ", description='" + description + '\''
|
||||
+ ", isContributorsEnabled=" + isContributorsEnabled + ", profileImageUrl='" + profileImageUrl + '\''
|
||||
+ ", profileImageUrlHttps='" + profileImageUrlHttps + '\'' + ", url='" + url + '\'' + ", isProtected="
|
||||
+ isProtected + ", followersCount=" + followersCount + ", status=" + status
|
||||
+ ", profileBackgroundColor='" + profileBackgroundColor + '\'' + ", profileTextColor='"
|
||||
+ profileTextColor + '\'' + ", profileLinkColor='" + profileLinkColor + '\''
|
||||
+ ", profileSidebarFillColor='" + profileSidebarFillColor + '\'' + ", profileSidebarBorderColor='"
|
||||
+ profileSidebarBorderColor + '\'' + ", profileUseBackgroundImage=" + profileUseBackgroundImage
|
||||
+ ", showAllInlineMedia=" + showAllInlineMedia + ", friendsCount=" + friendsCount + ", createdAt="
|
||||
+ createdAt + ", favouritesCount=" + favouritesCount + ", utcOffset=" + utcOffset + ", timeZone='"
|
||||
+ timeZone + '\'' + ", profileBackgroundImageUrl='" + profileBackgroundImageUrl + '\''
|
||||
+ ", profileBackgroundImageUrlHttps='" + profileBackgroundImageUrlHttps + '\''
|
||||
+ ", profileBackgroundTiled=" + profileBackgroundTiled + ", lang='" + lang + '\'' + ", statusesCount="
|
||||
+ statusesCount + ", isGeoEnabled=" + isGeoEnabled + ", isVerified=" + isVerified + ", isTranslator="
|
||||
+ isTranslator + ", listedCount=" + listedCount + ", isFollowRequestSent=" + isFollowRequestSent + '}';
|
||||
}
|
||||
|
||||
private void init(final JSONObject json) throws TwitterException {
|
||||
try {
|
||||
id = getLong("id", json);
|
||||
name = getRawString("name", json);
|
||||
screenName = getRawString("screen_name", json);
|
||||
location = getRawString("location", json);
|
||||
description = getRawString("description", json);
|
||||
isContributorsEnabled = getBoolean("contributors_enabled", json);
|
||||
profileImageUrl = getRawString("profile_image_url", json);
|
||||
profileImageUrlHttps = getRawString("profile_image_url_https", json);
|
||||
url = getRawString("url", json);
|
||||
isProtected = getBoolean("protected", json);
|
||||
isGeoEnabled = getBoolean("geo_enabled", json);
|
||||
isVerified = getBoolean("verified", json);
|
||||
isTranslator = getBoolean("is_translator", json);
|
||||
isFollowing = getBoolean("following", json);
|
||||
followersCount = getInt("followers_count", json);
|
||||
profileBannerImageUrl = getRawString("profile_banner_url", json);
|
||||
profileBackgroundColor = getRawString("profile_background_color", json);
|
||||
profileTextColor = getRawString("profile_text_color", json);
|
||||
profileLinkColor = getRawString("profile_link_color", json);
|
||||
profileSidebarFillColor = getRawString("profile_sidebar_fill_color", json);
|
||||
profileSidebarBorderColor = getRawString("profile_sidebar_border_color", json);
|
||||
profileUseBackgroundImage = getBoolean("profile_use_background_image", json);
|
||||
showAllInlineMedia = getBoolean("show_all_inline_media", json);
|
||||
friendsCount = getInt("friends_count", json);
|
||||
createdAt = getDate("created_at", json, "EEE MMM dd HH:mm:ss z yyyy");
|
||||
favouritesCount = getInt("favourites_count", json);
|
||||
utcOffset = getInt("utc_offset", json);
|
||||
timeZone = getRawString("time_zone", json);
|
||||
profileBackgroundImageUrl = getRawString("profile_background_image_url", json);
|
||||
profileBackgroundImageUrlHttps = getRawString("profile_background_image_url_https", json);
|
||||
profileBackgroundTiled = getBoolean("profile_background_tile", json);
|
||||
lang = getRawString("lang", json);
|
||||
statusesCount = getInt("statuses_count", json);
|
||||
listedCount = getInt("listed_count", json);
|
||||
isFollowRequestSent = getBoolean("follow_request_sent", json);
|
||||
isDefaultProfileImage = getBoolean("default_profile_image", json);
|
||||
if (!json.isNull("status")) {
|
||||
final JSONObject statusJSON = json.getJSONObject("status");
|
||||
status = new StatusJSONImpl(statusJSON);
|
||||
}
|
||||
if (!json.isNull("entities")) {
|
||||
try {
|
||||
final JSONObject entities = json.getJSONObject("entities");
|
||||
int len;
|
||||
if (!entities.isNull("description")) {
|
||||
final JSONObject description = entities.getJSONObject("description");
|
||||
if (!description.isNull("urls")) {
|
||||
final JSONArray urlsArray = description.getJSONArray("urls");
|
||||
len = urlsArray.length();
|
||||
descriptionEntities = new URLEntity[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
descriptionEntities[i] = new URLEntityJSONImpl(urlsArray.getJSONObject(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!entities.isNull("url")) {
|
||||
final JSONObject url = entities.getJSONObject("url");
|
||||
if (!url.isNull("urls")) {
|
||||
final JSONArray urlsArray = url.getJSONArray("urls");
|
||||
len = urlsArray.length();
|
||||
urlEntities = new URLEntity[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
urlEntities[i] = new URLEntityJSONImpl(urlsArray.getJSONObject(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
}
|
||||
}
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
|
||||
}
|
||||
}
|
||||
private void init(final JSONObject json) throws TwitterException {
|
||||
try {
|
||||
id = getLong("id", json);
|
||||
name = getRawString("name", json);
|
||||
screenName = getRawString("screen_name", json);
|
||||
location = getRawString("location", json);
|
||||
description = getRawString("description", json);
|
||||
isContributorsEnabled = getBoolean("contributors_enabled", json);
|
||||
profileImageUrl = getRawString("profile_image_url", json);
|
||||
profileImageUrlHttps = getRawString("profile_image_url_https", json);
|
||||
url = getRawString("url", json);
|
||||
isProtected = getBoolean("protected", json);
|
||||
isGeoEnabled = getBoolean("geo_enabled", json);
|
||||
isVerified = getBoolean("verified", json);
|
||||
isTranslator = getBoolean("is_translator", json);
|
||||
isFollowing = getBoolean("following", json);
|
||||
followersCount = getInt("followers_count", json);
|
||||
profileBannerImageUrl = getRawString("profile_banner_url", json);
|
||||
profileBackgroundColor = getRawString("profile_background_color", json);
|
||||
profileTextColor = getRawString("profile_text_color", json);
|
||||
profileLinkColor = getRawString("profile_link_color", json);
|
||||
profileSidebarFillColor = getRawString("profile_sidebar_fill_color", json);
|
||||
profileSidebarBorderColor = getRawString("profile_sidebar_border_color", json);
|
||||
profileUseBackgroundImage = getBoolean("profile_use_background_image", json);
|
||||
showAllInlineMedia = getBoolean("show_all_inline_media", json);
|
||||
friendsCount = getInt("friends_count", json);
|
||||
createdAt = getDate("created_at", json, "EEE MMM dd HH:mm:ss z yyyy");
|
||||
favouritesCount = getInt("favourites_count", json);
|
||||
utcOffset = getInt("utc_offset", json);
|
||||
timeZone = getRawString("time_zone", json);
|
||||
profileBackgroundImageUrl = getRawString("profile_background_image_url", json);
|
||||
profileBackgroundImageUrlHttps = getRawString("profile_background_image_url_https", json);
|
||||
profileBackgroundTiled = getBoolean("profile_background_tile", json);
|
||||
lang = getRawString("lang", json);
|
||||
statusesCount = getInt("statuses_count", json);
|
||||
listedCount = getInt("listed_count", json);
|
||||
isFollowRequestSent = getBoolean("follow_request_sent", json);
|
||||
isDefaultProfileImage = getBoolean("default_profile_image", json);
|
||||
if (!json.isNull("status")) {
|
||||
final JSONObject statusJSON = json.getJSONObject("status");
|
||||
status = new StatusJSONImpl(statusJSON);
|
||||
}
|
||||
if (!json.isNull("entities")) {
|
||||
try {
|
||||
final JSONObject entities = json.getJSONObject("entities");
|
||||
int len;
|
||||
if (!entities.isNull("description")) {
|
||||
final JSONObject description = entities.getJSONObject("description");
|
||||
if (!description.isNull("urls")) {
|
||||
final JSONArray urlsArray = description.getJSONArray("urls");
|
||||
len = urlsArray.length();
|
||||
descriptionEntities = new URLEntity[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
descriptionEntities[i] = new URLEntityJSONImpl(urlsArray.getJSONObject(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!entities.isNull("url")) {
|
||||
final JSONObject url = entities.getJSONObject("url");
|
||||
if (!url.isNull("urls")) {
|
||||
final JSONArray urlsArray = url.getJSONArray("urls");
|
||||
len = urlsArray.length();
|
||||
urlEntities = new URLEntity[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
urlEntities[i] = new URLEntityJSONImpl(urlsArray.getJSONObject(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
}
|
||||
}
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone.getMessage() + ":" + json.toString(), jsone);
|
||||
}
|
||||
}
|
||||
|
||||
/* package */
|
||||
static PageableResponseList<User> createPagableUserList(final HttpResponse res, final Configuration conf)
|
||||
throws TwitterException {
|
||||
try {
|
||||
final JSONObject json = res.asJSONObject();
|
||||
final JSONArray list = json.getJSONArray("users");
|
||||
final int size = list.length();
|
||||
@SuppressWarnings("unchecked")
|
||||
final PageableResponseList<User> users = new PageableResponseListImpl<User>(size, json, res);
|
||||
for (int i = 0; i < size; i++) {
|
||||
final JSONObject userJson = list.getJSONObject(i);
|
||||
final User user = new UserJSONImpl(userJson);
|
||||
users.add(user);
|
||||
}
|
||||
return users;
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
} catch (final TwitterException te) {
|
||||
throw te;
|
||||
}
|
||||
}
|
||||
/* package */
|
||||
static PageableResponseList<User> createPagableUserList(final HttpResponse res, final Configuration conf)
|
||||
throws TwitterException {
|
||||
try {
|
||||
final JSONObject json = res.asJSONObject();
|
||||
final JSONArray list = json.getJSONArray("users");
|
||||
final int size = list.length();
|
||||
@SuppressWarnings("unchecked")
|
||||
final PageableResponseList<User> users = new PageableResponseListImpl<User>(size, json, res);
|
||||
for (int i = 0; i < size; i++) {
|
||||
final JSONObject userJson = list.getJSONObject(i);
|
||||
final User user = new UserJSONImpl(userJson);
|
||||
users.add(user);
|
||||
}
|
||||
return users;
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
} catch (final TwitterException te) {
|
||||
throw te;
|
||||
}
|
||||
}
|
||||
|
||||
/* package */
|
||||
static ResponseList<User> createUserList(final HttpResponse res, final Configuration conf) throws TwitterException {
|
||||
return createUserList(res.asJSONArray(), res, conf);
|
||||
}
|
||||
/* package */
|
||||
static ResponseList<User> createUserList(final HttpResponse res, final Configuration conf) throws TwitterException {
|
||||
return createUserList(res.asJSONArray(), res, conf);
|
||||
}
|
||||
|
||||
/* package */
|
||||
static ResponseList<User> createUserList(final JSONArray list, final HttpResponse res, final Configuration conf)
|
||||
throws TwitterException {
|
||||
try {
|
||||
final int size = list.length();
|
||||
final ResponseList<User> users = new ResponseListImpl<User>(size, res);
|
||||
for (int i = 0; i < size; i++) {
|
||||
final JSONObject json = list.getJSONObject(i);
|
||||
final User user = new UserJSONImpl(json);
|
||||
users.add(user);
|
||||
}
|
||||
return users;
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
} catch (final TwitterException te) {
|
||||
throw te;
|
||||
}
|
||||
}
|
||||
/* package */
|
||||
static ResponseList<User> createUserList(final JSONArray list, final HttpResponse res, final Configuration conf)
|
||||
throws TwitterException {
|
||||
try {
|
||||
final int size = list.length();
|
||||
final ResponseList<User> users = new ResponseListImpl<User>(size, res);
|
||||
for (int i = 0; i < size; i++) {
|
||||
final JSONObject json = list.getJSONObject(i);
|
||||
final User user = new UserJSONImpl(json);
|
||||
users.add(user);
|
||||
}
|
||||
return users;
|
||||
} catch (final JSONException jsone) {
|
||||
throw new TwitterException(jsone);
|
||||
} catch (final TwitterException te) {
|
||||
throw te;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.mariotaku.twidere"
|
||||
<manifest package="org.mariotaku.twidere"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-sdk/>
|
||||
|
@ -45,18 +46,18 @@
|
|||
|
||||
<permission
|
||||
android:name="org.mariotaku.twidere.permission.SHORTEN_STATUS"
|
||||
android:label="@string/permission_label_shorten_status"
|
||||
android:description="@string/permission_description_shorten_status"
|
||||
android:label="@string/permission_label_shorten_status"
|
||||
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/>
|
||||
<permission
|
||||
android:name="org.mariotaku.twidere.permission.UPLOAD_MEDIA"
|
||||
android:label="@string/permission_label_upload_media"
|
||||
android:description="@string/permission_description_upload_media"
|
||||
android:label="@string/permission_label_upload_media"
|
||||
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/>
|
||||
<permission
|
||||
android:name="org.mariotaku.twidere.permission.SYNC_TIMELINE"
|
||||
android:label="@string/permission_label_sync_timeline"
|
||||
android:description="@string/permission_description_sync_timeline"
|
||||
android:label="@string/permission_label_sync_timeline"
|
||||
android:permissionGroup="org.mariotaku.twidere.permission.PERMISSION_GROUP"/>
|
||||
|
||||
<application
|
||||
|
@ -593,8 +594,8 @@
|
|||
android:windowSoftInputMode="stateAlwaysHidden"/>
|
||||
<activity
|
||||
android:name=".activity.support.UsageStatisticsActivity"
|
||||
android:theme="@android:style/Theme.NoDisplay"
|
||||
android:label="@string/usage_statistics"/>
|
||||
android:label="@string/usage_statistics"
|
||||
android:theme="@android:style/Theme.NoDisplay"/>
|
||||
|
||||
<service
|
||||
android:name=".service.RefreshService"
|
||||
|
@ -635,20 +636,30 @@
|
|||
android:authorities="twidere"
|
||||
android:exported="true"
|
||||
android:grantUriPermissions="true"
|
||||
android:label="@string/label_tweetstore_provider"/>
|
||||
android:label="@string/label_tweetstore_provider"
|
||||
tools:ignore="ExportedContentProvider"/>
|
||||
<provider
|
||||
android:name=".provider.TwidereCommandProvider"
|
||||
android:authorities="twidere.command"
|
||||
android:exported="true"/>
|
||||
android:exported="true"
|
||||
tools:ignore="ExportedContentProvider"/>
|
||||
<provider
|
||||
android:name=".provider.RecentSearchProvider"
|
||||
android:authorities="org.mariotaku.twidere.provider.SearchRecentSuggestions"/>
|
||||
android:authorities="org.mariotaku.twidere.provider.SearchRecentSuggestions"
|
||||
tools:ignore="ExportedContentProvider"/>
|
||||
|
||||
<receiver android:name=".receiver.ConnectivityStateReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.NotificationReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.NOTIFICATION_DELETED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".receiver.SecretCodeBroadcastReceiver"
|
||||
android:label="@string/twidere_test">
|
||||
|
|
|
@ -33,7 +33,7 @@ import static org.mariotaku.twidere.annotation.Preference.Type.STRING;
|
|||
public interface Constants extends TwidereConstants {
|
||||
|
||||
String DATABASES_NAME = "twidere.sqlite";
|
||||
int DATABASES_VERSION = 94;
|
||||
int DATABASES_VERSION = 95;
|
||||
|
||||
int MENU_GROUP_STATUS_EXTENSION = 10;
|
||||
int MENU_GROUP_COMPOSE_EXTENSION = 11;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.mariotaku.twidere.activity;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
|
@ -74,6 +75,17 @@ public class SettingsActivity extends BasePreferenceActivity {
|
|||
private String mThemeFontFamily;
|
||||
private String mThemeBackground;
|
||||
|
||||
private boolean mShouldNotifyChange;
|
||||
|
||||
public static void setShouldNotifyChange(Activity activity) {
|
||||
if (!(activity instanceof SettingsActivity)) return;
|
||||
((SettingsActivity) activity).setShouldNotifyChange(true);
|
||||
}
|
||||
|
||||
private void setShouldNotifyChange(boolean notify) {
|
||||
mShouldNotifyChange = notify;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
if (shouldNotifyThemeChange()) {
|
||||
|
@ -84,11 +96,33 @@ public class SettingsActivity extends BasePreferenceActivity {
|
|||
super.finish();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void startWithFragment(String fragmentName, Bundle args,
|
||||
Fragment resultTo, int resultRequestCode, int titleRes, int shortTitleRes) {
|
||||
Intent intent = onBuildStartFragmentIntent(fragmentName, args, titleRes, shortTitleRes);
|
||||
if (resultTo == null) {
|
||||
startActivityForResult(intent, resultRequestCode);
|
||||
} else {
|
||||
resultTo.startActivityForResult(intent, resultRequestCode);
|
||||
}
|
||||
}
|
||||
|
||||
public HeaderAdapter getHeaderAdapter() {
|
||||
if (mAdapter != null) return mAdapter;
|
||||
return mAdapter = new HeaderAdapter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == RESULT_OK && data != null && data.getBooleanExtra(EXTRA_RESTART_ACTIVITY, false)) {
|
||||
setShouldNotifyChange(true);
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBuildHeaders(final List<Header> target) {
|
||||
loadHeadersFromResource(R.xml.settings_headers, target);
|
||||
|
@ -222,6 +256,7 @@ public class SettingsActivity extends BasePreferenceActivity {
|
|||
}
|
||||
|
||||
private boolean shouldNotifyThemeChange() {
|
||||
if (mShouldNotifyChange) return true;
|
||||
return !CompareUtils.objectEquals(mTheme, mPreferences.getString(KEY_THEME, DEFAULT_THEME))
|
||||
|| !CompareUtils.objectEquals(mThemeFontFamily, mPreferences.getString(KEY_THEME_FONT_FAMILY, DEFAULT_THEME_FONT_FAMILY))
|
||||
|| !CompareUtils.objectEquals(mThemeBackground, mPreferences.getString(KEY_THEME_BACKGROUND, DEFAULT_THEME_BACKGROUND))
|
||||
|
|
|
@ -574,8 +574,7 @@ public class QuickSearchBarActivity extends ThemedFragmentActivity implements On
|
|||
final String queryEscaped = mQuery.replace("_", "^_");
|
||||
final SharedPreferences nicknamePrefs = context.getSharedPreferences(
|
||||
USER_NICKNAME_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final long[] nicknameIds = Utils.getMatchedNicknameIds(ParseUtils.parseString(mQuery),
|
||||
nicknamePrefs);
|
||||
final long[] nicknameIds = Utils.getMatchedNicknameIds(mQuery, nicknamePrefs);
|
||||
final Expression selection = Expression.or(
|
||||
Expression.likeRaw(new Column(CachedUsers.SCREEN_NAME), "?||'%'", "^"),
|
||||
Expression.likeRaw(new Column(CachedUsers.NAME), "?||'%'", "^"),
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.mariotaku.querybuilder.Columns.Column;
|
|||
import org.mariotaku.querybuilder.Expression;
|
||||
import org.mariotaku.querybuilder.RawItemArray;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.SettingsActivity;
|
||||
import org.mariotaku.twidere.activity.support.CustomTabEditorActivity;
|
||||
import org.mariotaku.twidere.model.CustomTabConfiguration;
|
||||
import org.mariotaku.twidere.model.CustomTabConfiguration.CustomTabConfigurationComparator;
|
||||
|
@ -101,7 +102,8 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks<
|
|||
public boolean onActionItemClicked(final ActionMode mode, final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_DELETE: {
|
||||
final Expression where = Expression.in(new Column(Tabs._ID), new RawItemArray(mListView.getCheckedItemIds()));
|
||||
final long[] itemIds = mListView.getCheckedItemIds();
|
||||
final Expression where = Expression.in(new Column(Tabs._ID), new RawItemArray(itemIds));
|
||||
mResolver.delete(Tabs.CONTENT_URI, where.getSQL(), null);
|
||||
break;
|
||||
}
|
||||
|
@ -160,7 +162,6 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks<
|
|||
mProgressContainer.setVisibility(shown ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
@ -185,6 +186,7 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks<
|
|||
values.put(Tabs.EXTRAS, data.getStringExtra(EXTRA_EXTRAS));
|
||||
values.put(Tabs.POSITION, mAdapter.getCount());
|
||||
mResolver.insert(Tabs.CONTENT_URI, values);
|
||||
SettingsActivity.setShouldNotifyChange(getActivity());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -196,6 +198,7 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks<
|
|||
values.put(Tabs.EXTRAS, data.getStringExtra(EXTRA_EXTRAS));
|
||||
final String where = Expression.equals(Tabs._ID, data.getLongExtra(EXTRA_ID, -1)).getSQL();
|
||||
mResolver.update(Tabs.CONTENT_URI, values, where, null);
|
||||
SettingsActivity.setShouldNotifyChange(getActivity());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -326,6 +329,7 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks<
|
|||
mResolver.update(Tabs.CONTENT_URI, values, where, null);
|
||||
}
|
||||
}
|
||||
SettingsActivity.setShouldNotifyChange(getActivity());
|
||||
}
|
||||
|
||||
private void updateTitle(final ActionMode mode) {
|
||||
|
|
|
@ -758,7 +758,7 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
|||
final String[] selectionArgs;
|
||||
if (queryEscaped != null) {
|
||||
final SharedPreferences nicknamePrefs = context.getSharedPreferences(USER_NICKNAME_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final long[] nicknameIds = Utils.getMatchedNicknameIds(ParseUtils.parseString(query), nicknamePrefs);
|
||||
final long[] nicknameIds = Utils.getMatchedNicknameIds(query, nicknamePrefs);
|
||||
selection = Expression.or(Expression.likeRaw(new Column(CachedUsers.SCREEN_NAME), "?||'%'", "^"),
|
||||
Expression.likeRaw(new Column(CachedUsers.NAME), "?||'%'", "^"),
|
||||
Expression.in(new Column(CachedUsers.USER_ID), new RawItemArray(nicknameIds)));
|
||||
|
|
|
@ -596,6 +596,10 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
retweetedByContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
final int typeIconRes, typeDescriptionRes;
|
||||
final long timestamp;
|
||||
final String source;
|
||||
if (status.is_quote) {
|
||||
quotedNameView.setText(getUserNickname(context, status.user_id, status.user_name, true));
|
||||
quotedScreenNameView.setText("@" + status.user_screen_name);
|
||||
|
@ -614,6 +618,11 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
quoteTextView.setVisibility(View.VISIBLE);
|
||||
quoteIndicator.setVisibility(View.VISIBLE);
|
||||
|
||||
typeIconRes = getUserTypeIconRes(status.quoted_by_user_is_verified, status.quoted_by_user_is_protected);
|
||||
typeDescriptionRes = Utils.getUserTypeDescriptionRes(status.quoted_by_user_is_verified, status.quoted_by_user_is_protected);
|
||||
|
||||
timestamp = status.quote_timestamp;
|
||||
source = status.quote_source;
|
||||
} else {
|
||||
nameView.setText(getUserNickname(context, status.user_id, status.user_name, true));
|
||||
screenNameView.setText("@" + status.user_screen_name);
|
||||
|
@ -623,25 +632,39 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
quotedNameContainer.setVisibility(View.GONE);
|
||||
quoteTextView.setVisibility(View.GONE);
|
||||
quoteIndicator.setVisibility(View.GONE);
|
||||
|
||||
typeIconRes = getUserTypeIconRes(status.user_is_verified, status.user_is_protected);
|
||||
typeDescriptionRes = Utils.getUserTypeDescriptionRes(status.user_is_verified, status.user_is_protected);
|
||||
|
||||
timestamp = status.timestamp;
|
||||
source = status.source;
|
||||
}
|
||||
|
||||
if (typeIconRes != 0 && typeDescriptionRes != 0) {
|
||||
profileTypeView.setImageResource(typeIconRes);
|
||||
profileTypeView.setContentDescription(context.getString(typeDescriptionRes));
|
||||
profileTypeView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileTypeView.setImageDrawable(null);
|
||||
profileTypeView.setContentDescription(null);
|
||||
profileTypeView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final String timeString = formatToLongTimeString(context, timestamp);
|
||||
if (!isEmpty(timeString) && !isEmpty(source)) {
|
||||
timeSourceView.setText(Html.fromHtml(context.getString(R.string.time_source, timeString, source)));
|
||||
} else if (isEmpty(timeString) && !isEmpty(source)) {
|
||||
timeSourceView.setText(Html.fromHtml(context.getString(R.string.source, source)));
|
||||
} else if (!isEmpty(timeString) && isEmpty(source)) {
|
||||
timeSourceView.setText(timeString);
|
||||
}
|
||||
timeSourceView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
|
||||
textView.setText(Html.fromHtml(status.text_html));
|
||||
linkify.applyAllLinks(textView, status.account_id, getAdapterPosition(), status.is_possibly_sensitive);
|
||||
ThemeUtils.applyParagraphSpacing(textView, 1.1f);
|
||||
|
||||
final String timeString = formatToLongTimeString(context, status.timestamp);
|
||||
final String sourceHtml = status.source;
|
||||
if (!isEmpty(timeString) && !isEmpty(sourceHtml)) {
|
||||
timeSourceView.setText(Html.fromHtml(context.getString(R.string.time_source,
|
||||
timeString, sourceHtml)));
|
||||
} else if (isEmpty(timeString) && !isEmpty(sourceHtml)) {
|
||||
timeSourceView.setText(Html.fromHtml(context.getString(R.string.source,
|
||||
sourceHtml)));
|
||||
} else if (!isEmpty(timeString) && isEmpty(sourceHtml)) {
|
||||
timeSourceView.setText(timeString);
|
||||
}
|
||||
timeSourceView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
if (!TextUtils.isEmpty(status.place_full_name)) {
|
||||
locationView.setVisibility(View.VISIBLE);
|
||||
locationView.setText(status.place_full_name);
|
||||
|
@ -662,30 +685,23 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
retweetsCountView.setText(getLocalizedNumber(locale, status.retweet_count));
|
||||
favoritesCountView.setText(getLocalizedNumber(locale, status.favorite_count));
|
||||
|
||||
final int typeIconRes = getUserTypeIconRes(status.user_is_verified, status.user_is_protected);
|
||||
final int typeDescriptionRes = Utils.getUserTypeDescriptionRes(status.user_is_verified, status.user_is_protected);
|
||||
if (typeIconRes != 0 && typeDescriptionRes != 0) {
|
||||
profileTypeView.setImageResource(typeIconRes);
|
||||
profileTypeView.setContentDescription(context.getString(typeDescriptionRes));
|
||||
profileTypeView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileTypeView.setImageDrawable(null);
|
||||
profileTypeView.setContentDescription(null);
|
||||
profileTypeView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (status.media == null) {
|
||||
mediaPreviewContainer.setVisibility(View.GONE);
|
||||
mediaPreview.setVisibility(View.GONE);
|
||||
mediaPreviewLoad.setVisibility(View.GONE);
|
||||
mediaPreview.displayMedia();
|
||||
} else if (adapter.isDetailMediaExpanded()) {
|
||||
mediaPreviewContainer.setVisibility(View.VISIBLE);
|
||||
mediaPreviewLoad.setVisibility(View.GONE);
|
||||
mediaPreview.setVisibility(View.VISIBLE);
|
||||
mediaPreviewLoad.setVisibility(View.GONE);
|
||||
mediaPreview.displayMedia(status.media, loader, status.account_id,
|
||||
adapter.getFragment(), adapter.getImageLoadingHandler());
|
||||
} else {
|
||||
mediaPreviewContainer.setVisibility(View.VISIBLE);
|
||||
mediaPreviewLoad.setVisibility(View.VISIBLE);
|
||||
mediaPreview.setVisibility(View.GONE);
|
||||
mediaPreviewLoad.setVisibility(View.VISIBLE);
|
||||
mediaPreview.displayMedia();
|
||||
}
|
||||
|
||||
if (TwitterCardUtils.isCardSupported(status.card)) {
|
||||
|
@ -786,6 +802,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
locationView.setTextSize(defaultTextSize * 0.85f);
|
||||
timeSourceView.setTextSize(defaultTextSize * 0.85f);
|
||||
|
||||
mediaPreview.setStyle(adapter.getMediaPreviewStyle());
|
||||
|
||||
textView.setMovementMethod(StatusContentMovementMethod.getInstance());
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
quoteTextView.setCustomSelectionActionModeCallback(new StatusActionModeCallback(quoteTextView, fragment, activity));
|
||||
|
|
|
@ -114,6 +114,8 @@ import org.mariotaku.twidere.util.TwidereLinkify;
|
|||
import org.mariotaku.twidere.util.TwidereLinkify.OnLinkClickListener;
|
||||
import org.mariotaku.twidere.util.UserColorNameUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.util.accessor.ActivityAccessor;
|
||||
import org.mariotaku.twidere.util.accessor.ActivityAccessor.TaskDescriptionCompat;
|
||||
import org.mariotaku.twidere.util.accessor.ViewAccessor;
|
||||
import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
|
||||
import org.mariotaku.twidere.util.message.FriendshipUpdatedEvent;
|
||||
|
@ -723,6 +725,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
|
||||
mProfileNameBackground.setBackgroundColor(mCardBackgroundColor);
|
||||
mProfileDetailsContainer.setBackgroundColor(mCardBackgroundColor);
|
||||
mPagerIndicator.setBackgroundColor(mCardBackgroundColor);
|
||||
mUuckyFooter.setBackgroundColor(mCardBackgroundColor);
|
||||
|
||||
getUserInfo(accountId, userId, screenName, false);
|
||||
|
@ -1257,9 +1260,11 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
final int actionBarColor = getResources().getColor(R.color.background_color_action_bar_dark);
|
||||
mTintedStatusContent.setColor(actionBarColor, themed.getCurrentThemeBackgroundAlpha());
|
||||
mActionBarBackground.setColor(actionBarColor);
|
||||
ActivityAccessor.setTaskDescription(activity, new TaskDescriptionCompat(null, null, actionBarColor));
|
||||
} else {
|
||||
mTintedStatusContent.setColor(color, themed.getCurrentThemeBackgroundAlpha());
|
||||
mActionBarBackground.setColor(color);
|
||||
ActivityAccessor.setTaskDescription(activity, new TaskDescriptionCompat(null, null, color));
|
||||
}
|
||||
mDescriptionView.setLinkTextColor(color);
|
||||
mProfileBannerView.setBackgroundColor(color);
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.mariotaku.twidere.app.TwidereApplication;
|
|||
import org.mariotaku.twidere.util.BitmapUtils;
|
||||
import org.mariotaku.twidere.util.Exif;
|
||||
import org.mariotaku.twidere.util.ImageValidator;
|
||||
import org.mariotaku.twidere.util.ParseUtils;
|
||||
import org.mariotaku.twidere.util.imageloader.AccountExtra;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -79,7 +78,7 @@ public class TileImageLoader extends AsyncTaskLoader<TileImageLoader.Result> {
|
|||
}
|
||||
final String scheme = mUri.getScheme();
|
||||
if ("http".equals(scheme) || "https".equals(scheme)) {
|
||||
final String url = ParseUtils.parseString(mUri.toString());
|
||||
final String url = mUri.toString();
|
||||
if (url == null) return Result.nullInstance();
|
||||
final File cacheFile = mDiskCache.get(url);
|
||||
if (cacheFile != null) {
|
||||
|
|
|
@ -335,15 +335,7 @@ public class StatusViewHolder extends RecyclerView.ViewHolder implements Constan
|
|||
replyRetweetIcon.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final int typeIconRes = getUserTypeIconRes(cursor.getShort(indices.is_verified) == 1,
|
||||
cursor.getShort(indices.is_protected) == 1);
|
||||
if (typeIconRes != 0) {
|
||||
profileTypeView.setImageResource(typeIconRes);
|
||||
profileTypeView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileTypeView.setImageDrawable(null);
|
||||
profileTypeView.setVisibility(View.GONE);
|
||||
}
|
||||
final int typeIconRes;
|
||||
|
||||
if (cursor.getShort(indices.is_quote) == 1) {
|
||||
quotedNameView.setText(user_name);
|
||||
|
@ -380,6 +372,9 @@ public class StatusViewHolder extends RecyclerView.ViewHolder implements Constan
|
|||
|
||||
final int userColor = UserColorNameUtils.getUserColor(context, cursor.getLong(indices.quoted_by_user_id));
|
||||
itemContent.drawStart(userColor);
|
||||
|
||||
typeIconRes = getUserTypeIconRes(cursor.getShort(indices.quoted_by_user_is_verified) == 1,
|
||||
cursor.getShort(indices.quoted_by_user_is_protected) == 1);
|
||||
} else {
|
||||
nameView.setText(user_name);
|
||||
screenNameView.setText("@" + user_screen_name);
|
||||
|
@ -401,8 +396,18 @@ public class StatusViewHolder extends RecyclerView.ViewHolder implements Constan
|
|||
}
|
||||
final int userColor = UserColorNameUtils.getUserColor(context, user_id);
|
||||
itemContent.drawStart(userColor);
|
||||
|
||||
typeIconRes = getUserTypeIconRes(cursor.getShort(indices.is_verified) == 1,
|
||||
cursor.getShort(indices.is_protected) == 1);
|
||||
}
|
||||
|
||||
if (typeIconRes != 0) {
|
||||
profileTypeView.setImageResource(typeIconRes);
|
||||
profileTypeView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileTypeView.setImageDrawable(null);
|
||||
profileTypeView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (adapter.shouldShowAccountsColor()) {
|
||||
itemContent.drawEnd(Utils.getAccountColor(context, account_id));
|
||||
|
|
|
@ -226,14 +226,50 @@
|
|||
tools:text="\@username"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
<FrameLayout
|
||||
android:id="@+id/media_preview_container"
|
||||
layout="@layout/layout_media_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/quoted_name_container"
|
||||
android:layout_toRightOf="@+id/quote_indicator"
|
||||
android:visibility="gone"/>
|
||||
tools:visibility="visible">
|
||||
|
||||
<org.mariotaku.twidere.view.CardMediaContainer
|
||||
android:id="@+id/media_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:horizontalSpacing="@dimen/element_spacing_xsmall"
|
||||
android:verticalSpacing="@dimen/element_spacing_xsmall"
|
||||
android:visibility="gone">
|
||||
|
||||
<include layout="@layout/layout_card_media_preview"/>
|
||||
|
||||
</org.mariotaku.twidere.view.CardMediaContainer>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/media_preview_load"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/action_button_size"
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawableLeft="@drawable/ic_action_gallery"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/load_media"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.StatusTextView
|
||||
android:id="@+id/text"
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<org.mariotaku.twidere.view.CardMediaContainer
|
||||
android:id="@+id/media_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/element_spacing_normal"
|
||||
android:horizontalSpacing="@dimen/element_spacing_xsmall"
|
||||
android:verticalSpacing="@dimen/element_spacing_xsmall">
|
||||
|
||||
<include layout="@layout/layout_card_media_preview"/>
|
||||
|
||||
</org.mariotaku.twidere.view.CardMediaContainer>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/media_preview_load"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/action_button_size"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.ActionIconThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:drawableLeft="@drawable/ic_action_gallery"
|
||||
android:text="@string/load_media"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"/>
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
Loading…
Reference in New Issue