aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcmp <camporter1@gmail.com>2022-11-03 02:00:25 +0000
committerGitHub <noreply@github.com>2022-11-03 02:00:25 +0000
commit15b979d3bac19e87e12f6beaf5bae88f2f8f0480 (patch)
tree8986ba876beb3435c6f9acc099abeace5cb96771
parent72c66e7e4e19200f5cdd470fa101a4c826ab950b (diff)
downloadinfinity-for-reddit-15b979d3bac19e87e12f6beaf5bae88f2f8f0480.tar
infinity-for-reddit-15b979d3bac19e87e12f6beaf5bae88f2f8f0480.tar.gz
infinity-for-reddit-15b979d3bac19e87e12f6beaf5bae88f2f8f0480.tar.bz2
infinity-for-reddit-15b979d3bac19e87e12f6beaf5bae88f2f8f0480.tar.lz
infinity-for-reddit-15b979d3bac19e87e12f6beaf5bae88f2f8f0480.tar.xz
infinity-for-reddit-15b979d3bac19e87e12f6beaf5bae88f2f8f0480.tar.zst
infinity-for-reddit-15b979d3bac19e87e12f6beaf5bae88f2f8f0480.zip
Add some contrast to subreddit and user toolbars. (#1170)
Add a gradient from the primary theme color to transparent so that if a subreddit or user profile has a very light background, the usually light text and buttons are not obscured or in some cases invisible. The gradients don't appear for immersive mode so that the app remains immersive.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java
index 5b5e74e0..e40128df 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java
@@ -12,6 +12,7 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Typeface;
+import android.graphics.drawable.GradientDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
@@ -314,6 +315,10 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo
}
if (setToolbarBackgroundColor) {
toolbar.setBackgroundColor(customThemeWrapper.getColorPrimary());
+ } else if (!isImmersiveInterface()) {
+ int[] colors = {customThemeWrapper.getColorPrimary(), Color.TRANSPARENT};
+ GradientDrawable gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colors);
+ toolbar.setBackground(gradientDrawable);
}
toolbar.setTitleTextColor(customThemeWrapper.getToolbarPrimaryTextAndIconColor());
toolbar.setSubtitleTextColor(customThemeWrapper.getToolbarSecondaryTextColor());