moved profile image in message conversation

This commit is contained in:
Mariotaku Lee 2014-11-23 02:30:27 +08:00
parent c7cc785320
commit 02420e27c3
26 changed files with 1799 additions and 1717 deletions

View File

@ -60,7 +60,6 @@ import org.mariotaku.twidere.util.ImageLoaderWrapper;
import org.mariotaku.twidere.util.ParseUtils;
import org.mariotaku.twidere.util.TwitterWrapper;
import org.mariotaku.twidere.view.ProfileImageBannerLayout;
import org.mariotaku.twidere.view.ProfileImageView;
import org.mariotaku.twidere.view.iface.IExtendedView.OnSizeChangedListener;
import java.io.File;
@ -88,7 +87,7 @@ public class UserProfileEditorActivity extends BaseSupportActivity implements On
private AsyncTask<Void, Void, ?> mTask;
private ProfileImageBannerLayout mProfileImageBannerLayout;
private ProfileImageView mProfileImageView;
private ImageView mProfileImageView;
private ImageView mProfileBannerView;
private EditText mEditName, mEditDescription, mEditLocation, mEditUrl;
private View mProgress, mContent;

View File

@ -19,7 +19,6 @@
package org.mariotaku.twidere.adapter;
import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.text.Html;
@ -43,7 +42,6 @@ import static org.mariotaku.twidere.util.Utils.configBaseCardAdapter;
import static org.mariotaku.twidere.util.Utils.findDirectMessageInDatabases;
import static org.mariotaku.twidere.util.Utils.formatToLongTimeString;
import static org.mariotaku.twidere.util.Utils.openImage;
import static org.mariotaku.twidere.util.Utils.openUserProfile;
public class DirectMessagesConversationAdapter extends BaseCursorAdapter implements IDirectMessagesAdapter,
OnClickListener {
@ -78,7 +76,6 @@ public class DirectMessagesConversationAdapter extends BaseCursorAdapter impleme
final String firstMedia = cursor.getString(mIndices.first_media);
final boolean displayProfileImage = isDisplayProfileImage();
final long accountId = cursor.getLong(mIndices.account_id);
final long timestamp = cursor.getLong(mIndices.message_timestamp);
final boolean is_outgoing = cursor.getInt(mIndices.is_outgoing) == 1;
@ -94,26 +91,12 @@ public class DirectMessagesConversationAdapter extends BaseCursorAdapter impleme
holder.outgoing_text.setMovementMethod(null);
holder.incoming_time.setText(formatToLongTimeString(mContext, timestamp));
holder.outgoing_time.setText(formatToLongTimeString(mContext, timestamp));
holder.incoming_profile_image_container.setVisibility(displayProfileImage ? View.VISIBLE : View.GONE);
holder.outgoing_profile_image_container.setVisibility(displayProfileImage ? View.VISIBLE : View.GONE);
if (displayProfileImage) {
final String profile_image_url_string = cursor.getString(mIndices.sender_profile_image_url);
mImageLoader.displayProfileImage(holder.incoming_profile_image, profile_image_url_string);
mImageLoader.displayProfileImage(holder.outgoing_profile_image, profile_image_url_string);
holder.incoming_profile_image.setTag(position);
holder.outgoing_profile_image.setTag(position);
} else {
mImageLoader.cancelDisplayTask(holder.incoming_profile_image);
mImageLoader.cancelDisplayTask(holder.outgoing_profile_image);
}
if (position > mMaxAnimationPosition) {
if (mAnimationEnabled) {
view.startAnimation(holder.item_animation);
}
mMaxAnimationPosition = position;
}
holder.incoming_item_menu.setTag(position);
holder.outgoing_item_menu.setTag(position);
if (firstMedia == null) {
mImageLoader.cancelDisplayTask(holder.incoming_image_preview);
@ -173,10 +156,6 @@ public class DirectMessagesConversationAdapter extends BaseCursorAdapter impleme
final Object tag = view.getTag();
if (!(tag instanceof DirectMessageConversationViewHolder)) {
final DirectMessageConversationViewHolder holder = new DirectMessageConversationViewHolder(view);
holder.incoming_profile_image.setOnClickListener(this);
holder.outgoing_profile_image.setOnClickListener(this);
holder.incoming_item_menu.setOnClickListener(this);
holder.outgoing_item_menu.setOnClickListener(this);
holder.incoming_image_preview.setOnClickListener(this);
holder.outgoing_image_preview.setOnClickListener(this);
view.setTag(holder);
@ -191,25 +170,8 @@ public class DirectMessagesConversationAdapter extends BaseCursorAdapter impleme
final int position = tag instanceof Integer ? (Integer) tag : -1;
if (position == -1) return;
switch (view.getId()) {
case R.id.incoming_profile_image:
case R.id.outgoing_profile_image: {
final ParcelableDirectMessage message = getDirectMessage(position);
if (message == null) return;
if (mContext instanceof Activity) {
openUserProfile((Activity) mContext, message.account_id, message.sender_id,
message.sender_screen_name);
}
break;
}
case R.id.incoming_item_menu:
case R.id.outgoing_item_menu: {
if (position == -1 || mListener == null) return;
mListener.onMenuButtonClick(view, position, getItemId(position));
break;
}
case R.id.incoming_image_preview:
case R.id.outgoing_image_preview: {
if (position == -1) return;
final ParcelableDirectMessage message = getDirectMessage(position);
if (message == null || message.first_media == null) return;
openImage(mContext, message.account_id, message.first_media, false);

View File

@ -39,6 +39,7 @@ import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
@ -62,6 +63,7 @@ import org.mariotaku.twidere.activity.support.UserListSelectorActivity;
import org.mariotaku.twidere.adapter.AccountsSpinnerAdapter;
import org.mariotaku.twidere.adapter.DirectMessagesConversationAdapter;
import org.mariotaku.twidere.adapter.iface.IBaseCardAdapter.MenuButtonClickListener;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.model.Account;
import org.mariotaku.twidere.model.Panes;
import org.mariotaku.twidere.model.ParcelableDirectMessage;
@ -72,12 +74,14 @@ import org.mariotaku.twidere.provider.TweetStore.DirectMessages.Conversation;
import org.mariotaku.twidere.task.AsyncTask;
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
import org.mariotaku.twidere.util.ClipboardUtils;
import org.mariotaku.twidere.util.ImageLoaderWrapper;
import org.mariotaku.twidere.util.ParseUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.TwidereValidator;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.accessor.ViewAccessor;
import org.mariotaku.twidere.view.StatusTextCountView;
import org.mariotaku.twidere.view.iface.IColorLabelView;
import java.util.List;
import java.util.Locale;
@ -105,6 +109,7 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
private ImageView mAddImageButton;
private View mConversationContainer, mRecipientSelectorContainer, mRecipientSelector;
private Spinner mAccountSpinner;
private ImageView mSenderProfileImageView, mRecipientProfileImageView;
private PopupMenu mPopupMenu;
@ -130,6 +135,11 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
}
};
private Account mSender;
private ParcelableUser mRecipient;
private ImageLoaderWrapper mImageLoader;
private IColorLabelView mProfileImageContainer;
@Override
public void afterTextChanged(final Editable s) {
@ -143,7 +153,9 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
mImageLoader = TwidereApplication.getInstance(getActivity()).getImageLoaderWrapper();
mTwitterWrapper = getTwitterWrapper();
mValidator = new TwidereValidator(getActivity());
mLocale = getResources().getConfiguration().locale;
@ -198,7 +210,9 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
final ParcelableUser user = data.getParcelableExtra(EXTRA_USER);
if (user != null && mAccountId > 0) {
mRecipientId = user.id;
mRecipient = user;
showConversation(mAccountId, mRecipientId);
updateProfileImage();
}
break;
}
@ -214,6 +228,37 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
super.onActivityResult(requestCode, resultCode, data);
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
updateProfileImage();
}
private void updateProfileImage() {
if (mProfileImageContainer == null || mRecipientProfileImageView == null
|| mSenderProfileImageView == null) {
return;
}
if (mSender != null && mRecipient != null) {
mImageLoader.displayProfileImage(mSenderProfileImageView, mSender.profile_image_url);
mImageLoader.displayProfileImage(mRecipientProfileImageView, mRecipient.profile_image_url);
mProfileImageContainer.drawEnd(mSender.color);
} else {
mImageLoader.cancelDisplayTask(mSenderProfileImageView);
mImageLoader.cancelDisplayTask(mRecipientProfileImageView);
}
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_direct_messages_conversation, menu);
final View profileImageItemView = menu.findItem(R.id.item_profile_image).getActionView();
profileImageItemView.setOnClickListener(this);
mProfileImageContainer = (IColorLabelView) profileImageItemView;
mRecipientProfileImageView = (ImageView) profileImageItemView.findViewById(R.id.recipient_profile_image);
mSenderProfileImageView = (ImageView) profileImageItemView.findViewById(R.id.sender_profile_image);
}
@Override
public void onClick(final View view) {
switch (view.getId()) {
@ -234,6 +279,13 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
startActivityForResult(intent, REQUEST_PICK_IMAGE);
break;
}
case R.id.item_profile_image: {
final ParcelableUser recipient = mRecipient;
if (recipient == null) return;
Utils.openUserProfile(getActivity(), recipient.account_id, recipient.id,
recipient.screen_name);
break;
}
}
}
@ -283,6 +335,8 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
final Account account = (Account) mAccountSpinner.getSelectedItem();
if (account != null) {
mAccountId = account.account_id;
mSender = account;
updateProfileImage();
}
}
@ -433,6 +487,9 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
public void showConversation(final long accountId, final long recipientId) {
mAccountId = accountId;
mRecipientId = recipientId;
final Context context = getActivity();
mSender = Account.getAccount(context, accountId);
mRecipient = Utils.getUserForConversation(context, accountId, recipientId);
final LoaderManager lm = getLoaderManager();
final Bundle args = new Bundle();
args.putLong(EXTRA_ACCOUNT_ID, accountId);
@ -443,6 +500,7 @@ public class DirectMessagesConversationFragment extends BasePullToRefreshListFra
mLoaderInitialized = true;
lm.initLoader(0, args, this);
}
updateProfileImage();
}
@Override

View File

