fixed wrong color in add tab menu

added reply/retweet/favorite count for quotes
This commit is contained in:
Mariotaku Lee 2015-06-01 17:35:34 +08:00
parent 028c2373cb
commit 2db066f467
16 changed files with 215 additions and 152 deletions

View File

@ -125,9 +125,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
@JsonField(name = "reply_count")
public long reply_count;
@ParcelableThisPlease
@JsonField(name = "descendent_reply_count")
public long descendent_reply_count;
@ParcelableThisPlease
@JsonField(name = "in_reply_to_status_id")
public long in_reply_to_status_id;
@ParcelableThisPlease
@ -227,6 +224,15 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
@JsonField(name = "quote_source")
public String quote_source;
@ParcelableThisPlease
@JsonField(name = "quote_retweet_count")
public long quote_retweet_count;
@ParcelableThisPlease
@JsonField(name = "quote_favorite_count")
public long quote_favorite_count;
@ParcelableThisPlease
@JsonField(name = "quote_reply_count")
public long quote_reply_count;
@ParcelableThisPlease
@JsonField(name = "quoted_by_user_name")
public String quoted_by_user_name;
@ParcelableThisPlease
@ -265,7 +271,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
retweet_count = idx.retweet_count != -1 ? c.getLong(idx.retweet_count) : -1;
favorite_count = idx.favorite_count != -1 ? c.getLong(idx.favorite_count) : -1;
reply_count = idx.reply_count != -1 ? c.getLong(idx.reply_count) : -1;
descendent_reply_count = idx.descendent_reply_count != -1 ? c.getLong(idx.descendent_reply_count) : -1;
in_reply_to_status_id = idx.in_reply_to_status_id != -1 ? c.getLong(idx.in_reply_to_status_id) : -1;
in_reply_to_user_id = idx.in_reply_to_user_id != -1 ? c.getLong(idx.in_reply_to_user_id) : -1;
is_gap = idx.is_gap != -1 && c.getInt(idx.is_gap) == 1;
@ -310,6 +315,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
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;
quote_retweet_count = idx.quote_retweet_count != -1 ? c.getLong(idx.quote_retweet_count) : -1;
quote_favorite_count = idx.quote_favorite_count != -1 ? c.getLong(idx.quote_favorite_count) : -1;
quote_reply_count = idx.quote_reply_count != -1 ? c.getLong(idx.quote_reply_count) : -1;
card_name = card != null ? card.name : null;
}
@ -328,7 +336,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
retweet_count = override_retweet_count;
favorite_count = orig.favorite_count;
reply_count = orig.reply_count;
descendent_reply_count = orig.descendent_reply_count;
in_reply_to_status_id = orig.in_reply_to_status_id;
is_gap = orig.is_gap;
is_retweet = orig.is_retweet;
@ -368,6 +375,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
quote_text_plain = orig.quote_text_plain;
quote_text_unescaped = orig.quote_text_unescaped;
quote_source = orig.quote_source;
quote_retweet_count = orig.quote_retweet_count;
quote_favorite_count = orig.quote_favorite_count;
quote_reply_count = orig.quote_reply_count;
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;
@ -398,6 +408,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
quote_text_unescaped = HtmlEscapeHelper.toPlainText(quote_text_html);
quote_timestamp = orig.getCreatedAt().getTime();
quote_source = orig.getSource();
quote_retweet_count = orig.getRetweetCount();
quote_favorite_count = orig.getFavoriteCount();
quote_reply_count = orig.getReplyCount();
quoted_by_user_id = quote_user != null ? quote_user.getId() : -1;
quoted_by_user_name = quote_user != null ? quote_user.getName() : null;
@ -429,7 +442,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
retweet_count = status.getRetweetCount();
favorite_count = status.getFavoriteCount();
reply_count = status.getReplyCount();
descendent_reply_count = status.getDescendentReplyCount();
in_reply_to_name = TwitterContentUtils.getInReplyToName(retweeted != null ? retweeted : orig);
in_reply_to_screen_name = (retweeted != null ? retweeted : orig).getInReplyToScreenName();
in_reply_to_status_id = (retweeted != null ? retweeted : orig).getInReplyToStatusId();
@ -490,7 +502,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", retweet_count=" + retweet_count +
", favorite_count=" + favorite_count +
", reply_count=" + reply_count +
", descendent_reply_count=" + descendent_reply_count +
", 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 +
@ -524,6 +535,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", quote_text_plain='" + quote_text_plain + '\'' +
", quote_text_unescaped='" + quote_text_unescaped + '\'' +
", quote_source='" + quote_source + '\'' +
", quote_retweet_count=" + quote_retweet_count +
", quote_favorite_count=" + quote_favorite_count +
", quote_reply_count=" + quote_reply_count +
", 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 + '\'' +
@ -531,6 +545,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", place_full_name='" + place_full_name + '\'' +
", mentions=" + Arrays.toString(mentions) +
", media=" + Arrays.toString(media) +
", quote_media=" + Arrays.toString(quote_media) +
", card=" + card +
'}';
}
@ -553,11 +568,11 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
in_reply_to_user_name, in_reply_to_user_screen_name, my_retweet_id, retweeted_by_user_name,
retweeted_by_user_screen_name, retweeted_by_user_profile_image, retweet_id, retweet_timestamp,
retweeted_by_user_id, user_id, source, retweet_count, favorite_count, reply_count,
descendent_reply_count, is_possibly_sensitive, is_following, media, mentions, quote_media,
card_name, card, place_full_name, is_quote, quote_id, quote_text_html, quote_text_plain,
quote_text_unescaped, 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;
is_possibly_sensitive, is_following, media, mentions, quote_media, card_name, card,
place_full_name, is_quote, quote_id, quote_text_html, quote_text_plain, quote_text_unescaped,
quote_timestamp, quote_source, quote_retweet_count, quote_favorite_count, quote_reply_count,
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);
@ -594,6 +609,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
quote_text_unescaped = cursor.getColumnIndex(Statuses.QUOTE_TEXT_UNESCAPED);
quote_timestamp = cursor.getColumnIndex(Statuses.QUOTE_TIMESTAMP);
quote_source = cursor.getColumnIndex(Statuses.QUOTE_SOURCE);
quote_retweet_count = cursor.getColumnIndex(Statuses.QUOTE_RETWEET_COUNT);
quote_favorite_count = cursor.getColumnIndex(Statuses.QUOTE_FAVORITE_COUNT);
quote_reply_count = cursor.getColumnIndex(Statuses.QUOTE_REPLY_COUNT);
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);
@ -605,7 +623,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
retweet_count = cursor.getColumnIndex(Statuses.RETWEET_COUNT);
favorite_count = cursor.getColumnIndex(Statuses.FAVORITE_COUNT);
reply_count = cursor.getColumnIndex(Statuses.REPLY_COUNT);
descendent_reply_count = cursor.getColumnIndex(Statuses.DESCENDENT_REPLY_COUNT);
is_possibly_sensitive = cursor.getColumnIndex(Statuses.IS_POSSIBLY_SENSITIVE);
is_following = cursor.getColumnIndex(Statuses.IS_FOLLOWING);
media = cursor.getColumnIndex(Statuses.MEDIA_JSON);
@ -651,7 +668,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", retweet_count=" + retweet_count +
", favorite_count=" + favorite_count +
", reply_count=" + reply_count +
", descendent_reply_count=" + descendent_reply_count +
", is_possibly_sensitive=" + is_possibly_sensitive +
", is_following=" + is_following +
", media=" + media +
@ -667,6 +683,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", quote_text_unescaped=" + quote_text_unescaped +
", quote_timestamp=" + quote_timestamp +
", quote_source=" + quote_source +
", quote_retweet_count=" + quote_retweet_count +
", quote_favorite_count=" + quote_favorite_count +
", quote_reply_count=" + quote_reply_count +
", quoted_by_user_id=" + quoted_by_user_id +
", quoted_by_user_name=" + quoted_by_user_name +
", quoted_by_user_screen_name=" + quoted_by_user_screen_name +

