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

implementing group

This commit is contained in:
Mariotaku Lee 2016-03-09 15:52:37 +08:00
parent 0960f81b98
commit 877e5296a6
35 changed files with 1134 additions and 671 deletions

View File

@ -92,6 +92,7 @@ public interface TwidereConstants extends SharedPreferenceConstants, IntentConst
String AUTHORITY_USER_LIST_SUBSCRIBERS = "user_list_subscribers";
String AUTHORITY_USER_LIST_MEMBERSHIPS = "user_list_memberships";
String AUTHORITY_USER_LISTS = "user_lists";
String AUTHORITY_USER_GROUPS = "user_groups";
String AUTHORITY_USERS_RETWEETED_STATUS = "users_retweeted_status";
String AUTHORITY_SAVED_SEARCHES = "saved_searches";
String AUTHORITY_SEARCH_USERS = "search_users";

View File

@ -18,7 +18,7 @@ public class Group {
@JsonField(name = "nickname")
String nickname;
@JsonField(name = "admin_count")
int adminCount;
long adminCount;
@JsonField(name = "created", typeConverter = TwitterDateConverter.class)
Date created;
@JsonField(name = "id")
@ -34,7 +34,7 @@ public class Group {
@JsonField(name = "url")
String url;
@JsonField(name = "member_count")
int memberCount;
long memberCount;
@JsonField(name = "blocked")
boolean blocked;
@JsonField(name = "stream_logo")
@ -56,7 +56,7 @@ public class Group {
return nickname;
}
public int getAdminCount() {
public long getAdminCount() {
return adminCount;
}
@ -88,7 +88,7 @@ public class Group {
return url;
}
public int getMemberCount() {
public long getMemberCount() {
return memberCount;
}
@ -115,4 +115,27 @@ public class Group {
public String getLocation() {
return location;
}
@Override
public String toString() {
return "Group{" +
"modified=" + modified +
", nickname='" + nickname + '\'' +
", adminCount=" + adminCount +
", created=" + created +
", id=" + id +
", homepage='" + homepage + '\'' +
", fullname='" + fullname + '\'' +
", homepageLogo='" + homepageLogo + '\'' +
", miniLogo='" + miniLogo + '\'' +
", url='" + url + '\'' +
", memberCount=" + memberCount +
", blocked=" + blocked +
", streamLogo='" + streamLogo + '\'' +
", member=" + member +
", description='" + description + '\'' +
", originalLogo='" + originalLogo + '\'' +
", location='" + location + '\'' +
'}';
}
}

View File

@ -0,0 +1,126 @@
package org.mariotaku.twidere.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.hannesdorfmann.parcelableplease.annotation.ParcelablePlease;
import com.hannesdorfmann.parcelableplease.annotation.ParcelableThisPlease;
import org.mariotaku.twidere.api.twitter.util.TwitterDateConverter;
import java.util.Date;
/**
* Created by mariotaku on 16/3/9.
*/
@ParcelablePlease
@JsonObject
public class ParcelableGroup implements Parcelable {
@ParcelableThisPlease
@JsonField(name = "account_key")
public UserKey account_key;
@ParcelableThisPlease
@JsonField(name = "id")
public long id;
@ParcelableThisPlease
@JsonField(name = "nickname")
public String nickname;
@ParcelableThisPlease
@JsonField(name = "homepage")
public String homepage;
@ParcelableThisPlease
@JsonField(name = "fullname")
public String fullname;
@ParcelableThisPlease
@JsonField(name = "url")
public String url;
@ParcelableThisPlease
@JsonField(name = "description")
public String description;
@ParcelableThisPlease
@JsonField(name = "location")
public String location;
@ParcelableThisPlease
@JsonField(name = "created")
public long created;
@ParcelableThisPlease
@JsonField(name = "modified")
public long modified;
@ParcelableThisPlease
@JsonField(name = "admin_count")
public long admin_count;
@ParcelableThisPlease
@JsonField(name = "member_count")
public long member_count;
@ParcelableThisPlease
@JsonField(name = "original_logo")
public String original_logo;
@ParcelableThisPlease
@JsonField(name = "homepage_logo")
public String homepage_logo;
@ParcelableThisPlease
@JsonField(name = "stream_logo")
public String stream_logo;
@ParcelableThisPlease
@JsonField(name = "mini_logo")
public String mini_logo;
@ParcelableThisPlease
@JsonField(name = "blocked")
public boolean blocked;
@ParcelableThisPlease
@JsonField(name = "member")
public boolean member;
@Override
public String toString() {
return "ParcelableGroup{" +
"account_key=" + account_key +
", id=" + id +
", nickname='" + nickname + '\'' +
", homepage='" + homepage + '\'' +
", fullname='" + fullname + '\'' +
", url='" + url + '\'' +
", description='" + description + '\'' +
", location='" + location + '\'' +
", created=" + created +
", modified=" + modified +
", admin_count=" + admin_count +
", member_count=" + member_count +
", original_logo='" + original_logo + '\'' +
", homepage_logo='" + homepage_logo + '\'' +
", stream_logo='" + stream_logo + '\'' +
", mini_logo='" + mini_logo + '\'' +
", blocked=" + blocked +
", member=" + member +
'}';
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
ParcelableGroupParcelablePlease.writeToParcel(this, dest, flags);
}
public static final Creator<ParcelableGroup> CREATOR = new Creator<ParcelableGroup>() {
public ParcelableGroup createFromParcel(Parcel source) {
ParcelableGroup target = new ParcelableGroup();
ParcelableGroupParcelablePlease.readFromParcel(target, source);
return target;
}
public ParcelableGroup[] newArray(int size) {
return new ParcelableGroup[size];
}
};
}

View File

@ -0,0 +1,9 @@
package org.mariotaku.twidere.fragment.support;
import android.support.v4.app.Fragment;
/**
* Created by mariotaku on 16/3/9.
*/
public class UserGroupsFragment extends Fragment {
}

View File

@ -57,6 +57,7 @@ public interface Constants extends TwidereConstants {
int LINK_ID_USER_LIST_MEMBERS = 13;
int LINK_ID_USER_LIST_SUBSCRIBERS = 14;
int LINK_ID_USER_LIST_MEMBERSHIPS = 15;
int LINK_ID_USER_GROUPS = 16;
int LINK_ID_SAVED_SEARCHES = 19;
int LINK_ID_USER_MENTIONS = 21;
int LINK_ID_INCOMING_FRIENDSHIPS = 22;

View File

@ -66,17 +66,17 @@ public abstract class AbsActivitiesAdapter<Data> extends LoadMoreSupportAdapter<
public static final int ITEM_VIEW_TYPE_STATUS = 4;
public static final int ITEM_VIEW_TYPE_EMPTY = 5;
final LayoutInflater mInflater;
final MediaLoadingHandler mLoadingHandler;
final int mCardBackgroundColor;
final boolean mCompactCards;
final DummyStatusHolderAdapter mStatusAdapterDelegate;
final EventListener mEventListener;
ActivityAdapterListener mActivityAdapterListener;
private final LayoutInflater mInflater;
private final MediaLoadingHandler mLoadingHandler;
private final int mCardBackgroundColor;
private final boolean mCompactCards;
private final DummyStatusHolderAdapter mStatusAdapterDelegate;
private final EventListener mEventListener;
private ActivityAdapterListener mActivityAdapterListener;
long[] mFilteredUserIds;
boolean mFollowingOnly;
boolean mMentionsOnly;
private long[] mFilteredUserIds;
private boolean mFollowingOnly;
private boolean mMentionsOnly;
protected AbsActivitiesAdapter(final Context context, boolean compact) {
@ -116,8 +116,9 @@ public abstract class AbsActivitiesAdapter<Data> extends LoadMoreSupportAdapter<
return mLoadingHandler;
}
@Nullable
@Override
public ActivityClickListener getActivityClickListener() {
public IActivitiesAdapter.ActivityAdapterListener getActivityClickListener() {
return mEventListener;
}
@ -399,7 +400,7 @@ public abstract class AbsActivitiesAdapter<Data> extends LoadMoreSupportAdapter<
}
static class EventListener implements IStatusViewHolder.StatusClickListener, GapClickListener,
ActivityClickListener {
IActivitiesAdapter.ActivityAdapterListener {
final WeakReference<AbsActivitiesAdapter<?>> adapterRef;

View File

@ -0,0 +1,184 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.adapter;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.adapter.iface.IGroupsAdapter;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.holder.GroupViewHolder;
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder;
public abstract class AbsGroupsAdapter<D> extends LoadMoreSupportAdapter<ViewHolder> implements Constants,
IGroupsAdapter<D> {
public static final int ITEM_VIEW_TYPE_USER_LIST = 2;
private final LayoutInflater mInflater;
private final int mCardBackgroundColor;
private final int mProfileImageStyle;
private final int mTextSize;
private final boolean mDisplayProfileImage;
private final boolean mShowAbsoluteTime;
private final boolean mNameFirst;
private final EventListener mEventListener;
private GroupAdapterListener mGroupAdapterListener;
public AbsGroupsAdapter(final Context context) {
super(context);
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context,
ThemeUtils.getThemeBackgroundOption(context),
ThemeUtils.getUserThemeBackgroundAlpha(context));
mEventListener = new EventListener(this);
mInflater = LayoutInflater.from(context);
mTextSize = mPreferences.getInt(KEY_TEXT_SIZE, context.getResources().getInteger(R.integer.default_text_size));
mProfileImageStyle = Utils.getProfileImageStyle(mPreferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
mDisplayProfileImage = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
mNameFirst = mPreferences.getBoolean(KEY_NAME_FIRST, true);
mShowAbsoluteTime = mPreferences.getBoolean(KEY_SHOW_ABSOLUTE_TIME, false);
}
@Override
public int getProfileImageStyle() {
return mProfileImageStyle;
}
@Override
public float getTextSize() {
return mTextSize;
}
@Override
public boolean isProfileImageEnabled() {
return mDisplayProfileImage;
}
@Override
public boolean isNameFirst() {
return mNameFirst;
}
public abstract D getData();
@Override
public boolean isShowAbsoluteTime() {
return mShowAbsoluteTime;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
switch (viewType) {
case ITEM_VIEW_TYPE_USER_LIST: {
final View view;
view = mInflater.inflate(R.layout.card_item_user_list_compact, parent, false);
final View itemContent = view.findViewById(R.id.item_content);
itemContent.setBackgroundColor(mCardBackgroundColor);
final GroupViewHolder holder = new GroupViewHolder(this, view);
holder.setOnClickListeners();
holder.setupViewOptions();
return holder;
}
case ITEM_VIEW_TYPE_LOAD_INDICATOR: {
final View view = mInflater.inflate(R.layout.card_item_load_indicator, parent, false);
return new LoadIndicatorViewHolder(view);
}
}
throw new IllegalStateException("Unknown view type " + viewType);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
switch (holder.getItemViewType()) {
case ITEM_VIEW_TYPE_USER_LIST: {
bindGroup(((GroupViewHolder) holder), position);
break;
}
}
}
@Override
public int getItemViewType(int position) {
if ((getLoadMoreIndicatorPosition() & IndicatorPosition.START) != 0 && position == 0) {
return ITEM_VIEW_TYPE_LOAD_INDICATOR;
}
if (position == getGroupsCount()) {
return ITEM_VIEW_TYPE_LOAD_INDICATOR;
}
return ITEM_VIEW_TYPE_USER_LIST;
}
public void setListener(GroupAdapterListener groupAdapterListener) {
mGroupAdapterListener = groupAdapterListener;
}
@Override
public boolean shouldShowAccountsColor() {
return false;
}
protected abstract void bindGroup(GroupViewHolder holder, int position);
@Nullable
@Override
public IGroupsAdapter.GroupAdapterListener getGroupAdapterListener() {
return mEventListener;
}
public interface GroupAdapterListener {
void onGroupClick(GroupViewHolder holder, int position);
boolean onGroupLongClick(GroupViewHolder holder, int position);
}
static class EventListener implements IGroupsAdapter.GroupAdapterListener {
private final AbsGroupsAdapter<?> mAdapter;
public EventListener(AbsGroupsAdapter<?> adapter) {
mAdapter = adapter;
}
@Override
public void onGroupClick(GroupViewHolder holder, int position) {
final GroupAdapterListener listener = mAdapter.mGroupAdapterListener;
if (listener == null) return;
listener.onGroupClick(holder, position);
}
@Override
public boolean onGroupLongClick(GroupViewHolder holder, int position) {
final GroupAdapterListener listener = mAdapter.mGroupAdapterListener;
return listener != null && listener.onGroupLongClick(holder, position);
}
}
}

View File

@ -20,7 +20,7 @@
package org.mariotaku.twidere.adapter;
import android.content.Context;
import android.support.v7.widget.CardView;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
@ -42,24 +42,28 @@ public abstract class AbsUserListsAdapter<D> extends LoadMoreSupportAdapter<View
private final LayoutInflater mInflater;
private final int mCardBackgroundColor;
private final boolean mCompactCards;
private final int mProfileImageStyle;
private final int mTextSize;
private final boolean mDisplayProfileImage;
private final boolean mShowAbsoluteTime;
private final boolean mNameFirst;
private final EventListener mEventListener;
public AbsUserListsAdapter(final Context context, final boolean compact) {
private UserListAdapterListener mUserListAdapterListener;
public AbsUserListsAdapter(final Context context) {
super(context);
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context, ThemeUtils.getThemeBackgroundOption(context), ThemeUtils.getUserThemeBackgroundAlpha(context));
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context,
ThemeUtils.getThemeBackgroundOption(context),
ThemeUtils.getUserThemeBackgroundAlpha(context));
mEventListener = new EventListener(this);
mInflater = LayoutInflater.from(context);
mTextSize = mPreferences.getInt(KEY_TEXT_SIZE, context.getResources().getInteger(R.integer.default_text_size));
mProfileImageStyle = Utils.getProfileImageStyle(mPreferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
mDisplayProfileImage = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
mNameFirst = mPreferences.getBoolean(KEY_NAME_FIRST, true);
mShowAbsoluteTime = mPreferences.getBoolean(KEY_SHOW_ABSOLUTE_TIME, false);
mCompactCards = compact;
}
@Override
@ -72,7 +76,6 @@ public abstract class AbsUserListsAdapter<D> extends LoadMoreSupportAdapter<View
return mTextSize;
}
@Override
public boolean isProfileImageEnabled() {
return mDisplayProfileImage;
@ -85,10 +88,6 @@ public abstract class AbsUserListsAdapter<D> extends LoadMoreSupportAdapter<View
public abstract D getData();
public boolean isUserList(int position) {
return position < getUserListsCount();
}
@Override
public boolean isShowAbsoluteTime() {
return mShowAbsoluteTime;
@ -99,15 +98,9 @@ public abstract class AbsUserListsAdapter<D> extends LoadMoreSupportAdapter<View
switch (viewType) {
case ITEM_VIEW_TYPE_USER_LIST: {
final View view;
if (mCompactCards) {
view = mInflater.inflate(R.layout.card_item_user_list_compact, parent, false);
final View itemContent = view.findViewById(R.id.item_content);
itemContent.setBackgroundColor(mCardBackgroundColor);
} else {
view = mInflater.inflate(R.layout.card_item_user_list, parent, false);
final CardView cardView = (CardView) view.findViewById(R.id.card);
cardView.setCardBackgroundColor(mCardBackgroundColor);
}
view = mInflater.inflate(R.layout.card_item_user_list_compact, parent, false);
final View itemContent = view.findViewById(R.id.item_content);
itemContent.setBackgroundColor(mCardBackgroundColor);
final UserListViewHolder holder = new UserListViewHolder(this, view);
holder.setOnClickListeners();
holder.setupViewOptions();
@ -135,33 +128,13 @@ public abstract class AbsUserListsAdapter<D> extends LoadMoreSupportAdapter<View
public int getItemViewType(int position) {
if ((getLoadMoreIndicatorPosition() & IndicatorPosition.START) != 0 && position == 0) {
return ITEM_VIEW_TYPE_LOAD_INDICATOR;
} if (position == getUserListsCount()) {
}
if (position == getUserListsCount()) {
return ITEM_VIEW_TYPE_LOAD_INDICATOR;
}
return ITEM_VIEW_TYPE_USER_LIST;
}
@Override
public void onItemActionClick(ViewHolder holder, int id, int position) {
}
@Override
public void onItemMenuClick(ViewHolder holder, View menuView, int position) {
}
@Override
public void onUserListClick(UserListViewHolder holder, int position) {
if (mUserListAdapterListener == null) return;
mUserListAdapterListener.onUserListClick(holder, position);
}
@Override
public boolean onUserListLongClick(UserListViewHolder holder, int position) {
return mUserListAdapterListener != null && mUserListAdapterListener.onUserListLongClick(holder, position);
}
public void setListener(UserListAdapterListener userListAdapterListener) {
mUserListAdapterListener = userListAdapterListener;
}
@ -173,8 +146,11 @@ public abstract class AbsUserListsAdapter<D> extends LoadMoreSupportAdapter<View
protected abstract void bindUserList(UserListViewHolder holder, int position);
private UserListAdapterListener mUserListAdapterListener;
@Nullable
@Override
public IUserListsAdapter.UserListAdapterListener getUserListAdapterListener() {
return mEventListener;
}
public interface UserListAdapterListener {
@ -183,4 +159,26 @@ public abstract class AbsUserListsAdapter<D> extends LoadMoreSupportAdapter<View
boolean onUserListLongClick(UserListViewHolder holder, int position);
}
static class EventListener implements IUserListsAdapter.UserListAdapterListener {
private final AbsUserListsAdapter<?> mAdapter;
public EventListener(AbsUserListsAdapter<?> adapter) {
mAdapter = adapter;
}
@Override
public void onUserListClick(UserListViewHolder holder, int position) {
final UserListAdapterListener listener = mAdapter.mUserListAdapterListener;
if (listener == null) return;
listener.onUserListClick(holder, position);
}
@Override
public boolean onUserListLongClick(UserListViewHolder holder, int position) {
final UserListAdapterListener listener = mAdapter.mUserListAdapterListener;
return listener != null && listener.onUserListLongClick(holder, position);
}
}
}

View File

@ -20,6 +20,7 @@
package org.mariotaku.twidere.adapter;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.View;
@ -126,6 +127,7 @@ public abstract class AbsUsersAdapter<D> extends LoadMoreSupportAdapter<ViewHold
return ITEM_VIEW_TYPE_USER;
}
@Nullable
@Override
public UserAdapterListener getUserAdapterListener() {
return mUserAdapterListener;

View File

@ -14,7 +14,7 @@ import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder;
/**
* Created by mariotaku on 14/11/19.
*/
public class ListParcelableStatusesAdapter extends AbsParcelableStatusesAdapter {
public class ListParcelableStatusesAdapter extends ParcelableStatusesAdapter {
public ListParcelableStatusesAdapter(Context context, boolean compact) {
super(context, compact);

View File

@ -33,10 +33,10 @@ import java.util.List;
/**
* Created by mariotaku on 15/10/26.
*/
public abstract class AbsParcelableStatusesAdapter extends AbsStatusesAdapter<List<ParcelableStatus>> {
public abstract class ParcelableStatusesAdapter extends AbsStatusesAdapter<List<ParcelableStatus>> {
private List<ParcelableStatus> mData;
public AbsParcelableStatusesAdapter(Context context, boolean compact) {
public ParcelableStatusesAdapter(Context context, boolean compact) {
super(context, compact);
setHasStableIds(true);
}

View File

@ -31,8 +31,8 @@ public class ParcelableUserListsAdapter extends AbsUserListsAdapter<List<Parcela
private List<ParcelableUserList> mData;
public ParcelableUserListsAdapter(Context context, boolean compact) {
super(context, compact);
public ParcelableUserListsAdapter(Context context) {
super(context);
}
@Override

View File

@ -44,7 +44,7 @@ import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder;
/**
* Created by mariotaku on 14/11/19.
*/
public class StaggeredGridParcelableStatusesAdapter extends AbsParcelableStatusesAdapter {
public class StaggeredGridParcelableStatusesAdapter extends ParcelableStatusesAdapter {
public StaggeredGridParcelableStatusesAdapter(Context context, boolean compact) {
super(context, compact);

View File

@ -19,6 +19,8 @@
package org.mariotaku.twidere.adapter.iface;
import android.support.annotation.Nullable;
import org.mariotaku.twidere.model.ParcelableActivity;
import org.mariotaku.twidere.util.MediaLoadingHandler;
import org.mariotaku.twidere.view.CardMediaContainer.PreviewStyle;
@ -46,9 +48,10 @@ public interface IActivitiesAdapter<Data> extends IContentCardAdapter, IGapSuppo
boolean shouldShowAccountsColor();
ActivityClickListener getActivityClickListener();
@Nullable
ActivityAdapterListener getActivityClickListener();
interface ActivityClickListener {
interface ActivityAdapterListener {
void onActivityClick(ActivityTitleSummaryViewHolder holder, int position);
}

View File

@ -0,0 +1,60 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.adapter.iface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.mariotaku.twidere.model.ParcelableGroup;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import org.mariotaku.twidere.view.holder.GroupViewHolder;
/**
* Created by mariotaku on 15/4/16.
*/
public interface IGroupsAdapter<Data> extends IContentCardAdapter {
ParcelableGroup getGroup(int position);
long getGroupId(int position);
int getGroupsCount();
void setData(Data data);
boolean shouldShowAccountsColor();
boolean isNameFirst();
@NonNull
@Override
MediaLoaderWrapper getMediaLoader();
@Nullable
GroupAdapterListener getGroupAdapterListener();
interface GroupAdapterListener {
void onGroupClick(GroupViewHolder holder, int position);
boolean onGroupLongClick(GroupViewHolder holder, int position);
}
}

View File

@ -20,15 +20,16 @@
package org.mariotaku.twidere.adapter.iface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.mariotaku.twidere.model.ParcelableUserList;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import org.mariotaku.twidere.view.holder.UserListViewHolder.UserListClickListener;
import org.mariotaku.twidere.view.holder.UserListViewHolder;
/**
* Created by mariotaku on 15/4/16.
*/
public interface IUserListsAdapter<Data> extends IContentCardAdapter, UserListClickListener {
public interface IUserListsAdapter<Data> extends IContentCardAdapter {
ParcelableUserList getUserList(int position);
@ -46,4 +47,14 @@ public interface IUserListsAdapter<Data> extends IContentCardAdapter, UserListCl
@Override
MediaLoaderWrapper getMediaLoader();
@Nullable
UserListAdapterListener getUserListAdapterListener();
interface UserListAdapterListener {
void onUserListClick(UserListViewHolder holder, int position);
boolean onUserListLongClick(UserListViewHolder holder, int position);
}
}

View File

@ -20,6 +20,7 @@
package org.mariotaku.twidere.adapter.iface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.mariotaku.twidere.model.ParcelableUser;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
@ -38,6 +39,7 @@ public interface IUsersAdapter<Data> extends IContentCardAdapter {
void setData(Data data);
@Nullable
UserAdapterListener getUserAdapterListener();
RequestClickListener getRequestClickListener();

View File

@ -0,0 +1,148 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.fragment.support;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import org.mariotaku.twidere.adapter.AbsGroupsAdapter;
import org.mariotaku.twidere.adapter.AbsUserListsAdapter;
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
import org.mariotaku.twidere.loader.iface.IExtendedLoader;
import org.mariotaku.twidere.loader.support.iface.ICursorSupportLoader;
import org.mariotaku.twidere.model.ParcelableGroup;
import org.mariotaku.twidere.model.ParcelableUserList;
import org.mariotaku.twidere.util.IntentUtils;
import org.mariotaku.twidere.util.KeyboardShortcutsHandler;
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback;
import org.mariotaku.twidere.util.RecyclerViewNavigationHelper;
import org.mariotaku.twidere.view.holder.GroupViewHolder;
import org.mariotaku.twidere.view.holder.UserListViewHolder;
abstract class AbsGroupsFragment<Data> extends AbsContentListRecyclerViewFragment<AbsGroupsAdapter<Data>>
implements LoaderCallbacks<Data>, AbsGroupsAdapter.GroupAdapterListener, KeyboardShortcutCallback {
private RecyclerViewNavigationHelper mNavigationHelper;
private long mNextCursor;
private long mPrevCursor;
public final Data getData() {
return getAdapter().getData();
}
@Override
public boolean handleKeyboardShortcutSingle(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event, int metaState) {
return mNavigationHelper.handleKeyboardShortcutSingle(handler, keyCode, event, metaState);
}
@Override
public boolean handleKeyboardShortcutRepeat(@NonNull KeyboardShortcutsHandler handler, int keyCode, int repeatCount, @NonNull KeyEvent event, int metaState) {
return mNavigationHelper.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event, metaState);
}
@Override
public boolean isKeyboardShortcutHandled(@NonNull KeyboardShortcutsHandler handler, int keyCode, @NonNull KeyEvent event, int metaState) {
return mNavigationHelper.isKeyboardShortcutHandled(handler, keyCode, event, metaState);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final AbsGroupsAdapter<Data> adapter = getAdapter();
final RecyclerView recyclerView = getRecyclerView();
final LinearLayoutManager layoutManager = getLayoutManager();
adapter.setListener(this);
mNavigationHelper = new RecyclerViewNavigationHelper(recyclerView, layoutManager, adapter,
this);
final Bundle loaderArgs = new Bundle(getArguments());
loaderArgs.putBoolean(EXTRA_FROM_USER, true);
getLoaderManager().initLoader(0, loaderArgs, this);
}
@Override
public final Loader<Data> onCreateLoader(int id, Bundle args) {
final boolean fromUser = args.getBoolean(EXTRA_FROM_USER);
args.remove(EXTRA_FROM_USER);
return onCreateUserListsLoader(getActivity(), args, fromUser);
}
@Override
public void onLoadFinished(Loader<Data> loader, Data data) {
final AbsGroupsAdapter<Data> adapter = getAdapter();
adapter.setData(data);
if (!(loader instanceof IExtendedLoader) || ((IExtendedLoader) loader).isFromUser()) {
adapter.setLoadMoreSupportedPosition(hasMoreData(data) ? IndicatorPosition.END : IndicatorPosition.NONE);
setRefreshEnabled(true);
}
if (loader instanceof IExtendedLoader) {
((IExtendedLoader) loader).setFromUser(false);
}
if (loader instanceof ICursorSupportLoader) {
mNextCursor = ((ICursorSupportLoader) loader).getNextCursor();
mPrevCursor = ((ICursorSupportLoader) loader).getNextCursor();
}
showContent();
}
@Override
public void onLoaderReset(Loader<Data> loader) {
if (loader instanceof IExtendedLoader) {
((IExtendedLoader) loader).setFromUser(false);
}
}
@Override
public void onGroupClick(GroupViewHolder holder, int position) {
}
@Override
public boolean onGroupLongClick(GroupViewHolder holder, int position) {
return false;
}
public long getPrevCursor() {
return mPrevCursor;
}
public long getNextCursor() {
return mNextCursor;
}
protected ParcelableUserList getSelectedUserList() {
//TODO return selected
return null;
}
protected abstract boolean hasMoreData(Data data);
protected abstract Loader<Data> onCreateUserListsLoader(Context context, Bundle args, boolean fromUser);
}

View File

@ -343,6 +343,11 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo
account.account_key.getId(), account.screen_name);
break;
}
case R.id.groups: {
IntentUtils.openUserGroups(getActivity(), account.account_key,
account.account_key.getId(), account.screen_name);
break;
}
case R.id.messages: {
IntentUtils.openDirectMessages(getActivity(), account.account_key);
break;
@ -581,6 +586,9 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo
if (TwitterAPIFactory.isTwitterCredentials(account)) {
mAccountOptionsAdapter.add(new OptionItem(R.string.lists, R.drawable.ic_action_list,
R.id.lists));
} else if (TwitterAPIFactory.isStatusNetCredentials(account)) {
mAccountOptionsAdapter.add(new OptionItem(R.string.groups, R.drawable.ic_action_list,
R.id.groups));
}
}

View File

@ -28,8 +28,8 @@ import android.support.v4.content.Loader;
import org.mariotaku.twidere.adapter.ParcelableUserListsAdapter;
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
import org.mariotaku.twidere.model.UserKey;
import org.mariotaku.twidere.model.ParcelableUserList;
import org.mariotaku.twidere.model.UserKey;
import java.util.List;
@ -45,7 +45,12 @@ public abstract class ParcelableUserListsFragment extends AbsUserListsFragment<L
@NonNull
@Override
protected final ParcelableUserListsAdapter onCreateAdapter(Context context, boolean compact) {
return new ParcelableUserListsAdapter(context, compact);
return new ParcelableUserListsAdapter(context);
}
@Override
protected void setupRecyclerView(Context context, boolean compact) {
super.setupRecyclerView(context, true);
}
@Nullable

View File

@ -1323,6 +1323,11 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
user.screen_name);
break;
}
case R.id.groups_container: {
IntentUtils.openUserGroups(getActivity(), user.account_key, user.key.getId(),
user.screen_name);
break;
}
case R.id.followers_container: {
IntentUtils.openUserFollowers(getActivity(), user.account_key, user.key.getId(),
user.screen_name);

View File

@ -551,6 +551,25 @@ public class IntentUtils implements Constants {
context.startActivity(intent);
}
public static void openUserGroups(@NonNull final Context context, @Nullable final UserKey accountKey, final long userId,
final String screenName) {
final Uri.Builder builder = new Uri.Builder();
builder.scheme(SCHEME_TWIDERE);
builder.authority(AUTHORITY_USER_GROUPS);
if (accountKey != null) {
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_KEY, accountKey.toString());
}
if (userId > 0) {
builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(userId));
}
if (screenName != null) {
builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screenName);
}
final Intent intent = new Intent(Intent.ACTION_VIEW, builder.build());
context.startActivity(intent);
}
public static void openDirectMessages(@NonNull final Context context, @Nullable final UserKey accountKey) {
final Uri.Builder builder = new Uri.Builder();
builder.scheme(SCHEME_TWIDERE);

View File

@ -149,6 +149,7 @@ import org.mariotaku.twidere.fragment.support.UserFavoritesFragment;
import org.mariotaku.twidere.fragment.support.UserFollowersFragment;
import org.mariotaku.twidere.fragment.support.UserFragment;
import org.mariotaku.twidere.fragment.support.UserFriendsFragment;
import org.mariotaku.twidere.fragment.support.UserGroupsFragment;
import org.mariotaku.twidere.fragment.support.UserListFragment;
import org.mariotaku.twidere.fragment.support.UserListMembersFragment;
import org.mariotaku.twidere.fragment.support.UserListMembershipsFragment;
@ -251,6 +252,7 @@ public final class Utils implements Constants {
LINK_HANDLER_URI_MATCHER.addURI(AUTHORITY_USER_LIST_SUBSCRIBERS, null, LINK_ID_USER_LIST_SUBSCRIBERS);
LINK_HANDLER_URI_MATCHER.addURI(AUTHORITY_USER_LIST_MEMBERSHIPS, null, LINK_ID_USER_LIST_MEMBERSHIPS);
LINK_HANDLER_URI_MATCHER.addURI(AUTHORITY_USER_LISTS, null, LINK_ID_USER_LISTS);
LINK_HANDLER_URI_MATCHER.addURI(AUTHORITY_USER_GROUPS, null, LINK_ID_USER_GROUPS);
LINK_HANDLER_URI_MATCHER.addURI(AUTHORITY_SAVED_SEARCHES, null, LINK_ID_SAVED_SEARCHES);
LINK_HANDLER_URI_MATCHER.addURI(AUTHORITY_USER_MENTIONS, null, LINK_ID_USER_MENTIONS);
LINK_HANDLER_URI_MATCHER.addURI(AUTHORITY_INCOMING_FRIENDSHIPS, null, LINK_ID_INCOMING_FRIENDSHIPS);
@ -648,6 +650,19 @@ public final class Utils implements Constants {
if (isEmpty(paramScreenName) && isEmpty(paramUserId)) return null;
break;
}
case LINK_ID_USER_GROUPS: {
fragment = new UserGroupsFragment();
final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);
final long paramUserId = NumberUtils.toLong(uri.getQueryParameter(QUERY_PARAM_USER_ID), -1);
if (!args.containsKey(EXTRA_SCREEN_NAME)) {
args.putString(EXTRA_SCREEN_NAME, paramScreenName);
}
if (!args.containsKey(EXTRA_USER_ID)) {
args.putLong(EXTRA_USER_ID, paramUserId);
}
if (isEmpty(paramScreenName) && paramUserId <= 0) return null;
break;
}
case LINK_ID_USER_LIST_TIMELINE: {
fragment = new UserListTimelineFragment();
final String paramScreenName = uri.getQueryParameter(QUERY_PARAM_SCREEN_NAME);

View File

@ -22,7 +22,6 @@ package org.mariotaku.twidere.view.holder;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.support.v4.text.BidiFormatter;
import android.support.v4.view.MarginLayoutParamsCompat;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.View;
@ -60,7 +59,7 @@ public class ActivityTitleSummaryViewHolder extends ViewHolder implements View.O
private final ImageView[] profileImageViews;
private final View profileImageSpace;
private IActivitiesAdapter.ActivityClickListener activityClickListener;
private IActivitiesAdapter.ActivityAdapterListener mActivityAdapterListener;
public ActivityTitleSummaryViewHolder(AbsActivitiesAdapter adapter, View itemView, boolean isCompact) {
super(itemView);
@ -156,11 +155,11 @@ public class ActivityTitleSummaryViewHolder extends ViewHolder implements View.O
}
public void setOnClickListeners() {
setActivityClickListener(adapter.getActivityClickListener());
setActivityAdapterListener(adapter.getActivityClickListener());
}
public void setActivityClickListener(IActivitiesAdapter.ActivityClickListener listener) {
activityClickListener = listener;
public void setActivityAdapterListener(IActivitiesAdapter.ActivityAdapterListener listener) {
mActivityAdapterListener = listener;
((View) itemContent).setOnClickListener(this);
// ((View) itemContent).setOnLongClickListener(this);
@ -168,11 +167,11 @@ public class ActivityTitleSummaryViewHolder extends ViewHolder implements View.O
@Override
public void onClick(View v) {
if (activityClickListener == null) return;
if (mActivityAdapterListener == null) return;
final int position = getLayoutPosition();
switch (v.getId()) {
case R.id.item_content: {
activityClickListener.onActivityClick(this, position);
mActivityAdapterListener.onActivityClick(this, position);
break;
}
}

View File

@ -0,0 +1,131 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mariotaku.twidere.view.holder;
import android.content.Context;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.adapter.iface.IGroupsAdapter;
import org.mariotaku.twidere.model.ParcelableGroup;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import org.mariotaku.twidere.util.UserColorNameManager;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.iface.IColorLabelView;
import java.util.Locale;
/**
* Created by mariotaku on 15/4/29.
*/
public class GroupViewHolder extends ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private final IGroupsAdapter<?> adapter;
private final IColorLabelView itemContent;
private final ImageView profileImageView;
private final TextView nameView;
private final TextView createdByView;
private final TextView descriptionView;
private final TextView membersCountView;
private final TextView subscribersCountView;
private IGroupsAdapter.GroupAdapterListener groupClickListener;
public GroupViewHolder(IGroupsAdapter<?> adapter, View itemView) {
super(itemView);
itemContent = (IColorLabelView) itemView.findViewById(R.id.item_content);
this.adapter = adapter;
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
nameView = (TextView) itemView.findViewById(R.id.name);
createdByView = (TextView) itemView.findViewById(R.id.created_by);
descriptionView = (TextView) itemView.findViewById(R.id.description);
membersCountView = (TextView) itemView.findViewById(R.id.members_count);
subscribersCountView = (TextView) itemView.findViewById(R.id.subscribers_count);
}
public void displayGroup(ParcelableGroup group) {
final Context context = adapter.getContext();
final MediaLoaderWrapper loader = adapter.getMediaLoader();
final UserColorNameManager manager = adapter.getUserColorNameManager();
nameView.setText(group.fullname);
final boolean nameFirst = adapter.isNameFirst();
if (adapter.isProfileImageEnabled()) {
profileImageView.setVisibility(View.VISIBLE);
loader.displayProfileImage(profileImageView, group.homepage_logo);
} else {
profileImageView.setVisibility(View.GONE);
loader.cancelDisplayTask(profileImageView);
}
descriptionView.setVisibility(TextUtils.isEmpty(group.description) ? View.GONE : View.VISIBLE);
descriptionView.setText(group.description);
membersCountView.setText(Utils.getLocalizedNumber(Locale.getDefault(), group.member_count));
subscribersCountView.setText(Utils.getLocalizedNumber(Locale.getDefault(), group.admin_count));
}
public void setOnClickListeners() {
setGroupClickListener(adapter.getGroupAdapterListener());
}
@Override
public void onClick(View v) {
if (groupClickListener == null) return;
switch (v.getId()) {
case R.id.item_content: {
groupClickListener.onGroupClick(this, getLayoutPosition());
break;
}
}
}
@Override
public boolean onLongClick(View v) {
if (groupClickListener == null) return false;
switch (v.getId()) {
case R.id.item_content: {
return groupClickListener.onGroupLongClick(this, getLayoutPosition());
}
}
return false;
}
public void setGroupClickListener(IGroupsAdapter.GroupAdapterListener listener) {
groupClickListener = listener;
((View) itemContent).setOnClickListener(this);
((View) itemContent).setOnLongClickListener(this);
}
public void setupViewOptions() {
setTextSize(adapter.getTextSize());
}
public void setTextSize(final float textSize) {
nameView.setTextSize(textSize);
createdByView.setTextSize(textSize * 0.75f);
}
}

View File

@ -286,8 +286,15 @@ public class StatusViewHolder extends ViewHolder implements Constants, IStatusVi
quoteIndicator.setVisibility(View.GONE);
if (status.is_retweet) {
itemContent.drawStart(manager.getUserColor(status.retweeted_by_user_id, false),
manager.getUserColor(status.user_key, false));
final int retweetUserColor = manager.getUserColor(status.retweeted_by_user_id, false);
final int userColor = manager.getUserColor(status.user_key, false);
if (retweetUserColor == 0) {
itemContent.drawStart(userColor);
} else if (userColor == 0) {
itemContent.drawStart(retweetUserColor);
} else {
itemContent.drawStart(retweetUserColor, userColor);
}
} else {
itemContent.drawStart(manager.getUserColor(status.user_key, false));
}

View File

@ -27,7 +27,6 @@ import android.widget.ImageView;
import android.widget.TextView;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.adapter.iface.ContentCardClickListener;
import org.mariotaku.twidere.adapter.iface.IUserListsAdapter;
import org.mariotaku.twidere.model.ParcelableUserList;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
@ -52,7 +51,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
private final TextView membersCountView;
private final TextView subscribersCountView;
private UserListClickListener userListClickListener;
private IUserListsAdapter.UserListAdapterListener userListClickListener;
public UserListViewHolder(IUserListsAdapter<?> adapter, View itemView) {
super(itemView);
@ -92,7 +91,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
}
public void setOnClickListeners() {
setUserListClickListener(adapter);
setUserListClickListener(adapter.getUserListAdapterListener());
}
@Override
@ -117,7 +116,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
return false;
}
public void setUserListClickListener(UserListClickListener listener) {
public void setUserListClickListener(IUserListsAdapter.UserListAdapterListener listener) {
userListClickListener = listener;
((View) itemContent).setOnClickListener(this);
((View) itemContent).setOnLongClickListener(this);
@ -132,12 +131,4 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
createdByView.setTextSize(textSize * 0.75f);
}
public interface UserListClickListener extends ContentCardClickListener {
void onUserListClick(UserListViewHolder holder, int position);
boolean onUserListLongClick(UserListViewHolder holder, int position);
}
}

View File

@ -1,58 +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.holder;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.view.iface.IColorLabelView;
public class UserListViewListHolder extends ViewListHolder {
public final IColorLabelView content;
public final ImageView profile_image;
public final TextView name, description, created_by, members_count, subscribers_count;
public int position;
private float text_size;
public UserListViewListHolder(final View view) {
super(view);
content = (IColorLabelView) view.findViewById(R.id.content);
profile_image = (ImageView) findViewById(R.id.profile_image);
name = (TextView) findViewById(R.id.name);
description = (TextView) findViewById(R.id.description);
created_by = (TextView) findViewById(R.id.created_by);
members_count = (TextView) findViewById(R.id.members_count);
subscribers_count = (TextView) findViewById(R.id.subscribers_count);
}
public void setTextSize(final float text_size) {
if (this.text_size == text_size) return;
this.text_size = text_size;
if (description != null) {
description.setTextSize(text_size);
}
name.setTextSize(text_size * 1.05f);
created_by.setTextSize(text_size * 0.65f);
}
}

View File

@ -19,6 +19,7 @@
package org.mariotaku.twidere.view.holder;
import android.content.Context;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.text.TextUtils;
import android.view.View;
@ -32,6 +33,7 @@ import org.mariotaku.twidere.adapter.iface.IUsersAdapter;
import org.mariotaku.twidere.adapter.iface.IUsersAdapter.RequestClickListener;
import org.mariotaku.twidere.adapter.iface.IUsersAdapter.UserAdapterListener;
import org.mariotaku.twidere.model.ParcelableUser;
import org.mariotaku.twidere.model.util.UserKeyUtils;
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import org.mariotaku.twidere.util.UserColorNameManager;
@ -51,6 +53,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
private final ImageView profileImageView;
private final ImageView profileTypeView;
private final NameView nameView;
private final TextView externalIndicator;
private final TextView descriptionView, locationView, urlView,
statusesCountView, followersCountView, friendsCountView;
@ -68,6 +71,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
profileTypeView = (ImageView) itemView.findViewById(R.id.profile_type);
nameView = (NameView) itemView.findViewById(R.id.name);
externalIndicator = (TextView) itemView.findViewById(R.id.external_indicator);
descriptionView = (TextView) itemView.findViewById(R.id.description);
locationView = (TextView) itemView.findViewById(R.id.location);
urlView = (TextView) itemView.findViewById(R.id.url);
@ -82,6 +86,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
public void displayUser(ParcelableUser user) {
final Context context = adapter.getContext();
final MediaLoaderWrapper loader = adapter.getMediaLoader();
final UserColorNameManager manager = adapter.getUserColorNameManager();
final AsyncTwitterWrapper twitter = adapter.getTwitterWrapper();
@ -125,6 +130,13 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
acceptRequestButton.setVisibility(View.VISIBLE);
denyRequestButton.setVisibility(View.VISIBLE);
}
if (UserKeyUtils.isSameHost(user.account_key, user.key)) {
externalIndicator.setVisibility(View.GONE);
} else {
externalIndicator.setVisibility(View.VISIBLE);
externalIndicator.setText(context.getString(R.string.external_user_host_format, user
.key.getHost()));
}
}
public ImageView getProfileImageView() {
@ -188,6 +200,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
public void setTextSize(final float textSize) {
descriptionView.setTextSize(textSize);
externalIndicator.setTextSize(textSize);
nameView.setPrimaryTextSize(textSize);
nameView.setSecondaryTextSize(textSize * 0.75f);
locationView.setTextSize(textSize);

View File

@ -1,87 +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.holder;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.view.iface.IColorLabelView;
public class UserViewListHolder extends ViewListHolder {
public final IColorLabelView content;
public final ImageView profile_image, profile_type;
public final TextView name, screen_name, description, location, url, statuses_count, followers_count,
friends_count;
public int position;
private boolean account_color_enabled;
private float text_size;
public UserViewListHolder(final View view) {
super(view);
content = (IColorLabelView) view.findViewById(R.id.content);
profile_image = (ImageView) findViewById(R.id.profile_image);
profile_type = (ImageView) findViewById(R.id.profile_type);
name = (TextView) findViewById(R.id.name);
screen_name = (TextView) findViewById(R.id.screen_name);
description = (TextView) findViewById(R.id.description);
location = (TextView) findViewById(R.id.location);
url = (TextView) findViewById(R.id.url);
statuses_count = (TextView) findViewById(R.id.statuses_count);
followers_count = (TextView) findViewById(R.id.followers_count);
friends_count = (TextView) findViewById(R.id.friends_count);
}
public void setAccountColor(final int color) {
content.drawEnd(account_color_enabled ? color : Color.TRANSPARENT);
}
public void setAccountColorEnabled(final boolean enabled) {
account_color_enabled = enabled;
if (!account_color_enabled) {
content.drawEnd(Color.TRANSPARENT);
}
}
public void setHighlightColor(final int color) {
content.drawBackground(color);
}
public void setTextSize(final float text_size) {
if (this.text_size == text_size) return;
this.text_size = text_size;
description.setTextSize(text_size);
name.setTextSize(text_size);
screen_name.setTextSize(text_size * 0.75f);
location.setTextSize(text_size);
url.setTextSize(text_size);
statuses_count.setTextSize(text_size);
followers_count.setTextSize(text_size);
friends_count.setTextSize(text_size);
}
public void setUserColor(final int color) {
content.drawStart(color);
}
}

View File

@ -17,7 +17,7 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<org.mariotaku.twidere.view.ColorLabelFrameLayout
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
android:id="@+id/item_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
@ -25,204 +25,204 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
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:clipChildren="false"
android:padding="@dimen/element_spacing_normal"
app:ignorePadding="true"
tools:context=".adapter.ParcelableUsersAdapter">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingEnd="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingStart="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal">
android:id="@+id/profile_image_container"
android:layout_width="@dimen/icon_size_card_list_item"
android:layout_height="@dimen/icon_size_card_list_item"
android:layout_alignBottom="@+id/actions_container"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignTop="@+id/actions_container"
android:layout_marginEnd="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:clipChildren="false">
<RelativeLayout
android:id="@+id/profile_image_container"
<org.mariotaku.twidere.view.ProfileImageView
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_alignBottom="@+id/actions_container"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignTop="@+id/actions_container"
android:layout_marginEnd="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:clipChildren="false">
android:layout_centerInParent="true"
android:contentDescription="@string/profile_image"
tools:src="@mipmap/ic_launcher"/>
<org.mariotaku.twidere.view.ProfileImageView
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_centerInParent="true"
android:contentDescription="@string/profile_image"
tools:src="@mipmap/ic_launcher"/>
<ImageView
android:id="@+id/profile_type"
android:layout_width="@dimen/icon_size_profile_type"
android:layout_height="@dimen/icon_size_profile_type"
android:layout_alignBottom="@id/profile_image"
android:layout_alignEnd="@id/profile_image"
android:layout_alignRight="@id/profile_image"
android:layout_marginBottom="@dimen/element_spacing_minus_small"
android:layout_marginEnd="@dimen/element_spacing_minus_normal"
android:layout_marginRight="@dimen/element_spacing_minus_normal"
android:scaleType="centerInside"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_user_type_verified"
tools:visibility="visible"/>
</RelativeLayout>
<org.mariotaku.twidere.view.NameView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/actions_container"
android:layout_alignTop="@+id/actions_container"
android:layout_toEndOf="@id/profile_image_container"
android:layout_toLeftOf="@+id/actions_container"
android:layout_toRightOf="@id/profile_image_container"
android:layout_toStartOf="@+id/actions_container"
android:gravity="center_vertical"
app:nv_primaryTextColor="?android:textColorPrimary"
app:nv_primaryTextStyle="bold"
app:nv_secondaryTextColor="?android:textColorSecondary"
app:nv_twoLine="true"/>
<LinearLayout
android:id="@+id/actions_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:clipChildren="false"
android:gravity="center"
android:minHeight="@dimen/element_size_normal"
android:minWidth="@dimen/element_size_normal"
android:orientation="horizontal"
tools:visibility="gone">
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/accept_request"
style="?buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/accept"
android:src="@drawable/ic_action_confirm"
app:backgroundTint="@color/material_light_green"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/deny_request"
style="?buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/deny"
android:src="@drawable/ic_action_cancel"
app:backgroundTint="@color/material_red"/>
<ProgressBar
android:id="@+id/processing_request"
style="?android:progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/name"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
tools:text="@string/sample_status_text"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/description"
android:drawableLeft="@drawable/ic_indicator_location"
android:drawablePadding="@dimen/element_spacing_small"
android:drawableStart="@drawable/ic_indicator_location"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Earth"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/location"
android:drawableLeft="@drawable/ic_indicator_web"
android:drawablePadding="@dimen/element_spacing_small"
android:drawableStart="@drawable/ic_indicator_web"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="https://github.com/TwidereProject"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/url"
android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/statuses_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_twitter"
android:drawablePadding="@dimen/element_spacing_small"
android:drawableStart="@drawable/ic_indicator_twitter"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="255"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/followers_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:drawableStart="@drawable/ic_indicator_followers"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="255"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/friends_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:drawableStart="@drawable/ic_indicator_following"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="255"/>
</LinearLayout>
<ImageView
android:id="@+id/profile_type"
android:layout_width="@dimen/icon_size_profile_type"
android:layout_height="@dimen/icon_size_profile_type"
android:layout_alignBottom="@id/profile_image"
android:layout_alignEnd="@id/profile_image"
android:layout_alignRight="@id/profile_image"
android:layout_marginBottom="@dimen/element_spacing_minus_small"
android:layout_marginEnd="@dimen/element_spacing_minus_normal"
android:layout_marginRight="@dimen/element_spacing_minus_normal"
android:scaleType="centerInside"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_user_type_verified"
tools:visibility="visible"/>
</RelativeLayout>
</org.mariotaku.twidere.view.ColorLabelFrameLayout>
<org.mariotaku.twidere.view.NameView
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/actions_container"
android:layout_alignTop="@+id/actions_container"
android:layout_toEndOf="@id/profile_image_container"
android:layout_toLeftOf="@+id/actions_container"
android:layout_toRightOf="@id/profile_image_container"
android:layout_toStartOf="@+id/actions_container"
android:gravity="center_vertical"
app:nv_primaryTextColor="?android:textColorPrimary"
app:nv_primaryTextStyle="bold"
app:nv_secondaryTextColor="?android:textColorSecondary"
app:nv_twoLine="true"/>
<LinearLayout
android:id="@+id/actions_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:clipChildren="false"
android:gravity="center"
android:minHeight="@dimen/element_size_normal"
android:minWidth="@dimen/element_size_normal"
android:orientation="horizontal"
tools:visibility="gone">
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/accept_request"
style="?buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/accept"
android:src="@drawable/ic_action_confirm"
app:backgroundTint="@color/material_light_green"/>
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/deny_request"
style="?buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/deny"
android:src="@drawable/ic_action_cancel"
app:backgroundTint="@color/material_red"/>
<ProgressBar
android:id="@+id/processing_request"
style="?android:progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/external_indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/name"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
android:textStyle="italic"
tools:text="External user at twitter.com"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/external_indicator"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
tools:text="@string/sample_status_text"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/description"
android:drawableLeft="@drawable/ic_indicator_location"
android:drawablePadding="@dimen/element_spacing_small"
android:drawableStart="@drawable/ic_indicator_location"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="Earth"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/location"
android:drawableLeft="@drawable/ic_indicator_web"
android:drawablePadding="@dimen/element_spacing_small"
android:drawableStart="@drawable/ic_indicator_web"
android:paddingTop="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="https://github.com/TwidereProject"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/name"
android:layout_alignStart="@+id/name"
android:layout_below="@+id/url"
android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/statuses_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_twitter"
android:drawablePadding="@dimen/element_spacing_small"
android:drawableStart="@drawable/ic_indicator_twitter"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="255"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/followers_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:drawableStart="@drawable/ic_indicator_followers"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="255"/>
<org.mariotaku.twidere.view.ActionIconThemedTextView
android:id="@+id/friends_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:drawableStart="@drawable/ic_indicator_following"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="255"/>
</LinearLayout>
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>

View File

@ -1,145 +0,0 @@
<?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/>.
-->
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/card"
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"
app:cardBackgroundColor="?cardItemBackgroundColor"
app:cardCornerRadius="2dp"
app:cardElevation="2dp"
tools:context=".adapter.ParcelableUserListsAdapter">
<org.mariotaku.twidere.view.ColorLabelLinearLayout
android:id="@+id/item_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:focusable="true"
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: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:paddingEnd="@dimen/element_spacing_xlarge"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_xlarge"
android:paddingStart="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ProfileImageView
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:paddingEnd="0dp"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="0dp"
android:paddingStart="@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/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"
android:visibility="gone" />
<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"
android:visibility="gone" />
<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:drawableStart="@drawable/ic_indicator_following"
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:drawableStart="@drawable/ic_indicator_followers"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</org.mariotaku.twidere.view.ColorLabelLinearLayout>
</android.support.v7.widget.CardView>

View File

@ -17,119 +17,108 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<org.mariotaku.twidere.view.ColorLabelFrameLayout
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
android:id="@+id/item_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
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:padding="@dimen/element_spacing_normal"
app:ignorePadding="true"
tools:context=".adapter.ParcelableUsersAdapter">
<RelativeLayout
android:layout_width="match_parent"
<org.mariotaku.twidere.view.ProfileImageView
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_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"
tools:src="@mipmap/ic_launcher"/>
<LinearLayout
android:id="@+id/name_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/element_spacing_normal"
android:paddingEnd="@dimen/element_spacing_normal"
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"
android:paddingStart="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal">
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_gravity="start|center_vertical"
android:layout_toEndOf="@id/profile_image"
android:layout_toRightOf="@id/profile_image"
android:gravity="center_vertical"
android:orientation="vertical">
<org.mariotaku.twidere.view.ProfileImageView
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_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"
android:scaleType="fitCenter"/>
<LinearLayout
android:id="@+id/name_container"
<org.mariotaku.twidere.view.TimelineContentTextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_gravity="start|center_vertical"
android:layout_toEndOf="@id/profile_image"
android:layout_toRightOf="@id/profile_image"
android:gravity="center_vertical"
android:orientation="vertical">
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
tools:text="List"/>
<org.mariotaku.twidere.view.TimelineContentTextView
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"
tools:text="List"/>
<org.mariotaku.twidere.view.TimelineContentTextView
android:id="@+id/created_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
tools:text="Created by user"/>
</LinearLayout>
<org.mariotaku.twidere.view.TimelineContentTextView
android:id="@+id/created_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
tools:text="Created by user"/>
</LinearLayout>
<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_container"
android:layout_alignStart="@id/name_container"
android:layout_below="@id/name_container"
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_alignStart="@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/description"
android:layout_width="match_parent"
android:id="@+id/members_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/name_container"
android:layout_alignStart="@id/name_container"
android:layout_below="@id/name_container"
android:paddingTop="@dimen/element_spacing_small"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_following"
android:drawablePadding="4dp"
android:drawableStart="@drawable/ic_indicator_following"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<LinearLayout
android:layout_width="match_parent"
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/subscribers_count"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/description"
android:layout_alignStart="@id/description"
android:layout_below="@id/description"
android:orientation="horizontal"
android:paddingTop="@dimen/element_spacing_small">
android:layout_weight="1"
android:drawableLeft="@drawable/ic_indicator_followers"
android:drawablePadding="4dp"
android:drawableStart="@drawable/ic_indicator_followers"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
<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:drawableStart="@drawable/ic_indicator_following"
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:drawableStart="@drawable/ic_indicator_followers"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>
</RelativeLayout>
</org.mariotaku.twidere.view.ColorLabelFrameLayout>
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>

View File

@ -57,6 +57,7 @@
<item name="statuses" type="id"/>
<item name="favorites" type="id"/>
<item name="lists" type="id"/>
<item name="groups" type="id"/>
<item name="center" type="id"/>
<item name="filters" type="id"/>
<item name="set_nickname" type="id"/>

View File

@ -756,4 +756,5 @@
<string name="shortener_version_incompatible">Incompatible tweet shortener</string>
<string name="uploader_version_incompatible">Incompatible media uploader</string>
<string name="groups">Groups</string>
<string name="external_user_host_format">External user at <xliff:g id="host">%s</xliff:g></string>
</resources>