mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge pull request #2089 from deltachat/adb-improve-new-group
improve selected recipients list
This commit is contained in:
@@ -1,25 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
<org.thoughtcrime.securesms.components.AvatarImageView
|
||||
android:id="@+id/contact_photo_image"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:foreground="@drawable/contact_photo_background"
|
||||
android:cropToPadding="true"
|
||||
tools:src="@color/blue_600"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:layout_toRightOf="@+id/contact_photo_image"
|
||||
android:layout_toEndOf="@+id/contact_photo_image"
|
||||
android:layout_toLeftOf="@+id/delete"
|
||||
android:layout_toStartOf="@+id/delete"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:drawablePadding="5dp"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:fontFamily="sans-serif"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/phone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignLeft="@+id/name"
|
||||
android:layout_alignStart="@+id/name"
|
||||
android:layout_below="@id/name"
|
||||
android:layout_toLeftOf="@+id/delete"
|
||||
android:layout_toStartOf="@+id/delete"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textSize="14sp"
|
||||
android:fontFamily="sans-serif-light" />
|
||||
|
||||
<ImageButton
|
||||
@@ -27,6 +54,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@string/delete"
|
||||
android:background="#00ffffff"
|
||||
|
||||
@@ -223,7 +223,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
||||
DcContact self = dcContext.getContact(DC_CONTACT_ID_SELF);
|
||||
initList.add(new Recipient(this, self));
|
||||
}
|
||||
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(this, initList);
|
||||
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(this, GlideApp.with(this), initList);
|
||||
adapter.setOnRecipientDeletedListener(this);
|
||||
lv.setAdapter(adapter);
|
||||
|
||||
@@ -549,7 +549,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
|
||||
if (isEdit() && recipient.getName()!=null) {
|
||||
groupName.setSelection(recipient.getName().length(), recipient.getName().length());
|
||||
}
|
||||
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(this, participants);
|
||||
SelectedRecipientsAdapter adapter = new SelectedRecipientsAdapter(this, GlideApp.with(this), participants);
|
||||
adapter.setOnRecipientDeletedListener(this);
|
||||
lv.setAdapter(adapter);
|
||||
updateViewState();
|
||||
|
||||
@@ -15,7 +15,10 @@ import com.b44t.messenger.DcContact;
|
||||
import com.b44t.messenger.DcContext;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiTextView;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.guava.Optional;
|
||||
|
||||
@@ -33,13 +36,16 @@ public class SelectedRecipientsAdapter extends BaseAdapter {
|
||||
@Nullable private OnRecipientDeletedListener onRecipientDeletedListener;
|
||||
@NonNull private List<RecipientWrapper> recipients;
|
||||
@NonNull private final DcContext dcContext;
|
||||
@NonNull private final GlideRequests glideRequests;
|
||||
|
||||
public SelectedRecipientsAdapter(@NonNull Context context,
|
||||
@NonNull GlideRequests glideRequests,
|
||||
@NonNull Collection<Recipient> existingRecipients)
|
||||
{
|
||||
this.context = context;
|
||||
this.dcContext = DcHelper.getContext(context);
|
||||
this.recipients = wrapExistingMembers(existingRecipients);
|
||||
this.context = context;
|
||||
this.glideRequests = glideRequests;
|
||||
this.dcContext = DcHelper.getContext(context);
|
||||
this.recipients = wrapExistingMembers(existingRecipients);
|
||||
}
|
||||
|
||||
public void add(@NonNull Recipient recipient, boolean isPush) {
|
||||
@@ -113,10 +119,12 @@ public class SelectedRecipientsAdapter extends BaseAdapter {
|
||||
dcContact = dcContext.getContact(p.getAddress().getDcContactId());
|
||||
}
|
||||
|
||||
TextView name = v.findViewById(R.id.name);
|
||||
TextView phone = v.findViewById(R.id.phone);
|
||||
ImageButton delete = v.findViewById(R.id.delete);
|
||||
AvatarImageView avatar = v.findViewById(R.id.contact_photo_image);
|
||||
EmojiTextView name = v.findViewById(R.id.name);
|
||||
TextView phone = v.findViewById(R.id.phone);
|
||||
ImageButton delete = v.findViewById(R.id.delete);
|
||||
|
||||
avatar.setAvatar(glideRequests, p, false);
|
||||
name.setText(dcContact.getDisplayName());
|
||||
phone.setText(dcContact.getAddr());
|
||||
delete.setVisibility(modifiable ? View.VISIBLE : View.GONE);
|
||||
@@ -172,4 +180,4 @@ public class SelectedRecipientsAdapter extends BaseAdapter {
|
||||
return modifiable;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user