function package changed to functions

This commit is contained in:
serso 2016-01-29 21:23:18 +01:00
parent 9c71e329cd
commit 9d2f739e22
24 changed files with 51 additions and 63 deletions

View File

@ -83,7 +83,7 @@
android:label="@string/c_about" /> android:label="@string/c_about" />
<activity <activity
android:name=".math.edit.FunctionsActivity" android:name=".functions.FunctionsActivity"
android:label="@string/c_functions" /> android:label="@string/c_functions" />
<activity <activity

View File

@ -1,6 +1,6 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import org.solovyev.android.calculator.function.EditFunctionFragment; import org.solovyev.android.calculator.functions.EditFunctionFragment;
import org.solovyev.android.calculator.history.BaseHistoryFragment; import org.solovyev.android.calculator.history.BaseHistoryFragment;
import org.solovyev.android.calculator.history.EditHistoryFragment; import org.solovyev.android.calculator.history.EditHistoryFragment;
import org.solovyev.android.calculator.math.edit.FunctionsFragment; import org.solovyev.android.calculator.math.edit.FunctionsFragment;

View File

@ -36,10 +36,10 @@ import android.widget.TextView;
import org.solovyev.android.Activities; import org.solovyev.android.Activities;
import org.solovyev.android.calculator.about.CalculatorAboutActivity; import org.solovyev.android.calculator.about.CalculatorAboutActivity;
import org.solovyev.android.calculator.function.CppFunction; import org.solovyev.android.calculator.functions.CppFunction;
import org.solovyev.android.calculator.function.EditFunctionFragment; import org.solovyev.android.calculator.functions.EditFunctionFragment;
import org.solovyev.android.calculator.history.CalculatorHistoryActivity; import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
import org.solovyev.android.calculator.math.edit.FunctionsActivity; import org.solovyev.android.calculator.functions.FunctionsActivity;
import org.solovyev.android.calculator.math.edit.OperatorsActivity; import org.solovyev.android.calculator.math.edit.OperatorsActivity;
import org.solovyev.android.calculator.math.edit.CalculatorVarsActivity; import org.solovyev.android.calculator.math.edit.CalculatorVarsActivity;
import org.solovyev.android.calculator.math.edit.VarEditDialogFragment; import org.solovyev.android.calculator.math.edit.VarEditDialogFragment;

View File

@ -35,6 +35,7 @@ import jscl.math.Generic;
import jscl.math.function.IConstant; import jscl.math.function.IConstant;
import jscl.math.operator.Operator; import jscl.math.operator.Operator;
import jscl.text.ParseInterruptedException; import jscl.text.ParseInterruptedException;
import org.solovyev.android.calculator.functions.FunctionsRegistry;
import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.android.calculator.jscl.JsclOperation;
import org.solovyev.android.calculator.units.CalculatorNumeralBase; import org.solovyev.android.calculator.units.CalculatorNumeralBase;
import org.solovyev.android.calculator.variables.CppVariable; import org.solovyev.android.calculator.variables.CppVariable;

View File

@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import com.squareup.otto.Bus; import com.squareup.otto.Bus;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.functions.FunctionsRegistry;
import org.solovyev.android.prefs.BooleanPreference; import org.solovyev.android.prefs.BooleanPreference;
import org.solovyev.android.prefs.IntegerPreference; import org.solovyev.android.prefs.IntegerPreference;
import org.solovyev.android.prefs.Preference; import org.solovyev.android.prefs.Preference;

View File

@ -24,9 +24,9 @@ package org.solovyev.android.calculator;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import org.solovyev.android.calculator.entities.BaseEntitiesRegistry;
import org.solovyev.android.calculator.entities.Category; import org.solovyev.android.calculator.entities.Category;
import org.solovyev.android.calculator.entities.Entities; import org.solovyev.android.calculator.entities.Entities;
import org.solovyev.android.calculator.function.FunctionCategory;
import org.solovyev.android.calculator.json.Jsonable; import org.solovyev.android.calculator.json.Jsonable;
import org.solovyev.android.calculator.operators.OperatorCategory; import org.solovyev.android.calculator.operators.OperatorCategory;
import org.solovyev.common.math.MathRegistry; import org.solovyev.common.math.MathRegistry;

View File

@ -24,6 +24,7 @@ package org.solovyev.android.calculator;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import org.solovyev.android.calculator.entities.BaseEntitiesRegistry;
import org.solovyev.android.calculator.entities.Category; import org.solovyev.android.calculator.entities.Category;
import org.solovyev.android.calculator.entities.Entities; import org.solovyev.android.calculator.entities.Entities;
import org.solovyev.android.calculator.json.Jsonable; import org.solovyev.android.calculator.json.Jsonable;

View File

@ -29,6 +29,7 @@ import com.google.common.base.Strings;
import org.simpleframework.xml.Serializer; import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister; import org.simpleframework.xml.core.Persister;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.entities.BaseEntitiesRegistry;
import org.solovyev.android.calculator.entities.Category; import org.solovyev.android.calculator.entities.Category;
import org.solovyev.android.calculator.entities.Entities; import org.solovyev.android.calculator.entities.Entities;
import org.solovyev.android.calculator.json.Json; import org.solovyev.android.calculator.json.Json;

