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