fixed open quoted user when click profile name in status screen

added click quoted user name to open quoted user
added tinted progress wheel
fixed quote text link highlighting
This commit is contained in:
Mariotaku Lee 2015-04-26 00:17:04 +08:00
parent 855594e6f9
commit 134cbeb916
10 changed files with 144 additions and 83 deletions

View File

@ -98,8 +98,8 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
public long user_id;
@JsonField(name = "retweet_id")
public long retweet_id;
@JsonField(name = "retweeted_by_id")
public long retweeted_by_id;
@JsonField(name = "retweeted_by_user_id")
public long retweeted_by_user_id;
@JsonField(name = "retweet_timestamp")
public long retweet_timestamp;
@JsonField(name = "retweet_count")
@ -144,12 +144,12 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
@JsonField(name = "quoted_by_user_is_verified")
public boolean quoted_by_user_is_verified;
@JsonField(name = "retweeted_by_name")
public String retweeted_by_name;
@JsonField(name = "retweeted_by_screen_name")
public String retweeted_by_screen_name;
@JsonField(name = "retweeted_by_profile_image")
public String retweeted_by_profile_image;
@JsonField(name = "retweeted_by_user_name")
public String retweeted_by_user_name;
@JsonField(name = "retweeted_by_user_screen_name")
public String retweeted_by_user_screen_name;
@JsonField(name = "retweeted_by_user_profile_image")
public String retweeted_by_user_profile_image;
@JsonField(name = "text_html")
public String text_html;
@JsonField(name = "text_plain")
@ -209,7 +209,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
user_id = idx.user_id != -1 ? c.getLong(idx.user_id) : -1;
retweet_id = idx.retweet_id != -1 ? c.getLong(idx.retweet_id) : -1;
retweet_timestamp = idx.retweet_timestamp != -1 ? c.getLong(idx.retweet_timestamp) : -1;
retweeted_by_id = idx.retweeted_by_user_id != -1 ? c.getLong(idx.retweeted_by_user_id) : -1;
retweeted_by_user_id = idx.retweeted_by_user_id != -1 ? c.getLong(idx.retweeted_by_user_id) : -1;
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;
@ -221,10 +221,10 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
is_favorite = idx.is_favorite != -1 && c.getInt(idx.is_favorite) == 1;
user_is_protected = idx.is_protected != -1 && c.getInt(idx.is_protected) == 1;
user_is_verified = idx.is_verified != -1 && c.getInt(idx.is_verified) == 1;
retweeted_by_name = idx.retweeted_by_user_name != -1 ? c.getString(idx.retweeted_by_user_name) : null;
retweeted_by_screen_name = idx.retweeted_by_user_screen_name != -1 ? c
retweeted_by_user_name = idx.retweeted_by_user_name != -1 ? c.getString(idx.retweeted_by_user_name) : null;
retweeted_by_user_screen_name = idx.retweeted_by_user_screen_name != -1 ? c
.getString(idx.retweeted_by_user_screen_name) : null;
retweeted_by_profile_image = idx.retweeted_by_user_profile_image != -1 ? c
retweeted_by_user_profile_image = idx.retweeted_by_user_profile_image != -1 ? c
.getString(idx.retweeted_by_user_profile_image) : null;
text_html = idx.text_html != -1 ? c.getString(idx.text_html) : null;
media = idx.media != -1 ? ParcelableMedia.fromSerializedJson(c.getString(idx.media)) : null;
@ -271,7 +271,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
user_id = in.readLong();
retweet_id = in.readLong();
retweet_timestamp = in.readLong();
retweeted_by_id = in.readLong();
retweeted_by_user_id = in.readLong();
retweet_count = in.readLong();
favorite_count = in.readLong();
reply_count = in.readLong();
@ -282,9 +282,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
is_favorite = in.readByte() == 1;
user_is_protected = in.readByte() == 1;
user_is_verified = in.readByte() == 1;
retweeted_by_name = in.readString();
retweeted_by_screen_name = in.readString();
retweeted_by_profile_image = in.readString();
retweeted_by_user_name = in.readString();
retweeted_by_user_screen_name = in.readString();
retweeted_by_user_profile_image = in.readString();
text_html = in.readString();
text_plain = in.readString();
user_name = in.readString();
@ -328,7 +328,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
user_id = orig.user_id;
retweet_id = orig.retweet_id;
retweet_timestamp = orig.retweet_timestamp;
retweeted_by_id = orig.retweeted_by_id;
retweeted_by_user_id = orig.retweeted_by_user_id;
retweet_count = override_retweet_count;
favorite_count = orig.favorite_count;
reply_count = orig.reply_count;
@ -339,9 +339,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
is_favorite = orig.is_favorite;
user_is_protected = orig.user_is_protected;
user_is_verified = orig.user_is_verified;
retweeted_by_name = orig.retweeted_by_name;
retweeted_by_screen_name = orig.retweeted_by_screen_name;
retweeted_by_profile_image = orig.retweeted_by_profile_image;
retweeted_by_user_name = orig.retweeted_by_user_name;
retweeted_by_user_screen_name = orig.retweeted_by_user_screen_name;
retweeted_by_user_profile_image = orig.retweeted_by_user_profile_image;
text_html = orig.text_html;
text_plain = orig.text_plain;
user_name = orig.user_name;
@ -388,10 +388,10 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
is_retweet = orig.isRetweet();
retweet_id = retweeted != null ? retweeted.getId() : -1;
retweet_timestamp = retweeted != null ? getTime(retweeted.getCreatedAt()) : -1;
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 ? retweet_user.getProfileImageUrlHttps() : null;
retweeted_by_user_id = retweet_user != null ? retweet_user.getId() : -1;
retweeted_by_user_name = retweet_user != null ? retweet_user.getName() : null;
retweeted_by_user_screen_name = retweet_user != null ? retweet_user.getScreenName() : null;
retweeted_by_user_profile_image = retweet_user != null ? retweet_user.getProfileImageUrlHttps() : null;
final Status quoted = orig.getQuotedStatus();
final User quote_user = quoted != null ? orig.getUser() : null;
@ -442,7 +442,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
location = ParcelableLocation.fromGeoLocation(status.getGeoLocation());
is_favorite = status.isFavorited();
text_unescaped = HtmlEscapeHelper.toPlainText(text_html);
my_retweet_id = retweeted_by_id == account_id ? id : status.getCurrentUserRetweet();
my_retweet_id = retweeted_by_user_id == account_id ? id : status.getCurrentUserRetweet();
is_possibly_sensitive = status.isPossiblySensitive();
mentions = ParcelableUserMention.fromUserMentionEntities(status.getUserMentionEntities());
card = ParcelableCardEntity.fromCardEntity(status.getCard(), account_id);
@ -489,7 +489,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", timestamp=" + timestamp +
", user_id=" + user_id +
", retweet_id=" + retweet_id +
", retweeted_by_id=" + retweeted_by_id +
", retweeted_by_user_id=" + retweeted_by_user_id +
", retweet_timestamp=" + retweet_timestamp +
", retweet_count=" + retweet_count +
", favorite_count=" + favorite_count +
@ -511,9 +511,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", 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 + '\'' +
", retweeted_by_user_name='" + retweeted_by_user_name + '\'' +
", retweeted_by_user_screen_name='" + retweeted_by_user_screen_name + '\'' +
", retweeted_by_user_profile_image='" + retweeted_by_user_profile_image + '\'' +
", text_html='" + text_html + '\'' +
", text_plain='" + text_plain + '\'' +
", user_name='" + user_name + '\'' +
@ -850,7 +850,7 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
out.writeLong(user_id);
out.writeLong(retweet_id);
out.writeLong(retweet_timestamp);
out.writeLong(retweeted_by_id);
out.writeLong(retweeted_by_user_id);
out.writeLong(retweet_count);
out.writeLong(favorite_count);
out.writeLong(reply_count);
@ -861,9 +861,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
out.writeByte((byte) (is_favorite ? 1 : 0));
out.writeByte((byte) (user_is_protected ? 1 : 0));
out.writeByte((byte) (user_is_verified ? 1 : 0));
out.writeString(retweeted_by_name);
out.writeString(retweeted_by_screen_name);
out.writeString(retweeted_by_profile_image);
out.writeString(retweeted_by_user_name);
out.writeString(retweeted_by_user_screen_name);
out.writeString(retweeted_by_user_profile_image);
out.writeString(text_html);
out.writeString(text_plain);
out.writeString(user_name);

