mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +01:00
Move TrustIndicator behind date in AuthorView
to prevent it from being pushed off-screen Fixes #1076
This commit is contained in:
@@ -5,11 +5,10 @@ import android.content.res.TypedArray;
|
|||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.support.annotation.DimenRes;
|
import android.support.annotation.DimenRes;
|
||||||
import android.support.annotation.UiThread;
|
import android.support.annotation.UiThread;
|
||||||
|
import android.support.constraint.ConstraintLayout;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.identity.Author;
|
import org.briarproject.bramble.api.identity.Author;
|
||||||
@@ -30,7 +29,7 @@ import static org.briarproject.bramble.api.identity.Author.Status.OURSELVES;
|
|||||||
import static org.briarproject.briar.android.util.UiUtils.resolveAttribute;
|
import static org.briarproject.briar.android.util.UiUtils.resolveAttribute;
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
public class AuthorView extends RelativeLayout {
|
public class AuthorView extends ConstraintLayout {
|
||||||
|
|
||||||
public static final int NORMAL = 0;
|
public static final int NORMAL = 0;
|
||||||
public static final int REBLOGGER = 1;
|
public static final int REBLOGGER = 1;
|
||||||
@@ -133,32 +132,24 @@ public class AuthorView extends RelativeLayout {
|
|||||||
date.setVisibility(VISIBLE);
|
date.setVisibility(VISIBLE);
|
||||||
setAvatarSize(R.dimen.blogs_avatar_normal_size);
|
setAvatarSize(R.dimen.blogs_avatar_normal_size);
|
||||||
setTextSize(authorName, R.dimen.text_size_small);
|
setTextSize(authorName, R.dimen.text_size_small);
|
||||||
setCenterVertical(authorName, false);
|
|
||||||
setCenterVertical(trustIndicator, false);
|
|
||||||
break;
|
break;
|
||||||
case REBLOGGER:
|
case REBLOGGER:
|
||||||
avatarIcon.setVisibility(VISIBLE);
|
avatarIcon.setVisibility(VISIBLE);
|
||||||
date.setVisibility(VISIBLE);
|
date.setVisibility(VISIBLE);
|
||||||
setAvatarSize(R.dimen.blogs_avatar_normal_size);
|
setAvatarSize(R.dimen.blogs_avatar_normal_size);
|
||||||
setTextSize(authorName, R.dimen.text_size_small);
|
setTextSize(authorName, R.dimen.text_size_small);
|
||||||
setCenterVertical(authorName, false);
|
|
||||||
setCenterVertical(trustIndicator, false);
|
|
||||||
break;
|
break;
|
||||||
case COMMENTER:
|
case COMMENTER:
|
||||||
avatarIcon.setVisibility(INVISIBLE);
|
avatarIcon.setVisibility(INVISIBLE);
|
||||||
date.setVisibility(VISIBLE);
|
date.setVisibility(VISIBLE);
|
||||||
setAvatarSize(R.dimen.blogs_avatar_comment_size);
|
setAvatarSize(R.dimen.blogs_avatar_comment_size);
|
||||||
setTextSize(authorName, R.dimen.text_size_tiny);
|
setTextSize(authorName, R.dimen.text_size_tiny);
|
||||||
setCenterVertical(authorName, false);
|
|
||||||
setCenterVertical(trustIndicator, false);
|
|
||||||
break;
|
break;
|
||||||
case LIST:
|
case LIST:
|
||||||
avatarIcon.setVisibility(INVISIBLE);
|
avatarIcon.setVisibility(INVISIBLE);
|
||||||
date.setVisibility(GONE);
|
date.setVisibility(GONE);
|
||||||
setAvatarSize(R.dimen.listitem_picture_size_small);
|
setAvatarSize(R.dimen.listitem_picture_size_small);
|
||||||
setTextSize(authorName, R.dimen.text_size_medium);
|
setTextSize(authorName, R.dimen.text_size_medium);
|
||||||
setCenterVertical(authorName, true);
|
|
||||||
setCenterVertical(trustIndicator, true);
|
|
||||||
break;
|
break;
|
||||||
case RSS_FEED:
|
case RSS_FEED:
|
||||||
avatarIcon.setVisibility(INVISIBLE);
|
avatarIcon.setVisibility(INVISIBLE);
|
||||||
@@ -166,8 +157,6 @@ public class AuthorView extends RelativeLayout {
|
|||||||
avatar.setImageResource(R.drawable.ic_rss_feed);
|
avatar.setImageResource(R.drawable.ic_rss_feed);
|
||||||
setAvatarSize(R.dimen.blogs_avatar_normal_size);
|
setAvatarSize(R.dimen.blogs_avatar_normal_size);
|
||||||
setTextSize(authorName, R.dimen.text_size_small);
|
setTextSize(authorName, R.dimen.text_size_small);
|
||||||
setCenterVertical(authorName, false);
|
|
||||||
setCenterVertical(trustIndicator, false);
|
|
||||||
break;
|
break;
|
||||||
case RSS_FEED_REBLOGGED:
|
case RSS_FEED_REBLOGGED:
|
||||||
avatarIcon.setVisibility(INVISIBLE);
|
avatarIcon.setVisibility(INVISIBLE);
|
||||||
@@ -175,8 +164,6 @@ public class AuthorView extends RelativeLayout {
|
|||||||
avatar.setImageResource(R.drawable.ic_rss_feed);
|
avatar.setImageResource(R.drawable.ic_rss_feed);
|
||||||
setAvatarSize(R.dimen.blogs_avatar_comment_size);
|
setAvatarSize(R.dimen.blogs_avatar_comment_size);
|
||||||
setTextSize(authorName, R.dimen.text_size_tiny);
|
setTextSize(authorName, R.dimen.text_size_tiny);
|
||||||
setCenterVertical(authorName, false);
|
|
||||||
setCenterVertical(trustIndicator, false);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,10 +181,4 @@ public class AuthorView extends RelativeLayout {
|
|||||||
v.setTextSize(COMPLEX_UNIT_PX, textSize);
|
v.setTextSize(COMPLEX_UNIT_PX, textSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCenterVertical(View v, boolean center) {
|
|
||||||
LayoutParams params = (LayoutParams) v.getLayoutParams();
|
|
||||||
params.addRule(CENTER_VERTICAL, center ? RelativeLayout.TRUE : 0);
|
|
||||||
v.setLayoutParams(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<merge
|
<merge
|
||||||
|
android:id="@+id/merge"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:layout_height="wrap_content"
|
||||||
|
tools:layout_width="match_parent"
|
||||||
|
tools:parentTag="android.support.constraint.ConstraintLayout"
|
||||||
tools:showIn="@layout/list_item_blog_post">
|
tools:showIn="@layout/list_item_blog_post">
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
@@ -9,58 +14,61 @@
|
|||||||
style="@style/BriarAvatar"
|
style="@style/BriarAvatar"
|
||||||
android:layout_width="@dimen/blogs_avatar_normal_size"
|
android:layout_width="@dimen/blogs_avatar_normal_size"
|
||||||
android:layout_height="@dimen/blogs_avatar_normal_size"
|
android:layout_height="@dimen/blogs_avatar_normal_size"
|
||||||
android:layout_alignTop="@+id/authorName"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:layout_marginEnd="@dimen/margin_medium"
|
app:layout_constraintEnd_toStartOf="@+id/authorName"
|
||||||
android:layout_marginRight="@dimen/margin_medium"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:src="@mipmap/ic_launcher_round"/>
|
tools:src="@mipmap/ic_launcher_round"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/avatarIcon"
|
android:id="@+id/avatarIcon"
|
||||||
android:layout_width="@dimen/blogs_avatar_icon_size"
|
android:layout_width="@dimen/blogs_avatar_icon_size"
|
||||||
android:layout_height="@dimen/blogs_avatar_icon_size"
|
android:layout_height="@dimen/blogs_avatar_icon_size"
|
||||||
android:layout_alignBottom="@+id/avatar"
|
|
||||||
android:layout_alignEnd="@+id/avatar"
|
|
||||||
android:layout_alignRight="@+id/avatar"
|
|
||||||
android:background="@drawable/bubble_white"
|
android:background="@drawable/bubble_white"
|
||||||
|
android:contentDescription="@string/blogs_reblog_button"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/ic_repeat"
|
android:src="@drawable/ic_repeat"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
tools:ignore="ContentDescription"/>
|
app:layout_constraintBottom_toBottomOf="@+id/avatar"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/avatar"/>
|
||||||
|
|
||||||
<com.vanniktech.emoji.EmojiTextView
|
<com.vanniktech.emoji.EmojiTextView
|
||||||
android:id="@+id/authorName"
|
android:id="@+id/authorName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toEndOf="@+id/avatar"
|
android:layout_marginLeft="@dimen/margin_medium"
|
||||||
android:layout_toRightOf="@+id/avatar"
|
android:layout_marginStart="@dimen/margin_medium"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textSize="@dimen/text_size_small"
|
android:textSize="@dimen/text_size_small"
|
||||||
tools:text="Author Name"/>
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/avatar"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="Author View that can have a long name"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dateView"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textSize="@dimen/text_size_tiny"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/authorName"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/authorName"
|
||||||
|
tools:text="yesterday"
|
||||||
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
<org.briarproject.briar.android.view.TrustIndicatorView
|
<org.briarproject.briar.android.view.TrustIndicatorView
|
||||||
android:id="@+id/trustIndicator"
|
android:id="@+id/trustIndicator"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignBottom="@+id/authorName"
|
android:layout_marginEnd="@dimen/margin_medium"
|
||||||
android:layout_alignTop="@+id/authorName"
|
android:layout_marginStart="@dimen/margin_medium"
|
||||||
android:layout_marginLeft="@dimen/margin_small"
|
|
||||||
android:layout_marginStart="@dimen/margin_small"
|
|
||||||
android:layout_toEndOf="@id/authorName"
|
|
||||||
android:layout_toRightOf="@id/authorName"
|
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/dateView"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/dateView"
|
||||||
|
app:layout_goneMarginEnd="0dp"
|
||||||
|
app:layout_goneMarginStart="0dp"
|
||||||
tools:src="@drawable/trust_indicator_verified"/>
|
tools:src="@drawable/trust_indicator_verified"/>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/dateView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/authorName"
|
|
||||||
android:layout_toEndOf="@+id/avatar"
|
|
||||||
android:layout_toRightOf="@+id/avatar"
|
|
||||||
android:gravity="bottom"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:textSize="@dimen/text_size_tiny"
|
|
||||||
tools:text="yesterday"/>
|
|
||||||
|
|
||||||
</merge>
|
</merge>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:descendantFocusability="beforeDescendants"
|
android:descendantFocusability="beforeDescendants"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
android:id="@+id/postLayout"
|
android:id="@+id/postLayout"
|
||||||
style="@style/BriarCard"
|
style="@style/BriarCard"
|
||||||
layout="@layout/list_item_blog_post"
|
layout="@layout/list_item_blog_post"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
|
|||||||
@@ -15,10 +15,11 @@
|
|||||||
|
|
||||||
<org.briarproject.briar.android.view.AuthorView
|
<org.briarproject.briar.android.view.AuthorView
|
||||||
android:id="@+id/authorView"
|
android:id="@+id/authorView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/listitem_vertical_margin"
|
android:padding="@dimen/listitem_vertical_margin"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:persona="commenter"/>
|
app:persona="commenter"/>
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,11 @@
|
|||||||
android:id="@+id/authorView"
|
android:id="@+id/authorView"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/listitem_vertical_margin"
|
android:layout_marginBottom="@dimen/listitem_horizontal_margin"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:layout_marginEnd="@dimen/listitem_vertical_margin"
|
||||||
|
android:layout_marginStart="@dimen/listitem_vertical_margin"
|
||||||
|
android:layout_marginTop="@dimen/listitem_vertical_margin"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/commentView"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/rebloggerView"/>
|
app:layout_constraintTop_toBottomOf="@+id/rebloggerView"/>
|
||||||
|
|||||||
@@ -21,10 +21,11 @@
|
|||||||
|
|
||||||
<org.briarproject.briar.android.view.AuthorView
|
<org.briarproject.briar.android.view.AuthorView
|
||||||
android:id="@+id/author"
|
android:id="@+id/author"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/margin_medium"
|
android:layout_margin="@dimen/margin_medium"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/text"
|
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||||
app:persona="commenter"/>
|
app:persona="commenter"/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user