From 880343bba42c52ab5cc4f2cb0a2bd81e3fe881b2 Mon Sep 17 00:00:00 2001 From: serso Date: Mon, 16 Feb 2015 22:30:56 +0100 Subject: [PATCH] Display/Editor colors fixed --- .../org/solovyev/android/calculator/Preferences.java | 2 +- .../android/calculator/view/TextHighlighter.java | 11 +---------- android-app/src/main/res/layout/widget_display.xml | 2 +- android-app/src/main/res/layout/widget_editor.xml | 2 +- .../res/layout/widget_layout_lockscreen_collapsed.xml | 4 ++-- android-app/src/main/res/values/attributes.xml | 2 +- android-app/src/main/res/values/colors.xml | 4 ++-- android-app/src/main/res/values/styles.xml | 7 +++++-- android-app/src/main/res/values/theme.xml | 8 ++++++++ 9 files changed, 22 insertions(+), 20 deletions(-) diff --git a/android-app/src/main/java/org/solovyev/android/calculator/Preferences.java b/android-app/src/main/java/org/solovyev/android/calculator/Preferences.java index ed17617a..61eeb02f 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/Preferences.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/Preferences.java @@ -155,7 +155,7 @@ public final class Preferences { TextColor textColor = textColors.get(themeId); if (textColor == null) { final ContextThemeWrapper themeContext = new ContextThemeWrapper(context, themeId); - final TypedArray a = themeContext.obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary, android.R.attr.textColorPrimaryInverse}); + final TypedArray a = themeContext.obtainStyledAttributes(themeId, new int[]{R.attr.cpp_text_color, R.attr.cpp_text_color_error}); final int normal = a.getColor(0, Color.BLACK); final int error = a.getColor(1, Color.WHITE); a.recycle(); diff --git a/android-app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java b/android-app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java index 9cbbd768..c5bd3ab8 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java @@ -30,7 +30,6 @@ import org.solovyev.common.MutableObject; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.HashMap; import java.util.Map; /** @@ -40,14 +39,6 @@ import java.util.Map; */ public class TextHighlighter implements TextProcessor { - public static final int WHITE = -1; - - private static final Map nbFontAttributes = new HashMap(); - - static { - nbFontAttributes.put("color", "#008000"); - } - private final int red; private final int green; private final int blue; @@ -108,7 +99,7 @@ public class TextHighlighter implements TextProcessor numberOffset = new MutableObject(0); + final MutableObject numberOffset = new MutableObject<>(0); ((NumberBuilder) numberBuilder).process(text1, mathType, numberOffset); resultOffset += numberOffset.getObject(); } else { diff --git a/android-app/src/main/res/layout/widget_display.xml b/android-app/src/main/res/layout/widget_display.xml index c0741c2b..8105de60 100644 --- a/android-app/src/main/res/layout/widget_display.xml +++ b/android-app/src/main/res/layout/widget_display.xml @@ -7,7 +7,7 @@ --> - + diff --git a/android-app/src/main/res/values/colors.xml b/android-app/src/main/res/values/colors.xml index 16899ec9..86cd2623 100644 --- a/android-app/src/main/res/values/colors.xml +++ b/android-app/src/main/res/values/colors.xml @@ -24,9 +24,9 @@ #ff2e2e2e #ffe6e6e6 - #424242 @color/cpp_text_inverse - @color/cpp_text + #424242 + @color/cpp_text #ffffffff #ffffff99 diff --git a/android-app/src/main/res/values/styles.xml b/android-app/src/main/res/values/styles.xml index 74e57fbf..2e2d66a5 100644 --- a/android-app/src/main/res/values/styles.xml +++ b/android-app/src/main/res/values/styles.xml @@ -56,6 +56,7 @@ fill_parent fill_parent @dimen/cpp_editor_text_size + ?attr/cpp_text_color - -