using name view for dm entry
This commit is contained in:
parent
5d8fdfdf1d
commit
4788ab956d
|
@ -34,6 +34,7 @@ import org.mariotaku.twidere.provider.TwidereDataStore.DirectMessages.Conversati
|
|||
import org.mariotaku.twidere.util.DataStoreUtils;
|
||||
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
||||
import org.mariotaku.twidere.util.UserColorNameManager;
|
||||
import org.mariotaku.twidere.view.NameView;
|
||||
import org.mariotaku.twidere.view.ShortTimeView;
|
||||
import org.mariotaku.twidere.view.iface.IColorLabelView;
|
||||
|
||||
|
@ -42,7 +43,8 @@ import static org.mariotaku.twidere.util.HtmlEscapeHelper.toPlainText;
|
|||
public class MessageEntryViewHolder extends ViewHolder implements OnClickListener {
|
||||
|
||||
public final ImageView profileImageView;
|
||||
public final TextView nameView, screenNameView, textView;
|
||||
public final NameView nameView;
|
||||
public final TextView textView;
|
||||
public final ShortTimeView timeView;
|
||||
private final MessageEntriesAdapter adapter;
|
||||
private final IColorLabelView content;
|
||||
|
@ -52,8 +54,7 @@ public class MessageEntryViewHolder extends ViewHolder implements OnClickListene
|
|||
this.adapter = adapter;
|
||||
content = (IColorLabelView) itemView.findViewById(R.id.content);
|
||||
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
|
||||
nameView = (TextView) itemView.findViewById(R.id.name);
|
||||
screenNameView = (TextView) itemView.findViewById(R.id.screen_name);
|
||||
nameView = (NameView) itemView.findViewById(R.id.name);
|
||||
textView = (TextView) itemView.findViewById(R.id.text);
|
||||
timeView = (ShortTimeView) itemView.findViewById(R.id.time);
|
||||
|
||||
|
@ -75,8 +76,9 @@ public class MessageEntryViewHolder extends ViewHolder implements OnClickListene
|
|||
final String name = cursor.getString(ConversationEntries.IDX_NAME);
|
||||
final String screenName = cursor.getString(ConversationEntries.IDX_SCREEN_NAME);
|
||||
|
||||
nameView.setText(manager.getUserNickname(conversationId, name, false));
|
||||
screenNameView.setText("@" + screenName);
|
||||
nameView.setName(manager.getUserNickname(conversationId, name, false));
|
||||
nameView.setScreenName("@" + screenName);
|
||||
nameView.updateText(adapter.getBidiFormatter());
|
||||
textView.setText(toPlainText(cursor.getString(ConversationEntries.IDX_TEXT)));
|
||||
timeView.setTime(timestamp);
|
||||
if (isOutgoing) {
|
||||
|
@ -85,7 +87,6 @@ public class MessageEntryViewHolder extends ViewHolder implements OnClickListene
|
|||
timeView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||
}
|
||||
nameView.setTypeface(null, isUnread && !isOutgoing ? Typeface.BOLD : Typeface.NORMAL);
|
||||
screenNameView.setTypeface(null, isUnread && !isOutgoing ? Typeface.BOLD : Typeface.NORMAL);
|
||||
textView.setTypeface(null, isUnread && !isOutgoing ? Typeface.BOLD : Typeface.NORMAL);
|
||||
if (adapter.shouldShowAccountsColor()) {
|
||||
content.drawEnd(DataStoreUtils.getAccountColor(context, accountId));
|
||||
|
@ -115,8 +116,8 @@ public class MessageEntryViewHolder extends ViewHolder implements OnClickListene
|
|||
}
|
||||
|
||||
public void setTextSize(final float textSize) {
|
||||
nameView.setTextSize(textSize * 1.1f);
|
||||
screenNameView.setTextSize(textSize);
|
||||
nameView.setPrimaryTextSize(textSize * 1.1f);
|
||||
nameView.setSecondaryTextSize(textSize);
|
||||
textView.setTextSize(textSize);
|
||||
timeView.setTextSize(textSize * 0.85f);
|
||||
}
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
android:id="@+id/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:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
|
@ -51,8 +52,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_toEndOf="@id/profile_image"
|
||||
android:layout_toRightOf="@id/profile_image"
|
||||
android:layout_toEndOf="@+id/profile_image"
|
||||
android:layout_toRightOf="@+id/profile_image"
|
||||
android:divider="?android:dividerVertical"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
|
@ -63,35 +64,19 @@
|
|||
android:paddingStart="0dp"
|
||||
android:paddingTop="@dimen/element_spacing_normal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/name_container"
|
||||
<org.mariotaku.twidere.view.NameView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toLeftOf="@id/time"
|
||||
android:layout_toStartOf="@id/time"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<org.mariotaku.twidere.view.TimelineContentTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
tools:text="Mariotaku Lee" />
|
||||
|
||||
<org.mariotaku.twidere.view.TimelineContentTextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/element_spacing_small"
|
||||
android:layout_marginStart="@dimen/element_spacing_small"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
tools:text="\@mariotaku" />
|
||||
|
||||
</LinearLayout>
|
||||
android:layout_toLeftOf="@+id/time"
|
||||
android:layout_toStartOf="@+id/time"
|
||||
android:gravity="center_vertical"
|
||||
app:nv_primaryTextColor="?android:textColorPrimary"
|
||||
app:nv_primaryTextStyle="bold"
|
||||
app:nv_secondaryTextColor="?android:textColorSecondary"
|
||||
app:nv_twoLine="false"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ShortTimeView
|
||||
android:id="@+id/time"
|
||||
|
@ -109,9 +94,9 @@
|
|||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@id/name_container"
|
||||
android:layout_alignStart="@id/name_container"
|
||||
android:layout_below="@id/name_container"
|
||||
android:layout_alignLeft="@+id/name"
|
||||
android:layout_alignStart="@+id/name"
|
||||
android:layout_below="@+id/name"
|
||||
android:layout_marginTop="@dimen/element_spacing_xsmall"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
|
|
Loading…
Reference in New Issue