mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Remove NewGroupUI FeatureFlag.
This commit is contained in:
@@ -58,7 +58,6 @@ public final class FeatureFlags {
|
||||
private static final String REMOTE_DELETE = "android.remoteDelete";
|
||||
private static final String PROFILE_FOR_CALLING = "android.profileForCalling";
|
||||
private static final String CALLING_PIP = "android.callingPip";
|
||||
private static final String NEW_GROUP_UI_KILL_SWITCH = "android.newGroupUI.KillSwitch";
|
||||
private static final String VERSIONED_PROFILES = "android.versionedProfiles";
|
||||
private static final String GROUPS_V2 = "android.groupsv2";
|
||||
private static final String GROUPS_V2_CREATE = "android.groupsv2.create";
|
||||
@@ -78,7 +77,6 @@ public final class FeatureFlags {
|
||||
REMOTE_DELETE,
|
||||
PROFILE_FOR_CALLING,
|
||||
CALLING_PIP,
|
||||
NEW_GROUP_UI_KILL_SWITCH,
|
||||
VERSIONED_PROFILES,
|
||||
GROUPS_V2,
|
||||
GROUPS_V2_CREATE,
|
||||
@@ -235,11 +233,6 @@ public final class FeatureFlags {
|
||||
return getBoolean(CALLING_PIP, false);
|
||||
}
|
||||
|
||||
/** New group UI elements. */
|
||||
public static boolean newGroupUI() {
|
||||
return !getBoolean(NEW_GROUP_UI_KILL_SWITCH, false);
|
||||
}
|
||||
|
||||
/** Read and write versioned profile information. */
|
||||
public static boolean versionedProfiles() {
|
||||
return getBoolean(VERSIONED_PROFILES, false);
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class SelectedRecipientsAdapter extends BaseAdapter {
|
||||
@NonNull private Context context;
|
||||
@Nullable private OnRecipientDeletedListener onRecipientDeletedListener;
|
||||
@NonNull private List<RecipientWrapper> recipients;
|
||||
|
||||
public SelectedRecipientsAdapter(@NonNull Context context) {
|
||||
this(context, Collections.<Recipient>emptyList());
|
||||
}
|
||||
|
||||
public SelectedRecipientsAdapter(@NonNull Context context,
|
||||
@NonNull Collection<Recipient> existingRecipients)
|
||||
{
|
||||
this.context = context;
|
||||
this.recipients = wrapExistingMembers(existingRecipients);
|
||||
}
|
||||
|
||||
public void add(@NonNull Recipient recipient, boolean isPush) {
|
||||
if (!find(recipient).isPresent()) {
|
||||
RecipientWrapper wrapper = new RecipientWrapper(recipient, true, isPush);
|
||||
this.recipients.add(0, wrapper);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Optional<RecipientWrapper> find(@NonNull Recipient recipient) {
|
||||
RecipientWrapper found = null;
|
||||
for (RecipientWrapper wrapper : recipients) {
|
||||
if (wrapper.getRecipient().equals(recipient)) found = wrapper;
|
||||
}
|
||||
return Optional.fromNullable(found);
|
||||
}
|
||||
|
||||
public void remove(@NonNull Recipient recipient) {
|
||||
Optional<RecipientWrapper> match = find(recipient);
|
||||
if (match.isPresent()) {
|
||||
recipients.remove(match.get());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public Set<Recipient> getRecipients() {
|
||||
final Set<Recipient> recipientSet = new HashSet<>(recipients.size());
|
||||
for (RecipientWrapper wrapper : recipients) {
|
||||
recipientSet.add(wrapper.getRecipient());
|
||||
}
|
||||
return recipientSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return recipients.size();
|
||||
}
|
||||
|
||||
public boolean hasNonPushMembers() {
|
||||
for (RecipientWrapper wrapper : recipients) {
|
||||
if (!wrapper.isPush()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return recipients.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View v, final ViewGroup parent) {
|
||||
if (v == null) {
|
||||
v = LayoutInflater.from(context).inflate(R.layout.selected_recipient_list_item, parent, false);
|
||||
}
|
||||
|
||||
final RecipientWrapper rw = (RecipientWrapper)getItem(position);
|
||||
final Recipient p = rw.getRecipient();
|
||||
final boolean modifiable = rw.isModifiable();
|
||||
|
||||
TextView name = (TextView) v.findViewById(R.id.name);
|
||||
TextView phone = (TextView) v.findViewById(R.id.phone);
|
||||
ImageButton delete = (ImageButton) v.findViewById(R.id.delete);
|
||||
|
||||
name.setText(p.getDisplayName(v.getContext()));
|
||||
phone.setText(p.getE164().or(""));
|
||||
delete.setVisibility(modifiable ? View.VISIBLE : View.GONE);
|
||||
delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (onRecipientDeletedListener != null) {
|
||||
onRecipientDeletedListener.onRecipientDeleted(recipients.get(position).getRecipient());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
private static List<RecipientWrapper> wrapExistingMembers(Collection<Recipient> recipients) {
|
||||
final LinkedList<RecipientWrapper> wrapperList = new LinkedList<>();
|
||||
for (Recipient recipient : recipients) {
|
||||
wrapperList.add(new RecipientWrapper(recipient, false, true));
|
||||
}
|
||||
return wrapperList;
|
||||
}
|
||||
|
||||
public void setOnRecipientDeletedListener(@Nullable OnRecipientDeletedListener listener) {
|
||||
onRecipientDeletedListener = listener;
|
||||
}
|
||||
|
||||
public interface OnRecipientDeletedListener {
|
||||
void onRecipientDeleted(Recipient recipient);
|
||||
}
|
||||
|
||||
public static class RecipientWrapper {
|
||||
private final Recipient recipient;
|
||||
private final boolean modifiable;
|
||||
private final boolean push;
|
||||
|
||||
public RecipientWrapper(final @NonNull Recipient recipient,
|
||||
final boolean modifiable,
|
||||
final boolean push)
|
||||
{
|
||||
this.recipient = recipient;
|
||||
this.modifiable = modifiable;
|
||||
this.push = push;
|
||||
}
|
||||
|
||||
public @NonNull Recipient getRecipient() {
|
||||
return recipient;
|
||||
}
|
||||
|
||||
public boolean isModifiable() {
|
||||
return modifiable;
|
||||
}
|
||||
|
||||
public boolean isPush() {
|
||||
return push;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user