improved retweet/favorite feature

This commit is contained in:
Mariotaku Lee 2014-12-11 13:40:08 +08:00
parent c5c40c2f67
commit a07fbf3102
24 changed files with 215 additions and 125 deletions

View File

@ -51,7 +51,7 @@ public class DraftsAdapter extends SimpleCursorAdapter {
public DraftsAdapter(final Context context) {
super(context, R.layout.card_item_draft, null, new String[0], new int[0], 0);
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
mImageLoadingHandler = new ImageLoadingHandler(R.id.image_preview_progress);
mImageLoadingHandler = new ImageLoadingHandler(R.id.media_preview_progress);
}
@Override

View File

@ -57,10 +57,10 @@ public class MediaPreviewAdapter extends ArrayAdapter<String> implements Constan
public View getView(final int position, final View convertView, final ViewGroup parent) {
final View view = super.getView(position, convertView, parent);
final String link = getItem(position);
final ImageView image_view = (ImageView) view.findViewById(R.id.image_preview_item);
final ImageView image_view = (ImageView) view.findViewById(R.id.media_preview_item);
image_view.setTag(link);
if (mIsPossiblySensitive && !mPreferences.getBoolean(KEY_DISPLAY_SENSITIVE_CONTENTS, false)) {
view.findViewById(R.id.image_preview_progress).setVisibility(View.GONE);
view.findViewById(R.id.media_preview_progress).setVisibility(View.GONE);
image_view.setBackgroundResource(R.drawable.image_preview_nsfw);
mImageLoader.cancelDisplayTask(image_view);
} else if (!link.equals(mImageLoadingHandler.getLoadingUri(image_view))) {

View File

@ -77,7 +77,6 @@ public interface IntentConstants {
public static final String BROADCAST_FRIENDSHIP_ACCEPTED = INTENT_PACKAGE_PREFIX + "FRIENDSHIP_ACCEPTED";
public static final String BROADCAST_FRIENDSHIP_DENIED = INTENT_PACKAGE_PREFIX + "FRIENDSHIP_DENIED";
public static final String BROADCAST_STATUS_RETWEETED = INTENT_PACKAGE_PREFIX + "STATUS_RETWEETED";
public static final String BROADCAST_USER_LIST_MEMBERS_DELETED = INTENT_PACKAGE_PREFIX + "USER_LIST_MEMBER_DELETED";
public static final String BROADCAST_USER_LIST_MEMBERS_ADDED = INTENT_PACKAGE_PREFIX + "USER_LIST_MEMBER_ADDED";
public static final String BROADCAST_USER_LIST_SUBSCRIBED = INTENT_PACKAGE_PREFIX + "USER_LIST_SUBSRCIBED";

View File

@ -59,7 +59,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.mariotaku.twidere.util.Utils.cancelRetweet;
import static org.mariotaku.twidere.util.Utils.clearListViewChoices;
import static org.mariotaku.twidere.util.Utils.configBaseCardAdapter;
import static org.mariotaku.twidere.util.Utils.isMyRetweet;
@ -302,10 +301,9 @@ abstract class BaseStatusesListFragment<Data> extends BasePullToRefreshListFragm
}
case MENU_RETWEET: {
if (isMyRetweet(status)) {
cancelRetweet(twitter, status);
twitter.cancelRetweetAsync(status.account_id, status.id, status.my_retweet_id);
} else {
final long id_to_retweet = status.retweet_id > 0 ? status.retweet_id : status.id;
twitter.retweetStatusAsync(status.account_id, id_to_retweet);
twitter.retweetStatusAsync(status.account_id, status.id);
}
break;
}

View File

@ -32,6 +32,7 @@ import org.mariotaku.twidere.model.ParcelableStatus;
import org.mariotaku.twidere.util.message.FavoriteCreatedEvent;
import org.mariotaku.twidere.util.message.FavoriteDestroyedEvent;
import org.mariotaku.twidere.util.message.StatusDestroyedEvent;
import org.mariotaku.twidere.util.message.StatusRetweetedEvent;
import java.util.HashSet;
import java.util.List;
@ -52,9 +53,12 @@ public abstract class ParcelableStatusesFragment extends AbsStatusesFragment<Lis
final List<ParcelableStatus> data = getAdapterData();
if (statusId <= 0 || data == null) return;
final Set<ParcelableStatus> dataToRemove = new HashSet<>();
for (final ParcelableStatus status : data) {
for (int i = 0, j = data.size(); i < j; i++) {
final ParcelableStatus status = data.get(i);
if (status.id == statusId || status.retweet_id > 0 && status.retweet_id == statusId) {
dataToRemove.add(status);
} else if (status.my_retweet_id == statusId) {
data.set(i, new ParcelableStatus(status, -1));
}
}
data.removeAll(dataToRemove);
@ -164,6 +168,11 @@ public abstract class ParcelableStatusesFragment extends AbsStatusesFragment<Lis
fragment.updateFavoritedStatus(event.status);
}
@Subscribe
public void notifyStatusRetweeted(StatusRetweetedEvent event) {
fragment.updateRetweetedStatuses(event.status);
}
@Subscribe
public void notifyFavoriteDestroyed(FavoriteDestroyedEvent event) {
fragment.updateFavoritedStatus(event.status);
@ -176,4 +185,16 @@ public abstract class ParcelableStatusesFragment extends AbsStatusesFragment<Lis
}
private void updateRetweetedStatuses(ParcelableStatus status) {
final List<ParcelableStatus> data = getAdapterData();
if (status == null || status.retweet_id <= 0 || data == null) return;
for (int i = 0, j = data.size(); i < j; i++) {
final ParcelableStatus orig = data.get(i);
if (orig.account_id == status.account_id && orig.id == status.retweet_id) {
data.set(i, new ParcelableStatus(orig, status.id));
}
}
setAdapterData(data);
}
}

View File

@ -22,7 +22,6 @@ package org.mariotaku.twidere.fragment.support;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.LoaderManager;
@ -53,19 +52,23 @@ public abstract class ParcelableStatusesListFragment extends BaseStatusesListFra
public void onReceive(final Context context, final Intent intent) {
if (getActivity() == null || !isAdded() || isDetached()) return;
final String action = intent.getAction();
if (BROADCAST_STATUS_RETWEETED.equals(action)) {
final long status_id = intent.getLongExtra(EXTRA_STATUS_ID, -1);
final boolean retweeted = intent.getBooleanExtra(EXTRA_RETWEETED, false);
if (status_id > 0 && !retweeted) {
deleteStatus(status_id);
switch (action) {
// case BROADCAST_STATUS_RETWEETED: {
// final long status_id = intent.getLongExtra(EXTRA_STATUS_ID, -1);
// final boolean retweeted = intent.getBooleanExtra(EXTRA_RETWEETED, false);
// if (status_id > 0 && !retweeted) {
// deleteStatus(status_id);
// }
// break;
// }
case BROADCAST_MULTI_MUTESTATE_CHANGED: {
final Bundle args = getArguments();
final long account_id = args != null ? args.getLong(EXTRA_ACCOUNT_ID, -1) : -1;
if (account_id <= 0) return;
getStatuses(new long[]{account_id}, null, null);
break;
}
} else if (BROADCAST_MULTI_MUTESTATE_CHANGED.equals(action)) {
final Bundle args = getArguments();
final long account_id = args != null ? args.getLong(EXTRA_ACCOUNT_ID, -1) : -1;
if (account_id <= 0) return;
getStatuses(new long[]{account_id}, null, null);
}
}
};

View File

@ -54,7 +54,7 @@ public class RetweetQuoteDialogFragment extends BaseSupportDialogFragment implem
final AsyncTwitterWrapper twitter = getTwitterWrapper();
if (status == null || twitter == null) return;
if (isMyRetweet(status)) {
twitter.destroyStatusAsync(status.account_id, status.retweet_id);
twitter.cancelRetweetAsync(status.account_id, status.id, status.my_retweet_id);
} else {
twitter.retweetStatusAsync(status.account_id, status.id);
}

View File

@ -101,7 +101,6 @@ import static org.mariotaku.twidere.util.UserColorNicknameUtils.clearUserNicknam
import static org.mariotaku.twidere.util.UserColorNicknameUtils.getUserColor;
import static org.mariotaku.twidere.util.UserColorNicknameUtils.getUserNickname;
import static org.mariotaku.twidere.util.UserColorNicknameUtils.setUserColor;
import static org.mariotaku.twidere.util.Utils.cancelRetweet;
import static org.mariotaku.twidere.util.Utils.findStatus;
import static org.mariotaku.twidere.util.Utils.formatToLongTimeString;
import static org.mariotaku.twidere.util.Utils.getLocalizedNumber;
@ -342,6 +341,7 @@ public class StatusFragment extends BaseSupportFragment
private final StatusFragment mFragment;
private final LayoutInflater mInflater;
private final ImageLoaderWrapper mImageLoader;
private final ImageLoadingHandler mImageLoadingHandler;
private final boolean mNameFirst, mNicknameOnly;
private final int mCardLayoutResource;
@ -361,6 +361,7 @@ public class StatusFragment extends BaseSupportFragment
mContext = context;
mInflater = LayoutInflater.from(context);
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
mImageLoadingHandler = new ImageLoadingHandler(R.id.media_preview_progress);
mNameFirst = preferences.getBoolean(KEY_NAME_FIRST, true);
mNicknameOnly = preferences.getBoolean(KEY_NICKNAME_ONLY, true);
mTextSize = preferences.getInt(KEY_TEXT_SIZE, res.getInteger(R.integer.default_text_size));
@ -392,7 +393,7 @@ public class StatusFragment extends BaseSupportFragment
@Override
public ImageLoadingHandler getImageLoadingHandler() {
return null;
return mImageLoadingHandler;
}
@Override
@ -480,7 +481,9 @@ public class StatusFragment extends BaseSupportFragment
}
case VIEW_TYPE_LIST_STATUS: {
final View view = mInflater.inflate(mCardLayoutResource, parent, false);
return new StatusViewHolder(this, view);
final StatusViewHolder holder = new StatusViewHolder(this, view);
holder.setupViews();
return holder;
}
case VIEW_TYPE_CONVERSATION_LOAD_INDICATOR:
case VIEW_TYPE_REPLIES_LOAD_INDICATOR: {
@ -723,11 +726,9 @@ public class StatusFragment extends BaseSupportFragment
}
case MENU_RETWEET: {
if (isMyRetweet(status)) {
cancelRetweet(twitter, status);
twitter.cancelRetweetAsync(status.account_id, status.id, status.my_retweet_id);
} else {
final long id_to_retweet = status.is_retweet && status.retweet_id > 0 ? status.retweet_id
: status.id;
twitter.retweetStatusAsync(status.account_id, id_to_retweet);
twitter.retweetStatusAsync(status.account_id, status.id);
}
break;
}

View File

@ -27,7 +27,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.Color;
@ -114,7 +113,6 @@ import static org.mariotaku.twidere.util.UserColorNicknameUtils.clearUserNicknam
import static org.mariotaku.twidere.util.UserColorNicknameUtils.getUserColor;
import static org.mariotaku.twidere.util.UserColorNicknameUtils.getUserNickname;
import static org.mariotaku.twidere.util.UserColorNicknameUtils.setUserColor;
import static org.mariotaku.twidere.util.Utils.cancelRetweet;
import static org.mariotaku.twidere.util.Utils.findStatus;
import static org.mariotaku.twidere.util.Utils.formatToLongTimeString;
import static org.mariotaku.twidere.util.Utils.getAccountColor;
@ -195,13 +193,13 @@ public class StatusFragmentOld extends ParcelableStatusesListFragment implements
// }
// break;
// }
case BROADCAST_STATUS_RETWEETED: {
final long status_id = intent.getLongExtra(EXTRA_STATUS_ID, -1);
if (status_id > 0 && status_id == getStatusId()) {
getStatus(true);
}
break;
}
// case BROADCAST_STATUS_RETWEETED: {
// final long status_id = intent.getLongExtra(EXTRA_STATUS_ID, -1);
// if (status_id > 0 && status_id == getStatusId()) {
// getStatus(true);
// }
// break;
// }
}
}
};
@ -674,9 +672,6 @@ public class StatusFragmentOld extends ParcelableStatusesListFragment implements
@Override
public void onStart() {
super.onStart();
final IntentFilter filter = new IntentFilter();
filter.addAction(BROADCAST_STATUS_RETWEETED);
registerReceiver(mStatusReceiver, filter);
updateUserColor();
final int text_size = mPreferences.getInt(KEY_TEXT_SIZE, getDefaultTextSize(getActivity()));
mTextView.setTextSize(text_size * 1.25f);
@ -688,12 +683,6 @@ public class StatusFragmentOld extends ParcelableStatusesListFragment implements
// mRetweetView.setTextSize(text_size * 0.85f);
}
@Override
public void onStop() {
unregisterReceiver(mStatusReceiver);
super.onStop();
}
@Override
public boolean scrollToStart() {
if (mListView == null) return false;
@ -742,11 +731,9 @@ public class StatusFragmentOld extends ParcelableStatusesListFragment implements
}
case MENU_RETWEET: {
if (isMyRetweet(status)) {
cancelRetweet(mTwitterWrapper, status);
mTwitterWrapper.cancelRetweetAsync(status.account_id, status.id, status.my_retweet_id);
} else {
final long id_to_retweet = status.is_retweet && status.retweet_id > 0 ? status.retweet_id
: status.id;
mTwitterWrapper.retweetStatusAsync(status.account_id, id_to_retweet);
mTwitterWrapper.retweetStatusAsync(status.account_id, status.id);
}
break;
}