View File

@ -57,7 +57,7 @@ public interface TwidereDataStore {
Uri[] DIRECT_MESSAGES_URIS = new Uri[]{DirectMessages.Inbox.CONTENT_URI,
DirectMessages.Outbox.CONTENT_URI};
public static interface Accounts extends BaseColumns {
interface Accounts extends BaseColumns {
String TABLE_NAME = "accounts";
String CONTENT_PATH = TABLE_NAME;
@ -147,7 +147,7 @@ public interface TwidereDataStore {
}
public static interface CachedHashtags extends CachedValues {
interface CachedHashtags extends CachedValues {
String[] COLUMNS = {_ID, NAME};
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT};
@ -158,7 +158,7 @@ public interface TwidereDataStore {
Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, CONTENT_PATH);
}
public static interface CachedImages extends BaseColumns {
interface CachedImages extends BaseColumns {
String TABLE_NAME = "cached_images";
String CONTENT_PATH = TABLE_NAME;
@ -173,21 +173,21 @@ public interface TwidereDataStore {
String[] COLUMNS = {_ID, URL, PATH};
}
public static interface CachedStatuses extends Statuses {
interface CachedStatuses extends Statuses {
String TABLE_NAME = "cached_statuses";
String CONTENT_PATH = TABLE_NAME;
Uri CONTENT_URI = Uri.withAppendedPath(BASE_CONTENT_URI, CONTENT_PATH);
}
public static interface CachedTrends extends CachedValues {
interface CachedTrends extends CachedValues {
String TIMESTAMP = "timestamp";
String[] COLUMNS = {_ID, NAME, TIMESTAMP};
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT, TYPE_INT};
public static interface Local extends CachedTrends {
interface Local extends CachedTrends {
String TABLE_NAME = "local_trends";
String CONTENT_PATH = TABLE_NAME;
@ -197,7 +197,7 @@ public interface TwidereDataStore {
}
public static interface CachedUsers extends CachedValues {
interface CachedUsers extends CachedValues {
String TABLE_NAME = "cached_users";
@ -285,12 +285,12 @@ public interface TwidereDataStore {
}
public static interface CachedValues extends BaseColumns {
interface CachedValues extends BaseColumns {
String NAME = "name";
}
public static interface CacheFiles extends BaseColumns {
interface CacheFiles extends BaseColumns {
String TABLE_NAME = "cache_files";
String CONTENT_PATH = TABLE_NAME;
@ -305,7 +305,7 @@ public interface TwidereDataStore {
String[] COLUMNS = {_ID, NAME, PATH};
}
public static interface DirectMessages extends BaseColumns {
interface DirectMessages extends BaseColumns {
String TABLE_NAME = "messages";
String CONTENT_PATH = TABLE_NAME;
@ -343,7 +343,7 @@ public interface TwidereDataStore {
String DEFAULT_SORT_ORDER = MESSAGE_ID + " DESC";
public static interface Conversation extends DirectMessages {
interface Conversation extends DirectMessages {
String DEFAULT_SORT_ORDER = MESSAGE_TIMESTAMP + " ASC";
@ -361,7 +361,7 @@ public interface TwidereDataStore {
CONTENT_PATH_SEGMENT_SCREEN_NAME);
}
public static interface ConversationEntries extends BaseColumns {
interface ConversationEntries extends BaseColumns {
String TABLE_NAME = "messages_conversation_entries";
@ -393,7 +393,7 @@ public interface TwidereDataStore {
int IDX_CONVERSATION_ID = 9;
}
public static interface Inbox extends DirectMessages {
interface Inbox extends DirectMessages {
String TABLE_NAME = "messages_inbox";
@ -405,7 +405,7 @@ public interface TwidereDataStore {
}
public static interface Outbox extends DirectMessages {
interface Outbox extends DirectMessages {
String TABLE_NAME = "messages_outbox";
@ -419,7 +419,7 @@ public interface TwidereDataStore {
}
public static interface SearchHistory extends BaseColumns {
interface SearchHistory extends BaseColumns {
String TABLE_NAME = "search_history";
String CONTENT_PATH = TABLE_NAME;
@ -435,7 +435,7 @@ public interface TwidereDataStore {
String DEFAULT_SORT_ORDER = RECENT_QUERY + " DESC";
}
public static interface DNS extends BaseColumns {
interface DNS extends BaseColumns {
String TABLE_NAME = "dns";
String CONTENT_PATH = TABLE_NAME;
@ -450,7 +450,7 @@ public interface TwidereDataStore {
String[] COLUMNS = {_ID, HOST, ADDRESS};
}
public static interface SavedSearches extends BaseColumns {
interface SavedSearches extends BaseColumns {
String TABLE_NAME = "saved_searches";
@ -471,7 +471,7 @@ public interface TwidereDataStore {
String DEFAULT_SORT_ORDER = CREATED_AT + " DESC";
}
public static interface Drafts extends BaseColumns {
interface Drafts extends BaseColumns {
int ACTION_UPDATE_STATUS = 1;
int ACTION_SEND_DIRECT_MESSAGE = 2;
@ -518,7 +518,7 @@ public interface TwidereDataStore {
}
public static interface Filters extends BaseColumns {
interface Filters extends BaseColumns {
String CONTENT_PATH = "filters";
@ -536,7 +536,7 @@ public interface TwidereDataStore {
String[] TYPES = {TYPE_PRIMARY_KEY, TYPE_TEXT_NOT_NULL_UNIQUE};
public static interface Keywords extends Filters {
interface Keywords extends Filters {
String TABLE_NAME = "filtered_keywords";
String CONTENT_PATH_SEGMENT = "keywords";
@ -544,7 +544,7 @@ public interface TwidereDataStore {
Uri CONTENT_URI = Uri.withAppendedPath(Filters.CONTENT_URI, CONTENT_PATH_SEGMENT);
}
public static interface Links extends Filters {
interface Links extends Filters {
String TABLE_NAME = "filtered_links";
String CONTENT_PATH_SEGMENT = "links";
@ -552,7 +552,7 @@ public interface TwidereDataStore {
Uri CONTENT_URI = Uri.withAppendedPath(Filters.CONTENT_URI, CONTENT_PATH_SEGMENT);
}
public static interface Sources extends Filters {
interface Sources extends Filters {
String TABLE_NAME = "filtered_sources";
String CONTENT_PATH_SEGMENT = "sources";
@ -560,7 +560,7 @@ public interface TwidereDataStore {
Uri CONTENT_URI = Uri.withAppendedPath(Filters.CONTENT_URI, CONTENT_PATH_SEGMENT);
}
public static interface Users extends BaseColumns {
interface Users extends BaseColumns {
String TABLE_NAME = "filtered_users";
String CONTENT_PATH_SEGMENT = "users";
@ -578,7 +578,7 @@ public interface TwidereDataStore {
}
}
public static interface Mentions extends Statuses {
interface Mentions extends Statuses {
String TABLE_NAME = "mentions";
String CONTENT_PATH = TABLE_NAME;
@ -587,7 +587,7 @@ public interface TwidereDataStore {
}
public static interface Notifications extends BaseColumns {
interface Notifications extends BaseColumns {
String TABLE_NAME = "notifications";
@ -604,7 +604,7 @@ public interface TwidereDataStore {
String[] COLUMNS = {_ID, ID, COUNT};
}
public static interface Permissions extends BaseColumns {
interface Permissions extends BaseColumns {
String TABLE_NAME = "permissions";
String CONTENT_PATH = TABLE_NAME;
@ -619,7 +619,7 @@ public interface TwidereDataStore {
String[] COLUMNS = {_ID, PACKAGE_NAME, PERMISSION};
}
public static interface Preferences extends BaseColumns {
interface Preferences extends BaseColumns {
String TABLE_NAME = "preferences";
String CONTENT_PATH = TABLE_NAME;
@ -650,7 +650,7 @@ public interface TwidereDataStore {
String[] COLUMNS = {_ID, KEY, VALUE, TYPE};
}
public static interface Statuses extends BaseColumns {
interface Statuses extends BaseColumns {
String TABLE_NAME = "statuses";
String CONTENT_PATH = TABLE_NAME;
@ -707,7 +707,6 @@ public interface TwidereDataStore {
String RETWEET_COUNT = "retweet_count";
String FAVORITE_COUNT = "favorite_count";
String REPLY_COUNT = "reply_count";
String DESCENDENT_REPLY_COUNT = "descendent_reply_count";
/**
* Set to an non-zero integer if the status is a retweet, set to
@ -799,6 +798,9 @@ public interface TwidereDataStore {
String QUOTE_MEDIA_JSON = "quote_media_json";
String QUOTE_TIMESTAMP = "quote_timestamp";
String QUOTE_SOURCE = "quote_source";
String QUOTE_RETWEET_COUNT = "quote_retweet_count";
String QUOTE_FAVORITE_COUNT = "quote_favorite_count";
String QUOTE_REPLY_COUNT = "quote_reply_count";
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";
@ -810,27 +812,28 @@ public interface TwidereDataStore {
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,
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_JSON, MENTIONS_JSON, QUOTE_MEDIA_JSON, CARD_NAME,
CARD, PLACE_FULL_NAME};
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, QUOTE_SOURCE, QUOTE_RETWEET_COUNT,
QUOTE_FAVORITE_COUNT, QUOTE_REPLY_COUNT, 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_JSON, MENTIONS_JSON,
QUOTE_MEDIA_JSON, CARD_NAME, CARD, PLACE_FULL_NAME};
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_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, 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_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, TYPE_TEXT};
TYPE_INT, TYPE_INT, 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, TYPE_TEXT};
}
public static interface Tabs extends BaseColumns {
interface Tabs extends BaseColumns {
String TABLE_NAME = "tabs";
String CONTENT_PATH = TABLE_NAME;
@ -857,7 +860,7 @@ public interface TwidereDataStore {
String DEFAULT_SORT_ORDER = POSITION + " ASC";
}
public static interface CachedRelationships extends BaseColumns {
interface CachedRelationships extends BaseColumns {
String TABLE_NAME = "cached_relationships";
String CONTENT_PATH = TABLE_NAME;
@ -886,7 +889,7 @@ public interface TwidereDataStore {
TYPE_BOOLEAN_DEFAULT_FALSE};
}
public static interface UnreadCounts extends BaseColumns {
interface UnreadCounts extends BaseColumns {
String CONTENT_PATH = "unread_counts";
@ -902,7 +905,7 @@ public interface TwidereDataStore {
String[] COLUMNS = {_ID, TAB_POSITION, TAB_TYPE, COUNT};
public static interface ByType extends UnreadCounts {
interface ByType extends UnreadCounts {
String CONTENT_PATH_SEGMENT = "by_type";

View File

@ -351,6 +351,9 @@ public final class ContentValuesCreator implements TwidereConstants {
values.put(Statuses.QUOTE_TEXT_UNESCAPED, toPlainText(textHtml));
values.put(Statuses.QUOTE_TIMESTAMP, orig.getCreatedAt().getTime());
values.put(Statuses.QUOTE_SOURCE, orig.getSource());
values.put(Statuses.QUOTE_RETWEET_COUNT, orig.getRetweetCount());
values.put(Statuses.QUOTE_FAVORITE_COUNT, orig.getFavoriteCount());
values.put(Statuses.QUOTE_REPLY_COUNT, orig.getReplyCount());
final ParcelableMedia[] quoteMedia = ParcelableMedia.fromStatus(orig);
if (quoteMedia != null && quoteMedia.length > 0) {
try {
@ -399,7 +402,6 @@ public final class ContentValuesCreator implements TwidereConstants {
values.put(Statuses.RETWEET_COUNT, status.getRetweetCount());
values.put(Statuses.REPLY_COUNT, status.getReplyCount());
values.put(Statuses.FAVORITE_COUNT, status.getFavoriteCount());
values.put(Statuses.DESCENDENT_REPLY_COUNT, status.getDescendentReplyCount());
values.put(Statuses.SOURCE, status.getSource());
values.put(Statuses.IS_POSSIBLY_SENSITIVE, status.isPossiblySensitive());
final GeoLocation location = status.getGeoLocation();

View File

@ -62,7 +62,6 @@ dependencies {
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.twitter:twitter-text:1.12.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'

View File

@ -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 = 98;
int DATABASES_VERSION = 99;
int MENU_GROUP_STATUS_EXTENSION = 10;
int MENU_GROUP_COMPOSE_EXTENSION = 11;
@ -169,8 +169,6 @@ public interface Constants extends TwidereConstants {
String EASTER_EGG_RESTORE_TEXT_PART2 = "\u5C0F\u7684";
String EASTER_EGG_RESTORE_TEXT_PART3 = "\u77E5\u9519";
float DEFAULT_PULL_TO_REFRESH_SCROLL_DISTANCE = 0.3f;
int[] PRESET_COLORS = {R.color.material_red, R.color.material_pink,
R.color.material_purple, R.color.material_deep_purple, R.color.material_indigo,
R.color.material_blue, R.color.material_light_blue, R.color.material_cyan,

View File

@ -962,11 +962,15 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
if (status == null || status.id <= 0) return false;
final String myScreenName = Utils.getAccountScreenName(this, status.account_id);
if (TextUtils.isEmpty(myScreenName)) return false;
int selectionStart = 0;
if (status.is_quote) {
mEditText.append("@" + status.quoted_by_user_screen_name + " ");
selectionStart = mEditText.length();
}
mEditText.append("@" + status.user_screen_name + " ");
final int selectionStart = mEditText.length();
if (!status.is_quote) {
selectionStart = mEditText.length();
}
if (status.is_retweet) {
mEditText.append("@" + status.retweeted_by_user_screen_name + " ");
}

View File

@ -34,7 +34,6 @@ import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.app.ActionBar;
import android.text.TextUtils;
import android.view.ActionMode;
import android.view.LayoutInflater;
@ -60,7 +59,6 @@ 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.BasePreferenceActivity;
import org.mariotaku.twidere.activity.SettingsActivity;
import org.mariotaku.twidere.activity.support.CustomTabEditorActivity;
import org.mariotaku.twidere.model.CustomTabConfiguration;
@ -222,6 +220,43 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks<
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
inflater.inflate(R.menu.menu_custom_tabs, menu);
final Resources res = getResources();
final boolean hasOfficialKeyAccounts = Utils.hasAccountSignedWithOfficialKeys(getActivity());
final boolean forcePrivateAPI = mPreferences.getBoolean(KEY_FORCE_USING_PRIVATE_APIS, false);
final long[] accountIds = getAccountIds(getActivity());
final MenuItem itemAdd = menu.findItem(R.id.add_submenu);
if (itemAdd != null && itemAdd.hasSubMenu()) {
final SubMenu subMenu = itemAdd.getSubMenu();
subMenu.clear();
final HashMap<String, CustomTabConfiguration> map = getConfigurationMap();
final List<Entry<String, CustomTabConfiguration>> tabs = new ArrayList<>(
map.entrySet());
Collections.sort(tabs, CustomTabConfigurationComparator.SINGLETON);
for (final Entry<String, CustomTabConfiguration> entry : tabs) {
final String type = entry.getKey();
final CustomTabConfiguration conf = entry.getValue();
final boolean isOfficialKeyAccountRequired = TAB_TYPE_ACTIVITIES_ABOUT_ME.equals(type)
|| TAB_TYPE_ACTIVITIES_BY_FRIENDS.equals(type);
final boolean accountIdRequired = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_REQUIRED;
final Intent intent = new Intent(INTENT_ACTION_ADD_TAB);
intent.setClass(getActivity(), CustomTabEditorActivity.class);
intent.putExtra(EXTRA_TYPE, type);
intent.putExtra(EXTRA_OFFICIAL_KEY_ONLY, isOfficialKeyAccountRequired);
final MenuItem subItem = subMenu.add(conf.getDefaultTitle());
final boolean disabledByNoAccount = accountIdRequired && accountIds.length == 0;
final boolean disabledByNoOfficialKey = !forcePrivateAPI && isOfficialKeyAccountRequired && !hasOfficialKeyAccounts;
final boolean disabledByDuplicateTab = conf.isSingleTab() && isTabAdded(getActivity(), type);
final boolean shouldDisable = disabledByDuplicateTab || disabledByNoOfficialKey || disabledByNoAccount;
subItem.setVisible(!shouldDisable);
subItem.setEnabled(!shouldDisable);
final Drawable icon = ResourcesCompat.getDrawable(res, conf.getDefaultIcon(), null);
subItem.setIcon(icon);
subItem.setIntent(intent);
}
}
}
@Override
@ -270,57 +305,6 @@ public class CustomTabsFragment extends BaseFragment implements LoaderCallbacks<
return true;
}
@Override
public void onPrepareOptionsMenu(final Menu menu) {
final Resources res = getResources();
final boolean hasOfficialKeyAccounts = Utils.hasAccountSignedWithOfficialKeys(getActivity());
final boolean forcePrivateAPI = mPreferences.getBoolean(KEY_FORCE_USING_PRIVATE_APIS, false);
final long[] accountIds = getAccountIds(getActivity());
final MenuItem itemAdd = menu.findItem(R.id.add_submenu);
if (itemAdd != null && itemAdd.hasSubMenu()) {
final SubMenu subMenu = itemAdd.getSubMenu();
subMenu.clear();
final HashMap<String, CustomTabConfiguration> map = getConfigurationMap();
final List<Entry<String, CustomTabConfiguration>> tabs = new ArrayList<>(
map.entrySet());
Collections.sort(tabs, CustomTabConfigurationComparator.SINGLETON);
for (final Entry<String, CustomTabConfiguration> entry : tabs) {
final String type = entry.getKey();
final CustomTabConfiguration conf = entry.getValue();
final boolean isOfficialKeyAccountRequired = TAB_TYPE_ACTIVITIES_ABOUT_ME.equals(type)
|| TAB_TYPE_ACTIVITIES_BY_FRIENDS.equals(type);
final boolean accountIdRequired = conf.getAccountRequirement() == CustomTabConfiguration.ACCOUNT_REQUIRED;
final Intent intent = new Intent(INTENT_ACTION_ADD_TAB);
intent.setClass(getActivity(), CustomTabEditorActivity.class);
intent.putExtra(EXTRA_TYPE, type);
intent.putExtra(EXTRA_OFFICIAL_KEY_ONLY, isOfficialKeyAccountRequired);
final MenuItem subItem = subMenu.add(conf.getDefaultTitle());
final boolean disabledByNoAccount = accountIdRequired && accountIds.length == 0;
final boolean disabledByNoOfficialKey = !forcePrivateAPI && isOfficialKeyAccountRequired && !hasOfficialKeyAccounts;
final boolean disabledByDuplicateTab = conf.isSingleTab() && isTabAdded(getActivity(), type);
final boolean shouldDisable = disabledByDuplicateTab || disabledByNoOfficialKey || disabledByNoAccount;
subItem.setVisible(!shouldDisable);
subItem.setEnabled(!shouldDisable);
final Drawable icon = ResourcesCompat.getDrawable(res, conf.getDefaultIcon(), null);
subItem.setIcon(icon);
subItem.setIntent(intent);
}
}
final Activity activity = getActivity();
if (activity instanceof BasePreferenceActivity) {
final ActionBar actionBar = ((BasePreferenceActivity) activity).getSupportActionBar();
final int themeResourceId = ((BasePreferenceActivity) activity).getCurrentThemeResourceId();
final int itemColor = ThemeUtils.getContrastActionBarItemColor(actionBar.getThemedContext());
final int popupTheme = ThemeUtils.getActionBarPopupThemeRes(actionBar.getThemedContext(), themeResourceId);
final int popupColor = ThemeUtils.getColorFromAttribute(activity, popupTheme, android.R.attr.colorForeground, 0);
ThemeUtils.applyColorFilterToMenuIcon(menu, itemColor, popupColor, 0, Mode.SRC_ATOP);
}
}
@Override
public void onStop() {
super.onStop();

View File

@ -544,14 +544,26 @@ public class ThemeUtils implements Constants {
return getThemeForegroundColor(context, 0);
}
public static int getThemeForegroundColor(final Context context, int theme) {
public static int getThemeForegroundColor(final Context context, int themeRes) {
@SuppressWarnings("ConstantConditions")
final TypedArray a = context.obtainStyledAttributes(null, new int[]{android.R.attr.colorForeground}, 0, theme);
try {
return a.getColor(0, 0);
} finally {
a.recycle();
final TypedValue value = new TypedValue();
final Resources.Theme theme;
if (themeRes != 0) {
theme = context.getResources().newTheme();
theme.applyStyle(themeRes, false);
} else {
theme = context.getTheme();
}
if (!theme.resolveAttribute(android.R.attr.colorForeground, value, true)) {
return 0;
}
if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
// windowBackground is a color
return value.data;
} else if (value.type == TypedValue.TYPE_REFERENCE) {
return theme.getResources().getColor(value.resourceId);
}
return 0;
}
public static String getThemeNameOption(final Context context) {

View File

@ -32,21 +32,21 @@ import org.mariotaku.twidere.util.MouseScrollDirectionDecider;
/**
* Created by mariotaku on 15/3/30.
*/
public class RecyclerViewBackport extends RecyclerView {
public class ExtendedRecyclerView extends RecyclerView {
private final MouseScrollDirectionDecider mMouseScrollDirectionDecider;
// This value is used when handling generic motion events.
private float mScrollFactor = Float.MIN_VALUE;
public RecyclerViewBackport(Context context) {
public ExtendedRecyclerView(Context context) {
this(context, null);
}
public RecyclerViewBackport(Context context, AttributeSet attrs) {
public ExtendedRecyclerView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RecyclerViewBackport(Context context, AttributeSet attrs, int defStyle) {
public ExtendedRecyclerView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mMouseScrollDirectionDecider = new MouseScrollDirectionDecider(context, getScrollFactorBackport());
}
@ -89,6 +89,42 @@ public class RecyclerViewBackport extends RecyclerView {
return false;
}
@Override
public int computeVerticalScrollRange() {
if (getLayoutManager() == null) return 0;
return super.computeVerticalScrollRange();
}
@Override
public int computeHorizontalScrollRange() {
if (getLayoutManager() == null) return 0;
return super.computeHorizontalScrollRange();
}
@Override
public int computeHorizontalScrollOffset() {
if (getLayoutManager() == null) return 0;
return super.computeHorizontalScrollOffset();
}
@Override
public int computeHorizontalScrollExtent() {
if (getLayoutManager() == null) return 0;
return super.computeHorizontalScrollExtent();
}
@Override
public int computeVerticalScrollOffset() {
if (getLayoutManager() == null) return 0;
return super.computeVerticalScrollOffset();
}
@Override
public int computeVerticalScrollExtent() {
if (getLayoutManager() == null) return 0;
return super.computeVerticalScrollExtent();
}
/**
* Ported from View.getVerticalScrollFactor.
*/

View File

@ -140,7 +140,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
final Context context = adapter.getContext();
final boolean nameFirst = adapter.isNameFirst();
final long reply_count = status.reply_count;
final long reply_count = status.is_quote ? status.quote_reply_count : status.reply_count;
final long retweet_count;
final long favorite_count;
@ -292,12 +292,13 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
if (twitter.isDestroyingStatus(status.account_id, status.my_retweet_id)) {
retweetCountView.setActivated(false);
retweet_count = Math.max(0, status.retweet_count - 1);
retweet_count = Math.max(0, (status.is_quote ? status.quote_retweet_count : status.retweet_count) - 1);
} else {
final boolean creatingRetweet = twitter.isCreatingRetweet(status.account_id, status.id);
retweetCountView.setActivated(creatingRetweet || Utils.isMyRetweet(status.account_id,
status.retweeted_by_user_id, status.my_retweet_id));
retweet_count = status.retweet_count + (creatingRetweet ? 1 : 0);
retweet_count = (status.is_quote ? status.quote_retweet_count : status.retweet_count)
+ (creatingRetweet ? 1 : 0);
}
if (retweet_count > 0) {
retweetCountView.setText(Utils.getLocalizedNumber(locale, retweet_count));
@ -306,11 +307,12 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
}
if (twitter.isDestroyingFavorite(status.account_id, status.id)) {
favoriteCountView.setActivated(false);
favorite_count = Math.max(0, status.favorite_count - 1);
favorite_count = Math.max(0, (status.is_quote ? status.quote_favorite_count : status.favorite_count) - 1);
} else {
final boolean creatingFavorite = twitter.isCreatingFavorite(status.account_id, status.id);
favoriteCountView.setActivated(creatingFavorite || status.is_favorite);
favorite_count = status.favorite_count + (creatingFavorite ? 1 : 0);
favorite_count = (status.is_quote ? status.quote_favorite_count : status.favorite_count)
+ (creatingFavorite ? 1 : 0);
}
if (favorite_count > 0) {
favoriteCountView.setText(Utils.getLocalizedNumber(locale, favorite_count));
@ -337,7 +339,9 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
final Context context = adapter.getContext();
final boolean nameFirst = adapter.isNameFirst();
final long reply_count = cursor.getLong(indices.reply_count);
final boolean is_quote = cursor.getShort(indices.is_quote) == 1;
final long reply_count = cursor.getLong(is_quote ? indices.quote_reply_count : indices.reply_count);
final long retweet_count;
final long favorite_count;
@ -385,7 +389,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
final int typeIconRes;
if (cursor.getShort(indices.is_quote) == 1) {
if (is_quote) {
quotedNameView.setName(manager.getUserNickname(user_id, user_name, false));
quotedNameView.setScreenName("@" + user_screen_name);
timeView.setTime(cursor.getLong(indices.quote_timestamp));
@ -506,12 +510,12 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
if (twitter.isDestroyingStatus(account_id, my_retweet_id)) {
retweetCountView.setActivated(false);
retweet_count = Math.max(0, cursor.getLong(indices.retweet_count) - 1);
retweet_count = Math.max(0, cursor.getLong(is_quote ? indices.quote_retweet_count : indices.retweet_count) - 1);
} else {
final boolean creatingRetweet = twitter.isCreatingRetweet(account_id, status_id);
retweetCountView.setActivated(creatingRetweet || Utils.isMyRetweet(account_id,
retweeted_by_id, my_retweet_id));
retweet_count = cursor.getLong(indices.retweet_count) + (creatingRetweet ? 1 : 0);
retweet_count = cursor.getLong(is_quote ? indices.quote_retweet_count : indices.retweet_count) + (creatingRetweet ? 1 : 0);
}
if (retweet_count > 0) {
retweetCountView.setText(Utils.getLocalizedNumber(Locale.getDefault(), retweet_count));
@ -520,11 +524,11 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
}
if (twitter.isDestroyingFavorite(account_id, status_id)) {
favoriteCountView.setActivated(false);
favorite_count = Math.max(0, cursor.getLong(indices.favorite_count) - 1);
favorite_count = Math.max(0, cursor.getLong(is_quote ? indices.quote_favorite_count : indices.favorite_count) - 1);
} else {
final boolean creatingFavorite = twitter.isCreatingFavorite(account_id, status_id);
favoriteCountView.setActivated(creatingFavorite || cursor.getShort(indices.is_favorite) == 1);
favorite_count = cursor.getLong(indices.favorite_count) + (creatingFavorite ? 1 : 0);
favorite_count = cursor.getLong(is_quote ? indices.quote_favorite_count : indices.favorite_count) + (creatingFavorite ? 1 : 0);
}
if (favorite_count > 0) {
favoriteCountView.setText(Utils.getLocalizedNumber(Locale.getDefault(), favorite_count));

View File

@ -108,7 +108,7 @@
android:layout_alignTop="@+id/edit_text_container"
android:visibility="gone">
<android.support.v7.widget.RecyclerView
<org.mariotaku.twidere.view.ExtendedRecyclerView
android:id="@+id/account_selector"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -17,7 +17,8 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@ -33,7 +34,8 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:clickable="true"
android:padding="@dimen/element_spacing_msmall">
android:paddingBottom="@dimen/element_spacing_msmall"
android:paddingTop="@dimen/element_spacing_msmall">
<org.mariotaku.twidere.view.SquareShapedImageView
android:id="@+id/account_profile_image"
@ -43,7 +45,7 @@
android:layout_gravity="center"
app:sivBackgroundColor="?android:colorBackground"
app:sivBorder="true"
app:sivBorderWidth="@dimen/line_width_compose_account_profile_image" />
app:sivBorderWidth="@dimen/line_width_compose_account_profile_image"/>
<org.mariotaku.twidere.view.BadgeView
android:id="@+id/accounts_count"
@ -56,7 +58,7 @@
android:layout_alignStart="@id/account_profile_image"
android:layout_alignTop="@id/account_profile_image"
android:layout_gravity="center"
android:textColor="?android:colorForeground" />
android:textColor="?android:colorForeground"/>
</RelativeLayout>
@ -74,7 +76,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@null" />
android:background="@null"/>
</HorizontalScrollView>
<LinearLayout
@ -101,7 +103,7 @@
android:gravity="center"
android:minWidth="@dimen/element_size_small"
android:textAppearance="?android:textAppearanceSmall"
tools:text="140" />
tools:text="140"/>
<org.mariotaku.twidere.view.ActionIconView
android:layout_width="wrap_content"
@ -111,7 +113,7 @@
android:cropToPadding="false"
android:padding="@dimen/element_spacing_xsmall"
android:scaleType="centerCrop"
android:src="@drawable/ic_action_send" />
android:src="@drawable/ic_action_send"/>
</LinearLayout>
</RelativeLayout>

View File

@ -32,7 +32,7 @@
android:layout_height="match_parent"
android:clipToPadding="false">
<org.mariotaku.twidere.view.RecyclerViewBackport
<org.mariotaku.twidere.view.ExtendedRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -38,7 +38,7 @@
android:layout_height="match_parent"
android:layout_above="@+id/input_panel">
<android.support.v7.widget.RecyclerView
<org.mariotaku.twidere.view.ExtendedRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -33,13 +33,13 @@
android:layout_gravity="bottom"
android:visibility="gone">
<android.support.v7.widget.RecyclerView
<org.mariotaku.twidere.view.ExtendedRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<requestFocus/>
</android.support.v7.widget.RecyclerView>
</org.mariotaku.twidere.view.ExtendedRecyclerView>
<MultiAutoCompleteTextView
android:layout_width="match_parent"

View File

@ -66,7 +66,7 @@
app:sivBorderWidth="2dp"
tools:src="@mipmap/ic_launcher" />
<android.support.v7.widget.RecyclerView
<org.mariotaku.twidere.view.ExtendedRecyclerView
android:id="@+id/other_accounts_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"