View File

@ -917,14 +917,14 @@ public class ComposeActivity extends ThemedFragmentActivity implements LocationL
}
mEditText.append("@" + status.user_screen_name + " ");
final int selectionStart = mEditText.length();
if (!TextUtils.isEmpty(status.retweeted_by_screen_name)) {
mEditText.append("@" + status.retweeted_by_screen_name + " ");
if (!TextUtils.isEmpty(status.retweeted_by_user_screen_name)) {
mEditText.append("@" + status.retweeted_by_user_screen_name + " ");
}
final Collection<String> mentions = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
mentions.addAll(mExtractor.extractMentionedScreennames(status.text_plain));
for (final String mention : mentions) {
if (mention.equalsIgnoreCase(status.user_screen_name) || mention.equalsIgnoreCase(myScreenName)
|| mention.equalsIgnoreCase(status.retweeted_by_screen_name)) {
|| mention.equalsIgnoreCase(status.retweeted_by_user_screen_name)) {
continue;
}
mEditText.append("@" + mention + " ");

View File

@ -131,16 +131,6 @@ import edu.tsinghua.spice.Utilies.SpiceProfilingUtil;
import edu.tsinghua.spice.Utilies.TypeMappingUtil;
import twitter4j.TwitterException;
import static android.text.TextUtils.isEmpty;
import static org.mariotaku.twidere.util.Utils.findStatus;
import static org.mariotaku.twidere.util.Utils.formatToLongTimeString;
import static org.mariotaku.twidere.util.Utils.getLocalizedNumber;
import static org.mariotaku.twidere.util.Utils.getUserTypeIconRes;
import static org.mariotaku.twidere.util.Utils.openStatus;
import static org.mariotaku.twidere.util.Utils.openUserProfile;
import static org.mariotaku.twidere.util.Utils.setMenuForStatus;
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
/**
* Created by mariotaku on 14/12/5.
*/
@ -236,7 +226,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
if (resultCode == Activity.RESULT_OK) {
if (data == null || !data.hasExtra(EXTRA_ID)) return;
final long accountId = data.getLongExtra(EXTRA_ID, -1);
openStatus(activity, accountId, status.id);
Utils.openStatus(activity, accountId, status.id);
}
break;
}
@ -357,7 +347,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
@Override
public void onStatusClick(StatusViewHolder holder, int position) {
openStatus(getActivity(), mStatusAdapter.getStatus(position), null);
Utils.openStatus(getActivity(), mStatusAdapter.getStatus(position), null);
}
@Override
@ -376,7 +366,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
popupMenu.setOnMenuItemClickListener(mOnStatusMenuItemClickListener);
popupMenu.inflate(R.menu.action_status);
final ParcelableStatus status = mStatusAdapter.getStatus(position);
setMenuForStatus(mStatusAdapter.getContext(), popupMenu.getMenu(), status);
Utils.setMenuForStatus(mStatusAdapter.getContext(), popupMenu.getMenu(), status);
popupMenu.show();
mPopupMenu = popupMenu;
mSelectedStatus = status;
@ -496,7 +486,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
final Bundle args = new Bundle();
args.putLong(EXTRA_ACCOUNT_ID, status.account_id);
args.putLong(EXTRA_STATUS_ID, status.retweet_id > 0 ? status.retweet_id : status.id);
args.putString(EXTRA_SCREEN_NAME, status.retweet_id > 0 ? status.retweeted_by_screen_name : status.user_screen_name);
args.putString(EXTRA_SCREEN_NAME, status.retweet_id > 0 ? status.retweeted_by_user_screen_name : status.user_screen_name);
if (mRepliesLoaderInitialized) {
getLoaderManager().restartLoader(LOADER_ID_STATUS_REPLIES, args, mRepliesLoaderCallback);
return;
@ -697,8 +687,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
linkClickHandler.setStatus(status);
if (status.retweet_id > 0) {
final String retweetedBy = manager.getDisplayName(status.retweeted_by_id,
status.retweeted_by_name, status.retweeted_by_screen_name, nameFirst, false);
final String retweetedBy = manager.getDisplayName(status.retweeted_by_user_id,
status.retweeted_by_user_name, status.retweeted_by_user_screen_name, nameFirst, false);
retweetedByView.setText(context.getString(R.string.name_retweeted, retweetedBy));
retweetedByContainer.setVisibility(View.VISIBLE);
} else {
@ -711,6 +701,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
final int typeIconRes, typeDescriptionRes;
final long timestamp;
final String source;
final int layoutPosition = getLayoutPosition();
final int linkHighlightingStyle = adapter.getLinkHighlightingStyle();
if (status.is_quote) {
quotedNameView.setText(manager.getUserNickname(status.user_id, status.user_name, false));
quotedScreenNameView.setText("@" + status.user_screen_name);
@ -721,8 +713,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
final int idx = status.quote_text_unescaped.lastIndexOf(" twitter.com");
final Spanned quote_text = Html.fromHtml(status.quote_text_html);
quoteTextView.setText(idx > 0 ? quote_text.subSequence(0, idx) : quote_text);
linkify.applyAllLinks(quoteTextView, status.account_id, getLayoutPosition(),
status.is_possibly_sensitive, adapter.getLinkHighlightingStyle());
linkify.applyAllLinks(quoteTextView, status.account_id, layoutPosition, status.is_possibly_sensitive);
ThemeUtils.applyParagraphSpacing(quoteTextView, 1.1f);
loader.displayProfileImage(profileImageView, status.quoted_by_user_profile_image);
@ -733,8 +725,9 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
quoteIndicator.setColor(manager.getUserColor(status.user_id, false));
profileContainer.drawStart(manager.getUserColor(status.quoted_by_user_id, false));
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);
typeIconRes = Utils.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;
@ -751,7 +744,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
profileContainer.drawStart(manager.getUserColor(status.user_id, false));
typeIconRes = getUserTypeIconRes(status.user_is_verified, status.user_is_protected);
typeIconRes = Utils.getUserTypeIconRes(status.user_is_verified, status.user_is_protected);
typeDescriptionRes = Utils.getUserTypeDescriptionRes(status.user_is_verified, status.user_is_protected);
timestamp = status.timestamp;
@ -768,19 +761,19 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
profileTypeView.setVisibility(View.GONE);
}
final String timeString = formatToLongTimeString(context, timestamp);
if (!isEmpty(timeString) && !isEmpty(source)) {
final String timeString = Utils.formatToLongTimeString(context, timestamp);
if (!TextUtils.isEmpty(timeString) && !TextUtils.isEmpty(source)) {
timeSourceView.setText(Html.fromHtml(context.getString(R.string.time_source, timeString, source)));
} else if (isEmpty(timeString) && !isEmpty(source)) {
} else if (TextUtils.isEmpty(timeString) && !TextUtils.isEmpty(source)) {
timeSourceView.setText(Html.fromHtml(context.getString(R.string.source, source)));
} else if (!isEmpty(timeString) && isEmpty(source)) {
} else if (!TextUtils.isEmpty(timeString) && TextUtils.isEmpty(source)) {
timeSourceView.setText(timeString);
}
timeSourceView.setMovementMethod(null);
textView.setText(Html.fromHtml(status.text_html));
linkify.applyAllLinks(textView, status.account_id, getLayoutPosition(), status.is_possibly_sensitive);
linkify.applyAllLinks(textView, status.account_id, layoutPosition, status.is_possibly_sensitive);
ThemeUtils.applyParagraphSpacing(textView, 1.1f);
if (!TextUtils.isEmpty(status.place_full_name)) {
@ -800,9 +793,9 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
repliesContainer.setVisibility(status.reply_count < 0 ? View.GONE : View.VISIBLE);
favoritesContainer.setVisibility(status.favorite_count < 0 ? View.GONE : View.VISIBLE);
final Locale locale = context.getResources().getConfiguration().locale;
repliesCountView.setText(getLocalizedNumber(locale, status.reply_count));
retweetsCountView.setText(getLocalizedNumber(locale, status.retweet_count));
favoritesCountView.setText(getLocalizedNumber(locale, status.favorite_count));
repliesCountView.setText(Utils.getLocalizedNumber(locale, status.reply_count));
retweetsCountView.setText(Utils.getLocalizedNumber(locale, status.retweet_count));
favoritesCountView.setText(Utils.getLocalizedNumber(locale, status.favorite_count));
if (status.media == null) {
@ -872,8 +865,13 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
final Bundle activityOption = Utils.makeSceneTransitionOption(activity,
new Pair<View, String>(profileImageView, UserFragment.TRANSITION_NAME_PROFILE_IMAGE),
new Pair<View, String>(profileTypeView, UserFragment.TRANSITION_NAME_PROFILE_TYPE));
openUserProfile(activity, status.account_id, status.user_id, status.user_screen_name,
activityOption);
if (status.is_quote) {
Utils.openUserProfile(adapter.getContext(), status.account_id, status.quoted_by_user_id,
status.quoted_by_user_screen_name, activityOption);
} else {
Utils.openUserProfile(activity, status.account_id, status.user_id, status.user_screen_name,
activityOption);
}
break;
}
case R.id.retweets_container: {
@ -883,8 +881,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
}
case R.id.retweeted_by_container: {
if (status.retweet_id > 0) {
Utils.openUserProfile(adapter.getContext(), status.account_id, status.retweeted_by_id,
status.retweeted_by_screen_name, null);
Utils.openUserProfile(adapter.getContext(), status.account_id, status.retweeted_by_user_id,
status.retweeted_by_user_screen_name, null);
}
break;
}
@ -894,6 +892,11 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
Utils.openMap(adapter.getContext(), location.latitude, location.longitude);
break;
}
case R.id.quoted_name_container: {
Utils.openUserProfile(adapter.getContext(), status.account_id, status.user_id,
status.user_screen_name, null);
break;
}
}
}
@ -924,6 +927,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
ThemeUtils.wrapMenuIcon(menuBar, MENU_GROUP_STATUS_SHARE);
mediaPreviewLoad.setOnClickListener(this);
profileContainer.setOnClickListener(this);
quotedNameContainer.setOnClickListener(this);
retweetsContainer.setOnClickListener(this);
favoritesContainer.setOnClickListener(this);
retweetedByContainer.setOnClickListener(this);
@ -1014,7 +1018,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
ParcelableStatus status = params[0];
final long account_id = status.account_id;
while (status.in_reply_to_status_id > 0 && !isCancelled()) {
status = findStatus(context, account_id, status.in_reply_to_status_id);
status = Utils.findStatus(context, account_id, status.in_reply_to_status_id);
publishProgress(status);
list.add(0, status);
}
@ -1029,7 +1033,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
if (data.hasData()) {
fragment.setConversation(data.getData());
} else {
showErrorMessage(context, context.getString(R.string.action_getting_status), data.getException(), true);
Utils.showErrorMessage(context, context.getString(R.string.action_getting_status), data.getException(), true);
}
}

