mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Merge branch '951-remove-visibility-indicators' into 'master'
Remove visibility indicators from private group join messages Closes #951 See merge request !546
This commit is contained in:
@@ -1,25 +1,15 @@
|
||||
package org.briarproject.briar.android.privategroup.conversation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.UiThread;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.privategroup.reveal.RevealContactsActivity;
|
||||
import org.briarproject.briar.android.threaded.BaseThreadItemViewHolder;
|
||||
import org.briarproject.briar.android.threaded.ThreadItemAdapter.ThreadItemListener;
|
||||
|
||||
import static org.briarproject.bramble.api.identity.Author.Status.OURSELVES;
|
||||
import static org.briarproject.bramble.api.identity.Author.Status.UNKNOWN;
|
||||
import static org.briarproject.briar.android.activity.BriarActivity.GROUP_ID;
|
||||
import static org.briarproject.briar.android.privategroup.VisibilityHelper.getVisibilityIcon;
|
||||
import static org.briarproject.briar.android.privategroup.VisibilityHelper.getVisibilityString;
|
||||
import static org.briarproject.briar.api.privategroup.Visibility.INVISIBLE;
|
||||
|
||||
@UiThread
|
||||
@NotNullByDefault
|
||||
@@ -27,16 +17,10 @@ class JoinMessageItemViewHolder
|
||||
extends BaseThreadItemViewHolder<GroupMessageItem> {
|
||||
|
||||
private final boolean isCreator;
|
||||
private final ImageView icon;
|
||||
private final TextView info;
|
||||
private final Button options;
|
||||
|
||||
JoinMessageItemViewHolder(View v, boolean isCreator) {
|
||||
super(v);
|
||||
this.isCreator = isCreator;
|
||||
icon = (ImageView) v.findViewById(R.id.icon);
|
||||
info = (TextView) v.findViewById(R.id.info);
|
||||
options = (Button) v.findViewById(R.id.optionsButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,9 +40,6 @@ class JoinMessageItemViewHolder
|
||||
getContext().getString(R.string.groups_member_joined,
|
||||
item.getAuthor().getName()));
|
||||
}
|
||||
icon.setVisibility(View.GONE);
|
||||
info.setVisibility(View.GONE);
|
||||
options.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void bind(final JoinMessageItem item) {
|
||||
@@ -75,32 +56,6 @@ class JoinMessageItemViewHolder
|
||||
item.getAuthor().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getStatus() == OURSELVES || item.getStatus() == UNKNOWN) {
|
||||
icon.setVisibility(View.GONE);
|
||||
info.setVisibility(View.GONE);
|
||||
options.setVisibility(View.GONE);
|
||||
} else {
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
icon.setImageResource(getVisibilityIcon(item.getVisibility()));
|
||||
info.setVisibility(View.VISIBLE);
|
||||
info.setText(getVisibilityString(getContext(), item.getVisibility(),
|
||||
item.getAuthor().getName()));
|
||||
if (item.getVisibility() == INVISIBLE) {
|
||||
options.setVisibility(View.VISIBLE);
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i =
|
||||
new Intent(ctx, RevealContactsActivity.class);
|
||||
i.putExtra(GROUP_ID, item.getGroupId().getBytes());
|
||||
ctx.startActivity(i);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
options.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ class MemberListAdapter extends
|
||||
@Override
|
||||
public boolean areContentsTheSame(MemberListItem m1, MemberListItem m2) {
|
||||
if (m1.isOnline() != m2.isOnline()) return false;
|
||||
if (m1.getVisibility() != m2.getVisibility()) return false;
|
||||
if (m1.getContactId() != m2.getContactId()) return false;
|
||||
if (m1.getStatus() != m2.getStatus()) return false;
|
||||
return true;
|
||||
|
||||
@@ -5,7 +5,6 @@ import org.briarproject.bramble.api.identity.Author;
|
||||
import org.briarproject.bramble.api.identity.Author.Status;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.api.privategroup.GroupMember;
|
||||
import org.briarproject.briar.api.privategroup.Visibility;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.NotThreadSafe;
|
||||
@@ -39,10 +38,6 @@ class MemberListItem {
|
||||
return groupMember.getContactId();
|
||||
}
|
||||
|
||||
Visibility getVisibility() {
|
||||
return groupMember.getVisibility();
|
||||
}
|
||||
|
||||
boolean isOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,6 @@ import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.view.AuthorView;
|
||||
|
||||
import static org.briarproject.bramble.api.identity.Author.Status.OURSELVES;
|
||||
import static org.briarproject.bramble.api.identity.Author.Status.UNKNOWN;
|
||||
import static org.briarproject.briar.android.privategroup.VisibilityHelper.getVisibilityIcon;
|
||||
import static org.briarproject.briar.android.privategroup.VisibilityHelper.getVisibilityString;
|
||||
|
||||
@UiThread
|
||||
@NotNullByDefault
|
||||
@@ -22,16 +19,12 @@ class MemberListItemHolder extends RecyclerView.ViewHolder {
|
||||
private final AuthorView author;
|
||||
private final ImageView bulb;
|
||||
private final TextView creator;
|
||||
private final ImageView icon;
|
||||
private final TextView info;
|
||||
|
||||
MemberListItemHolder(View v) {
|
||||
super(v);
|
||||
author = (AuthorView) v.findViewById(R.id.authorView);
|
||||
bulb = (ImageView) v.findViewById(R.id.bulbView);
|
||||
creator = (TextView) v.findViewById(R.id.creatorView);
|
||||
icon = (ImageView) v.findViewById(R.id.icon);
|
||||
info = (TextView) v.findViewById(R.id.info);
|
||||
}
|
||||
|
||||
protected void bind(MemberListItem item) {
|
||||
@@ -64,19 +57,6 @@ class MemberListItemHolder extends RecyclerView.ViewHolder {
|
||||
} else {
|
||||
creator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// visibility information
|
||||
if (item.getStatus() == OURSELVES || item.getStatus() == UNKNOWN) {
|
||||
icon.setVisibility(View.GONE);
|
||||
info.setVisibility(View.GONE);
|
||||
} else {
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
icon.setImageResource(getVisibilityIcon(item.getVisibility()));
|
||||
info.setVisibility(View.VISIBLE);
|
||||
info.setText(
|
||||
getVisibilityString(info.getContext(), item.getVisibility(),
|
||||
item.getMember().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,57 +19,15 @@
|
||||
android:textStyle="italic"
|
||||
tools:text="@string/groups_member_joined"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/info"
|
||||
android:layout_alignLeft="@+id/text"
|
||||
android:layout_alignTop="@+id/info"
|
||||
android:layout_below="@+id/text"
|
||||
android:layout_marginRight="@dimen/margin_medium"
|
||||
android:scaleType="center"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@drawable/ic_visibility"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/text"
|
||||
android:layout_alignRight="@+id/text"
|
||||
android:layout_below="@+id/text"
|
||||
android:layout_marginBottom="@dimen/margin_medium"
|
||||
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_tiny"
|
||||
android:textStyle="italic"
|
||||
tools:text="@string/groups_reveal_visible_revealed_by_contact"/>
|
||||
|
||||
<org.briarproject.briar.android.view.AuthorView
|
||||
android:id="@+id/author"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/text"
|
||||
android:layout_below="@+id/info"
|
||||
android:layout_toLeftOf="@+id/optionsButton"
|
||||
android:layout_alignStart="@+id/text"
|
||||
android:layout_below="@+id/text"
|
||||
app:persona="commenter"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/optionsButton"
|
||||
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_below="@+id/info"
|
||||
android:gravity="right|center_vertical"
|
||||
android:text="@string/options"/>
|
||||
|
||||
<View
|
||||
style="@style/Divider.ThreadItem"
|
||||
android:layout_below="@+id/author"
|
||||
|
||||
@@ -13,11 +13,13 @@
|
||||
android:id="@+id/authorView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginBottom="@dimen/margin_small"
|
||||
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||
android:layout_toStartOf="@+id/bulbView"
|
||||
android:layout_toLeftOf="@+id/bulbView"
|
||||
app:persona="list"/>
|
||||
|
||||
@@ -29,6 +31,7 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignTop="@+id/authorView"
|
||||
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||
tools:src="@drawable/contact_connected"/>
|
||||
|
||||
@@ -39,40 +42,16 @@
|
||||
android:layout_below="@+id/authorView"
|
||||
android:layout_marginBottom="@dimen/margin_small"
|
||||
android:layout_marginLeft="@dimen/listitem_group_member_indentation"
|
||||
android:layout_marginStart="@dimen/listitem_group_member_indentation"
|
||||
android:text="@string/groups_member_created_you"
|
||||
android:textColor="@color/briar_text_secondary"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/creatorView"
|
||||
android:layout_marginLeft="@dimen/listitem_group_member_indentation"
|
||||
android:layout_marginRight="@dimen/margin_small"
|
||||
android:contentDescription="@string/forum_invitation_already_sharing"
|
||||
android:src="@drawable/ic_visibility"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/creatorView"
|
||||
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||
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_tiny"
|
||||
android:textStyle="italic"
|
||||
tools:text="@string/groups_reveal_visible_revealed_by_us"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
style="@style/Divider.ContactList"
|
||||
android:layout_below="@+id/info"
|
||||
android:layout_below="@+id/creatorView"
|
||||
android:layout_marginStart="@dimen/listitem_group_member_indentation"
|
||||
android:layout_marginLeft="@dimen/listitem_group_member_indentation"
|
||||
android:layout_marginTop="@dimen/margin_medium"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user