View File

@ -20,7 +20,7 @@
* Site: http://se.solovyev.org * Site: http://se.solovyev.org
*/ */
package org.solovyev.android.calculator; package org.solovyev.android.calculator.entities;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
@ -28,12 +28,11 @@ import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Handler; import android.os.Handler;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import com.squareup.otto.Bus; import com.squareup.otto.Bus;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.json.Json; import org.solovyev.android.calculator.json.Json;
import org.solovyev.android.calculator.json.Jsonable; import org.solovyev.android.calculator.json.Jsonable;
import org.solovyev.android.io.FileSaver; import org.solovyev.android.io.FileSaver;
@ -41,6 +40,10 @@ import org.solovyev.common.JBuilder;
import org.solovyev.common.math.MathEntity; import org.solovyev.common.math.MathEntity;
import org.solovyev.common.math.MathRegistry; import org.solovyev.common.math.MathRegistry;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -49,11 +52,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Named;
public abstract class BaseEntitiesRegistry<T extends MathEntity> implements EntitiesRegistry<T> { public abstract class BaseEntitiesRegistry<T extends MathEntity> implements EntitiesRegistry<T> {
@Nonnull @Nonnull
@ -65,18 +63,18 @@ public abstract class BaseEntitiesRegistry<T extends MathEntity> implements Enti
@NonNull @NonNull
private final WriteTask writeTask = new WriteTask(); private final WriteTask writeTask = new WriteTask();
@Inject @Inject
Handler handler; public Handler handler;
@Inject @Inject
SharedPreferences preferences; public SharedPreferences preferences;
@Inject @Inject
Application application; public Application application;
@Inject @Inject
Bus bus; public Bus bus;
@Inject @Inject
ErrorReporter errorReporter; public ErrorReporter errorReporter;
@Inject @Inject
@Named(AppModule.THREAD_BACKGROUND) @Named(AppModule.THREAD_BACKGROUND)
Executor backgroundThread; public Executor backgroundThread;
// synchronized on lock // synchronized on lock
private boolean initialized; private boolean initialized;

View File

@ -1,4 +1,4 @@
package org.solovyev.android.calculator.function; package org.solovyev.android.calculator.functions;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;

View File

@ -20,7 +20,7 @@
* Site: http://se.solovyev.org * Site: http://se.solovyev.org
*/ */
package org.solovyev.android.calculator.function; package org.solovyev.android.calculator.functions;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
@ -45,7 +45,6 @@ import butterknife.ButterKnife;
import jscl.math.function.Function; import jscl.math.function.Function;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.*; 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.math.edit.VarEditorSaver;
import org.solovyev.android.calculator.view.EditTextCompat; import org.solovyev.android.calculator.view.EditTextCompat;
import org.solovyev.common.math.MathRegistry; import org.solovyev.common.math.MathRegistry;
@ -55,7 +54,7 @@ import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.*; 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 { public class EditFunctionFragment extends BaseDialogFragment implements View.OnClickListener, View.OnFocusChangeListener, View.OnKeyListener {

View File

@ -20,7 +20,7 @@
* Site: http://se.solovyev.org * Site: http://se.solovyev.org
*/ */
package org.solovyev.android.calculator.function; package org.solovyev.android.calculator.functions;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;

View File

@ -20,7 +20,7 @@
* Site: http://se.solovyev.org * Site: http://se.solovyev.org
*/ */
package org.solovyev.android.calculator.function; package org.solovyev.android.calculator.functions;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;

View File

@ -1,4 +1,4 @@
package org.solovyev.android.calculator.function; package org.solovyev.android.calculator.functions;
import android.app.Activity; import android.app.Activity;
import android.content.DialogInterface; import android.content.DialogInterface;

View File

@ -20,14 +20,14 @@
* Site: http://se.solovyev.org * 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.Bundle;
import android.os.Parcelable; import android.os.Parcelable;
import org.solovyev.android.calculator.BaseActivity; import org.solovyev.android.calculator.BaseActivity;
import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.function.FunctionCategory;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.math.edit.FunctionsFragment;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -46,15 +46,13 @@ public class FunctionsActivity extends BaseActivity {
final Bundle extras = getIntent().getExtras(); final Bundle extras = getIntent().getExtras();
final Parcelable function = extras != null ? extras.getParcelable(EXTRA_FUNCTION) : null; final Parcelable function = extras != null ? extras.getParcelable(EXTRA_FUNCTION) : null;
final CalculatorFragmentType fragmentType = CalculatorFragmentType.functions;
for (FunctionCategory category : FunctionCategory.values()) { for (FunctionCategory category : FunctionCategory.values()) {
final Bundle arguments = new Bundle(2); final Bundle arguments = new Bundle(2);
if (category == FunctionCategory.my && function != null) { if (category == FunctionCategory.my && function != null) {
arguments.putParcelable(FunctionsFragment.ARG_FUNCTION, function); arguments.putParcelable(FunctionsFragment.ARG_FUNCTION, function);
} }
arguments.putString(FunctionsFragment.ARG_CATEGORY, category.name()); 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);
} }
} }
} }

