1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-17 04:00:48 +01:00

improved quote status style

This commit is contained in:
Mariotaku Lee 2016-08-30 23:57:37 +08:00
parent 5ea133b960
commit 21acf7aa5d
13 changed files with 189 additions and 209 deletions

View File

@ -48,6 +48,31 @@ public class Photo implements Parcelable {
'}'; '}';
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Photo photo = (Photo) o;
if (url != null ? !url.equals(photo.url) : photo.url != null) return false;
if (imageUrl != null ? !imageUrl.equals(photo.imageUrl) : photo.imageUrl != null)
return false;
if (thumbUrl != null ? !thumbUrl.equals(photo.thumbUrl) : photo.thumbUrl != null)
return false;
return largeUrl != null ? largeUrl.equals(photo.largeUrl) : photo.largeUrl == null;
}
@Override
public int hashCode() {
int result = url != null ? url.hashCode() : 0;
result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
result = 31 * result + (thumbUrl != null ? thumbUrl.hashCode() : 0);
result = 31 * result + (largeUrl != null ? largeUrl.hashCode() : 0);
return result;
}
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;

View File

@ -246,7 +246,7 @@ public class Activity extends TwitterResponseObject implements TwitterResponse,
} }
} }
public static Activity fromMention(String accountId, Status status) { public static Activity fromMention(@NonNull String accountId, @NonNull Status status) {
final Activity activity = new Activity(); final Activity activity = new Activity();
activity.maxPosition = activity.minPosition = status.getId(); activity.maxPosition = activity.minPosition = status.getId();

View File

@ -532,6 +532,11 @@ public class Status extends TwitterResponseObject implements Comparable<Status>,
quotedStatus = repostStatus; quotedStatus = repostStatus;
quotedStatusId = repostStatusId; quotedStatusId = repostStatusId;
isQuoteStatus = true; isQuoteStatus = true;
// Set repost media to null if identical to original
if (photo != null && photo.equals(repostStatus.photo)) {
photo = null;
}
} }
} }

View File

@ -275,14 +275,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
@CursorField(Statuses.QUOTED_USER_PROFILE_IMAGE) @CursorField(Statuses.QUOTED_USER_PROFILE_IMAGE)
public String quoted_user_profile_image; public String quoted_user_profile_image;
@ParcelableThisPlease @ParcelableThisPlease
@JsonField(name = "quoted_location")
@CursorField(value = Statuses.QUOTED_LOCATION, converter = ParcelableLocation.Converter.class)
public ParcelableLocation quoted_location;
@ParcelableThisPlease
@JsonField(name = "quoted_place_full_name")
@CursorField(value = Statuses.QUOTED_PLACE_FULL_NAME, converter = LoganSquareCursorFieldConverter.class)
public String quoted_place_full_name;
@ParcelableThisPlease
@JsonField(name = "location") @JsonField(name = "location")
@CursorField(value = Statuses.LOCATION, converter = ParcelableLocation.Converter.class) @CursorField(value = Statuses.LOCATION, converter = ParcelableLocation.Converter.class)
public ParcelableLocation location; public ParcelableLocation location;
@ -401,11 +393,12 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
@Override @Override
public String toString() { public String toString() {
return "ParcelableStatus{" + return "ParcelableStatus{" +
"id='" + id + '\'' + "_id=" + _id +
", sort_id=" + sort_id + ", id='" + id + '\'' +
", account_key=" + account_key + ", account_key=" + account_key +
", timestamp=" + timestamp + ", sort_id=" + sort_id +
", position_key=" + position_key + ", position_key=" + position_key +
", timestamp=" + timestamp +
", user_key=" + user_key + ", user_key=" + user_key +
", retweet_id='" + retweet_id + '\'' + ", retweet_id='" + retweet_id + '\'' +
", retweeted_by_user_key=" + retweeted_by_user_key + ", retweeted_by_user_key=" + retweeted_by_user_key +
@ -449,8 +442,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", quoted_user_name='" + quoted_user_name + '\'' + ", quoted_user_name='" + quoted_user_name + '\'' +
", quoted_user_screen_name='" + quoted_user_screen_name + '\'' + ", quoted_user_screen_name='" + quoted_user_screen_name + '\'' +
", quoted_user_profile_image='" + quoted_user_profile_image + '\'' + ", quoted_user_profile_image='" + quoted_user_profile_image + '\'' +
", quoted_location=" + quoted_location +
", quoted_place_full_name='" + quoted_place_full_name + '\'' +
", location=" + location + ", location=" + location +
", place_full_name='" + place_full_name + '\'' + ", place_full_name='" + place_full_name + '\'' +
", mentions=" + Arrays.toString(mentions) + ", mentions=" + Arrays.toString(mentions) +
@ -469,7 +460,8 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
", quoted_user_nickname='" + quoted_user_nickname + '\'' + ", quoted_user_nickname='" + quoted_user_nickname + '\'' +
", retweet_user_nickname='" + retweet_user_nickname + '\'' + ", retweet_user_nickname='" + retweet_user_nickname + '\'' +
", in_reply_to_user_nickname='" + in_reply_to_user_nickname + '\'' + ", in_reply_to_user_nickname='" + in_reply_to_user_nickname + '\'' +
", _id=" + _id + ", inserted_date=" + inserted_date +
", is_pinned_status=" + is_pinned_status +
'}'; '}';
} }
@ -481,8 +473,6 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
@OnJsonParseComplete @OnJsonParseComplete
void onParseComplete() throws IOException { void onParseComplete() throws IOException {
if (is_quote && TextUtils.isEmpty(quoted_text_unescaped))
throw new IOException("Incompatible model");
fixSortId(); fixSortId();
} }

