mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-07-14 21:15:26 +02:00
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.
This commit is contained in:
@ -12,6 +12,7 @@ import android.content.res.Configuration;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -314,6 +315,10 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo
|
|||||||
}
|
}
|
||||||
if (setToolbarBackgroundColor) {
|
if (setToolbarBackgroundColor) {
|
||||||
toolbar.setBackgroundColor(customThemeWrapper.getColorPrimary());
|
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.setTitleTextColor(customThemeWrapper.getToolbarPrimaryTextAndIconColor());
|
||||||
toolbar.setSubtitleTextColor(customThemeWrapper.getToolbarSecondaryTextColor());
|
toolbar.setSubtitleTextColor(customThemeWrapper.getToolbarSecondaryTextColor());
|
||||||
|
Reference in New Issue
Block a user