aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2022-08-14 07:47:57 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2022-08-14 07:47:57 +0000
commit275063684779a02efe7ec8ef971bb219b1f4fd33 (patch)
treebb2ed692f7dc49231d50881be78d7742df63098c /app/src/main
parent7a0a40f696cd05892a42fe5eb2985ee5fdd6f09c (diff)
downloadinfinity-for-reddit-275063684779a02efe7ec8ef971bb219b1f4fd33.tar
infinity-for-reddit-275063684779a02efe7ec8ef971bb219b1f4fd33.tar.gz
infinity-for-reddit-275063684779a02efe7ec8ef971bb219b1f4fd33.tar.bz2
infinity-for-reddit-275063684779a02efe7ec8ef971bb219b1f4fd33.tar.lz
infinity-for-reddit-275063684779a02efe7ec8ef971bb219b1f4fd33.tar.xz
infinity-for-reddit-275063684779a02efe7ec8ef971bb219b1f4fd33.tar.zst
infinity-for-reddit-275063684779a02efe7ec8ef971bb219b1f4fd33.zip
Apply custom theme to the header of the navigation drawer.
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java4
-rw-r--r--app/src/main/res/drawable/side_nav_bar.xml9
-rw-r--r--app/src/main/res/layout/nav_header_main.xml6
4 files changed, 14 insertions, 16 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java
index efc4ecc0..55989855 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java
@@ -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);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java
index f3159f93..923af7eb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/NavigationDrawerRecyclerViewMergedAdapter.java
@@ -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() {
diff --git a/app/src/main/res/drawable/side_nav_bar.xml b/app/src/main/res/drawable/side_nav_bar.xml
deleted file mode 100644
index 378cf16f..00000000
--- a/app/src/main/res/drawable/side_nav_bar.xml
+++ /dev/null
@@ -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> \ No newline at end of file
diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml
index 2b30f55a..6619f129 100644
--- a/app/src/main/res/layout/nav_header_main.xml
+++ b/app/src/main/res/layout/nav_header_main.xml
@@ -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"