From 1afd2faa4a0938ddfe7022f17a8b912ed9bd987d Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 6 Jun 2020 16:49:09 +0200 Subject: [PATCH 1/5] fix opening avatar-preview, getBaseContext() is not needed and led to crashes on some android versions as this context might not be an Activity --- src/org/thoughtcrime/securesms/ProfileActivity.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ProfileActivity.java b/src/org/thoughtcrime/securesms/ProfileActivity.java index f195e715e..da4272ddc 100644 --- a/src/org/thoughtcrime/securesms/ProfileActivity.java +++ b/src/org/thoughtcrime/securesms/ProfileActivity.java @@ -401,12 +401,11 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity profileImagePath = dcContext.getContact(contactId).getProfileImage(); profileImageUri = Uri.fromFile(new File(profileImagePath)); - Context ctx = getBaseContext(); String type = "image/" + profileImagePath.substring(profileImagePath.lastIndexOf(".") +1); - Intent intent = new Intent(ctx, MediaPreviewActivity.class); - intent.setDataAndType(profileImageUri, type); - ctx.startActivity(intent); + Intent intent = new Intent(this, MediaPreviewActivity.class); + intent.setDataAndType(profileImageUri, type); + startActivity(intent); } public void onEditName() { From e0c1396f4cb07688f3e9ef08c0a5cfa810f7a728 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 6 Jun 2020 18:40:35 +0200 Subject: [PATCH 2/5] streamline wording we have already the string menu_group_name_and_image to be used as an 'edit' button label. the string 'edit' is ommitted to keep things a bit shorter. if we like, we can change that string, however, maybe things are just fine :) --- res/values/strings.xml | 1 - src/org/thoughtcrime/securesms/GroupCreateActivity.java | 2 +- src/org/thoughtcrime/securesms/ProfileActivity.java | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b712a0251..e2c2f8630 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -168,7 +168,6 @@ Select all Expand Edit name - Edit group name and image Edit group name Edit group image Settings diff --git a/src/org/thoughtcrime/securesms/GroupCreateActivity.java b/src/org/thoughtcrime/securesms/GroupCreateActivity.java index a9b88782e..7f8e44d44 100644 --- a/src/org/thoughtcrime/securesms/GroupCreateActivity.java +++ b/src/org/thoughtcrime/securesms/GroupCreateActivity.java @@ -126,7 +126,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity String title; if(isEdit()) { - title = getString(R.string.menu_edit_group); + title = getString(R.string.menu_group_name_and_image); } else if(verified) { title = getString(R.string.menu_new_verified_group); diff --git a/src/org/thoughtcrime/securesms/ProfileActivity.java b/src/org/thoughtcrime/securesms/ProfileActivity.java index da4272ddc..b18c31448 100644 --- a/src/org/thoughtcrime/securesms/ProfileActivity.java +++ b/src/org/thoughtcrime/securesms/ProfileActivity.java @@ -118,7 +118,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity if (chatId != 0) { inflater.inflate(R.menu.profile_chat, menu); if (chatIsGroup) { - menu.findItem(R.id.edit_name).setTitle(R.string.menu_edit_group_name_and_image); + menu.findItem(R.id.edit_name).setTitle(R.string.menu_group_name_and_image); } } From 9bf2b8dfb319cf2d9eb2414e1a33f379c4578493 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 6 Jun 2020 19:47:05 +0200 Subject: [PATCH 3/5] streamline title, add 'edit' button to the preview to allow the same flow as before (edit on click on group-avatar) --- res/menu/media_preview.xml | 4 +++ .../securesms/MediaPreviewActivity.java | 26 +++++++++++++++++++ .../securesms/ProfileActivity.java | 2 ++ 3 files changed, 32 insertions(+) diff --git a/res/menu/media_preview.xml b/res/menu/media_preview.xml index 01914cd1e..85fc317a8 100644 --- a/res/menu/media_preview.xml +++ b/res/menu/media_preview.xml @@ -1,6 +1,10 @@ + Date: Sat, 6 Jun 2020 19:56:49 +0200 Subject: [PATCH 4/5] revert GlideApp change introduced in #1392 for no obvious reason --- src/org/thoughtcrime/securesms/CreateProfileActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/CreateProfileActivity.java b/src/org/thoughtcrime/securesms/CreateProfileActivity.java index fedd1daef..9dd9faf3b 100644 --- a/src/org/thoughtcrime/securesms/CreateProfileActivity.java +++ b/src/org/thoughtcrime/securesms/CreateProfileActivity.java @@ -213,7 +213,7 @@ public class CreateProfileActivity extends BaseActionBarActivity { protected void onPostExecute(byte[] result) { if (result != null) { avatarBytes = result; - GlideApp.with(getApplicationContext()) + GlideApp.with(CreateProfileActivity.this) .load(avatarBytes) .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE) From 40cad4ec4b2c35612c098220d3b98aa1d48b6778 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 6 Jun 2020 19:59:14 +0200 Subject: [PATCH 5/5] also enlarge avatar by clicking on activity-title --- src/org/thoughtcrime/securesms/ProfileActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/ProfileActivity.java b/src/org/thoughtcrime/securesms/ProfileActivity.java index 3d41201e2..fcd948413 100644 --- a/src/org/thoughtcrime/securesms/ProfileActivity.java +++ b/src/org/thoughtcrime/securesms/ProfileActivity.java @@ -98,7 +98,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity titleView = (ConversationTitleView) supportActionBar.getCustomView(); titleView.setOnBackClickedListener(view -> onBackPressed()); - titleView.setOnAvatarClickListener(view -> onEnlargeAvatar()); + titleView.setOnClickListener(view -> onEnlargeAvatar()); updateToolbar();