layout
This commit is contained in:
@@ -23,6 +23,11 @@ public class CalculatorEditor extends EditText {
|
||||
|
||||
private boolean highlightText = true;
|
||||
|
||||
private final static int BASE_COLOUR = Color.WHITE;
|
||||
private final static int BASE_COLOUR_RED_COMPONENT = Color.red(BASE_COLOUR);
|
||||
private final static int BASE_COLOUR_GREEN_COMPONENT = Color.green(BASE_COLOUR);
|
||||
private final static int BASE_COLOUR_BLUE_COMPONENT = Color.blue(BASE_COLOUR);
|
||||
|
||||
public CalculatorEditor(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -135,13 +140,11 @@ public class CalculatorEditor extends EditText {
|
||||
}
|
||||
|
||||
private String getColor(int numberOfOpenGroupSymbols, int numberOfOpenings) {
|
||||
final int baseColor = Color.WHITE;
|
||||
double c = 0.7;
|
||||
|
||||
double c = 1;
|
||||
int offset = ((int) (255 * c)) * numberOfOpenings / (numberOfOpenGroupSymbols + 1);
|
||||
|
||||
int i = ((int) (255 * c)) * numberOfOpenings / (numberOfOpenGroupSymbols + 1);
|
||||
|
||||
int result = Color.rgb(Color.red(baseColor) - i, Color.green(baseColor) - i, Color.blue(baseColor) - i);
|
||||
int result = Color.rgb(BASE_COLOUR_RED_COMPONENT - offset, BASE_COLOUR_GREEN_COMPONENT - offset, BASE_COLOUR_BLUE_COMPONENT - offset);
|
||||
|
||||
return "#" + Integer.toHexString(result).substring(2);
|
||||
}
|
||||
|
@@ -6,13 +6,10 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.ClipboardManager;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@@ -38,7 +35,7 @@ import org.solovyev.common.utils.history.SimpleHistoryHelper;
|
||||
public class CalculatorView implements CursorControl, HistoryControl<CalculatorHistoryState> {
|
||||
|
||||
// millis to wait before evaluation after user edit action
|
||||
public static final int EVAL_DELAY_MILLIS = 700;
|
||||
public static final int EVAL_DELAY_MILLIS = 1000;
|
||||
|
||||
@NotNull
|
||||
private final CalculatorEditor editor;
|
||||
@@ -55,11 +52,7 @@ public class CalculatorView implements CursorControl, HistoryControl<CalculatorH
|
||||
public CalculatorView(@NotNull final Activity activity, @NotNull CalculatorModel calculator) {
|
||||
this.calculatorModel = calculator;
|
||||
|
||||
final InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
|
||||
this.editor = (CalculatorEditor) activity.findViewById(R.id.editText);
|
||||
this.editor.setInputType(InputType.TYPE_NULL);
|
||||
imm.hideSoftInputFromWindow(this.editor.getWindowToken(), 0);
|
||||
|
||||
this.display = (CalculatorDisplay) activity.findViewById(R.id.resultEditText);
|
||||
this.display.setOnClickListener(new View.OnClickListener() {
|
||||
|
@@ -9,6 +9,7 @@ import bsh.EvalError;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.simpleframework.xml.Attribute;
|
||||
import org.solovyev.android.calculator.JsclOperation;
|
||||
|
||||
/**
|
||||
@@ -79,4 +80,50 @@ public class CalculatorModelTest {
|
||||
Assert.assertEquals("i", cm.createResultForComplexNumber("i"));
|
||||
|
||||
}
|
||||
|
||||
public interface TestInterface {
|
||||
Integer getField();
|
||||
}
|
||||
|
||||
public class TestClass implements TestInterface{
|
||||
|
||||
@Attribute(required = true)
|
||||
private Integer field;
|
||||
|
||||
public TestClass() {
|
||||
}
|
||||
|
||||
public TestClass(Integer field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public Integer getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public void setField(Integer field) {
|
||||
this.field = field;
|
||||
}
|
||||
}
|
||||
|
||||
public class NewTestClass implements TestInterface{
|
||||
|
||||
@Attribute
|
||||
private Integer field;
|
||||
|
||||
public NewTestClass() {
|
||||
}
|
||||
|
||||
public NewTestClass(Integer field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public Integer getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public void setField(Integer field) {
|
||||
this.field = field;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user