color operator buttons
This commit is contained in:
parent
10242e3ba0
commit
e6b7673a54
@ -7,6 +7,8 @@
|
||||
<resources>
|
||||
<color name="magic_flame">#00ffffff</color>
|
||||
<color name="button_text_color">#ffffffff</color>
|
||||
<color name="button_operator_text_color">#ffffff99</color>
|
||||
<color name="button_ce_text_color">#ffffffff</color>
|
||||
<color name="default_text_color">#ffffffff</color>
|
||||
<color name="default_background">#ff000000</color>
|
||||
</resources>
|
@ -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;
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user