mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -9,8 +8,9 @@
|
|||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/listitem_height_contact_selector"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground">
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/listitem_horizontal_margin">
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
android:id="@+id/avatarView"
|
android:id="@+id/avatarView"
|
||||||
@@ -20,13 +20,10 @@
|
|||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
|
|
||||||
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
|
||||||
android:transitionName="avatar"
|
android:transitionName="avatar"
|
||||||
tools:src="@drawable/ic_launcher"/>
|
tools:src="@drawable/ic_launcher"/>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/nameView"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
@@ -35,10 +32,28 @@
|
|||||||
android:layout_toEndOf="@+id/avatarView"
|
android:layout_toEndOf="@+id/avatarView"
|
||||||
android:layout_toLeftOf="@+id/checkBox"
|
android:layout_toLeftOf="@+id/checkBox"
|
||||||
android:layout_toRightOf="@+id/avatarView"
|
android:layout_toRightOf="@+id/avatarView"
|
||||||
android:maxLines="2"
|
android:orientation="vertical">
|
||||||
android:textSize="@dimen/text_size_large"
|
|
||||||
android:textColor="@color/briar_text_primary"
|
<TextView
|
||||||
tools:text="This is a name of a contact"/>
|
android:id="@+id/nameView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:textColor="@color/briar_text_primary"
|
||||||
|
android:textSize="@dimen/text_size_large"
|
||||||
|
tools:text="This is a name of a contact"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/infoView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="2"
|
||||||
|
android:text="@string/forum_invitation_already_sharing"
|
||||||
|
android:textColor="@color/briar_text_tertiary"
|
||||||
|
android:textSize="@dimen/text_size_small"
|
||||||
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/checkBox"
|
android:id="@+id/checkBox"
|
||||||
@@ -47,7 +62,6 @@
|
|||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
|
||||||
android:clickable="false"/>
|
android:clickable="false"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
<dimen name="listitem_vertical_margin">10dp</dimen>
|
<dimen name="listitem_vertical_margin">10dp</dimen>
|
||||||
<dimen name="listitem_text_left_margin">72dp</dimen>
|
<dimen name="listitem_text_left_margin">72dp</dimen>
|
||||||
<dimen name="listitem_height_one_line_avatar">56dp</dimen>
|
<dimen name="listitem_height_one_line_avatar">56dp</dimen>
|
||||||
<dimen name="listitem_height_contact_selector">68dp</dimen>
|
|
||||||
<dimen name="listitem_picture_size">48dp</dimen>
|
<dimen name="listitem_picture_size">48dp</dimen>
|
||||||
<dimen name="listitem_picture_size_small">23dp</dimen>
|
<dimen name="listitem_picture_size_small">23dp</dimen>
|
||||||
<dimen name="listitem_picture_frame_size">53dp</dimen>
|
<dimen name="listitem_picture_frame_size">53dp</dimen>
|
||||||
|
|||||||
@@ -221,6 +221,7 @@
|
|||||||
<string name="forum_new_entry_received">New forum entry</string>
|
<string name="forum_new_entry_received">New forum entry</string>
|
||||||
<string name="forum_new_message_hint">New Entry</string>
|
<string name="forum_new_message_hint">New Entry</string>
|
||||||
<string name="forum_message_reply_hint">New Reply</string>
|
<string name="forum_message_reply_hint">New Reply</string>
|
||||||
|
<string name="forum_invitation_already_sharing">Already sharing</string>
|
||||||
|
|
||||||
<!-- Dialogs -->
|
<!-- Dialogs -->
|
||||||
<string name="dialog_title_lost_password">Lost Password</string>
|
<string name="dialog_title_lost_password">Lost Password</string>
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import android.graphics.ColorFilter;
|
|||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.briarproject.R;
|
import org.briarproject.R;
|
||||||
import org.briarproject.android.contact.BaseContactListAdapter;
|
import org.briarproject.android.contact.BaseContactListAdapter;
|
||||||
@@ -19,10 +21,13 @@ import org.briarproject.api.contact.ContactId;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public class ContactSelectorAdapter
|
import static android.view.View.GONE;
|
||||||
|
import static android.view.View.VISIBLE;
|
||||||
|
|
||||||
|
class ContactSelectorAdapter
|
||||||
extends BaseContactListAdapter<ContactSelectorAdapter.SelectableContactHolder> {
|
extends BaseContactListAdapter<ContactSelectorAdapter.SelectableContactHolder> {
|
||||||
|
|
||||||
public ContactSelectorAdapter(Context context,
|
ContactSelectorAdapter(Context context,
|
||||||
OnItemClickListener listener) {
|
OnItemClickListener listener) {
|
||||||
|
|
||||||
super(context, listener);
|
super(context, listener);
|
||||||
@@ -53,11 +58,15 @@ public class ContactSelectorAdapter
|
|||||||
if (item.isDisabled()) {
|
if (item.isDisabled()) {
|
||||||
// we share this forum already with that contact
|
// we share this forum already with that contact
|
||||||
ui.layout.setEnabled(false);
|
ui.layout.setEnabled(false);
|
||||||
grayOutItem(ui);
|
ui.shared.setVisibility(VISIBLE);
|
||||||
|
grayOutItem(ui, true);
|
||||||
|
} else {
|
||||||
|
ui.shared.setVisibility(GONE);
|
||||||
|
grayOutItem(ui, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ContactId> getSelectedContactIds() {
|
Collection<ContactId> getSelectedContactIds() {
|
||||||
Collection<ContactId> selected = new ArrayList<>();
|
Collection<ContactId> selected = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < contacts.size(); i++) {
|
for (int i = 0; i < contacts.size(); i++) {
|
||||||
@@ -69,15 +78,17 @@ public class ContactSelectorAdapter
|
|||||||
return selected;
|
return selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class SelectableContactHolder
|
static class SelectableContactHolder
|
||||||
extends BaseContactListAdapter.BaseContactHolder {
|
extends BaseContactListAdapter.BaseContactHolder {
|
||||||
|
|
||||||
private final CheckBox checkBox;
|
private final CheckBox checkBox;
|
||||||
|
private final TextView shared;
|
||||||
|
|
||||||
public SelectableContactHolder(View v) {
|
SelectableContactHolder(View v) {
|
||||||
super(v);
|
super(v);
|
||||||
|
|
||||||
checkBox = (CheckBox) v.findViewById(R.id.checkBox);
|
checkBox = (CheckBox) v.findViewById(R.id.checkBox);
|
||||||
|
shared = (TextView) v.findViewById(R.id.infoView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,18 +97,27 @@ public class ContactSelectorAdapter
|
|||||||
return compareByName(c1, c2);
|
return compareByName(c1, c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void grayOutItem(final SelectableContactHolder ui) {
|
private void grayOutItem(final SelectableContactHolder ui,
|
||||||
|
final boolean gray) {
|
||||||
if (Build.VERSION.SDK_INT >= 11) {
|
if (Build.VERSION.SDK_INT >= 11) {
|
||||||
float alpha = 0.25f;
|
float alpha = 1f;
|
||||||
|
if (gray) alpha = 0.25f;
|
||||||
ui.avatar.setAlpha(alpha);
|
ui.avatar.setAlpha(alpha);
|
||||||
ui.name.setAlpha(alpha);
|
ui.name.setAlpha(alpha);
|
||||||
|
ui.shared.setAlpha(alpha);
|
||||||
ui.checkBox.setAlpha(alpha);
|
ui.checkBox.setAlpha(alpha);
|
||||||
} else {
|
} else {
|
||||||
ColorFilter colorFilter = new PorterDuffColorFilter(Color.GRAY,
|
if (gray) {
|
||||||
PorterDuff.Mode.MULTIPLY);
|
ColorFilter colorFilter = new PorterDuffColorFilter(
|
||||||
ui.avatar.setColorFilter(colorFilter);
|
ContextCompat.getColor(ctx, R.color.window_background),
|
||||||
ui.name.setEnabled(false);
|
PorterDuff.Mode.MULTIPLY);
|
||||||
ui.checkBox.setEnabled(false);
|
ui.avatar.setColorFilter(colorFilter);
|
||||||
|
} else{
|
||||||
|
ui.avatar.clearColorFilter();
|
||||||
|
}
|
||||||
|
ui.name.setEnabled(!gray);
|
||||||
|
ui.shared.setEnabled(!gray);
|
||||||
|
ui.checkBox.setEnabled(!gray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user