mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-30 08:25:01 +01:00
improved name displaying
This commit is contained in:
parent
a4b275d5d9
commit
458c50a820
@ -836,6 +836,7 @@ public class HomeActivity extends BaseAppCompatActivity implements OnClickListen
|
||||
final boolean hasNoTab = mPagerAdapter.getCount() == 0;
|
||||
mEmptyTabHint.setVisibility(hasNoTab ? View.VISIBLE : View.GONE);
|
||||
mViewPager.setVisibility(hasNoTab ? View.GONE : View.VISIBLE);
|
||||
mViewPager.setOffscreenPageLimit(mPagerAdapter.getCount() / 2);
|
||||
}
|
||||
|
||||
private void setupSlidingMenu() {
|
||||
|
@ -63,6 +63,7 @@ public class TrendsSuggestionsFragment extends AbsContentListViewFragment<Trends
|
||||
mAccountId = getDefaultAccountId(getActivity());
|
||||
getListView().setOnItemClickListener(this);
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
showProgress();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -102,6 +103,7 @@ public class TrendsSuggestionsFragment extends AbsContentListViewFragment<Trends
|
||||
@Override
|
||||
public void onLoadFinished(final Loader<Cursor> loader, final Cursor cursor) {
|
||||
getAdapter().swapCursor(cursor);
|
||||
showContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,7 @@ import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.iface.ContentCardClickListener;
|
||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter;
|
||||
import org.mariotaku.twidere.api.twitter.model.TranslationResult;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.model.ParcelableLocation;
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
@ -41,8 +42,6 @@ import org.mariotaku.twidere.view.iface.IColorLabelView;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.mariotaku.twidere.api.twitter.model.TranslationResult;
|
||||
|
||||
import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText;
|
||||
import static org.mariotaku.twidere.util.Utils.getUserTypeIconRes;
|
||||
|
||||
@ -65,6 +64,8 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
private final TextView quoteTextView;
|
||||
private final TextView nameView, screenNameView;
|
||||
private final TextView quotedNameView, quotedScreenNameView;
|
||||
private TextView primaryNameView, secondaryNameView;
|
||||
private TextView quotedPrimaryNameView, quotedSecondaryNameView;
|
||||
private final TextView replyRetweetView;
|
||||
private final ShortTimeView timeView;
|
||||
private final CardMediaContainer mediaPreview;
|
||||
@ -86,10 +87,10 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
extraTypeView = (ImageView) itemView.findViewById(R.id.extra_type);
|
||||
textView = (TextView) itemView.findViewById(R.id.text);
|
||||
quoteTextView = (TextView) itemView.findViewById(R.id.quote_text);
|
||||
nameView = (TextView) itemView.findViewById(R.id.name);
|
||||
screenNameView = (TextView) itemView.findViewById(R.id.screen_name);
|
||||
quotedNameView = (TextView) itemView.findViewById(R.id.quoted_name);
|
||||
quotedScreenNameView = (TextView) itemView.findViewById(R.id.quoted_screen_name);
|
||||
nameView = primaryNameView = (TextView) itemView.findViewById(R.id.name);
|
||||
screenNameView = secondaryNameView = (TextView) itemView.findViewById(R.id.screen_name);
|
||||
quotedNameView = quotedPrimaryNameView = (TextView) itemView.findViewById(R.id.quoted_name);
|
||||
quotedScreenNameView = quotedSecondaryNameView = (TextView) itemView.findViewById(R.id.quoted_screen_name);
|
||||
replyRetweetIcon = (ImageView) itemView.findViewById(R.id.reply_retweet_icon);
|
||||
replyRetweetView = (TextView) itemView.findViewById(R.id.reply_retweet_status);
|
||||
timeView = (ShortTimeView) itemView.findViewById(R.id.time);
|
||||
@ -116,8 +117,8 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
public void displaySampleStatus() {
|
||||
profileImageView.setVisibility(adapter.isProfileImageEnabled() ? View.VISIBLE : View.GONE);
|
||||
profileImageView.setImageResource(R.mipmap.ic_launcher);
|
||||
nameView.setText(TWIDERE_PREVIEW_NAME);
|
||||
screenNameView.setText("@" + TWIDERE_PREVIEW_SCREEN_NAME);
|
||||
primaryNameView.setText(TWIDERE_PREVIEW_NAME);
|
||||
secondaryNameView.setText("@" + TWIDERE_PREVIEW_SCREEN_NAME);
|
||||
if (adapter.getLinkHighlightingStyle() == VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE) {
|
||||
textView.setText(Html.fromHtml(TWIDERE_PREVIEW_TEXT_HTML));
|
||||
adapter.getTwidereLinkify().applyAllLinks(textView, -1, -1, false, adapter.getLinkHighlightingStyle());
|
||||
@ -170,11 +171,11 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
final int typeIconRes;
|
||||
|
||||
if (status.is_quote) {
|
||||
quotedNameView.setText(manager.getUserNickname(status.user_id, status.user_name, false));
|
||||
quotedScreenNameView.setText("@" + status.user_screen_name);
|
||||
quotedPrimaryNameView.setText(manager.getUserNickname(status.user_id, status.user_name, false));
|
||||
quotedSecondaryNameView.setText("@" + status.user_screen_name);
|
||||
timeView.setTime(status.quote_timestamp);
|
||||
nameView.setText(manager.getUserNickname(status.quoted_by_user_id, status.quoted_by_user_name, false));
|
||||
screenNameView.setText("@" + status.quoted_by_user_screen_name);
|
||||
primaryNameView.setText(manager.getUserNickname(status.quoted_by_user_id, status.quoted_by_user_name, false));
|
||||
secondaryNameView.setText("@" + status.quoted_by_user_screen_name);
|
||||
|
||||
final int idx = status.quote_text_unescaped.lastIndexOf(" twitter.com");
|
||||
if (translation != null) {
|
||||
@ -213,8 +214,8 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
final int userColor = manager.getUserColor(status.quoted_by_user_id, false);
|
||||
itemContent.drawStart(userColor);
|
||||
} else {
|
||||
nameView.setText(manager.getUserNickname(status.user_id, status.user_name, false));
|
||||
screenNameView.setText("@" + status.user_screen_name);
|
||||
primaryNameView.setText(manager.getUserNickname(status.user_id, status.user_name, false));
|
||||
secondaryNameView.setText("@" + status.user_screen_name);
|
||||
if (status.is_retweet) {
|
||||
timeView.setTime(status.retweet_timestamp);
|
||||
} else {
|
||||
@ -383,11 +384,11 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
final int typeIconRes;
|
||||
|
||||
if (cursor.getShort(indices.is_quote) == 1) {
|
||||
quotedNameView.setText(user_name);
|
||||
quotedScreenNameView.setText("@" + user_screen_name);
|
||||
quotedPrimaryNameView.setText(user_name);
|
||||
quotedSecondaryNameView.setText("@" + user_screen_name);
|
||||
timeView.setTime(cursor.getLong(indices.quote_timestamp));
|
||||
nameView.setText(cursor.getString(indices.quoted_by_user_name));
|
||||
screenNameView.setText("@" + cursor.getString(indices.quoted_by_user_screen_name));
|
||||
primaryNameView.setText(cursor.getString(indices.quoted_by_user_name));
|
||||
secondaryNameView.setText("@" + cursor.getString(indices.quoted_by_user_screen_name));
|
||||
|
||||
final String quote_text_unescaped = cursor.getString(indices.quote_text_unescaped);
|
||||
final int idx = quote_text_unescaped.lastIndexOf(" twitter.com");
|
||||
@ -425,8 +426,8 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
itemContent.drawStart(userColor);
|
||||
|
||||
} else {
|
||||
nameView.setText(user_name);
|
||||
screenNameView.setText("@" + user_screen_name);
|
||||
primaryNameView.setText(user_name);
|
||||
secondaryNameView.setText("@" + user_screen_name);
|
||||
if (retweet_id > 0) {
|
||||
timeView.setTime(cursor.getLong(indices.retweet_timestamp));
|
||||
} else {
|
||||
@ -621,6 +622,12 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
profileImageView.setStyle(adapter.getProfileImageStyle());
|
||||
actionButtons.setVisibility(adapter.isCardActionsHidden() ? View.GONE : View.VISIBLE);
|
||||
itemMenu.setVisibility(adapter.isCardActionsHidden() ? View.GONE : View.VISIBLE);
|
||||
|
||||
final boolean nameFirst = adapter.isNameFirst();
|
||||
primaryNameView = nameFirst ? nameView : screenNameView;
|
||||
secondaryNameView = nameFirst ? screenNameView : nameView;
|
||||
quotedPrimaryNameView = nameFirst ? quotedNameView : quotedScreenNameView;
|
||||
quotedSecondaryNameView = nameFirst ? quotedScreenNameView : quotedNameView;
|
||||
}
|
||||
|
||||
private void displayExtraTypeIcon(String cardName, ParcelableMedia[] media, ParcelableLocation location, String placeFullName, boolean sensitive) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user