diff --git a/res/values/colors.xml b/res/values/colors.xml index 2613c677..a81127cf 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -7,6 +7,8 @@ #00ffffff #ffffffff + #ffffff99 + #ffffffff #ffffffff #ff000000 \ No newline at end of file diff --git a/src/main/java/org/solovyev/android/view/widgets/ColorButton.java b/src/main/java/org/solovyev/android/view/widgets/ColorButton.java index 07902a1d..b9042726 100644 --- a/src/main/java/org/solovyev/android/view/widgets/ColorButton.java +++ b/src/main/java/org/solovyev/android/view/widgets/ColorButton.java @@ -35,9 +35,12 @@ import android.widget.Button; import org.jetbrains.annotations.NotNull; import org.solovyev.android.calculator.R; import org.solovyev.android.view.FontSizeAdjuster; +import org.solovyev.common.utils.CollectionsUtils; import org.solovyev.common.utils.Point2d; import org.solovyev.common.utils.StringUtils; +import java.util.Arrays; + /** * NOTE: copied from com.android.calculator2.ColorButton */ @@ -79,13 +82,20 @@ public class ColorButton extends Button { } protected void init(Context context) { - Resources res = getResources(); + final Resources resources = getResources(); - CLICK_FEEDBACK_COLOR = res.getColor(org.solovyev.android.calculator.R.color.magic_flame); + CLICK_FEEDBACK_COLOR = resources.getColor(org.solovyev.android.calculator.R.color.magic_flame); feedbackPaint = new Paint(); feedbackPaint.setStyle(Style.STROKE); feedbackPaint.setStrokeWidth(2); - getPaint().setColor(res.getColor(R.color.button_text_color)); + + if (CollectionsUtils.contains(getText().toString(), Arrays.asList("+", "-", "/", "×"))) { + getPaint().setColor(resources.getColor(R.color.button_operator_text_color)); + } else if (getText().toString().equals("CE")) { + getPaint().setColor(resources.getColor(R.color.button_ce_text_color)); + } else { + getPaint().setColor(resources.getColor(R.color.button_text_color)); + } animationStart = -1; diff --git a/src/main/java/org/solovyev/android/view/widgets/DirectionDragButton.java b/src/main/java/org/solovyev/android/view/widgets/DirectionDragButton.java index 2608e5ff..7a6a74fd 100644 --- a/src/main/java/org/solovyev/android/view/widgets/DirectionDragButton.java +++ b/src/main/java/org/solovyev/android/view/widgets/DirectionDragButton.java @@ -6,6 +6,7 @@ package org.solovyev.android.view.widgets; import android.content.Context; +import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; @@ -165,7 +166,10 @@ public class DirectionDragButton extends DragButton { paint = getPaint(); } + final Resources resources = getResources(); + upDownTextPaint = new TextPaint(paint); + upDownTextPaint.setColor(resources.getColor(R.color.button_text_color)); upDownTextPaint.setAlpha(150); upDownTextPaint.setTextSize(paint.getTextSize() * getDirectionTextScale()); }