Address review issues

parent 980a6d18
......@@ -9,7 +9,7 @@
style="@style/BriarAvatar"
android:layout_width="@dimen/blogs_avatar_normal_size"
android:layout_height="@dimen/blogs_avatar_normal_size"
android:layout_centerVertical="true"
android:layout_alignTop="@+id/authorName"
android:layout_marginRight="@dimen/margin_medium"
tools:src="@drawable/ic_launcher"/>
......@@ -30,7 +30,6 @@
android:id="@+id/authorName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/avatar"
android:layout_toEndOf="@+id/avatar"
android:layout_toRightOf="@+id/avatar"
android:textColor="@color/briar_text_primary"
......
......@@ -21,7 +21,6 @@
android:layout_height="wrap_content"
android:layout_below="@+id/top_divider"
android:layout_marginBottom="@dimen/margin_small"
android:layout_marginLeft="@dimen/margin_medium"
android:layout_marginRight="@dimen/margin_medium"
android:layout_marginTop="@dimen/margin_medium"
android:textColor="@color/briar_text_secondary"
......@@ -46,34 +45,34 @@
android:layout_alignEnd="@+id/text"
android:layout_alignRight="@+id/text"
android:layout_below="@+id/text"
android:layout_marginBottom="@dimen/margin_small"
android:layout_toRightOf="@+id/icon"
android:gravity="center_vertical"
android:minHeight="24dp"
android:textColor="@color/briar_text_secondary"
android:textIsSelectable="true"
android:textSize="@dimen/text_size_small"
android:textSize="@dimen/text_size_tiny"
android:textStyle="italic"
tools:text="@string/groups_reveal_visible_revealed_by_contact"/>
<org.briarproject.android.view.AuthorView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/button_size"
android:layout_alignLeft="@+id/text"
android:layout_below="@+id/info"
android:paddingBottom="@dimen/margin_medium"
android:gravity="center"
app:persona="commenter"/>
<Button
android:id="@+id/optionsButton"
style="@style/BriarButtonFlat.Positive"
style="@style/BriarButtonFlat.Positive.Tiny"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/author"
android:layout_alignEnd="@+id/text"
android:layout_alignRight="@+id/text"
android:layout_alignTop="@+id/author"
android:layout_toRightOf="@+id/author"
android:gravity="right"
android:gravity="right|center_vertical"
android:text="@string/options"/>
</RelativeLayout>
......@@ -6,8 +6,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false">
android:baselineAligned="false"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="wrap_content"
......@@ -70,64 +70,64 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_medium"
android:layout_marginBottom="@dimen/margin_medium"
android:layout_weight="1">
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_medium"
android:paddingRight="@dimen/margin_medium"
android:paddingTop="@dimen/margin_medium"
android:textColor="@color/briar_text_primary"
android:textIsSelectable="true"
android:textSize="@dimen/text_size_medium"
android:textColor="@color/briar_text_primary"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."/>
<org.briarproject.android.view.AuthorView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="@dimen/button_size"
android:layout_alignLeft="@id/text"
android:layout_below="@id/text"
android:gravity="center"
app:persona="commenter"/>
<ImageView
android:id="@+id/chevron"
<TextView
android:id="@+id/replies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/text"
android:layout_marginRight="@dimen/margin_medium"
android:layout_marginTop="@dimen/margin_small"
android:clickable="true"
android:src="@drawable/selector_chevron"/>
android:layout_alignBottom="@+id/author"
android:layout_alignTop="@+id/author"
android:layout_toLeftOf="@+id/btn_reply"
android:layout_toRightOf="@+id/author"
android:ellipsize="end"
android:gravity="right|end|center_vertical"
android:maxLines="1"
android:padding="@dimen/margin_medium"
android:textSize="@dimen/text_size_tiny"
tools:text="2 replies"/>
<TextView
android:id="@+id/btn_reply"
style="@style/BriarButtonFlat.Positive.Tiny"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/text"
android:layout_marginRight="@dimen/margin_medium"
android:layout_toLeftOf="@id/chevron"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:padding="@dimen/margin_medium"
android:layout_alignBottom="@+id/author"
android:layout_toLeftOf="@+id/chevron"
android:text="@string/btn_reply"
android:textColor="@color/briar_button_positive"
android:textSize="@dimen/text_size_tiny"/>
<TextView
android:id="@+id/replies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/btn_reply"
android:layout_toLeftOf="@id/btn_reply"
android:layout_toRightOf="@+id/author"
android:gravity="right|end"
android:maxLines="1"
<ImageView
android:id="@+id/chevron"
android:layout_width="@dimen/button_size"
android:layout_height="@dimen/button_size"
android:layout_alignBottom="@+id/author"
android:layout_alignParentRight="true"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:padding="@dimen/margin_medium"
android:textSize="@dimen/text_size_tiny"
tools:text="2 replies"/>
android:scaleType="center"
android:src="@drawable/selector_chevron"/>
<View
android:id="@+id/top_divider"
......
......@@ -31,6 +31,7 @@
<dimen name="avatar_forum_size">48dp</dimen>
<dimen name="avatar_border_width">2dp</dimen>
<dimen name="avatar_text_size">30sp</dimen>
<dimen name="button_size">48dp</dimen>
<dimen name="unread_bubble_text_size">12sp</dimen>
<dimen name="unread_bubble_padding_horizontal">6dp</dimen>
......
......@@ -224,7 +224,7 @@
<string name="forum_new_entry_received">New forum entry</string>
<string name="forum_new_message_hint">New Entry</string>
<string name="forum_message_reply_hint">New Reply</string>
<string name="btn_reply">REPLY</string>
<string name="btn_reply">Reply</string>
<plurals name="message_replies">
<item quantity="one">%1$d reply</item>
<item quantity="other">%1$d replies</item>
......
......@@ -45,6 +45,12 @@
<item name="android:padding">@dimen/margin_large</item>
</style>
<style name="BriarButtonFlat.Positive.Tiny" parent="BriarButtonFlat.Positive">
<item name="android:textSize">@dimen/text_size_tiny</item>
<item name="android:padding">@dimen/margin_medium</item>
<item name="android:minWidth">@dimen/button_size</item>
</style>
<style name="BriarTextTitle">
<item name="android:textSize">@dimen/text_size_medium</item>
<item name="android:textColor">@android:color/primary_text_light</item>
......
......@@ -8,7 +8,7 @@ import org.briarproject.api.privategroup.Visibility;
public class VisibilityStringProvider {
@StringRes
public static int getVisibilityString(Visibility v) {
public static int getVisibilityStringId(Visibility v) {
switch (v) {
case VISIBLE:
return R.string.groups_reveal_visible;
......
......@@ -44,7 +44,7 @@ import static org.briarproject.api.privategroup.PrivateGroupConstants.MAX_GROUP_
@MethodsNotNullByDefault
@ParametersNotNullByDefault
public class GroupActivity extends
ThreadListActivity<PrivateGroup, GroupMessageAdapter<GroupMessageItem>, GroupMessageItem, GroupMessageHeader>
ThreadListActivity<PrivateGroup, GroupMessageAdapter, GroupMessageItem, GroupMessageHeader>
implements GroupListener, OnClickListener {
private final static int REQUEST_INVITE = 2;
......@@ -85,9 +85,9 @@ public class GroupActivity extends
}
@Override
protected GroupMessageAdapter<GroupMessageItem> createAdapter(
protected GroupMessageAdapter createAdapter(
LinearLayoutManager layoutManager) {
return new GroupMessageAdapter<>(this, layoutManager);
return new GroupMessageAdapter(this, layoutManager);
}
@Override
......
......@@ -19,12 +19,11 @@ import static android.support.v7.widget.RecyclerView.NO_POSITION;
@UiThread
@NotNullByDefault
public class GroupMessageAdapter<I extends GroupMessageItem>
extends ThreadItemAdapter<I> {
class GroupMessageAdapter extends ThreadItemAdapter<GroupMessageItem> {
private boolean isCreator = false;
public GroupMessageAdapter(ThreadItemListener<I> listener,
public GroupMessageAdapter(ThreadItemListener<GroupMessageItem> listener,
LinearLayoutManager layoutManager) {
super(listener, layoutManager);
}
......@@ -38,13 +37,12 @@ public class GroupMessageAdapter<I extends GroupMessageItem>
}
@Override
public BaseThreadItemViewHolder<I> onCreateViewHolder(
public BaseThreadItemViewHolder<GroupMessageItem> onCreateViewHolder(
ViewGroup parent, int type) {
View v = LayoutInflater.from(parent.getContext())
.inflate(type, parent, false);
if (type == R.layout.list_item_group_join_notice) {
return (BaseThreadItemViewHolder<I>)
new JoinMessageItemViewHolder(v, isCreator);
return new JoinMessageItemViewHolder(v, isCreator);
}
return new ThreadPostViewHolder<>(v);
}
......@@ -60,7 +58,7 @@ public class GroupMessageAdapter<I extends GroupMessageItem>
GroupMessageItem item = items.get(position);
if (item instanceof JoinMessageItem) {
((JoinMessageItem) item).setVisibility(v);
notifyItemChanged(position, item);
notifyItemChanged(getVisiblePos(item), item);
}
}
}
......@@ -68,7 +66,7 @@ public class GroupMessageAdapter<I extends GroupMessageItem>
private int findItemPosition(AuthorId a) {
int count = items.size();
for (int i = 0; i < count; i++) {
I item = items.get(i);
GroupMessageItem item = items.get(i);
if (item.getAuthor().getId().equals(a))
return i;
}
......
......@@ -16,8 +16,7 @@ class JoinMessageItem extends GroupMessageItem {
private Visibility visibility;
private final boolean isInitial;
JoinMessageItem(JoinMessageHeader h,
String text) {
JoinMessageItem(JoinMessageHeader h, String text) {
super(h, text);
this.visibility = h.getVisibility();
this.isInitial = h.isInitial();
......
......@@ -16,15 +16,15 @@ import org.briarproject.android.threaded.ThreadItemAdapter.ThreadItemListener;
import org.briarproject.api.nullsafety.NotNullByDefault;
import static org.briarproject.android.BriarActivity.GROUP_ID;
import static org.briarproject.android.privategroup.VisibilityStringProvider.getVisibilityString;
import static org.briarproject.android.privategroup.VisibilityStringProvider.getVisibilityStringId;
import static org.briarproject.api.identity.Author.Status.OURSELVES;
import static org.briarproject.api.identity.Author.Status.UNKNOWN;
import static org.briarproject.api.privategroup.Visibility.INVISIBLE;
@UiThread
@NotNullByDefault
public class JoinMessageItemViewHolder
extends BaseThreadItemViewHolder<JoinMessageItem> {
class JoinMessageItemViewHolder
extends BaseThreadItemViewHolder<GroupMessageItem> {
private final boolean isCreator;
private final ImageView icon;
......@@ -40,19 +40,18 @@ public class JoinMessageItemViewHolder
}
@Override
public void bind(ThreadItemAdapter<JoinMessageItem> adapter,
ThreadItemListener<JoinMessageItem> listener, JoinMessageItem item,
int pos) {
public void bind(ThreadItemAdapter<GroupMessageItem> adapter,
ThreadItemListener<GroupMessageItem> listener,
GroupMessageItem item, int pos) {
super.bind(adapter, listener, item, pos);
if (isCreator) bindForCreator(item);
else bind(item);
if (isCreator) bindForCreator((JoinMessageItem) item);
else bind((JoinMessageItem) item);
}
private void bindForCreator(final JoinMessageItem item) {
if (item.isInitial()) {
textView.setText(
getContext().getString(R.string.groups_member_created_you));
textView.setText(R.string.groups_member_created_you);
} else {
textView.setText(
getContext().getString(R.string.groups_member_joined,
......@@ -71,8 +70,7 @@ public class JoinMessageItemViewHolder
item.getAuthor().getName()));
} else {
if (item.getStatus() == OURSELVES) {
textView.setText(
ctx.getString(R.string.groups_member_joined_you));
textView.setText(R.string.groups_member_joined_you);
} else {
textView.setText(ctx.getString(R.string.groups_member_joined,
item.getAuthor().getName()));
......@@ -86,7 +84,7 @@ public class JoinMessageItemViewHolder
} else {
icon.setVisibility(View.VISIBLE);
info.setVisibility(View.VISIBLE);
info.setText(getVisibilityString(item.getVisibility()));
info.setText(getVisibilityStringId(item.getVisibility()));
if (item.getVisibility() == INVISIBLE) {
icon.setImageResource(R.drawable.ic_visibility_off);
......
......@@ -10,7 +10,7 @@ import org.briarproject.android.contactselection.BaseSelectableContactHolder;
import org.briarproject.api.nullsafety.NotNullByDefault;
import org.jetbrains.annotations.Nullable;
import static org.briarproject.android.privategroup.VisibilityStringProvider.getVisibilityString;
import static org.briarproject.android.privategroup.VisibilityStringProvider.getVisibilityStringId;
import static org.briarproject.android.util.AndroidUtils.GREY_OUT;
import static org.briarproject.api.privategroup.Visibility.INVISIBLE;
......@@ -32,7 +32,7 @@ public class RevealableContactViewHolder
OnContactClickListener<RevealableContactItem> listener) {
super.bind(item, listener);
info.setText(getVisibilityString(item.getVisibility()));
info.setText(getVisibilityStringId(item.getVisibility()));
if (item.getVisibility() == INVISIBLE) {
icon.setImageResource(R.drawable.ic_visibility_off);
......
......@@ -273,7 +273,7 @@ public class ThreadItemAdapter<I extends ThreadItem>
* items if 'item' is null. If 'item' is not visible, NO_POSITION is
* returned.
*/
private int getVisiblePos(@Nullable I item) {
protected int getVisiblePos(@Nullable I item) {
int visibleCounter = 0;
int levelLimit = UNDEFINED;
for (I i : items) {
......
......@@ -9,13 +9,13 @@ import javax.annotation.concurrent.Immutable;
public class JoinMessageHeader extends GroupMessageHeader {
private final Visibility visibility;
private final boolean isCreator;
private final boolean isInitial;
public JoinMessageHeader(GroupMessageHeader h, Visibility visibility, boolean isCreator) {
public JoinMessageHeader(GroupMessageHeader h, Visibility visibility, boolean isInitial) {
super(h.getGroupId(), h.getId(), h.getParentId(), h.getTimestamp(),
h.getAuthor(), h.getAuthorStatus(), h.isRead());
this.visibility = visibility;
this.isCreator = isCreator;
this.isInitial = isInitial;
}
public Visibility getVisibility() {
......@@ -23,7 +23,7 @@ public class JoinMessageHeader extends GroupMessageHeader {
}
public boolean isInitial() {
return isCreator;
return isInitial;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment