diff --git a/calculatorpp/AndroidManifest.xml b/calculatorpp/AndroidManifest.xml
index ee1ce70d..86e51de9 100644
--- a/calculatorpp/AndroidManifest.xml
+++ b/calculatorpp/AndroidManifest.xml
@@ -37,6 +37,9 @@
+
+
+
diff --git a/calculatorpp/res/layout/calc_vars_button.xml b/calculatorpp/res/layout/calc_vars_button.xml
index 0005f0f3..7d23094c 100644
--- a/calculatorpp/res/layout/calc_vars_button.xml
+++ b/calculatorpp/res/layout/calc_vars_button.xml
@@ -1,17 +1,18 @@
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/calculatorpp/res/layout/matrix_edit_fragment.xml b/calculatorpp/res/layout/matrix_edit_fragment.xml
new file mode 100644
index 00000000..2dc0b9b6
--- /dev/null
+++ b/calculatorpp/res/layout/matrix_edit_fragment.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calculatorpp/res/layout/matrix_edit_fragment_item.xml b/calculatorpp/res/layout/matrix_edit_fragment_item.xml
new file mode 100644
index 00000000..880d08b1
--- /dev/null
+++ b/calculatorpp/res/layout/matrix_edit_fragment_item.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java
index 27ae4778..3f63389a 100644
--- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java
+++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorButtons.java
@@ -1,238 +1,243 @@
-package org.solovyev.android.calculator;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.res.Configuration;
-import android.preference.PreferenceManager;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.Button;
-import android.widget.Toast;
-import jscl.AngleUnit;
-import jscl.NumeralBase;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.solovyev.android.AndroidUtils;
-import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
-import org.solovyev.android.calculator.view.AngleUnitsButton;
-import org.solovyev.android.calculator.view.NumeralBasesButton;
-import org.solovyev.android.view.ColorButton;
-import org.solovyev.android.view.drag.DragButton;
-import org.solovyev.android.view.drag.DragDirection;
-import org.solovyev.android.view.drag.SimpleOnDragListener;
-import org.solovyev.common.math.Point2d;
-
-/**
- * User: serso
- * Date: 9/28/12
- * Time: 12:06 AM
- */
-public final class CalculatorButtons {
-
- private CalculatorButtons () {
- }
-
-
- public static void processButtons(boolean fixMagicFlames,
- @NotNull CalculatorPreferences.Gui.Theme theme,
- @NotNull View root) {
- if (theme.getThemeType() == CalculatorPreferences.Gui.ThemeType.metro) {
-
- if (fixMagicFlames) {
- // for metro themes we should turn off magic flames
- AndroidUtils.processViewsOfType(root, ColorButton.class, new AndroidUtils.ViewProcessor() {
- @Override
- public void process(@NotNull ColorButton colorButton) {
- colorButton.setDrawMagicFlame(false);
- }
- });
- }
- }
- }
-
- static void initMultiplicationButton(@NotNull View root) {
- final View multiplicationButton = root.findViewById(R.id.multiplicationButton);
- if ( multiplicationButton instanceof Button) {
- ((Button) multiplicationButton).setText(CalculatorLocatorImpl.getInstance().getEngine().getMultiplicationSign());
- }
- }
-
-
-
- public static void toggleEqualsButton(@Nullable SharedPreferences preferences,
- @NotNull Activity activity) {
- preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
-
- final boolean large = AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration());
-
- if (!large) {
- if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT
- || !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
-
- final DragButton equalsButton = (DragButton)activity.findViewById(R.id.equalsButton);
- if (equalsButton != null) {
- if (CalculatorPreferences.Gui.showEqualsButton.getPreference(preferences)) {
- equalsButton.setVisibility(View.VISIBLE);
- } else {
- equalsButton.setVisibility(View.GONE);
- }
- }
- }
- }
- }
-
- @Nullable
- private static AndroidCalculatorDisplayView getCalculatorDisplayView() {
- return (AndroidCalculatorDisplayView) CalculatorLocatorImpl.getInstance().getDisplay().getView();
- }
-
- /*
- **********************************************************************
- *
- * STATIC CLASSES
- *
- **********************************************************************
- */
-
- static class RoundBracketsDragProcessor implements SimpleOnDragListener.DragProcessor {
- @Override
- public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) {
- final boolean result;
-
- if (dragDirection == DragDirection.left) {
- getKeyboard().roundBracketsButtonPressed();
- result = true;
- } else {
- result = new DigitButtonDragProcessor(getKeyboard()).processDragEvent(dragDirection, dragButton, startPoint2d, motionEvent);
- }
-
- return result;
- }
- }
-
- @NotNull
- private static CalculatorKeyboard getKeyboard() {
- return CalculatorLocatorImpl.getInstance().getKeyboard();
- }
-
- static class VarsDragProcessor implements SimpleOnDragListener.DragProcessor {
-
- @NotNull
- private Context context;
-
- VarsDragProcessor(Context context) {
- this.context = context;
- }
-
- @Override
- public boolean processDragEvent(@NotNull DragDirection dragDirection,
- @NotNull DragButton dragButton,
- @NotNull Point2d startPoint2d,
- @NotNull MotionEvent motionEvent) {
- boolean result = false;
-
- if (dragDirection == DragDirection.up) {
- CalculatorActivityLauncher.createVar(context, CalculatorLocatorImpl.getInstance().getDisplay());
- result = true;
- }
-
- return result;
- }
- }
-
- static class AngleUnitsChanger implements SimpleOnDragListener.DragProcessor {
-
- @NotNull
- private final DigitButtonDragProcessor processor;
-
- @NotNull
- private final Context context;
-
- AngleUnitsChanger(@NotNull Context context) {
- this.context = context;
- this.processor = new DigitButtonDragProcessor(CalculatorLocatorImpl.getInstance().getKeyboard());
- }
-
- @Override
- public boolean processDragEvent(@NotNull DragDirection dragDirection,
- @NotNull DragButton dragButton,
- @NotNull Point2d startPoint2d,
- @NotNull MotionEvent motionEvent) {
- boolean result = false;
-
- if (dragButton instanceof AngleUnitsButton) {
- if (dragDirection != DragDirection.left) {
- final String directionText = ((AngleUnitsButton) dragButton).getText(dragDirection);
- if (directionText != null) {
- try {
-
- final AngleUnit angleUnits = AngleUnit.valueOf(directionText);
-
- final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
-
- final AngleUnit oldAngleUnits = AndroidCalculatorEngine.Preferences.angleUnit.getPreference(preferences);
- if (oldAngleUnits != angleUnits) {
- AndroidCalculatorEngine.Preferences.angleUnit.putPreference(preferences, angleUnits);
-
- Toast.makeText(context, context.getString(R.string.c_angle_units_changed_to, angleUnits.name()), Toast.LENGTH_LONG).show();
- }
-
- result = true;
- } catch (IllegalArgumentException e) {
- Log.d(this.getClass().getName(), "Unsupported angle units: " + directionText);
- }
- }
- } else if (dragDirection == DragDirection.left) {
- result = processor.processDragEvent(dragDirection, dragButton, startPoint2d, motionEvent);
- }
- }
-
- return result;
- }
- }
-
- static class NumeralBasesChanger implements SimpleOnDragListener.DragProcessor {
-
- @NotNull
- private final Context context;
-
- NumeralBasesChanger(@NotNull Context context) {
- this.context = context;
- }
-
- @Override
- public boolean processDragEvent(@NotNull DragDirection dragDirection,
- @NotNull DragButton dragButton,
- @NotNull Point2d startPoint2d,
- @NotNull MotionEvent motionEvent) {
- boolean result = false;
-
- if (dragButton instanceof NumeralBasesButton) {
- final String directionText = ((NumeralBasesButton) dragButton).getText(dragDirection);
- if (directionText != null) {
- try {
-
- final NumeralBase numeralBase = NumeralBase.valueOf(directionText);
-
- final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
-
- final NumeralBase oldNumeralBase = AndroidCalculatorEngine.Preferences.numeralBase.getPreference(preferences);
- if (oldNumeralBase != numeralBase) {
- AndroidCalculatorEngine.Preferences.numeralBase.putPreference(preferences, numeralBase);
-
- Toast.makeText(context, context.getString(R.string.c_numeral_base_changed_to, numeralBase.name()), Toast.LENGTH_LONG).show();
- }
-
- result = true;
- } catch (IllegalArgumentException e) {
- Log.d(this.getClass().getName(), "Unsupported numeral base: " + directionText);
- }
- }
- }
-
- return result;
- }
- }
-}
+package org.solovyev.android.calculator;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+import jscl.AngleUnit;
+import jscl.NumeralBase;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.solovyev.android.AndroidUtils;
+import org.solovyev.android.calculator.matrix.CalculatorMatrixActivity;
+import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
+import org.solovyev.android.calculator.view.AngleUnitsButton;
+import org.solovyev.android.calculator.view.NumeralBasesButton;
+import org.solovyev.android.view.ColorButton;
+import org.solovyev.android.view.drag.DragButton;
+import org.solovyev.android.view.drag.DragDirection;
+import org.solovyev.android.view.drag.SimpleOnDragListener;
+import org.solovyev.common.math.Point2d;
+
+/**
+ * User: serso
+ * Date: 9/28/12
+ * Time: 12:06 AM
+ */
+public final class CalculatorButtons {
+
+ private CalculatorButtons () {
+ }
+
+
+ public static void processButtons(boolean fixMagicFlames,
+ @NotNull CalculatorPreferences.Gui.Theme theme,
+ @NotNull View root) {
+ if (theme.getThemeType() == CalculatorPreferences.Gui.ThemeType.metro) {
+
+ if (fixMagicFlames) {
+ // for metro themes we should turn off magic flames
+ AndroidUtils.processViewsOfType(root, ColorButton.class, new AndroidUtils.ViewProcessor() {
+ @Override
+ public void process(@NotNull ColorButton colorButton) {
+ colorButton.setDrawMagicFlame(false);
+ }
+ });
+ }
+ }
+ }
+
+ static void initMultiplicationButton(@NotNull View root) {
+ final View multiplicationButton = root.findViewById(R.id.multiplicationButton);
+ if ( multiplicationButton instanceof Button) {
+ ((Button) multiplicationButton).setText(CalculatorLocatorImpl.getInstance().getEngine().getMultiplicationSign());
+ }
+ }
+
+
+
+ public static void toggleEqualsButton(@Nullable SharedPreferences preferences,
+ @NotNull Activity activity) {
+ preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
+
+ final boolean large = AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration());
+
+ if (!large) {
+ if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT
+ || !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
+
+ final DragButton equalsButton = (DragButton)activity.findViewById(R.id.equalsButton);
+ if (equalsButton != null) {
+ if (CalculatorPreferences.Gui.showEqualsButton.getPreference(preferences)) {
+ equalsButton.setVisibility(View.VISIBLE);
+ } else {
+ equalsButton.setVisibility(View.GONE);
+ }
+ }
+ }
+ }
+ }
+
+ @Nullable
+ private static AndroidCalculatorDisplayView getCalculatorDisplayView() {
+ return (AndroidCalculatorDisplayView) CalculatorLocatorImpl.getInstance().getDisplay().getView();
+ }
+
+ /*
+ **********************************************************************
+ *
+ * STATIC CLASSES
+ *
+ **********************************************************************
+ */
+
+ static class RoundBracketsDragProcessor implements SimpleOnDragListener.DragProcessor {
+ @Override
+ public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) {
+ final boolean result;
+
+ if (dragDirection == DragDirection.left) {
+ getKeyboard().roundBracketsButtonPressed();
+ result = true;
+ } else {
+ result = new DigitButtonDragProcessor(getKeyboard()).processDragEvent(dragDirection, dragButton, startPoint2d, motionEvent);
+ }
+
+ return result;
+ }
+ }
+
+ @NotNull
+ private static CalculatorKeyboard getKeyboard() {
+ return CalculatorLocatorImpl.getInstance().getKeyboard();
+ }
+
+ static class VarsDragProcessor implements SimpleOnDragListener.DragProcessor {
+
+ @NotNull
+ private Context context;
+
+ VarsDragProcessor(Context context) {
+ this.context = context;
+ }
+
+ @Override
+ public boolean processDragEvent(@NotNull DragDirection dragDirection,
+ @NotNull DragButton dragButton,
+ @NotNull Point2d startPoint2d,
+ @NotNull MotionEvent motionEvent) {
+ boolean result = false;
+
+ if (dragDirection == DragDirection.up) {
+ CalculatorActivityLauncher.createVar(context, CalculatorLocatorImpl.getInstance().getDisplay());
+ result = true;
+ } else if ( dragDirection == DragDirection.down ) {
+ context.startActivity(new Intent(context, CalculatorMatrixActivity.class));
+ result = true;
+ }
+
+ return result;
+ }
+ }
+
+ static class AngleUnitsChanger implements SimpleOnDragListener.DragProcessor {
+
+ @NotNull
+ private final DigitButtonDragProcessor processor;
+
+ @NotNull
+ private final Context context;
+
+ AngleUnitsChanger(@NotNull Context context) {
+ this.context = context;
+ this.processor = new DigitButtonDragProcessor(CalculatorLocatorImpl.getInstance().getKeyboard());
+ }
+
+ @Override
+ public boolean processDragEvent(@NotNull DragDirection dragDirection,
+ @NotNull DragButton dragButton,
+ @NotNull Point2d startPoint2d,
+ @NotNull MotionEvent motionEvent) {
+ boolean result = false;
+
+ if (dragButton instanceof AngleUnitsButton) {
+ if (dragDirection != DragDirection.left) {
+ final String directionText = ((AngleUnitsButton) dragButton).getText(dragDirection);
+ if (directionText != null) {
+ try {
+
+ final AngleUnit angleUnits = AngleUnit.valueOf(directionText);
+
+ final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+
+ final AngleUnit oldAngleUnits = AndroidCalculatorEngine.Preferences.angleUnit.getPreference(preferences);
+ if (oldAngleUnits != angleUnits) {
+ AndroidCalculatorEngine.Preferences.angleUnit.putPreference(preferences, angleUnits);
+
+ Toast.makeText(context, context.getString(R.string.c_angle_units_changed_to, angleUnits.name()), Toast.LENGTH_LONG).show();
+ }
+
+ result = true;
+ } catch (IllegalArgumentException e) {
+ Log.d(this.getClass().getName(), "Unsupported angle units: " + directionText);
+ }
+ }
+ } else if (dragDirection == DragDirection.left) {
+ result = processor.processDragEvent(dragDirection, dragButton, startPoint2d, motionEvent);
+ }
+ }
+
+ return result;
+ }
+ }
+
+ static class NumeralBasesChanger implements SimpleOnDragListener.DragProcessor {
+
+ @NotNull
+ private final Context context;
+
+ NumeralBasesChanger(@NotNull Context context) {
+ this.context = context;
+ }
+
+ @Override
+ public boolean processDragEvent(@NotNull DragDirection dragDirection,
+ @NotNull DragButton dragButton,
+ @NotNull Point2d startPoint2d,
+ @NotNull MotionEvent motionEvent) {
+ boolean result = false;
+
+ if (dragButton instanceof NumeralBasesButton) {
+ final String directionText = ((NumeralBasesButton) dragButton).getText(dragDirection);
+ if (directionText != null) {
+ try {
+
+ final NumeralBase numeralBase = NumeralBase.valueOf(directionText);
+
+ final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
+
+ final NumeralBase oldNumeralBase = AndroidCalculatorEngine.Preferences.numeralBase.getPreference(preferences);
+ if (oldNumeralBase != numeralBase) {
+ AndroidCalculatorEngine.Preferences.numeralBase.putPreference(preferences, numeralBase);
+
+ Toast.makeText(context, context.getString(R.string.c_numeral_base_changed_to, numeralBase.name()), Toast.LENGTH_LONG).show();
+ }
+
+ result = true;
+ } catch (IllegalArgumentException e) {
+ Log.d(this.getClass().getName(), "Unsupported numeral base: " + directionText);
+ }
+ }
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/about/CalculatorFragmentType.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/about/CalculatorFragmentType.java
index 693f660f..65a33d52 100644
--- a/calculatorpp/src/main/java/org/solovyev/android/calculator/about/CalculatorFragmentType.java
+++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/about/CalculatorFragmentType.java
@@ -1,76 +1,80 @@
-package org.solovyev.android.calculator.about;
-
-import android.support.v4.app.Fragment;
-import org.jetbrains.annotations.NotNull;
-import org.solovyev.android.calculator.CalculatorEditorFragment;
-import org.solovyev.android.calculator.R;
-import org.solovyev.android.calculator.help.CalculatorHelpFaqFragment;
-import org.solovyev.android.calculator.help.CalculatorHelpHintsFragment;
-import org.solovyev.android.calculator.help.CalculatorHelpScreensFragment;
-import org.solovyev.android.calculator.history.CalculatorHistoryFragment;
-import org.solovyev.android.calculator.history.CalculatorSavedHistoryFragment;
-import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment;
-import org.solovyev.android.calculator.math.edit.CalculatorOperatorsFragment;
-import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
-import org.solovyev.android.calculator.plot.CalculatorPlotFragment;
-
-/**
- * User: Solovyev_S
- * Date: 03.10.12
- * Time: 11:30
- */
-public enum CalculatorFragmentType {
-
- editor(CalculatorEditorFragment.class, R.layout.calc_editor, R.string.editor),
- //display(CalculatorHistoryFragment.class, "history", R.layout.history_fragment, R.string.c_history),
- //keyboard(CalculatorHistoryFragment.class, "history", R.layout.history_fragment, R.string.c_history),
- history(CalculatorHistoryFragment.class, R.layout.history_fragment, R.string.c_history),
- saved_history(CalculatorSavedHistoryFragment.class, R.layout.history_fragment, R.string.c_saved_history),
- variables(CalculatorVarsFragment.class, R.layout.vars_fragment, R.string.c_vars),
- functions(CalculatorFunctionsFragment.class, R.layout.math_entities_fragment, R.string.c_functions),
- operators(CalculatorOperatorsFragment.class, R.layout.math_entities_fragment, R.string.c_operators),
- plotter(CalculatorPlotFragment.class, R.layout.plot_fragment, R.string.c_graph),
- about(CalculatorAboutFragment.class, R.layout.about_fragment, R.string.c_about),
- faq(CalculatorHelpFaqFragment.class, R.layout.help_faq_fragment, R.string.c_faq),
- hints(CalculatorHelpHintsFragment.class, R.layout.help_hints_fragment, R.string.c_hints),
- screens(CalculatorHelpScreensFragment.class, R.layout.help_screens_fragment, R.string.c_screens),
- release_notes(CalculatorReleaseNotesFragment.class, R.layout.release_notes_fragment, R.string.c_release_notes);
-
- @NotNull
- private Class extends Fragment> fragmentClass;
-
- private final int defaultLayoutId;
-
- private int defaultTitleResId;
-
- private CalculatorFragmentType(@NotNull Class extends Fragment> fragmentClass,
- int defaultLayoutId,
- int defaultTitleResId) {
- this.fragmentClass = fragmentClass;
- this.defaultLayoutId = defaultLayoutId;
- this.defaultTitleResId = defaultTitleResId;
- }
-
- @NotNull
- public String getFragmentTag() {
- return this.name();
- }
-
- public int getDefaultTitleResId() {
- return defaultTitleResId;
- }
-
- @NotNull
- public Class extends Fragment> getFragmentClass() {
- return fragmentClass;
- }
-
- public int getDefaultLayoutId() {
- return defaultLayoutId;
- }
-
- @NotNull
- public String createSubFragmentTag(@NotNull String subFragmentTag) {
- return this.getFragmentTag() + "_" + subFragmentTag;
- }
-}
+package org.solovyev.android.calculator.about;
+
+import android.support.v4.app.Fragment;
+import org.jetbrains.annotations.NotNull;
+import org.solovyev.android.calculator.CalculatorEditorFragment;
+import org.solovyev.android.calculator.R;
+import org.solovyev.android.calculator.help.CalculatorHelpFaqFragment;
+import org.solovyev.android.calculator.help.CalculatorHelpHintsFragment;
+import org.solovyev.android.calculator.help.CalculatorHelpScreensFragment;
+import org.solovyev.android.calculator.history.CalculatorHistoryFragment;
+import org.solovyev.android.calculator.history.CalculatorSavedHistoryFragment;
+import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment;
+import org.solovyev.android.calculator.math.edit.CalculatorOperatorsFragment;
+import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
+import org.solovyev.android.calculator.matrix.CalculatorMatrixEditFragment;
+import org.solovyev.android.calculator.plot.CalculatorPlotFragment;
+
+/**
+ * User: Solovyev_S
+ * Date: 03.10.12
+ * Time: 11:30
+ */
+public enum CalculatorFragmentType {
+
+ editor(CalculatorEditorFragment.class, R.layout.calc_editor, R.string.editor),
+ //display(CalculatorHistoryFragment.class, "history", R.layout.history_fragment, R.string.c_history),
+ //keyboard(CalculatorHistoryFragment.class, "history", R.layout.history_fragment, R.string.c_history),
+ history(CalculatorHistoryFragment.class, R.layout.history_fragment, R.string.c_history),
+ saved_history(CalculatorSavedHistoryFragment.class, R.layout.history_fragment, R.string.c_saved_history),
+ variables(CalculatorVarsFragment.class, R.layout.vars_fragment, R.string.c_vars),
+ functions(CalculatorFunctionsFragment.class, R.layout.math_entities_fragment, R.string.c_functions),
+ operators(CalculatorOperatorsFragment.class, R.layout.math_entities_fragment, R.string.c_operators),
+ plotter(CalculatorPlotFragment.class, R.layout.plot_fragment, R.string.c_graph),
+ about(CalculatorAboutFragment.class, R.layout.about_fragment, R.string.c_about),
+ faq(CalculatorHelpFaqFragment.class, R.layout.help_faq_fragment, R.string.c_faq),
+ hints(CalculatorHelpHintsFragment.class, R.layout.help_hints_fragment, R.string.c_hints),
+ screens(CalculatorHelpScreensFragment.class, R.layout.help_screens_fragment, R.string.c_screens),
+
+ // todo serso: strings
+ matrix_edit(CalculatorMatrixEditFragment.class, R.layout.matrix_edit_fragment, R.string.c_screens),
+ release_notes(CalculatorReleaseNotesFragment.class, R.layout.release_notes_fragment, R.string.c_release_notes);
+
+ @NotNull
+ private Class extends Fragment> fragmentClass;
+
+ private final int defaultLayoutId;
+
+ private int defaultTitleResId;
+
+ private CalculatorFragmentType(@NotNull Class extends Fragment> fragmentClass,
+ int defaultLayoutId,
+ int defaultTitleResId) {
+ this.fragmentClass = fragmentClass;
+ this.defaultLayoutId = defaultLayoutId;
+ this.defaultTitleResId = defaultTitleResId;
+ }
+
+ @NotNull
+ public String getFragmentTag() {
+ return this.name();
+ }
+
+ public int getDefaultTitleResId() {
+ return defaultTitleResId;
+ }
+
+ @NotNull
+ public Class extends Fragment> getFragmentClass() {
+ return fragmentClass;
+ }
+
+ public int getDefaultLayoutId() {
+ return defaultLayoutId;
+ }
+
+ @NotNull
+ public String createSubFragmentTag(@NotNull String subFragmentTag) {
+ return this.getFragmentTag() + "_" + subFragmentTag;
+ }
+}
diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixActivity.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixActivity.java
new file mode 100644
index 00000000..3ec80741
--- /dev/null
+++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixActivity.java
@@ -0,0 +1,23 @@
+package org.solovyev.android.calculator.matrix;
+
+import android.app.ActionBar;
+import android.os.Bundle;
+import org.solovyev.android.calculator.CalculatorFragmentActivity;
+import org.solovyev.android.calculator.R;
+import org.solovyev.android.calculator.about.CalculatorFragmentType;
+
+/**
+ * User: Solovyev_S
+ * Date: 12.10.12
+ * Time: 10:56
+ */
+public class CalculatorMatrixActivity extends CalculatorFragmentActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ getActivityHelper().setFragment(this, CalculatorFragmentType.matrix_edit, null, R.id.main_layout);
+ }
+}
diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java
new file mode 100644
index 00000000..1d36190e
--- /dev/null
+++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/matrix/CalculatorMatrixEditFragment.java
@@ -0,0 +1,83 @@
+package org.solovyev.android.calculator.matrix;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TableLayout;
+import org.jetbrains.annotations.NotNull;
+import org.solovyev.android.calculator.CalculatorFragment;
+import org.solovyev.android.calculator.R;
+import org.solovyev.android.calculator.about.CalculatorFragmentType;
+import org.solovyev.android.view.IntegerRange;
+import org.solovyev.android.view.Picker;
+
+/**
+ * User: Solovyev_S
+ * Date: 12.10.12
+ * Time: 10:41
+ */
+public class CalculatorMatrixEditFragment extends CalculatorFragment implements Picker.OnChangedListener {
+
+ /*
+ **********************************************************************
+ *
+ * CONSTANTS
+ *
+ **********************************************************************
+ */
+
+ private static final int MAX_COUNT = 10;
+ private static final int MIN_COUNT = 2;
+
+ /*
+ **********************************************************************
+ *
+ * CONSTRUCTORS
+ *
+ **********************************************************************
+ */
+
+ public CalculatorMatrixEditFragment() {
+ super(CalculatorFragmentType.matrix_edit);
+ }
+
+ @Override
+ public void onViewCreated(View root, Bundle savedInstanceState) {
+ super.onViewCreated(root, savedInstanceState);
+
+ final Picker matrixRowsCountPicker = (Picker) root.findViewById(R.id.matrix_rows_count_picker);
+ initPicker(matrixRowsCountPicker);
+ final Picker matrixColsCountPicker = (Picker) root.findViewById(R.id.matrix_cols_count_picker);
+ initPicker(matrixColsCountPicker);
+
+ getMatrixTable(root);
+ }
+
+ @NotNull
+ private TableLayout getMatrixTable(@NotNull View root) {
+ return (TableLayout) root.findViewById(R.id.matrix_layout);
+ }
+
+ private void initPicker(@NotNull Picker picker) {
+ picker.setRange(new IntegerRange(MIN_COUNT, MAX_COUNT, 1, 2, null));
+ picker.setOnChangeListener(this);
+ }
+
+ @Override
+ public void onChanged(@NotNull Picker picker, @NotNull Integer value) {
+ switch (picker.getId()) {
+ case R.id.matrix_rows_count_picker:
+ onRowsCountChange(value);
+ break;
+ case R.id.matrix_cols_count_picker:
+ onColsCountChange(value);
+ break;
+ }
+ }
+
+ private void onColsCountChange(@NotNull Integer cols) {
+ final TableLayout matrixTable = getMatrixTable(getView());
+ }
+
+ private void onRowsCountChange(@NotNull Integer rows) {
+ }
+}