rad/degrees

This commit is contained in:
serso
2011-11-22 23:56:46 +04:00
parent 59ffa7a6d8
commit e349bba759
11 changed files with 345 additions and 48 deletions

View File

@@ -38,10 +38,7 @@ import org.solovyev.common.utils.history.HistoryAction;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.*;
public class CalculatorActivity extends Activity implements FontSizeAdjuster, SharedPreferences.OnSharedPreferenceChangeListener {
@@ -122,7 +119,7 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh
equalsButton.setOnDragListener(evalOnDragListener);
}
final AngleUnitsButton angleUnitsButton = (AngleUnitsButton) findViewById(R.id.clearButton);
final AngleUnitsButton angleUnitsButton = (AngleUnitsButton) findViewById(R.id.sixDigitButton);
if (angleUnitsButton != null) {
final OnDragListener varsOnDragListener = new OnDragListenerVibrator(newOnDragListener(new AngleUnitsChanger(), dragPreferences), vibrator, preferences);
angleUnitsButton.setOnDragListener(varsOnDragListener);

View File

@@ -7,6 +7,7 @@
package org.solovyev.android.calculator.model;
import jscl.math.function.Constant;
import jscl.math.function.ExtendedConstant;
import jscl.math.function.IConstant;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -159,7 +160,7 @@ public class Var implements IConstant {
Double result = null;
if (value != null) {
try {
result = Double.valueOf(value);
result = ExtendedConstant.getDoubleValue0(getName(), value);
} catch (NumberFormatException e) {
// do nothing - string is not a double
}
@@ -224,11 +225,16 @@ public class Var implements IConstant {
@Override
public String toString() {
final String stringValue = getValue();
if (!StringUtils.isEmpty(stringValue)) {
return getName() + " = " + stringValue;
final Double doubleValue = getDoubleValue();
if (doubleValue == null) {
final String stringValue = getValue();
if (!StringUtils.isEmpty(stringValue)) {
return getName() + " = " + stringValue;
} else {
return getName();
}
} else {
return getName();
return getName() + " = " + doubleValue;
}
}

View File

@@ -1,3 +1,9 @@
/*
* Copyright (c) 2009-2011. Created by serso aka se.solovyev.
* For more information, please, contact se.solovyev@gmail.com
* or visit http://se.solovyev.org
*/
package org.solovyev.android.view.widgets;
import android.content.Context;
@@ -32,6 +38,7 @@ public class AngleUnitsButton extends DirectionDragButton {
result.setColor(resources.getColor(R.color.selected_angle_unit_text_color));
} else {
result.setColor(resources.getColor(R.color.default_text_color));
result.setAlpha(getDefaultDirectionTextAlpha());
}
}

View File

@@ -188,12 +188,16 @@ public class DirectionDragButton extends DragButton {
private static TextPaint getUpDownTextPaint(@NotNull Paint basePaint, @NotNull Resources resources, @NotNull Float directionTextScale) {
final TextPaint result = new TextPaint(basePaint);
result.setColor(resources.getColor(R.color.button_text_color));
result.setAlpha(150);
result.setAlpha(getDefaultDirectionTextAlpha());
result.setTextSize(basePaint.getTextSize() * directionTextScale);
return result;
}
protected static int getDefaultDirectionTextAlpha() {
return 150;
}
@Nullable
public String getTextUp() {
return textUp;