@ -19,10 +19,6 @@
package org.mariotaku.twidere.model;
import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText;
import static org.mariotaku.twidere.util.Utils.formatExpandedUserDescription;
import static org.mariotaku.twidere.util.Utils.formatUserDescription;
import android.content.ContentValues;
import android.database.Cursor;
import android.os.Parcel;
@ -31,293 +27,335 @@ import android.os.Parcelable;
import org.mariotaku.jsonserializer.JSONParcel;
import org.mariotaku.jsonserializer.JSONParcelable;
import org.mariotaku.twidere.provider.TweetStore.CachedUsers;
import org.mariotaku.twidere.provider.TweetStore.DirectMessages.ConversationEntries;
import org.mariotaku.twidere.util.ParseUtils;
import java.util.Date;
import twitter4j.URLEntity;
import twitter4j.User;
import java.util.Date;
import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText;
import static org.mariotaku.twidere.util.Utils.formatExpandedUserDescription;
import static org.mariotaku.twidere.util.Utils.formatUserDescription;
public class ParcelableUser implements TwidereParcelable, Comparable<ParcelableUser> {
public static final Parcelable.Creator<ParcelableUser> CREATOR = new Parcelable.Creator<ParcelableUser>() {
@Override
public ParcelableUser createFromParcel(final Parcel in) {
return new ParcelableUser(in);
}
public static final Parcelable.Creator<ParcelableUser> CREATOR = new Parcelable.Creator<ParcelableUser>() {
@Override
public ParcelableUser createFromParcel(final Parcel in) {
return new ParcelableUser(in);
}
@Override
public ParcelableUser[] newArray(final int size) {
return new ParcelableUser[size];
}
};
@Override
public ParcelableUser[] newArray(final int size) {
return new ParcelableUser[size];
}
};
public static final JSONParcelable.Creator<ParcelableUser> JSON_CREATOR = new JSONParcelable.Creator<ParcelableUser>() {
@Override
public ParcelableUser createFromParcel(final JSONParcel in) {
return new ParcelableUser(in);
}
public static final JSONParcelable.Creator<ParcelableUser> JSON_CREATOR = new JSONParcelable.Creator<ParcelableUser>() {
@Override
public ParcelableUser createFromParcel(final JSONParcel in) {
return new ParcelableUser(in);
}
@Override
public ParcelableUser[] newArray(final int size) {
return new ParcelableUser[size];
}
};
@Override
public ParcelableUser[] newArray(final int size) {
return new ParcelableUser[size];
}
};
public final long account_id, id, created_at, position;
public final long account_id, id, created_at, position;
public final boolean is_protected, is_verified, is_follow_request_sent, is_following;
public final boolean is_protected, is_verified, is_follow_request_sent, is_following;
public final String description_plain, name, screen_name, location, profile_image_url, profile_banner_url, url,
url_expanded, description_html, description_unescaped, description_expanded;
public final String description_plain, name, screen_name, location, profile_image_url, profile_banner_url, url,
url_expanded, description_html, description_unescaped, description_expanded;
public final int followers_count, friends_count, statuses_count, favorites_count;
public final int followers_count, friends_count, statuses_count, favorites_count;
public final boolean is_cache;
public final boolean is_cache;
public ParcelableUser(final Cursor cursor, final long account_id) {
this.account_id = account_id;
position = -1;
is_follow_request_sent = false;
id = cursor.getLong(cursor.getColumnIndex(CachedUsers.USER_ID));
name = cursor.getString(cursor.getColumnIndex(CachedUsers.NAME));
screen_name = cursor.getString(cursor.getColumnIndex(CachedUsers.SCREEN_NAME));
profile_image_url = cursor.getString(cursor.getColumnIndex(CachedUsers.PROFILE_IMAGE_URL));
created_at = cursor.getLong(cursor.getColumnIndex(CachedUsers.CREATED_AT));
is_protected = cursor.getInt(cursor.getColumnIndex(CachedUsers.IS_PROTECTED)) == 1;
is_verified = cursor.getInt(cursor.getColumnIndex(CachedUsers.IS_VERIFIED)) == 1;
favorites_count = cursor.getInt(cursor.getColumnIndex(CachedUsers.FAVORITES_COUNT));
followers_count = cursor.getInt(cursor.getColumnIndex(CachedUsers.FOLLOWERS_COUNT));
friends_count = cursor.getInt(cursor.getColumnIndex(CachedUsers.FRIENDS_COUNT));
statuses_count = cursor.getInt(cursor.getColumnIndex(CachedUsers.STATUSES_COUNT));
location = cursor.getString(cursor.getColumnIndex(CachedUsers.LOCATION));
description_plain = cursor.getString(cursor.getColumnIndex(CachedUsers.DESCRIPTION_PLAIN));
description_html = cursor.getString(cursor.getColumnIndex(CachedUsers.DESCRIPTION_HTML));
description_expanded = cursor.getString(cursor.getColumnIndex(CachedUsers.DESCRIPTION_EXPANDED));
url = cursor.getString(cursor.getColumnIndex(CachedUsers.URL));
url_expanded = cursor.getString(cursor.getColumnIndex(CachedUsers.URL_EXPANDED));
profile_banner_url = cursor.getString(cursor.getColumnIndex(CachedUsers.PROFILE_BANNER_URL));
is_cache = true;
description_unescaped = toPlainText(description_html);
is_following = cursor.getInt(cursor.getColumnIndex(CachedUsers.IS_FOLLOWING)) == 1;
}
public ParcelableUser(final long account_id, final long id, final String name,
final String screen_name, final String profile_image_url) {
this.account_id = account_id;
this.id = id;
this.name = name;
this.screen_name = screen_name;
this.profile_image_url = profile_image_url;
this.created_at = 0;
this.position = 0;
is_protected = false;
is_verified = false;
is_follow_request_sent = false;
is_following = false;
description_plain = null;
location = null;
profile_banner_url = null;
url = null;
url_expanded = null;
description_html = null;
description_unescaped = null;
description_expanded = null;
followers_count = 0;
friends_count = 0;
statuses_count = 0;
favorites_count = 0;
is_cache = true;
}
public ParcelableUser(final JSONParcel in) {
position = in.readLong("position");
account_id = in.readLong("account_id");
id = in.readLong("user_id");
created_at = in.readLong("created_at");
is_protected = in.readBoolean("is_protected");
is_verified = in.readBoolean("is_verified");
name = in.readString("name");
screen_name = in.readString("screen_name");
description_plain = in.readString("description_plain");
location = in.readString("location");
profile_image_url = in.readString("profile_image_url");
profile_banner_url = in.readString("profile_banner_url");
url = in.readString("url");
is_follow_request_sent = in.readBoolean("is_follow_request_sent");
followers_count = in.readInt("followers_count");
friends_count = in.readInt("friends_count");
statuses_count = in.readInt("statuses_count");
favorites_count = in.readInt("favorites_count");
is_cache = in.readBoolean("is_cache");
description_html = in.readString("description_html");
description_expanded = in.readString("description_expanded");
url_expanded = in.readString("url_expanded");
is_following = in.readBoolean("is_following");
description_unescaped = in.readString("description_unescaped");
}
public static ParcelableUser fromDirectMessageConversationEntry(final Cursor cursor) {
final long account_id = cursor.getLong(ConversationEntries.IDX_ACCOUNT_ID);
final long id = cursor.getLong(ConversationEntries.IDX_CONVERSATION_ID);
final String name = cursor.getString(ConversationEntries.IDX_NAME);
final String screen_name = cursor.getString(ConversationEntries.IDX_SCREEN_NAME);
final String profile_image_url = cursor.getString(ConversationEntries.IDX_PROFILE_IMAGE_URL);
return new ParcelableUser(account_id, id, name, screen_name, profile_image_url);
}
public ParcelableUser(final Parcel in) {
position = in.readLong();
account_id = in.readLong();
id = in.readLong();
created_at = in.readLong();
is_protected = in.readInt() == 1;
is_verified = in.readInt() == 1;
name = in.readString();
screen_name = in.readString();
description_plain = in.readString();
location = in.readString();
profile_image_url = in.readString();
profile_banner_url = in.readString();
url = in.readString();
is_follow_request_sent = in.readInt() == 1;
followers_count = in.readInt();
friends_count = in.readInt();
statuses_count = in.readInt();
favorites_count = in.readInt();
is_cache = in.readInt() == 1;
description_html = in.readString();
description_expanded = in.readString();
url_expanded = in.readString();
is_following = in.readInt() == 1;
description_unescaped = in.readString();
}
public ParcelableUser(final Cursor cursor, final long account_id) {
this.account_id = account_id;
position = -1;
is_follow_request_sent = false;
id = cursor.getLong(cursor.getColumnIndex(CachedUsers.USER_ID));
name = cursor.getString(cursor.getColumnIndex(CachedUsers.NAME));
screen_name = cursor.getString(cursor.getColumnIndex(CachedUsers.SCREEN_NAME));
profile_image_url = cursor.getString(cursor.getColumnIndex(CachedUsers.PROFILE_IMAGE_URL));
created_at = cursor.getLong(cursor.getColumnIndex(CachedUsers.CREATED_AT));
is_protected = cursor.getInt(cursor.getColumnIndex(CachedUsers.IS_PROTECTED)) == 1;
is_verified = cursor.getInt(cursor.getColumnIndex(CachedUsers.IS_VERIFIED)) == 1;
favorites_count = cursor.getInt(cursor.getColumnIndex(CachedUsers.FAVORITES_COUNT));
followers_count = cursor.getInt(cursor.getColumnIndex(CachedUsers.FOLLOWERS_COUNT));
friends_count = cursor.getInt(cursor.getColumnIndex(CachedUsers.FRIENDS_COUNT));
statuses_count = cursor.getInt(cursor.getColumnIndex(CachedUsers.STATUSES_COUNT));
location = cursor.getString(cursor.getColumnIndex(CachedUsers.LOCATION));
description_plain = cursor.getString(cursor.getColumnIndex(CachedUsers.DESCRIPTION_PLAIN));
description_html = cursor.getString(cursor.getColumnIndex(CachedUsers.DESCRIPTION_HTML));
description_expanded = cursor.getString(cursor.getColumnIndex(CachedUsers.DESCRIPTION_EXPANDED));
url = cursor.getString(cursor.getColumnIndex(CachedUsers.URL));
url_expanded = cursor.getString(cursor.getColumnIndex(CachedUsers.URL_EXPANDED));
profile_banner_url = cursor.getString(cursor.getColumnIndex(CachedUsers.PROFILE_BANNER_URL));
is_cache = true;
description_unescaped = toPlainText(description_html);
is_following = cursor.getInt(cursor.getColumnIndex(CachedUsers.IS_FOLLOWING)) == 1;
}
public ParcelableUser(final User user, final long account_id) {
this(user, account_id, 0);
}
public ParcelableUser(final JSONParcel in) {
position = in.readLong("position");
account_id = in.readLong("account_id");
id = in.readLong("user_id");
created_at = in.readLong("created_at");
is_protected = in.readBoolean("is_protected");
is_verified = in.readBoolean("is_verified");
name = in.readString("name");
screen_name = in.readString("screen_name");
description_plain = in.readString("description_plain");
location = in.readString("location");
profile_image_url = in.readString("profile_image_url");
profile_banner_url = in.readString("profile_banner_url");
url = in.readString("url");
is_follow_request_sent = in.readBoolean("is_follow_request_sent");
followers_count = in.readInt("followers_count");
friends_count = in.readInt("friends_count");
statuses_count = in.readInt("statuses_count");
favorites_count = in.readInt("favorites_count");
is_cache = in.readBoolean("is_cache");
description_html = in.readString("description_html");
description_expanded = in.readString("description_expanded");
url_expanded = in.readString("url_expanded");
is_following = in.readBoolean("is_following");
description_unescaped = in.readString("description_unescaped");
}
public ParcelableUser(final User user, final long account_id, final long position) {
this.position = position;
this.account_id = account_id;
final URLEntity[] urls_url_entities = user.getURLEntities();
id = user.getId();
created_at = getTime(user.getCreatedAt());
is_protected = user.isProtected();
is_verified = user.isVerified();
name = user.getName();
screen_name = user.getScreenName();
description_plain = user.getDescription();
description_html = formatUserDescription(user);
description_expanded = formatExpandedUserDescription(user);
location = user.getLocation();
profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
profile_banner_url = user.getProfileBannerImageUrl();
url = ParseUtils.parseString(user.getURL());
url_expanded = url != null && urls_url_entities != null && urls_url_entities.length > 0 ? ParseUtils
.parseString(urls_url_entities[0].getExpandedURL()) : null;
is_follow_request_sent = user.isFollowRequestSent();
followers_count = user.getFollowersCount();
friends_count = user.getFriendsCount();
statuses_count = user.getStatusesCount();
favorites_count = user.getFavouritesCount();
is_cache = false;
is_following = user.isFollowing();
description_unescaped = toPlainText(description_html);
}
public ParcelableUser(final Parcel in) {
position = in.readLong();
account_id = in.readLong();
id = in.readLong();
created_at = in.readLong();
is_protected = in.readInt() == 1;
is_verified = in.readInt() == 1;
name = in.readString();
screen_name = in.readString();
description_plain = in.readString();
location = in.readString();
profile_image_url = in.readString();
profile_banner_url = in.readString();
url = in.readString();
is_follow_request_sent = in.readInt() == 1;
followers_count = in.readInt();
friends_count = in.readInt();
statuses_count = in.readInt();
favorites_count = in.readInt();
is_cache = in.readInt() == 1;
description_html = in.readString();
description_expanded = in.readString();
url_expanded = in.readString();
is_following = in.readInt() == 1;
description_unescaped = in.readString();
}
@Override
public int compareTo(final ParcelableUser that) {
final long diff = that != null ? position - that.position : position;
if (diff > Integer.MAX_VALUE) return Integer.MAX_VALUE;
if (diff < Integer.MIN_VALUE) return Integer.MIN_VALUE;
return (int) diff;
}
public ParcelableUser(final User user, final long account_id) {
this(user, account_id, 0);
}
@Override
public int describeContents() {
return 0;
}
public ParcelableUser(final User user, final long account_id, final long position) {
this.position = position;
this.account_id = account_id;
final URLEntity[] urls_url_entities = user.getURLEntities();
id = user.getId();
created_at = getTime(user.getCreatedAt());
is_protected = user.isProtected();
is_verified = user.isVerified();
name = user.getName();
screen_name = user.getScreenName();
description_plain = user.getDescription();
description_html = formatUserDescription(user);
description_expanded = formatExpandedUserDescription(user);
location = user.getLocation();
profile_image_url = ParseUtils.parseString(user.getProfileImageUrlHttps());
profile_banner_url = user.getProfileBannerImageUrl();
url = ParseUtils.parseString(user.getURL());
url_expanded = url != null && urls_url_entities != null && urls_url_entities.length > 0 ? ParseUtils
.parseString(urls_url_entities[0].getExpandedURL()) : null;
is_follow_request_sent = user.isFollowRequestSent();
followers_count = user.getFollowersCount();
friends_count = user.getFriendsCount();
statuses_count = user.getStatusesCount();
favorites_count = user.getFavouritesCount();
is_cache = false;
is_following = user.isFollowing();
description_unescaped = toPlainText(description_html);
}
@Override
public boolean equals(final Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (!(obj instanceof ParcelableUser)) return false;
final ParcelableUser other = (ParcelableUser) obj;
if (account_id != other.account_id) return false;
if (id != other.id) return false;
return true;
}
@Override
public int compareTo(final ParcelableUser that) {
final long diff = that != null ? position - that.position : position;
if (diff > Integer.MAX_VALUE) return Integer.MAX_VALUE;
if (diff < Integer.MIN_VALUE) return Integer.MIN_VALUE;
return (int) diff;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (account_id ^ account_id >>> 32);
result = prime * result + (int) (id ^ id >>> 32);
return result;
}
@Override
public int describeContents() {
return 0;
}
@Override
public String toString() {
return "ParcelableUser{account_id=" + account_id + ", id=" + id + ", created_at=" + created_at + ", position="
+ position + ", is_protected=" + is_protected + ", is_verified=" + is_verified
+ ", is_follow_request_sent=" + is_follow_request_sent + ", is_following=" + is_following
+ ", description_plain=" + description_plain + ", name=" + name + ", screen_name=" + screen_name
+ ", location=" + location + ", profile_image_url=" + profile_image_url + ", profile_banner_url="
+ profile_banner_url + ", url=" + url + ", url_expanded=" + url_expanded + ", description_html="
+ description_html + ", description_unescaped=" + description_unescaped + ", description_expanded="
+ description_expanded + ", followers_count=" + followers_count + ", friends_count=" + friends_count
+ ", statuses_count=" + statuses_count + ", favorites_count=" + favorites_count + ", is_cache="
+ is_cache + "}";
}
@Override
public boolean equals(final Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (!(obj instanceof ParcelableUser)) return false;
final ParcelableUser other = (ParcelableUser) obj;
if (account_id != other.account_id) return false;
if (id != other.id) return false;
return true;
}
@Override
public void writeToParcel(final JSONParcel out) {
out.writeLong("position", position);
out.writeLong("account_id", account_id);
out.writeLong("user_id", id);
out.writeLong("created_at", created_at);
out.writeBoolean("is_protected", is_protected);
out.writeBoolean("is_verified", is_verified);
out.writeString("name", name);
out.writeString("screen_name", screen_name);
out.writeString("description_plain", description_plain);
out.writeString("location", location);
out.writeString("profile_image_url", profile_image_url);
out.writeString("profile_banner_url", profile_banner_url);
out.writeString("url", url);
out.writeBoolean("is_follow_request_sent", is_follow_request_sent);
out.writeInt("followers_count", followers_count);
out.writeInt("friends_count", friends_count);
out.writeInt("statuses_count", statuses_count);
out.writeInt("favorites_count", favorites_count);
out.writeBoolean("is_cache", is_cache);
out.writeString("description_html", description_html);
out.writeString("description_expanded", description_expanded);
out.writeString("url_expanded", url_expanded);
out.writeBoolean("is_following", is_following);
out.writeString("description_unescaped", description_unescaped);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (account_id ^ account_id >>> 32);
result = prime * result + (int) (id ^ id >>> 32);
return result;
}
@Override
public void writeToParcel(final Parcel out, final int flags) {
out.writeLong(position);
out.writeLong(account_id);
out.writeLong(id);
out.writeLong(created_at);
out.writeInt(is_protected ? 1 : 0);
out.writeInt(is_verified ? 1 : 0);
out.writeString(name);
out.writeString(screen_name);
out.writeString(description_plain);
out.writeString(location);
out.writeString(profile_image_url);
out.writeString(profile_banner_url);
out.writeString(url);
out.writeInt(is_follow_request_sent ? 1 : 0);
out.writeInt(followers_count);
out.writeInt(friends_count);
out.writeInt(statuses_count);
out.writeInt(favorites_count);
out.writeInt(is_cache ? 1 : 0);
out.writeString(description_html);
out.writeString(description_expanded);
out.writeString(url_expanded);
out.writeInt(is_following ? 1 : 0);
out.writeString(description_unescaped);
}
@Override
public String toString() {
return "ParcelableUser{account_id=" + account_id + ", id=" + id + ", created_at=" + created_at + ", position="
+ position + ", is_protected=" + is_protected + ", is_verified=" + is_verified
+ ", is_follow_request_sent=" + is_follow_request_sent + ", is_following=" + is_following
+ ", description_plain=" + description_plain + ", name=" + name + ", screen_name=" + screen_name
+ ", location=" + location + ", profile_image_url=" + profile_image_url + ", profile_banner_url="
+ profile_banner_url + ", url=" + url + ", url_expanded=" + url_expanded + ", description_html="
+ description_html + ", description_unescaped=" + description_unescaped + ", description_expanded="
+ description_expanded + ", followers_count=" + followers_count + ", friends_count=" + friends_count
+ ", statuses_count=" + statuses_count + ", favorites_count=" + favorites_count + ", is_cache="
+ is_cache + "}";
}
public static ContentValues makeCachedUserContentValues(final ParcelableUser user) {
if (user == null) return null;
final ContentValues values = new ContentValues();
values.put(CachedUsers.USER_ID, user.id);
values.put(CachedUsers.NAME, user.name);
values.put(CachedUsers.SCREEN_NAME, user.screen_name);
values.put(CachedUsers.PROFILE_IMAGE_URL, user.profile_image_url);
values.put(CachedUsers.CREATED_AT, user.created_at);
values.put(CachedUsers.IS_PROTECTED, user.is_protected);
values.put(CachedUsers.IS_VERIFIED, user.is_verified);
values.put(CachedUsers.FAVORITES_COUNT, user.favorites_count);
values.put(CachedUsers.FOLLOWERS_COUNT, user.followers_count);
values.put(CachedUsers.FRIENDS_COUNT, user.friends_count);
values.put(CachedUsers.STATUSES_COUNT, user.statuses_count);
values.put(CachedUsers.LOCATION, user.location);
values.put(CachedUsers.DESCRIPTION_PLAIN, user.description_plain);
values.put(CachedUsers.DESCRIPTION_HTML, user.description_html);
values.put(CachedUsers.DESCRIPTION_EXPANDED, user.description_expanded);
values.put(CachedUsers.URL, user.url);
values.put(CachedUsers.URL_EXPANDED, user.url_expanded);
values.put(CachedUsers.PROFILE_BANNER_URL, user.profile_banner_url);
values.put(CachedUsers.IS_FOLLOWING, user.is_following);
return values;
}
@Override
public void writeToParcel(final JSONParcel out) {
out.writeLong("position", position);
out.writeLong("account_id", account_id);
out.writeLong("user_id", id);
out.writeLong("created_at", created_at);
out.writeBoolean("is_protected", is_protected);
out.writeBoolean("is_verified", is_verified);
out.writeString("name", name);
out.writeString("screen_name", screen_name);
out.writeString("description_plain", description_plain);
out.writeString("location", location);
out.writeString("profile_image_url", profile_image_url);
out.writeString("profile_banner_url", profile_banner_url);
out.writeString("url", url);
out.writeBoolean("is_follow_request_sent", is_follow_request_sent);
out.writeInt("followers_count", followers_count);
out.writeInt("friends_count", friends_count);
out.writeInt("statuses_count", statuses_count);
out.writeInt("favorites_count", favorites_count);
out.writeBoolean("is_cache", is_cache);
out.writeString("description_html", description_html);
out.writeString("description_expanded", description_expanded);
out.writeString("url_expanded", url_expanded);
out.writeBoolean("is_following", is_following);
out.writeString("description_unescaped", description_unescaped);
}
private static long getTime(final Date date) {
return date != null ? date.getTime() : 0;
}
@Override
public void writeToParcel(final Parcel out, final int flags) {
out.writeLong(position);
out.writeLong(account_id);
out.writeLong(id);
out.writeLong(created_at);
out.writeInt(is_protected ? 1 : 0);
out.writeInt(is_verified ? 1 : 0);
out.writeString(name);
out.writeString(screen_name);
out.writeString(description_plain);
out.writeString(location);
out.writeString(profile_image_url);
out.writeString(profile_banner_url);
out.writeString(url);
out.writeInt(is_follow_request_sent ? 1 : 0);
out.writeInt(followers_count);
out.writeInt(friends_count);
out.writeInt(statuses_count);
out.writeInt(favorites_count);
out.writeInt(is_cache ? 1 : 0);
out.writeString(description_html);
out.writeString(description_expanded);
out.writeString(url_expanded);
out.writeInt(is_following ? 1 : 0);
out.writeString(description_unescaped);
}
public static ContentValues makeCachedUserContentValues(final ParcelableUser user) {
if (user == null) return null;
final ContentValues values = new ContentValues();
values.put(CachedUsers.USER_ID, user.id);
values.put(CachedUsers.NAME, user.name);
values.put(CachedUsers.SCREEN_NAME, user.screen_name);
values.put(CachedUsers.PROFILE_IMAGE_URL, user.profile_image_url);
values.put(CachedUsers.CREATED_AT, user.created_at);
values.put(CachedUsers.IS_PROTECTED, user.is_protected);
values.put(CachedUsers.IS_VERIFIED, user.is_verified);
values.put(CachedUsers.FAVORITES_COUNT, user.favorites_count);
values.put(CachedUsers.FOLLOWERS_COUNT, user.followers_count);
values.put(CachedUsers.FRIENDS_COUNT, user.friends_count);
values.put(CachedUsers.STATUSES_COUNT, user.statuses_count);
values.put(CachedUsers.LOCATION, user.location);
values.put(CachedUsers.DESCRIPTION_PLAIN, user.description_plain);
values.put(CachedUsers.DESCRIPTION_HTML, user.description_html);
values.put(CachedUsers.DESCRIPTION_EXPANDED, user.description_expanded);
values.put(CachedUsers.URL, user.url);
values.put(CachedUsers.URL_EXPANDED, user.url_expanded);
values.put(CachedUsers.PROFILE_BANNER_URL, user.profile_banner_url);
values.put(CachedUsers.IS_FOLLOWING, user.is_following);
return values;
}
private static long getTime(final Date date) {
return date != null ? date.getTime() : 0;
}
}