View File

@ -272,6 +272,46 @@ public class ParcelableStatus implements TwidereParcelable, Comparable<Parcelabl
first_media = media != null && media.length > 0 ? media[0].url : null;
}
public ParcelableStatus(final ParcelableStatus orig, long override_my_retweet_id) {
id = orig.id;
account_id = orig.account_id;
timestamp = orig.timestamp;
user_id = orig.user_id;
retweet_id = orig.retweet_id;
retweet_timestamp = orig.retweet_timestamp;
retweeted_by_id = orig.retweeted_by_id;
retweet_count = orig.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;
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;
text_html = orig.text_html;
text_plain = orig.text_plain;
user_name = orig.user_name;
user_screen_name = orig.user_screen_name;
in_reply_to_screen_name = orig.in_reply_to_screen_name;
source = orig.source;
user_profile_image_url = orig.user_profile_image_url;
media = orig.media;
location = orig.location;
my_retweet_id = override_my_retweet_id;
is_possibly_sensitive = orig.is_possibly_sensitive;
user_is_following = orig.user_is_following;
text_unescaped = orig.text_unescaped;
in_reply_to_user_id = orig.in_reply_to_user_id;
in_reply_to_name = orig.in_reply_to_name;
mentions = orig.mentions;
first_media = orig.first_media;
}
public ParcelableStatus(final Status orig, final long account_id, final boolean is_gap) {
this.is_gap = is_gap;
this.account_id = account_id;

View File

@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.util.LongSparseArray;
import android.util.Log;
@ -63,6 +64,7 @@ import org.mariotaku.twidere.util.message.FavoriteDestroyedEvent;
import org.mariotaku.twidere.util.message.FriendshipUpdatedEvent;
import org.mariotaku.twidere.util.message.ProfileUpdatedEvent;
import org.mariotaku.twidere.util.message.StatusDestroyedEvent;
import org.mariotaku.twidere.util.message.StatusRetweetedEvent;
import java.io.FileNotFoundException;
import java.util.ArrayList;
@ -198,6 +200,19 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
return mAsyncTaskManager.add(task, true);
}
public int cancelRetweetAsync(long account_id, long status_id, long my_retweet_id) {
if (my_retweet_id > 0)
return destroyStatusAsync(account_id, my_retweet_id);
else if (status_id > 0)
return destroyStatusAsync(account_id, status_id);
return -1;
}
public int cancelRetweetAsync(@NonNull final ParcelableStatus status) {
return cancelRetweetAsync(status.account_id, status.id, status.my_retweet_id);
}
public int destroyBlockAsync(final long accountId, final long user_id) {
final DestroyBlockTask task = new DestroyBlockTask(accountId, user_id);
return mAsyncTaskManager.add(task, true);
@ -816,7 +831,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
@Override
protected SingleResponse<ParcelableStatus> doInBackground(final Void... params) {
if (account_id < 0) return SingleResponse.getInstance();
final Twitter twitter = getTwitterInstance(mContext, account_id, false);
final Twitter twitter = getTwitterInstance(mContext, account_id, true);
if (twitter == null) return SingleResponse.getInstance();
try {
final twitter4j.Status status = twitter.createFavorite(status_id);
@ -1333,7 +1348,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
@Override
protected SingleResponse<ParcelableStatus> doInBackground(final Void... params) {
if (account_id < 0) return SingleResponse.getInstance();
final Twitter twitter = getTwitterInstance(mContext, account_id, false);
final Twitter twitter = getTwitterInstance(mContext, account_id, true);
if (twitter != null) {
try {
final twitter4j.Status status = twitter.destroyFavorite(status_id);
@ -2028,7 +2043,7 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
}
class RetweetStatusTask extends ManagedAsyncTask<Void, Void, SingleResponse<twitter4j.Status>> {
class RetweetStatusTask extends ManagedAsyncTask<Void, Void, SingleResponse<ParcelableStatus>> {
private final long account_id;
@ -2041,36 +2056,36 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
}
@Override
protected SingleResponse<twitter4j.Status> doInBackground(final Void... params) {
protected SingleResponse<ParcelableStatus> doInBackground(final Void... params) {
if (account_id < 0) return SingleResponse.getInstance();
final Twitter twitter = getTwitterInstance(mContext, account_id, false);
if (twitter != null) {
try {
final twitter4j.Status status = twitter.retweetStatus(status_id);
return SingleResponse.getInstance(status, null);
} catch (final TwitterException e) {
return SingleResponse.getInstance(null, e);
}
final Twitter twitter = getTwitterInstance(mContext, account_id, true);
if (twitter == null) {
return SingleResponse.getInstance();
}
try {
final ParcelableStatus status = new ParcelableStatus(twitter.retweetStatus(status_id),
account_id, false);
return SingleResponse.getInstance(status);
} catch (final TwitterException e) {
return SingleResponse.getInstance(e);
}
return SingleResponse.getInstance();
}
@Override
protected void onPostExecute(final SingleResponse<twitter4j.Status> result) {
if (result.hasData() && result.getData().getId() > 0) {
protected void onPostExecute(final SingleResponse<ParcelableStatus> result) {
if (result.hasData()) {
final ContentValues values = new ContentValues();
values.put(Statuses.MY_RETWEET_ID, result.getData().getId());
final String where = Statuses.STATUS_ID + " = " + status_id + " OR " + Statuses.RETWEET_ID + " = "
+ status_id;
final ParcelableStatus status = result.getData();
values.put(Statuses.MY_RETWEET_ID, status.id);
final Expression where = Expression.or(
Expression.equals(Statuses.STATUS_ID, status_id),
Expression.equals(Statuses.RETWEET_ID, status_id)
);
for (final Uri uri : STATUSES_URIS) {
mResolver.update(uri, values, where, null);
mResolver.update(uri, values, where.getSQL(), null);
}
final Intent intent = new Intent(BROADCAST_STATUS_RETWEETED);
intent.putExtra(EXTRA_STATUS_ID, status_id);
mContext.sendBroadcast(intent);
final Bus bus = TwidereApplication.getInstance(mContext).getMessageBus();
bus.post(new StatusRetweetedEvent(status));
mMessagesManager.showOkMessage(R.string.status_retweeted, false);
} else {
mMessagesManager.showErrorMessage(R.string.action_retweeting, result.getException(), true);

View File

@ -40,7 +40,7 @@ public class ImageLoadingHandler implements ImageLoadingListener, ImageLoadingPr
private final int[] mProgressBarIds;
public ImageLoadingHandler() {
this(R.id.image_preview_progress);
this(R.id.media_preview_progress);
}
public ImageLoadingHandler(final int... progressBarIds) {

View File

@ -199,7 +199,7 @@ public class MediaPreviewUtils {
if (container.getOrientation() != LinearLayout.VERTICAL)
throw new IllegalArgumentException();
final Context context = container.getContext();
final ImageLoadingHandler loadingHandler = new ImageLoadingHandler();
final ImageLoadingHandler loadingHandler = new ImageLoadingHandler(R.id.media_preview_progress);
final LayoutInflater inflater = LayoutInflater.from(context);
final ListIterator<ParcelableMedia> iterator = mediaList.listIterator();
final int imageCount = mediaList.size();
@ -218,7 +218,7 @@ public class MediaPreviewUtils {
final int columnCount = currentRow == 0 && firstColumn > 0 ? firstColumn : bestColumnCount;
for (int currentColumn = 0; currentColumn < columnCount; currentColumn++) {
final ParcelableMedia media = iterator.next();
final View item = inflater.inflate(R.layout.grid_item_image_preview, rowContainer, false);
final View item = inflater.inflate(R.layout.grid_item_media_preview, rowContainer, false);
item.setTag(media);
if (mediaClickListener != null) {
item.setOnClickListener(clickListener);
@ -226,7 +226,7 @@ public class MediaPreviewUtils {
final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) item.getLayoutParams();
lp.weight = 1.0f;
rowContainer.addView(item, lp);
final ImageView imageView = (ImageView) item.findViewById(R.id.image_preview_item);
final ImageView imageView = (ImageView) item.findViewById(R.id.media_preview_item);
loader.displayPreviewImage(imageView, media.url, loadingHandler);
}
}

View File

@ -542,15 +542,6 @@ public final class Utils implements Constants, TwitterConstants {
return Math.max(1, result);
}
public static int cancelRetweet(final AsyncTwitterWrapper wrapper, final ParcelableStatus status) {
if (wrapper == null || status == null) return -1;
if (status.my_retweet_id > 0)
return wrapper.destroyStatusAsync(status.account_id, status.my_retweet_id);
else if (status.retweeted_by_id == status.account_id)
return wrapper.destroyStatusAsync(status.account_id, status.retweet_id);
return -1;
}
public static boolean checkActivityValidity(final Context context, final Intent intent) {
final PackageManager pm = context.getPackageManager();
return !pm.queryIntentActivities(intent, 0).isEmpty();
@ -2438,9 +2429,9 @@ public final class Utils implements Constants, TwitterConstants {
return te.getMessage();
}
public static Twitter getTwitterInstance(final Context context, final long account_id,
final boolean include_entities) {
return getTwitterInstance(context, account_id, include_entities, true, !MIUIUtils.isMIUI());
public static Twitter getTwitterInstance(final Context context, final long accountId,
final boolean includeEntities) {
return getTwitterInstance(context, accountId, includeEntities, true, !MIUIUtils.isMIUI());
}
public static Twitter getTwitterInstance(final Context context, final long accountId,

View File

@ -0,0 +1,34 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.util.message;
import org.mariotaku.twidere.model.ParcelableStatus;
/**
* Created by mariotaku on 14/12/10.
*/
public class StatusRetweetedEvent {
public final ParcelableStatus status;
public StatusRetweetedEvent(ParcelableStatus status) {
this.status = status;
}
}

View File

@ -63,7 +63,7 @@ public class StatusListViewHolder extends CardViewHolder {
profile_image = (ImageView) findViewById(R.id.profile_image);
my_profile_image = (ImageView) findViewById(R.id.my_profile_image);
image_preview = (ImageView) findViewById(R.id.image_preview);
image_preview_progress = (ProgressBar) findViewById(R.id.image_preview_progress);
image_preview_progress = (ProgressBar) findViewById(R.id.media_preview_progress);
image_preview_container = (ViewGroup) findViewById(R.id.image_preview_container);
name = (TextView) findViewById(R.id.name);
screen_name = (TextView) findViewById(R.id.screen_name);

View File

@ -108,7 +108,7 @@
android:scaleType="centerCrop"/>
<ProgressBar
android:id="@+id/image_preview_progress"
android:id="@+id/media_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -112,7 +112,7 @@
android:scaleType="centerCrop"/>
<ProgressBar
android:id="@+id/image_preview_progress"
android:id="@+id/media_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -25,7 +25,7 @@
android:scaleType="centerCrop"/>
<ProgressBar
android:id="@+id/image_preview_progress"
android:id="@+id/media_preview_progress"
style="?android:progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -4,7 +4,7 @@
android:layout_height="wrap_content">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/image_preview_item"
android:id="@+id/media_preview_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
@ -13,7 +13,7 @@
android:scaleType="centerCrop"/>
<ProgressBar
android:id="@+id/image_preview_progress"
android:id="@+id/media_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.SquareRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/image_preview_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:scaleType="centerCrop"/>
<ProgressBar
android:id="@+id/image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_margin="16dp"/>
</org.mariotaku.twidere.view.SquareRelativeLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.SquareRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/media_preview_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:scaleType="centerCrop"/>
<ProgressBar
android:id="@+id/media_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_margin="16dp"/>
</org.mariotaku.twidere.view.SquareRelativeLayout>

View File

@ -116,7 +116,7 @@
android:scaleType="centerCrop"/>
<ProgressBar
android:id="@+id/image_preview_progress"
android:id="@+id/media_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -109,7 +109,7 @@
android:scaleType="fitCenter"/>
<ProgressBar
android:id="@+id/image_preview_progress"
android:id="@+id/media_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"