Fix issue #122 - Add banner in main menu

This commit is contained in:
Thomas 2022-06-03 19:04:15 +02:00
parent 0ab394c64f
commit 132f48fbef
2 changed files with 17 additions and 9 deletions

View File

@ -477,6 +477,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
headerMenuOpen = false; headerMenuOpen = false;
} }
}); });
headerMainBinding.headerOptionInfo.setOnClickListener(v -> { headerMainBinding.headerOptionInfo.setOnClickListener(v -> {
PopupMenu popup = new PopupMenu(new ContextThemeWrapper(BaseMainActivity.this, Helper.popupStyle()), headerMainBinding.headerOptionInfo); PopupMenu popup = new PopupMenu(new ContextThemeWrapper(BaseMainActivity.this, Helper.popupStyle()), headerMainBinding.headerOptionInfo);
popup.getMenuInflater() popup.getMenuInflater()
@ -648,9 +649,20 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
account.mastodon_account.display_name = account.mastodon_account.acct; account.mastodon_account.display_name = account.mastodon_account.acct;
} }
headerMainBinding.accountName.setText(account.mastodon_account.display_name); headerMainBinding.accountName.setText(account.mastodon_account.display_name);
Helper.loadPP(headerMainBinding.accountProfilePicture, account); Helper.loadPP(headerMainBinding.accountProfilePicture, account);
Glide.with(BaseMainActivity.this)
.load(account.mastodon_account.header)
.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) {
}
});
/* /*
* Some general data are loaded when the app starts such; * Some general data are loaded when the app starts such;
* - Instance info (for limits) * - Instance info (for limits)

View File

@ -5,13 +5,7 @@
android:layout_height="@dimen/nav_header_height" android:layout_height="@dimen/nav_header_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark"> android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/back_ground_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:contentDescription="@string/profile_banner"
android:scaleType="fitCenter" />
<ImageView <ImageView
android:id="@+id/header_option_info" android:id="@+id/header_option_info"
@ -28,6 +22,8 @@
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/back_ground_image"
android:background="@color/transparent"
android:gravity="bottom" android:gravity="bottom"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingLeft="@dimen/activity_horizontal_margin"
@ -40,6 +36,7 @@
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:scaleType="fitCenter"
android:contentDescription="@string/profile_picture" android:contentDescription="@string/profile_picture"
android:paddingTop="@dimen/nav_header_vertical_spacing" /> android:paddingTop="@dimen/nav_header_vertical_spacing" />
@ -102,5 +99,4 @@
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
</RelativeLayout> </RelativeLayout>