|
@ -1,3 +1,5 @@
|
|||
apply plugin: 'com.github.ben-manes.versions'
|
||||
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
|
@ -5,6 +7,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.6'
|
||||
classpath 'com.android.tools.build:gradle:1.0.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
|
@ -61,6 +61,6 @@ android {
|
|||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.google.android.support:wearable:1.0.0'
|
||||
compile 'com.google.android.gms:play-services-wearable:6.1.11'
|
||||
compile 'com.google.android.support:wearable:1.1.0'
|
||||
compile 'com.google.android.gms:play-services-wearable:6.5.87'
|
||||
}
|
||||
|
|
|
@ -79,6 +79,12 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url 'https://repo.commonsware.com.s3.amazonaws.com' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// wearApp project(':twidere.wear')
|
||||
compile 'com.android.support:support-v13:21.0.3'
|
||||
|
@ -93,9 +99,11 @@ dependencies {
|
|||
compile 'org.apache.httpcomponents:httpmime:4.3.5'
|
||||
compile 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
|
||||
compile 'com.squareup:otto:1.3.5'
|
||||
compile 'dnsjava:dnsjava:2.1.6'
|
||||
compile 'com.commonsware.cwac:merge:1.1.1'
|
||||
googleCompile 'com.google.android.gms:play-services:6.5.87'
|
||||
fdroidCompile 'org.osmdroid:osmdroid-android:4.2'
|
||||
fdroidCompile 'org.slf4j:slf4j-simple:1.6.1'
|
||||
fdroidCompile 'org.slf4j:slf4j-simple:1.7.9'
|
||||
compile project(':SlidingMenu')
|
||||
compile project(':DragSortListView')
|
||||
compile project(':MenuComponent')
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.support.v7.widget.RecyclerView.Adapter;
|
|||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -41,13 +42,14 @@ import org.mariotaku.twidere.util.ThemeUtils;
|
|||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.view.holder.ActivityTitleSummaryViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.GapViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/1/3.
|
||||
*/
|
||||
public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> implements Constants,
|
||||
IActivitiesAdapter<Data> {
|
||||
IActivitiesAdapter<Data>, OnClickListener {
|
||||
|
||||
private static final int ITEM_VIEW_TYPE_STUB = 0;
|
||||
private static final int ITEM_VIEW_TYPE_GAP = 1;
|
||||
|
@ -65,7 +67,7 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
|||
private final int mProfileImageStyle, mMediaPreviewStyle;
|
||||
private boolean mLoadMoreIndicatorEnabled;
|
||||
|
||||
protected AbsActivitiesAdapter(Context context) {
|
||||
protected AbsActivitiesAdapter(final Context context) {
|
||||
mContext = context;
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context);
|
||||
|
@ -84,6 +86,11 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
|||
|
||||
public abstract int getActivityCount();
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusClick(StatusViewHolder holder, int position) {
|
||||
|
||||
|
@ -144,10 +151,11 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
|||
final View view = mInflater.inflate(R.layout.card_item_status_compat, parent, false);
|
||||
final StatusViewHolder holder = new StatusViewHolder(view);
|
||||
holder.setTextSize(getTextSize());
|
||||
holder.setOnClickListeners(this);
|
||||
return holder;
|
||||
}
|
||||
case ITEM_VIEW_TYPE_TITLE_SUMMARY: {
|
||||
final View view = mInflater.inflate(R.layout.list_item_activity_about_me_status, parent, false);
|
||||
final View view = mInflater.inflate(R.layout.list_item_activity_title_summary, parent, false);
|
||||
final ActivityTitleSummaryViewHolder holder = new ActivityTitleSummaryViewHolder(this, view);
|
||||
holder.setTextSize(getTextSize());
|
||||
return holder;
|
||||
|
@ -156,6 +164,10 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
|||
final View view = mInflater.inflate(R.layout.card_item_gap, parent, false);
|
||||
return new GapViewHolder(this, view);
|
||||
}
|
||||
case ITEM_VIEW_TYPE_LOAD_INDICATOR: {
|
||||
final View view = mInflater.inflate(R.layout.card_item_load_indicator, parent, false);
|
||||
return new LoadIndicatorViewHolder(view);
|
||||
}
|
||||
default: {
|
||||
final View view = mInflater.inflate(R.layout.list_item_two_line, parent, false);
|
||||
return new StubViewHolder(view);
|
||||
|
@ -181,7 +193,7 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
|||
break;
|
||||
}
|
||||
case ITEM_VIEW_TYPE_TITLE_SUMMARY: {
|
||||
((ActivityTitleSummaryViewHolder) holder).displayActivity(getActivity(position));
|
||||
bindTitleSummaryViewHolder((ActivityTitleSummaryViewHolder) holder, position);
|
||||
break;
|
||||
}
|
||||
case ITEM_VIEW_TYPE_STUB: {
|
||||
|
@ -191,6 +203,8 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract void bindTitleSummaryViewHolder(ActivityTitleSummaryViewHolder holder, int position);
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == getItemCount() - 1) {
|
||||
|
@ -205,7 +219,10 @@ public abstract class AbsActivitiesAdapter<Data> extends Adapter<ViewHolder> imp
|
|||
}
|
||||
case ParcelableActivity.ACTION_FOLLOW:
|
||||
case ParcelableActivity.ACTION_FAVORITE:
|
||||
case ParcelableActivity.ACTION_RETWEET: {
|
||||
case ParcelableActivity.ACTION_RETWEET:
|
||||
case ParcelableActivity.ACTION_FAVORITED_RETWEET:
|
||||
case ParcelableActivity.ACTION_RETWEETED_RETWEET:
|
||||
case ParcelableActivity.ACTION_LIST_MEMBER_ADDED: {
|
||||
return ITEM_VIEW_TYPE_TITLE_SUMMARY;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public abstract class AbsStatusesAdapter<D> extends Adapter<ViewHolder> implemen
|
|||
cardView.setCardBackgroundColor(mCardBackgroundColor);
|
||||
}
|
||||
final StatusViewHolder holder = new StatusViewHolder(this, view);
|
||||
holder.setupViewListeners();
|
||||
holder.setOnClickListeners();
|
||||
holder.setupViewOptions();
|
||||
return holder;
|
||||
}
|
||||
|
|
|
@ -1,212 +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.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.iface.IBaseCardAdapter;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.util.ImageLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.MultiSelectManager;
|
||||
import org.mariotaku.twidere.util.UserColorNameUtils;
|
||||
import org.mariotaku.twidere.view.holder.ActivityListViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.configBaseCardAdapter;
|
||||
import static org.mariotaku.twidere.util.Utils.getAccountColor;
|
||||
import static org.mariotaku.twidere.util.UserColorNameUtils.getDisplayName;
|
||||
import static org.mariotaku.twidere.util.Utils.isCompactCards;
|
||||
|
||||
public abstract class BaseParcelableActivitiesAdapter extends BaseArrayAdapter<ParcelableActivity> implements
|
||||
IBaseCardAdapter {
|
||||
|
||||
private final MultiSelectManager mMultiSelectManager;
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
|
||||
private boolean mShowAbsoluteTime;
|
||||
|
||||
public BaseParcelableActivitiesAdapter(final Context context) {
|
||||
this(context, isCompactCards(context));
|
||||
}
|
||||
|
||||
public BaseParcelableActivitiesAdapter(final Context context, final boolean compactCards) {
|
||||
super(context, getItemResource(compactCards));
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mMultiSelectManager = app.getMultiSelectManager();
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
configBaseCardAdapter(context, this);
|
||||
}
|
||||
|
||||
public abstract void bindView(final int position, final ActivityListViewHolder holder, final ParcelableActivity item);
|
||||
|
||||
@Override
|
||||
public ImageLoaderWrapper getImageLoader() {
|
||||
return mImageLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(final int position) {
|
||||
final Object obj = getItem(position);
|
||||
return obj != null ? obj.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getView(position, convertView, parent);
|
||||
final Object tag = view.getTag();
|
||||
final ActivityListViewHolder holder = tag instanceof ActivityListViewHolder ? (ActivityListViewHolder) tag
|
||||
: new ActivityListViewHolder(view);
|
||||
if (!(tag instanceof ActivityListViewHolder)) {
|
||||
view.setTag(holder);
|
||||
}
|
||||
|
||||
final boolean showAccountColor = isShowAccountColor();
|
||||
|
||||
holder.setTextSize(getTextSize());
|
||||
holder.my_profile_image.setVisibility(View.GONE);
|
||||
final ParcelableActivity item = getItem(position);
|
||||
holder.setAccountColorEnabled(showAccountColor);
|
||||
if (showAccountColor) {
|
||||
holder.setAccountColor(getAccountColor(getContext(), item.account_id));
|
||||
}
|
||||
if (mShowAbsoluteTime) {
|
||||
holder.time.setTime(item.timestamp);
|
||||
} else {
|
||||
holder.time.setTime(item.timestamp);
|
||||
}
|
||||
bindView(position, holder, item);
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onItemSelected(final Object item) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void onItemUnselected(final Object item) {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setData(final List<ParcelableActivity> data) {
|
||||
clear();
|
||||
if (data == null) return;
|
||||
addAll(data);
|
||||
}
|
||||
|
||||
public void setShowAbsoluteTime(final boolean show) {
|
||||
if (show != mShowAbsoluteTime) {
|
||||
mShowAbsoluteTime = show;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected void displayActivityUserProfileImages(final ActivityListViewHolder holder, final ParcelableStatus[] statuses) {
|
||||
if (statuses == null) {
|
||||
displayActivityUserProfileImages(holder, new String[0]);
|
||||
} else {
|
||||
final String[] urls = new String[statuses.length];
|
||||
for (int i = 0, j = statuses.length; i < j; i++) {
|
||||
urls[i] = statuses[i].user_profile_image_url;
|
||||
}
|
||||
displayActivityUserProfileImages(holder, urls);
|
||||
}
|
||||
}
|
||||
|
||||
protected void displayActivityUserProfileImages(final ActivityListViewHolder holder, final ParcelableUser[] users) {
|
||||
if (users == null) {
|
||||
displayActivityUserProfileImages(holder, new String[0]);
|
||||
} else {
|
||||
final String[] urls = new String[users.length];
|
||||
for (int i = 0, j = users.length; i < j; i++) {
|
||||
urls[i] = users[i].profile_image_url;
|
||||
}
|
||||
displayActivityUserProfileImages(holder, urls);
|
||||
}
|
||||
}
|
||||
|
||||
protected void displayProfileImage(final ImageView view, final ParcelableUser user) {
|
||||
if (isDisplayProfileImage()) {
|
||||
mImageLoader.displayProfileImage(view, user.profile_image_url);
|
||||
} else {
|
||||
view.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getName(final ParcelableStatus status) {
|
||||
if (status == null) return null;
|
||||
return UserColorNameUtils.getDisplayName(getContext(), status.user_id, status.user_name, status.user_screen_name,
|
||||
isDisplayNameFirst(), isNicknameOnly());
|
||||
}
|
||||
|
||||
protected String getName(final ParcelableUser user) {
|
||||
if (user == null) return null;
|
||||
return UserColorNameUtils.getDisplayName(getContext(), user.id, user.name, user.screen_name, isDisplayNameFirst(),
|
||||
isNicknameOnly());
|
||||
}
|
||||
|
||||
protected void setProfileImage(final ImageView view, final ParcelableStatus status) {
|
||||
if (isDisplayProfileImage()) {
|
||||
mImageLoader.displayProfileImage(view, status.user_profile_image_url);
|
||||
} else {
|
||||
view.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean shouldDisplayProfileImage() {
|
||||
return isDisplayProfileImage();
|
||||
}
|
||||
|
||||
private void displayActivityUserProfileImages(final ActivityListViewHolder holder, final String[] urls) {
|
||||
final int length = urls != null ? Math.min(holder.activity_profile_images.length, urls.length) : 0;
|
||||
final boolean shouldDisplayImages = isDisplayProfileImage() && length > 0;
|
||||
holder.activity_profile_images_container.setVisibility(shouldDisplayImages ? View.VISIBLE : View.GONE);
|
||||
if (!shouldDisplayImages) return;
|
||||
for (int i = 0, j = holder.activity_profile_images.length; i < j; i++) {
|
||||
final ImageView view = holder.activity_profile_images[i];
|
||||
view.setImageDrawable(null);
|
||||
if (i < length) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
mImageLoader.displayProfileImage(view, urls[i]);
|
||||
} else {
|
||||
mImageLoader.cancelDisplayTask(view);
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
if (urls.length > holder.activity_profile_images.length) {
|
||||
final int moreNumber = urls.length - holder.activity_profile_images.length;
|
||||
holder.activity_profile_image_more_number.setVisibility(View.VISIBLE);
|
||||
holder.activity_profile_image_more_number.setText(getContext().getString(R.string.and_more, moreNumber));
|
||||
} else {
|
||||
holder.activity_profile_image_more_number.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private static int getItemResource(final boolean compactCards) {
|
||||
return compactCards ? R.layout.card_item_activity_compact : R.layout.card_item_activity;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,292 +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.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
import org.mariotaku.twidere.model.ParcelableLocation;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.model.ParcelableUserList;
|
||||
import org.mariotaku.twidere.util.ImageLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.ImageLoadingHandler;
|
||||
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||
import org.mariotaku.twidere.view.holder.ActivityListViewHolder;
|
||||
|
||||
import static org.mariotaku.twidere.util.UserColorNameUtils.getUserColor;
|
||||
import static org.mariotaku.twidere.util.UserColorNameUtils.getUserNickname;
|
||||
import static org.mariotaku.twidere.util.Utils.getAccountColor;
|
||||
import static org.mariotaku.twidere.util.Utils.getCardHighlightColor;
|
||||
|
||||
public class ParcelableActivitiesAboutMeListAdapter extends BaseParcelableActivitiesAdapter {
|
||||
|
||||
private final ImageLoadingHandler mImageLoadingHandler;
|
||||
|
||||
private boolean mGapDisallowed;
|
||||
private boolean mIndicateMyStatusDisabled;
|
||||
private boolean mFavoritesHighlightDisabled;
|
||||
private boolean mDisplayImagePreview;
|
||||
private boolean mDisplaySensitiveContents;
|
||||
|
||||
public ParcelableActivitiesAboutMeListAdapter(final Context context, final boolean compactCards) {
|
||||
super(context, compactCards);
|
||||
mImageLoadingHandler = new ImageLoadingHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindView(final int position, final ActivityListViewHolder holder, final ParcelableActivity item) {
|
||||
if (item == null) return;
|
||||
final ParcelableUser[] sources = item.sources;
|
||||
if (sources == null || sources.length == 0) return;
|
||||
final ParcelableStatus[] targetStatuses = item.target_statuses;
|
||||
final int action = item.action;
|
||||
final boolean displayProfileImage = shouldDisplayProfileImage();
|
||||
|
||||
final TwidereLinkify linkify = getLinkify();
|
||||
final int highlightOption = getLinkHighlightOption();
|
||||
|
||||
final Context context = getContext();
|
||||
final ParcelableUser firstSource = sources[0];
|
||||
final ParcelableStatus[] targetObjects = item.target_object_statuses;
|
||||
final String sourceName = getName(firstSource);
|
||||
switch (action) {
|
||||
case ParcelableActivity.ACTION_FAVORITE: {
|
||||
holder.name.setVisibility(View.VISIBLE);
|
||||
holder.screen_name.setVisibility(View.GONE);
|
||||
holder.profile_image.setVisibility(View.GONE);
|
||||
holder.my_profile_image.setVisibility(View.GONE);
|
||||
holder.text.setVisibility(View.VISIBLE);
|
||||
holder.reply_retweet_status.setVisibility(View.GONE);
|
||||
holder.activity_profile_images_container.setVisibility(displayProfileImage ? View.VISIBLE : View.GONE);
|
||||
|
||||
holder.name.setSingleLine(false);
|
||||
|
||||
if (targetStatuses != null && targetStatuses.length > 0) {
|
||||
final ParcelableStatus status = targetStatuses[0];
|
||||
if (highlightOption != VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE) {
|
||||
holder.text.setText(Html.fromHtml(status.text_html));
|
||||
linkify.applyAllLinks(holder.text, status.account_id, status.is_possibly_sensitive);
|
||||
holder.text.setMovementMethod(null);
|
||||
} else {
|
||||
holder.text.setText(status.text_unescaped);
|
||||
}
|
||||
}
|
||||
if (sources.length == 1) {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_favorite, sourceName));
|
||||
} else {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_favorite_multi, sourceName,
|
||||
sources.length - 1));
|
||||
}
|
||||
displayActivityUserProfileImages(holder, sources);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_FOLLOW: {
|
||||
holder.name.setVisibility(View.VISIBLE);
|
||||
holder.screen_name.setVisibility(View.GONE);
|
||||
holder.profile_image.setVisibility(View.GONE);
|
||||
holder.my_profile_image.setVisibility(View.GONE);
|
||||
holder.text.setVisibility(View.GONE);
|
||||
holder.reply_retweet_status.setVisibility(View.GONE);
|
||||
|
||||
holder.name.setSingleLine(false);
|
||||
|
||||
if (sources.length == 1) {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_follow, sourceName));
|
||||
} else {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_follow_multi, sourceName,
|
||||
sources.length - 1));
|
||||
}
|
||||
displayActivityUserProfileImages(holder, sources);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_MENTION: {
|
||||
if (targetObjects != null && targetObjects.length > 0) {
|
||||
final ParcelableStatus status = targetObjects[0];
|
||||
displayStatus(status, holder, position);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_REPLY: {
|
||||
if (targetStatuses != null && targetStatuses.length > 0) {
|
||||
final ParcelableStatus status = targetStatuses[0];
|
||||
displayStatus(status, holder, position);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_RETWEET: {
|
||||
|
||||
holder.name.setVisibility(View.VISIBLE);
|
||||
holder.screen_name.setVisibility(View.GONE);
|
||||
holder.profile_image.setVisibility(View.GONE);
|
||||
holder.my_profile_image.setVisibility(View.GONE);
|
||||
holder.text.setVisibility(View.VISIBLE);
|
||||
holder.reply_retweet_status.setVisibility(View.GONE);
|
||||
|
||||
holder.name.setSingleLine(false);
|
||||
|
||||
if (targetObjects != null && targetObjects.length > 0) {
|
||||
final ParcelableStatus status = targetObjects[0];
|
||||
if (highlightOption != VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE) {
|
||||
holder.text.setText(Html.fromHtml(status.text_html));
|
||||
linkify.applyAllLinks(holder.text, status.account_id, status.is_possibly_sensitive);
|
||||
holder.text.setMovementMethod(null);
|
||||
} else {
|
||||
holder.text.setText(status.text_unescaped);
|
||||
}
|
||||
}
|
||||
|
||||
if (sources.length == 1) {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_retweet, sourceName));
|
||||
} else {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_retweet_multi, sourceName,
|
||||
sources.length - 1));
|
||||
}
|
||||
holder.activity_profile_images_container.setVisibility(View.VISIBLE);
|
||||
displayActivityUserProfileImages(holder, sources);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_LIST_MEMBER_ADDED: {
|
||||
holder.name.setVisibility(View.VISIBLE);
|
||||
holder.screen_name.setVisibility(View.GONE);
|
||||
holder.profile_image.setVisibility(View.GONE);
|
||||
holder.my_profile_image.setVisibility(View.GONE);
|
||||
holder.text.setVisibility(View.GONE);
|
||||
holder.reply_retweet_status.setVisibility(View.GONE);
|
||||
|
||||
holder.name.setSingleLine(false);
|
||||
|
||||
if (sources.length == 1) {
|
||||
if (item.target_object_user_lists != null && item.target_object_user_lists.length > 0) {
|
||||
final ParcelableUserList list = item.target_object_user_lists[0];
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_list_member_added_with_name,
|
||||
sourceName, list.name));
|
||||
} else {
|
||||
holder.name
|
||||
.setText(context.getString(R.string.activity_about_me_list_member_added, sourceName));
|
||||
}
|
||||
} else {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_list_member_added_multi,
|
||||
sourceName, sources.length - 1));
|
||||
}
|
||||
displayActivityUserProfileImages(holder, sources);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void displayStatus(final ParcelableStatus status, final ActivityListViewHolder holder, final int position) {
|
||||
|
||||
final boolean showGap = status.is_gap && !mGapDisallowed && position != getCount() - 1;
|
||||
final boolean displayProfileImage = isDisplayProfileImage();
|
||||
final Context context = getContext();
|
||||
|
||||
holder.setShowAsGap(showGap);
|
||||
holder.name.setVisibility(View.VISIBLE);
|
||||
holder.screen_name.setVisibility(View.VISIBLE);
|
||||
holder.text.setVisibility(View.VISIBLE);
|
||||
holder.profile_image.setVisibility(displayProfileImage ? View.VISIBLE : View.GONE);
|
||||
holder.activity_profile_images_container.setVisibility(View.GONE);
|
||||
|
||||
holder.name.setSingleLine(true);
|
||||
holder.text.setSingleLine(false);
|
||||
|
||||
if (!showGap) {
|
||||
final TwidereLinkify linkify = getLinkify();
|
||||
final int highlightOption = getLinkHighlightOption();
|
||||
final boolean showAccountColor = isShowAccountColor();
|
||||
|
||||
// Clear images in prder to prevent images in recycled view shown.
|
||||
holder.profile_image.setImageDrawable(null);
|
||||
holder.my_profile_image.setImageDrawable(null);
|
||||
holder.image_preview.setImageDrawable(null);
|
||||
|
||||
holder.setAccountColorEnabled(showAccountColor);
|
||||
|
||||
if (highlightOption != VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE) {
|
||||
holder.text.setText(Html.fromHtml(status.text_html));
|
||||
linkify.applyAllLinks(holder.text, status.account_id, status.is_possibly_sensitive);
|
||||
holder.text.setMovementMethod(null);
|
||||
} else {
|
||||
holder.text.setText(status.text_unescaped);
|
||||
}
|
||||
|
||||
if (showAccountColor) {
|
||||
holder.setAccountColor(getAccountColor(context, status.account_id));
|
||||
}
|
||||
|
||||
final boolean isMyStatus = status.account_id == status.user_id;
|
||||
final boolean hasMedia = status.first_media != null;
|
||||
holder.setUserColor(getUserColor(context, status.user_id));
|
||||
holder.setHighlightColor(getCardHighlightColor(context.getResources(), false,
|
||||
!mFavoritesHighlightDisabled && status.is_favorite, status.is_retweet));
|
||||
holder.setTextSize(getTextSize());
|
||||
|
||||
holder.setIsMyStatus(isMyStatus && !mIndicateMyStatusDisabled);
|
||||
|
||||
holder.setUserType(status.user_is_verified, status.user_is_protected);
|
||||
holder.setDisplayNameFirst(isDisplayNameFirst());
|
||||
holder.setNicknameOnly(isNicknameOnly());
|
||||
final String nick = getUserNickname(context, status.user_id);
|
||||
holder.name.setText(TextUtils.isEmpty(nick) ? status.user_name : isNicknameOnly() ? nick : context
|
||||
.getString(R.string.name_with_nickname, status.user_name, nick));
|
||||
holder.screen_name.setText("@" + status.user_screen_name);
|
||||
holder.time.setTime(status.timestamp);
|
||||
holder.setStatusType(!mFavoritesHighlightDisabled && status.is_favorite,
|
||||
ParcelableLocation.isValidLocation(status.location), hasMedia, status.is_possibly_sensitive);
|
||||
holder.setIsReplyRetweet(status.in_reply_to_status_id > 0, status.is_retweet);
|
||||
if (status.is_retweet) {
|
||||
holder.setRetweetedBy(status.retweet_count, status.retweeted_by_id, status.retweeted_by_name,
|
||||
status.retweeted_by_screen_name);
|
||||
} else if (status.in_reply_to_status_id > 0) {
|
||||
holder.setReplyTo(status.in_reply_to_user_id, status.in_reply_to_name, status.in_reply_to_screen_name);
|
||||
}
|
||||
if (displayProfileImage) {
|
||||
setProfileImage(holder.my_profile_image, status);
|
||||
setProfileImage(holder.profile_image, status);
|
||||
holder.profile_image.setTag(position);
|
||||
holder.my_profile_image.setTag(position);
|
||||
} else {
|
||||
holder.profile_image.setVisibility(View.GONE);
|
||||
holder.my_profile_image.setVisibility(View.GONE);
|
||||
}
|
||||
final boolean hasPreview = mDisplayImagePreview && hasMedia;
|
||||
holder.image_preview_container.setVisibility(hasPreview ? View.VISIBLE : View.GONE);
|
||||
if (hasPreview) {
|
||||
if (status.is_possibly_sensitive && !mDisplaySensitiveContents) {
|
||||
holder.image_preview.setImageDrawable(null);
|
||||
holder.image_preview.setBackgroundResource(R.drawable.image_preview_nsfw);
|
||||
holder.image_preview_progress.setVisibility(View.GONE);
|
||||
} else if (!status.first_media.equals(mImageLoadingHandler.getLoadingUri(holder.image_preview))) {
|
||||
holder.image_preview.setBackgroundResource(0);
|
||||
final ImageLoaderWrapper imageLoader = getImageLoader();
|
||||
imageLoader.displayPreviewImage(holder.image_preview, status.first_media, mImageLoadingHandler);
|
||||
}
|
||||
holder.image_preview.setTag(position);
|
||||
}
|
||||
// holder.item_menu.setTag(position);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -23,6 +23,7 @@ import android.content.Context;
|
|||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
import org.mariotaku.twidere.view.holder.ActivityTitleSummaryViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -81,6 +82,11 @@ public class ParcelableActivitiesAdapter extends AbsActivitiesAdapter<List<Parce
|
|||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindTitleSummaryViewHolder(ActivityTitleSummaryViewHolder holder, int position) {
|
||||
holder.displayActivity(getActivity(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelableActivity> getData() {
|
||||
return mData;
|
||||
|
|
|
@ -1,172 +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.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.model.ParcelableUserList;
|
||||
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||
import org.mariotaku.twidere.view.holder.ActivityListViewHolder;
|
||||
|
||||
public class ParcelableActivitiesByFriendsAdapter extends BaseParcelableActivitiesAdapter {
|
||||
|
||||
public ParcelableActivitiesByFriendsAdapter(final Context context, final boolean compactCards) {
|
||||
super(context, compactCards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindView(final int position, final ActivityListViewHolder holder, final ParcelableActivity item) {
|
||||
if (item == null) return;
|
||||
final ParcelableUser[] sources = item.sources;
|
||||
final ParcelableStatus[] targetStatuses = item.target_statuses;
|
||||
final ParcelableUser[] targetUsers = item.target_users;
|
||||
final ParcelableStatus[] target_object_statuses = item.target_object_statuses;
|
||||
final ParcelableUserList[] targetUserLists = item.target_user_lists;
|
||||
final ParcelableUserList[] target_object_user_lists = item.target_object_user_lists;
|
||||
final int sourcesLength = sources != null ? sources.length : 0;
|
||||
final int targetStatusesLength = targetStatuses != null ? targetStatuses.length : 0;
|
||||
final int target_users_length = targetUsers != null ? targetUsers.length : 0;
|
||||
final int target_object_user_lists_length = target_object_user_lists != null ? target_object_user_lists.length
|
||||
: 0;
|
||||
final int target_user_lists_length = targetUserLists != null ? targetUserLists.length : 0;
|
||||
final int action = item.action;
|
||||
final Context context = getContext();
|
||||
|
||||
final TwidereLinkify linkify = getLinkify();
|
||||
final int highlightOption = getLinkHighlightOption();
|
||||
|
||||
holder.name.setSingleLine(false);
|
||||
holder.screen_name.setVisibility(View.GONE);
|
||||
holder.reply_retweet_status.setVisibility(View.GONE);
|
||||
if (holder.divider != null) {
|
||||
holder.divider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (sources != null && sources.length != 0) {
|
||||
final ParcelableUser firstSource = sources[0];
|
||||
final String firstSourceName = getName(firstSource);
|
||||
switch (action) {
|
||||
case ParcelableActivity.ACTION_FAVORITE: {
|
||||
if (targetStatuses == null || targetStatuses.length == 0) return;
|
||||
final ParcelableStatus status = targetStatuses[0];
|
||||
if (targetStatusesLength == 1) {
|
||||
holder.text.setVisibility(View.VISIBLE);
|
||||
if (highlightOption != VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE) {
|
||||
holder.text.setText(Html.fromHtml(status.text_html));
|
||||
linkify.applyAllLinks(holder.text, status.account_id, status.is_possibly_sensitive);
|
||||
holder.text.setMovementMethod(null);
|
||||
} else {
|
||||
holder.text.setText(status.text_unescaped);
|
||||
}
|
||||
holder.name.setText(context.getString(R.string.activity_by_friends_favorite, firstSourceName,
|
||||
getName(status)));
|
||||
} else {
|
||||
holder.text.setVisibility(View.GONE);
|
||||
holder.name.setText(context.getString(R.string.activity_by_friends_favorite_multi,
|
||||
firstSourceName, getName(status), targetStatusesLength - 1));
|
||||
}
|
||||
displayProfileImage(holder.profile_image, firstSource);
|
||||
displayActivityUserProfileImages(holder, targetStatuses);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_FOLLOW: {
|
||||
holder.text.setVisibility(View.GONE);
|
||||
if (targetUsers == null || targetUsers.length == 0) return;
|
||||
if (targetUsers.length == 1) {
|
||||
holder.name.setText(context.getString(R.string.activity_by_friends_follow, firstSourceName,
|
||||
getName(targetUsers[0])));
|
||||
} else {
|
||||
holder.name.setText(context.getString(R.string.activity_by_friends_follow_multi,
|
||||
firstSourceName, getName(targetUsers[0]), target_users_length - 1));
|
||||
}
|
||||
displayProfileImage(holder.profile_image, firstSource);
|
||||
displayActivityUserProfileImages(holder, targetUsers);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_RETWEET: {
|
||||
holder.text.setVisibility(View.VISIBLE);
|
||||
if (target_object_statuses != null && target_object_statuses.length > 0) {
|
||||
final ParcelableStatus status = target_object_statuses[0];
|
||||
if (highlightOption != VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE) {
|
||||
holder.text.setText(Html.fromHtml(status.text_html));
|
||||
linkify.applyAllLinks(holder.text, status.account_id, status.is_possibly_sensitive);
|
||||
holder.text.setMovementMethod(null);
|
||||
} else {
|
||||
holder.text.setText(status.text_unescaped);
|
||||
}
|
||||
}
|
||||
if (sourcesLength == 1) {
|
||||
holder.name.setText(context.getString(R.string.activity_by_friends_retweet, firstSourceName,
|
||||
getName(targetStatuses[0])));
|
||||
} else {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_retweet_multi,
|
||||
firstSourceName, sourcesLength - 1));
|
||||
}
|
||||
displayActivityUserProfileImages(holder, sources);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_LIST_MEMBER_ADDED: {
|
||||
holder.text.setVisibility(View.GONE);
|
||||
if (target_object_user_lists_length == 1) {
|
||||
holder.name.setText(context.getString(R.string.activity_by_friends_list_member_added,
|
||||
firstSourceName, getName(targetUsers[0])));
|
||||
} else {
|
||||
holder.name.setText(context.getString(R.string.activity_about_me_list_member_added_multi,
|
||||
firstSourceName, sourcesLength - 1));
|
||||
}
|
||||
displayProfileImage(holder.profile_image, firstSource);
|
||||
displayActivityUserProfileImages(holder, targetUsers);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_LIST_CREATED: {
|
||||
if (target_user_lists_length == 0) return;
|
||||
holder.activity_profile_images_container.setVisibility(View.GONE);
|
||||
final ParcelableUserList userList = targetUserLists[0];
|
||||
if (target_user_lists_length == 1) {
|
||||
if (!TextUtils.isEmpty(userList.description)) {
|
||||
holder.text.setVisibility(View.VISIBLE);
|
||||
holder.text.setText(userList.description);
|
||||
} else {
|
||||
if (holder.divider != null) {
|
||||
holder.divider.setVisibility(View.GONE);
|
||||
}
|
||||
holder.text.setVisibility(View.GONE);
|
||||
}
|
||||
holder.name.setText(context.getString(R.string.activity_by_friends_list_created,
|
||||
firstSourceName, userList.name));
|
||||
} else {
|
||||
holder.text.setVisibility(View.GONE);
|
||||
holder.name.setText(context.getString(R.string.activity_by_friends_list_created_multi,
|
||||
firstSourceName, userList.name, target_user_lists_length - 1));
|
||||
}
|
||||
displayProfileImage(holder.profile_image, firstSource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,6 @@ package org.mariotaku.twidere.fragment.support;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -43,7 +42,6 @@ import org.mariotaku.twidere.adapter.AbsActivitiesAdapter;
|
|||
import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.fragment.iface.RefreshScrollTopInterface;
|
||||
import org.mariotaku.twidere.util.AccelerateSmoothScroller;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.SimpleDrawerCallback;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
@ -71,16 +69,20 @@ public abstract class AbsActivitiesFragment<Data> extends BaseSupportFragment im
|
|||
private AbsActivitiesAdapter<Data> mAdapter;
|
||||
private SimpleDrawerCallback mDrawerCallback;
|
||||
private OnScrollListener mOnScrollListener = new OnScrollListener() {
|
||||
|
||||
private int mScrollState;
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
mScrollState = newState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
final LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
if (isRefreshing()) return;
|
||||
if (mAdapter.hasLoadMoreIndicator()
|
||||
if (mAdapter.hasLoadMoreIndicator() && mScrollState != RecyclerView.SCROLL_STATE_IDLE
|
||||
&& layoutManager.findLastVisibleItemPosition() == mAdapter.getItemCount() - 1) {
|
||||
onLoadMoreStatuses();
|
||||
}
|
||||
|
@ -221,26 +223,7 @@ public abstract class AbsActivitiesFragment<Data> extends BaseSupportFragment im
|
|||
if (twitter != null && tabPosition != -1) {
|
||||
twitter.clearUnreadCountAsync(tabPosition);
|
||||
}
|
||||
// mRecyclerView.smoothScrollToPosition(0);
|
||||
final LinearLayoutManager layoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
|
||||
final AccelerateSmoothScroller smoothScroller = new AccelerateSmoothScroller(getActivity(), 2) {
|
||||
|
||||
@Override
|
||||
public PointF computeScrollVectorForPosition(int targetPosition) {
|
||||
if (getChildCount() == 0) {
|
||||
return null;
|
||||
}
|
||||
final int firstChildPos = layoutManager.getPosition(layoutManager.getChildAt(0));
|
||||
final int direction = targetPosition < firstChildPos != layoutManager.getReverseLayout() ? -1 : 1;
|
||||
if (layoutManager.getOrientation() == LinearLayoutManager.HORIZONTAL) {
|
||||
return new PointF(direction, 0);
|
||||
} else {
|
||||
return new PointF(0, direction);
|
||||
}
|
||||
}
|
||||
};
|
||||
smoothScroller.setTargetPosition(0);
|
||||
layoutManager.startSmoothScroll(smoothScroller);
|
||||
mRecyclerView.smoothScrollToPosition(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.mariotaku.twidere.fragment.support;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -28,7 +27,6 @@ import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration;
|
|||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.fragment.iface.RefreshScrollTopInterface;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.util.AccelerateSmoothScroller;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.SimpleDrawerCallback;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
@ -264,26 +262,7 @@ public abstract class AbsStatusesFragment<Data> extends BaseSupportFragment impl
|
|||
if (twitter != null && tabPosition != -1) {
|
||||
twitter.clearUnreadCountAsync(tabPosition);
|
||||
}
|
||||
// mRecyclerView.smoothScrollToPosition(0);
|
||||
final LinearLayoutManager layoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
|
||||
final AccelerateSmoothScroller smoothScroller = new AccelerateSmoothScroller(getActivity(), 2) {
|
||||
|
||||
@Override
|
||||
public PointF computeScrollVectorForPosition(int targetPosition) {
|
||||
if (getChildCount() == 0) {
|
||||
return null;
|
||||
}
|
||||
final int firstChildPos = layoutManager.getPosition(layoutManager.getChildAt(0));
|
||||
final int direction = targetPosition < firstChildPos != layoutManager.getReverseLayout() ? -1 : 1;
|
||||
if (layoutManager.getOrientation() == LinearLayoutManager.HORIZONTAL) {
|
||||
return new PointF(direction, 0);
|
||||
} else {
|
||||
return new PointF(0, direction);
|
||||
}
|
||||
}
|
||||
};
|
||||
smoothScroller.setTargetPosition(0);
|
||||
layoutManager.startSmoothScroll(smoothScroller);
|
||||
mRecyclerView.smoothScrollToPosition(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
* 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.v4.content.Loader;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.mariotaku.twidere.adapter.BaseParcelableActivitiesAdapter;
|
||||
import org.mariotaku.twidere.adapter.ParcelableActivitiesAboutMeListAdapter;
|
||||
import org.mariotaku.twidere.loader.support.ActivitiesAboutMeLoader;
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.openStatus;
|
||||
import static org.mariotaku.twidere.util.Utils.openUserProfile;
|
||||
import static org.mariotaku.twidere.util.Utils.openUsers;
|
||||
|
||||
public class ActivitiesAboutMeListFragment extends BaseActivitiesListFragment {
|
||||
|
||||
@Override
|
||||
public BaseParcelableActivitiesAdapter createListAdapter(final Context context, final boolean compactCards) {
|
||||
return new ParcelableActivitiesAboutMeListAdapter(context, compactCards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<List<ParcelableActivity>> onCreateLoader(final int id, final Bundle args) {
|
||||
setProgressBarIndeterminateVisibility(true);
|
||||
return new ActivitiesAboutMeLoader(getActivity(), getAccountIds()[0], -1, -1, getData(),
|
||||
getSavedActivitiesFileArgs(), getTabPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(final ListView l, final View v, final int position, final long id) {
|
||||
final int adapter_pos = position - l.getHeaderViewsCount();
|
||||
final ParcelableActivity item = getListAdapter().getItem(adapter_pos);
|
||||
if (item == null) return;
|
||||
final ParcelableUser[] sources = item.sources;
|
||||
if (sources == null || sources.length == 0) return;
|
||||
final ParcelableStatus[] target_statuses = item.target_statuses;
|
||||
final ParcelableStatus[] target_objects = item.target_object_statuses;
|
||||
switch (item.action) {
|
||||
case ParcelableActivity.ACTION_FAVORITE: {
|
||||
if (sources.length == 1) {
|
||||
openUserProfile(getActivity(), sources[0], null);
|
||||
} else {
|
||||
final List<ParcelableUser> users = Arrays.asList(sources);
|
||||
openUsers(getActivity(), users);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_FOLLOW: {
|
||||
if (sources.length == 1) {
|
||||
openUserProfile(getActivity(), sources[0], null);
|
||||
} else {
|
||||
final List<ParcelableUser> users = Arrays.asList(sources);
|
||||
openUsers(getActivity(), users);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_MENTION: {
|
||||
if (target_objects != null && target_objects.length > 0) {
|
||||
openStatus(getActivity(), target_objects[0], null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_REPLY: {
|
||||
if (target_statuses != null && target_statuses.length > 0) {
|
||||
openStatus(getActivity(), target_statuses[0], null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_RETWEET: {
|
||||
if (sources.length == 1) {
|
||||
openUserProfile(getActivity(), sources[0], null);
|
||||
} else {
|
||||
final List<ParcelableUser> users = Arrays.asList(sources);
|
||||
openUsers(getActivity(), users);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getSavedActivitiesFileArgs() {
|
||||
final Bundle args = getArguments();
|
||||
if (args != null && args.containsKey(EXTRA_ACCOUNT_ID)) {
|
||||
final long account_id = args.getLong(EXTRA_ACCOUNT_ID, -1);
|
||||
return new String[]{AUTHORITY_ACTIVITIES_ABOUT_ME, "account" + account_id};
|
||||
}
|
||||
return new String[]{AUTHORITY_ACTIVITIES_ABOUT_ME};
|
||||
}
|
||||
|
||||
}
|
|
@ -19,97 +19,30 @@
|
|||
|
||||
package org.mariotaku.twidere.fragment.support;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.mariotaku.twidere.adapter.BaseParcelableActivitiesAdapter;
|
||||
import org.mariotaku.twidere.adapter.ParcelableActivitiesByFriendsAdapter;
|
||||
import org.mariotaku.twidere.loader.support.ActivitiesAboutMeLoader;
|
||||
import org.mariotaku.twidere.loader.support.ActivitiesByFriendsLoader;
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.openStatus;
|
||||
import static org.mariotaku.twidere.util.Utils.openStatuses;
|
||||
import static org.mariotaku.twidere.util.Utils.openUserProfile;
|
||||
import static org.mariotaku.twidere.util.Utils.openUsers;
|
||||
public class ActivitiesByFriendsFragment extends ParcelableActivitiesFragment {
|
||||
|
||||
public class ActivitiesByFriendsFragment extends BaseActivitiesListFragment {
|
||||
|
||||
@Override
|
||||
public BaseParcelableActivitiesAdapter createListAdapter(final Context context, final boolean compactCards) {
|
||||
return new ParcelableActivitiesByFriendsAdapter(context, compactCards);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<List<ParcelableActivity>> onCreateLoader(final int id, final Bundle args) {
|
||||
setProgressBarIndeterminateVisibility(true);
|
||||
return new ActivitiesAboutMeLoader(getActivity(), getAccountIds()[0], -1, -1, getData(),
|
||||
final long[] accountIds = args.getLongArray(EXTRA_ACCOUNT_IDS);
|
||||
final long[] sinceIds = args.getLongArray(EXTRA_SINCE_IDS);
|
||||
final long[] maxIds = args.getLongArray(EXTRA_MAX_IDS);
|
||||
final long accountId = accountIds != null ? accountIds[0] : -1;
|
||||
final long sinceId = sinceIds != null ? sinceIds[0] : -1;
|
||||
final long maxId = maxIds != null ? maxIds[0] : -1;
|
||||
return new ActivitiesByFriendsLoader(getActivity(), accountId, sinceId, maxId, getAdapterData(),
|
||||
getSavedActivitiesFileArgs(), getTabPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(final ListView l, final View v, final int position, final long id) {
|
||||
final int adapterPos = position - l.getHeaderViewsCount();
|
||||
final ParcelableActivity item = getListAdapter().getItem(adapterPos);
|
||||
if (item == null) return;
|
||||
final ParcelableUser[] sources = item.sources;
|
||||
if (sources == null || sources.length == 0) return;
|
||||
final ParcelableStatus[] targetStatuses = item.target_statuses;
|
||||
final ParcelableUser[] targetUsers = item.target_users;
|
||||
final ParcelableStatus[] target_object_statuses = item.target_object_statuses;
|
||||
switch (item.action) {
|
||||
case ParcelableActivity.ACTION_FAVORITE: {
|
||||
if (targetStatuses == null || targetStatuses.length == 0) return;
|
||||
if (targetStatuses.length == 1) {
|
||||
openStatus(getActivity(), targetStatuses[0], null);
|
||||
} else {
|
||||
final List<ParcelableStatus> statuses = Arrays.asList(targetStatuses);
|
||||
openStatuses(getActivity(), statuses);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_FOLLOW: {
|
||||
if (targetUsers == null || targetUsers.length == 0) return;
|
||||
if (targetUsers.length == 1) {
|
||||
openUserProfile(getActivity(), targetUsers[0], null);
|
||||
} else {
|
||||
final List<ParcelableUser> users = Arrays.asList(targetUsers);
|
||||
openUsers(getActivity(), users);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_MENTION: {
|
||||
if (target_object_statuses != null && target_object_statuses.length > 0) {
|
||||
openStatus(getActivity(), target_object_statuses[0], null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_REPLY: {
|
||||
if (targetStatuses != null && targetStatuses.length > 0) {
|
||||
openStatus(getActivity(), targetStatuses[0], null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_RETWEET: {
|
||||
if (targetStatuses == null || targetStatuses.length == 0) return;
|
||||
if (targetStatuses.length == 1) {
|
||||
openStatus(getActivity(), targetStatuses[0], null);
|
||||
} else {
|
||||
final List<ParcelableStatus> statuses = Arrays.asList(targetStatuses);
|
||||
openStatuses(getActivity(), statuses);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] getSavedActivitiesFileArgs() {
|
||||
final Bundle args = getArguments();
|
||||
|
|
|
@ -1,133 +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.fragment.support;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.mariotaku.twidere.adapter.BaseParcelableActivitiesAdapter;
|
||||
import org.mariotaku.twidere.loader.support.Twitter4JActivitiesLoaderOld;
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
import org.mariotaku.twidere.util.ArrayUtils;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.mariotaku.twidere.util.Utils.encodeQueryParams;
|
||||
import static org.mariotaku.twidere.util.Utils.getDefaultTextSize;
|
||||
|
||||
public abstract class BaseActivitiesListFragment extends BasePullToRefreshListFragment implements
|
||||
LoaderCallbacks<List<ParcelableActivity>> {
|
||||
|
||||
private BaseParcelableActivitiesAdapter mAdapter;
|
||||
private SharedPreferences mPreferences;
|
||||
|
||||
private List<ParcelableActivity> mData;
|
||||
|
||||
public abstract BaseParcelableActivitiesAdapter createListAdapter(final Context context,
|
||||
final boolean compactCards);
|
||||
|
||||
@Override
|
||||
public BaseParcelableActivitiesAdapter getListAdapter() {
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final boolean compactCards = mPreferences.getBoolean(KEY_COMPACT_CARDS, false);
|
||||
mAdapter = createListAdapter(getActivity(), compactCards);
|
||||
setListAdapter(mAdapter);
|
||||
final ListView lv = getListView();
|
||||
if (!compactCards) {
|
||||
lv.setDivider(null);
|
||||
}
|
||||
lv.setSelector(android.R.color.transparent);
|
||||
getLoaderManager().initLoader(0, getArguments(), this);
|
||||
setListShown(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(final Loader<List<ParcelableActivity>> loader) {
|
||||
mAdapter.setData(null);
|
||||
mData = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(final Loader<List<ParcelableActivity>> loader, final List<ParcelableActivity> data) {
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
mData = data;
|
||||
mAdapter.setData(data);
|
||||
if (loader instanceof Twitter4JActivitiesLoaderOld) {
|
||||
final boolean multipleAccounts = ((Twitter4JActivitiesLoaderOld) loader).getAccountIds().length > 1;
|
||||
mAdapter.setShowAccountColor(multipleAccounts);
|
||||
}
|
||||
setRefreshing(false);
|
||||
setListShown(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
if (isRefreshing()) return;
|
||||
getLoaderManager().restartLoader(0, getArguments(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
final float text_size = mPreferences.getInt(KEY_TEXT_SIZE, getDefaultTextSize(getActivity()));
|
||||
final boolean display_profile_image = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
final boolean show_absolute_time = mPreferences.getBoolean(KEY_SHOW_ABSOLUTE_TIME, false);
|
||||
mAdapter.setDisplayProfileImage(display_profile_image);
|
||||
mAdapter.setTextSize(text_size);
|
||||
mAdapter.setShowAbsoluteTime(show_absolute_time);
|
||||
}
|
||||
|
||||
protected final long[] getAccountIds() {
|
||||
final Bundle args = getArguments();
|
||||
if (args != null && args.containsKey(EXTRA_ACCOUNT_ID))
|
||||
return new long[]{args.getLong(EXTRA_ACCOUNT_ID)};
|
||||
return Utils.getActivatedAccountIds(getActivity());
|
||||
}
|
||||
|
||||
protected final List<ParcelableActivity> getData() {
|
||||
return mData;
|
||||
}
|
||||
|
||||
protected final String getPositionKey() {
|
||||
final Object[] args = getSavedActivitiesFileArgs();
|
||||
if (args == null || args.length <= 0) return null;
|
||||
try {
|
||||
return encodeQueryParams(ArrayUtils.toString(args, '.', false) + "." + getTabPosition());
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract Object[] getSavedActivitiesFileArgs();
|
||||
|
||||
}
|
|
@ -395,6 +395,7 @@ public class StatusFragment extends BaseSupportFragment
|
|||
private final int mCardLayoutResource;
|
||||
private final int mTextSize;
|
||||
private final int mCardBackgroundColor;
|
||||
private final boolean mIsCompact;
|
||||
|
||||
private ParcelableStatus mStatus;
|
||||
private ParcelableCredentials mStatusAccount;
|
||||
|
@ -417,6 +418,7 @@ public class StatusFragment extends BaseSupportFragment
|
|||
mNameFirst = preferences.getBoolean(KEY_NAME_FIRST, true);
|
||||
mNicknameOnly = preferences.getBoolean(KEY_NICKNAME_ONLY, true);
|
||||
mTextSize = preferences.getInt(KEY_TEXT_SIZE, res.getInteger(R.integer.default_text_size));
|
||||
mIsCompact = compact;
|
||||
if (compact) {
|
||||
mCardLayoutResource = R.layout.card_item_status_compat;
|
||||
} else {
|
||||
|
@ -572,7 +574,12 @@ public class StatusFragment extends BaseSupportFragment
|
|||
switch (viewType) {
|
||||
case VIEW_TYPE_DETAIL_STATUS: {
|
||||
if (mCachedHolder != null) return mCachedHolder;
|
||||
final View view = mInflater.inflate(R.layout.header_status, parent, false);
|
||||
final View view;
|
||||
if (mIsCompact) {
|
||||
view = mInflater.inflate(R.layout.header_status_common, parent, false);
|
||||
} else {
|
||||
view = mInflater.inflate(R.layout.header_status, parent, false);
|
||||
}
|
||||
final CardView cardView = (CardView) view.findViewById(R.id.card);
|
||||
if (cardView != null) {
|
||||
cardView.setCardBackgroundColor(mCardBackgroundColor);
|
||||
|
@ -586,7 +593,7 @@ public class StatusFragment extends BaseSupportFragment
|
|||
cardView.setCardBackgroundColor(mCardBackgroundColor);
|
||||
}
|
||||
final StatusViewHolder holder = new StatusViewHolder(this, view);
|
||||
holder.setupViewListeners();
|
||||
holder.setOnClickListeners();
|
||||
return holder;
|
||||
}
|
||||
case VIEW_TYPE_CONVERSATION_LOAD_INDICATOR:
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.mariotaku.twidere.loader.support;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import org.mariotaku.twidere.model.ParcelableActivity;
|
||||
|
||||
|
@ -30,12 +31,13 @@ import twitter4j.Paging;
|
|||
import twitter4j.Twitter;
|
||||
import twitter4j.TwitterException;
|
||||
|
||||
public class ActivitiesByFriendsLoader extends Twitter4JActivitiesLoaderOld {
|
||||
public class ActivitiesByFriendsLoader extends Twitter4JActivitiesLoader {
|
||||
|
||||
public ActivitiesByFriendsLoader(final Context context, final long[] accountIds, long[] sinceIds,
|
||||
long[] maxIds, final List<ParcelableActivity> data,
|
||||
final String[] saveFileArgs, final boolean useCache) {
|
||||
super(context, accountIds, sinceIds, maxIds, data, saveFileArgs, useCache);
|
||||
|
||||
public ActivitiesByFriendsLoader(final Context context, final long accountId, long sinceId,
|
||||
long maxId, final List<ParcelableActivity> data,
|
||||
final String[] saveFileArgs, final int position) {
|
||||
super(context, accountId, sinceId, maxId, data, saveFileArgs, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,4 +46,10 @@ public class ActivitiesByFriendsLoader extends Twitter4JActivitiesLoaderOld {
|
|||
return twitter.getActivitiesByFriends(paging);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldFilterActivity(SQLiteDatabase database, ParcelableActivity activity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ public abstract class Twitter4JStatusesLoader extends ParcelableStatusesLoader {
|
|||
final Context context = getContext();
|
||||
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
final int loadItemLimit = prefs.getInt(KEY_LOAD_ITEM_LIMIT, DEFAULT_LOAD_ITEM_LIMIT);
|
||||
final int databaseLimit = prefs.getInt(KEY_DATABASE_ITEM_LIMIT, DEFAULT_DATABASE_ITEM_LIMIT);
|
||||
try {
|
||||
final Paging paging = new Paging();
|
||||
paging.setCount(loadItemLimit);
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* 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.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
|
|
@ -11,10 +11,16 @@ import android.widget.ImageView;
|
|||
*/
|
||||
public class ActionIconView extends ImageView {
|
||||
|
||||
private final int mDefaultColor;
|
||||
|
||||
public ActionIconView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public int getDefaultColor() {
|
||||
return mDefaultColor;
|
||||
}
|
||||
|
||||
public ActionIconView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
@ -22,7 +28,8 @@ public class ActionIconView extends ImageView {
|
|||
public ActionIconView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.colorForeground});
|
||||
setColorFilter(a.getColor(0, 0), Mode.SRC_ATOP);
|
||||
mDefaultColor = a.getColor(0, 0);
|
||||
setColorFilter(mDefaultColor, Mode.SRC_ATOP);
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,14 @@
|
|||
package org.mariotaku.twidere.view.holder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
@ -32,6 +39,8 @@ import org.mariotaku.twidere.model.ParcelableActivity;
|
|||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.util.ImageLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.UserColorNameUtils;
|
||||
import org.mariotaku.twidere.view.ActionIconView;
|
||||
import org.oshkimaadziig.george.androidutils.SpanFormatter;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/1/3.
|
||||
|
@ -39,7 +48,7 @@ import org.mariotaku.twidere.util.UserColorNameUtils;
|
|||
public class ActivityTitleSummaryViewHolder extends ViewHolder {
|
||||
|
||||
private final AbsActivitiesAdapter adapter;
|
||||
private final ImageView activityTypeView;
|
||||
private final ActionIconView activityTypeView;
|
||||
private final TextView titleView;
|
||||
private final TextView summaryView;
|
||||
private final ViewGroup profileImagesContainer;
|
||||
|
@ -49,7 +58,7 @@ public class ActivityTitleSummaryViewHolder extends ViewHolder {
|
|||
public ActivityTitleSummaryViewHolder(AbsActivitiesAdapter adapter, View itemView) {
|
||||
super(itemView);
|
||||
this.adapter = adapter;
|
||||
activityTypeView = (ImageView) itemView.findViewById(R.id.activity_type);
|
||||
activityTypeView = (ActionIconView) itemView.findViewById(R.id.activity_type);
|
||||
titleView = (TextView) itemView.findViewById(R.id.title);
|
||||
summaryView = (TextView) itemView.findViewById(R.id.summary);
|
||||
|
||||
|
@ -65,54 +74,135 @@ public class ActivityTitleSummaryViewHolder extends ViewHolder {
|
|||
|
||||
public void displayActivity(ParcelableActivity activity) {
|
||||
final Context context = adapter.getContext();
|
||||
final Resources resources = adapter.getContext().getResources();
|
||||
switch (activity.action) {
|
||||
case ParcelableActivity.ACTION_FOLLOW: {
|
||||
activityTypeView.setImageResource(R.drawable.ic_indicator_followers);
|
||||
final String firstDisplayName = UserColorNameUtils.getDisplayName(context,
|
||||
activity.sources[0]);
|
||||
if (activity.sources.length > 1) {
|
||||
titleView.setText(context.getString(R.string.activity_about_me_follow_multi,
|
||||
firstDisplayName, activity.sources.length - 1));
|
||||
} else {
|
||||
titleView.setText(context.getString(R.string.activity_about_me_follow,
|
||||
firstDisplayName));
|
||||
}
|
||||
activityTypeView.setImageResource(R.drawable.ic_activity_action_follow);
|
||||
activityTypeView.setColorFilter(resources.getColor(R.color.highlight_follow), Mode.SRC_ATOP);
|
||||
titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_follow,
|
||||
R.string.activity_about_me_follow_multi, activity.sources));
|
||||
displayUserProfileImages(activity.sources);
|
||||
summaryView.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_FAVORITE: {
|
||||
activityTypeView.setImageResource(R.drawable.ic_indicator_starred);
|
||||
final String firstDisplayName = UserColorNameUtils.getDisplayName(context,
|
||||
activity.sources[0]);
|
||||
if (activity.sources.length > 1) {
|
||||
titleView.setText(context.getString(R.string.activity_about_me_favorite_multi,
|
||||
firstDisplayName, activity.sources.length - 1));
|
||||
} else {
|
||||
titleView.setText(context.getString(R.string.activity_about_me_favorite,
|
||||
firstDisplayName));
|
||||
}
|
||||
activityTypeView.setImageResource(R.drawable.ic_activity_action_favorite);
|
||||
activityTypeView.setColorFilter(resources.getColor(R.color.highlight_favorite), Mode.SRC_ATOP);
|
||||
titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_favorite,
|
||||
R.string.activity_about_me_favorite_multi, activity.sources));
|
||||
displayUserProfileImages(activity.sources);
|
||||
summaryView.setText(activity.target_statuses[0].text_unescaped);
|
||||
summaryView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_RETWEET: {
|
||||
activityTypeView.setImageResource(R.drawable.ic_indicator_retweet);
|
||||
final String firstDisplayName = UserColorNameUtils.getDisplayName(context,
|
||||
activity.sources[0]);
|
||||
if (activity.sources.length > 1) {
|
||||
titleView.setText(context.getString(R.string.activity_about_me_retweet_multi,
|
||||
firstDisplayName, activity.sources.length - 1));
|
||||
} else {
|
||||
titleView.setText(context.getString(R.string.activity_about_me_retweet,
|
||||
firstDisplayName));
|
||||
}
|
||||
activityTypeView.setImageResource(R.drawable.ic_activity_action_retweet);
|
||||
activityTypeView.setColorFilter(resources.getColor(R.color.highlight_retweet), Mode.SRC_ATOP);
|
||||
titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_retweet,
|
||||
R.string.activity_about_me_retweet_multi, activity.sources));
|
||||
displayUserProfileImages(activity.sources);
|
||||
summaryView.setText(activity.target_statuses[0].text_unescaped);
|
||||
summaryView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_FAVORITED_RETWEET: {
|
||||
activityTypeView.setImageResource(R.drawable.ic_activity_action_favorite);
|
||||
activityTypeView.setColorFilter(resources.getColor(R.color.highlight_favorite), Mode.SRC_ATOP);
|
||||
titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_favorited_retweet,
|
||||
R.string.activity_about_me_favorited_retweet_multi, activity.sources));
|
||||
displayUserProfileImages(activity.sources);
|
||||
summaryView.setText(activity.target_statuses[0].text_unescaped);
|
||||
summaryView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_RETWEETED_RETWEET: {
|
||||
activityTypeView.setImageResource(R.drawable.ic_activity_action_retweet);
|
||||
activityTypeView.setColorFilter(resources.getColor(R.color.highlight_retweet), Mode.SRC_ATOP);
|
||||
titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_retweeted_retweet,
|
||||
R.string.activity_about_me_retweeted_retweet_multi, activity.sources));
|
||||
displayUserProfileImages(activity.sources);
|
||||
summaryView.setText(activity.target_statuses[0].text_unescaped);
|
||||
summaryView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
case ParcelableActivity.ACTION_LIST_MEMBER_ADDED: {
|
||||
activityTypeView.setImageResource(R.drawable.ic_activity_action_list_added);
|
||||
activityTypeView.setColorFilter(activityTypeView.getDefaultColor(), Mode.SRC_ATOP);
|
||||
if (activity.sources.length == 1 && activity.target_object_user_lists != null
|
||||
&& activity.target_object_user_lists.length == 1) {
|
||||
final SpannableString firstDisplayName = new SpannableString(UserColorNameUtils.getDisplayName(context,
|
||||
activity.sources[0]));
|
||||
final SpannableString listName = new SpannableString(activity.target_object_user_lists[0].name);
|
||||
firstDisplayName.setSpan(new StyleSpan(Typeface.BOLD), 0, firstDisplayName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
listName.setSpan(new StyleSpan(Typeface.BOLD), 0, listName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
final String format = context.getString(R.string.activity_about_me_list_member_added_with_name);
|
||||
final Configuration configuration = resources.getConfiguration();
|
||||
titleView.setText(SpanFormatter.format(configuration.locale, format, firstDisplayName,
|
||||
listName));
|
||||
} else {
|
||||
titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_list_member_added,
|
||||
R.string.activity_about_me_list_member_added_multi, activity.sources));
|
||||
}
|
||||
displayUserProfileImages(activity.sources);
|
||||
summaryView.setVisibility(View.GONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Spanned getTitleStringAboutMe(int stringRes, int stringResMulti, ParcelableUser[] sources) {
|
||||
if (sources == null || sources.length == 0) return null;
|
||||
final Context context = adapter.getContext();
|
||||
final Resources resources = context.getResources();
|
||||
final Configuration configuration = resources.getConfiguration();
|
||||
final SpannableString firstDisplayName = new SpannableString(UserColorNameUtils.getDisplayName(context,
|
||||
sources[0]));
|
||||
firstDisplayName.setSpan(new StyleSpan(Typeface.BOLD), 0, firstDisplayName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
if (sources.length == 1) {
|
||||
final String format = context.getString(stringRes);
|
||||
return SpanFormatter.format(configuration.locale, format, firstDisplayName);
|
||||
} else if (sources.length == 2) {
|
||||
final String format = context.getString(stringResMulti);
|
||||
final SpannableString secondDisplayName = new SpannableString(UserColorNameUtils.getDisplayName(context, sources[1]));
|
||||
secondDisplayName.setSpan(new StyleSpan(Typeface.BOLD), 0, secondDisplayName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
return SpanFormatter.format(configuration.locale, format, firstDisplayName,
|
||||
secondDisplayName);
|
||||
} else {
|
||||
final int othersCount = sources.length - 1;
|
||||
final SpannableString nOthers = new SpannableString(resources.getQuantityString(R.plurals.N_others, othersCount, othersCount));
|
||||
nOthers.setSpan(new StyleSpan(Typeface.BOLD), 0, nOthers.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
final String format = context.getString(stringResMulti);
|
||||
return SpanFormatter.format(configuration.locale, format, firstDisplayName, nOthers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Spanned getTitleStringByFriends(int stringRes, int stringResMulti, ParcelableUser[] sources, ParcelableUser[] targets) {
|
||||
if (sources == null || sources.length == 0) return null;
|
||||
final Context context = adapter.getContext();
|
||||
final Resources resources = context.getResources();
|
||||
final Configuration configuration = resources.getConfiguration();
|
||||
final SpannableString firstSourceName = new SpannableString(UserColorNameUtils.getDisplayName(context,
|
||||
sources[0]));
|
||||
firstSourceName.setSpan(new StyleSpan(Typeface.BOLD), 0, firstSourceName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
final SpannableString firstTargetName = new SpannableString(UserColorNameUtils.getDisplayName(context,
|
||||
targets[0]));
|
||||
firstTargetName.setSpan(new StyleSpan(Typeface.BOLD), 0, firstTargetName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
if (sources.length == 1) {
|
||||
final String format = context.getString(stringRes);
|
||||
return SpanFormatter.format(configuration.locale, format, firstSourceName, firstTargetName);
|
||||
} else if (sources.length == 2) {
|
||||
final String format = context.getString(stringResMulti);
|
||||
final SpannableString secondSourceName = new SpannableString(UserColorNameUtils.getDisplayName(context, sources[1]));
|
||||
secondSourceName.setSpan(new StyleSpan(Typeface.BOLD), 0, secondSourceName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
return SpanFormatter.format(configuration.locale, format, firstSourceName,
|
||||
secondSourceName, firstTargetName);
|
||||
} else {
|
||||
final int othersCount = sources.length - 1;
|
||||
final SpannableString nOthers = new SpannableString(resources.getQuantityString(R.plurals.N_others, othersCount, othersCount));
|
||||
nOthers.setSpan(new StyleSpan(Typeface.BOLD), 0, nOthers.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
final String format = context.getString(stringResMulti);
|
||||
return SpanFormatter.format(configuration.locale, format, firstSourceName, nOthers, firstTargetName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,16 +74,20 @@ public class StatusViewHolder extends RecyclerView.ViewHolder implements OnClick
|
|||
// profileImageView.setSelectorColor(ThemeUtils.getUserHighlightColor(itemView.getContext()));
|
||||
}
|
||||
|
||||
public void setupViewListeners() {
|
||||
itemView.findViewById(R.id.item_content).setOnClickListener(this);
|
||||
itemView.findViewById(R.id.item_menu).setOnClickListener(this);
|
||||
public void setOnClickListeners() {
|
||||
setOnClickListeners(this);
|
||||
}
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
profileImageView.setOnClickListener(this);
|
||||
mediaPreviewContainer.setOnClickListener(this);
|
||||
replyCountView.setOnClickListener(this);
|
||||
retweetCountView.setOnClickListener(this);
|
||||
favoriteCountView.setOnClickListener(this);
|
||||
public void setOnClickListeners(OnClickListener listener) {
|
||||
itemView.findViewById(R.id.item_content).setOnClickListener(listener);
|
||||
itemView.findViewById(R.id.item_menu).setOnClickListener(listener);
|
||||
|
||||
itemView.setOnClickListener(listener);
|
||||
profileImageView.setOnClickListener(listener);
|
||||
mediaPreviewContainer.setOnClickListener(listener);
|
||||
replyCountView.setOnClickListener(listener);
|
||||
retweetCountView.setOnClickListener(listener);
|
||||
favoriteCountView.setOnClickListener(listener);
|
||||
}
|
||||
|
||||
public void setupViewOptions() {
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* 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.oshkimaadziig.george.androidutils;
|
||||
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.SpannedString;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Provides {@link String#format} style functions that work with {@link Spanned} strings and preserve formatting.
|
||||
*
|
||||
* @author George T. Steel
|
||||
*/
|
||||
public class SpanFormatter {
|
||||
public static final Pattern FORMAT_SEQUENCE = Pattern.compile("%([0-9]+\\$|<?)([^a-zA-z%]*)([[a-zA-Z%]&&[^tT]]|[tT][a-zA-Z])");
|
||||
|
||||
private SpanFormatter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Version of {@link String#format(String, Object...)} that works on {@link Spanned} strings to preserve rich text formatting.
|
||||
* Both the {@code format} as well as any {@code %s args} can be Spanned and will have their formatting preserved.
|
||||
* Due to the way {@link Spannable}s work, any argument's spans will can only be included <b>once</b> in the result.
|
||||
* Any duplicates will appear as text only.
|
||||
*
|
||||
* @param format the format string (see {@link java.util.Formatter#format})
|
||||
* @param args the list of arguments passed to the formatter. If there are
|
||||
* more arguments than required by {@code format},
|
||||
* additional arguments are ignored.
|
||||
* @return the formatted string (with spans).
|
||||
*/
|
||||
public static SpannedString format(CharSequence format, Object... args) {
|
||||
return format(Locale.getDefault(), format, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Version of {@link String#format(Locale, String, Object...)} that works on {@link Spanned} strings to preserve rich text formatting.
|
||||
* Both the {@code format} as well as any {@code %s args} can be Spanned and will have their formatting preserved.
|
||||
* Due to the way {@link Spannable}s work, any argument's spans will can only be included <b>once</b> in the result.
|
||||
* Any duplicates will appear as text only.
|
||||
*
|
||||
* @param locale the locale to apply; {@code null} value means no localization.
|
||||
* @param format the format string (see {@link java.util.Formatter#format})
|
||||
* @param args the list of arguments passed to the formatter.
|
||||
* @return the formatted string (with spans).
|
||||
* @see String#format(Locale, String, Object...)
|
||||
*/
|
||||
public static SpannedString format(Locale locale, CharSequence format, Object... args) {
|
||||
SpannableStringBuilder out = new SpannableStringBuilder(format);
|
||||
|
||||
int i = 0;
|
||||
int argAt = -1;
|
||||
|
||||
while (i < out.length()) {
|
||||
Matcher m = FORMAT_SEQUENCE.matcher(out);
|
||||
if (!m.find(i)) break;
|
||||
i = m.start();
|
||||
int exprEnd = m.end();
|
||||
|
||||
String argTerm = m.group(1);
|
||||
String modTerm = m.group(2);
|
||||
String typeTerm = m.group(3);
|
||||
|
||||
CharSequence cookedArg;
|
||||
|
||||
if (typeTerm.equals("%")) {
|
||||
cookedArg = "%";
|
||||
} else if (typeTerm.equals("%")) {
|
||||
cookedArg = "\n";
|
||||
} else {
|
||||
int argIdx = 0;
|
||||
if (argTerm.equals("")) argIdx = ++argAt;
|
||||
else if (argTerm.equals("<")) argIdx = argAt;
|
||||
else argIdx = Integer.parseInt(argTerm.substring(0, argTerm.length() - 1)) - 1;
|
||||
|
||||
Object argItem = args[argIdx];
|
||||
|
||||
if (typeTerm.equals("s") && argItem instanceof Spanned) {
|
||||
cookedArg = (Spanned) argItem;
|
||||
} else {
|
||||
cookedArg = String.format(locale, "%" + modTerm + typeTerm, argItem);
|
||||
}
|
||||
}
|
||||
|
||||
out.replace(i, exprEnd, cookedArg);
|
||||
i += cookedArg.length();
|
||||
}
|
||||
|
||||
return new SpannedString(out);
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 724 B |
After Width: | Height: | Size: 496 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 682 B |
After Width: | Height: | Size: 479 B |
After Width: | Height: | Size: 307 B |
After Width: | Height: | Size: 150 B |
After Width: | Height: | Size: 461 B |
After Width: | Height: | Size: 969 B |
After Width: | Height: | Size: 615 B |
After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 853 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 949 B |
After Width: | Height: | Size: 330 B |
After Width: | Height: | Size: 1.2 KiB |
|
@ -21,7 +21,6 @@
|
|||
<FrameLayout
|
||||
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">
|
||||
|
||||
|
@ -34,296 +33,7 @@
|
|||
app:cardCornerRadius="@dimen/corner_radius_card"
|
||||
app:cardElevation="@dimen/elevation_card">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/reply_retweet_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/element_size_small"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
android:id="@+id/profile_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
app:ignorePadding="true">
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/profile_image"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/element_size_mlarge"
|
||||
android:layout_height="@dimen/element_size_mlarge"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="@dimen/padding_profile_image_detail_page"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="centerCrop"
|
||||
app:sivBorder="true"
|
||||
app:sivBorderWidth="1dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_type"
|
||||
android:layout_width="@dimen/icon_size_profile_type_detail"
|
||||
android:layout_height="@dimen/icon_size_profile_type_detail"
|
||||
android:layout_alignBottom="@id/profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/profile_image"
|
||||
android:layout_alignTop="@id/profile_image"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/follow_indicator"
|
||||
android:layout_toRightOf="@id/profile_image"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<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/textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/time_source"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/element_spacing_small"
|
||||
android:gravity="center_vertical"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/follow_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<Button
|
||||
android:id="@+id/follow"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/follow"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/follow_info_progress"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"/>
|
||||
</FrameLayout>
|
||||
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/layout_media_preview"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<org.mariotaku.twidere.view.StatusTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<org.mariotaku.twidere.view.TwitterCardContainer
|
||||
android:id="@+id/twitter_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/location_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.MapImageView
|
||||
android:id="@+id/map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_map"
|
||||
android:contentDescription="@string/location"
|
||||
android:duplicateParentState="true"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/location_background_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/location_view"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignTop="@+id/location_view"
|
||||
android:alpha="0.5"
|
||||
android:background="?cardItemBackgroundColor"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/location_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:drawableLeft="@drawable/ic_indicator_location"
|
||||
android:drawablePadding="4dp"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/view_map"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/element_spacing_small"
|
||||
android:layout_marginRight="@dimen/element_spacing_small"
|
||||
android:orientation="horizontal"
|
||||
android:splitMotionEvents="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/replies_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
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:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/replies"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/retweets_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
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:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/retweets"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/favorites_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
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:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/favorites"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.TwidereMenuBar
|
||||
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>
|
||||
<include layout="@layout/header_status_common"/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</FrameLayout>
|
|
@ -0,0 +1,316 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
<LinearLayout
|
||||
android:id="@+id/card_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/reply_retweet_status"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/element_size_small"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
android:id="@+id/profile_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
app:ignorePadding="true">
|
||||
|
||||
<org.mariotaku.twidere.view.ShapedImageView
|
||||
android:id="@+id/profile_image"
|
||||
style="?profileImageStyle"
|
||||
android:layout_width="@dimen/element_size_mlarge"
|
||||
android:layout_height="@dimen/element_size_mlarge"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="@dimen/padding_profile_image_detail_page"
|
||||
android:contentDescription="@string/profile_image"
|
||||
android:scaleType="centerCrop"
|
||||
app:sivBorder="true"
|
||||
app:sivBorderWidth="1dp"
|
||||
tools:src="@drawable/ic_profile_image_default"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_type"
|
||||
android:layout_width="@dimen/icon_size_profile_type_detail"
|
||||
android:layout_height="@dimen/icon_size_profile_type_detail"
|
||||
android:layout_alignBottom="@id/profile_image"
|
||||
android:layout_alignRight="@id/profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/profile_image"
|
||||
android:layout_alignTop="@id/profile_image"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/follow_indicator"
|
||||
android:layout_toRightOf="@id/profile_image"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
tools:text="Name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
tools:text="\@username"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/time_source"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/element_spacing_small"
|
||||
android:gravity="center_vertical"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/follow_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="gone">
|
||||
|
||||
<Button
|
||||
android:id="@+id/follow"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/follow"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/follow_info_progress"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"/>
|
||||
</FrameLayout>
|
||||
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/layout_media_preview"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<org.mariotaku.twidere.view.StatusTextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
tools:text="@string/sample_status_text"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<org.mariotaku.twidere.view.TwitterCardContainer
|
||||
android:id="@+id/twitter_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/location_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<org.mariotaku.twidere.view.MapImageView
|
||||
android:id="@+id/map_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_map"
|
||||
android:contentDescription="@string/location"
|
||||
android:duplicateParentState="true"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:scaleType="centerCrop"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/location_background_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/location_view"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignTop="@+id/location_view"
|
||||
android:alpha="0.5"
|
||||
android:background="?cardItemBackgroundColor"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/location_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:drawableLeft="@drawable/ic_indicator_location"
|
||||
android:drawablePadding="4dp"
|
||||
android:duplicateParentState="true"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/view_map"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/element_spacing_small"
|
||||
android:layout_marginRight="@dimen/element_spacing_small"
|
||||
android:orientation="horizontal"
|
||||
android:splitMotionEvents="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/replies_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
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:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/replies"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/retweets_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
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:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/retweets"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/favorites_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:baselineAligned="true"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
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:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="255"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/favorites"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.TwidereMenuBar
|
||||
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>
|
|
@ -26,15 +26,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
android:paddingTop="@dimen/element_spacing_normal">
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<ImageView
|
||||
<org.mariotaku.twidere.view.ActionIconView
|
||||
android:id="@+id/activity_type"
|
||||
android:layout_width="@dimen/element_spacing_large"
|
||||
android:layout_height="@dimen/element_spacing_large"
|
||||
android:layout_alignRight="@+id/profile_image"
|
||||
android:layout_width="@dimen/icon_size_activity_type"
|
||||
android:layout_height="@dimen/icon_size_activity_type"
|
||||
android:layout_alignRight="@+id/profile_image_space"
|
||||
android:layout_alignTop="@+id/profile_images_container"
|
||||
android:scaleType="centerInside"
|
||||
tools:src="@drawable/ic_indicator_retweet"/>
|
||||
|
@ -43,7 +41,8 @@
|
|||
android:id="@+id/profile_images_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/profile_image"
|
||||
android:layout_marginLeft="@dimen/element_spacing_normal"
|
||||
android:layout_toRightOf="@+id/profile_image_space"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
@ -95,12 +94,12 @@
|
|||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/activity_profile_image_more_number"
|
||||
android:layout_width="0dp"
|
||||
android:minHeight="@dimen/profile_image_size_activity_small"
|
||||
android:minWidth="@dimen/profile_image_size_activity_small"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:minHeight="@dimen/profile_image_size_activity_small"
|
||||
android:minWidth="@dimen/profile_image_size_activity_small"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textStyle="bold"
|
||||
|
@ -108,9 +107,9 @@
|
|||
</LinearLayout>
|
||||
|
||||
<Space
|
||||
android:id="@+id/profile_image"
|
||||
android:id="@+id/profile_image_space"
|
||||
android:layout_width="@dimen/icon_size_status_profile_image"
|
||||
android:layout_height="@dimen/icon_size_status_profile_image"
|
||||
android:layout_height="0dp"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_below="@+id/profile_images_container"/>
|
||||
|
||||
|
@ -120,21 +119,21 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/profile_images_container"
|
||||
android:layout_below="@+id/profile_images_container"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:singleLine="false"
|
||||
tools:text="Uucky and 15 others favorited your tweet."/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/summary"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="12dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/profile_images_container"
|
||||
android:layout_below="@+id/title"
|
||||
android:singleLine="false"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="12dp"
|
||||
tools:text="@string/sample_status_text"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -21,6 +21,7 @@
|
|||
<color name="highlight_retweet">@color/material_light_green</color>
|
||||
<color name="highlight_favorite">@color/material_amber</color>
|
||||
<color name="highlight_reply">@color/material_light_blue</color>
|
||||
<color name="highlight_follow">@color/material_light_blue</color>
|
||||
<color name="unread_color">@color/material_red</color>
|
||||
<color name="branding_color">@color/material_light_blue</color>
|
||||
<color name="bg_color_tab_pressed">#40808080</color>
|
||||
|
|
|
@ -81,11 +81,12 @@
|
|||
<dimen name="action_icon_size">32dp</dimen>
|
||||
<dimen name="unread_indicator_size">16dp</dimen>
|
||||
<dimen name="account_selector_popup_width">180dp</dimen>
|
||||
<dimen name="icon_size_status_profile_image">40dp</dimen>
|
||||
<dimen name="icon_size_status_profile_image">48dp</dimen>
|
||||
|
||||
<dimen name="icon_size_profile_type">16dp</dimen>
|
||||
<dimen name="icon_size_profile_type_detail">22dp</dimen>
|
||||
<dimen name="icon_size_profile_type_user_profile">28dp</dimen>
|
||||
<dimen name="icon_size_activity_type">16dp</dimen>
|
||||
|
||||
<!-- Elevation values -->
|
||||
<dimen name="elevation_card">2dp</dimen>
|
||||
|
|
|
@ -42,5 +42,9 @@
|
|||
<item quantity="one">@string/N_retweeted_quantity_one</item>
|
||||
<item quantity="other">@string/N_retweeted_quantity_other</item>
|
||||
</plurals>
|
||||
<plurals name="N_others">
|
||||
<item quantity="one">@string/N_others_quantity_one</item>
|
||||
<item quantity="other">@string/N_others_quantity_other</item>
|
||||
</plurals>
|
||||
|
||||
</resources>
|
|
@ -284,22 +284,26 @@
|
|||
<string name="activities_about_me">Activities about me</string>
|
||||
<string name="activities_by_friends">Activities by friends</string>
|
||||
<string name="activity_about_me_favorite"><xliff:g id="user">%s</xliff:g> favorited your tweet.</string>
|
||||
<string name="activity_about_me_favorite_multi"><xliff:g id="user">%s</xliff:g> and <xliff:g id="count">%d</xliff:g> others favorited your tweet.</string>
|
||||
<string name="activity_about_me_favorite_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> favorited your tweet.</string>
|
||||
<string name="activity_about_me_favorited_retweet"><xliff:g id="user">%s</xliff:g> favorited your retweet.</string>
|
||||
<string name="activity_about_me_favorited_retweet_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> favorited your retweet.</string>
|
||||
<string name="activity_about_me_follow"><xliff:g id="user">%s</xliff:g> is following you.</string>
|
||||
<string name="activity_about_me_follow_multi"><xliff:g id="user">%s</xliff:g> and <xliff:g id="count">%d</xliff:g> others are following you.</string>
|
||||
<string name="activity_about_me_follow_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> are following you.</string>
|
||||
<string name="activity_about_me_retweet"><xliff:g id="user">%s</xliff:g> retweeted your tweet.</string>
|
||||
<string name="activity_about_me_retweet_multi"><xliff:g id="user">%s</xliff:g> and <xliff:g id="count">%d</xliff:g> others retweeted your tweet.</string>
|
||||
<string name="activity_about_me_retweet_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> retweeted your tweet.</string>
|
||||
<string name="activity_about_me_retweeted_retweet"><xliff:g id="user">%s</xliff:g> retweeted your retweet.</string>
|
||||
<string name="activity_about_me_retweeted_retweet_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> retweeted your retweet.</string>
|
||||
<string name="activity_about_me_list_member_added"><xliff:g id="user">%s</xliff:g> added you to list.</string>
|
||||
<string name="activity_about_me_list_member_added_with_name"><xliff:g id="user">%1$s</xliff:g> added you to list \"<xliff:g id="list">%2$s</xliff:g>\"".</string>
|
||||
<string name="activity_about_me_list_member_added_multi"><xliff:g id="user">%s</xliff:g> and <xliff:g id="count">%d</xliff:g> others added you to their lists.</string>
|
||||
<string name="activity_about_me_list_member_added_with_name"><xliff:g id="user">%1$s</xliff:g> added you to list <xliff:g id="list">%2$s</xliff:g>".</string>
|
||||
<string name="activity_about_me_list_member_added_multi"><xliff:g id="user">%1$s</xliff:g> and <xliff:g id="other">%2$s</xliff:g> added you to their lists.</string>
|
||||
<string name="activity_by_friends_favorite"><xliff:g id="user">%1$s</xliff:g> favorited <xliff:g id="target">%2$s</xliff:g>\'s tweet.</string>
|
||||
<string name="activity_by_friends_favorite_multi"><xliff:g id="user">%1$s</xliff:g> favorited <xliff:g id="target">%2$s</xliff:g> and <xliff:g id="count">%3$d</xliff:g> other\'s tweet.</string>
|
||||
<string name="activity_by_friends_favorite_multi"><xliff:g id="user">%1$s</xliff:g> favorited <xliff:g id="target">%2$s</xliff:g> and <xliff:g id="other">%3$s</xliff:g>\'s tweet.</string>
|
||||
<string name="activity_by_friends_follow"><xliff:g id="user">%1$s</xliff:g> is following <xliff:g id="target">%2$s</xliff:g>.</string>
|
||||
<string name="activity_by_friends_follow_multi"><xliff:g id="user">%1$s</xliff:g> is following <xliff:g id="target">%2$s</xliff:g> and <xliff:g id="count">%3$d</xliff:g> others.</string>
|
||||
<string name="activity_by_friends_follow_multi"><xliff:g id="user">%1$s</xliff:g> is following <xliff:g id="target">%2$s</xliff:g> and <xliff:g id="other">%3$s</xliff:g>.</string>
|
||||
<string name="activity_by_friends_retweet"><xliff:g id="user">%1$s</xliff:g> retweeted <xliff:g id="target">%2$s</xliff:g>\'s tweet.</string>
|
||||
<string name="activity_by_friends_list_member_added"><xliff:g id="user">%1$s</xliff:g> added <xliff:g id="target">%2$s</xliff:g> to list.</string>
|
||||
<string name="activity_by_friends_list_created"><xliff:g id="user">%1$s</xliff:g> created list <xliff:g id="target">%2$s</xliff:g>.</string>
|
||||
<string name="activity_by_friends_list_created_multi"><xliff:g id="user">%1$s</xliff:g> created list <xliff:g id="target">%2$s</xliff:g> and <xliff:g id="count">%3$d</xliff:g> more.</string>
|
||||
<string name="activity_by_friends_list_created_multi"><xliff:g id="user">%1$s</xliff:g> created list <xliff:g id="target">%2$s</xliff:g> and <xliff:g id="other">%1$s</xliff:g>.</string>
|
||||
<string name="status_not_updated">Tweet not sent.</string>
|
||||
<string name="status_not_updated_summary">Tweet not sent, and saved to drafts.</string>
|
||||
<string name="incoming_friendships">Pending follow requests</string>
|
||||
|
@ -699,5 +703,7 @@
|
|||
<string name="media_preview_style">Media preview style</string>
|
||||
<string name="draft_saved">Draft saved</string>
|
||||
<string name="open_twitter_links">Open Twitter links</string>
|
||||
<string name="N_others_quantity_one">another</string>
|
||||
<string name="N_others_quantity_other"><xliff:g id="retweet_count">%d</xliff:g> others</string>
|
||||
|
||||
</resources>
|