text + some fixes

This commit is contained in:
Sergey Solovyev 2011-12-24 21:20:51 +04:00
parent c67de4117a
commit 4cdceca650
15 changed files with 81 additions and 47 deletions

View File

@ -11,7 +11,7 @@
a:text="@string/c_history_button"
c:textUp="@string/c_undo"
c:textDown="@string/c_redo"
c:directionTextScale="0.3"
c:directionTextScale="0.27"
style="?controlButtonStyle"
a:textStyle="bold"
a:onClick="historyButtonClickHandler"/>

View File

@ -18,6 +18,7 @@
<string name="c_fun_description_acot">Arccotangente - El inverso de la función cotangente.</string>
<string name="c_fun_description_ln">Logaritmo neperiano - logaritmo de base e.</string>
<string name="c_fun_description_lg">Decadic logaritmo - logaritmo de base 10.</string>
<string name="c_fun_description_log">Logaritmo - logaritmo de la base especificada.</string>
<string name="c_fun_description_exp">Función exponencial.</string>
<string name="c_fun_description_sqrt">Función Raíz cuadrado.</string>
<string name="c_fun_description_cubic">Función Raíz cuadrada.</string>

View File

@ -120,8 +120,8 @@
<string name="c_empty_var_error">No se puede crear una constante vacía!</string>
<string name="c_not_valid_result">El resultado actual no es válido!</string>
<!--
<string name="c_plot_graph">Graph</string>
<string name="c_plot_graph">Gráfico</string>
<string name="c_min_x_value">From</string>
<string name="c_max_x_value">To</string>
@ -129,25 +129,28 @@
<string name="c_swipe_distance_summary">Sets swipe distance for buttons that support additional swipe actions</string>
<string name="c_comment">Comment</string>
<string name="c_history_item_saved">Saved</string>
<string name="c_history_item_not_saved">Not saved</string>
<string name="c_expression_copied">Expression copied to the clipboard!</string>
<string name="c_history_item_status">Status: </string>
<string name="c_history_item_comment">Comment: </string>
<string name="c_use">Use</string>
<string name="c_copy_expression">Copy expression</string>
<string name="c_copy_result">Copy result</string>
<string name="c_history_expression">Value</string>
<string name="c_history_item_already_saved">Saved (see \'Saved history\' tab)</string>
<string name="c_history_comment">Comment</string>
<string name="c_save_history">Save history</string>
<string name="c_edit_history">Modify history</string>
<string name="c_edit">Modify</string>
<string name="c_saved_history">Saved history</string>
<string name="c_history_item_saved">Guardado</string>
<string name="c_history_item_not_saved">No se guarda</string>
<string name="c_expression_copied">Expresión copiada en el portapapeles!</string>
<string name="c_history_item_status">Estado: </string>
<string name="c_history_item_comment">Comentario: </string>
<string name="c_use">Utilizar</string>
<string name="c_copy_expression">Copia de la expresión</string>
<string name="c_copy_result">Copia resultado</string>
<string name="c_history_expression">Valor</string>
<string name="c_history_item_already_saved">Salvo (ver \'La historia guardada\' ficha)</string>
<string name="c_history_comment">Comentario</string>
<string name="c_save_history">Guardar el historial de</string>
<string name="c_edit_history">Modificar la historia</string>
<string name="c_edit">modificar</string>
<string name="c_saved_history">La historia guardada</string>
<string name="c_history_already_saved">La historia se salvó ya!</string>
<string name="c_history_must_be_saved">La historia debe ser salvado antes de editar!</string>
<string name="c_history_was_removed">La historia se ha eliminado correctamente!</string>
<string name="c_history_saved">La historia se ha guardado correctamente!</string>
<string name="c_copy_description">Сopia de la descripción</string>
<string name="c_copy_value">Сopia el valor</string>
<string name="c_history_already_saved">History was already saved!</string>
<string name="c_history_must_be_saved">History must be saved before editing!</string>
<string name="c_history_was_removed">History was successfully removed!</string>
<string name="c_history_saved">History was successfully saved!</string>
-->
</resources>

View File

@ -18,6 +18,7 @@
<string name="c_fun_description_acot">Arccotangente - inversa della funzione cotangente.</string>
<string name="c_fun_description_ln">Logaritmo naturale - logaritmo in base e.</string>
<string name="c_fun_description_lg">Logaritmo decimale - logaritmo in base 10.</string>
<string name="c_fun_description_log">Logaritmo - logaritmo nella base specificata.</string>
<string name="c_fun_description_exp">Funzione esponenziale.</string>
<string name="c_fun_description_sqrt">Funzione radice quadrata.</string>
<string name="c_fun_description_cubic">Funzione radice cubica.</string>

View File

@ -150,4 +150,7 @@
<string name="c_history_was_removed">La storia è stata rimossa con successo!</string>
<string name="c_history_saved">La storia è stata salvata correttamente!</string>
<string name="c_copy_description">Сopia descrizione</string>
<string name="c_copy_value">Сopia il valore</string>
</resources>

View File

@ -16,7 +16,7 @@
Если вам понравилось приложение -\nпоставьте 5 звёздочек в\n<a href="https://market.android.com/details?id=org.solovyev.android.calculator">андроид.маркете</a>\n\n
Спасибо тем, кто переводил Калькулятор++:\n
на итальянский - Gabriele Ravanetti\n
на испанский - Jordi Luna\т\n
на испанский - Jordi Luna\n\n
Это приложение использует следующие открытые библиотеки:\n
<a href="http://simple.sourceforge.net">Simple (XML serialization)</a>\n
<a href="http://meditorworld.appspot.com/meditor.txt">JSCL</a>\n

View File

@ -18,6 +18,7 @@
<string name="c_fun_description_acot">Арккотангенс - обратная функция к котангенсу.</string>
<string name="c_fun_description_ln">Натуральный логарифм - логарифм по основанию e.</string>
<string name="c_fun_description_lg">Десятичный логарифм - логарифм по основанию 10.</string>
<string name="c_fun_description_log">Логирифм по заданному основанию.</string>
<string name="c_fun_description_exp">Экспонента.</string>
<string name="c_fun_description_sqrt">Функция квадратного корня.</string>
<string name="c_fun_description_cubic">Функция кубического корня.</string>

View File

@ -150,4 +150,7 @@
<string name="c_history_was_removed">История успешно удалена!</string>
<string name="c_history_saved">История успешно сохранена!</string>
<string name="c_copy_description">Копироват описание</string>
<string name="c_copy_value">Копировать значение</string>
</resources>

View File

@ -1,11 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="DragButton">
<declare-styleable name="DirectionDragButton">
<attr name="textUp" format="string"/>
<attr name="textDown" format="string"/>
<attr name="textRight" format="string"/>
<attr name="textLeft" format="string"/>
<attr name="directionTextScale" format="string"/>
<attr name="directionTextAlpha" format="integer"/>
</declare-styleable>
<declare-styleable name="DragButton">
<attr name="hTextPosition" format="float"/>
</declare-styleable>

View File

@ -18,6 +18,7 @@
<string name="c_fun_description_acot">Arccotangent - the inverse of cotangent function.</string>
<string name="c_fun_description_ln">Natural logarithm - logarithm the base e.</string>
<string name="c_fun_description_lg">Decadic logarithm - logarithm the base 10.</string>
<string name="c_fun_description_log">Logarithm - logarithm the specified base.</string>
<string name="c_fun_description_exp">Exponential function.</string>
<string name="c_fun_description_sqrt">Square root function.</string>
<string name="c_fun_description_cubic">Cubic root function.</string>

View File

@ -58,7 +58,7 @@ public class AndroidFunctionsMathRegistry extends AbstractAndroidMathRegistry<Fu
}
},
common(R.string.c_fun_category_common, 100) {
common(R.string.c_fun_category_common, 50) {
@Override
boolean isInCategory(@NotNull Function function) {
for (Category category : values()) {
@ -120,7 +120,7 @@ public class AndroidFunctionsMathRegistry extends AbstractAndroidMathRegistry<Fu
public void load(@Nullable Context context, @Nullable SharedPreferences preferences) {
super.load(context, preferences);
add(new CustomFunction.Builder(true, "log", new String[]{"a", "b"}, "ln(b)/ln(a)"));
add(new CustomFunction.Builder(true, "log", new String[]{"base", "x"}, "ln(x)/ln(base)"));
}
@NotNull

View File

@ -37,7 +37,7 @@ public class AngleUnitsButton extends DirectionDragButton {
directionTextPaint.setColor(resources.getColor(R.color.selected_angle_unit_text_color));
} else {
directionTextPaint.setColor(resources.getColor(R.color.default_text_color));
directionTextPaint.setAlpha(getDefaultDirectionTextAlpha());
directionTextPaint.setAlpha(getDirectionTextAlpha());
}
}
}

View File

@ -23,6 +23,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;
import android.graphics.Paint.Style;
@ -64,7 +65,6 @@ public class ColorButton extends Button {
private static final float H_TEXT_POSITION_DEFAULT_VALUE = 0.5f;
// todo serso: check - currently not worked
private float hTextPosition = H_TEXT_POSITION_DEFAULT_VALUE;
public ColorButton(Context context, AttributeSet attrs) {
@ -74,6 +74,22 @@ public class ColorButton extends Button {
public ColorButton(Context context, AttributeSet attrs, boolean init) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, org.solovyev.android.calculator.R.styleable.DragButton);
final int N = a.getIndexCount();
for (int i = 0; i < N; i++) {
int attr = a.getIndex(i);
final String attrValue = a.getString(attr);
if (!StringUtils.isEmpty(attrValue)) {
switch (attr) {
case R.styleable.DragButton_hTextPosition:
this.hTextPosition = Float.valueOf(attrValue);
break;
}
}
}
if (init) {
init(context);
}
@ -219,14 +235,6 @@ public class ColorButton extends Button {
this.onClickListener.onClick(this);
}
public float getHTextPosition() {
return hTextPosition;
}
public void setHTextPosition(float hTextPosition) {
this.hTextPosition = hTextPosition;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean result = super.onTouchEvent(event);

View File

@ -35,6 +35,9 @@ public class DirectionDragButton extends DragButton {
@NotNull
private final static Float DEFAULT_DIRECTION_TEXT_SCALE_FLOAT = 0.33f;
@NotNull
private final static Integer DEFAULT_DIRECTION_TEXT_ALPHA = 140;
@NotNull
private final static String DEFAULT_DIRECTION_TEXT_SCALE = "0.33;0.33;0.33;0.33";
@ -106,7 +109,7 @@ public class DirectionDragButton extends DragButton {
up(DragDirection.up, 0) {
@Override
public int getAttributeId() {
return R.styleable.DragButton_textUp;
return R.styleable.DirectionDragButton_textUp;
}
@NotNull
@ -118,7 +121,7 @@ public class DirectionDragButton extends DragButton {
down(DragDirection.down, 2) {
@Override
public int getAttributeId() {
return R.styleable.DragButton_textDown;
return R.styleable.DirectionDragButton_textDown;
}
@NotNull
@ -130,7 +133,7 @@ public class DirectionDragButton extends DragButton {
left(DragDirection.left, 3) {
@Override
public int getAttributeId() {
return R.styleable.DragButton_textLeft;
return R.styleable.DirectionDragButton_textLeft;
}
@NotNull
@ -143,7 +146,7 @@ public class DirectionDragButton extends DragButton {
right(DragDirection.right, 1) {
@Override
public int getAttributeId() {
return R.styleable.DragButton_textRight;
return R.styleable.DirectionDragButton_textRight;
}
@NotNull
@ -230,6 +233,9 @@ public class DirectionDragButton extends DragButton {
@NotNull
private String directionTextScale = DEFAULT_DIRECTION_TEXT_SCALE;
@NotNull
private Integer directionTextAlpha = DEFAULT_DIRECTION_TEXT_ALPHA;
private boolean initialized = false;
public DirectionDragButton(Context context, @NotNull AttributeSet attrs) {
@ -239,7 +245,7 @@ public class DirectionDragButton extends DragButton {
private void init(@NotNull Context context, @NotNull AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, org.solovyev.android.calculator.R.styleable.DragButton);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DirectionDragButton);
final int N = a.getIndexCount();
for (int i = 0; i < N; i++) {
@ -249,9 +255,12 @@ public class DirectionDragButton extends DragButton {
if (!StringUtils.isEmpty(attrValue)) {
switch (attr) {
case R.styleable.DragButton_directionTextScale:
case R.styleable.DirectionDragButton_directionTextScale:
this.directionTextScale = attrValue;
break;
case R.styleable.DirectionDragButton_directionTextAlpha:
this.directionTextAlpha = Integer.valueOf(attrValue);
break;
default:
// try drag direction text
for (GuiDragDirection guiDragDirection : GuiDragDirection.values()) {
@ -318,14 +327,14 @@ public class DirectionDragButton extends DragButton {
final TextPaint directionTextPaint = new TextPaint(basePaint);
directionTextPaint.setColor(resources.getColor(R.color.button_text_color));
directionTextPaint.setAlpha(getDefaultDirectionTextAlpha());
directionTextPaint.setAlpha(getDirectionTextAlpha());
directionTextPaint.setTextSize(basePaint.getTextSize() * directionTextData.getTextScale());
directionTextData.setPaint(directionTextPaint);
}
protected static int getDefaultDirectionTextAlpha() {
return 120;
protected int getDirectionTextAlpha() {
return directionTextAlpha;
}
@Nullable

View File

@ -37,7 +37,7 @@ public class NumeralBasesButton extends DirectionDragButton {
directionTextPaint.setColor(resources.getColor(R.color.selected_angle_unit_text_color));
} else {
directionTextPaint.setColor(resources.getColor(R.color.default_text_color));
directionTextPaint.setAlpha(getDefaultDirectionTextAlpha());
directionTextPaint.setAlpha(getDirectionTextAlpha());
}
}
}