mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 03:11:10 +01:00
Add polish to groups v2 creation flow.
This commit is contained in:
committed by
Greyson Parrelli
parent
8947b82034
commit
558a8e4a14
@@ -140,7 +140,7 @@ public class AddGroupDetailsFragment extends Fragment {
|
||||
|
||||
initializeViewModel();
|
||||
|
||||
avatar.setOnClickListener(v -> AvatarSelectionBottomSheetDialogFragment.create(false, true, REQUEST_CODE_AVATAR, true)
|
||||
avatar.setOnClickListener(v -> AvatarSelectionBottomSheetDialogFragment.create(viewModel.hasAvatar(), true, REQUEST_CODE_AVATAR, true)
|
||||
.show(getChildFragmentManager(), "BOTTOM"));
|
||||
members.setRecipientLongClickListener(this::handleRecipientLongClick);
|
||||
members.setRecipientClickListener(this::handleRecipientClick);
|
||||
@@ -162,11 +162,19 @@ public class AddGroupDetailsFragment extends Fragment {
|
||||
.into(avatar);
|
||||
}
|
||||
});
|
||||
|
||||
name.requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
if (requestCode == REQUEST_CODE_AVATAR && resultCode == Activity.RESULT_OK && data != null) {
|
||||
|
||||
if (data.getBooleanExtra("delete", false)) {
|
||||
viewModel.setAvatar(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final Media result = data.getParcelableExtra(AvatarSelectionActivity.EXTRA_MEDIA);
|
||||
final DecryptableStreamUriLoader.DecryptableUri decryptableUri = new DecryptableStreamUriLoader.DecryptableUri(result.getUri());
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.groups.ui.creategroup.details;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.Transformations;
|
||||
@@ -72,10 +73,14 @@ public final class AddGroupDetailsViewModel extends ViewModel {
|
||||
return isMms;
|
||||
}
|
||||
|
||||
void setAvatar(@NonNull byte[] avatar) {
|
||||
void setAvatar(@Nullable byte[] avatar) {
|
||||
this.avatar.setValue(avatar);
|
||||
}
|
||||
|
||||
boolean hasAvatar() {
|
||||
return avatar.getValue() != null;
|
||||
}
|
||||
|
||||
void setName(@NonNull String name) {
|
||||
this.name.setValue(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user