Fix banner not cropped in main menu

This commit is contained in:
Thomas 2022-06-08 09:41:32 +02:00
parent b96996ddde
commit 8aad0fd264
2 changed files with 9 additions and 17 deletions

View File

@ -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<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> 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)

View File

@ -5,8 +5,6 @@
android:layout_height="@dimen/nav_header_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/header_option_info"
android:layout_width="wrap_content"
@ -19,8 +17,14 @@
android:src="@drawable/ic_baseline_more_vert_24"
app:tint="?iconColor" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/background_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="@dimen/nav_header_height"
android:scaleType="centerCrop" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/back_ground_image"
android:layout_width="match_parent"
android:layout_height="180dp"
android:background="@color/transparent"