Lint issues fixed

This commit is contained in:
serso 2015-01-26 11:12:06 +01:00
parent 24f18b8aae
commit bb0c32e1e6
30 changed files with 91 additions and 94 deletions

View File

@ -25,15 +25,13 @@ package org.solovyev.android.calculator;
import android.app.Application; import android.app.Application;
import android.os.Handler; import android.os.Handler;
import android.widget.Toast; import android.widget.Toast;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.Threads; import org.solovyev.android.Threads;
import org.solovyev.android.msg.AndroidMessage; import org.solovyev.android.msg.AndroidMessage;
import org.solovyev.common.msg.Message; import org.solovyev.common.msg.Message;
import org.solovyev.common.msg.MessageType; import org.solovyev.common.msg.MessageType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
/** /**
@ -56,7 +54,7 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
} }
public AndroidCalculatorNotifier(@Nonnull Application application, boolean showDebugMessages) { public AndroidCalculatorNotifier(@Nonnull Application application, boolean showDebugMessages) {
assert Threads.isUiThread(); if (!Threads.isUiThread()) throw new AssertionError();
this.application = application; this.application = application;
this.showDebugMessages = showDebugMessages; this.showDebugMessages = showDebugMessages;

View File

@ -22,6 +22,7 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.annotation.TargetApi;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; 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); activityHelper.addTab(this, CalculatorPlotActivity.getPlotterFragmentType(), null, R.id.main_second_pane);
} else { } else {
final ActionBar actionBar = getSupportActionBar(); 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(); actionBar.hide();
} else { } else {
actionBar.setDisplayShowTitleEnabled(false); 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() { private boolean isMultiPane() {
return findViewById(R.id.main_second_pane) != null; return findViewById(R.id.main_second_pane) != null;
} }

View File

@ -36,17 +36,15 @@ import android.util.Log;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.app.SherlockFragmentActivity;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.Activities; import org.solovyev.android.Activities;
import org.solovyev.android.Views; import org.solovyev.android.Views;
import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener; import org.solovyev.android.sherlock.tabs.ActionBarFragmentTabListener;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/** /**
* User: serso * User: serso
* Date: 9/25/12 * Date: 9/25/12
@ -187,7 +185,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
final SharedPreferences.Editor editor = preferences.edit(); final SharedPreferences.Editor editor = preferences.edit();
editor.putInt(getSavedTabPreferenceName(activity), selectedNavigationIndex); editor.putInt(getSavedTabPreferenceName(activity), selectedNavigationIndex);
editor.commit(); editor.apply();
} }
} }

View File

@ -24,15 +24,13 @@ package org.solovyev.android.calculator;
import android.content.Context; import android.content.Context;
import jscl.math.Generic; 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.jscl.JsclOperation;
import org.solovyev.android.calculator.plot.CalculatorPlotter; import org.solovyev.android.calculator.plot.CalculatorPlotter;
import org.solovyev.android.calculator.view.NumeralBaseConverterDialog; import org.solovyev.android.calculator.view.NumeralBaseConverterDialog;
import org.solovyev.android.menu.LabeledMenuItem; import org.solovyev.android.menu.LabeledMenuItem;
import javax.annotation.Nonnull;
/** /**
* User: Solovyev_S * User: Solovyev_S
* Date: 21.09.12 * Date: 21.09.12
@ -102,7 +100,7 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem<CalculatorDispl
@Override @Override
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) { public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
final Generic expression = data.getResult(); final Generic expression = data.getResult();
assert expression != null; if (expression == null) throw new AssertionError();
final CalculatorPlotter plotter = Locator.getInstance().getPlotter(); final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
plotter.plot(expression); plotter.plot(expression);

View File

@ -33,6 +33,8 @@ import org.solovyev.android.checkout.*;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Locale;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
/** /**
@ -82,7 +84,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
if (!isPane(fragment)) { if (!isPane(fragment)) {
fragmentTitle.setVisibility(View.GONE); fragmentTitle.setVisibility(View.GONE);
} else { } else {
fragmentTitle.setText(fragment.getString(titleResId).toUpperCase()); fragmentTitle.setText(fragment.getString(titleResId).toUpperCase(Locale.getDefault()));
} }
} }
} }

View File

@ -23,15 +23,14 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.view.MotionEvent; import android.view.MotionEvent;
import javax.annotation.Nonnull;
import org.solovyev.android.view.drag.DirectionDragButton; import org.solovyev.android.view.drag.DirectionDragButton;
import org.solovyev.android.view.drag.DragButton; import org.solovyev.android.view.drag.DragButton;
import org.solovyev.android.view.drag.DragDirection; import org.solovyev.android.view.drag.DragDirection;
import org.solovyev.android.view.drag.SimpleOnDragListener; import org.solovyev.android.view.drag.SimpleOnDragListener;
import org.solovyev.common.math.Point2d; import org.solovyev.common.math.Point2d;
import javax.annotation.Nonnull;
/** /**
* User: serso * User: serso
* Date: 9/16/11 * Date: 9/16/11
@ -48,7 +47,7 @@ public class DigitButtonDragProcessor implements SimpleOnDragListener.DragProces
@Override @Override
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) { 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)); calculatorKeyboard.buttonPressed(((DirectionDragButton) dragButton).getText(dragDirection));
return true; return true;
} }

View File

@ -78,7 +78,7 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment {
final String versionName = getVersionName(textHelper, versionCode); final String versionName = getVersionName(textHelper, versionCode);
String releaseNotesForVersion = textHelper.getText(makeReleaseNotesResourceId(versionCode)); String releaseNotesForVersion = textHelper.getText(makeReleaseNotesResourceId(versionCode));
if (!Strings.isEmpty(releaseNotesForVersion)) { if (!Strings.isEmpty(releaseNotesForVersion)) {
assert releaseNotesForVersion != null; if (releaseNotesForVersion == null) throw new AssertionError();
if (!first) { if (!first) {
result.append("<br/><br/>"); result.append("<br/><br/>");
} else { } else {

View File

@ -22,7 +22,9 @@
package org.solovyev.android.calculator.function; package org.solovyev.android.calculator.function;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.os.Build;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -31,12 +33,10 @@ import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import jscl.text.MutableInt; import jscl.text.MutableInt;
import org.solovyev.android.calculator.R;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.solovyev.android.calculator.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -59,6 +59,7 @@ public class FunctionParamsView extends LinearLayout {
super(context, attrs); super(context, attrs);
} }
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public FunctionParamsView(Context context, AttributeSet attrs, int defStyle) { public FunctionParamsView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
} }

View File

@ -245,7 +245,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
} }
public static boolean isAlreadySaved(@Nonnull CalculatorHistoryState historyState) { public static boolean isAlreadySaved(@Nonnull CalculatorHistoryState historyState) {
assert !historyState.isSaved(); if (historyState.isSaved()) throw new AssertionError();
boolean result = false; boolean result = false;
try { try {

View File

@ -70,7 +70,7 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
editor.putString("org.solovyev.android.calculator.CalculatorModel_history", calculatorHistory.toXml()); editor.putString("org.solovyev.android.calculator.CalculatorModel_history", calculatorHistory.toXml());
editor.commit(); editor.apply();
} }
public void clearSavedHistory() { public void clearSavedHistory() {

View File

@ -25,17 +25,11 @@ package org.solovyev.android.calculator.math.edit;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem; import com.actionbarsherlock.view.MenuItem;
import jscl.math.function.IConstant; import jscl.math.function.IConstant;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*; import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.math.MathType;
import org.solovyev.android.menu.AMenuItem; 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.collections.Collections;
import org.solovyev.common.text.Strings; import org.solovyev.common.text.Strings;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -269,7 +265,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
public void onClick(@Nonnull IConstant data, @Nonnull Context context) { public void onClick(@Nonnull IConstant data, @Nonnull Context context) {
final String text = data.getValue(); final String text = data.getValue();
if (!Strings.isEmpty(text)) { if (!Strings.isEmpty(text)) {
assert text != null; if (text == null) throw new AssertionError();
Locator.getInstance().getClipboard().setText(text); Locator.getInstance().getClipboard().setText(text);
} }
} }
@ -280,7 +276,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
public void onClick(@Nonnull IConstant data, @Nonnull Context context) { public void onClick(@Nonnull IConstant data, @Nonnull Context context) {
final String text = Locator.getInstance().getEngine().getVarsRegistry().getDescription(data.getName()); final String text = Locator.getInstance().getEngine().getVarsRegistry().getDescription(data.getName());
if (!Strings.isEmpty(text)) { if (!Strings.isEmpty(text)) {
assert text != null; if (text == null) throw new AssertionError();
Locator.getInstance().getClipboard().setText(text); Locator.getInstance().getClipboard().setText(text);
} }
} }

View File

@ -180,7 +180,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
final View.OnClickListener buttonOnClickListener = new View.OnClickListener() { final View.OnClickListener buttonOnClickListener = new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
assert view instanceof Button; if (!(view instanceof Button)) throw new AssertionError();
editName.append(((Button) view).getText()); editName.append(((Button) view).getText());
} }
}; };

View File

@ -28,10 +28,6 @@ import jscl.text.Identifier;
import jscl.text.MutableInt; import jscl.text.MutableInt;
import jscl.text.ParseException; import jscl.text.ParseException;
import jscl.text.Parser; import jscl.text.Parser;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorMathRegistry; import org.solovyev.android.calculator.CalculatorMathRegistry;
import org.solovyev.android.calculator.CalculatorVarsRegistry; import org.solovyev.android.calculator.CalculatorVarsRegistry;
import org.solovyev.android.calculator.Locator; 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.msg.MessageType;
import org.solovyev.common.text.Strings; import org.solovyev.common.text.Strings;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/** /**
* User: serso * User: serso
* Date: 12/22/11 * Date: 12/22/11
@ -146,7 +145,7 @@ public class VarEditorSaver<T extends MathEntity> implements View.OnClickListene
if (!Strings.isEmpty(name)) { if (!Strings.isEmpty(name)) {
try { 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); Identifier.parser.parse(Parser.Parameters.newInstance(name, new MutableInt(0), Locator.getInstance().getEngine().getMathEngine0()), null);
result = true; result = true;
} catch (ParseException e) { } catch (ParseException e) {

View File

@ -81,7 +81,7 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
editor.putString(preferenceString, sw.toString()); editor.putString(preferenceString, sw.toString());
editor.commit(); editor.apply();
} }
} }

View File

@ -38,6 +38,7 @@ import org.solovyev.android.prefs.Preference;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Locale;
/** /**
* User: serso * User: serso
@ -530,7 +531,7 @@ public class CalculatorOnscreenView {
if (value >= 0) { if (value >= 0) {
return "+" + String.format("%.2f", value); return "+" + String.format("%.2f", value);
} else { } else {
return String.format("%.2f", value); return String.format(Locale.ENGLISH, "%.2f", value);
} }
} }
} }

View File

@ -165,7 +165,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
case plot_data_changed: case plot_data_changed:
final CalculatorEventHolder.Result result = this.lastEventHolder.apply(calculatorEventData); final CalculatorEventHolder.Result result = this.lastEventHolder.apply(calculatorEventData);
if (result.isNewAfter()) { if (result.isNewAfter()) {
assert data != null; if (data == null) throw new AssertionError();
onNewPlotData((PlotData) data); onNewPlotData((PlotData) data);
} }
break; break;
@ -191,7 +191,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
createGraphicalView(view, plotData); createGraphicalView(view, plotData);
} }
assert activity != null; if (activity == null) throw new AssertionError();
activity.invalidateOptionsMenu(); activity.invalidateOptionsMenu();
} }
}); });

View File

@ -95,7 +95,7 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment {
@Nonnull @Nonnull
@Override @Override
protected Bitmap getScreehshot() { protected Bitmap getScreehshot() {
assert this.graphView != null; if (this.graphView == null) throw new AssertionError();
return this.graphView.captureScreenshot(); return this.graphView.captureScreenshot();
} }

View File

@ -23,13 +23,9 @@
package org.solovyev.android.calculator.plot; package org.solovyev.android.calculator.plot;
import android.os.Bundle; import android.os.Bundle;
import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.CalculatorListFragment; import org.solovyev.android.calculator.CalculatorListFragment;
import org.solovyev.android.calculator.Locator; 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.fragments.FragmentUtils;
import org.solovyev.android.list.ListItemAdapter; import org.solovyev.android.list.ListItemAdapter;
import javax.annotation.Nullable;
import java.util.List; 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>() { final List<PlotFunctionListItem> items = Lists.transform(Locator.getInstance().getPlotter().getFunctions(), new Function<PlotFunction, PlotFunctionListItem>() {
@Override @Override
public PlotFunctionListItem apply(@javax.annotation.Nullable PlotFunction input) { public PlotFunctionListItem apply(@javax.annotation.Nullable PlotFunction input) {
assert input != null; if (input == null) throw new AssertionError();
return new PlotFunctionListItem(input); return new PlotFunctionListItem(input);
} }
}); });

View File

@ -22,6 +22,7 @@
package org.solovyev.android.calculator.widget; package org.solovyev.android.calculator.widget;
import android.annotation.TargetApi;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider; import android.appwidget.AppWidgetProvider;
@ -147,6 +148,13 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider {
private int getLayout(@Nonnull AppWidgetManager appWidgetManager, int appWidgetId, @Nonnull Resources resources) { private int getLayout(@Nonnull AppWidgetManager appWidgetManager, int appWidgetId, @Nonnull Resources resources) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
return getLayoutJellyBean(appWidgetManager, appWidgetId, resources);
}
return R.layout.widget_layout;
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private int getLayoutJellyBean(AppWidgetManager appWidgetManager, int appWidgetId, Resources resources) {
final Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId); final Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
if (options != null) { if (options != null) {
@ -168,7 +176,6 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider {
} }
} }
} }
}
return R.layout.widget_layout; return R.layout.widget_layout;
} }

View File

@ -26,15 +26,13 @@
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="fill_parent"> a:layout_height="fill_parent">
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android" <LinearLayout a:orientation="vertical"
a:orientation="vertical" a:layout_width="match_parent"
a:layout_width="fill_parent" a:layout_height="wrap_content"
a:layout_height="fill_parent"
a:scrollbars="vertical" a:scrollbars="vertical"
a:scrollbarAlwaysDrawVerticalTrack="true"> a:scrollbarAlwaysDrawVerticalTrack="true">
<TextView xmlns:a="http://schemas.android.com/apk/res/android" <TextView a:id="@+id/error_message_text_view"
a:id="@+id/error_message_text_view"
a:layout_height="fill_parent" a:layout_height="fill_parent"
a:layout_width="wrap_content" a:layout_width="wrap_content"
a:padding="6dp" a:padding="6dp"

View File

@ -78,6 +78,5 @@
a:text="@string/c_restart" a:text="@string/c_restart"
a:layout_width="wrap_content" a:layout_width="wrap_content"
a:layout_height="wrap_content" a:layout_height="wrap_content"
a:onClick="restartClickHandler"
a:layout_gravity="bottom"/> a:layout_gravity="bottom"/>
</LinearLayout> </LinearLayout>

View File

@ -29,8 +29,8 @@
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/history_edit" a:id="@+id/history_edit"
a:orientation="vertical" a:orientation="vertical"
a:layout_width="fill_parent" a:layout_width="match_parent"
a:layout_height="fill_parent" a:layout_height="wrap_content"
a:scrollbars="vertical" a:scrollbars="vertical"
a:scrollbarAlwaysDrawVerticalTrack="true"> a:scrollbarAlwaysDrawVerticalTrack="true">

View File

@ -74,7 +74,7 @@
<org.solovyev.android.calculator.matrix.MatrixView <org.solovyev.android.calculator.matrix.MatrixView
a:id="@+id/matrix_layout" a:id="@+id/matrix_layout"
a:layout_height="match_parent" a:layout_height="match_parent"
a:layout_width="match_parent" a:layout_width="wrap_content"
a:minWidth="300dp"/> a:minWidth="300dp"/>
</HorizontalScrollView> </HorizontalScrollView>

View File

@ -20,15 +20,15 @@
~ Site: http://se.solovyev.org ~ 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</item>
<item>@string/p_layout_calculator_mobile</item> <item>@string/p_layout_calculator_mobile</item>
<item>@string/p_layout_simple</item> <item>@string/p_layout_simple</item>
<item>@string/p_layout_simple_mobile</item> <item>@string/p_layout_simple_mobile</item>
</string-array> </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</item>
<item>main_calculator_mobile</item> <item>main_calculator_mobile</item>
<item>simple</item> <item>simple</item>

View File

@ -20,7 +20,7 @@
~ Site: http://se.solovyev.org ~ Site: http://se.solovyev.org
--> -->
<resources> <resources xmlns:tools="http://schemas.android.com/tools">
<string-array name="p_theme_names"> <string-array name="p_theme_names">
<item>@string/p_default_theme</item> <item>@string/p_default_theme</item>
<item>@string/p_violet_theme</item> <item>@string/p_violet_theme</item>
@ -55,11 +55,11 @@
<item>"∙"</item> <item>"∙"</item>
</string-array> </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_calculator</item>
<item>@string/p_layout_simple</item> <item>@string/p_layout_simple</item>
</string-array> </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</item>
<item>simple</item> <item>simple</item>
</string-array> </string-array>

View File

@ -120,7 +120,7 @@ public class CalculatorEditorImpl implements CalculatorEditor {
} }
private void fireStateChangedEvent(boolean majorChanges, @Nonnull CalculatorEditorViewState oldViewState, @Nonnull CalculatorEditorViewState newViewState) { private void fireStateChangedEvent(boolean majorChanges, @Nonnull CalculatorEditorViewState oldViewState, @Nonnull CalculatorEditorViewState newViewState) {
assert Thread.holdsLock(viewLock); if (!Thread.holdsLock(viewLock)) throw new AssertionError();
if (majorChanges) { if (majorChanges) {
calculator.fireCalculatorEvent(editor_state_changed, newChangeEventData(oldViewState, newViewState)); calculator.fireCalculatorEvent(editor_state_changed, newChangeEventData(oldViewState, newViewState));

View File

@ -46,7 +46,7 @@ public class CalculatorKeyboardImpl implements CalculatorKeyboard {
public void buttonPressed(@Nullable final String text) { public void buttonPressed(@Nullable final String text) {
if (!Strings.isEmpty(text)) { if (!Strings.isEmpty(text)) {
assert text != null; if (text == null) throw new AssertionError();
// process special buttons // process special buttons
boolean processed = processSpecialButtons(text); boolean processed = processSpecialButtons(text);

View File

@ -24,15 +24,13 @@ package org.solovyev.android.calculator;
import jscl.math.function.Function; import jscl.math.function.Function;
import jscl.math.function.IConstant; import jscl.math.function.IConstant;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.math.MathType;
import org.solovyev.android.calculator.text.TextProcessor; import org.solovyev.android.calculator.text.TextProcessor;
import org.solovyev.common.collections.Collections; import org.solovyev.common.collections.Collections;
import org.solovyev.common.msg.MessageType; import org.solovyev.common.msg.MessageType;
import org.solovyev.common.search.StartsWithFinder; import org.solovyev.common.search.StartsWithFinder;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -135,7 +133,7 @@ public class ToJsclTextProcessor implements TextProcessor<PreparedExpression, St
offset = varName.length(); offset = varName.length();
} else { } else {
final String value = var.getValue(); final String value = var.getValue();
assert value != null; if (value == null) throw new AssertionError();
if (var.getDoubleValue() != null) { if (var.getDoubleValue() != null) {
//result.append(value); //result.append(value);

View File

@ -82,7 +82,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
public boolean addFunction(@Nonnull Generic expression) { public boolean addFunction(@Nonnull Generic expression) {
final List<Constant> variables = new ArrayList<Constant>(CalculatorUtils.getNotSystemConstants(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; final Constant xVariable;
if (variables.size() > 0) { if (variables.size() > 0) {
@ -316,7 +316,7 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
// NOTE: this method must be called from synchronized block // NOTE: this method must be called from synchronized block
private void onFunctionsChanged() { private void onFunctionsChanged() {
assert Thread.holdsLock(functions); if (!Thread.holdsLock(functions)) throw new AssertionError();
int maxArity = 0; int maxArity = 0;
for (PlotFunction function : functions) { for (PlotFunction function : functions) {

View File

@ -69,7 +69,7 @@ public class MapPlotResourceManager implements PlotResourceManager {
} }
private void addLineDef(@Nonnull final PlotLineDef toBeAdded) { private void addLineDef(@Nonnull final PlotLineDef toBeAdded) {
assert Thread.holdsLock(this); if (!Thread.holdsLock(this)) throw new AssertionError();
List<PlotLineDef> registeredLineDefs = registeredLineDefsMap.get(toBeAdded); List<PlotLineDef> registeredLineDefs = registeredLineDefsMap.get(toBeAdded);
if (registeredLineDefs == null) { if (registeredLineDefs == null) {
@ -94,7 +94,7 @@ public class MapPlotResourceManager implements PlotResourceManager {
} }
private void removeLineDef(@Nonnull final PlotLineDef toBeRemoved) { private void removeLineDef(@Nonnull final PlotLineDef toBeRemoved) {
assert Thread.holdsLock(this); if (!Thread.holdsLock(this)) throw new AssertionError();
List<PlotLineDef> registeredLineDefs = registeredLineDefsMap.get(toBeRemoved); List<PlotLineDef> registeredLineDefs = registeredLineDefsMap.get(toBeRemoved);