variables package

This commit is contained in:
serso 2016-01-29 21:26:48 +01:00
parent 9d2f739e22
commit f13c6dd493
8 changed files with 30 additions and 36 deletions

View File

@ -91,7 +91,7 @@
android:label="@string/c_operators" />
<activity
android:name=".math.edit.CalculatorVarsActivity"
android:name=".variables.VariablesActivity"
android:label="@string/c_vars_and_constants" />
<activity
android:name=".wizard.WizardActivity"

View File

@ -4,7 +4,7 @@ import org.solovyev.android.calculator.functions.EditFunctionFragment;
import org.solovyev.android.calculator.history.BaseHistoryFragment;
import org.solovyev.android.calculator.history.EditHistoryFragment;
import org.solovyev.android.calculator.math.edit.FunctionsFragment;
import org.solovyev.android.calculator.math.edit.VariablesFragment;
import org.solovyev.android.calculator.variables.VariablesFragment;
import org.solovyev.android.calculator.onscreen.CalculatorOnscreenService;
import javax.inject.Singleton;

View File

@ -41,9 +41,9 @@ import org.solovyev.android.calculator.functions.EditFunctionFragment;
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
import org.solovyev.android.calculator.functions.FunctionsActivity;
import org.solovyev.android.calculator.math.edit.OperatorsActivity;
import org.solovyev.android.calculator.math.edit.CalculatorVarsActivity;
import org.solovyev.android.calculator.variables.VariablesActivity;
import org.solovyev.android.calculator.math.edit.VarEditDialogFragment;
import org.solovyev.android.calculator.math.edit.VariablesFragment;
import org.solovyev.android.calculator.variables.VariablesFragment;
import org.solovyev.android.calculator.matrix.CalculatorMatrixActivity;
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
import org.solovyev.android.calculator.plot.CalculatorPlotter;
@ -126,7 +126,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}
public static void showVars(@Nonnull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
final Intent intent = new Intent(context, VariablesActivity.class);
Activities.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
@ -148,7 +148,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
if (context instanceof AppCompatActivity) {
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromValue(varValue), ((AppCompatActivity) context).getSupportFragmentManager());
} else {
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
final Intent intent = new Intent(context, VariablesActivity.class);
intent.putExtra(VariablesFragment.CREATE_VAR_EXTRA_STRING, varValue);
Activities.addIntentFlags(intent, false, context);
context.startActivity(intent);

View File

@ -30,7 +30,7 @@ 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.math.edit.VariablesFragment;
import org.solovyev.android.calculator.variables.VariablesFragment;
import org.solovyev.android.calculator.matrix.CalculatorMatrixEditFragment;
import org.solovyev.android.calculator.plot.CalculatorPlotFragment;
import org.solovyev.android.calculator.plot.CalculatorPlotFunctionSettingsActivity;

View File

@ -31,35 +31,27 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.ClipboardManager;
import android.text.TextUtils;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.*;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
import com.melnykov.fab.FloatingActionButton;
import org.solovyev.android.Check;
import org.solovyev.android.calculator.BaseFragment;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.entities.Category;
import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.entities.Category;
import org.solovyev.android.views.llm.DividerItemDecoration;
import org.solovyev.common.math.MathEntity;
import org.solovyev.common.text.Strings;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import butterknife.Bind;
import butterknife.ButterKnife;
public abstract class BaseEntitiesFragment<E extends MathEntity> extends BaseFragment {
@ -74,9 +66,9 @@ public abstract class BaseEntitiesFragment<E extends MathEntity> 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<E extends MathEntity> 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<E extends MathEntity> extends BaseFra
protected abstract List<E> getEntities();
@Nullable
abstract Category getCategory(@Nonnull E e);
protected abstract Category getCategory(@Nonnull E e);
protected EntitiesAdapter getAdapter() {
return adapter;

View File

@ -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<T extends MathEntity> implements View.OnClickListener {
@Nonnull

View File

@ -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

View File

@ -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;