do not show 'contact only' switch for group avatars

This commit is contained in:
Daniel Gultsch 2024-12-29 23:16:46 +01:00 committed by Arne
parent 4497149950
commit c42293a574

View file

@ -82,11 +82,11 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
private void reloadAvatar() { private void reloadAvatar() {
if (xmppConnectionService == null) return; // We will get called again in onBackendConnected if (xmppConnectionService == null) return; // We will get called again in onBackendConnected
final int size = (int) getResources().getDimension(R.dimen.publish_avatar_size); final int size = (int) getResources().getDimension(R.dimen.publish_avatar_size);
Drawable bitmap; final Drawable bitmap;
if (uri == null) { if (uri == null) {
bitmap = xmppConnectionService.getAvatarService().get(conversation, size); bitmap = xmppConnectionService.getAvatarService().get(conversation, size);
} else { } else {
Log.d(Config.LOGTAG, "loading " + uri.toString() + " into preview"); Log.d(Config.LOGTAG, "loading " + uri + " into preview");
bitmap = xmppConnectionService.getFileBackend().cropCenterSquareDrawable(uri, size); bitmap = xmppConnectionService.getFileBackend().cropCenterSquareDrawable(uri, size);
} }
this.binding.accountImage.setImageDrawable(bitmap); this.binding.accountImage.setImageDrawable(bitmap);
@ -97,17 +97,18 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_publish_profile_picture); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_publish_profile_picture);
this.binding.contactOnly.setVisibility(View.GONE);
Activities.setStatusAndNavigationBarColors(this, binding.getRoot()); Activities.setStatusAndNavigationBarColors(this, binding.getRoot());
setSupportActionBar(this.binding.toolbar); setSupportActionBar(this.binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
this.binding.cancelButton.setOnClickListener((v) -> this.finish()); this.binding.cancelButton.setOnClickListener((v) -> this.finish());
this.binding.secondaryHint.setVisibility(View.GONE); this.binding.secondaryHint.setVisibility(View.GONE);
this.binding.accountImage.setOnClickListener((v) -> PublishProfilePictureActivity.chooseAvatar(this)); this.binding.accountImage.setOnClickListener((v) -> PublishProfilePictureActivity.chooseAvatar(this));
Intent intent = getIntent(); final var intent = getIntent();
String uuid = intent == null ? null : intent.getStringExtra("uuid"); final var uuid = intent == null ? null : intent.getStringExtra("uuid");
if (uuid != null) { if (uuid != null) {
pendingConversationUuid.push(uuid); pendingConversationUuid.push(uuid);
} }
@ -116,24 +117,24 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
} }
private void publish(View view) { private void publish(final View view) {
binding.publishButton.setText(R.string.publishing); binding.publishButton.setText(R.string.publishing);
binding.publishButton.setEnabled(false); binding.publishButton.setEnabled(false);
xmppConnectionService.publishMucAvatar(conversation, uri, this); xmppConnectionService.publishMucAvatar(conversation, uri, this);
} }
@Override @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) { if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
final CropImage.ActivityResult result = CropImage.getActivityResult(data); final CropImage.ActivityResult result = CropImage.getActivityResult(data);
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
this.uri = result.getUri(); this.uri = result == null ? null : result.getUri();
if (xmppConnectionServiceBound) { if (xmppConnectionServiceBound) {
reloadAvatar(); reloadAvatar();
} }
} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
Exception error = result.getError(); final var error = result == null ? null : result.getError();
if (error != null) { if (error != null) {
Toast.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show();
} }