View File

@ -349,11 +349,14 @@ public interface TweetStore {
public static final Uri CONTENT_URI = Uri
.withAppendedPath(DirectMessages.CONTENT_URI, CONTENT_PATH_SEGMENT);
public static final String MESSAGE_TIMESTAMP = "message_timestamp";
public static final String MESSAGE_ID = DirectMessages.MESSAGE_ID;
public static final String ACCOUNT_ID = DirectMessages.ACCOUNT_ID;
public static final String IS_OUTGOING = DirectMessages.IS_OUTGOING;
public static final String MESSAGE_TIMESTAMP = DirectMessages.MESSAGE_TIMESTAMP;
public static final String NAME = "name";
public static final String SCREEN_NAME = "screen_name";
public static final String PROFILE_IMAGE_URL = "profile_image_url";
public static final String TEXT_HTML = "text_html";
public static final String TEXT_HTML = DirectMessages.TEXT_HTML;
public static final String CONVERSATION_ID = "conversation_id";
public static final int IDX__ID = 0;

View File

@ -35,142 +35,146 @@ import org.mariotaku.twidere.provider.TweetStore.DirectMessages.Outbox;
public class TwidereQueryBuilder {
public static final class ConversationQueryBuilder {
public static final class ConversationQueryBuilder {
public static final String buildByConversationId(final String[] projection, final long account_id,
final long conversationId, final String selection, final String sortOrder) {
final Selectable select = Utils.getColumnsFromProjection(projection);
final SQLSelectQuery.Builder qb = SQLQueryBuilder.select(select);
qb.from(new Tables(DirectMessages.TABLE_NAME));
final Where accountIdWhere = Where.equals(DirectMessages.ACCOUNT_ID, account_id);
final Where incomingWhere = Where.and(Where.notEquals(DirectMessages.IS_OUTGOING, 1),
Where.equals(DirectMessages.SENDER_ID, conversationId));
final Where outgoingWhere = Where.and(Where.equals(DirectMessages.IS_OUTGOING, 1),
Where.equals(DirectMessages.RECIPIENT_ID, conversationId));
final Where conversationWhere = Where.or(incomingWhere, outgoingWhere);
if (selection != null) {
qb.where(Where.and(accountIdWhere, conversationWhere, new Where(selection)));
} else {
qb.where(Where.and(accountIdWhere, conversationWhere));
}
qb.orderBy(new OrderBy(sortOrder != null ? sortOrder : Conversation.DEFAULT_SORT_ORDER));
return qb.build().getSQL();
}
public static final String buildByConversationId(final String[] projection, final long account_id,
final long conversationId, final String selection, final String sortOrder) {
final Selectable select = Utils.getColumnsFromProjection(projection);
final SQLSelectQuery.Builder qb = SQLQueryBuilder.select(select);
qb.from(new Tables(DirectMessages.TABLE_NAME));
final Where accountIdWhere = Where.equals(DirectMessages.ACCOUNT_ID, account_id);
final Where incomingWhere = Where.and(Where.notEquals(DirectMessages.IS_OUTGOING, 1),
Where.equals(DirectMessages.SENDER_ID, conversationId));
final Where outgoingWhere = Where.and(Where.equals(DirectMessages.IS_OUTGOING, 1),
Where.equals(DirectMessages.RECIPIENT_ID, conversationId));
final Where conversationWhere = Where.or(incomingWhere, outgoingWhere);
if (selection != null) {
qb.where(Where.and(accountIdWhere, conversationWhere, new Where(selection)));
} else {
qb.where(Where.and(accountIdWhere, conversationWhere));
}
qb.orderBy(new OrderBy(sortOrder != null ? sortOrder : Conversation.DEFAULT_SORT_ORDER));
return qb.build().getSQL();
}
public static final String buildByScreenName(final String[] projection, final long account_id,
final String screen_name, final String selection, final String sortOrder) {
final Selectable select = Utils.getColumnsFromProjection(projection);
final SQLSelectQuery.Builder qb = SQLQueryBuilder.select(select);
qb.select(select);
qb.from(new Tables(DirectMessages.TABLE_NAME));
final Where accountIdWhere = Where.equals(DirectMessages.ACCOUNT_ID, account_id);
final Where incomingWhere = Where.and(Where.notEquals(DirectMessages.IS_OUTGOING, 1),
Where.equals(new Column(DirectMessages.SENDER_SCREEN_NAME), screen_name));
final Where outgoingWhere = Where.and(Where.equals(DirectMessages.IS_OUTGOING, 1),
Where.equals(new Column(DirectMessages.RECIPIENT_SCREEN_NAME), screen_name));
if (selection != null) {
qb.where(Where.and(accountIdWhere, incomingWhere, outgoingWhere, new Where(selection)));
} else {
qb.where(Where.and(accountIdWhere, incomingWhere, outgoingWhere));
}
qb.orderBy(new OrderBy(sortOrder != null ? sortOrder : Conversation.DEFAULT_SORT_ORDER));
return qb.build().getSQL();
}
public static final String buildByScreenName(final String[] projection, final long account_id,
final String screen_name, final String selection, final String sortOrder) {
final Selectable select = Utils.getColumnsFromProjection(projection);
final SQLSelectQuery.Builder qb = SQLQueryBuilder.select(select);
qb.select(select);
qb.from(new Tables(DirectMessages.TABLE_NAME));
final Where accountIdWhere = Where.equals(DirectMessages.ACCOUNT_ID, account_id);
final Where incomingWhere = Where.and(Where.notEquals(DirectMessages.IS_OUTGOING, 1),
Where.equals(new Column(DirectMessages.SENDER_SCREEN_NAME), screen_name));
final Where outgoingWhere = Where.and(Where.equals(DirectMessages.IS_OUTGOING, 1),
Where.equals(new Column(DirectMessages.RECIPIENT_SCREEN_NAME), screen_name));
if (selection != null) {
qb.where(Where.and(accountIdWhere, incomingWhere, outgoingWhere, new Where(selection)));
} else {
qb.where(Where.and(accountIdWhere, incomingWhere, outgoingWhere));
}
qb.orderBy(new OrderBy(sortOrder != null ? sortOrder : Conversation.DEFAULT_SORT_ORDER));
return qb.build().getSQL();
}
}
}
public static class ConversationsEntryQueryBuilder {
public static class ConversationsEntryQueryBuilder {
public static SQLSelectQuery build() {
return build(null);
}
public static SQLSelectQuery build() {
return build(null);
}
public static SQLSelectQuery build(final String selection) {
final SQLSelectQuery.Builder qb = new SQLSelectQuery.Builder();
qb.select(new Columns(new Column(DirectMessages._ID), new Column(ConversationEntries.MESSAGE_TIMESTAMP),
new Column(DirectMessages.MESSAGE_ID), new Column(DirectMessages.ACCOUNT_ID), new Column(
DirectMessages.IS_OUTGOING), new Column(ConversationEntries.NAME), new Column(
ConversationEntries.SCREEN_NAME), new Column(ConversationEntries.PROFILE_IMAGE_URL),
new Column(ConversationEntries.TEXT_HTML), new Column(ConversationEntries.CONVERSATION_ID)));
final SQLSelectQuery.Builder entryIds = new SQLSelectQuery.Builder();
entryIds.select(new Columns(new Column(DirectMessages._ID), new Column(
ConversationEntries.MESSAGE_TIMESTAMP), new Column(DirectMessages.MESSAGE_ID), new Column(
DirectMessages.ACCOUNT_ID), new Column("0", DirectMessages.IS_OUTGOING), new Column(
DirectMessages.SENDER_NAME, ConversationEntries.NAME), new Column(
DirectMessages.SENDER_SCREEN_NAME, ConversationEntries.SCREEN_NAME), new Column(
DirectMessages.SENDER_PROFILE_IMAGE_URL, ConversationEntries.PROFILE_IMAGE_URL), new Column(
ConversationEntries.TEXT_HTML), new Column(DirectMessages.SENDER_ID,
ConversationEntries.CONVERSATION_ID)));
entryIds.from(new Tables(Inbox.TABLE_NAME));
entryIds.union();
entryIds.select(new Columns(new Column(DirectMessages._ID), new Column(
ConversationEntries.MESSAGE_TIMESTAMP), new Column(DirectMessages.MESSAGE_ID), new Column(
DirectMessages.ACCOUNT_ID), new Column("1", DirectMessages.IS_OUTGOING), new Column(
DirectMessages.RECIPIENT_NAME, ConversationEntries.NAME), new Column(
DirectMessages.RECIPIENT_SCREEN_NAME, ConversationEntries.SCREEN_NAME), new Column(
DirectMessages.RECIPIENT_PROFILE_IMAGE_URL, ConversationEntries.PROFILE_IMAGE_URL), new Column(
ConversationEntries.TEXT_HTML), new Column(DirectMessages.RECIPIENT_ID,
ConversationEntries.CONVERSATION_ID)));
entryIds.from(new Tables(Outbox.TABLE_NAME));
qb.from(entryIds.build());
final SQLSelectQuery.Builder recent_inbox_msg_ids = SQLQueryBuilder
.select(new Column("MAX(" + DirectMessages.MESSAGE_ID + ")")).from(new Tables(Inbox.TABLE_NAME))
.groupBy(new Column(DirectMessages.SENDER_ID));
final SQLSelectQuery.Builder recent_outbox_msg_ids = SQLQueryBuilder
.select(new Column("MAX(" + DirectMessages.MESSAGE_ID + ")")).from(new Tables(Outbox.TABLE_NAME))
.groupBy(new Column(DirectMessages.RECIPIENT_ID));
final SQLSelectQuery.Builder conversationIds = new SQLSelectQuery.Builder();
conversationIds.select(new Columns(new Column(DirectMessages.MESSAGE_ID), new Column(
DirectMessages.SENDER_ID, ConversationEntries.CONVERSATION_ID)));
conversationIds.from(new Tables(Inbox.TABLE_NAME));
conversationIds.where(Where.in(new Column(DirectMessages.MESSAGE_ID), recent_inbox_msg_ids.build()));
conversationIds.union();
conversationIds.select(new Columns(new Column(DirectMessages.MESSAGE_ID), new Column(
DirectMessages.RECIPIENT_ID, ConversationEntries.CONVERSATION_ID)));
conversationIds.from(new Tables(Outbox.TABLE_NAME));
conversationIds.where(Where.in(new Column(DirectMessages.MESSAGE_ID), recent_outbox_msg_ids.build()));
final SQLSelectQuery.Builder groupedConversationIds = new SQLSelectQuery.Builder();
groupedConversationIds.select(new Column(DirectMessages.MESSAGE_ID));
groupedConversationIds.from(conversationIds.build());
groupedConversationIds.groupBy(new Column(ConversationEntries.CONVERSATION_ID));
final Where groupedWhere = Where.in(new Column(DirectMessages.MESSAGE_ID), groupedConversationIds.build());
final Where where;
if (selection != null) {
where = Where.and(groupedWhere, new Where(selection));
} else {
where = groupedWhere;
}
qb.where(where);
qb.groupBy(Utils.getColumnsFromProjection(ConversationEntries.CONVERSATION_ID, DirectMessages.ACCOUNT_ID));
qb.orderBy(new OrderBy(ConversationEntries.MESSAGE_TIMESTAMP + " DESC"));
return qb.build();
}
public static SQLSelectQuery build(final String selection) {
final SQLSelectQuery.Builder qb = new SQLSelectQuery.Builder();
qb.select(new Columns(new Column(ConversationEntries._ID), new Column(ConversationEntries.MESSAGE_TIMESTAMP),
new Column(ConversationEntries.MESSAGE_ID), new Column(ConversationEntries.ACCOUNT_ID), new Column(
ConversationEntries.IS_OUTGOING), new Column(ConversationEntries.NAME), new Column(
ConversationEntries.SCREEN_NAME), new Column(ConversationEntries.PROFILE_IMAGE_URL),
new Column(ConversationEntries.TEXT_HTML), new Column(ConversationEntries.CONVERSATION_ID)));
final SQLSelectQuery.Builder entryIds = new SQLSelectQuery.Builder();
entryIds.select(new Columns(new Column(DirectMessages._ID),
new Column(DirectMessages.MESSAGE_TIMESTAMP),
new Column(DirectMessages.MESSAGE_ID),
new Column(DirectMessages.ACCOUNT_ID),
new Column("0", DirectMessages.IS_OUTGOING),
new Column(DirectMessages.SENDER_NAME, ConversationEntries.NAME),
new Column(DirectMessages.SENDER_SCREEN_NAME, ConversationEntries.SCREEN_NAME),
new Column(DirectMessages.SENDER_PROFILE_IMAGE_URL, ConversationEntries.PROFILE_IMAGE_URL),
new Column(DirectMessages.TEXT_HTML),
new Column(DirectMessages.SENDER_ID, ConversationEntries.CONVERSATION_ID)));
entryIds.from(new Tables(Inbox.TABLE_NAME));
entryIds.union();
entryIds.select(new Columns(new Column(DirectMessages._ID),
new Column(DirectMessages.MESSAGE_TIMESTAMP),
new Column(DirectMessages.MESSAGE_ID),
new Column(DirectMessages.ACCOUNT_ID),
new Column("1", DirectMessages.IS_OUTGOING),
new Column(DirectMessages.RECIPIENT_NAME, ConversationEntries.NAME),
new Column(DirectMessages.RECIPIENT_SCREEN_NAME, ConversationEntries.SCREEN_NAME),
new Column(DirectMessages.RECIPIENT_PROFILE_IMAGE_URL, ConversationEntries.PROFILE_IMAGE_URL),
new Column(DirectMessages.TEXT_HTML),
new Column(DirectMessages.RECIPIENT_ID, ConversationEntries.CONVERSATION_ID)));
entryIds.from(new Tables(Outbox.TABLE_NAME));
qb.from(entryIds.build());
final SQLSelectQuery.Builder recent_inbox_msg_ids = SQLQueryBuilder
.select(new Column("MAX(" + DirectMessages.MESSAGE_ID + ")")).from(new Tables(Inbox.TABLE_NAME))
.groupBy(new Column(DirectMessages.SENDER_ID));
final SQLSelectQuery.Builder recent_outbox_msg_ids = SQLQueryBuilder
.select(new Column("MAX(" + DirectMessages.MESSAGE_ID + ")")).from(new Tables(Outbox.TABLE_NAME))
.groupBy(new Column(DirectMessages.RECIPIENT_ID));
final SQLSelectQuery.Builder conversationIds = new SQLSelectQuery.Builder();
conversationIds.select(new Columns(new Column(DirectMessages.MESSAGE_ID), new Column(
DirectMessages.SENDER_ID, ConversationEntries.CONVERSATION_ID)));
conversationIds.from(new Tables(Inbox.TABLE_NAME));
conversationIds.where(Where.in(new Column(DirectMessages.MESSAGE_ID), recent_inbox_msg_ids.build()));
conversationIds.union();
conversationIds.select(new Columns(new Column(DirectMessages.MESSAGE_ID), new Column(
DirectMessages.RECIPIENT_ID, ConversationEntries.CONVERSATION_ID)));
conversationIds.from(new Tables(Outbox.TABLE_NAME));
conversationIds.where(Where.in(new Column(DirectMessages.MESSAGE_ID), recent_outbox_msg_ids.build()));
final SQLSelectQuery.Builder groupedConversationIds = new SQLSelectQuery.Builder();
groupedConversationIds.select(new Column(DirectMessages.MESSAGE_ID));
groupedConversationIds.from(conversationIds.build());
groupedConversationIds.groupBy(new Column(ConversationEntries.CONVERSATION_ID));
final Where groupedWhere = Where.in(new Column(DirectMessages.MESSAGE_ID), groupedConversationIds.build());
final Where where;
if (selection != null) {
where = Where.and(groupedWhere, new Where(selection));
} else {
where = groupedWhere;
}
qb.where(where);
qb.groupBy(Utils.getColumnsFromProjection(ConversationEntries.CONVERSATION_ID, DirectMessages.ACCOUNT_ID));
qb.orderBy(new OrderBy(ConversationEntries.MESSAGE_TIMESTAMP + " DESC"));
return qb.build();
}
}
}
public static final class DirectMessagesQueryBuilder {
public static final class DirectMessagesQueryBuilder {
public static final SQLSelectQuery build() {
return build(null, null, null);
}
public static final SQLSelectQuery build() {
return build(null, null, null);
}
public static final SQLSelectQuery build(final String[] projection, final String selection,
final String sortOrder) {
final SQLSelectQuery.Builder qb = new SQLSelectQuery.Builder();
final Selectable select = Utils.getColumnsFromProjection(projection);
qb.select(select).from(new Tables(DirectMessages.Inbox.TABLE_NAME));
if (selection != null) {
qb.where(new Where(selection));
}
qb.union();
qb.select(select).from(new Tables(DirectMessages.Outbox.TABLE_NAME));
if (selection != null) {
qb.where(new Where(selection));
}
qb.orderBy(new OrderBy(sortOrder != null ? sortOrder : DirectMessages.DEFAULT_SORT_ORDER));
return qb.build();
}
public static final SQLSelectQuery build(final String[] projection, final String selection,
final String sortOrder) {
final SQLSelectQuery.Builder qb = new SQLSelectQuery.Builder();
final Selectable select = Utils.getColumnsFromProjection(projection);
qb.select(select).from(new Tables(DirectMessages.Inbox.TABLE_NAME));
if (selection != null) {
qb.where(new Where(selection));
}
qb.union();
qb.select(select).from(new Tables(DirectMessages.Outbox.TABLE_NAME));
if (selection != null) {
qb.where(new Where(selection));
}
qb.orderBy(new OrderBy(sortOrder != null ? sortOrder : DirectMessages.DEFAULT_SORT_ORDER));
return qb.build();
}
}
}
}

View File

@ -166,6 +166,7 @@ import org.mariotaku.twidere.provider.TweetStore.CachedTrends;
import org.mariotaku.twidere.provider.TweetStore.CachedUsers;
import org.mariotaku.twidere.provider.TweetStore.DNS;
import org.mariotaku.twidere.provider.TweetStore.DirectMessages;
import org.mariotaku.twidere.provider.TweetStore.DirectMessages.ConversationEntries;
import org.mariotaku.twidere.provider.TweetStore.Drafts;
import org.mariotaku.twidere.provider.TweetStore.Filters;
import org.mariotaku.twidere.provider.TweetStore.Filters.Users;
@ -3971,4 +3972,19 @@ public final class Utils implements Constants, TwitterConstants {
c.close();
}
}
public static ParcelableUser getUserForConversation(Context context, long accountId,
long conversationId) {
final ContentResolver cr = context.getContentResolver();
final Where where = Where.and(Where.equals(ConversationEntries.ACCOUNT_ID, accountId),
Where.equals(ConversationEntries.CONVERSATION_ID, conversationId));
final Cursor c = cr.query(ConversationEntries.CONTENT_URI, null, where.getSQL(), null, null);
try {
if (c.moveToFirst()) return ParcelableUser.fromDirectMessageConversationEntry(c);
} finally {
c.close();
}
return null;
}
}

