From 9a948a590ff64c25e1888b6f89e0c436ead1e411 Mon Sep 17 00:00:00 2001 From: Forrest Guice Date: Thu, 18 Mar 2021 10:21:16 -0700 Subject: [PATCH] applyTheme applies theme text settings to app views (#492) --- .../suntimeswidget/EquinoxView.java | 38 +++++++++++++++---- .../suntimeswidget/LightMapDialog.java | 30 ++++++++++++++- .../suntimeswidget/MoonDialog.java | 11 +++++- .../suntimeswidget/MoonPhaseView.java | 16 +++++++- .../suntimeswidget/MoonPhasesView1.java | 28 ++++++++++++-- .../suntimeswidget/MoonRiseSetView.java | 6 ++- .../suntimeswidget/SuntimesActivity.java | 26 ++++++++++++- .../suntimeswidget/cards/CardViewHolder.java | 30 ++++++++++++++- .../suntimeswidget/map/WorldMapDialog.java | 9 ++++- .../suntimeswidget/views/MoonApsisView.java | 33 ++++++++++++++-- 10 files changed, 204 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/EquinoxView.java b/app/src/main/java/com/forrestguice/suntimeswidget/EquinoxView.java index 381ae2f3d..03da68110 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/EquinoxView.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/EquinoxView.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2017-2019 Forrest Guice + Copyright (C) 2017-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -25,6 +25,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v4.widget.ImageViewCompat; import android.support.v7.widget.PagerSnapHelper; @@ -377,7 +378,7 @@ public void adjustLabelWidth( int labelWidthPx ) labelView.setLayoutParams(layoutParams); } - public void themeViews(Integer labelColor, Integer timeColor, Integer textColor) + public void themeViews(@Nullable Integer labelColor, @Nullable Integer timeColor, @Nullable Integer textColor, @Nullable Float textSizeSp, @Nullable Float titleSizeSp, boolean titleBold) { if (labelColor != null) { labelView.setTextColor(SuntimesUtils.colorStateList(labelColor, options.disabledColor)); @@ -390,6 +391,16 @@ public void themeViews(Integer labelColor, Integer timeColor, Integer textColor) if (textColor != null) { noteView.setTextColor(SuntimesUtils.colorStateList(textColor, options.disabledColor)); } //else Log.w("EquinoxView", "themeViews: null color, ignoring..."); + + if (textSizeSp != null) { + noteView.setTextSize(textSizeSp); + timeView.setTextSize(textSizeSp); + } //else Log.w("EquinoxView", "themeViews: null color, ignoring..."); + + if (titleSizeSp != null) { + labelView.setTextSize(titleSizeSp); + labelView.setTypeface(labelView.getTypeface(), (titleBold ? Typeface.BOLD : Typeface.NORMAL)); + } //else Log.w("EquinoxView", "themeViews: null color, ignoring..."); } public void updateDate( Context context, Calendar time ) @@ -774,7 +785,7 @@ private EquinoxNote addNote(TextView labelView, TextView timeView, TextView note { EquinoxNote note = new EquinoxNote(labelView, timeView, noteView, pageIndex, options); if (timeColor != null) { - note.themeViews(options.labelColor, timeColor, options.textColor); + note.themeViews(options.labelColor, timeColor, options.textColor, options.timeSizeSp, options.titleSizeSp, options.titleBold); } notes.add(note); return note; @@ -890,14 +901,19 @@ public void applyTheme(SuntimesTheme theme, EquinoxViewOptions options) public void themeViews( EquinoxViewOptions options, int position ) { title.setTextColor(SuntimesUtils.colorStateList((position < EquinoxViewAdapter.CENTER_POSITION ? options.disabledColor : options.titleColor), options.disabledColor, options.pressedColor)); + if (options.titleSizeSp != null) + { + title.setTextSize(options.titleSizeSp); + title.setTypeface(title.getTypeface(), (options.titleBold ? Typeface.BOLD : Typeface.NORMAL)); + } ImageViewCompat.setImageTintList(btn_flipperNext, SuntimesUtils.colorStateList(options.titleColor, options.disabledColor, options.pressedColor)); ImageViewCompat.setImageTintList(btn_flipperPrev, SuntimesUtils.colorStateList(options.titleColor, options.disabledColor, options.pressedColor)); - note_equinox_vernal.themeViews(options.labelColor, options.seasonColors[0], options.textColor); - note_solstice_summer.themeViews(options.labelColor, options.seasonColors[1], options.textColor); - note_equinox_autumnal.themeViews(options.labelColor, options.seasonColors[2], options.textColor); - note_solstice_winter.themeViews(options.labelColor, options.seasonColors[3], options.textColor); + note_equinox_vernal.themeViews(options.labelColor, options.seasonColors[0], options.textColor, options.timeSizeSp, options.titleSizeSp, options.titleBold); + note_solstice_summer.themeViews(options.labelColor, options.seasonColors[1], options.textColor, options.timeSizeSp, options.titleSizeSp, options.titleBold); + note_equinox_autumnal.themeViews(options.labelColor, options.seasonColors[2], options.textColor, options.timeSizeSp, options.titleSizeSp, options.titleBold); + note_solstice_winter.themeViews(options.labelColor, options.seasonColors[3], options.textColor, options.timeSizeSp, options.titleSizeSp, options.titleBold); } } @@ -919,6 +935,10 @@ public static class EquinoxViewOptions public Integer labelColor, textColor; public int resID_buttonPressColor; + public Float timeSizeSp = null; + public Float titleSizeSp = null; + public boolean titleBold = false; + private SuntimesTheme themeOverride = null; @SuppressLint("ResourceType") @@ -932,6 +952,7 @@ public void init(Context context) resID_buttonPressColor = typedArray.getResourceId(2, R.color.btn_tint_pressed_dark); pressedColor = ContextCompat.getColor(context, resID_buttonPressColor); labelColor = textColor = seasonColors[0] = seasonColors[1] = seasonColors[2] = seasonColors[3] = null; + titleSizeSp = timeSizeSp = null; typedArray.recycle(); } @@ -948,6 +969,9 @@ public void init(SuntimesTheme theme) seasonColors[1] = theme.getSummerColor(); seasonColors[2] = theme.getFallColor(); seasonColors[3] = theme.getWinterColor(); + timeSizeSp = theme.getTimeSizeSp(); + titleSizeSp = theme.getTitleSizeSp(); + titleBold = theme.getTitleBold(); } } } diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/LightMapDialog.java b/app/src/main/java/com/forrestguice/suntimeswidget/LightMapDialog.java index 5ab294fb8..7aedab404 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/LightMapDialog.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/LightMapDialog.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2017-2020 Forrest Guice + Copyright (C) 2017-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -362,9 +362,20 @@ public void themeViews(Context context) } else { int titleColor = themeOverride.getTitleColor(); + float textSizeSp = themeOverride.getTextSizeSp(); + float titleSizeSp = themeOverride.getTitleSizeSp(); + float timeSizeSp = themeOverride.getTimeSizeSp(); + float suffixSizeSp = themeOverride.getTimeSuffixSizeSp(); + dialogTitle.setTextColor(titleColor); + dialogTitle.setTextSize(titleSizeSp); + dialogTitle.setTypeface(dialogTitle.getTypeface(), (themeOverride.getTitleBold() ? Typeface.BOLD : Typeface.NORMAL)); + sunElevationLabel.setTextColor(titleColor); + sunElevationLabel.setTextSize(suffixSizeSp); + sunAzimuthLabel.setTextColor(titleColor); + sunAzimuthLabel.setTextSize(suffixSizeSp); lightmap.themeViews(context, themeOverride); colorNight = themeOverride.getNightColor(); @@ -382,11 +393,25 @@ public void themeViews(Context context) field_night.themeViews(themeOverride); sunAzimuth.setTextColor(themeOverride.getTimeColor()); + sunAzimuth.setTextSize(timeSizeSp); + sunAzimuthRising.setTextSize(timeSizeSp); + sunAzimuthSetting.setTextSize(timeSizeSp); + sunElevation.setTextColor(themeOverride.getTimeColor()); + sunElevation.setTextSize(timeSizeSp); + sunElevationAtNoon.setTextSize(timeSizeSp); + sunAzimuthAtNoon.setTextColor(themeOverride.getTimeColor()); + sunAzimuthAtNoon.setTextSize(timeSizeSp); + sunShadowObj.setTextColor(themeOverride.getTitleColor()); + sunShadowObj.setTextSize(timeSizeSp); + sunShadowLength.setTextColor(themeOverride.getTimeColor()); + sunShadowLength.setTextSize(timeSizeSp); + sunShadowLengthAtNoon.setTextColor(themeOverride.getSunsetTextColor()); + sunShadowLengthAtNoon.setTextSize(timeSizeSp); SuntimesUtils.tintDrawable((InsetDrawable)riseIcon.getBackground(), themeOverride.getSunriseIconColor(), themeOverride.getSunriseIconStrokeColor(), themeOverride.getSunriseIconStrokePixels(context)); SuntimesUtils.tintDrawable((InsetDrawable)setIcon.getBackground(), themeOverride.getSunsetIconColor(), themeOverride.getSunsetIconStrokeColor(), themeOverride.getSunsetIconStrokePixels(context)); @@ -644,7 +669,10 @@ public void themeViews(SuntimesTheme theme) if (theme != null) { label.setTextColor(theme.getTextColor()); + label.setTextSize(theme.getTextSizeSp()); text.setTextColor(theme.getTimeColor()); + text.setTextSize(theme.getTimeSizeSp()); + text.setTypeface(text.getTypeface(), (theme.getTimeBold() ? Typeface.BOLD : Typeface.NORMAL)); } } diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/MoonDialog.java b/app/src/main/java/com/forrestguice/suntimeswidget/MoonDialog.java index b22384e94..74609bc3a 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/MoonDialog.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/MoonDialog.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2018-2019 Forrest Guice + Copyright (C) 2018-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -24,6 +24,7 @@ import android.content.DialogInterface; import android.content.res.TypedArray; import android.graphics.Rect; +import android.graphics.Typeface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -187,14 +188,22 @@ public void themeViews(Context context) setColor = themeOverride.getMoonsetTextColor(); dialogTitle.setTextColor(titleColor); + dialogTitle.setTextSize(themeOverride.getTitleSizeSp()); + dialogTitle.setTypeface(dialogTitle.getTypeface(), (themeOverride.getTitleBold() ? Typeface.BOLD : Typeface.NORMAL)); + moonriseset.themeViews(context, themeOverride); currentphase.themeViews(context, themeOverride); moonphases.themeViews(context, themeOverride); moonapsis.themeViews(context, themeOverride); moondistance_label.setTextColor(titleColor); + moondistance_label.setTextSize(themeOverride.getTitleSizeSp()); + moondistance.setTextColor(textColor); + moondistance.setTextSize(themeOverride.getTimeSuffixSizeSp()); + moondistance_note.setTextColor(timeColor); + moondistance_note.setTextSize(themeOverride.getTextSizeSp()); } else { int[] colorAttrs = { android.R.attr.textColorPrimary, R.attr.moonriseColor, R.attr.moonsetColor }; diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/MoonPhaseView.java b/app/src/main/java/com/forrestguice/suntimeswidget/MoonPhaseView.java index 8e7d2727b..b0816a2d0 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/MoonPhaseView.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/MoonPhaseView.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2018-2019 Forrest Guice + Copyright (C) 2018-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; +import android.graphics.Typeface; import android.support.v4.content.ContextCompat; import android.text.SpannableString; import android.util.AttributeSet; @@ -115,11 +116,22 @@ public void themeViews(Context context, SuntimesTheme theme) { noteColor = theme.getTimeColor(); int textColor = theme.getTextColor(); + int timeColor = theme.getTimeColor(); + float suffixSizeSp = theme.getTimeSuffixSizeSp(); + float timeSizeSp = theme.getTimeSizeSp(); illumText.setTextColor(textColor); + illumText.setTextSize(suffixSizeSp); + azimuthText.setTextColor(textColor); + azimuthText.setTextSize(suffixSizeSp); + elevationText.setTextColor(textColor); - phaseText.setTextColor(theme.getTimeColor()); + elevationText.setTextSize(suffixSizeSp); + + phaseText.setTextColor(timeColor); + phaseText.setTextSize(timeSizeSp); + phaseText.setTypeface(phaseText.getTypeface(), (theme.getTimeBold() ? Typeface.BOLD : Typeface.NORMAL)); int[] viewID = getIconViewIDs(); Bitmap[] bitmaps = getThemedBitmaps(context, theme); diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/MoonPhasesView1.java b/app/src/main/java/com/forrestguice/suntimeswidget/MoonPhasesView1.java index 657392318..e4dd23042 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/MoonPhasesView1.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/MoonPhasesView1.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2018-2019 Forrest Guice + Copyright (C) 2018-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -23,7 +23,9 @@ import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Color; +import android.graphics.Typeface; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v4.graphics.ColorUtils; import android.support.v4.widget.ImageViewCompat; @@ -279,6 +281,8 @@ public static class PhaseAdapter extends RecyclerView.Adapter private int colorNote, colorTitle, colorTime, colorText, colorWaxing, colorWaning, colorFull, colorNew, colorDisabled; private float strokePixelsNew, strokePixelsFull; + private Float spTime = null, spText = null, spTitle = null, spSuffix = null; + private boolean boldTime, boldTitle; public PhaseAdapter(Context context) { contextRef = new WeakReference<>(context); @@ -420,6 +424,12 @@ protected void applyTheme(Context context, SuntimesTheme theme) colorNew = theme.getMoonNewColor(); strokePixelsNew = theme.getMoonNewStrokePixels(context); strokePixelsFull = theme.getMoonFullStrokePixels(context); + spTime = theme.getTimeSizeSp(); + spText = theme.getTextSizeSp(); + spTitle = theme.getTitleSizeSp(); + spSuffix = theme.getTimeSuffixSizeSp(); + boldTitle = theme.getTitleBold(); + boldTime = theme.getTimeBold(); } protected void themeViews(Context context, @NonNull PhaseField holder, boolean isAgo) @@ -438,7 +448,7 @@ protected void themeViews(Context context, @NonNull PhaseField holder, boolean i int titleColor = isAgo ? colorDisabled : colorTitle; int timeColor = isAgo ? colorDisabled : colorTime; int textColor = isAgo ? colorDisabled : colorText; - holder.themeViews(titleColor, timeColor, textColor, bitmap); + holder.themeViews(titleColor, spTitle, boldTitle, timeColor, spTime, boldTime, textColor, bitmap); } } @@ -525,11 +535,23 @@ public void bindDataToPosition(Context context, SuntimesMoonData1 data, Suntimes setLabel(phaseLabel); } - public void themeViews(int labelColor, int timeColor, int textColor, @NonNull Bitmap bitmap) + public void themeViews(int labelColor, @Nullable Float labelSizeSp, boolean labelBold, int timeColor, @Nullable Float timeSizeSp, boolean timeBold, int textColor, @NonNull Bitmap bitmap) { label.setTextColor(labelColor); + if (labelSizeSp != null) { + label.setTextSize(labelSizeSp); + label.setTypeface(label.getTypeface(), (labelBold ? Typeface.BOLD : Typeface.NORMAL)); + } + field.setTextColor(timeColor); note.setTextColor(textColor); + + if (timeSizeSp != null) { + note.setTextSize(timeSizeSp); + field.setTextSize(timeSizeSp); + field.setTypeface(field.getTypeface(), (timeBold ? Typeface.BOLD : Typeface.NORMAL)); + } + icon.setImageBitmap(bitmap); } diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/MoonRiseSetView.java b/app/src/main/java/com/forrestguice/suntimeswidget/MoonRiseSetView.java index fb2452c0e..84ff758ac 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/MoonRiseSetView.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/MoonRiseSetView.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2018 Forrest Guice + Copyright (C) 2018-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -19,6 +19,7 @@ import android.content.Context; import android.content.res.TypedArray; +import android.graphics.Typeface; import android.graphics.drawable.LayerDrawable; import android.os.Build; import android.support.annotation.NonNull; @@ -431,7 +432,10 @@ public void themeView(SuntimesTheme theme) { int color = (rising ? theme.getMoonriseTextColor() : theme.getMoonsetTextColor()); timeView.setTextColor(color); + timeView.setTextSize(theme.getTimeSizeSp()); + timeView.setTypeface(timeView.getTypeface(), theme.getTimeBold() ? Typeface.BOLD : Typeface.NORMAL); positionView.setTextColor(color); + positionView.setTextSize(theme.getTimeSuffixSizeSp()); SuntimesUtils.tintDrawable((LayerDrawable)iconView.getBackground(), color, color, 0); } diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/SuntimesActivity.java b/app/src/main/java/com/forrestguice/suntimeswidget/SuntimesActivity.java index c00ab77b5..ae1dbfb59 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/SuntimesActivity.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/SuntimesActivity.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2014-2019 Forrest Guice + Copyright (C) 2014-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -33,6 +33,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; +import android.graphics.Typeface; import android.location.Location; import android.net.Uri; import android.os.Build; @@ -776,6 +777,10 @@ protected void themeViews(Context context) int textColor = appThemeOverride.getTextColor(); int disabledColor = ContextCompat.getColor(context, resID_buttonDisabledColor); int pressedColor = appThemeOverride.getActionColor(); + float suffixSizeSp = appThemeOverride.getTimeSuffixSizeSp(); + float textSizeSp = appThemeOverride.getTextSizeSp(); + float titleSizeSp = appThemeOverride.getTitleSizeSp(); + boolean titleBold = appThemeOverride.getTitleBold(); Toolbar actionBar = (Toolbar) findViewById(R.id.app_menubar); actionBar.setTitleTextColor(titleColor); @@ -783,15 +788,32 @@ protected void themeViews(Context context) txt_time.setTextColor(timeColor); txt_time_suffix.setTextColor(timeColor); + txt_timezone.setTextColor(SuntimesUtils.colorStateList(textColor, disabledColor, pressedColor)); + txt_timezone.setTextSize(suffixSizeSp); txt_time1_note1.setTextColor(timeColor); - txt_time1_note2.setTextColor(textColor); + txt_time1_note1.setTextSize(titleSizeSp); + txt_time1_note1.setTypeface(txt_time1_note1.getTypeface(), (titleBold ? Typeface.BOLD : Typeface.NORMAL)); txt_time2_note1.setTextColor(timeColor); + txt_time2_note1.setTextSize(titleSizeSp); + txt_time2_note1.setTypeface(txt_time2_note1.getTypeface(), (titleBold ? Typeface.BOLD : Typeface.NORMAL)); + + txt_time1_note2.setTextColor(textColor); + txt_time1_note2.setTextSize(textSizeSp); txt_time2_note2.setTextColor(textColor); + txt_time2_note2.setTextSize(textSizeSp); + + txt_time1_note3.setTextSize(titleSizeSp); + txt_time1_note3.setTypeface(txt_time1_note3.getTypeface(), (titleBold ? Typeface.BOLD : Typeface.NORMAL)); + txt_time2_note3.setTextSize(titleSizeSp); + txt_time2_note3.setTypeface(txt_time2_note3.getTypeface(), (titleBold ? Typeface.BOLD : Typeface.NORMAL)); txt_datasource.setTextColor(SuntimesUtils.colorStateList(textColor, disabledColor, pressedColor)); + txt_datasource.setTextSize(suffixSizeSp); + txt_altitude.setTextColor(timeColor); + txt_altitude.setTextSize(suffixSizeSp); color_textTimeDelta = appThemeOverride.getTimeColor(); card_adapter.setThemeOverride(appThemeOverride); diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/cards/CardViewHolder.java b/app/src/main/java/com/forrestguice/suntimeswidget/cards/CardViewHolder.java index fa7158154..b386853ad 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/cards/CardViewHolder.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/cards/CardViewHolder.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2019-2020 Forrest Guice + Copyright (C) 2019-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -310,9 +310,17 @@ protected void themeCardViews(Context context, @NonNull SuntimesTheme theme, Car int color_sunrise = theme.getSunriseTextColor(); int color_sunset = theme.getSunsetTextColor(); int color_action = theme.getActionColor(); + float titleSizeSp = theme.getTitleSizeSp(); + float textSizeSp = theme.getTextSizeSp(); + float timeSizeSp = theme.getTimeSizeSp(); + //boolean boldTime = theme.getTimeBold(); + boolean boldTitle = theme.getTitleBold(); txt_daylength.setTextColor(color_text); + txt_daylength.setTextSize(textSizeSp); + txt_lightlength.setTextColor(color_text); + txt_lightlength.setTextSize(textSizeSp); row_actual.getField(0).setTextColor(color_sunrise); row_civil.getField(0).setTextColor(color_sunrise); @@ -332,27 +340,45 @@ protected void themeCardViews(Context context, @NonNull SuntimesTheme theme, Car row_blue4.getField(1).setTextColor(color_sunrise); int labelColor = theme.getTitleColor(); - for (CardViewHolder.TimeFieldRow row : rows) { + for (CardViewHolder.TimeFieldRow row : rows) + { row.label.setTextColor(labelColor); + row.label.setTextSize(titleSizeSp); + row.label.setTypeface(row.label.getTypeface(), (boldTitle ? Typeface.BOLD : Typeface.NORMAL)); + + for (int i=0; i<2; i++) { + if (row.getField(i) != null) { + row.getField(i).setTextSize(timeSizeSp); + //row.getField(i).setTypeface(row.getField(i).getTypeface(), (timeBold ? Typeface.BOLD : Typeface.NORMAL)); + } + } } txt_date.setTextColor(SuntimesUtils.colorStateList(labelColor, options.color_disabled, color_action)); + txt_date.setTextSize(titleSizeSp); + txt_date.setTypeface(txt_date.getTypeface(), (boldTitle ? Typeface.BOLD : Typeface.NORMAL)); int sunriseIconColor = theme.getSunriseIconColor(); int sunriseIconColor2 = theme.getSunriseIconStrokeColor(); int sunriseIconStrokeWidth = theme.getSunriseIconStrokePixels(context); SuntimesUtils.tintDrawable((InsetDrawable)icon_sunrise.getBackground(), sunriseIconColor, sunriseIconColor2, sunriseIconStrokeWidth); header_sunrise.setTextColor(color_sunrise); + header_sunrise.setTextSize(titleSizeSp); + header_sunrise.setTypeface(header_sunrise.getTypeface(), (boldTitle ? Typeface.BOLD : Typeface.NORMAL)); int sunsetIconColor = theme.getSunsetIconColor(); int sunsetIconColor2 = theme.getSunsetIconStrokeColor(); int sunsetIconStrokeWidth = theme.getSunsetIconStrokePixels(context); SuntimesUtils.tintDrawable((InsetDrawable)icon_sunset.getBackground(), sunsetIconColor, sunsetIconColor2, sunsetIconStrokeWidth); header_sunset.setTextColor(color_sunset); + header_sunset.setTextSize(titleSizeSp); + header_sunset.setTypeface(header_sunset.getTypeface(), (boldTitle ? Typeface.BOLD : Typeface.NORMAL)); moonrise.themeViews(context, theme); moonphase.themeViews(context, theme); moonlabel.setTextColor(labelColor); + moonlabel.setTextSize(titleSizeSp); + moonlabel.setTypeface(moonlabel.getTypeface(), (boldTitle ? Typeface.BOLD : Typeface.NORMAL)); lightmap.themeViews(context, theme); } diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/map/WorldMapDialog.java b/app/src/main/java/com/forrestguice/suntimeswidget/map/WorldMapDialog.java index 07584aabb..39d849de1 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/map/WorldMapDialog.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/map/WorldMapDialog.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2018-2019 Forrest Guice + Copyright (C) 2018-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -27,6 +27,7 @@ import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.PorterDuff; +import android.graphics.Typeface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -392,7 +393,13 @@ public void themeViews(Context context) color_accent = themeOverride.getAccentColor(); dialogTitle.setTextColor(themeOverride.getTitleColor()); + dialogTitle.setTextSize(themeOverride.getTitleSizeSp()); + dialogTitle.setTypeface(dialogTitle.getTypeface(), (themeOverride.getTitleBold() ? Typeface.BOLD : Typeface.NORMAL)); + utcTime.setTextColor(themeOverride.getTimeColor()); + utcTime.setTextSize(themeOverride.getTimeSizeSp()); + utcTime.setTypeface(utcTime.getTypeface(), (themeOverride.getTimeBold() ? Typeface.BOLD : Typeface.NORMAL)); + worldmap.themeViews(context, themeOverride); } diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/views/MoonApsisView.java b/app/src/main/java/com/forrestguice/suntimeswidget/views/MoonApsisView.java index bcbdbc26f..765b89f27 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/views/MoonApsisView.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/views/MoonApsisView.java @@ -1,5 +1,5 @@ /** - Copyright (C) 2019 Forrest Guice + Copyright (C) 2019-2021 Forrest Guice This file is part of SuntimesWidget. SuntimesWidget is free software: you can redistribute it and/or modify @@ -22,7 +22,9 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; +import android.graphics.Typeface; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v4.graphics.ColorUtils; import android.support.v4.widget.ImageViewCompat; @@ -234,6 +236,8 @@ public static class MoonApsisAdapter extends RecyclerView.Adapter apsis, boolean showTime, boolean showWeeks, boolean showHours, boolean showSeconds, WidgetSettings.LengthUnit units)