From e8853a4329f7d85ec11d0424e14c2c3217f42e92 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 17 Jun 2020 11:50:18 +0200 Subject: [PATCH] Revert "fixes #466. Setting the background image provides for a image that is sufficiently large to fit portrait and landscape orientations. When displayed the shorter side is scaled to fit, the larger is then centered and cropped." This reverts commit 16f5c6d88983ae381a4ba7387efb6136f966dd6c. --- res/layout/conversation_activity.xml | 12 +++--------- .../thoughtcrime/securesms/ConversationActivity.java | 8 +++----- .../preferences/ChatBackgroundActivity.java | 6 ++---- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/res/layout/conversation_activity.xml b/res/layout/conversation_activity.xml index 106b79d17..44a0e9089 100644 --- a/res/layout/conversation_activity.xml +++ b/res/layout/conversation_activity.xml @@ -1,16 +1,10 @@ - - - diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index c5fcc9db8..df0ec67b7 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -176,7 +176,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity private InputAwareLayout container; private View composePanel; protected Stub reminderView; - private ImageView backgroundView; private AttachmentTypeSelector attachmentTypeSelector; private AttachmentManager attachmentManager; @@ -801,7 +800,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity quickAttachmentDrawer = ViewUtil.findById(this, R.id.quick_attachment_drawer); quickAttachmentToggle = ViewUtil.findById(this, R.id.quick_attachment_toggle); inputPanel = ViewUtil.findById(this, R.id.bottom_panel); - backgroundView = ViewUtil.findById(this, R.id.conversation_background); ImageButton quickCameraToggle = ViewUtil.findById(this, R.id.quick_camera_toggle); @@ -846,13 +844,13 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity String backgroundImagePath = Prefs.getBackgroundImagePath(this); if(!backgroundImagePath.isEmpty()) { Drawable image = Drawable.createFromPath(backgroundImagePath); - backgroundView.setImageDrawable(image); + getWindow().setBackgroundDrawable(image); } else if(dynamicTheme.isDarkTheme(this)) { - backgroundView.setImageResource(R.drawable.background_hd_dark); + getWindow().setBackgroundDrawableResource(R.drawable.background_hd_dark); } else { - backgroundView.setImageResource(R.drawable.background_hd); + getWindow().setBackgroundDrawableResource(R.drawable.background_hd); } } diff --git a/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java b/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java index b0aa6fa50..29fc5b06f 100644 --- a/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java +++ b/src/org/thoughtcrime/securesms/preferences/ChatBackgroundActivity.java @@ -136,15 +136,13 @@ public class ChatBackgroundActivity extends PassphraseRequiredActionBarActivity Display display = ServiceUtil.getWindowManager(context).getDefaultDisplay(); Point size = new Point(); display.getSize(size); - // resize so that the larger side fits the screen accurately - int largerSide = (size.x > size.y ? size.x : size.y); Bitmap scaledBitmap = GlideApp.with(context) .asBitmap() .load(imageUri) - .fitCenter() + .centerCrop() .skipMemoryCache(true) .diskCacheStrategy(DiskCacheStrategy.NONE) - .submit(largerSide, largerSide) + .submit(size.x, size.y) .get(); FileOutputStream outStream = new FileOutputStream(destinationPath); scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 85, outStream);