From 8aad0fd2648fd436146b4bc63ae89989cacb86c7 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 8 Jun 2022 09:41:32 +0200 Subject: [PATCH] Fix banner not cropped in main menu --- .../app/fedilab/android/BaseMainActivity.java | 16 ++-------------- app/src/main/res/layout/nav_header_main.xml | 10 +++++++--- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/BaseMainActivity.java index 26f340980..0c9f6cae1 100644 --- a/app/src/main/java/app/fedilab/android/BaseMainActivity.java +++ b/app/src/main/java/app/fedilab/android/BaseMainActivity.java @@ -112,6 +112,7 @@ import app.fedilab.android.databinding.ActivityMainBinding; import app.fedilab.android.databinding.NavHeaderMainBinding; import app.fedilab.android.exception.DBException; import app.fedilab.android.helper.Helper; +import app.fedilab.android.helper.MastodonHelper; import app.fedilab.android.helper.PinnedTimelineHelper; import app.fedilab.android.helper.PushHelper; import app.fedilab.android.helper.ThemeHelper; @@ -652,20 +653,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt } headerMainBinding.accountName.setText(account.mastodon_account.display_name); Helper.loadPP(headerMainBinding.accountProfilePicture, account); - Glide.with(BaseMainActivity.this) - .load(account.mastodon_account.header) - .apply(new RequestOptions().transform(new CenterCrop())) - .into(new CustomTarget() { - @Override - public void onResourceReady(@NonNull Drawable resource, @Nullable Transition transition) { - headerMainBinding.backGroundImage.setBackground(resource); - } - - @Override - public void onLoadCleared(@Nullable Drawable placeholder) { - - } - }); + MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, account.mastodon_account, MastodonHelper.MediaAccountType.HEADER); /* * Some general data are loaded when the app starts such; * - Instance info (for limits) diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml index 67209766e..276a84b38 100644 --- a/app/src/main/res/layout/nav_header_main.xml +++ b/app/src/main/res/layout/nav_header_main.xml @@ -5,8 +5,6 @@ android:layout_height="@dimen/nav_header_height" android:theme="@style/ThemeOverlay.AppCompat.Dark"> - - + +