View File

@ -1700,9 +1700,13 @@ public final class Utils implements Constants, TwitterConstants {
public static long getDefaultAccountId(final Context context) {
if (context == null) return -1;
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
long account_id = prefs.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
if (account_id == -1) account_id = Utils.getAccountIds(context)[0]; /* TODO: this is just a quick fix */
return account_id;
final long accountId = prefs.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
final long[] accountIds;
if (accountId == -1 && (accountIds = Utils.getAccountIds(context)).length > 0) {
/* TODO: this is just a quick fix */
return accountIds[0];
}
return accountId;
}
public static String getDefaultAccountScreenName(final Context context) {
@ -2763,7 +2767,7 @@ public final class Utils implements Constants, TwitterConstants {
final boolean filter_rts) {
if (database == null || status == null) return false;
return isFiltered(database, status.user_id, status.text_plain, status.text_html, status.source,
status.retweeted_by_id, filter_rts);
status.retweeted_by_user_id, filter_rts);
}
public static boolean isMyAccount(final Context context, final long account_id) {
@ -2796,7 +2800,7 @@ public final class Utils implements Constants, TwitterConstants {
}
public static boolean isMyRetweet(final ParcelableStatus status) {
return status != null && isMyRetweet(status.account_id, status.retweeted_by_id, status.my_retweet_id);
return status != null && isMyRetweet(status.account_id, status.retweeted_by_user_id, status.my_retweet_id);
}
public static boolean isMyRetweet(final long account_id, final long retweeted_by_id, final long my_retweet_id) {

View File

@ -149,8 +149,8 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
final long favorite_count;
if (status.retweet_id > 0) {
final String retweetedBy = manager.getDisplayName(status.retweeted_by_id,
status.retweeted_by_name, status.retweeted_by_screen_name, nameFirst, false);
final String retweetedBy = manager.getDisplayName(status.retweeted_by_user_id,
status.retweeted_by_user_name, status.retweeted_by_user_screen_name, nameFirst, false);
replyRetweetView.setText(context.getString(R.string.name_retweeted, retweetedBy));
replyRetweetIcon.setImageResource(R.drawable.ic_activity_action_retweet);
replyRetweetView.setVisibility(View.VISIBLE);
@ -292,7 +292,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
} else {
final boolean creatingRetweet = twitter.isCreatingRetweet(status.account_id, status.id);
retweetCountView.setActivated(creatingRetweet || Utils.isMyRetweet(status.account_id,
status.retweeted_by_id, status.my_retweet_id));
status.retweeted_by_user_id, status.my_retweet_id));
retweet_count = status.retweet_count + (creatingRetweet ? 1 : 0);
}
if (retweet_count > 0) {

View File

@ -0,0 +1,51 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 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/>.
*/
package org.mariotaku.twidere.view.themed;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.util.AttributeSet;
import com.pnikosis.materialishprogress.ProgressWheel;
import org.mariotaku.twidere.view.iface.IThemedView;
/**
* Created by mariotaku on 15/4/25.
*/
public class TintThemedProgressWheel extends ProgressWheel implements IThemedView {
public TintThemedProgressWheel(Context context, AttributeSet attrs) {
super(context, attrs);
}
public TintThemedProgressWheel(Context context) {
super(context);
}
@Override
public void setThemeTintColor(ColorStateList color) {
if (color != null) {
setBarColor(color.getDefaultColor());
} else {
setBarColor(Color.TRANSPARENT);
}
}
}

View File

@ -35,7 +35,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.pnikosis.materialishprogress.ProgressWheel
<org.mariotaku.twidere.view.themed.TintThemedProgressWheel
android:id="@+id/load_progress"
android:layout_width="@dimen/element_size_normal"
android:layout_height="@dimen/element_size_normal"

View File

@ -30,7 +30,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.pnikosis.materialishprogress.ProgressWheel
<org.mariotaku.twidere.view.themed.TintThemedProgressWheel
android:id="@+id/load_progress"
android:layout_width="@dimen/element_size_normal"
android:layout_height="@dimen/element_size_normal"

View File

@ -51,7 +51,7 @@
</RelativeLayout>
<com.pnikosis.materialishprogress.ProgressWheel
<org.mariotaku.twidere.view.themed.TintThemedProgressWheel
android:id="@+id/load_progress"
android:layout_width="@dimen/element_size_normal"
android:layout_height="@dimen/element_size_normal"

View File

@ -18,10 +18,10 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout
android:id="@+id/card_content"
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:id="@+id/card_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
@ -202,6 +202,8 @@
android:layout_height="wrap_content"
android:layout_below="@+id/quote_text"
android:layout_toRightOf="@+id/quote_indicator"
android:background="?selectableItemBackground"
android:clickable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/element_spacing_normal"