View File

@ -20,40 +20,32 @@
* Site: http://se.solovyev.org * Site: http://se.solovyev.org
*/ */
package org.solovyev.android.calculator; package org.solovyev.android.calculator.functions;
import android.support.annotation.NonNull; 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.Serializer;
import org.simpleframework.xml.core.Persister; import org.simpleframework.xml.core.Persister;
import org.solovyev.android.Check; 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.Category;
import org.solovyev.android.calculator.entities.Entities; 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.Json;
import org.solovyev.android.calculator.json.Jsonable; import org.solovyev.android.calculator.json.Jsonable;
import org.solovyev.android.calculator.function.OldFunctions;
import org.solovyev.android.io.FileSaver; import org.solovyev.android.io.FileSaver;
import org.solovyev.common.JBuilder; import org.solovyev.common.JBuilder;
import org.solovyev.common.text.Strings; 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.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import java.io.File;
import jscl.JsclMathEngine; import java.util.*;
import jscl.math.function.CustomFunction;
import jscl.math.function.Function;
import jscl.math.function.IFunction;
import static android.text.TextUtils.isEmpty; import static android.text.TextUtils.isEmpty;

View File

@ -20,7 +20,7 @@
* Site: http://se.solovyev.org * 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.Element;
import org.simpleframework.xml.ElementList; import org.simpleframework.xml.ElementList;

View File

@ -20,7 +20,7 @@
* Site: http://se.solovyev.org * Site: http://se.solovyev.org
*/ */
package org.solovyev.android.calculator.function; package org.solovyev.android.calculator.functions;
import android.text.TextUtils; import android.text.TextUtils;

View File

@ -34,9 +34,7 @@ import jscl.math.function.IFunction;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.entities.Category; import org.solovyev.android.calculator.entities.Category;
import org.solovyev.android.calculator.function.CppFunction; import org.solovyev.android.calculator.functions.*;
import org.solovyev.android.calculator.function.EditFunctionFragment;
import org.solovyev.android.calculator.function.FunctionRemovalDialog;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;

View File

@ -6,7 +6,7 @@ import android.text.TextUtils;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.solovyev.android.Check; 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.Json;
import org.solovyev.android.calculator.json.Jsonable; import org.solovyev.android.calculator.json.Jsonable;
import org.solovyev.common.JBuilder; import org.solovyev.common.JBuilder;

View File

@ -1,16 +1,14 @@
package org.solovyev.android.calculator.variables; package org.solovyev.android.calculator.variables;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import jscl.math.function.Constant;
import org.solovyev.android.calculator.function.CppFunction; import jscl.math.function.IConstant;
import org.solovyev.android.calculator.functions.CppFunction;
import org.solovyev.common.math.MathEntity; import org.solovyev.common.math.MathEntity;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import jscl.math.function.Constant;
import jscl.math.function.IConstant;
class JsclConstant extends CppVariable implements IConstant { class JsclConstant extends CppVariable implements IConstant {
private Double doubleValue; private Double doubleValue;

View File

@ -44,7 +44,7 @@
a:inputType="text" /> a:inputType="text" />
</android.support.design.widget.TextInputLayout> </android.support.design.widget.TextInputLayout>
<org.solovyev.android.calculator.function.FunctionParamsView <org.solovyev.android.calculator.functions.FunctionParamsView
a:id="@+id/function_params" a:id="@+id/function_params"
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="wrap_content" a:layout_height="wrap_content"

View File

@ -29,6 +29,7 @@ import com.squareup.otto.Bus;
import org.junit.Assert; import org.junit.Assert;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.robolectric.fakes.RoboSharedPreferences; import org.robolectric.fakes.RoboSharedPreferences;
import org.solovyev.android.calculator.functions.FunctionsRegistry;
import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.android.calculator.jscl.JsclOperation;
import org.solovyev.android.calculator.language.Languages; import org.solovyev.android.calculator.language.Languages;
import org.solovyev.android.calculator.plot.CalculatorPlotter; import org.solovyev.android.calculator.plot.CalculatorPlotter;

View File

@ -30,8 +30,8 @@ import org.junit.Test;
import org.simpleframework.xml.Serializer; import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister; import org.simpleframework.xml.core.Persister;
import org.solovyev.android.calculator.CalculatorTestUtils; import org.solovyev.android.calculator.CalculatorTestUtils;
import org.solovyev.android.calculator.function.OldFunction; import org.solovyev.android.calculator.functions.OldFunction;
import org.solovyev.android.calculator.function.OldFunctions; import org.solovyev.android.calculator.functions.OldFunctions;
import org.solovyev.common.Objects; import org.solovyev.common.Objects;
import org.solovyev.common.equals.CollectionEqualizer; import org.solovyev.common.equals.CollectionEqualizer;