diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d1820689..42fe7268 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -87,7 +87,7 @@
android:label="@string/c_functions" />
- constant_changed,
-
- // @Nonnull IConstant
- constant_removed,
-
-
- // @Nonnull Function
- function_removed,
-
- /*
+ /*
**********************************************************************
*
* OTHER
diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentType.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentType.java
index 92c6dbbf..a7b5faa5 100644
--- a/app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentType.java
+++ b/app/src/main/java/org/solovyev/android/calculator/CalculatorFragmentType.java
@@ -28,8 +28,8 @@ import org.solovyev.android.calculator.about.CalculatorAboutFragment;
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
import org.solovyev.android.calculator.history.RecentHistoryFragment;
import org.solovyev.android.calculator.history.SavedHistoryFragment;
-import org.solovyev.android.calculator.math.edit.FunctionsFragment;
-import org.solovyev.android.calculator.math.edit.OperatorsFragment;
+import org.solovyev.android.calculator.functions.FunctionsFragment;
+import org.solovyev.android.calculator.operators.OperatorsFragment;
import org.solovyev.android.calculator.variables.VariablesFragment;
import org.solovyev.android.calculator.matrix.CalculatorMatrixEditFragment;
import org.solovyev.android.calculator.plot.CalculatorPlotFragment;
diff --git a/app/src/main/java/org/solovyev/android/calculator/VariablesRegistry.java b/app/src/main/java/org/solovyev/android/calculator/VariablesRegistry.java
index 87057e79..8d66f6cb 100644
--- a/app/src/main/java/org/solovyev/android/calculator/VariablesRegistry.java
+++ b/app/src/main/java/org/solovyev/android/calculator/VariablesRegistry.java
@@ -56,7 +56,7 @@ public class VariablesRegistry extends BaseEntitiesRegistry {
public static final String ANS = "ans";
@Nonnull
- private static final Map substitutes = new HashMap();
+ private static final Map substitutes = new HashMap<>();
static {
substitutes.put("π", "pi");
diff --git a/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesFragment.java b/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesFragment.java
index b9156799..4b1a018b 100644
--- a/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesFragment.java
+++ b/app/src/main/java/org/solovyev/android/calculator/entities/BaseEntitiesFragment.java
@@ -242,7 +242,7 @@ public abstract class BaseEntitiesFragment extends BaseFra
}
}
- public class EntitiesAdapter extends RecyclerView.Adapter {
+ private class EntitiesAdapter extends RecyclerView.Adapter {
@Nonnull
private final LayoutInflater inflater;
@Nonnull
diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsFragment.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsFragment.java
similarity index 98%
rename from app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsFragment.java
rename to app/src/main/java/org/solovyev/android/calculator/functions/FunctionsFragment.java
index c8329d16..b1425b77 100644
--- a/app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsFragment.java
+++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsFragment.java
@@ -20,7 +20,7 @@
* Site: http://se.solovyev.org
*/
-package org.solovyev.android.calculator.math.edit;
+package org.solovyev.android.calculator.functions;
import android.content.DialogInterface;
import android.os.Bundle;
@@ -36,7 +36,6 @@ import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.entities.BaseEntitiesFragment;
import org.solovyev.android.calculator.entities.Category;
import org.solovyev.android.calculator.entities.EntityRemovalDialog;
-import org.solovyev.android.calculator.functions.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/MathEntityRemover.java b/app/src/main/java/org/solovyev/android/calculator/math/edit/MathEntityRemover.java
deleted file mode 100644
index cd18e3d6..00000000
--- a/app/src/main/java/org/solovyev/android/calculator/math/edit/MathEntityRemover.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2013 serso aka se.solovyev
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- * Contact details
- *
- * Email: se.solovyev@gmail.com
- * Site: http://se.solovyev.org
- */
-
-package org.solovyev.android.calculator.math.edit;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.view.View;
-import android.widget.TextView;
-
-import org.solovyev.android.calculator.CalculatorEventType;
-import org.solovyev.android.calculator.EntitiesRegistry;
-import org.solovyev.android.calculator.Locator;
-import org.solovyev.android.calculator.R;
-import org.solovyev.common.math.MathEntity;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import jscl.math.function.IConstant;
-
-/**
- * User: serso
- * Date: 12/22/11
- * Time: 9:36 PM
- */
-public class MathEntityRemover implements View.OnClickListener, DialogInterface.OnClickListener {
-
- @Nonnull
- private final T mathEntity;
-
- @Nullable
- private final DialogInterface.OnClickListener callbackOnCancel;
-
- private final boolean confirmed;
-
- @Nonnull
- private final EntitiesRegistry super T> varsRegistry;
- @Nonnull
- private final Object source;
- @Nonnull
- private final Params params;
- @Nonnull
- private Context context;
-
- /*
- **********************************************************************
- *
- * CONSTRUCTORS
- *
- **********************************************************************
- */
-
- private MathEntityRemover(@Nonnull T mathEntity,
- @Nullable DialogInterface.OnClickListener callbackOnCancel,
- boolean confirmed,
- @Nonnull EntitiesRegistry super T> varsRegistry,
- @Nonnull Context context,
- @Nonnull Object source,
- @Nonnull Params params) {
- this.mathEntity = mathEntity;
- this.callbackOnCancel = callbackOnCancel;
- this.confirmed = confirmed;
- this.varsRegistry = varsRegistry;
- this.context = context;
- this.source = source;
- this.params = params;
- }
-
- public static MathEntityRemover newConstantRemover(@Nonnull IConstant constant,
- @Nullable DialogInterface.OnClickListener callbackOnCancel,
- @Nonnull Context context,
- @Nonnull Object source) {
- return new MathEntityRemover(constant, callbackOnCancel, false, Locator.getInstance().getEngine().getVariablesRegistry(), context, source, Params.newConstantInstance());
- }
-
- /*
- **********************************************************************
- *
- * METHODS
- *
- **********************************************************************
- */
-
-
- public void showConfirmationDialog() {
- final TextView question = new TextView(context);
- question.setText(String.format(context.getString(params.getRemovalConfirmationQuestionResId()), mathEntity.getName()));
- question.setPadding(6, 6, 6, 6);
- final AlertDialog.Builder builder = new AlertDialog.Builder(context)
- .setCancelable(true)
- .setView(question)
- .setTitle(params.getRemovalConfirmationTitleResId())
- .setNegativeButton(R.string.c_no, callbackOnCancel)
- .setPositiveButton(R.string.c_yes, new MathEntityRemover(mathEntity, callbackOnCancel, true, varsRegistry, context, source, params));
-
- builder.create().show();
- }
-
- @Override
- public void onClick(@Nullable View v) {
- if (!confirmed) {
- showConfirmationDialog();
- } else {
- varsRegistry.remove(mathEntity);
- varsRegistry.save();
-
- Locator.getInstance().getCalculator().fireCalculatorEvent(params.getCalculatorEventType(), mathEntity, source);
- }
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- onClick(null);
- }
-
- /*
- **********************************************************************
- *
- * STATIC
- *
- **********************************************************************
- */
-
- private static final class Params {
-
- private int removalConfirmationTitleResId;
-
- private int removalConfirmationQuestionResId;
-
- private CalculatorEventType calculatorEventType;
-
- private Params() {
- }
-
- private static Params newConstantInstance() {
- final Params result = new Params();
- result.removalConfirmationTitleResId = R.string.removal_confirmation;
- result.removalConfirmationQuestionResId = R.string.c_var_removal_confirmation_question;
- result.calculatorEventType = CalculatorEventType.constant_removed;
- return result;
- }
-
- public int getRemovalConfirmationTitleResId() {
- return removalConfirmationTitleResId;
- }
-
- public int getRemovalConfirmationQuestionResId() {
- return removalConfirmationQuestionResId;
- }
-
- public CalculatorEventType getCalculatorEventType() {
- return calculatorEventType;
- }
- }
-}
diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/OperatorsActivity.java b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsActivity.java
similarity index 65%
rename from app/src/main/java/org/solovyev/android/calculator/math/edit/OperatorsActivity.java
rename to app/src/main/java/org/solovyev/android/calculator/operators/OperatorsActivity.java
index 32c17e4d..497e7155 100644
--- a/app/src/main/java/org/solovyev/android/calculator/math/edit/OperatorsActivity.java
+++ b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsActivity.java
@@ -20,18 +20,10 @@
* Site: http://se.solovyev.org
*/
-package org.solovyev.android.calculator.math.edit;
+package org.solovyev.android.calculator.operators;
import android.os.Bundle;
-
-import org.solovyev.android.calculator.BaseActivity;
-import org.solovyev.android.calculator.CalculatorEventData;
-import org.solovyev.android.calculator.CalculatorEventListener;
-import org.solovyev.android.calculator.CalculatorEventType;
-import org.solovyev.android.calculator.CalculatorFragmentType;
-import org.solovyev.android.calculator.entities.BaseEntitiesFragment;
-import org.solovyev.android.calculator.operators.OperatorCategory;
-import org.solovyev.android.calculator.R;
+import org.solovyev.android.calculator.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -46,10 +38,8 @@ public class OperatorsActivity extends BaseActivity implements CalculatorEventLi
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- final CalculatorFragmentType fragmentType = CalculatorFragmentType.operators;
-
for (OperatorCategory category : OperatorCategory.values()) {
- ui.addTab(this, fragmentType.createSubFragmentTag(category.name()), fragmentType.getFragmentClass(), BaseEntitiesFragment.createBundleFor(category.name()), category.title(), R.id.main_layout);
+ addTab(category, CalculatorFragmentType.operators);
}
}
diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/OperatorsFragment.java b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsFragment.java
similarity index 98%
rename from app/src/main/java/org/solovyev/android/calculator/math/edit/OperatorsFragment.java
rename to app/src/main/java/org/solovyev/android/calculator/operators/OperatorsFragment.java
index 5497d0ee..14c003fd 100644
--- a/app/src/main/java/org/solovyev/android/calculator/math/edit/OperatorsFragment.java
+++ b/app/src/main/java/org/solovyev/android/calculator/operators/OperatorsFragment.java
@@ -20,7 +20,7 @@
* Site: http://se.solovyev.org
*/
-package org.solovyev.android.calculator.math.edit;
+package org.solovyev.android.calculator.operators;
import android.support.annotation.NonNull;
import android.view.ContextMenu;