changes
This commit is contained in:
parent
cdc478174c
commit
30e8b55a73
@ -46,7 +46,14 @@ public class FixableMessage implements Parcelable {
|
|||||||
|
|
||||||
public FixableMessage(@NotNull Message message) {
|
public FixableMessage(@NotNull Message message) {
|
||||||
this.message = message.getLocalizedMessage();
|
this.message = message.getLocalizedMessage();
|
||||||
this.messageType = message.getMessageType();
|
int messageLevel = message.getMessageLevel().getMessageLevel();
|
||||||
|
if(messageLevel < MessageType.info.getMessageLevel()) {
|
||||||
|
this.messageType = MessageType.info;
|
||||||
|
} else if (messageLevel < MessageType.warning.getMessageLevel()) {
|
||||||
|
this.messageType = MessageType.warning;
|
||||||
|
} else {
|
||||||
|
this.messageType = MessageType.error;
|
||||||
|
}
|
||||||
this.fixableError = CalculatorFixableError.getErrorByMessageCode(message.getMessageCode());
|
this.fixableError = CalculatorFixableError.getErrorByMessageCode(message.getMessageCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.solovyev.common.msg.MessageLevel;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,8 +82,8 @@ public final class ParcelableDialogData implements DialogData, Parcelable {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public MessageType getMessageType() {
|
public MessageLevel getMessageLevel() {
|
||||||
return nestedData.getMessageType();
|
return nestedData.getMessageLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -99,7 +100,7 @@ public final class ParcelableDialogData implements DialogData, Parcelable {
|
|||||||
@Override
|
@Override
|
||||||
public void writeToParcel(@NotNull Parcel out, int flags) {
|
public void writeToParcel(@NotNull Parcel out, int flags) {
|
||||||
out.writeString(this.getMessage());
|
out.writeString(this.getMessage());
|
||||||
out.writeInt(this.getMessageType().ordinal());
|
out.writeInt(this.getMessageLevel().getMessageLevel());
|
||||||
out.writeString(this.getTitle());
|
out.writeString(this.getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class CalculatorDialogActivity extends SherlockFragmentActivity {
|
|||||||
messageTextView.setMovementMethod(ScrollingMovementMethod.getInstance());
|
messageTextView.setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||||
messageTextView.setText(dialogData.getMessage());
|
messageTextView.setText(dialogData.getMessage());
|
||||||
|
|
||||||
if ( dialogData.getMessageType() == MessageType.error || dialogData.getMessageType() == MessageType.warning ) {
|
if ( dialogData.getMessageLevel() == MessageType.error || dialogData.getMessageLevel() == MessageType.warning ) {
|
||||||
final Button copyButton = (Button) root.findViewById(R.id.cpp_copy_button);
|
final Button copyButton = (Button) root.findViewById(R.id.cpp_copy_button);
|
||||||
copyButton.setVisibility(View.VISIBLE);
|
copyButton.setVisibility(View.VISIBLE);
|
||||||
copyButton.setOnClickListener(new View.OnClickListener() {
|
copyButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -9,7 +9,6 @@ import android.view.View;
|
|||||||
import android.widget.Scroller;
|
import android.widget.Scroller;
|
||||||
import android.widget.ZoomButtonsController;
|
import android.widget.ZoomButtonsController;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.common.definitions.Pair;
|
|
||||||
import org.solovyev.common.math.Point2d;
|
import org.solovyev.common.math.Point2d;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@ -243,7 +242,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
|||||||
|
|
||||||
graphsData.checkBoundaries(graphHeight, yMin, yMax);
|
graphsData.checkBoundaries(graphHeight, yMin, yMax);
|
||||||
|
|
||||||
final Pair<Integer, Integer> tickDigits = drawGridAndAxis(canvas);
|
final TickDigits tickDigits = drawGridAndAxis(canvas);
|
||||||
|
|
||||||
{
|
{
|
||||||
// TOUCH POSITION
|
// TOUCH POSITION
|
||||||
@ -256,7 +255,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
|||||||
canvas.drawLine(0, lastTouchYPxs, widthPxs, lastTouchYPxs, paint);
|
canvas.drawLine(0, lastTouchYPxs, widthPxs, lastTouchYPxs, paint);
|
||||||
|
|
||||||
final Point2d lastTouch = dimensions.toGraphCoordinates(lastTouchXPxs, lastTouchYPxs);
|
final Point2d lastTouch = dimensions.toGraphCoordinates(lastTouchXPxs, lastTouchYPxs);
|
||||||
final String touchLabel = "[" + formatTick(lastTouch.getX(), tickDigits.getFirst() + 1) + ", " + formatTick(lastTouch.getY(), tickDigits.getSecond() + 1) + "]";
|
final String touchLabel = "[" + formatTick(lastTouch.getX(), tickDigits.xTicks + 1) + ", " + formatTick(lastTouch.getY(), tickDigits.yTicks + 1) + "]";
|
||||||
canvas.drawText(touchLabel, 0, touchLabel.length(), lastTouchXPxs - 40, lastTouchYPxs - 40, textPaint);
|
canvas.drawText(touchLabel, 0, touchLabel.length(), lastTouchXPxs - 40, lastTouchYPxs - 40, textPaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,8 +300,8 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private Pair<Integer, Integer> drawGridAndAxis(@NotNull Canvas canvas) {
|
private TickDigits drawGridAndAxis(@NotNull Canvas canvas) {
|
||||||
final Pair<Integer, Integer> result = new Pair<Integer, Integer>(1, 1);
|
final TickDigits result = new TickDigits();
|
||||||
|
|
||||||
final float xMin = dimensions.getXMin();
|
final float xMin = dimensions.getXMin();
|
||||||
|
|
||||||
@ -350,7 +349,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
|||||||
{
|
{
|
||||||
final float tickStep = getTickStep(dimensions.getGWidth());
|
final float tickStep = getTickStep(dimensions.getGWidth());
|
||||||
final int tickDigits = countTickDigits(tickStep);
|
final int tickDigits = countTickDigits(tickStep);
|
||||||
result.setFirst(tickDigits);
|
result.xTicks = tickDigits;
|
||||||
// round xMin and init first tick
|
// round xMin and init first tick
|
||||||
float tick = ((int) (xMin / tickStep)) * tickStep;
|
float tick = ((int) (xMin / tickStep)) * tickStep;
|
||||||
|
|
||||||
@ -372,7 +371,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
|||||||
{
|
{
|
||||||
final float tickStep = getTickStep(dimensions.getGHeight());
|
final float tickStep = getTickStep(dimensions.getGHeight());
|
||||||
final int tickDigits = countTickDigits(tickStep);
|
final int tickDigits = countTickDigits(tickStep);
|
||||||
result.setSecond(tickDigits);
|
result.yTicks = tickDigits;
|
||||||
// round yMin and init first tick
|
// round yMin and init first tick
|
||||||
float tick = ((int) (yMin / tickStep)) * tickStep;
|
float tick = ((int) (yMin / tickStep)) * tickStep;
|
||||||
|
|
||||||
@ -622,4 +621,10 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
|||||||
|
|
||||||
dimensions.increaseXY(dx, dy);
|
dimensions.increaseXY(dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final class TickDigits {
|
||||||
|
|
||||||
|
public int xTicks = 1;
|
||||||
|
public int yTicks = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,8 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.solovyev.common.exceptions.SersoException;
|
|
||||||
import org.solovyev.common.msg.Message;
|
import org.solovyev.common.msg.Message;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageLevel;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -19,7 +18,7 @@ import java.util.Locale;
|
|||||||
* Date: 12/8/11
|
* Date: 12/8/11
|
||||||
* Time: 1:27 AM
|
* Time: 1:27 AM
|
||||||
*/
|
*/
|
||||||
public class CalculatorEvalException extends SersoException implements Message {
|
public class CalculatorEvalException extends Exception implements Message {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Message message;
|
private final Message message;
|
||||||
@ -53,8 +52,8 @@ public class CalculatorEvalException extends SersoException implements Message {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public MessageType getMessageType() {
|
public MessageLevel getMessageLevel() {
|
||||||
return this.message.getMessageType();
|
return this.message.getMessageLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,9 +8,8 @@ package org.solovyev.android.calculator;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.common.exceptions.SersoException;
|
|
||||||
import org.solovyev.common.msg.Message;
|
import org.solovyev.common.msg.Message;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageLevel;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -20,7 +19,7 @@ import java.util.Locale;
|
|||||||
* Date: 10/6/11
|
* Date: 10/6/11
|
||||||
* Time: 9:25 PM
|
* Time: 9:25 PM
|
||||||
*/
|
*/
|
||||||
public class CalculatorParseException extends SersoException implements Message {
|
public class CalculatorParseException extends Exception implements Message {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Message message;
|
private final Message message;
|
||||||
@ -74,8 +73,8 @@ public class CalculatorParseException extends SersoException implements Message
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public MessageType getMessageType() {
|
public MessageLevel getMessageLevel() {
|
||||||
return this.message.getMessageType();
|
return this.message.getMessageLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,7 @@ package org.solovyev.android.calculator;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
@ -15,7 +15,7 @@ public interface DialogData {
|
|||||||
String getMessage();
|
String getMessage();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
MessageType getMessageType();
|
MessageLevel getMessageLevel();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
String getTitle();
|
String getTitle();
|
||||||
|
@ -3,7 +3,7 @@ package org.solovyev.android.calculator;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.solovyev.common.msg.Message;
|
import org.solovyev.common.msg.Message;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: serso
|
* User: serso
|
||||||
@ -36,8 +36,8 @@ public class MessageDialogData implements DialogData {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public MessageType getMessageType() {
|
public MessageLevel getMessageLevel() {
|
||||||
return message.getMessageType();
|
return message.getMessageLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,7 +39,7 @@ public class StringDialogData implements DialogData {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public MessageType getMessageType() {
|
public MessageType getMessageLevel() {
|
||||||
return messageType;
|
return messageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ import org.solovyev.android.calculator.Locator;
|
|||||||
import org.solovyev.android.calculator.MathPersistenceEntity;
|
import org.solovyev.android.calculator.MathPersistenceEntity;
|
||||||
import org.solovyev.common.math.MathEntity;
|
import org.solovyev.common.math.MathEntity;
|
||||||
import org.solovyev.common.msg.Message;
|
import org.solovyev.common.msg.Message;
|
||||||
import org.solovyev.common.msg.MessageType;
|
import org.solovyev.common.msg.MessageLevel;
|
||||||
import org.solovyev.common.text.Strings;
|
import org.solovyev.common.text.Strings;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -315,8 +315,8 @@ public class AFunction implements IFunction, MathPersistenceEntity, Serializable
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public MessageType getMessageType() {
|
public MessageLevel getMessageLevel() {
|
||||||
return message.getMessageType();
|
return message.getMessageLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
7
pom.xml
7
pom.xml
@ -166,17 +166,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.solovyev</groupId>
|
<groupId>org.solovyev</groupId>
|
||||||
<artifactId>jscl</artifactId>
|
<artifactId>jscl</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.4-SNAPSHOT</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>xercesImpl</artifactId>
|
<artifactId>xercesImpl</artifactId>
|
||||||
<groupId>xerces</groupId>
|
<groupId>xerces</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
|
||||||
<exclusion>
|
|
||||||
<groupId>jgraphx</groupId>
|
|
||||||
<artifactId>jgraphx</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user