View File

@ -34,7 +34,7 @@ import static org.mariotaku.twidere.annotation.PreferenceType.STRING;
public interface Constants extends TwidereConstants { public interface Constants extends TwidereConstants {
String DATABASES_NAME = "twidere.sqlite"; String DATABASES_NAME = "twidere.sqlite";
int DATABASES_VERSION = 152; int DATABASES_VERSION = 153;
int MENU_GROUP_STATUS_EXTENSION = 10; int MENU_GROUP_STATUS_EXTENSION = 10;
int MENU_GROUP_COMPOSE_EXTENSION = 11; int MENU_GROUP_COMPOSE_EXTENSION = 11;

View File

@ -91,13 +91,16 @@ public class CardMediaContainer extends ViewGroup implements Constants {
public void displayMedia(@Nullable final ParcelableMedia[] mediaArray, public void displayMedia(@Nullable final ParcelableMedia[] mediaArray,
@NonNull final MediaLoaderWrapper loader, @NonNull final MediaLoaderWrapper loader,
final UserKey accountId, final long extraId, final UserKey accountId, final long extraId,
final OnMediaClickListener mediaClickListener, @Nullable final OnMediaClickListener mediaClickListener,
final MediaLoadingHandler loadingHandler) { @Nullable final MediaLoadingHandler loadingHandler) {
displayMedia(loader, mediaClickListener, loadingHandler, mediaArray, accountId, extraId, false); displayMedia(loader, mediaArray, accountId, mediaClickListener, loadingHandler, extraId, false);
} }
public void displayMedia(@NonNull final MediaLoaderWrapper loader, final OnMediaClickListener mediaClickListener, final MediaLoadingHandler loadingHandler, @Nullable final ParcelableMedia[] mediaArray, public void displayMedia(@NonNull final MediaLoaderWrapper loader,
final UserKey accountId, final long extraId, boolean withCredentials) { @Nullable final ParcelableMedia[] mediaArray, final UserKey accountId,
@Nullable final OnMediaClickListener mediaClickListener,
@Nullable final MediaLoadingHandler loadingHandler,
final long extraId, boolean withCredentials) {
if (mediaArray == null || mMediaPreviewStyle == VALUE_MEDIA_PREVIEW_STYLE_CODE_NONE) { if (mediaArray == null || mMediaPreviewStyle == VALUE_MEDIA_PREVIEW_STYLE_CODE_NONE) {
for (int i = 0, j = getChildCount(); i < j; i++) { for (int i = 0, j = getChildCount(); i < j; i++) {
final View child = getChildAt(i); final View child = getChildAt(i);
@ -110,7 +113,9 @@ public class CardMediaContainer extends ViewGroup implements Constants {
accountId, extraId); accountId, extraId);
for (int i = 0, j = getChildCount(), k = mediaArray.length; i < j; i++) { for (int i = 0, j = getChildCount(), k = mediaArray.length; i < j; i++) {
final View child = getChildAt(i); final View child = getChildAt(i);
child.setOnClickListener(clickListener); if (mediaClickListener != null) {
child.setOnClickListener(clickListener);
}
final ImageView imageView = (ImageView) child.findViewById(R.id.mediaPreview); final ImageView imageView = (ImageView) child.findViewById(R.id.mediaPreview);
switch (mMediaPreviewStyle) { switch (mMediaPreviewStyle) {
case VALUE_MEDIA_PREVIEW_STYLE_CODE_CROP: { case VALUE_MEDIA_PREVIEW_STYLE_CODE_CROP: {
@ -170,9 +175,9 @@ public class CardMediaContainer extends ViewGroup implements Constants {
} }
} }
private void measure1Media(int contentWidth, int[] childIndices) { private void measure1Media(int contentWidth, int[] childIndices, float ratioMultiplier) {
final View child = getChildAt(childIndices[0]); final View child = getChildAt(childIndices[0]);
final int childHeight = Math.round(contentWidth * WIDTH_HEIGHT_RATIO); final int childHeight = Math.round(contentWidth * WIDTH_HEIGHT_RATIO * ratioMultiplier);
final int widthSpec = MeasureSpec.makeMeasureSpec(contentWidth, MeasureSpec.EXACTLY); final int widthSpec = MeasureSpec.makeMeasureSpec(contentWidth, MeasureSpec.EXACTLY);
final int heightSpec = MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY); final int heightSpec = MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY);
child.measure(widthSpec, heightSpec); child.measure(widthSpec, heightSpec);
@ -219,16 +224,17 @@ public class CardMediaContainer extends ViewGroup implements Constants {
} }
} }
private void measure3Media(int contentWidth, int horizontalSpacing, int[] childIndices) { private void measure3Media(int contentWidth, int horizontalSpacing, int[] childIndices, float ratioMultiplier) {
final View child0 = getChildAt(childIndices[0]), child1 = getChildAt(childIndices[1]), final View child0 = getChildAt(childIndices[0]), child1 = getChildAt(childIndices[1]),
child2 = getChildAt(childIndices[2]); child2 = getChildAt(childIndices[2]);
final int childWidth = (contentWidth - horizontalSpacing) / 2; final int childWidth = (contentWidth - horizontalSpacing) / 2;
final int sizeSpec = MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY); final int childLeftHeightSpec = MeasureSpec.makeMeasureSpec(Math.round(childWidth * ratioMultiplier), MeasureSpec.EXACTLY);
child0.measure(sizeSpec, sizeSpec); final int widthSpec = MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY);
final int childRightHeight = Math.round(childWidth - horizontalSpacing) / 2; child0.measure(widthSpec, childLeftHeightSpec);
final int heightSpec = MeasureSpec.makeMeasureSpec(childRightHeight, MeasureSpec.EXACTLY); final int childRightHeight = Math.round((childWidth - horizontalSpacing) / 2 * ratioMultiplier);
child1.measure(sizeSpec, heightSpec); final int childRightHeightSpec = MeasureSpec.makeMeasureSpec(childRightHeight, MeasureSpec.EXACTLY);
child2.measure(sizeSpec, heightSpec); child1.measure(widthSpec, childRightHeightSpec);
child2.measure(widthSpec, childRightHeightSpec);
} }
private void layout3Media(int horizontalSpacing, int verticalSpacing, int[] childIndices) { private void layout3Media(int horizontalSpacing, int verticalSpacing, int[] childIndices) {
@ -248,23 +254,33 @@ public class CardMediaContainer extends ViewGroup implements Constants {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int measuredWidth = resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec); final int measuredWidth = resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec);
final int contentWidth = measuredWidth - getPaddingLeft() - getPaddingRight(); final int contentWidth = measuredWidth - getPaddingLeft() - getPaddingRight();
float ratioMultiplier = 1;
int contentHeight = -1;
if (getLayoutParams().height != LayoutParams.WRAP_CONTENT) {
final int measuredHeight = resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec);
ratioMultiplier = contentWidth > 0 ? measuredHeight / (contentWidth * WIDTH_HEIGHT_RATIO) : 1;
contentHeight = contentWidth;
}
final int[] childIndices = createChildIndices(); final int[] childIndices = createChildIndices();
final int childCount = getChildIndicesInLayout(this, childIndices); final int childCount = getChildIndicesInLayout(this, childIndices);
int heightSum = 0; int heightSum = 0;
if (childCount > 0) { if (childCount > 0) {
if (childCount == 1) { if (childCount == 1) {
measure1Media(contentWidth, childIndices); measure1Media(contentWidth, childIndices, ratioMultiplier);
heightSum = Math.round(contentWidth * WIDTH_HEIGHT_RATIO); heightSum = Math.round(contentWidth * WIDTH_HEIGHT_RATIO * ratioMultiplier);
} else if (childCount == 2) { } else if (childCount == 2) {
measureGridMedia(childCount, 2, contentWidth, 1, mHorizontalSpacing, mVerticalSpacing, measureGridMedia(childCount, 2, contentWidth, ratioMultiplier, mHorizontalSpacing,
childIndices); mVerticalSpacing, childIndices);
heightSum = Math.round(contentWidth * WIDTH_HEIGHT_RATIO); heightSum = Math.round(contentWidth * WIDTH_HEIGHT_RATIO * ratioMultiplier);
} else if (childCount == 3) { } else if (childCount == 3) {
measure3Media(contentWidth, mHorizontalSpacing, childIndices); measure3Media(contentWidth, mHorizontalSpacing, childIndices, ratioMultiplier);
heightSum = Math.round(contentWidth * WIDTH_HEIGHT_RATIO); heightSum = Math.round(contentWidth * WIDTH_HEIGHT_RATIO * ratioMultiplier);
} else { } else {
heightSum = measureGridMedia(childCount, 2, contentWidth, WIDTH_HEIGHT_RATIO, heightSum = measureGridMedia(childCount, 2, contentWidth,
mHorizontalSpacing, mVerticalSpacing, childIndices); WIDTH_HEIGHT_RATIO * ratioMultiplier, mHorizontalSpacing, mVerticalSpacing, childIndices);
}
if (contentHeight > 0) {
heightSum = contentHeight;
} }
} }
final int height = heightSum + getPaddingTop() + getPaddingBottom(); final int height = heightSum + getPaddingTop() + getPaddingBottom();
@ -298,7 +314,7 @@ public class CardMediaContainer extends ViewGroup implements Constants {
private final UserKey mAccountKey; private final UserKey mAccountKey;
private final long mExtraId; private final long mExtraId;
ImageGridClickListener(final OnMediaClickListener listener, final UserKey accountKey, ImageGridClickListener(@Nullable final OnMediaClickListener listener, final UserKey accountKey,
final long extraId) { final long extraId) {
mListenerRef = new WeakReference<>(listener); mListenerRef = new WeakReference<>(listener);
mAccountKey = accountKey; mAccountKey = accountKey;

View File

@ -103,7 +103,7 @@ public class MessageViewHolder extends ViewHolder {
textView.setText(text); textView.setText(text);
time.setText(Utils.formatToLongTimeString(context, timestamp)); time.setText(Utils.formatToLongTimeString(context, timestamp));
mediaContainer.setVisibility(media != null && media.length > 0 ? View.VISIBLE : View.GONE); mediaContainer.setVisibility(media != null && media.length > 0 ? View.VISIBLE : View.GONE);
mediaContainer.displayMedia(loader, adapter.getOnMediaClickListener(), adapter.getMediaLoadingHandler(), media, accountKey, getLayoutPosition(), true mediaContainer.displayMedia(loader, media, accountKey, adapter.getOnMediaClickListener(), adapter.getMediaLoadingHandler(), getLayoutPosition(), true
); );
} }

View File

@ -366,12 +366,15 @@ class ParcelableActivitiesAdapter(
init { init {
text1 = itemView.findViewById(android.R.id.text1) as TextView text1 = itemView.findViewById(android.R.id.text1) as TextView
text2 = itemView.findViewById(android.R.id.text2) as TextView text2 = itemView.findViewById(android.R.id.text2) as TextView
text2.setSingleLine(false)
} }
fun displayActivity(activity: ParcelableActivity) { fun displayActivity(activity: ParcelableActivity) {
text1.text = text1.resources.getString(R.string.unsupported_activity_action_title, text1.text = text1.resources.getString(R.string.unsupported_activity_action_title,
activity.action) activity.action)
text2.setText(R.string.unsupported_activity_action_summary) text2.text = "host: ${activity.account_key.host}, id: ${activity.status_id}\n"
text2.append(itemView.context.getString(R.string.unsupported_activity_action_summary))
} }
} }

View File

@ -45,6 +45,7 @@ import org.mariotaku.twidere.TwidereConstants
import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter
import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.Companion.ITEM_VIEW_TYPE_GAP import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.Companion.ITEM_VIEW_TYPE_GAP
import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.Companion.ITEM_VIEW_TYPE_STATUS import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.Companion.ITEM_VIEW_TYPE_STATUS
import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.Companion.ITEM_VIEW_TYPE_STUB
import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.Companion.ITEM_VIEW_TYPE_TITLE_SUMMARY import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.Companion.ITEM_VIEW_TYPE_TITLE_SUMMARY
import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
@ -553,7 +554,8 @@ abstract class AbsActivitiesFragment protected constructor() : AbsContentListRec
(recyclerView.layoutManager as LinearLayoutManager).orientation) { (recyclerView.layoutManager as LinearLayoutManager).orientation) {
override fun isDividerEnabled(childPos: Int): Boolean { override fun isDividerEnabled(childPos: Int): Boolean {
when (adapter.getItemViewType(childPos)) { when (adapter.getItemViewType(childPos)) {
ITEM_VIEW_TYPE_STATUS, ITEM_VIEW_TYPE_TITLE_SUMMARY, ITEM_VIEW_TYPE_GAP -> { ITEM_VIEW_TYPE_STATUS, ITEM_VIEW_TYPE_TITLE_SUMMARY, ITEM_VIEW_TYPE_GAP,
ITEM_VIEW_TYPE_STUB -> {
return true return true
} }
else -> { else -> {

View File

@ -776,13 +776,11 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
val skipLinksInText = status.extras != null && status.extras.support_entities val skipLinksInText = status.extras != null && status.extras.support_entities
if (status.is_quote) { if (status.is_quote) {
itemView.quoteIndicator.visibility = View.VISIBLE itemView.quotedView.visibility = View.VISIBLE
val originalIdAvailable = !TextUtils.isEmpty(status.quoted_id) val originalIdAvailable = !TextUtils.isEmpty(status.quoted_id)
val quoteContentAvailable = status.quoted_text_plain != null && status.quoted_text_unescaped != null val quoteContentAvailable = status.quoted_text_plain != null && status.quoted_text_unescaped != null
itemView.quoteOriginalLink.visibility = if (originalIdAvailable) View.VISIBLE else View.GONE
if (quoteContentAvailable) { if (quoteContentAvailable) {
itemView.quotedName.visibility = View.VISIBLE itemView.quotedName.visibility = View.VISIBLE
itemView.quotedText.visibility = View.VISIBLE itemView.quotedText.visibility = View.VISIBLE
@ -815,9 +813,28 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
} }
itemView.quoteIndicator.color = status.quoted_user_color itemView.quoteIndicator.color = status.quoted_user_color
val quotedMedia = status.quoted_media
if (quotedMedia?.isEmpty() ?: true) {
itemView.quotedMediaPreviewContainer.visibility = View.GONE
itemView.quotedMediaPreview.visibility = View.GONE
itemView.quotedMediaPreviewPlaceholder.visibility = View.GONE
} else if (adapter.isDetailMediaExpanded) {
itemView.quotedMediaPreviewContainer.visibility = View.VISIBLE
itemView.quotedMediaPreview.visibility = View.VISIBLE
itemView.quotedMediaPreviewPlaceholder.visibility = View.GONE
itemView.quotedMediaPreview.displayMedia(quotedMedia, loader, status.account_key, -1,
adapter.fragment, null)
} else {
itemView.quotedMediaPreviewContainer.visibility = View.VISIBLE
itemView.quotedMediaPreview.visibility = View.GONE
itemView.quotedMediaPreviewPlaceholder.visibility = View.VISIBLE
}
} else { } else {
itemView.quotedName.visibility = View.GONE itemView.quotedName.visibility = View.GONE
itemView.quotedText.visibility = View.VISIBLE itemView.quotedText.visibility = View.VISIBLE
itemView.quotedMediaPreviewContainer.visibility = View.GONE
// Not available // Not available
val string = SpannableString.valueOf(context.getString(R.string.status_not_available_text)) val string = SpannableString.valueOf(context.getString(R.string.status_not_available_text))
@ -829,10 +846,7 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
itemView.quoteIndicator.color = 0 itemView.quoteIndicator.color = 0
} }
} else { } else {
itemView.quoteOriginalLink.visibility = View.GONE itemView.quotedView.visibility = View.GONE
itemView.quotedName.visibility = View.GONE
itemView.quotedText.visibility = View.GONE
itemView.quoteIndicator.visibility = View.GONE
} }
itemView.profileContainer.drawStart(status.user_color) itemView.profileContainer.drawStart(status.user_color)
@ -949,26 +963,6 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
itemView.mediaPreview.displayMedia() itemView.mediaPreview.displayMedia()
} }
val quotedMedia = status.quoted_media
if (quotedMedia?.isEmpty() ?: true) {
itemView.quotedMediaPreviewContainer.visibility = View.GONE
itemView.quotedMediaPreview.visibility = View.GONE
itemView.quotedMediaPreviewLoad.visibility = View.GONE
itemView.quotedMediaPreview.displayMedia()
} else if (adapter.isDetailMediaExpanded) {
itemView.quotedMediaPreviewContainer.visibility = View.VISIBLE
itemView.quotedMediaPreview.visibility = View.VISIBLE
itemView.quotedMediaPreviewLoad.visibility = View.GONE
itemView.quotedMediaPreview.displayMedia(media, loader, status.account_key, -1,
adapter.fragment, adapter.mediaLoadingHandler)
} else {
itemView.quotedMediaPreviewContainer.visibility = View.VISIBLE
itemView.quotedMediaPreview.visibility = View.GONE
itemView.quotedMediaPreviewLoad.visibility = View.VISIBLE
itemView.quotedMediaPreview.displayMedia()
}
if (TwitterCardUtils.isCardSupported(status)) { if (TwitterCardUtils.isCardSupported(status)) {
val size = TwitterCardUtils.getCardSize(status.card!!) val size = TwitterCardUtils.getCardSize(status.card!!)
itemView.twitterCard.visibility = View.VISIBLE itemView.twitterCard.visibility = View.VISIBLE
@ -1013,11 +1007,9 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
} }
itemView.text.setTextIsSelectable(true) itemView.text.setTextIsSelectable(true)
itemView.quotedText.setTextIsSelectable(true)
itemView.translateResult.setTextIsSelectable(true) itemView.translateResult.setTextIsSelectable(true)
itemView.text.movementMethod = LinkMovementMethod.getInstance() itemView.text.movementMethod = LinkMovementMethod.getInstance()
itemView.quotedText.movementMethod = LinkMovementMethod.getInstance()
} }
override fun onClick(v: View) { override fun onClick(v: View) {
@ -1052,12 +1044,7 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
if (!ParcelableLocationUtils.isValidLocation(location)) return if (!ParcelableLocationUtils.isValidLocation(location)) return
IntentUtils.openMap(adapter.context, location.latitude, location.longitude) IntentUtils.openMap(adapter.context, location.latitude, location.longitude)
} }
itemView.quotedName -> { itemView.quotedView -> {
IntentUtils.openUserProfile(adapter.context, status.account_key,
status.quoted_user_key, status.quoted_user_screen_name, null,
preferences.getBoolean(KEY_NEW_DOCUMENT_API), Referral.STATUS)
}
itemView.quoteOriginalLink -> {
IntentUtils.openStatus(adapter.context, status.account_key, status.quoted_id) IntentUtils.openStatus(adapter.context, status.account_key, status.quoted_id)
} }
itemView.translateLabel -> { itemView.translateLabel -> {
@ -1107,10 +1094,9 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
ThemeUtils.wrapMenuIcon(itemView.menuBar, MENU_GROUP_STATUS_SHARE) ThemeUtils.wrapMenuIcon(itemView.menuBar, MENU_GROUP_STATUS_SHARE)
itemView.mediaPreviewLoad.setOnClickListener(this) itemView.mediaPreviewLoad.setOnClickListener(this)
itemView.profileContainer.setOnClickListener(this) itemView.profileContainer.setOnClickListener(this)
itemView.quotedName.setOnClickListener(this)
retweetedByView.setOnClickListener(this) retweetedByView.setOnClickListener(this)
locationView.setOnClickListener(this) locationView.setOnClickListener(this)
itemView.quoteOriginalLink.setOnClickListener(this) itemView.quotedView.setOnClickListener(this)
itemView.translateLabel.setOnClickListener(this) itemView.translateLabel.setOnClickListener(this)
val textSize = adapter.textSize val textSize = adapter.textSize
@ -1122,7 +1108,6 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
itemView.quotedName.setSecondaryTextSize(textSize * 0.85f) itemView.quotedName.setSecondaryTextSize(textSize * 0.85f)
itemView.quotedText.textSize = textSize * 1.25f itemView.quotedText.textSize = textSize * 1.25f
itemView.quoteOriginalLink.textSize = textSize * 0.85f
locationView.textSize = textSize * 0.85f locationView.textSize = textSize * 0.85f
itemView.timeSource.textSize = textSize * 0.85f itemView.timeSource.textSize = textSize * 0.85f
itemView.translateLabel.textSize = textSize * 0.85f itemView.translateLabel.textSize = textSize * 0.85f
@ -1135,8 +1120,8 @@ class StatusFragment : BaseSupportFragment(), LoaderCallbacks<SingleResponse<Par
itemView.quotedName.setNameFirst(adapter.nameFirst) itemView.quotedName.setNameFirst(adapter.nameFirst)
itemView.mediaPreview.setStyle(adapter.mediaPreviewStyle) itemView.mediaPreview.setStyle(adapter.mediaPreviewStyle)
itemView.quotedMediaPreview.setStyle(adapter.mediaPreviewStyle)
itemView.quotedText.customSelectionActionModeCallback = StatusActionModeCallback(itemView.quotedText, activity)
itemView.text.customSelectionActionModeCallback = StatusActionModeCallback(itemView.text, activity) itemView.text.customSelectionActionModeCallback = StatusActionModeCallback(itemView.text, activity)
val layoutManager = LinearLayoutManager(adapter.context) val layoutManager = LinearLayoutManager(adapter.context)

View File

@ -90,8 +90,6 @@ object ParcelableStatusUtils {
result.quoted_timestamp = quoted.createdAt.time result.quoted_timestamp = quoted.createdAt.time
result.quoted_source = quoted.source result.quoted_source = quoted.source
result.quoted_media = ParcelableMediaUtils.fromStatus(quoted) result.quoted_media = ParcelableMediaUtils.fromStatus(quoted)
result.quoted_location = getLocation(quoted)
result.quoted_place_full_name = getPlaceFullName(quoted)
result.quoted_user_key = UserKeyUtils.fromUser(quotedUser) result.quoted_user_key = UserKeyUtils.fromUser(quotedUser)
result.quoted_user_name = quotedUser.name result.quoted_user_name = quotedUser.name

View File

@ -257,143 +257,101 @@
android:layout_below="@+id/mediaPreviewContainer" android:layout_below="@+id/mediaPreviewContainer"
android:visibility="gone"/> android:visibility="gone"/>
<org.mariotaku.twidere.view.ForegroundColorView <LinearLayout
android:id="@+id/quoteIndicator" android:id="@+id/quotedView"
android:layout_width="@dimen/element_spacing_small"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/quoteIndicatorAnchorBottom"
android:layout_alignTop="@+id/quoteIndicatorAnchorTop"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_marginStart="@dimen/element_spacing_normal"
android:background="?quoteIndicatorBackgroundColor"
android:visibility="gone"
tools:visibility="visible"/>
<android.support.v4.widget.Space
android:id="@+id/quoteIndicatorAnchorTop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="wrap_content"
android:layout_below="@+id/twitterCard" android:layout_below="@+id/twitterCard"
android:layout_marginTop="@dimen/element_spacing_normal"
android:visibility="visible"/>
<org.mariotaku.twidere.view.NameView
android:id="@+id/quotedName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/quoteIndicatorAnchorTop"
android:layout_toEndOf="@+id/quoteIndicator"
android:layout_toRightOf="@+id/quoteIndicator"
android:background="?selectableItemBackground" android:background="?selectableItemBackground"
android:clickable="true" android:orientation="horizontal">
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:tag="font_family|user"
android:visibility="gone"
app:nv_primaryTextColor="?android:textColorPrimary"
app:nv_secondaryTextColor="?android:textColorSecondary"
app:nv_twoLine="false"
tools:visibility="visible"/>
<org.mariotaku.twidere.view.TimelineContentTextView <org.mariotaku.twidere.view.ForegroundColorView
android:id="@+id/quotedText" android:id="@+id/quoteIndicator"
android:layout_width="match_parent" android:layout_width="@dimen/element_spacing_small"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_below="@+id/quotedName" android:layout_weight="0"
android:layout_margin="@dimen/element_spacing_normal" android:background="?quoteIndicatorBackgroundColor"/>
android:layout_toEndOf="@+id/quoteIndicator"
android:layout_toRightOf="@+id/quoteIndicator"
android:singleLine="false"
android:tag="font_family|user"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="?android:textColorPrimary"
android:visibility="gone"
tools:text="@string/sample_status_text"
tools:visibility="visible"/>
<FrameLayout <FrameLayout
android:id="@+id/quotedMediaPreviewContainer" android:id="@+id/quotedMediaPreviewContainer"
android:layout_width="match_parent" android:layout_width="128dp"
android:layout_height="wrap_content" android:layout_height="128dp"
android:layout_below="@+id/quotedText" android:layout_gravity="center_vertical"
android:layout_toEndOf="@+id/quoteIndicator" android:layout_marginBottom="@dimen/element_spacing_normal"
android:layout_toRightOf="@+id/quoteIndicator" android:layout_marginLeft="@dimen/element_spacing_normal"
tools:visibility="visible"> android:layout_marginStart="@dimen/element_spacing_normal"
android:layout_marginTop="@dimen/element_spacing_normal"
<org.mariotaku.twidere.view.CardMediaContainer android:layout_weight="0"
android:id="@+id/quotedMediaPreview"
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"
tools:ignore="DuplicateIncludedIds"/>
</org.mariotaku.twidere.view.CardMediaContainer>
<LinearLayout
android:id="@+id/quotedMediaPreviewLoad"
android:layout_width="match_parent"
android:layout_height="@dimen/action_button_size"
android:layout_gravity="center"
android:background="?selectableItemBackground"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible"> tools:visibility="visible">
<org.mariotaku.twidere.view.ActionIconThemedTextView <org.mariotaku.twidere.view.CardMediaContainer
android:layout_width="wrap_content" android:id="@+id/quotedMediaPreview"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:drawableLeft="@drawable/ic_action_gallery" android:horizontalSpacing="@dimen/element_spacing_xsmall"
android:drawableStart="@drawable/ic_action_gallery" android:verticalSpacing="@dimen/element_spacing_xsmall"
android:visibility="gone"
tools:visibility="visible">
<include
layout="@layout/layout_card_media_preview"
tools:ignore="DuplicateIncludedIds"/>
</org.mariotaku.twidere.view.CardMediaContainer>
<View
android:id="@+id/quotedMediaPreviewPlaceholder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/element_spacing_normal"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_marginStart="@dimen/element_spacing_normal"
android:layout_marginTop="@dimen/element_spacing_normal"
android:layout_weight="1"
android:orientation="vertical">
<org.mariotaku.twidere.view.NameView
android:id="@+id/quotedName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:tag="font_family|user" android:tag="font_family|user"
android:text="@string/load_media" android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceMedium" app:nv_primaryTextColor="?android:textColorPrimary"
android:textStyle="bold"/> app:nv_secondaryTextColor="?android:textColorSecondary"
app:nv_twoLine="false"
tools:visibility="visible"/>
<org.mariotaku.twidere.view.TimelineContentTextView
android:id="@+id/quotedText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/element_spacing_normal"
android:singleLine="false"
android:tag="font_family|user"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="?android:textColorPrimary"
android:visibility="gone"
tools:text="@string/sample_status_text"
tools:visibility="visible"/>
</LinearLayout> </LinearLayout>
</FrameLayout> </LinearLayout>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/quoteOriginalLink"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/quotedMediaPreviewContainer"
android:layout_toEndOf="@+id/quoteIndicator"
android:layout_toRightOf="@+id/quoteIndicator"
android:background="?selectableItemBackground"
android:drawableLeft="@drawable/ic_indicator_twitter"
android:drawablePadding="4dp"
android:drawableStart="@drawable/ic_indicator_twitter"
android:gravity="center_vertical"
android:padding="@dimen/element_spacing_normal"
android:singleLine="true"
android:tag="font_family|user"
android:text="@string/original_status"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:textColorSecondary"/>
<android.support.v4.widget.Space
android:id="@+id/quoteIndicatorAnchorBottom"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@+id/quoteOriginalLink"
android:visibility="visible"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView <org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/locationView" android:id="@+id/locationView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/quoteIndicatorAnchorBottom" android:layout_below="@+id/quotedView"
android:background="?selectableItemBackground" android:background="?selectableItemBackground"
android:drawableLeft="@drawable/ic_indicator_location" android:drawableLeft="@drawable/ic_indicator_location"
android:drawablePadding="4dp" android:drawablePadding="4dp"

View File

@ -21,8 +21,6 @@
<merge <merge
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:showIn="@layout/list_item_status"> tools:showIn="@layout/list_item_status">
<com.commonsware.cwac.layouts.AspectLockedFrameLayout <com.commonsware.cwac.layouts.AspectLockedFrameLayout