From f13c6dd4930ed95abd4f3bd6e51b266246c84ad1 Mon Sep 17 00:00:00 2001 From: serso Date: Fri, 29 Jan 2016 21:26:48 +0100 Subject: [PATCH] variables package --- app/src/main/AndroidManifest.xml | 2 +- .../android/calculator/AppComponent.java | 2 +- .../CalculatorActivityLauncher.java | 8 +++--- .../calculator/CalculatorFragmentType.java | 2 +- .../math/edit/BaseEntitiesFragment.java | 28 +++++++------------ .../calculator/math/edit/VarEditorSaver.java | 9 +++--- .../VariablesActivity.java} | 10 +++---- .../edit => variables}/VariablesFragment.java | 5 +++- 8 files changed, 30 insertions(+), 36 deletions(-) rename app/src/main/java/org/solovyev/android/calculator/{math/edit/CalculatorVarsActivity.java => variables/VariablesActivity.java} (88%) rename app/src/main/java/org/solovyev/android/calculator/{math/edit => variables}/VariablesFragment.java (96%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3b3cf64b..d1820689 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -91,7 +91,7 @@ android:label="@string/c_operators" /> extends BaseFragment { @@ -74,9 +66,9 @@ public abstract class BaseEntitiesFragment extends BaseFra @Nonnull private final Handler uiHandler = new Handler(); @Bind(R.id.entities_fab) - FloatingActionButton fab; + public FloatingActionButton fab; @Bind(R.id.entities_recyclerview) - RecyclerView recyclerView; + public RecyclerView recyclerView; private EntitiesAdapter adapter; @Nullable private String category; @@ -92,7 +84,7 @@ public abstract class BaseEntitiesFragment extends BaseFra return result; } - static void putCategory(@Nonnull Bundle bundle, @Nonnull String categoryId) { + public static void putCategory(@Nonnull Bundle bundle, @Nonnull String categoryId) { bundle.putString(ARG_CATEGORY, categoryId); } @@ -152,7 +144,7 @@ public abstract class BaseEntitiesFragment extends BaseFra protected abstract List getEntities(); @Nullable - abstract Category getCategory(@Nonnull E e); + protected abstract Category getCategory(@Nonnull E e); protected EntitiesAdapter getAdapter() { return adapter; diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditorSaver.java b/app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditorSaver.java index 10b79aa8..20b8b748 100644 --- a/app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditorSaver.java +++ b/app/src/main/java/org/solovyev/android/calculator/math/edit/VarEditorSaver.java @@ -24,13 +24,16 @@ package org.solovyev.android.calculator.math.edit; import android.view.View; import android.widget.EditText; - +import jscl.text.Identifier; +import jscl.text.ParseException; +import jscl.text.Parser; import org.solovyev.android.calculator.EntitiesRegistry; import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.VariablesRegistry; import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.model.MathEntityBuilder; +import org.solovyev.android.calculator.variables.VariablesFragment; import org.solovyev.common.math.MathEntity; import org.solovyev.common.msg.MessageType; import org.solovyev.common.text.Strings; @@ -38,10 +41,6 @@ import org.solovyev.common.text.Strings; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import jscl.text.Identifier; -import jscl.text.ParseException; -import jscl.text.Parser; - public class VarEditorSaver implements View.OnClickListener { @Nonnull diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsActivity.java b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesActivity.java similarity index 88% rename from app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsActivity.java rename to app/src/main/java/org/solovyev/android/calculator/variables/VariablesActivity.java index 279c4a26..efdfca94 100644 --- a/app/src/main/java/org/solovyev/android/calculator/math/edit/CalculatorVarsActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesActivity.java @@ -20,7 +20,7 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator.math.edit; +package org.solovyev.android.calculator.variables; import android.content.Intent; import android.os.Bundle; @@ -31,15 +31,15 @@ import org.solovyev.android.calculator.CalculatorEventListener; import org.solovyev.android.calculator.CalculatorEventType; import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.R; -import org.solovyev.android.calculator.variables.VariablesCategory; +import org.solovyev.android.calculator.math.edit.BaseEntitiesFragment; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class CalculatorVarsActivity extends BaseActivity implements CalculatorEventListener { +public class VariablesActivity extends BaseActivity implements CalculatorEventListener { - public CalculatorVarsActivity() { - super(R.layout.main_empty, CalculatorVarsActivity.class.getSimpleName()); + public VariablesActivity() { + super(R.layout.main_empty, VariablesActivity.class.getSimpleName()); } @Override diff --git a/app/src/main/java/org/solovyev/android/calculator/math/edit/VariablesFragment.java b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java similarity index 96% rename from app/src/main/java/org/solovyev/android/calculator/math/edit/VariablesFragment.java rename to app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java index 77736301..63c00455 100644 --- a/app/src/main/java/org/solovyev/android/calculator/math/edit/VariablesFragment.java +++ b/app/src/main/java/org/solovyev/android/calculator/variables/VariablesFragment.java @@ -20,7 +20,7 @@ * Site: http://se.solovyev.org */ -package org.solovyev.android.calculator.math.edit; +package org.solovyev.android.calculator.variables; import android.os.Bundle; import android.support.annotation.NonNull; @@ -33,6 +33,9 @@ import jscl.math.function.IConstant; import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.entities.Category; import org.solovyev.android.calculator.math.MathType; +import org.solovyev.android.calculator.math.edit.BaseEntitiesFragment; +import org.solovyev.android.calculator.math.edit.MathEntityRemover; +import org.solovyev.android.calculator.math.edit.VarEditDialogFragment; import org.solovyev.common.JPredicate; import org.solovyev.common.collections.Collections; import org.solovyev.common.text.Strings;