changes
This commit is contained in:
parent
452f5ebde7
commit
03cc14a097
@ -11,6 +11,7 @@
|
|||||||
a:text="@string/c_history_button"
|
a:text="@string/c_history_button"
|
||||||
c:textUp="@string/c_undo"
|
c:textUp="@string/c_undo"
|
||||||
c:textDown="@string/c_redo"
|
c:textDown="@string/c_redo"
|
||||||
|
c:directionTextScale="0.3"
|
||||||
style="?controlButtonStyle"
|
style="?controlButtonStyle"
|
||||||
a:textStyle="bold"
|
a:textStyle="bold"
|
||||||
a:onClick="historyButtonClickHandler"/>
|
a:onClick="historyButtonClickHandler"/>
|
@ -13,6 +13,6 @@
|
|||||||
a:text="()"
|
a:text="()"
|
||||||
c:textDown=")"
|
c:textDown=")"
|
||||||
c:textLeft="(…)"
|
c:textLeft="(…)"
|
||||||
c:directionTextScale="0.5"
|
c:directionTextScale="0.5;0.5;0.5;0.33"
|
||||||
style="?digitButtonStyle"
|
style="?digitButtonStyle"
|
||||||
a:onClick="digitButtonClickHandler"/>
|
a:onClick="digitButtonClickHandler"/>
|
@ -14,5 +14,6 @@
|
|||||||
c:textLeft="F"
|
c:textLeft="F"
|
||||||
c:textRight="grad"
|
c:textRight="grad"
|
||||||
c:textDown="rad"
|
c:textDown="rad"
|
||||||
|
c:directionTextScale="0.33;0.30;0.33;0.33"
|
||||||
style="?digitButtonStyle"
|
style="?digitButtonStyle"
|
||||||
a:onClick="digitButtonClickHandler"/>
|
a:onClick="digitButtonClickHandler"/>
|
@ -202,7 +202,7 @@
|
|||||||
<b>Ejemplos:</b>\n
|
<b>Ejemplos:</b>\n
|
||||||
268° = 4.67748\n
|
268° = 4.67748\n
|
||||||
30.21° = 0.52726\n
|
30.21° = 0.52726\n
|
||||||
rad(30, 21, 0) = 0.52726\n
|
rad(30, 21, 0) = 0.52971\n
|
||||||
deg(4.67748) = 268\n\n
|
deg(4.67748) = 268\n\n
|
||||||
|
|
||||||
<b>¿Soporta C+ %?</b>\n\n
|
<b>¿Soporta C+ %?</b>\n\n
|
||||||
@ -242,7 +242,7 @@
|
|||||||
|
|
||||||
<b>Ejemplos:</b>\n\n
|
<b>Ejemplos:</b>\n\n
|
||||||
|
|
||||||
(2i + 1) ^ = -3 + 4i\n
|
(2i + 1) ^ 2 = -3 + 4i\n
|
||||||
e ^ i = 0.5403 + 0.84147i\n\n
|
e ^ i = 0.5403 + 0.84147i\n\n
|
||||||
|
|
||||||
<b>¿Puede C+ dibujar gráficas de las funciones?</b>\n\n
|
<b>¿Puede C+ dibujar gráficas de las funciones?</b>\n\n
|
||||||
|
@ -198,7 +198,7 @@ Attualente C++ non supporta questa funzione ma è possibile utilizzare le funzio
|
|||||||
<b>Esempi:</b>\n
|
<b>Esempi:</b>\n
|
||||||
268° = 4.67748\n
|
268° = 4.67748\n
|
||||||
30.21° = 0.52726\n
|
30.21° = 0.52726\n
|
||||||
rad(30, 21, 0) = 0.52726\n
|
rad(30, 21, 0) = 0.52971\n
|
||||||
deg(4.67748) = 268\n
|
deg(4.67748) = 268\n
|
||||||
\n
|
\n
|
||||||
<b>C++ supporta la %?</b>\n
|
<b>C++ supporta la %?</b>\n
|
||||||
@ -233,7 +233,7 @@ Sì, basta inserire una espressione complessa (usando i o √(-1) come numero im
|
|||||||
\n
|
\n
|
||||||
<b>Esempi:</b>\n
|
<b>Esempi:</b>\n
|
||||||
\n
|
\n
|
||||||
(2i + 1) ^ = -3 + 4i\n
|
(2i + 1) ^ 2 = -3 + 4i\n
|
||||||
e ^ i = 0.5403 + 0.84147i\n
|
e ^ i = 0.5403 + 0.84147i\n
|
||||||
\n
|
\n
|
||||||
<b>C++ può disegnare i grafici delle funzioni?</b>\n
|
<b>C++ può disegnare i grafici delle funzioni?</b>\n
|
||||||
|
@ -213,7 +213,7 @@
|
|||||||
<b>Примеры:</b>\n
|
<b>Примеры:</b>\n
|
||||||
268° = 4.67748\n
|
268° = 4.67748\n
|
||||||
30.21° = 0.52726\n
|
30.21° = 0.52726\n
|
||||||
rad(30, 21, 0) = 0.52726\n
|
rad(30, 21, 0) = 0.52971\n
|
||||||
deg(4.67748) = 268\n
|
deg(4.67748) = 268\n
|
||||||
\n
|
\n
|
||||||
<b>Поддерживает ли К++ проценты?</b>\n
|
<b>Поддерживает ли К++ проценты?</b>\n
|
||||||
@ -248,7 +248,7 @@ deg(4.67748) = 268\n
|
|||||||
\n
|
\n
|
||||||
<b>Примеры:</b>\n
|
<b>Примеры:</b>\n
|
||||||
\n
|
\n
|
||||||
(2i + 1) ^ = -3 + 4i\n
|
(2i + 1) ^ 2 = -3 + 4i\n
|
||||||
e ^ i = 0.5403 + 0.84147i\n
|
e ^ i = 0.5403 + 0.84147i\n
|
||||||
\n
|
\n
|
||||||
<b>Умеет ли К++ строить графики функций?</b>\n
|
<b>Умеет ли К++ строить графики функций?</b>\n
|
||||||
@ -291,4 +291,21 @@ e ^ i = 0.5403 + 0.84147i\n
|
|||||||
<string name="c_swipe_distance">Длина свайпа для клавиш</string>
|
<string name="c_swipe_distance">Длина свайпа для клавиш</string>
|
||||||
<string name="c_swipe_distance_summary">Устанавливает длину свайпа для клавиш которые поддерживают дополнительные действия по свайпу</string>
|
<string name="c_swipe_distance_summary">Устанавливает длину свайпа для клавиш которые поддерживают дополнительные действия по свайпу</string>
|
||||||
|
|
||||||
|
<string name="c_comment">Комментарий</string>
|
||||||
|
<string name="c_history_item_saved">Сохранено</string>
|
||||||
|
<string name="c_history_item_not_saved">Не сохранено</string>
|
||||||
|
<string name="c_expression_copied">Выражение скопировано в буфер!</string>
|
||||||
|
<string name="c_history_item_status">Статус: </string>
|
||||||
|
<string name="c_history_item_comment">Комментарий: </string>
|
||||||
|
<string name="c_use_expression">Использовать</string>
|
||||||
|
<string name="c_copy_expression">Копировать выражение</string>
|
||||||
|
<string name="c_copy_result">Копировать результат</string>
|
||||||
|
<string name="c_history_expression">Значение</string>
|
||||||
|
<string name="c_history_item_already_saved">Сохранено (см. вкладку \'Сохранённая история\')</string>
|
||||||
|
<string name="c_history_comment">Комментарий</string>
|
||||||
|
<string name="c_save_history">Сохранить</string>
|
||||||
|
<string name="c_edit_history">Изменить</string>
|
||||||
|
<string name="c_edit">Изменить</string>
|
||||||
|
<string name="c_saved_history">Сохранённая история</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -216,7 +216,7 @@ Also you can use deg() and rad() functions and ° operator to convert degrees to
|
|||||||
<b>Examples:</b>\n
|
<b>Examples:</b>\n
|
||||||
268° = 4.67748\n
|
268° = 4.67748\n
|
||||||
30.21° = 0.52726\n
|
30.21° = 0.52726\n
|
||||||
rad(30, 21, 0) = 0.52726\n
|
rad(30, 21, 0) = 0.52971\n
|
||||||
deg(4.67748) = 268\n
|
deg(4.67748) = 268\n
|
||||||
\n
|
\n
|
||||||
<b>Does C++ support %?</b>\n
|
<b>Does C++ support %?</b>\n
|
||||||
@ -251,7 +251,7 @@ Yes, just enter complex expression (using i or √(-1) as imaginary number).\n
|
|||||||
\n
|
\n
|
||||||
<b>Examples:</b>\n
|
<b>Examples:</b>\n
|
||||||
\n
|
\n
|
||||||
(2i + 1) ^ = -3 + 4i\n
|
(2i + 1) ^ 2 = -3 + 4i\n
|
||||||
e ^ i = 0.5403 + 0.84147i\n
|
e ^ i = 0.5403 + 0.84147i\n
|
||||||
\n
|
\n
|
||||||
<b>Can C++ plot graph of the function?</b>\n
|
<b>Can C++ plot graph of the function?</b>\n
|
||||||
@ -302,7 +302,7 @@ Check the \'Round result\' preference in application settings - it should be tur
|
|||||||
<string name="c_comment">Comment</string>
|
<string name="c_comment">Comment</string>
|
||||||
<string name="c_history_item_saved">Saved</string>
|
<string name="c_history_item_saved">Saved</string>
|
||||||
<string name="c_history_item_not_saved">Not 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_expression_copied">Expression copied to the clipboard!</string>
|
||||||
<string name="c_history_item_status">Status: </string>
|
<string name="c_history_item_status">Status: </string>
|
||||||
<string name="c_history_item_comment">Comment: </string>
|
<string name="c_history_item_comment">Comment: </string>
|
||||||
<string name="c_use_expression">Use</string>
|
<string name="c_use_expression">Use</string>
|
||||||
|
@ -31,8 +31,8 @@ import org.solovyev.android.calculator.model.CalculatorEngine;
|
|||||||
import org.solovyev.android.calculator.model.CalculatorEvalException;
|
import org.solovyev.android.calculator.model.CalculatorEvalException;
|
||||||
import org.solovyev.android.calculator.model.CalculatorParseException;
|
import org.solovyev.android.calculator.model.CalculatorParseException;
|
||||||
import org.solovyev.android.calculator.model.Var;
|
import org.solovyev.android.calculator.model.Var;
|
||||||
import org.solovyev.android.view.CursorControl;
|
import org.solovyev.android.view.*;
|
||||||
import org.solovyev.android.view.HistoryControl;
|
import org.solovyev.android.view.prefs.ResourceCache;
|
||||||
import org.solovyev.common.msg.Message;
|
import org.solovyev.common.msg.Message;
|
||||||
import org.solovyev.common.utils.CollectionsUtils;
|
import org.solovyev.common.utils.CollectionsUtils;
|
||||||
import org.solovyev.common.utils.MutableObject;
|
import org.solovyev.common.utils.MutableObject;
|
||||||
@ -396,21 +396,19 @@ public enum CalculatorModel implements CursorControl, HistoryControl<CalculatorH
|
|||||||
if (notSystemConstants.size() > 1) {
|
if (notSystemConstants.size() > 1) {
|
||||||
copyResult(activity, cd);
|
copyResult(activity, cd);
|
||||||
} else {
|
} else {
|
||||||
final CharSequence[] items = {activity.getText(R.string.c_plot), activity.getText(R.string.c_copy)};
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
final AMenu<CalculatorDisplayMenuItem> menu = new EnumMenu<CalculatorDisplayMenuItem>(CalculatorDisplayMenuItem.class);
|
||||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
|
||||||
|
final AlertDialog.Builder menuBuilder = new AlertDialog.Builder(activity);
|
||||||
|
menuBuilder.setItems(menu.getMenuCaptions(), new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int item) {
|
public void onClick(DialogInterface dialog, int item) {
|
||||||
if (item == 0) {
|
final AMenuItem<CalculatorDisplayMenuData> menuItem = menu.itemAt(item);
|
||||||
final Constant constant = CollectionsUtils.getFirstCollectionElement(notSystemConstants);
|
if ( menuItem != null ){
|
||||||
assert constant != null;
|
menuItem.doAction(new CalculatorDisplayMenuData(cd, genericResult, notSystemConstants), activity);
|
||||||
CalculatorActivityLauncher.plotGraph(activity, genericResult, constant);
|
|
||||||
} else if ( item == 1 ) {
|
|
||||||
copyResult(activity, cd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
menuBuilder.create().show();
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -434,4 +432,68 @@ public enum CalculatorModel implements CursorControl, HistoryControl<CalculatorH
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class CalculatorDisplayMenuData {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final CalculatorDisplay display;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final Generic result;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final Set<Constant> notSystemConstants;
|
||||||
|
|
||||||
|
private CalculatorDisplayMenuData(@NotNull CalculatorDisplay display, @NotNull Generic result, @NotNull Set<Constant> notSystemConstants) {
|
||||||
|
this.display = display;
|
||||||
|
this.result = result;
|
||||||
|
this.notSystemConstants = notSystemConstants;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public CalculatorDisplay getDisplay() {
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public Generic getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public Set<Constant> getNotSystemConstants() {
|
||||||
|
return notSystemConstants;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static enum CalculatorDisplayMenuItem implements AMenuItem<CalculatorDisplayMenuData> {
|
||||||
|
plot("c_plot"){
|
||||||
|
@Override
|
||||||
|
public void doAction(@NotNull CalculatorDisplayMenuData data, @NotNull Context context) {
|
||||||
|
final Constant constant = CollectionsUtils.getFirstCollectionElement(data.getNotSystemConstants());
|
||||||
|
assert constant != null;
|
||||||
|
CalculatorActivityLauncher.plotGraph(context, data.getResult(), constant);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
copy("c_copy"){
|
||||||
|
@Override
|
||||||
|
public void doAction(@NotNull CalculatorDisplayMenuData data, @NotNull Context context) {
|
||||||
|
copyResult(context, data.getDisplay());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private final String captionId;
|
||||||
|
|
||||||
|
CalculatorDisplayMenuItem(@NotNull String captionId) {
|
||||||
|
|
||||||
|
this.captionId = captionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String getCaption() {
|
||||||
|
final String caption = ResourceCache.instance.getCaption(captionId);
|
||||||
|
return caption == null ? name() : caption;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ public class DirectionDragButton extends DragButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static int getDefaultDirectionTextAlpha() {
|
protected static int getDefaultDirectionTextAlpha() {
|
||||||
return 100;
|
return 120;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -202,6 +202,12 @@ public class HistoryUtilsTest {
|
|||||||
|
|
||||||
Assert.assertEquals(history.getStates().size(), historyFromXml.getStates().size());
|
Assert.assertEquals(history.getStates().size(), historyFromXml.getStates().size());
|
||||||
|
|
||||||
|
for (CalculatorHistoryState historyState : history.getStates()) {
|
||||||
|
historyState.setId(0);
|
||||||
|
}
|
||||||
|
for (CalculatorHistoryState historyState : historyFromXml.getStates()) {
|
||||||
|
historyState.setId(0);
|
||||||
|
}
|
||||||
Assert.assertTrue(EqualsTool.areEqual(history.getStates(), historyFromXml.getStates(), new CollectionEqualizer<CalculatorHistoryState>(null)));
|
Assert.assertTrue(EqualsTool.areEqual(history.getStates(), historyFromXml.getStates(), new CollectionEqualizer<CalculatorHistoryState>(null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user