View File

@ -23,6 +23,7 @@ import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.IdRes;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.Gravity;
@ -31,86 +32,88 @@ import android.widget.ImageView;
public class ProfileImageBannerLayout extends ExtendedFrameLayout {
public static final int VIEW_ID_PROFILE_IMAGE = 0x10000001;
public static final int VIEW_ID_PROFILE_BANNER = 0x10000002;
@IdRes
public static final int VIEW_ID_PROFILE_IMAGE = 0x10000001;
@IdRes
public static final int VIEW_ID_PROFILE_BANNER = 0x10000002;
private static final double PROFILE_IMAGE_WIDTH_FACTOR = 0.1425;
private static final double PROFILE_IMAGE_TOP_MARGIN_FACTOR = 0.0875;
private static final double PROFILE_IMAGE_WIDTH_FACTOR = 0.1425;
private static final double PROFILE_IMAGE_TOP_MARGIN_FACTOR = 0.0875;
private final int mBorderWidth;
private final ImageView mProfileBannerImageView;
private final ProfileImageView mProfileImageView;
private final int mBorderWidth;
private final ImageView mProfileBannerImageView;
private final ImageView mProfileImageView;
public ProfileImageBannerLayout(final Context context) {
this(context, null);
}
public ProfileImageBannerLayout(final Context context) {
this(context, null);
}
public ProfileImageBannerLayout(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public ProfileImageBannerLayout(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public ProfileImageBannerLayout(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
mBorderWidth = (int) (getResources().getDisplayMetrics().density * 2);
mProfileBannerImageView = new ProfileBannerImageView(context);
mProfileBannerImageView.setId(VIEW_ID_PROFILE_BANNER);
addView(mProfileBannerImageView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
mProfileImageView = new ProfileImageViewInternal(context, mBorderWidth);
mProfileImageView.setId(VIEW_ID_PROFILE_IMAGE);
addView(mProfileImageView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL));
}
public ProfileImageBannerLayout(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
mBorderWidth = (int) (getResources().getDisplayMetrics().density * 2);
mProfileBannerImageView = new ProfileBannerImageView(context);
mProfileBannerImageView.setId(VIEW_ID_PROFILE_BANNER);
addView(mProfileBannerImageView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
mProfileImageView = new ProfileImageViewInternal(context, mBorderWidth);
mProfileImageView.setId(VIEW_ID_PROFILE_IMAGE);
addView(mProfileImageView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL));
}
public ImageView getProfileBannerImageView() {
return mProfileBannerImageView;
}
public ImageView getProfileBannerImageView() {
return mProfileBannerImageView;
}
public ProfileImageView getProfileImageView() {
return mProfileImageView;
}
public ImageView getProfileImageView() {
return mProfileImageView;
}
@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec), height = width / 2;
setMeasuredDimension(width, height);
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
if (width > 0) {
final int profile_size = (int) (width * PROFILE_IMAGE_WIDTH_FACTOR);
final LayoutParams profile_lp = (FrameLayout.LayoutParams) mProfileImageView.getLayoutParams();
profile_lp.width = profile_size + mBorderWidth * 2;
profile_lp.height = profile_size + mBorderWidth * 2;
profile_lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
profile_lp.topMargin = (int) (height * PROFILE_IMAGE_TOP_MARGIN_FACTOR) - mBorderWidth;
mProfileImageView.setLayoutParams(profile_lp);
}
}
@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec), height = width / 2;
setMeasuredDimension(width, height);
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
if (width > 0) {
final int profile_size = (int) (width * PROFILE_IMAGE_WIDTH_FACTOR);
final LayoutParams profile_lp = (FrameLayout.LayoutParams) mProfileImageView.getLayoutParams();
profile_lp.width = profile_size + mBorderWidth * 2;
profile_lp.height = profile_size + mBorderWidth * 2;
profile_lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
profile_lp.topMargin = (int) (height * PROFILE_IMAGE_TOP_MARGIN_FACTOR) - mBorderWidth;
mProfileImageView.setLayoutParams(profile_lp);
}
}
private static class ProfileImageViewInternal extends ProfileImageView {
private static class ProfileImageViewInternal extends ImageView {
private final Paint mWhitePaint, mBlackPaint;
private final int mPaddings;
private final Paint mWhitePaint, mBlackPaint;
private final int mPaddings;
private ProfileImageViewInternal(final Context context, final int padding) {
super(context, null, 0);
ViewCompat.setLayerType(this, LAYER_TYPE_SOFTWARE, null);
mWhitePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mWhitePaint.setColor(Color.WHITE);
mBlackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBlackPaint.setColor(Color.BLACK);
mPaddings = padding;
setPadding(padding, padding, padding, padding);
}
private ProfileImageViewInternal(final Context context, final int padding) {
super(context, null, 0);
ViewCompat.setLayerType(this, LAYER_TYPE_SOFTWARE, null);
mWhitePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mWhitePaint.setColor(Color.WHITE);
mBlackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBlackPaint.setColor(Color.BLACK);
mPaddings = padding;
setPadding(padding, padding, padding, padding);
}
@Override
protected void onDraw(final Canvas canvas) {
canvas.drawColor(Color.WHITE);
final int width = getWidth(), height = getHeight();
if (width > 0 && height > 0) {
canvas.drawRect(mPaddings, mPaddings, width - mPaddings, height - mPaddings, mBlackPaint);
canvas.drawRect(mPaddings / 2, mPaddings / 2, width - mPaddings / 2, height - mPaddings / 2,
mWhitePaint);
}
super.onDraw(canvas);
}
}
@Override
protected void onDraw(final Canvas canvas) {
canvas.drawColor(Color.WHITE);
final int width = getWidth(), height = getHeight();
if (width > 0 && height > 0) {
canvas.drawRect(mPaddings, mPaddings, width - mPaddings, height - mPaddings, mBlackPaint);
canvas.drawRect(mPaddings / 2, mPaddings / 2, width - mPaddings / 2, height - mPaddings / 2,
mWhitePaint);
}
super.onDraw(canvas);
}
}
}

