From 9d2f739e22a1f99b52be58258021826cbf350ac0 Mon Sep 17 00:00:00 2001 From: serso Date: Fri, 29 Jan 2016 21:23:18 +0100 Subject: [PATCH] function package changed to functions --- app/src/main/AndroidManifest.xml | 2 +- .../android/calculator/AppComponent.java | 2 +- .../CalculatorActivityLauncher.java | 6 ++--- .../android/calculator/CalculatorImpl.java | 1 + .../solovyev/android/calculator/Engine.java | 1 + .../android/calculator/OperatorsRegistry.java | 2 +- .../calculator/PostfixFunctionsRegistry.java | 1 + .../android/calculator/VariablesRegistry.java | 1 + .../{ => entities}/BaseEntitiesRegistry.java | 26 +++++++++---------- .../{function => functions}/CppFunction.java | 2 +- .../EditFunctionFragment.java | 5 ++-- .../FunctionCategory.java | 2 +- .../FunctionParamsView.java | 2 +- .../FunctionRemovalDialog.java | 2 +- .../edit => functions}/FunctionsActivity.java | 8 +++--- .../{ => functions}/FunctionsRegistry.java | 26 +++++++------------ .../{function => functions}/OldFunction.java | 2 +- .../{function => functions}/OldFunctions.java | 2 +- .../math/edit/FunctionsFragment.java | 4 +-- .../calculator/variables/CppVariable.java | 2 +- .../calculator/variables/JsclConstant.java | 8 +++--- .../res/layout/fragment_function_edit.xml | 2 +- .../calculator/CalculatorTestUtils.java | 1 + .../calculator/model/OldFunctionsTest.java | 4 +-- 24 files changed, 51 insertions(+), 63 deletions(-) rename app/src/main/java/org/solovyev/android/calculator/{ => entities}/BaseEntitiesRegistry.java (95%) rename app/src/main/java/org/solovyev/android/calculator/{function => functions}/CppFunction.java (99%) rename app/src/main/java/org/solovyev/android/calculator/{function => functions}/EditFunctionFragment.java (99%) rename app/src/main/java/org/solovyev/android/calculator/{function => functions}/FunctionCategory.java (98%) rename app/src/main/java/org/solovyev/android/calculator/{function => functions}/FunctionParamsView.java (99%) rename app/src/main/java/org/solovyev/android/calculator/{function => functions}/FunctionRemovalDialog.java (97%) rename app/src/main/java/org/solovyev/android/calculator/{math/edit => functions}/FunctionsActivity.java (84%) rename app/src/main/java/org/solovyev/android/calculator/{ => functions}/FunctionsRegistry.java (94%) rename app/src/main/java/org/solovyev/android/calculator/{function => functions}/OldFunction.java (96%) rename app/src/main/java/org/solovyev/android/calculator/{function => functions}/OldFunctions.java (97%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ebcdd071..3b3cf64b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -83,7 +83,7 @@ android:label="@string/c_about" /> implements EntitiesRegistry { @Nonnull @@ -65,18 +63,18 @@ public abstract class BaseEntitiesRegistry implements Enti @NonNull private final WriteTask writeTask = new WriteTask(); @Inject - Handler handler; + public Handler handler; @Inject - SharedPreferences preferences; + public SharedPreferences preferences; @Inject - Application application; + public Application application; @Inject - Bus bus; + public Bus bus; @Inject - ErrorReporter errorReporter; + public ErrorReporter errorReporter; @Inject @Named(AppModule.THREAD_BACKGROUND) - Executor backgroundThread; + public Executor backgroundThread; // synchronized on lock private boolean initialized; diff --git a/app/src/main/java/org/solovyev/android/calculator/function/CppFunction.java b/app/src/main/java/org/solovyev/android/calculator/functions/CppFunction.java similarity index 99% rename from app/src/main/java/org/solovyev/android/calculator/function/CppFunction.java rename to app/src/main/java/org/solovyev/android/calculator/functions/CppFunction.java index edc36353..e7f103c0 100644 --- a/app/src/main/java/org/solovyev/android/calculator/function/CppFunction.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/CppFunction.java @@ -1,4 +1,4 @@ -package org.solovyev.android.calculator.function; +package org.solovyev.android.calculator.functions; import android.os.Parcel; import android.os.Parcelable; diff --git a/app/src/main/java/org/solovyev/android/calculator/function/EditFunctionFragment.java b/app/src/main/java/org/solovyev/android/calculator/functions/EditFunctionFragment.java similarity index 99% rename from app/src/main/java/org/solovyev/android/calculator/function/EditFunctionFragment.java rename to app/src/main/java/org/solovyev/android/calculator/functions/EditFunctionFragment.java index 892477c4..169ac3e7 100644 --- a/app/src/main/java/org/solovyev/android/calculator/function/EditFunctionFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/EditFunctionFragment.java @@ -20,7 +20,7 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator.function; +package org.solovyev.android.calculator.functions; import android.annotation.SuppressLint; import android.content.Context; @@ -45,7 +45,6 @@ import butterknife.ButterKnife; import jscl.math.function.Function; import org.solovyev.android.Check; import org.solovyev.android.calculator.*; -import org.solovyev.android.calculator.math.edit.FunctionsActivity; import org.solovyev.android.calculator.math.edit.VarEditorSaver; import org.solovyev.android.calculator.view.EditTextCompat; import org.solovyev.common.math.MathRegistry; @@ -55,7 +54,7 @@ import javax.annotation.Nullable; import javax.inject.Inject; import java.util.*; -import static org.solovyev.android.calculator.function.CppFunction.NO_ID; +import static org.solovyev.android.calculator.functions.CppFunction.NO_ID; public class EditFunctionFragment extends BaseDialogFragment implements View.OnClickListener, View.OnFocusChangeListener, View.OnKeyListener { diff --git a/app/src/main/java/org/solovyev/android/calculator/function/FunctionCategory.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionCategory.java similarity index 98% rename from app/src/main/java/org/solovyev/android/calculator/function/FunctionCategory.java rename to app/src/main/java/org/solovyev/android/calculator/functions/FunctionCategory.java index 06560ded..eb0b9739 100644 --- a/app/src/main/java/org/solovyev/android/calculator/function/FunctionCategory.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionCategory.java @@ -20,7 +20,7 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator.function; +package org.solovyev.android.calculator.functions; import android.support.annotation.StringRes; diff --git a/app/src/main/java/org/solovyev/android/calculator/function/FunctionParamsView.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionParamsView.java similarity index 99% rename from app/src/main/java/org/solovyev/android/calculator/function/FunctionParamsView.java rename to app/src/main/java/org/solovyev/android/calculator/functions/FunctionParamsView.java index 69d25caf..06f72323 100644 --- a/app/src/main/java/org/solovyev/android/calculator/function/FunctionParamsView.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionParamsView.java @@ -20,7 +20,7 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator.function; +package org.solovyev.android.calculator.functions; import android.annotation.TargetApi; import android.content.Context; diff --git a/app/src/main/java/org/solovyev/android/calculator/function/FunctionRemovalDialog.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionRemovalDialog.java similarity index 97% rename from app/src/main/java/org/solovyev/android/calculator/function/FunctionRemovalDialog.java rename to app/src/main/java/org/solovyev/android/calculator/functions/FunctionRemovalDialog.java index 00a805fb..a880ebaf 100644 --- a/app/src/main/java/org/solovyev/android/calculator/function/FunctionRemovalDialog.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionRemovalDialog.java @@ -1,4 +1,4 @@ -package org.solovyev.android.calculator.function; +package org.solovyev.android.calculator.functions; import android.app.Activity; import android.content.DialogInterface; diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsActivity.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsActivity.java similarity index 84% rename from app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsActivity.java rename to app/src/main/java/org/solovyev/android/calculator/functions/FunctionsActivity.java index def4542d..e0ab2801 100644 --- a/app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsActivity.java @@ -20,14 +20,14 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator.math.edit; +package org.solovyev.android.calculator.functions; import android.os.Bundle; import android.os.Parcelable; import org.solovyev.android.calculator.BaseActivity; import org.solovyev.android.calculator.CalculatorFragmentType; -import org.solovyev.android.calculator.function.FunctionCategory; import org.solovyev.android.calculator.R; +import org.solovyev.android.calculator.math.edit.FunctionsFragment; import javax.annotation.Nullable; @@ -46,15 +46,13 @@ public class FunctionsActivity extends BaseActivity { final Bundle extras = getIntent().getExtras(); final Parcelable function = extras != null ? extras.getParcelable(EXTRA_FUNCTION) : null; - final CalculatorFragmentType fragmentType = CalculatorFragmentType.functions; - for (FunctionCategory category : FunctionCategory.values()) { final Bundle arguments = new Bundle(2); if (category == FunctionCategory.my && function != null) { arguments.putParcelable(FunctionsFragment.ARG_FUNCTION, function); } arguments.putString(FunctionsFragment.ARG_CATEGORY, category.name()); - ui.addTab(this, fragmentType.createSubFragmentTag(category.name()), fragmentType.getFragmentClass(), arguments, category.title, R.id.main_layout); + ui.addTab(this, CalculatorFragmentType.functions.createSubFragmentTag(category.name()), CalculatorFragmentType.functions.getFragmentClass(), arguments, category.title, R.id.main_layout); } } } diff --git a/app/src/main/java/org/solovyev/android/calculator/FunctionsRegistry.java b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsRegistry.java similarity index 94% rename from app/src/main/java/org/solovyev/android/calculator/FunctionsRegistry.java rename to app/src/main/java/org/solovyev/android/calculator/functions/FunctionsRegistry.java index bda58f7e..4330d1ee 100644 --- a/app/src/main/java/org/solovyev/android/calculator/FunctionsRegistry.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/FunctionsRegistry.java @@ -20,40 +20,32 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator; +package org.solovyev.android.calculator.functions; import android.support.annotation.NonNull; - +import jscl.JsclMathEngine; +import jscl.math.function.CustomFunction; +import jscl.math.function.Function; +import jscl.math.function.IFunction; import org.simpleframework.xml.Serializer; import org.simpleframework.xml.core.Persister; import org.solovyev.android.Check; +import org.solovyev.android.calculator.entities.BaseEntitiesRegistry; +import org.solovyev.android.calculator.Calculator; import org.solovyev.android.calculator.entities.Category; import org.solovyev.android.calculator.entities.Entities; -import org.solovyev.android.calculator.function.CppFunction; -import org.solovyev.android.calculator.function.FunctionCategory; import org.solovyev.android.calculator.json.Json; import org.solovyev.android.calculator.json.Jsonable; -import org.solovyev.android.calculator.function.OldFunctions; import org.solovyev.android.io.FileSaver; import org.solovyev.common.JBuilder; import org.solovyev.common.text.Strings; -import java.io.File; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Singleton; - -import jscl.JsclMathEngine; -import jscl.math.function.CustomFunction; -import jscl.math.function.Function; -import jscl.math.function.IFunction; +import java.io.File; +import java.util.*; import static android.text.TextUtils.isEmpty; diff --git a/app/src/main/java/org/solovyev/android/calculator/function/OldFunction.java b/app/src/main/java/org/solovyev/android/calculator/functions/OldFunction.java similarity index 96% rename from app/src/main/java/org/solovyev/android/calculator/function/OldFunction.java rename to app/src/main/java/org/solovyev/android/calculator/functions/OldFunction.java index 100c944d..59eeae55 100644 --- a/app/src/main/java/org/solovyev/android/calculator/function/OldFunction.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/OldFunction.java @@ -20,7 +20,7 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator.function; +package org.solovyev.android.calculator.functions; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; diff --git a/app/src/main/java/org/solovyev/android/calculator/function/OldFunctions.java b/app/src/main/java/org/solovyev/android/calculator/functions/OldFunctions.java similarity index 97% rename from app/src/main/java/org/solovyev/android/calculator/function/OldFunctions.java rename to app/src/main/java/org/solovyev/android/calculator/functions/OldFunctions.java index 3fad7aa0..418c93fe 100644 --- a/app/src/main/java/org/solovyev/android/calculator/function/OldFunctions.java +++ b/app/src/main/java/org/solovyev/android/calculator/functions/OldFunctions.java @@ -20,7 +20,7 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator.function; +package org.solovyev.android.calculator.functions; import android.text.TextUtils; diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsFragment.java b/app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsFragment.java index 1f209d1f..e97bd18c 100644 --- a/app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/math/edit/FunctionsFragment.java @@ -34,9 +34,7 @@ import jscl.math.function.IFunction; import org.solovyev.android.Check; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.entities.Category; -import org.solovyev.android.calculator.function.CppFunction; -import org.solovyev.android.calculator.function.EditFunctionFragment; -import org.solovyev.android.calculator.function.FunctionRemovalDialog; +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/variables/CppVariable.java b/app/src/main/java/org/solovyev/android/calculator/variables/CppVariable.java index 6161741c..4a68d40d 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/CppVariable.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/CppVariable.java @@ -6,7 +6,7 @@ import android.text.TextUtils; import org.json.JSONException; import org.json.JSONObject; import org.solovyev.android.Check; -import org.solovyev.android.calculator.function.CppFunction; +import org.solovyev.android.calculator.functions.CppFunction; import org.solovyev.android.calculator.json.Json; import org.solovyev.android.calculator.json.Jsonable; import org.solovyev.common.JBuilder; diff --git a/app/src/main/java/org/solovyev/android/calculator/variables/JsclConstant.java b/app/src/main/java/org/solovyev/android/calculator/variables/JsclConstant.java index 2203f372..ddc46938 100644 --- a/app/src/main/java/org/solovyev/android/calculator/variables/JsclConstant.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/JsclConstant.java @@ -1,16 +1,14 @@ package org.solovyev.android.calculator.variables; import com.google.common.base.Strings; - -import org.solovyev.android.calculator.function.CppFunction; +import jscl.math.function.Constant; +import jscl.math.function.IConstant; +import org.solovyev.android.calculator.functions.CppFunction; import org.solovyev.common.math.MathEntity; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import jscl.math.function.Constant; -import jscl.math.function.IConstant; - class JsclConstant extends CppVariable implements IConstant { private Double doubleValue; diff --git a/app/src/main/res/layout/fragment_function_edit.xml b/app/src/main/res/layout/fragment_function_edit.xml index 42f4555a..81a19de8 100644 --- a/app/src/main/res/layout/fragment_function_edit.xml +++ b/app/src/main/res/layout/fragment_function_edit.xml @@ -44,7 +44,7 @@ a:inputType="text" /> -