Lint issues fixed
This commit is contained in:
parent
24f18b8aae
commit
bb0c32e1e6
@ -25,15 +25,13 @@ package org.solovyev.android.calculator;
|
||||
import android.app.Application;
|
||||
import android.os.Handler;
|
||||
import android.widget.Toast;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.Threads;
|
||||
import org.solovyev.android.msg.AndroidMessage;
|
||||
import org.solovyev.common.msg.Message;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -56,7 +54,7 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
|
||||
}
|
||||
|
||||
public AndroidCalculatorNotifier(@Nonnull Application application, boolean showDebugMessages) {
|
||||
assert Threads.isUiThread();
|
||||
if (!Threads.isUiThread()) throw new AssertionError();
|
||||
|
||||
this.application = application;
|
||||
this.showDebugMessages = showDebugMessages;
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
@ -96,7 +97,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
||||
activityHelper.addTab(this, CalculatorPlotActivity.getPlotterFragmentType(), null, R.id.main_second_pane);
|
||||
} else {
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
if (Build.VERSION.SDK_INT <= GINGERBREAD_MR1 || (Build.VERSION.SDK_INT >= ICE_CREAM_SANDWICH && ViewConfiguration.get(this).hasPermanentMenuKey())) {
|
||||
if (Build.VERSION.SDK_INT <= GINGERBREAD_MR1 || (Build.VERSION.SDK_INT >= ICE_CREAM_SANDWICH && hasPermanentMenuKey())) {
|
||||
actionBar.hide();
|
||||
} else {
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
@ -126,6 +127,11 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
private boolean hasPermanentMenuKey() {
|
||||
return ViewConfiguration.get(this).hasPermanentMenuKey();
|
||||
}
|
||||
|
||||
private boolean isMultiPane() {
|
||||
return findViewById(R.id.main_second_pane) != null;
|
||||
}
|
||||
|
@ -36,17 +36,15 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.Activities;
|
||||
import org.solovyev.android.Views;
|
||||
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 9/25/12
|
||||
@ -187,7 +185,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
final SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putInt(getSavedTabPreferenceName(activity), selectedNavigationIndex);
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,15 +24,13 @@ package org.solovyev.android.calculator;
|
||||
|
||||
import android.content.Context;
|
||||
import jscl.math.Generic;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||
import org.solovyev.android.calculator.plot.CalculatorPlotter;
|
||||
import org.solovyev.android.calculator.view.NumeralBaseConverterDialog;
|
||||
import org.solovyev.android.menu.LabeledMenuItem;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 21.09.12
|
||||
@ -102,7 +100,7 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem<CalculatorDispl
|
||||
@Override
|
||||
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
|
||||
final Generic expression = data.getResult();
|
||||
assert expression != null;
|
||||
if (expression == null) throw new AssertionError();
|
||||
|
||||
final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
|
||||
plotter.plot(expression);
|
||||
|
@ -33,6 +33,8 @@ import org.solovyev.android.checkout.*;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
/**
|
||||
@ -82,7 +84,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
|
||||
if (!isPane(fragment)) {
|
||||
fragmentTitle.setVisibility(View.GONE);
|
||||
} else {
|
||||
fragmentTitle.setText(fragment.getString(titleResId).toUpperCase());
|
||||
fragmentTitle.setText(fragment.getString(titleResId).toUpperCase(Locale.getDefault()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,15 +23,14 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.view.drag.DirectionDragButton;
|
||||
import org.solovyev.android.view.drag.DragButton;
|
||||
import org.solovyev.android.view.drag.DragDirection;
|
||||
import org.solovyev.android.view.drag.SimpleOnDragListener;
|
||||
import org.solovyev.common.math.Point2d;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 9/16/11
|
||||
@ -48,7 +47,7 @@ public class DigitButtonDragProcessor implements SimpleOnDragListener.DragProces
|
||||
|
||||
@Override
|
||||
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) {
|
||||
assert dragButton instanceof DirectionDragButton;
|
||||
if (!(dragButton instanceof DirectionDragButton)) throw new AssertionError();
|
||||
calculatorKeyboard.buttonPressed(((DirectionDragButton) dragButton).getText(dragDirection));
|
||||
return true;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment {
|
||||
final String versionName = getVersionName(textHelper, versionCode);
|
||||
String releaseNotesForVersion = textHelper.getText(makeReleaseNotesResourceId(versionCode));
|
||||
if (!Strings.isEmpty(releaseNotesForVersion)) {
|
||||
assert releaseNotesForVersion != null;
|
||||
if (releaseNotesForVersion == null) throw new AssertionError();
|
||||
if (!first) {
|
||||
result.append("<br/><br/>");
|
||||
} else {
|
||||
|
@ -22,7 +22,9 @@
|
||||
|
||||
package org.solovyev.android.calculator.function;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -31,12 +33,10 @@ import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import jscl.text.MutableInt;
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -59,6 +59,7 @@ public class FunctionParamsView extends LinearLayout {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public FunctionParamsView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
|
||||
}
|
||||
|
||||
public static boolean isAlreadySaved(@Nonnull CalculatorHistoryState historyState) {
|
||||
assert !historyState.isSaved();
|
||||
if (historyState.isSaved()) throw new AssertionError();
|
||||
|
||||
boolean result = false;
|
||||
try {
|
||||
|
@ -70,7 +70,7 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
|
||||
|
||||
editor.putString("org.solovyev.android.calculator.CalculatorModel_history", calculatorHistory.toXml());
|
||||
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public void clearSavedHistory() {
|
||||
|
@ -25,17 +25,11 @@ package org.solovyev.android.calculator.math.edit;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import jscl.math.function.IConstant;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.*;
|
||||
import org.solovyev.android.calculator.math.MathType;
|
||||
import org.solovyev.android.menu.AMenuItem;
|
||||
@ -44,6 +38,8 @@ import org.solovyev.common.JPredicate;
|
||||
import org.solovyev.common.collections.Collections;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -269,7 +265,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
public void onClick(@Nonnull IConstant data, @Nonnull Context context) {
|
||||
final String text = data.getValue();
|
||||
if (!Strings.isEmpty(text)) {
|
||||
assert text != null;
|
||||
if (text == null) throw new AssertionError();
|
||||
Locator.getInstance().getClipboard().setText(text);
|
||||
}
|
||||
}
|
||||
@ -280,7 +276,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
|
||||
public void onClick(@Nonnull IConstant data, @Nonnull Context context) {
|
||||
final String text = Locator.getInstance().getEngine().getVarsRegistry().getDescription(data.getName());
|
||||
if (!Strings.isEmpty(text)) {
|
||||
assert text != null;
|
||||
if (text == null) throw new AssertionError();
|
||||
Locator.getInstance().getClipboard().setText(text);
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
|
||||
final View.OnClickListener buttonOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
assert view instanceof Button;
|
||||
if (!(view instanceof Button)) throw new AssertionError();
|
||||
editName.append(((Button) view).getText());
|
||||
}
|
||||
};
|
||||
|
@ -28,10 +28,6 @@ import jscl.text.Identifier;
|
||||
import jscl.text.MutableInt;
|
||||
import jscl.text.ParseException;
|
||||
import jscl.text.Parser;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.CalculatorMathRegistry;
|
||||
import org.solovyev.android.calculator.CalculatorVarsRegistry;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
@ -42,6 +38,9 @@ import org.solovyev.common.math.MathEntity;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
import org.solovyev.common.text.Strings;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 12/22/11
|
||||
@ -146,7 +145,7 @@ public class VarEditorSaver<T extends MathEntity> implements View.OnClickListene
|
||||
|
||||
if (!Strings.isEmpty(name)) {
|
||||
try {
|
||||
assert name != null;
|
||||
if (name == null) throw new AssertionError();
|
||||
Identifier.parser.parse(Parser.Parameters.newInstance(name, new MutableInt(0), Locator.getInstance().getEngine().getMathEngine0()), null);
|
||||
result = true;
|
||||
} catch (ParseException e) {
|
||||
|
@ -81,7 +81,7 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
|
||||
|
||||
editor.putString(preferenceString, sw.toString());
|
||||
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ import org.solovyev.android.prefs.Preference;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@ -530,7 +531,7 @@ public class CalculatorOnscreenView {
|
||||
if (value >= 0) {
|
||||
return "+" + String.format("%.2f", value);
|
||||
} else {
|
||||
return String.format("%.2f", value);
|
||||
return String.format(Locale.ENGLISH, "%.2f", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
case plot_data_changed:
|
||||
final CalculatorEventHolder.Result result = this.lastEventHolder.apply(calculatorEventData);
|
||||
if (result.isNewAfter()) {
|
||||
assert data != null;
|
||||
if (data == null) throw new AssertionError();
|
||||
onNewPlotData((PlotData) data);
|
||||
}
|
||||
break;
|
||||
@ -191,7 +191,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
createGraphicalView(view, plotData);
|
||||
}
|
||||
|
||||
assert activity != null;
|
||||
if (activity == null) throw new AssertionError();
|
||||
activity.invalidateOptionsMenu();
|
||||
}
|
||||
});
|
||||
|
@ -95,7 +95,7 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment {
|
||||
@Nonnull
|
||||
@Override
|
||||
protected Bitmap getScreehshot() {
|
||||
assert this.graphView != null;
|
||||
if (this.graphView == null) throw new AssertionError();
|
||||
return this.graphView.captureScreenshot();
|
||||
}
|
||||
|
||||
|
@ -23,13 +23,9 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.CalculatorListFragment;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
@ -37,6 +33,7 @@ import org.solovyev.android.calculator.R;
|
||||
import org.solovyev.android.fragments.FragmentUtils;
|
||||
import org.solovyev.android.list.ListItemAdapter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -68,7 +65,7 @@ public class CalculatorPlotFunctionsActivity extends SherlockFragmentActivity {
|
||||
final List<PlotFunctionListItem> items = Lists.transform(Locator.getInstance().getPlotter().getFunctions(), new Function<PlotFunction, PlotFunctionListItem>() {
|
||||
@Override
|
||||
public PlotFunctionListItem apply(@javax.annotation.Nullable PlotFunction input) {
|
||||
assert input != null;
|
||||
if (input == null) throw new AssertionError();
|
||||
return new PlotFunctionListItem(input);
|
||||
}
|
||||
});
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
@ -147,24 +148,30 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider {
|
||||
|
||||
private int getLayout(@Nonnull AppWidgetManager appWidgetManager, int appWidgetId, @Nonnull Resources resources) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
final Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
||||
return getLayoutJellyBean(appWidgetManager, appWidgetId, resources);
|
||||
}
|
||||
return R.layout.widget_layout;
|
||||
}
|
||||
|
||||
if (options != null) {
|
||||
// Get the value of OPTION_APPWIDGET_HOST_CATEGORY
|
||||
final int category = options.getInt(OPTION_APPWIDGET_HOST_CATEGORY, -1);
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
private int getLayoutJellyBean(AppWidgetManager appWidgetManager, int appWidgetId, Resources resources) {
|
||||
final Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
||||
|
||||
if (category != -1) {
|
||||
// If the value is WIDGET_CATEGORY_KEYGUARD, it's a lockscreen widget
|
||||
final boolean keyguard = category == WIDGET_CATEGORY_KEYGUARD;
|
||||
if(keyguard) {
|
||||
final int minHeightDp = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, -1);
|
||||
final int minHeight = resources.getDimensionPixelSize(R.dimen.min_expanded_height_lock_screen);
|
||||
final boolean expanded = (minHeightDp >= minHeight / resources.getDisplayMetrics().density);
|
||||
if (expanded) {
|
||||
return R.layout.widget_layout_lockscreen;
|
||||
} else {
|
||||
return R.layout.widget_layout_lockscreen_collapsed;
|
||||
}
|
||||
if (options != null) {
|
||||
// Get the value of OPTION_APPWIDGET_HOST_CATEGORY
|
||||
final int category = options.getInt(OPTION_APPWIDGET_HOST_CATEGORY, -1);
|
||||
|
||||
if (category != -1) {
|
||||
// If the value is WIDGET_CATEGORY_KEYGUARD, it's a lockscreen widget
|
||||
final boolean keyguard = category == WIDGET_CATEGORY_KEYGUARD;
|
||||
if(keyguard) {
|
||||
final int minHeightDp = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, -1);
|
||||
final int minHeight = resources.getDimensionPixelSize(R.dimen.min_expanded_height_lock_screen);
|
||||
final boolean expanded = (minHeightDp >= minHeight / resources.getDisplayMetrics().density);
|
||||
if (expanded) {
|
||||
return R.layout.widget_layout_lockscreen;
|
||||
} else {
|
||||
return R.layout.widget_layout_lockscreen_collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,15 +26,13 @@
|
||||
a:layout_width="fill_parent"
|
||||
a:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:orientation="vertical"
|
||||
a:layout_width="fill_parent"
|
||||
a:layout_height="fill_parent"
|
||||
<LinearLayout a:orientation="vertical"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="wrap_content"
|
||||
a:scrollbars="vertical"
|
||||
a:scrollbarAlwaysDrawVerticalTrack="true">
|
||||
|
||||
<TextView xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/error_message_text_view"
|
||||
<TextView a:id="@+id/error_message_text_view"
|
||||
a:layout_height="fill_parent"
|
||||
a:layout_width="wrap_content"
|
||||
a:padding="6dp"
|
||||
|
@ -78,6 +78,5 @@
|
||||
a:text="@string/c_restart"
|
||||
a:layout_width="wrap_content"
|
||||
a:layout_height="wrap_content"
|
||||
a:onClick="restartClickHandler"
|
||||
a:layout_gravity="bottom"/>
|
||||
</LinearLayout>
|
||||
|
@ -29,8 +29,8 @@
|
||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/history_edit"
|
||||
a:orientation="vertical"
|
||||
a:layout_width="fill_parent"
|
||||
a:layout_height="fill_parent"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="wrap_content"
|
||||
a:scrollbars="vertical"
|
||||
a:scrollbarAlwaysDrawVerticalTrack="true">
|
||||
|
||||
|
@ -74,7 +74,7 @@
|
||||
<org.solovyev.android.calculator.matrix.MatrixView
|
||||
a:id="@+id/matrix_layout"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_width="wrap_content"
|
||||
a:minWidth="300dp"/>
|
||||
|
||||
</HorizontalScrollView>
|
||||
|
@ -20,15 +20,15 @@
|
||||
~ Site: http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<string-array name="p_layout_names">
|
||||
<string-array name="p_layout_names" tools:ignore="InconsistentArrays">
|
||||
<item>@string/p_layout_calculator</item>
|
||||
<item>@string/p_layout_calculator_mobile</item>
|
||||
<item>@string/p_layout_simple</item>
|
||||
<item>@string/p_layout_simple_mobile</item>
|
||||
</string-array>
|
||||
<string-array name="p_layout_values" translatable="false">
|
||||
<string-array name="p_layout_values" translatable="false" tools:ignore="InconsistentArrays">
|
||||
<item>main_calculator</item>
|
||||
<item>main_calculator_mobile</item>
|
||||
<item>simple</item>
|
||||
|
@ -20,7 +20,7 @@
|
||||
~ Site: http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<string-array name="p_theme_names">
|
||||
<item>@string/p_default_theme</item>
|
||||
<item>@string/p_violet_theme</item>
|
||||
@ -55,11 +55,11 @@
|
||||
<item>"∙"</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="p_layout_names">
|
||||
<string-array name="p_layout_names" tools:ignore="InconsistentArrays">
|
||||
<item>@string/p_layout_calculator</item>
|
||||
<item>@string/p_layout_simple</item>
|
||||
</string-array>
|
||||
<string-array name="p_layout_values" translatable="false">
|
||||
<string-array name="p_layout_values" translatable="false" tools:ignore="InconsistentArrays">
|
||||
<item>main_calculator</item>
|
||||
<item>simple</item>
|
||||
</string-array>
|
||||
|
@ -120,7 +120,7 @@ public class CalculatorEditorImpl implements CalculatorEditor {
|
||||
}
|
||||
|
||||
private void fireStateChangedEvent(boolean majorChanges, @Nonnull CalculatorEditorViewState oldViewState, @Nonnull CalculatorEditorViewState newViewState) {
|
||||
assert Thread.holdsLock(viewLock);
|
||||
if (!Thread.holdsLock(viewLock)) throw new AssertionError();
|
||||
|
||||
if (majorChanges) {
|
||||
calculator.fireCalculatorEvent(editor_state_changed, newChangeEventData(oldViewState, newViewState));
|
||||
|
@ -46,7 +46,7 @@ public class CalculatorKeyboardImpl implements CalculatorKeyboard {
|
||||
public void buttonPressed(@Nullable final String text) {
|
||||
|
||||
if (!Strings.isEmpty(text)) {
|
||||
assert text != null;
|
||||
if (text == null) throw new AssertionError();
|
||||
|
||||
// process special buttons
|
||||
boolean processed = processSpecialButtons(text);
|
||||
|
@ -24,15 +24,13 @@ package org.solovyev.android.calculator;
|
||||
|
||||
import jscl.math.function.Function;
|
||||
import jscl.math.function.IConstant;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.solovyev.android.calculator.math.MathType;
|
||||
import org.solovyev.android.calculator.text.TextProcessor;
|
||||
import org.solovyev.common.collections.Collections;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
import org.solovyev.common.search.StartsWithFinder;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -135,7 +133,7 @@ public class ToJsclTextProcessor implements TextProcessor<PreparedExpression, St
|
||||
offset = varName.length();
|
||||
} else {
|
||||
final String value = var.getValue();
|
||||
assert value != null;
|
||||
if (value == null) throw new AssertionError();
|
||||
|
||||
if (var.getDoubleValue() != null) {
|
||||
//result.append(value);
|
||||
|
@ -82,7 +82,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
||||
public boolean addFunction(@Nonnull Generic expression) {
|
||||
final List<Constant> variables = new ArrayList<Constant>(CalculatorUtils.getNotSystemConstants(expression));
|
||||
|
||||
assert variables.size() <= 2;
|
||||
if (variables.size() > 2) throw new AssertionError();
|
||||
|
||||
final Constant xVariable;
|
||||
if (variables.size() > 0) {
|
||||
@ -316,7 +316,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
||||
|
||||
// NOTE: this method must be called from synchronized block
|
||||
private void onFunctionsChanged() {
|
||||
assert Thread.holdsLock(functions);
|
||||
if (!Thread.holdsLock(functions)) throw new AssertionError();
|
||||
|
||||
int maxArity = 0;
|
||||
for (PlotFunction function : functions) {
|
||||
|
@ -69,7 +69,7 @@ public class MapPlotResourceManager implements PlotResourceManager {
|
||||
}
|
||||
|
||||
private void addLineDef(@Nonnull final PlotLineDef toBeAdded) {
|
||||
assert Thread.holdsLock(this);
|
||||
if (!Thread.holdsLock(this)) throw new AssertionError();
|
||||
|
||||
List<PlotLineDef> registeredLineDefs = registeredLineDefsMap.get(toBeAdded);
|
||||
if (registeredLineDefs == null) {
|
||||
@ -94,7 +94,7 @@ public class MapPlotResourceManager implements PlotResourceManager {
|
||||
}
|
||||
|
||||
private void removeLineDef(@Nonnull final PlotLineDef toBeRemoved) {
|
||||
assert Thread.holdsLock(this);
|
||||
if (!Thread.holdsLock(this)) throw new AssertionError();
|
||||
|
||||
List<PlotLineDef> registeredLineDefs = registeredLineDefsMap.get(toBeRemoved);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user