diff --git a/android-app/AndroidManifest.xml b/android-app/AndroidManifest.xml index db7ca808..66a63eab 100644 --- a/android-app/AndroidManifest.xml +++ b/android-app/AndroidManifest.xml @@ -72,7 +72,11 @@ - + + + + + diff --git a/android-app/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java index b7e5cde4..2dbfcb25 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java @@ -24,17 +24,14 @@ package org.solovyev.android.calculator.matrix; import android.os.Bundle; import android.view.View; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import org.solovyev.android.calculator.CalculatorFragment; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.R; import org.solovyev.android.view.IntegerRange; import org.solovyev.android.view.Picker; -import java.io.Serializable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * User: Solovyev_S @@ -91,11 +88,11 @@ public class CalculatorMatrixEditFragment extends CalculatorFragment implements final Picker matrixColsCountPicker = (Picker) root.findViewById(R.id.matrix_cols_count_picker); initPicker(matrixColsCountPicker); - Matrix matrix = null; + MatrixUi matrix = null; if (in != null) { final Object matrixObject = in.getSerializable(MATRIX); - if (matrixObject instanceof Matrix) { - matrix = (Matrix) matrixObject; + if (matrixObject instanceof MatrixUi) { + matrix = (MatrixUi) matrixObject; } } @@ -103,7 +100,7 @@ public class CalculatorMatrixEditFragment extends CalculatorFragment implements if (matrix == null) { matrixView.setMatrixDimensions(DEFAULT_ROWS, DEFAULT_COLS); } else { - matrixView.setMatrix(matrix.bakingArray); + matrixView.setMatrix(matrix.getBakingArray()); } matrixRowsCountPicker.setCurrent(matrixView.getRows()); matrixColsCountPicker.setCurrent(matrixView.getCols()); @@ -113,7 +110,7 @@ public class CalculatorMatrixEditFragment extends CalculatorFragment implements public void onSaveInstanceState(@Nonnull Bundle out) { super.onSaveInstanceState(out); - out.putSerializable(MATRIX, new Matrix(getMatrixView(getView()).toMatrix())); + out.putSerializable(MATRIX, new MatrixUi(getMatrixView(getView()).toMatrix())); } @Nonnull @@ -146,16 +143,4 @@ public class CalculatorMatrixEditFragment extends CalculatorFragment implements getMatrixView(getView()).setMatrixRows(newRows); } - public static class Matrix implements Serializable { - - @Nonnull - private String[][] bakingArray; - - public Matrix() { - } - - public Matrix(@Nonnull String[][] bakingArray) { - this.bakingArray = bakingArray; - } - } } diff --git a/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixUi.java b/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixUi.java new file mode 100644 index 00000000..22a76100 --- /dev/null +++ b/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixUi.java @@ -0,0 +1,27 @@ +package org.solovyev.android.calculator.matrix; + +import javax.annotation.Nonnull; +import java.io.Serializable; + +/** +* User: serso +* Date: 7/11/13 +* Time: 4:54 PM +*/ +class MatrixUi implements Serializable { + + @Nonnull + private String[][] bakingArray; + + public MatrixUi() { + } + + public MatrixUi(@Nonnull String[][] bakingArray) { + this.bakingArray = bakingArray; + } + + @Nonnull + String[][] getBakingArray() { + return bakingArray; + } +} diff --git a/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixView.java b/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixView.java index 10cfa4e8..9e2a099d 100644 --- a/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixView.java +++ b/android-app/src/main/java/org/solovyev/android/calculator/matrix/MatrixView.java @@ -118,8 +118,8 @@ public class MatrixView extends TableLayout { throw new IllegalArgumentException("Number of columns must be more than 1: " + newCols); } - boolean rowsChanged = this.rows != newRows; - boolean colsChanged = this.cols != newCols; + final boolean rowsChanged = this.rows != newRows; + final boolean colsChanged = this.cols != newCols; if (rowsChanged || colsChanged) { if (!initialized) { diff --git a/android-app/src/test/java/org/solovyev/android/calculator/matrix/MatrixViewTest.java b/android-app/src/test/java/org/solovyev/android/calculator/matrix/MatrixViewTest.java new file mode 100644 index 00000000..721d90a9 --- /dev/null +++ b/android-app/src/test/java/org/solovyev/android/calculator/matrix/MatrixViewTest.java @@ -0,0 +1,9 @@ +package org.solovyev.android.calculator.matrix; + +/** + * User: serso + * Date: 7/11/13 + * Time: 4:56 PM + */ +public class MatrixViewTest { +}