View File

@ -1,80 +0,0 @@
/*
* 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.view;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.graphic.DropShadowDrawable;
public class ProfileImageView extends CircularImageView {
private final Drawable mVerifiedDrawable, mProtectedDrawable;
private boolean mIsVerified;
private boolean mIsProtected;
public ProfileImageView(final Context context) {
this(context, null);
}
public ProfileImageView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public ProfileImageView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
final Resources res = context.getResources();
mVerifiedDrawable = new DropShadowDrawable(res, R.drawable.ic_user_type_verified, 4, 0xa0000000);
mProtectedDrawable = new DropShadowDrawable(res, R.drawable.ic_user_type_protected, 4, 0xa0000000);
}
public void setUserType(final boolean isVerified, final boolean isProtected) {
mIsVerified = isVerified;
mIsProtected = isProtected;
invalidate();
}
@Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
if (mIsVerified) {
mVerifiedDrawable.draw(canvas);
}
if (mIsProtected) {
mProtectedDrawable.draw(canvas);
}
}
@Override
protected void onSizeChanged(final int w, final int h, final int oldw, final int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
final int vw = mVerifiedDrawable.getIntrinsicWidth(), vh = mVerifiedDrawable.getIntrinsicHeight();
final int pw = mProtectedDrawable.getIntrinsicWidth(), ph = mProtectedDrawable.getIntrinsicHeight();
final int bottom = h, right = w;
mVerifiedDrawable.setBounds(right - vw, bottom - vh, right, bottom);
mProtectedDrawable.setBounds(right - pw, bottom - ph, right, bottom);
}
}

View File

@ -0,0 +1,62 @@
/*
* 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.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.ImageView;
public class SquareCircularImageView extends CircularImageView {
public SquareCircularImageView(final Context context) {
this(context, null);
}
public SquareCircularImageView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public SquareCircularImageView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec), height = MeasureSpec.getSize(heightMeasureSpec);
final ViewGroup.LayoutParams lp = getLayoutParams();
if (lp.height == ViewGroup.LayoutParams.MATCH_PARENT && lp.width == ViewGroup.LayoutParams.WRAP_CONTENT) {
super.onMeasure(heightMeasureSpec, heightMeasureSpec);
setMeasuredDimension(height, height);
} else if (lp.width == ViewGroup.LayoutParams.MATCH_PARENT && lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
setMeasuredDimension(width, width);
} else {
if (width > height) {
super.onMeasure(heightMeasureSpec, heightMeasureSpec);
setMeasuredDimension(height, height);
} else {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
setMeasuredDimension(width, width);
}
}
}
}

View File

@ -19,6 +19,8 @@
package org.mariotaku.twidere.view.holder;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@ -29,47 +31,43 @@ import org.mariotaku.twidere.R;
public class DirectMessageConversationViewHolder extends CardViewHolder {
public final ImageView incoming_profile_image, outgoing_profile_image;
public final View incoming_message_container, outgoing_message_container, incoming_profile_image_container,
outgoing_profile_image_container;
public final TextView incoming_text, incoming_time, outgoing_text, outgoing_time;
public final View incoming_item_menu, outgoing_item_menu;
public final View incoming_message_container, outgoing_message_container;
public final TextView incoming_text, incoming_time, outgoing_text, outgoing_time;
public final ImageView incoming_image_preview, outgoing_image_preview;
public final ViewGroup incoming_image_preview_container, outgoing_image_preview_container;
public final ProgressBar incoming_image_preview_progress, outgoing_image_preview_progress;
public final ImageView incoming_image_preview, outgoing_image_preview;
public final ViewGroup incoming_image_preview_container, outgoing_image_preview_container;
public final ProgressBar incoming_image_preview_progress, outgoing_image_preview_progress;
private float text_size;
private float text_size;
public DirectMessageConversationViewHolder(final View view) {
super(view);
incoming_message_container = findViewById(R.id.incoming_message_container);
outgoing_message_container = findViewById(R.id.outgoing_message_container);
incoming_profile_image_container = findViewById(R.id.incoming_profile_image_container);
outgoing_profile_image_container = findViewById(R.id.outgoing_profile_image_container);
incoming_profile_image = (ImageView) findViewById(R.id.incoming_profile_image);
outgoing_profile_image = (ImageView) findViewById(R.id.outgoing_profile_image);
incoming_text = (TextView) findViewById(R.id.incoming_text);
incoming_time = (TextView) findViewById(R.id.incoming_time);
outgoing_text = (TextView) findViewById(R.id.outgoing_text);
outgoing_time = (TextView) findViewById(R.id.outgoing_time);
incoming_item_menu = findViewById(R.id.incoming_item_menu);
outgoing_item_menu = findViewById(R.id.outgoing_item_menu);
outgoing_image_preview = (ImageView) findViewById(R.id.outgoing_image_preview);
outgoing_image_preview_progress = (ProgressBar) findViewById(R.id.outgoing_image_preview_progress);
outgoing_image_preview_container = (ViewGroup) findViewById(R.id.outgoing_image_preview_container);
incoming_image_preview = (ImageView) findViewById(R.id.incoming_image_preview);
incoming_image_preview_progress = (ProgressBar) findViewById(R.id.incoming_image_preview_progress);
incoming_image_preview_container = (ViewGroup) findViewById(R.id.incoming_image_preview_container);
}
public DirectMessageConversationViewHolder(final View view) {
super(view);
incoming_message_container = findViewById(R.id.incoming_message_container);
outgoing_message_container = findViewById(R.id.outgoing_message_container);
incoming_text = (TextView) findViewById(R.id.incoming_text);
incoming_time = (TextView) findViewById(R.id.incoming_time);
outgoing_text = (TextView) findViewById(R.id.outgoing_text);
outgoing_time = (TextView) findViewById(R.id.outgoing_time);
outgoing_image_preview = (ImageView) findViewById(R.id.outgoing_image_preview);
outgoing_image_preview_progress = (ProgressBar) findViewById(R.id.outgoing_image_preview_progress);
outgoing_image_preview_container = (ViewGroup) findViewById(R.id.outgoing_image_preview_container);
incoming_image_preview = (ImageView) findViewById(R.id.incoming_image_preview);
incoming_image_preview_progress = (ProgressBar) findViewById(R.id.incoming_image_preview_progress);
incoming_image_preview_container = (ViewGroup) findViewById(R.id.incoming_image_preview_container);
public void setTextSize(final float text_size) {
if (this.text_size != text_size) {
this.text_size = text_size;
incoming_text.setTextSize(text_size);
incoming_time.setTextSize(text_size * 0.75f);
outgoing_text.setTextSize(text_size);
outgoing_time.setTextSize(text_size * 0.75f);
}
}
final Drawable drawable = outgoing_message_container.getBackground();
if (drawable != null) {
drawable.setColorFilter(0x20009900, Mode.MULTIPLY);
}
}
public void setTextSize(final float text_size) {
if (this.text_size != text_size) {
this.text_size = text_size;
incoming_text.setTextSize(text_size);
incoming_time.setTextSize(text_size * 0.75f);
outgoing_text.setTextSize(text_size);
outgoing_time.setTextSize(text_size * 0.75f);
}
}
}

View File

@ -30,7 +30,6 @@ import android.widget.TextView;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.ProfileImageView;
import org.mariotaku.twidere.view.ShortTimeView;
import static org.mariotaku.twidere.util.Utils.getDisplayName;
@ -62,7 +61,7 @@ public class StatusListViewHolder extends CardViewHolder {
super(view);
final Context context = getContext();
profile_image = (ImageView) findViewById(R.id.profile_image);
my_profile_image = (ProfileImageView) findViewById(R.id.my_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_container = (ViewGroup) findViewById(R.id.image_preview_container);

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
style="?android:actionButtonStyle"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:padding="@dimen/element_spacing_msmall"
app:ignorePadding="true">
<org.mariotaku.twidere.view.SquareCircularImageView
android:id="@+id/sender_profile_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/element_spacing_minus_large"
android:layout_toRightOf="@+id/recipient_profile_image"
android:visibility="gone"/>
<org.mariotaku.twidere.view.SquareCircularImageView
android:id="@+id/recipient_profile_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"/>
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>

View File

@ -1,201 +1,203 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.CardItemLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small">
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_large"
android:paddingTop="@dimen/element_spacing_normal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_large"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginRight="@dimen/element_spacing_normal"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginRight="@dimen/element_spacing_normal"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</FrameLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</FrameLayout>
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/my_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_weight="0"
android:contentDescription="@string/my_profile_image"
android:scaleType="fitCenter"/>
</LinearLayout>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/my_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_weight="0"
android:contentDescription="@string/my_profile_image"
android:scaleType="fitCenter"/>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="#40808080"/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="#40808080"/>
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<org.mariotaku.twidere.view.ForegroundImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?android:selectableItemBackground"
android:scaleType="centerCrop"/>
<org.mariotaku.twidere.view.ForegroundImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?android:selectableItemBackground"
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_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<ProgressBar
android:id="@+id/image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/reply_retweet_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/element_spacing_small"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/reply_retweet_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/element_spacing_small"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
<LinearLayout
android:id="@+id/activity_profile_image_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small">
<LinearLayout
android:id="@+id/activity_profile_image_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small">
<ImageView
android:id="@+id/activity_profile_image_1"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_1"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_2"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_2"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_3"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_3"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_4"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_4"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_5"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_5"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/activity_profile_image_more_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</LinearLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/activity_profile_image_more_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</LinearLayout>
</org.mariotaku.twidere.view.CardItemLinearLayout>

View File

@ -1,208 +1,215 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.CardItemFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small">
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/element_spacing_normal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/my_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:contentDescription="@string/my_profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/my_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:contentDescription="@string/my_profile_image"
android:scaleType="fitCenter"/>
<FrameLayout
android:id="@+id/name_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/time_frame"
android:layout_toRightOf="@+id/profile_image">
<FrameLayout
android:id="@+id/name_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/time_frame"
android:layout_toRightOf="@+id/profile_image">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:gravity="center_vertical"
android:orientation="horizontal">
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</FrameLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/time_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/name_frame"
android:layout_alignTop="@+id/name_frame"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/my_profile_image"
android:paddingLeft="@dimen/element_spacing_small">
<FrameLayout
android:id="@+id/time_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/name_frame"
android:layout_alignTop="@+id/name_frame"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/my_profile_image"
android:paddingLeft="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</FrameLayout>
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</FrameLayout>
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/name_frame"
android:paddingTop="@dimen/element_spacing_small"
android:visibility="gone">
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/name_frame"
android:paddingTop="@dimen/element_spacing_small"
android:visibility="gone">
<org.mariotaku.twidere.view.ForegroundImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?android:selectableItemBackground"
android:scaleType="centerCrop"/>
<org.mariotaku.twidere.view.ForegroundImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?android:selectableItemBackground"
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_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<ProgressBar
android:id="@+id/image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/image_preview_container"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/image_preview_container"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/reply_retweet_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/text"
android:drawablePadding="4dp"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/reply_retweet_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/text"
android:drawablePadding="4dp"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
<LinearLayout
android:id="@+id/activity_profile_image_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_alignWithParentIfMissing="true"
android:layout_below="@+id/reply_retweet_status"
android:layout_toRightOf="@+id/profile_image"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small">
<LinearLayout
android:id="@+id/activity_profile_image_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_alignWithParentIfMissing="true"
android:layout_below="@+id/reply_retweet_status"
android:layout_toRightOf="@+id/profile_image"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small">
<ImageView
android:id="@+id/activity_profile_image_1"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/activity_profile_image_1"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_2"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/activity_profile_image_2"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_3"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/activity_profile_image_3"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_4"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/activity_profile_image_4"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<ImageView
android:id="@+id/activity_profile_image_5"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/activity_profile_image_5"
android:layout_width="@dimen/profile_image_size_activity_small"
android:layout_height="@dimen/profile_image_size_activity_small"
android:layout_margin="2dp"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/activity_profile_image_more_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</LinearLayout>
</RelativeLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/activity_profile_image_more_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</LinearLayout>
</RelativeLayout>
</org.mariotaku.twidere.view.CardItemFrameLayout>

View File

@ -1,180 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:padding="8dp">
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:padding="8dp">
<RelativeLayout
android:id="@+id/incoming_message_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left">
<org.mariotaku.twidere.view.MessageCardItemFrameLayout
android:id="@+id/incoming_message_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:background="?cardItemMessageIncomingBackground">
<FrameLayout
android:id="@+id/incoming_profile_image_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/incoming_message_content_frame"
android:layout_marginRight="-12.5dp"
android:background="?cardItemMessageProfileImageIncomingBackground">
<LinearLayout
android:id="@+id/incoming_message_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="@dimen/icon_size_card_list_item"
android:orientation="vertical"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/incoming_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:scaleType="fitCenter"/>
</FrameLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/incoming_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.MessageCardItemFrameLayout
android:id="@+id/incoming_message_content_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@+id/incoming_profile_image_container"
android:background="?cardItemMessageIncomingBackground">
<org.mariotaku.twidere.view.SquareFrameLayout
android:id="@+id/incoming_image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingTop="@dimen/element_spacing_small"
android:visibility="gone">
<LinearLayout
android:id="@+id/incoming_message_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="@dimen/icon_size_card_list_item"
android:orientation="vertical"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/incoming_image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/incoming_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="16dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<ProgressBar
android:id="@+id/incoming_image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
</org.mariotaku.twidere.view.SquareFrameLayout>
<org.mariotaku.twidere.view.SquareFrameLayout
android:id="@+id/incoming_image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingTop="@dimen/element_spacing_small"
android:visibility="gone">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/incoming_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</org.mariotaku.twidere.view.MessageCardItemFrameLayout>
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/incoming_image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.MessageCardItemFrameLayout
android:id="@+id/outgoing_message_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="?cardItemMessageOutgoingBackground">
<ProgressBar
android:id="@+id/incoming_image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
</org.mariotaku.twidere.view.SquareFrameLayout>
<LinearLayout
android:id="@+id/outgoing_message_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="@dimen/icon_size_card_list_item"
android:orientation="vertical"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/incoming_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</org.mariotaku.twidere.view.MessageCardItemFrameLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/outgoing_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.ListMenuOverflowButton
android:id="@+id/incoming_item_menu"
android:layout_width="@dimen/item_menu_width_default"
android:layout_height="@dimen/item_menu_height_default"
android:layout_alignRight="@+id/incoming_message_content_frame"
android:layout_alignTop="@+id/incoming_message_content_frame"
android:clickable="true"/>
</RelativeLayout>
<org.mariotaku.twidere.view.SquareFrameLayout
android:id="@+id/outgoing_image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingTop="@dimen/element_spacing_small"
android:visibility="gone">
<RelativeLayout
android:id="@+id/outgoing_message_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/outgoing_image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"/>
<FrameLayout
android:id="@+id/outgoing_profile_image_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/outgoing_message_content_container"
android:layout_alignParentRight="true"
android:layout_marginLeft="-12.5dp"
android:background="?cardItemMessageProfileImageOutgoingBackground">
<ProgressBar
android:id="@+id/outgoing_image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
</org.mariotaku.twidere.view.SquareFrameLayout>
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/outgoing_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:scaleType="fitCenter"/>
</FrameLayout>
<org.mariotaku.twidere.view.MessageCardItemFrameLayout
android:id="@+id/outgoing_message_content_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/outgoing_profile_image_container"
android:background="?cardItemMessageOutgoingBackground">
<LinearLayout
android:id="@+id/outgoing_message_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="@dimen/icon_size_card_list_item"
android:orientation="vertical"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/outgoing_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.SquareFrameLayout
android:id="@+id/outgoing_image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingTop="@dimen/element_spacing_small"
android:visibility="gone">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/outgoing_image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"/>
<ProgressBar
android:id="@+id/outgoing_image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
</org.mariotaku.twidere.view.SquareFrameLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/outgoing_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</org.mariotaku.twidere.view.MessageCardItemFrameLayout>
<org.mariotaku.twidere.view.ListMenuOverflowButton
android:id="@+id/outgoing_item_menu"
android:layout_width="@dimen/item_menu_width_default"
android:layout_height="@dimen/item_menu_height_default"
android:layout_alignLeft="@+id/outgoing_message_content_container"
android:layout_alignTop="@+id/outgoing_message_content_container"
android:clickable="true"/>
</RelativeLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/outgoing_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</org.mariotaku.twidere.view.MessageCardItemFrameLayout>
</FrameLayout>

View File

@ -1,94 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.CardItemLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.DirectMessagesEntryAdapter">
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.DirectMessagesEntryAdapter">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="8dp">
<org.mariotaku.twidere.view.ForegroundImageView
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginRight="8dp"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginRight="8dp"
android:layout_weight="0"
android:contentDescription="@string/profile_image"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</FrameLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</FrameLayout>
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:drawablePadding="4dp"
android:gravity="center"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:drawablePadding="4dp"
android:gravity="center"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</LinearLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="#40808080"/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="#40808080"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="8dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="8dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</org.mariotaku.twidere.view.CardItemLinearLayout>

View File

@ -1,152 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.CardItemLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.CursorStatusesAdapter">
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.CursorStatusesAdapter">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_xlarge"
android:paddingTop="@dimen/element_spacing_normal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_xlarge"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginRight="@dimen/element_spacing_normal"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:scaleType="centerCrop"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginRight="@dimen/element_spacing_normal"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:scaleType="centerCrop"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</FrameLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
</FrameLayout>
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/my_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_weight="0"
android:contentDescription="@string/my_profile_image"
android:scaleType="fitCenter"/>
</LinearLayout>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/my_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_weight="0"
android:contentDescription="@string/my_profile_image"
android:scaleType="fitCenter"/>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="#40808080"/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="#40808080"/>
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"/>
<ProgressBar
android:id="@+id/image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
<ProgressBar
android:id="@+id/image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
<TextView
android:id="@+id/image_preview_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="@dimen/element_spacing_normal"
android:shadowColor="#000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="3.0"
android:textColor="#ffffff"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<TextView
android:id="@+id/image_preview_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="@dimen/element_spacing_normal"
android:shadowColor="#000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="3.0"
android:textColor="#ffffff"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/reply_retweet_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/element_spacing_small"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/reply_retweet_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/element_spacing_small"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</org.mariotaku.twidere.view.CardItemLinearLayout>

View File

@ -1,160 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.CardItemFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.CursorStatusesAdapter">
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.CursorStatusesAdapter">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/item_menu_card_padding_compact"
android:paddingTop="@dimen/element_spacing_normal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/item_menu_card_padding_compact"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"
android:scaleType="centerCrop"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"
android:scaleType="centerCrop"/>
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/my_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:contentDescription="@string/my_profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/my_profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:contentDescription="@string/my_profile_image"
android:scaleType="fitCenter"/>
<FrameLayout
android:id="@+id/name_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/time_frame"
android:layout_toRightOf="@+id/profile_image">
<FrameLayout
android:id="@+id/name_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/time_frame"
android:layout_toRightOf="@+id/profile_image">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:gravity="center_vertical"
android:orientation="horizontal">
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</FrameLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/screen_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/time_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/name_frame"
android:layout_alignTop="@+id/name_frame"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/my_profile_image"
android:paddingLeft="@dimen/element_spacing_small">
<FrameLayout
android:id="@+id/time_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/name_frame"
android:layout_alignTop="@+id/name_frame"
android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/my_profile_image"
android:paddingLeft="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</FrameLayout>
<org.mariotaku.twidere.view.ShortTimeView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</FrameLayout>
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/name_frame"
android:paddingTop="@dimen/element_spacing_small"
android:visibility="gone">
<org.mariotaku.twidere.view.ImagePreviewContainer
android:id="@+id/image_preview_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/name_frame"
android:paddingTop="@dimen/element_spacing_small"
android:visibility="gone">
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<org.mariotaku.twidere.view.HighlightImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
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_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
<ProgressBar
android:id="@+id/image_preview_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_large"/>
<TextView
android:id="@+id/image_preview_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="@dimen/element_spacing_normal"
android:shadowColor="#000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="3.0"
android:textColor="#ffffff"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<TextView
android:id="@+id/image_preview_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="@dimen/element_spacing_normal"
android:shadowColor="#000000"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="3.0"
android:textColor="#ffffff"/>
</org.mariotaku.twidere.view.ImagePreviewContainer>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/image_preview_container"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/image_preview_container"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/reply_retweet_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/text"
android:drawablePadding="4dp"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</RelativeLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/reply_retweet_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_alignRight="@+id/time_frame"
android:layout_below="@+id/text"
android:drawablePadding="4dp"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"/>
</RelativeLayout>
</org.mariotaku.twidere.view.CardItemFrameLayout>

View File

@ -1,101 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.CardItemLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.ParcelableUserListsAdapter">
<org.mariotaku.twidere.view.CardItemLinearLayout
android:id="@+id/content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_small"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_small"
tools:context=".adapter.ParcelableUserListsAdapter">
<LinearLayout
android:id="@+id/profile_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_xlarge"
android:paddingTop="@dimen/element_spacing_normal">
<LinearLayout
android:id="@+id/profile_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_xlarge"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_normal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/created_by"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</LinearLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/created_by"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="#40808080"/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="#40808080"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/members_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_following"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/members_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_following"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/subscribers_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_followers"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/subscribers_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_followers"
android:drawablePadding="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
</org.mariotaku.twidere.view.CardItemLinearLayout>

View File

@ -1,109 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.CardItemFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/element_spacing_small"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:layout_marginTop="@dimen/element_spacing_small"
tools:context=".adapter.ParcelableUsersAdapter">
<org.mariotaku.twidere.view.CardItemFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/element_spacing_small"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:layout_marginTop="@dimen/element_spacing_small"
tools:context=".adapter.ParcelableUsersAdapter">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/item_menu_card_padding_compact"
android:paddingTop="@dimen/element_spacing_normal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/item_menu_card_padding_compact"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<org.mariotaku.twidere.view.CircularImageView
style="?profileImageStyle"
android:id="@+id/profile_image"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<FrameLayout
android:id="@+id/name_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@+id/profile_image">
<FrameLayout
android:id="@+id/name_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@+id/profile_image">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:gravity="center_vertical"
android:orientation="horizontal">
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"/>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/created_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</FrameLayout>
<org.mariotaku.twidere.view.HandleSpanClickTextView
android:id="@+id/created_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
</FrameLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_below="@+id/name_frame"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name_frame"
android:layout_below="@+id/name_frame"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/description"
android:layout_below="@+id/description"
android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/description"
android:layout_below="@+id/description"
android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/members_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_following"
android:drawablePadding="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/members_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_following"
android:drawablePadding="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/subscribers_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_followers"
android:drawablePadding="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
</RelativeLayout>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/subscribers_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_followers"
android:drawablePadding="4dp"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
</RelativeLayout>
</org.mariotaku.twidere.view.CardItemFrameLayout>

View File

@ -141,7 +141,10 @@
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginBottom="@dimen/element_spacing_normal"
android:layout_marginLeft="@dimen/element_spacing_large"
android:layout_marginRight="@dimen/element_spacing_large"
android:layout_marginTop="@dimen/element_spacing_normal"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textIsSelectable="true"/>
@ -190,26 +193,30 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="@dimen/button_bar_height"
android:orientation="horizontal">
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:orientation="horizontal"
android:splitMotionEvents="false">
<LinearLayout
android:id="@+id/replies_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:baselineAligned="true"
android:clickable="true"
android:gravity="center"
android:minWidth="@dimen/button_width_content_min"
android:orientation="vertical"
android:padding="@dimen/element_spacing_small">
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/replies_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:textAppearanceMedium"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
@ -224,20 +231,21 @@
<LinearLayout
android:id="@+id/retweets_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:baselineAligned="true"
android:clickable="true"
android:gravity="center"
android:minWidth="@dimen/button_width_content_min"
android:orientation="vertical"
android:padding="@dimen/element_spacing_small">
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/retweets_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:textAppearanceMedium"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
@ -252,20 +260,21 @@
<LinearLayout
android:id="@+id/favorites_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:baselineAligned="true"
android:clickable="true"
android:gravity="center"
android:minWidth="@dimen/button_width_content_min"
android:orientation="vertical"
android:padding="@dimen/element_spacing_small">
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/favorites_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:textAppearanceMedium"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
@ -283,6 +292,7 @@
android:id="@+id/menu_bar"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
android:splitMotionEvents="false"
app:maxActionItems="@integer/max_action_buttons_bottom"/>
</LinearLayout>

View File

@ -25,23 +25,6 @@
<!--android:layout_alignBottom="@+id/card"-->
<!--android:layout_alignTop="@+id/profile_name_container"/>-->
<!--<FrameLayout-->
<!--android:id="@+id/profile_image_container"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignBottom="@+id/profile_name_container"-->
<!--android:layout_marginLeft="@dimen/element_spacing_normal"-->
<!--android:background="?cardItemBackground">-->
<!--<org.mariotaku.twidere.view.ProfileImageView-->
<!--android:id="@+id/profile_image"-->
<!--android:layout_width="@dimen/icon_size_user_profile"-->
<!--android:layout_height="@dimen/icon_size_user_profile"-->
<!--android:contentDescription="@string/profile_image"-->
<!--android:scaleType="centerCrop"-->
<!--android:src="@drawable/ic_profile_image_default"/>-->
<!--</FrameLayout>-->
<org.mariotaku.twidere.view.CircularImageView
android:id="@+id/profile_image"
style="?profileImageStyleLarge"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
android:id="@+id/account_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/account_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
@ -19,8 +19,9 @@
android:orientation="horizontal"
android:padding="@dimen/element_spacing_small">
<ImageView
<org.mariotaku.twidere.view.CircularImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_list_item_small"
android:layout_height="@dimen/icon_size_list_item_small"
android:layout_weight="0"

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/item_profile_image"
android:actionLayout="@layout/action_item_messages_conversation_profile_image"
android:showAsAction="always"
android:title="@string/user"/>
</menu>

View File

@ -16,6 +16,7 @@
<dimen name="element_spacing_xlarge">24dp</dimen>
<dimen name="element_spacing_minus_small">-4dp</dimen>
<dimen name="element_spacing_minus_normal">-8dp</dimen>
<dimen name="element_spacing_minus_large">-16dp</dimen>
<dimen name="icon_size_list_item">56dp</dimen>
<dimen name="icon_size_list_item_small">42dp</dimen>
<dimen name="icon_size_card_list_item">48dp</dimen>