mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 19:38:22 +01:00
Apply custom theme to the header of the navigation drawer.
This commit is contained in:
parent
7a0a40f696
commit
2750636847
@ -29,11 +29,13 @@ import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
|
||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
|
||||
public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private BaseActivity baseActivity;
|
||||
private CustomThemeWrapper customThemeWrapper;
|
||||
private Resources resources;
|
||||
private RequestManager glide;
|
||||
private String accountName;
|
||||
@ -46,12 +48,14 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
|
||||
private boolean isInMainPage = true;
|
||||
private PageToggle pageToggle;
|
||||
|
||||
public HeaderSectionRecyclerViewAdapter(BaseActivity baseActivity, RequestManager glide, String accountName,
|
||||
public HeaderSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper,
|
||||
RequestManager glide, String accountName,
|
||||
SharedPreferences sharedPreferences,
|
||||
SharedPreferences navigationDrawerSharedPreferences,
|
||||
SharedPreferences securitySharedPreferences,
|
||||
PageToggle pageToggle) {
|
||||
this.baseActivity = baseActivity;
|
||||
this.customThemeWrapper = customThemeWrapper;
|
||||
resources = baseActivity.getResources();
|
||||
this.glide = glide;
|
||||
this.accountName = accountName;
|
||||
@ -206,6 +210,11 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc
|
||||
accountNameTextView.setTypeface(baseActivity.typeface);
|
||||
karmaTextView.setTypeface(baseActivity.typeface);
|
||||
}
|
||||
|
||||
itemView.setBackgroundColor(customThemeWrapper.getColorPrimary());
|
||||
accountNameTextView.setTextColor(customThemeWrapper.getToolbarPrimaryTextAndIconColor());
|
||||
karmaTextView.setTextColor(customThemeWrapper.getToolbarSecondaryTextColor());
|
||||
dropIconImageView.setColorFilter(customThemeWrapper.getToolbarPrimaryTextAndIconColor(), android.graphics.PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,8 @@ public class NavigationDrawerRecyclerViewMergedAdapter {
|
||||
ItemClickListener itemClickListener) {
|
||||
RequestManager glide = Glide.with(baseActivity);
|
||||
|
||||
headerSectionRecyclerViewAdapter = new HeaderSectionRecyclerViewAdapter(baseActivity, glide, accountName,
|
||||
sharedPreferences, navigationDrawerSharedPreferences, securitySharedPreferences,
|
||||
headerSectionRecyclerViewAdapter = new HeaderSectionRecyclerViewAdapter(baseActivity, customThemeWrapper,
|
||||
glide, accountName, sharedPreferences, navigationDrawerSharedPreferences, securitySharedPreferences,
|
||||
new HeaderSectionRecyclerViewAdapter.PageToggle() {
|
||||
@Override
|
||||
public void openAccountSection() {
|
||||
|
@ -1,9 +0,0 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:centerColor="#0336FF"
|
||||
android:endColor="#002BF0"
|
||||
android:startColor="#5954FF"
|
||||
android:type="linear" />
|
||||
</shape>
|
@ -2,7 +2,6 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:background="@drawable/side_nav_bar"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||
@ -11,7 +10,7 @@
|
||||
android:id="@+id/banner_image_view_nav_header_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"/>
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/profile_image_view_nav_header_main"
|
||||
@ -20,7 +19,7 @@
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"/>
|
||||
android:layout_marginEnd="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name_text_view_nav_header_main"
|
||||
@ -30,7 +29,6 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:layout_below="@id/profile_image_view_nav_header_main"
|
||||
|
Loading…
Reference in New Issue
Block a user