version update
This commit is contained in:
@@ -17,7 +17,8 @@ import org.solovyev.android.calculator.view.NumeralBasesButton;
|
||||
import org.solovyev.android.calculator.view.OnDragListenerVibrator;
|
||||
import org.solovyev.android.history.HistoryDragProcessor;
|
||||
import org.solovyev.android.view.drag.*;
|
||||
import org.solovyev.common.Announcer;
|
||||
import org.solovyev.common.listeners.JListeners;
|
||||
import org.solovyev.common.listeners.Listeners;
|
||||
import org.solovyev.common.math.Point2d;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@@ -42,7 +43,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
|
||||
private Vibrator vibrator;
|
||||
|
||||
@NotNull
|
||||
private final Announcer<DragPreferencesChangeListener> dpclRegister = new Announcer<DragPreferencesChangeListener>(DragPreferencesChangeListener.class);
|
||||
private final JListeners<DragPreferencesChangeListener> dpclRegister = Listeners.newHardRefListeners();
|
||||
|
||||
@NotNull
|
||||
private String logTag = "CalculatorActivity";
|
||||
@@ -79,7 +80,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
|
||||
}
|
||||
|
||||
public void processButtons(@NotNull final Activity activity, @NotNull View root) {
|
||||
dpclRegister.clear();
|
||||
dpclRegister.removeAll();
|
||||
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
final SimpleOnDragListener.Preferences dragPreferences = SimpleOnDragListener.getPreferences(preferences, activity);
|
||||
@@ -239,7 +240,10 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||
if (key != null && key.startsWith("org.solovyev.android.calculator.DragButtonCalibrationActivity")) {
|
||||
dpclRegister.announce().onDragPreferencesChange(SimpleOnDragListener.getPreferences(preferences, CalculatorApplication.getInstance()));
|
||||
final SimpleOnDragListener.Preferences dragPreferences = SimpleOnDragListener.getPreferences(preferences, CalculatorApplication.getInstance());
|
||||
for (DragPreferencesChangeListener dragPreferencesChangeListener : dpclRegister.getListeners()) {
|
||||
dragPreferencesChangeListener.onDragPreferencesChange(dragPreferences);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import android.os.Handler;
|
||||
import android.widget.Toast;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.AndroidUtils;
|
||||
import org.solovyev.android.AThreads;
|
||||
import org.solovyev.android.msg.AndroidMessage;
|
||||
import org.solovyev.common.msg.Message;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
@@ -32,7 +32,7 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
|
||||
}
|
||||
|
||||
public AndroidCalculatorNotifier(@NotNull Application application, boolean showDebugMessages) {
|
||||
assert AndroidUtils.isUiThread();
|
||||
assert AThreads.isUiThread();
|
||||
|
||||
this.application = application;
|
||||
this.showDebugMessages = showDebugMessages;
|
||||
@@ -61,7 +61,7 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
|
||||
}
|
||||
|
||||
private void showMessageInUiThread(@NotNull final String message) {
|
||||
if (AndroidUtils.isUiThread()) {
|
||||
if (AThreads.isUiThread()) {
|
||||
Toast.makeText(application, message, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
uiHandler.post(new Runnable() {
|
||||
|
@@ -23,14 +23,16 @@ import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.AActivities;
|
||||
import org.solovyev.android.AThreads;
|
||||
import org.solovyev.android.AndroidUtils;
|
||||
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
|
||||
import org.solovyev.android.calculator.plot.CalculatorPlotActivity;
|
||||
import org.solovyev.android.fragments.FragmentUtils;
|
||||
import org.solovyev.android.prefs.Preference;
|
||||
import org.solovyev.common.equals.EqualsTool;
|
||||
import org.solovyev.common.Objects;
|
||||
import org.solovyev.common.history.HistoryAction;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
public class CalculatorActivity extends SherlockFragmentActivity implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEventListener {
|
||||
|
||||
@@ -114,7 +116,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
||||
if (!CalculatorApplication.isMonkeyRunner(context)) {
|
||||
|
||||
boolean dialogShown = false;
|
||||
if (EqualsTool.areEqual(savedVersion, CalculatorPreferences.appVersion.getDefaultValue())) {
|
||||
if (Objects.areEqual(savedVersion, CalculatorPreferences.appVersion.getDefaultValue())) {
|
||||
// new start
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context).setMessage(R.string.c_first_start_text);
|
||||
builder.setPositiveButton(android.R.string.ok, null);
|
||||
@@ -126,7 +128,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
||||
final boolean showReleaseNotes = CalculatorPreferences.Gui.showReleaseNotes.getPreference(preferences);
|
||||
if (showReleaseNotes) {
|
||||
final String releaseNotes = CalculatorReleaseNotesFragment.getReleaseNotes(context, savedVersion + 1);
|
||||
if (!StringUtils.isEmpty(releaseNotes)) {
|
||||
if (!Strings.isEmpty(releaseNotes)) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context).setMessage(Html.fromHtml(releaseNotes));
|
||||
builder.setPositiveButton(android.R.string.ok, null);
|
||||
builder.setTitle(R.string.c_release_notes);
|
||||
@@ -199,7 +201,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
final CalculatorPreferences.Gui.Layout newLayout = CalculatorPreferences.Gui.layout.getPreference(preferences);
|
||||
if ( newLayout != activityHelper.getLayout() ) {
|
||||
AndroidUtils.restartActivity(this);
|
||||
AActivities.restartActivity(this);
|
||||
}
|
||||
|
||||
this.activityHelper.onResume(this);
|
||||
@@ -330,12 +332,12 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
||||
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
|
||||
switch (calculatorEventType) {
|
||||
case plot_graph:
|
||||
Threads.tryRunOnUiThread(this, new Runnable() {
|
||||
AThreads.tryRunOnUiThread(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if ( isMultiPane() ) {
|
||||
if (isMultiPane()) {
|
||||
final ActionBar.Tab selectedTab = getSupportActionBar().getSelectedTab();
|
||||
if ( selectedTab != null && CalculatorFragmentType.plotter.getFragmentTag().equals(selectedTab.getTag()) ) {
|
||||
if (selectedTab != null && CalculatorFragmentType.plotter.getFragmentTag().equals(selectedTab.getTag())) {
|
||||
// do nothing - fragment shown and already registered for plot updates
|
||||
} else {
|
||||
// otherwise - open fragment
|
||||
|
@@ -18,7 +18,8 @@ import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.AndroidUtils;
|
||||
import org.solovyev.android.AActivities;
|
||||
import org.solovyev.android.AViews;
|
||||
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
||||
|
||||
/**
|
||||
@@ -112,7 +113,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
|
||||
final ActionBar actionBar = activity.getSupportActionBar();
|
||||
|
||||
if (activity instanceof CalculatorActivity) {
|
||||
if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT) {
|
||||
if (AViews.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT) {
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
} else {
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
@@ -144,7 +145,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
|
||||
|
||||
final CalculatorPreferences.Gui.Theme newTheme = CalculatorPreferences.Gui.theme.getPreference(preferences);
|
||||
if (!theme.equals(newTheme)) {
|
||||
AndroidUtils.restartActivity(activity);
|
||||
AActivities.restartActivity(activity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,13 +282,13 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
|
||||
|
||||
final StringBuilder helpText = new StringBuilder();
|
||||
helpText.append("Size: ");
|
||||
if (AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE, c)) {
|
||||
if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_XLARGE, c)) {
|
||||
helpText.append("xlarge");
|
||||
} else if (AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, c)) {
|
||||
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, c)) {
|
||||
helpText.append("large");
|
||||
} else if (AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL, c)) {
|
||||
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_NORMAL, c)) {
|
||||
helpText.append("normal");
|
||||
} else if (AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL, c)) {
|
||||
} else if (AViews.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_SMALL, c)) {
|
||||
helpText.append("small");
|
||||
} else {
|
||||
helpText.append("unknown");
|
||||
|
@@ -14,7 +14,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import jscl.math.Generic;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.AndroidUtils2;
|
||||
import org.solovyev.android.AndroidUtils;
|
||||
import org.solovyev.android.App;
|
||||
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
|
||||
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
|
||||
@@ -27,7 +27,7 @@ import org.solovyev.android.calculator.plot.CalculatorPlotter;
|
||||
import org.solovyev.android.calculator.preferences.CalculatorPreferencesActivity;
|
||||
import org.solovyev.common.msg.Message;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
|
||||
public static void showHistory(@NotNull final Context context, boolean detached) {
|
||||
final Intent intent = new Intent(context, CalculatorHistoryActivity.class);
|
||||
AndroidUtils2.addFlags(intent, detached, context);
|
||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
}
|
||||
public static void showSettings(@NotNull final Context context, boolean detached) {
|
||||
final Intent intent = new Intent(context, CalculatorPreferencesActivity.class);
|
||||
AndroidUtils2.addFlags(intent, detached, context);
|
||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
|
||||
public static void showFunctions(@NotNull final Context context, boolean detached) {
|
||||
final Intent intent = new Intent(context, CalculatorFunctionsActivity.class);
|
||||
AndroidUtils2.addFlags(intent, detached, context);
|
||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
|
||||
public static void showOperators(@NotNull final Context context, boolean detached) {
|
||||
final Intent intent = new Intent(context, CalculatorOperatorsActivity.class);
|
||||
AndroidUtils2.addFlags(intent, detached, context);
|
||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -94,14 +94,14 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
|
||||
public static void showVars(@NotNull final Context context, boolean detached) {
|
||||
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
|
||||
AndroidUtils2.addFlags(intent, detached, context);
|
||||
AndroidUtils.addIntentFlags(intent, detached, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void plotGraph(@NotNull final Context context){
|
||||
final Intent intent = new Intent();
|
||||
intent.setClass(context, CalculatorPlotActivity.class);
|
||||
AndroidUtils2.addFlags(intent, false, context);
|
||||
AndroidUtils.addIntentFlags(intent, false, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -110,14 +110,14 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
final CalculatorDisplayViewState viewState = display.getViewState();
|
||||
if (viewState.isValid() ) {
|
||||
final String varValue = viewState.getText();
|
||||
if (!StringUtils.isEmpty(varValue)) {
|
||||
if (!Strings.isEmpty(varValue)) {
|
||||
if (CalculatorVarsFragment.isValidValue(varValue)) {
|
||||
if (context instanceof SherlockFragmentActivity) {
|
||||
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromValue(varValue), ((SherlockFragmentActivity) context).getSupportFragmentManager());
|
||||
} else {
|
||||
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
|
||||
intent.putExtra(CalculatorVarsFragment.CREATE_VAR_EXTRA_STRING, varValue);
|
||||
AndroidUtils2.addFlags(intent, false, context);
|
||||
AndroidUtils.addIntentFlags(intent, false, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
} else {
|
||||
@@ -137,7 +137,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
|
||||
if (viewState.isValid() ) {
|
||||
final String functionValue = viewState.getText();
|
||||
if (!StringUtils.isEmpty(functionValue)) {
|
||||
if (!Strings.isEmpty(functionValue)) {
|
||||
|
||||
FunctionEditDialogFragment.showDialog(FunctionEditDialogFragment.Input.newFromDisplay(viewState), context);
|
||||
|
||||
@@ -162,7 +162,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
if (viewState.isValid() ) {
|
||||
final String functionValue = viewState.getText();
|
||||
final Generic expression = viewState.getResult();
|
||||
if (!StringUtils.isEmpty(functionValue) && expression != null) {
|
||||
if (!Strings.isEmpty(functionValue) && expression != null) {
|
||||
if ( plotter.isPlotPossibleFor(expression) ) {
|
||||
plotter.plot(expression);
|
||||
} else {
|
||||
@@ -184,7 +184,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
|
||||
public static void likeButtonPressed(@NotNull final Context context) {
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CalculatorApplication.FACEBOOK_APP_URL));
|
||||
AndroidUtils2.addFlags(intent, false, context);
|
||||
AndroidUtils.addIntentFlags(intent, false, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -204,22 +204,22 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
if ( source instanceof Context ) {
|
||||
context = ((Context) source);
|
||||
} else {
|
||||
context = App.getInstance().getApplication();
|
||||
context = App.getApplication();
|
||||
}
|
||||
|
||||
switch (calculatorEventType){
|
||||
case show_create_matrix_dialog:
|
||||
App.getInstance().getUiThreadExecutor().execute(new Runnable() {
|
||||
App.getUiThreadExecutor().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final Intent intent = new Intent(context, CalculatorMatrixActivity.class);
|
||||
AndroidUtils2.addFlags(intent, false, context);
|
||||
AndroidUtils.addIntentFlags(intent, false, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case show_create_var_dialog:
|
||||
App.getInstance().getUiThreadExecutor().execute(new Runnable() {
|
||||
App.getUiThreadExecutor().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CalculatorActivityLauncher.tryCreateVar(context);
|
||||
@@ -227,7 +227,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
});
|
||||
break;
|
||||
case show_create_function_dialog:
|
||||
App.getInstance().getUiThreadExecutor().execute(new Runnable() {
|
||||
App.getUiThreadExecutor().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CalculatorActivityLauncher.tryCreateFunction(context);
|
||||
@@ -237,7 +237,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
case show_evaluation_error:
|
||||
final String errorMessage = (String) data;
|
||||
if (errorMessage != null) {
|
||||
App.getInstance().getUiThreadExecutor().execute(new Runnable() {
|
||||
App.getUiThreadExecutor().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showEvaluationError(context, errorMessage);
|
||||
@@ -248,7 +248,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
|
||||
case show_message_dialog:
|
||||
final DialogData dialogData = (DialogData) data;
|
||||
if (dialogData != null) {
|
||||
App.getInstance().getUiThreadExecutor().execute(new Runnable() {
|
||||
App.getUiThreadExecutor().execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CalculatorDialogActivity.showDialog(context, dialogData);
|
||||
|
@@ -13,7 +13,7 @@ import org.acra.ACRA;
|
||||
import org.acra.ReportingInteractionMode;
|
||||
import org.acra.annotation.ReportsCrashes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.solovyev.android.AndroidUtils2;
|
||||
import org.solovyev.android.AndroidUtils;
|
||||
import org.solovyev.android.App;
|
||||
import org.solovyev.android.ads.AdsController;
|
||||
import org.solovyev.android.calculator.external.AndroidExternalListenersContainer;
|
||||
@@ -100,7 +100,7 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
||||
public void onCreate() {
|
||||
ACRA.init(this);
|
||||
|
||||
App.getInstance().init(this);
|
||||
App.init(this);
|
||||
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
CalculatorPreferences.setDefaultValues(preferences);
|
||||
@@ -221,7 +221,7 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||
if (CalculatorPreferences.OnscreenCalculator.showAppIcon.getKey().equals(key)) {
|
||||
boolean showAppIcon = CalculatorPreferences.OnscreenCalculator.showAppIcon.getPreference(prefs);
|
||||
AndroidUtils2.toggleComponent(this, CalculatorOnscreenStartActivity.class, showAppIcon);
|
||||
AndroidUtils.toggleComponent(this, CalculatorOnscreenStartActivity.class, showAppIcon);
|
||||
Locator.getInstance().getNotifier().showMessage(R.string.cpp_this_change_may_require_reboot, MessageType.info);
|
||||
}
|
||||
}
|
||||
|
@@ -11,10 +11,10 @@ import android.widget.TextView;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.AndroidUtils2;
|
||||
import org.solovyev.android.AndroidUtils;
|
||||
import org.solovyev.android.fragments.FragmentUtils;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -33,7 +33,7 @@ public class CalculatorDialogActivity extends SherlockFragmentActivity {
|
||||
final Intent intent = new Intent();
|
||||
intent.setClass(context, CalculatorDialogActivity.class);
|
||||
intent.putExtra(DIALOG_DATA_EXTRA, ParcelableDialogData.wrap(dialogData));
|
||||
AndroidUtils2.addFlags(intent, false, context);
|
||||
AndroidUtils.addIntentFlags(intent, false, context);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CalculatorDialogActivity extends SherlockFragmentActivity {
|
||||
setContentView(R.layout.cpp_dialog);
|
||||
|
||||
final String title = dialogData.getTitle();
|
||||
if (!StringUtils.isEmpty(title)) {
|
||||
if (!Strings.isEmpty(title)) {
|
||||
setTitle(title);
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ public class CalculatorEditorFragment extends SherlockFragment {
|
||||
private CalculatorFragmentHelper fragmentHelper;
|
||||
|
||||
@NotNull
|
||||
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromList(CalculatorMenu.class, SherlockMenuHelper.getInstance());
|
||||
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromEnum(CalculatorMenu.class, SherlockMenuHelper.getInstance());
|
||||
|
||||
public CalculatorEditorFragment() {
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ import org.solovyev.android.calculator.CalculatorApplication;
|
||||
import org.solovyev.android.calculator.CalculatorFragment;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -58,7 +58,7 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment {
|
||||
boolean first = true;
|
||||
for ( int i = version; i >= minVersion; i-- ) {
|
||||
String releaseNotesForVersion = textHelper.getText("c_release_notes_for_" + i);
|
||||
if (!StringUtils.isEmpty(releaseNotesForVersion)){
|
||||
if (!Strings.isEmpty(releaseNotesForVersion)){
|
||||
assert releaseNotesForVersion != null;
|
||||
if ( !first ) {
|
||||
result.append("<br/><br/>");
|
||||
|
@@ -14,7 +14,7 @@ import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.calculator.math.edit.VarEditorSaver;
|
||||
import org.solovyev.android.calculator.model.AFunction;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -79,7 +79,7 @@ public class FunctionEditorSaver implements View.OnClickListener {
|
||||
if (canBeSaved) {
|
||||
if (validateParameters(parameterNames)) {
|
||||
|
||||
if (!StringUtils.isEmpty(content)) {
|
||||
if (!Strings.isEmpty(content)) {
|
||||
builder.setParameterNames(parameterNames);
|
||||
builder.setName(name);
|
||||
builder.setDescription(description);
|
||||
|
@@ -26,15 +26,14 @@ import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||
import org.solovyev.android.menu.*;
|
||||
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
||||
import org.solovyev.common.collections.CollectionsUtils;
|
||||
import org.solovyev.common.JPredicate;
|
||||
import org.solovyev.common.collections.Collections;
|
||||
import org.solovyev.common.equals.Equalizer;
|
||||
import org.solovyev.common.filter.Filter;
|
||||
import org.solovyev.common.filter.FilterRule;
|
||||
import org.solovyev.common.filter.FilterRulesChain;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -145,7 +144,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
||||
|
||||
final HistoryItemMenuData data = new HistoryItemMenuData(historyState, adapter);
|
||||
|
||||
final List<HistoryItemMenuItem> menuItems = CollectionsUtils.asList(HistoryItemMenuItem.values());
|
||||
final List<HistoryItemMenuItem> menuItems = Collections.asList(HistoryItemMenuItem.values());
|
||||
|
||||
if (historyState.isSaved()) {
|
||||
menuItems.remove(HistoryItemMenuItem.save);
|
||||
@@ -157,11 +156,11 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
||||
menuItems.remove(HistoryItemMenuItem.edit);
|
||||
}
|
||||
|
||||
if (historyState.getDisplayState().isValid() && StringUtils.isEmpty(historyState.getDisplayState().getEditorState().getText())) {
|
||||
if (historyState.getDisplayState().isValid() && Strings.isEmpty(historyState.getDisplayState().getEditorState().getText())) {
|
||||
menuItems.remove(HistoryItemMenuItem.copy_result);
|
||||
}
|
||||
|
||||
final AMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = AMenuBuilder.newInstance(context, MenuImpl.newInstance(menuItems));
|
||||
final ContextMenuBuilder<HistoryItemMenuItem, HistoryItemMenuData> menuBuilder = ContextMenuBuilder.newInstance(context, ListContextMenu.newInstance(menuItems));
|
||||
menuBuilder.create(data).show();
|
||||
|
||||
return true;
|
||||
@@ -219,7 +218,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
||||
boolean result = false;
|
||||
try {
|
||||
historyState.setSaved(true);
|
||||
if ( CollectionsUtils.contains(historyState, Locator.getInstance().getHistory().getSavedHistory(), new Equalizer<CalculatorHistoryState>() {
|
||||
if ( Collections.contains(historyState, Locator.getInstance().getHistory().getSavedHistory(), new Equalizer<CalculatorHistoryState>() {
|
||||
@Override
|
||||
public boolean equals(@Nullable CalculatorHistoryState first, @Nullable CalculatorHistoryState second) {
|
||||
return first != null && second != null &&
|
||||
@@ -244,13 +243,13 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
||||
private List<CalculatorHistoryState> getHistoryList() {
|
||||
final List<CalculatorHistoryState> calculatorHistoryStates = getHistoryItems();
|
||||
|
||||
Collections.sort(calculatorHistoryStates, COMPARATOR);
|
||||
java.util.Collections.sort(calculatorHistoryStates, COMPARATOR);
|
||||
|
||||
final FilterRulesChain<CalculatorHistoryState> filterRulesChain = new FilterRulesChain<CalculatorHistoryState>();
|
||||
filterRulesChain.addFilterRule(new FilterRule<CalculatorHistoryState>() {
|
||||
filterRulesChain.addFilterRule(new JPredicate<CalculatorHistoryState>() {
|
||||
@Override
|
||||
public boolean isFiltered(CalculatorHistoryState object) {
|
||||
return object == null || StringUtils.isEmpty(object.getEditorState().getText());
|
||||
public boolean apply(CalculatorHistoryState object) {
|
||||
return object == null || Strings.isEmpty(object.getEditorState().getText());
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -13,7 +13,7 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@@ -45,7 +45,7 @@ public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
|
||||
final TextView commentView = (TextView) result.findViewById(R.id.history_item_comment);
|
||||
if (commentView != null) {
|
||||
final String comment = state.getComment();
|
||||
if (!StringUtils.isEmpty(comment)) {
|
||||
if (!Strings.isEmpty(comment)) {
|
||||
commentView.setText(comment);
|
||||
} else {
|
||||
commentView.setText("");
|
||||
|
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.menu.LabeledMenuItem;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -41,7 +41,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
|
||||
public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) {
|
||||
final CalculatorHistoryState calculatorHistoryState = data.getHistoryState();
|
||||
final String text = calculatorHistoryState.getEditorState().getText();
|
||||
if (!StringUtils.isEmpty(text)) {
|
||||
if (!Strings.isEmpty(text)) {
|
||||
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE);
|
||||
clipboard.setText(text);
|
||||
Toast.makeText(context, context.getText(R.string.c_expression_copied), Toast.LENGTH_SHORT).show();
|
||||
@@ -54,7 +54,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
|
||||
public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) {
|
||||
final CalculatorHistoryState calculatorHistoryState = data.getHistoryState();
|
||||
final String text = calculatorHistoryState.getDisplayState().getEditorState().getText();
|
||||
if (!StringUtils.isEmpty(text)) {
|
||||
if (!Strings.isEmpty(text)) {
|
||||
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE);
|
||||
clipboard.setText(text);
|
||||
Toast.makeText(context, context.getText(R.string.c_result_copied), Toast.LENGTH_SHORT).show();
|
||||
|
@@ -20,15 +20,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.calculator.*;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.menu.AMenuBuilder;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
import org.solovyev.android.menu.ContextMenuBuilder;
|
||||
import org.solovyev.android.menu.LabeledMenuItem;
|
||||
import org.solovyev.android.menu.MenuImpl;
|
||||
import org.solovyev.common.equals.EqualsTool;
|
||||
import org.solovyev.android.menu.ListContextMenu;
|
||||
import org.solovyev.common.JPredicate;
|
||||
import org.solovyev.common.Objects;
|
||||
import org.solovyev.common.filter.Filter;
|
||||
import org.solovyev.common.filter.FilterRule;
|
||||
import org.solovyev.common.math.MathEntity;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
@@ -51,7 +51,7 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
||||
|
||||
public static final String MATH_ENTITY_CATEGORY_EXTRA_STRING = "org.solovyev.android.calculator.CalculatorVarsActivity_math_entity_category";
|
||||
|
||||
protected final static List<Character> acceptableChars = Arrays.asList(StringUtils.toObject("1234567890abcdefghijklmnopqrstuvwxyzйцукенгшщзхъфывапролджэячсмитьбюё_".toCharArray()));
|
||||
protected final static List<Character> acceptableChars = Arrays.asList(Strings.toObject("1234567890abcdefghijklmnopqrstuvwxyzйцукенгшщзхъфывапролджэячсмитьбюё_".toCharArray()));
|
||||
|
||||
|
||||
/*
|
||||
@@ -124,7 +124,7 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
||||
final List<LabeledMenuItem<T>> menuItems = getMenuItemsOnLongClick(item);
|
||||
|
||||
if (!menuItems.isEmpty()) {
|
||||
final AMenuBuilder<LabeledMenuItem<T>, T> menuBuilder = AMenuBuilder.newInstance(AbstractMathEntityListFragment.this.getActivity(), MenuImpl.newInstance(menuItems));
|
||||
final ContextMenuBuilder<LabeledMenuItem<T>, T> menuBuilder = ContextMenuBuilder.newInstance(AbstractMathEntityListFragment.this.getActivity(), ListContextMenu.newInstance(menuItems));
|
||||
menuBuilder.create(item).show();
|
||||
}
|
||||
|
||||
@@ -169,9 +169,9 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
||||
private List<T> getMathEntitiesByCategory() {
|
||||
final List<T> result = getMathEntities();
|
||||
|
||||
new Filter<T>(new FilterRule<T>() {
|
||||
new Filter<T>(new JPredicate<T>() {
|
||||
@Override
|
||||
public boolean isFiltered(T t) {
|
||||
public boolean apply(T t) {
|
||||
return !isInCategory(t);
|
||||
}
|
||||
}).filter(result.iterator());
|
||||
@@ -180,7 +180,7 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
||||
}
|
||||
|
||||
protected boolean isInCategory(@Nullable T t) {
|
||||
return t != null && (category == null || EqualsTool.areEqual(getMathEntityCategory(t), category));
|
||||
return t != null && (category == null || Objects.areEqual(getMathEntityCategory(t), category));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -246,7 +246,7 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
|
||||
final String mathEntityDescription = descriptionGetter.getDescription(getContext(), mathEntity.getName());
|
||||
|
||||
final TextView description = (TextView) result.findViewById(R.id.math_entity_description);
|
||||
if (!StringUtils.isEmpty(mathEntityDescription)) {
|
||||
if (!Strings.isEmpty(mathEntityDescription)) {
|
||||
description.setVisibility(View.VISIBLE);
|
||||
description.setText(mathEntityDescription);
|
||||
} else {
|
||||
|
@@ -24,7 +24,7 @@ import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
import org.solovyev.android.menu.LabeledMenuItem;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -73,7 +73,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
|
||||
List<LabeledMenuItem<Function>> result = new ArrayList<LabeledMenuItem<Function>>(Arrays.asList(LongClickMenuItem.values()));
|
||||
|
||||
final CalculatorMathRegistry<Function> functionsRegistry = Locator.getInstance().getEngine().getFunctionsRegistry();
|
||||
if ( StringUtils.isEmpty(functionsRegistry.getDescription(item.getName())) ) {
|
||||
if ( Strings.isEmpty(functionsRegistry.getDescription(item.getName())) ) {
|
||||
result.remove(LongClickMenuItem.copy_description);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
|
||||
@Override
|
||||
public void onClick(@NotNull Function function, @NotNull Context context) {
|
||||
final String text = Locator.getInstance().getEngine().getFunctionsRegistry().getDescription(function.getName());
|
||||
if (!StringUtils.isEmpty(text)) {
|
||||
if (!Strings.isEmpty(text)) {
|
||||
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE);
|
||||
clipboard.setText(text);
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
import org.solovyev.android.menu.LabeledMenuItem;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -39,7 +39,7 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
|
||||
protected List<LabeledMenuItem<Operator>> getMenuItemsOnLongClick(@NotNull Operator item) {
|
||||
final List<LabeledMenuItem<Operator>> result = new ArrayList<LabeledMenuItem<Operator>>(Arrays.asList(LongClickMenuItem.values()));
|
||||
|
||||
if ( StringUtils.isEmpty(OperatorDescriptionGetter.instance.getDescription(this.getActivity(), item.getName())) ) {
|
||||
if ( Strings.isEmpty(OperatorDescriptionGetter.instance.getDescription(this.getActivity(), item.getName())) ) {
|
||||
result.remove(LongClickMenuItem.copy_description);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
|
||||
@Override
|
||||
public String getDescription(@NotNull Context context, @NotNull String mathEntityName) {
|
||||
String result = Locator.getInstance().getEngine().getOperatorsRegistry().getDescription(mathEntityName);
|
||||
if (StringUtils.isEmpty(result)) {
|
||||
if (Strings.isEmpty(result)) {
|
||||
result = Locator.getInstance().getEngine().getPostfixFunctionsRegistry().getDescription(mathEntityName);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
|
||||
@Override
|
||||
public void onClick(@NotNull Operator data, @NotNull Context context) {
|
||||
final String text = OperatorDescriptionGetter.instance.getDescription(context, data.getName());
|
||||
if (!StringUtils.isEmpty(text)) {
|
||||
if (!Strings.isEmpty(text)) {
|
||||
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE);
|
||||
clipboard.setText(text);
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@ import org.solovyev.android.calculator.math.MathType;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
import org.solovyev.android.menu.LabeledMenuItem;
|
||||
import org.solovyev.common.JPredicate;
|
||||
import org.solovyev.common.collections.CollectionsUtils;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.collections.Collections;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -49,7 +49,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
final Bundle bundle = getArguments();
|
||||
if (bundle != null) {
|
||||
final String varValue = bundle.getString(CREATE_VAR_EXTRA_STRING);
|
||||
if (!StringUtils.isEmpty(varValue)) {
|
||||
if (!Strings.isEmpty(varValue)) {
|
||||
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromValue(varValue), this.getActivity().getSupportFragmentManager());
|
||||
|
||||
// in order to stop intent for other tabs
|
||||
@@ -75,11 +75,11 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
result.remove(LongClickMenuItem.remove);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(Locator.getInstance().getEngine().getVarsRegistry().getDescription(item.getName()))) {
|
||||
if (Strings.isEmpty(Locator.getInstance().getEngine().getVarsRegistry().getDescription(item.getName()))) {
|
||||
result.remove(LongClickMenuItem.copy_description);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(item.getValue())) {
|
||||
if (Strings.isEmpty(item.getValue())) {
|
||||
result.remove(LongClickMenuItem.copy_value);
|
||||
}
|
||||
|
||||
@@ -102,10 +102,10 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
protected List<IConstant> getMathEntities() {
|
||||
final List<IConstant> result = new ArrayList<IConstant>(Locator.getInstance().getEngine().getVarsRegistry().getEntities());
|
||||
|
||||
CollectionsUtils.removeAll(result, new JPredicate<IConstant>() {
|
||||
Collections.removeAll(result, new JPredicate<IConstant>() {
|
||||
@Override
|
||||
public boolean apply(@Nullable IConstant var) {
|
||||
return var != null && CollectionsUtils.contains(var.getName(), MathType.INFINITY_JSCL, MathType.NAN);
|
||||
return var != null && Collections.contains(var.getName(), MathType.INFINITY_JSCL, MathType.NAN);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -249,7 +249,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
@Override
|
||||
public void onClick(@NotNull IConstant data, @NotNull Context context) {
|
||||
final String text = data.getValue();
|
||||
if (!StringUtils.isEmpty(text)) {
|
||||
if (!Strings.isEmpty(text)) {
|
||||
assert text != null;
|
||||
Locator.getInstance().getClipboard().setText(text);
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
@Override
|
||||
public void onClick(@NotNull IConstant data, @NotNull Context context) {
|
||||
final String text = Locator.getInstance().getEngine().getVarsRegistry().getDescription(data.getName());
|
||||
if (!StringUtils.isEmpty(text)) {
|
||||
if (!Strings.isEmpty(text)) {
|
||||
assert text != null;
|
||||
Locator.getInstance().getClipboard().setText(text);
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ import org.solovyev.android.calculator.math.MathType;
|
||||
import org.solovyev.android.calculator.model.MathEntityBuilder;
|
||||
import org.solovyev.common.math.MathEntity;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
import org.solovyev.common.text.StringUtils;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -87,7 +87,7 @@ public class VarEditorSaver<T extends MathEntity> implements View.OnClickListene
|
||||
|
||||
if (mathType.getMathType() == MathType.text || mathType.getMathType() == MathType.constant) {
|
||||
|
||||
if (StringUtils.isEmpty(value)) {
|
||||
if (Strings.isEmpty(value)) {
|
||||
// value is empty => undefined variable
|
||||
varBuilder.setName(name);
|
||||
varBuilder.setDescription(description);
|
||||
@@ -126,7 +126,7 @@ public class VarEditorSaver<T extends MathEntity> implements View.OnClickListene
|
||||
public static boolean isValidName(@Nullable String name) {
|
||||
boolean result = false;
|
||||
|
||||
if (!StringUtils.isEmpty(name)) {
|
||||
if (!Strings.isEmpty(name)) {
|
||||
try {
|
||||
assert name != null;
|
||||
Identifier.parser.parse(Parser.Parameters.newInstance(name, new MutableInt(0), Locator.getInstance().getEngine().getMathEngine0()), null);
|
||||
|
@@ -16,7 +16,8 @@ import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.AndroidUtils2;
|
||||
import org.solovyev.android.AThreads;
|
||||
import org.solovyev.android.AndroidUtils;
|
||||
import org.solovyev.android.calculator.*;
|
||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
@@ -152,7 +153,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
}
|
||||
|
||||
private void updateChart(@NotNull final PlotData plotData, @Nullable final SherlockFragmentActivity activity) {
|
||||
Threads.tryRunOnUiThread(activity, new Runnable() {
|
||||
AThreads.tryRunOnUiThread(activity, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
createChart(plotData);
|
||||
@@ -308,7 +309,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
final File externalFilesDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||
if (externalFilesDir != null) {
|
||||
final String path = externalFilesDir.getPath();
|
||||
AndroidUtils2.saveBitmap(screenshot, path, screenShotFileName);
|
||||
AndroidUtils.saveBitmap(screenshot, path, screenShotFileName);
|
||||
Locator.getInstance().getNotifier().showMessage(R.string.cpp_plot_screenshot_saved, MessageType.info, path + "/" + screenShotFileName);
|
||||
} else {
|
||||
Locator.getInstance().getNotifier().showMessage(R.string.cpp_plot_unable_to_save_screenshot, MessageType.error);
|
||||
|
@@ -5,7 +5,7 @@ package org.solovyev.android.calculator.plot;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.solovyev.android.AndroidUtils2;
|
||||
import org.solovyev.android.AViews;
|
||||
|
||||
class TouchHandler {
|
||||
|
||||
@@ -43,7 +43,7 @@ class TouchHandler {
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
|
||||
int pointerCount = AndroidUtils2.getPointerCountFromMotionEvent(event);
|
||||
int pointerCount = AViews.getPointerCountFromMotionEvent(event);
|
||||
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
@@ -63,7 +63,7 @@ class TouchHandler {
|
||||
velocityTracker.addMovement(event);
|
||||
listener.onTouchMove(x, y);
|
||||
} else if (pointerCount == 2) {
|
||||
listener.onTouchZoomMove(x, y, AndroidUtils2.getXFromMotionEvent(event, 1), AndroidUtils2.getYFromMotionEvent(event, 1));
|
||||
listener.onTouchZoomMove(x, y, AViews.getXFromMotionEvent(event, 1), AViews.getYFromMotionEvent(event, 1));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -75,7 +75,7 @@ class TouchHandler {
|
||||
|
||||
case MotionEvent.ACTION_POINTER_DOWN:
|
||||
if (pointerCount == 2) {
|
||||
listener.onTouchZoomDown(x, y, AndroidUtils2.getXFromMotionEvent(event, 1), AndroidUtils2.getYFromMotionEvent(event, 1));
|
||||
listener.onTouchZoomDown(x, y, AViews.getXFromMotionEvent(event, 1), AViews.getYFromMotionEvent(event, 1));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -21,7 +21,7 @@ import net.robotmedia.billing.ResponseCode;
|
||||
import net.robotmedia.billing.helper.AbstractBillingObserver;
|
||||
import net.robotmedia.billing.model.Transaction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.solovyev.android.AndroidUtils;
|
||||
import org.solovyev.android.AActivities;
|
||||
import org.solovyev.android.App;
|
||||
import org.solovyev.android.ads.AdsController;
|
||||
import org.solovyev.android.calculator.*;
|
||||
@@ -156,7 +156,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
|
||||
case PURCHASED:
|
||||
adFreePreference.setEnabled(false);
|
||||
// restart activity to disable ads
|
||||
AndroidUtils.restartActivity(this);
|
||||
AActivities.restartActivity(this);
|
||||
break;
|
||||
case CANCELLED:
|
||||
adFreePreference.setEnabled(true);
|
||||
@@ -177,7 +177,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
|
||||
if (response == ResponseCode.RESULT_OK) {
|
||||
adFreePreference.setEnabled(false);
|
||||
|
||||
final Message message = new AndroidMessage(R.string.cpp_purchase_thank_you_text, MessageType.info, App.getInstance().getApplication());
|
||||
final Message message = new AndroidMessage(R.string.cpp_purchase_thank_you_text, MessageType.info, App.getApplication());
|
||||
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_message_dialog, MessageDialogData.newInstance(message, null));
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ import android.support.v4.app.FragmentTransaction;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.common.collections.CollectionsUtils;
|
||||
import org.solovyev.common.collections.Collections;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class FragmentUtils {
|
||||
}
|
||||
|
||||
public static void removeFragments(@NotNull SherlockFragmentActivity activity, @NotNull String... fragmentTags) {
|
||||
removeFragments(activity, CollectionsUtils.asList(fragmentTags));
|
||||
removeFragments(activity, Collections.asList(fragmentTags));
|
||||
}
|
||||
|
||||
public static void removeFragments(@NotNull SherlockFragmentActivity activity, @NotNull List<String> fragmentTags) {
|
||||
@@ -61,7 +61,7 @@ public class FragmentUtils {
|
||||
}
|
||||
|
||||
public static void detachFragments(@NotNull SherlockFragmentActivity activity, @NotNull String... fragmentTags) {
|
||||
detachFragments(activity, CollectionsUtils.asList(fragmentTags));
|
||||
detachFragments(activity, Collections.asList(fragmentTags));
|
||||
}
|
||||
|
||||
public static void detachFragments(@NotNull SherlockFragmentActivity activity, @NotNull List<String> fragmentTags) {
|
||||
|
Reference in New Issue
Block a user