From 781f3d564898373e181936b88ad32862fddffde4 Mon Sep 17 00:00:00 2001 From: serso Date: Thu, 7 Jan 2016 20:22:28 +0100 Subject: [PATCH] Fix too light and too dark colors in editor/display --- .../calculator/view/TextHighlighter.java | 32 +++---------------- .../calculator/widget/CalculatorWidget.java | 17 +++------- 2 files changed, 10 insertions(+), 39 deletions(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java b/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java index 6b3e05c3..af5fe425 100644 --- a/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java +++ b/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java @@ -26,47 +26,31 @@ import android.graphics.Typeface; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; - import com.google.common.collect.Lists; - import org.solovyev.android.Check; -import org.solovyev.android.calculator.BaseNumberBuilder; -import org.solovyev.android.calculator.CalculatorEngine; -import org.solovyev.android.calculator.CalculatorParseException; -import org.solovyev.android.calculator.LiteNumberBuilder; -import org.solovyev.android.calculator.Locator; -import org.solovyev.android.calculator.NumberBuilder; +import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.text.TextProcessor; import org.solovyev.android.calculator.text.TextProcessorEditorResult; +import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; - -/** - * User: serso - * Date: 10/12/11 - * Time: 9:47 PM - */ public class TextHighlighter implements TextProcessor { private final int red; private final int green; private final int blue; private final boolean formatNumber; - private final boolean dark; + private final int dark; public TextHighlighter(int color, boolean formatNumber) { this.formatNumber = formatNumber; - //this.red = Color.red(baseColor); red = red(color); - //this.green = Color.green(baseColor); green = green(color); - //this.blue = Color.blue(baseColor); blue = blue(color); - dark = isDark(red, green, blue); + dark = isDark(red, green, blue) ? 1 : -1; } private static int blue(int color) { @@ -195,13 +179,7 @@ public class TextHighlighter implements TextProcessor