fixes + @NotNull -> @Nonnull

This commit is contained in:
Sergey Solovyev 2013-06-15 23:10:45 +04:00
parent e57ce8cf2c
commit 4658f42a8a
245 changed files with 2592 additions and 2652 deletions

View File

@ -2,4 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.solovyev.android.calculator.core"
android:versionCode="1"
android:versionName="1.0" />
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="17" />
</manifest>

View File

@ -14,13 +14,13 @@ import android.support.v4.app.FragmentActivity;
import android.text.Html;
import android.util.AttributeSet;
import android.util.TypedValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.calculator.text.TextProcessor;
import org.solovyev.android.calculator.view.TextHighlighter;
import org.solovyev.android.view.AutoResizeTextView;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -39,7 +39,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
**********************************************************************
*/
@NotNull
@Nonnull
private final static TextProcessor<TextHighlighter.Result, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
/*
@ -50,18 +50,18 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
**********************************************************************
*/
@NotNull
@Nonnull
private volatile CalculatorDisplayViewState state = CalculatorDisplayViewStateImpl.newDefaultInstance();
private volatile boolean viewStateChange = false;
@NotNull
@Nonnull
private final Object lock = new Object();
@NotNull
@Nonnull
private final Handler uiHandler = new Handler();
@NotNull
@Nonnull
private final ExecutorService bgExecutor = Executors.newSingleThreadExecutor();
private volatile boolean initialized = false;
@ -97,7 +97,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
@Override
public void setState(@NotNull final CalculatorDisplayViewState state) {
public void setState(@Nonnull final CalculatorDisplayViewState state) {
uiHandler.post(new Runnable() {
@Override
@ -133,7 +133,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
});
}
@NotNull
@Nonnull
@Override
public CalculatorDisplayViewState getState() {
synchronized (lock) {
@ -170,11 +170,11 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
resizeText();
}
public synchronized void init(@NotNull Context context) {
public synchronized void init(@Nonnull Context context) {
this.init(context, true);
}
public synchronized void init(@NotNull Context context, boolean fromApp) {
public synchronized void init(@Nonnull Context context, boolean fromApp) {
if (!initialized) {
if (fromApp) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);

View File

@ -18,13 +18,14 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextMenu;
import android.widget.EditText;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.text.TextProcessor;
import org.solovyev.android.calculator.view.TextHighlighter;
import org.solovyev.android.prefs.BooleanPreference;
import org.solovyev.common.collections.Collections;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
* Date: 9/17/11
@ -32,25 +33,26 @@ import org.solovyev.common.collections.Collections;
*/
public class AndroidCalculatorEditorView extends EditText implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEditorView {
@NotNull
@Nonnull
private static final BooleanPreference colorDisplay = BooleanPreference.of("org.solovyev.android.calculator.CalculatorModel_color_display", true);
private volatile boolean initialized = false;
private boolean highlightText = true;
@NotNull
@Nonnull
private final static TextProcessor<TextHighlighter.Result, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
@NotNull
@SuppressWarnings("UnusedDeclaration")
@Nonnull
private volatile CalculatorEditorViewState viewState = CalculatorEditorViewStateImpl.newDefaultInstance();
private volatile boolean viewStateChange = false;
@Nullable
@Nonnull
private final Object viewLock = new Object();
@NotNull
@Nonnull
private final Handler uiHandler = new Handler();
public AndroidCalculatorEditorView(Context context) {
@ -97,7 +99,7 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe
}
@Nullable
private CharSequence prepareText(@NotNull String text, boolean highlightText) {
private CharSequence prepareText(@Nonnull String text, boolean highlightText) {
CharSequence result;
if (highlightText) {
@ -137,7 +139,7 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe
}
}
public synchronized void init(@NotNull Context context) {
public synchronized void init(@Nonnull Context context) {
if (!initialized) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
@ -152,57 +154,51 @@ public class AndroidCalculatorEditorView extends EditText implements SharedPrefe
}
@Override
public void setState(@NotNull final CalculatorEditorViewState viewState) {
if (viewLock != null) {
synchronized (viewLock) {
public void setState(@Nonnull final CalculatorEditorViewState viewState) {
synchronized (viewLock) {
final CharSequence text = prepareText(viewState.getText(), highlightText);
final CharSequence text = prepareText(viewState.getText(), highlightText);
uiHandler.post(new Runnable() {
@Override
public void run() {
final AndroidCalculatorEditorView editorView = AndroidCalculatorEditorView.this;
synchronized (viewLock) {
try {
editorView.viewStateChange = true;
editorView.viewState = viewState;
editorView.setText(text, BufferType.EDITABLE);
final int selection = CalculatorEditorImpl.correctSelection(viewState.getSelection(), editorView.getText());
editorView.setSelection(selection);
} finally {
editorView.viewStateChange = false;
}
uiHandler.post(new Runnable() {
@Override
public void run() {
final AndroidCalculatorEditorView editorView = AndroidCalculatorEditorView.this;
synchronized (viewLock) {
try {
editorView.viewStateChange = true;
editorView.viewState = viewState;
editorView.setText(text, BufferType.EDITABLE);
final int selection = CalculatorEditorImpl.correctSelection(viewState.getSelection(), editorView.getText());
editorView.setSelection(selection);
} finally {
editorView.viewStateChange = false;
}
}
});
}
}
});
}
}
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
if (viewLock != null) {
synchronized (viewLock) {
if (!viewStateChange) {
// external text change => need to notify editor
super.onSelectionChanged(selStart, selEnd);
synchronized (viewLock) {
if (!viewStateChange) {
// external text change => need to notify editor
super.onSelectionChanged(selStart, selEnd);
if (selStart == selEnd) {
// only if cursor moving, if selection do nothing
Locator.getInstance().getEditor().setSelection(selStart);
}
if (selStart == selEnd) {
// only if cursor moving, if selection do nothing
Locator.getInstance().getEditor().setSelection(selStart);
}
}
}
}
public void handleTextChange(Editable s) {
if (viewLock != null) {
synchronized (viewLock) {
if (!viewStateChange) {
// external text change => need to notify editor
Locator.getInstance().getEditor().setText(String.valueOf(s));
}
synchronized (viewLock) {
if (!viewStateChange) {
// external text change => need to notify editor
Locator.getInstance().getEditor().setText(String.valueOf(s));
}
}
}

View File

@ -1,8 +1,8 @@
package org.solovyev.android.calculator;
import android.content.Context;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.core.R;
import java.util.HashMap;
@ -61,42 +61,42 @@ public enum CalculatorButton {
private final int buttonId;
@NotNull
@Nonnull
private final String onClickText;
@Nullable
private final String onLongClickText;
@NotNull
@Nonnull
private static Map<Integer, CalculatorButton> buttonsByIds = new HashMap<Integer, CalculatorButton>();
CalculatorButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton, @Nullable CalculatorSpecialButton onLongClickButton) {
CalculatorButton(int buttonId, @Nonnull CalculatorSpecialButton onClickButton, @Nullable CalculatorSpecialButton onLongClickButton) {
this(buttonId, onClickButton.getActionCode(), onLongClickButton == null ? null : onLongClickButton.getActionCode());
}
CalculatorButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton) {
CalculatorButton(int buttonId, @Nonnull CalculatorSpecialButton onClickButton) {
this(buttonId, onClickButton, null);
}
CalculatorButton(int buttonId, @NotNull String onClickText, @Nullable String onLongClickText) {
CalculatorButton(int buttonId, @Nonnull String onClickText, @Nullable String onLongClickText) {
this.buttonId = buttonId;
this.onClickText = onClickText;
this.onLongClickText = onLongClickText;
}
CalculatorButton(int buttonId, @NotNull String onClickText) {
CalculatorButton(int buttonId, @Nonnull String onClickText) {
this(buttonId, onClickText, null);
}
public void onLongClick(@NotNull Context context) {
public void onLongClick(@Nonnull Context context) {
Locator.getInstance().getNotifier().showDebugMessage("Calculator++ Widget", "Button pressed: " + onLongClickText);
if (onLongClickText != null) {
Locator.getInstance().getKeyboard().buttonPressed(onLongClickText);
}
}
public void onClick(@NotNull Context context) {
public void onClick(@Nonnull Context context) {
Locator.getInstance().getNotifier().showDebugMessage("Calculator++ Widget", "Button pressed: " + onClickText);
Locator.getInstance().getKeyboard().buttonPressed(onClickText);
}

View File

@ -13,8 +13,8 @@ import android.widget.Button;
import android.widget.RemoteViews;
import jscl.AngleUnit;
import jscl.NumeralBase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.Views;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
@ -36,36 +36,36 @@ public final class CalculatorButtons {
}
public static void processButtons(@NotNull CalculatorPreferences.Gui.Theme theme,
@NotNull CalculatorPreferences.Gui.Layout layout,
@NotNull View root) {
public static void processButtons(@Nonnull CalculatorPreferences.Gui.Theme theme,
@Nonnull CalculatorPreferences.Gui.Layout layout,
@Nonnull View root) {
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) {
final float textSize = root.getContext().getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile);
Views.processViewsOfType(root, DragButton.class, new Views.ViewProcessor<DragButton>() {
@Override
public void process(@NotNull DragButton button) {
public void process(@Nonnull DragButton button) {
button.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize);
}
});
}
}
static void initMultiplicationButton(@NotNull View root) {
static void initMultiplicationButton(@Nonnull View root) {
final View multiplicationButton = root.findViewById(R.id.cpp_button_multiplication);
if (multiplicationButton instanceof Button) {
((Button) multiplicationButton).setText(Locator.getInstance().getEngine().getMultiplicationSign());
}
}
public static void initMultiplicationButton(@NotNull RemoteViews views) {
public static void initMultiplicationButton(@Nonnull RemoteViews views) {
views.setTextViewText(R.id.cpp_button_multiplication, Locator.getInstance().getEngine().getMultiplicationSign());
}
public static void toggleEqualsButton(@Nullable SharedPreferences preferences,
@NotNull Activity activity) {
@Nonnull Activity activity) {
preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
final boolean large = Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) &&
@ -97,7 +97,7 @@ public final class CalculatorButtons {
static class RoundBracketsDragProcessor implements SimpleOnDragListener.DragProcessor {
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) {
final boolean result;
if (dragDirection == DragDirection.left) {
@ -111,25 +111,25 @@ public final class CalculatorButtons {
}
}
@NotNull
@Nonnull
private static CalculatorKeyboard getKeyboard() {
return Locator.getInstance().getKeyboard();
}
static class VarsDragProcessor implements SimpleOnDragListener.DragProcessor {
@NotNull
@Nonnull
private Context context;
VarsDragProcessor(@NotNull Context context) {
VarsDragProcessor(@Nonnull Context context) {
this.context = context;
}
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection,
@NotNull DragButton dragButton,
@NotNull Point2d startPoint2d,
@NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection,
@Nonnull DragButton dragButton,
@Nonnull Point2d startPoint2d,
@Nonnull MotionEvent motionEvent) {
boolean result = false;
if (dragDirection == DragDirection.up) {
@ -146,22 +146,22 @@ public final class CalculatorButtons {
static class AngleUnitsChanger implements SimpleOnDragListener.DragProcessor {
@NotNull
@Nonnull
private final DigitButtonDragProcessor processor;
@NotNull
@Nonnull
private final Context context;
AngleUnitsChanger(@NotNull Context context) {
AngleUnitsChanger(@Nonnull Context context) {
this.context = context;
this.processor = new DigitButtonDragProcessor(Locator.getInstance().getKeyboard());
}
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection,
@NotNull DragButton dragButton,
@NotNull Point2d startPoint2d,
@NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection,
@Nonnull DragButton dragButton,
@Nonnull Point2d startPoint2d,
@Nonnull MotionEvent motionEvent) {
boolean result = false;
if (dragButton instanceof AngleUnitsButton) {
@ -195,18 +195,18 @@ public final class CalculatorButtons {
static class NumeralBasesChanger implements SimpleOnDragListener.DragProcessor {
@NotNull
@Nonnull
private final Context context;
NumeralBasesChanger(@NotNull Context context) {
NumeralBasesChanger(@Nonnull Context context) {
this.context = context;
}
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection,
@NotNull DragButton dragButton,
@NotNull Point2d startPoint2d,
@NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection,
@Nonnull DragButton dragButton,
@Nonnull Point2d startPoint2d,
@Nonnull MotionEvent motionEvent) {
boolean result = false;
if (dragButton instanceof NumeralBasesButton) {
@ -236,18 +236,18 @@ public final class CalculatorButtons {
static class FunctionsDragProcessor implements SimpleOnDragListener.DragProcessor {
@NotNull
@Nonnull
private Context context;
FunctionsDragProcessor(@NotNull Context context) {
FunctionsDragProcessor(@Nonnull Context context) {
this.context = context;
}
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection,
@NotNull DragButton dragButton,
@NotNull Point2d startPoint2d,
@NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection,
@Nonnull DragButton dragButton,
@Nonnull Point2d startPoint2d,
@Nonnull MotionEvent motionEvent) {
boolean result = false;
if (dragDirection == DragDirection.up) {

View File

@ -2,7 +2,7 @@ package org.solovyev.android.calculator;
import android.content.Context;
import jscl.math.Generic;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.calculator.jscl.JsclOperation;
import org.solovyev.android.calculator.plot.CalculatorPlotter;
@ -18,50 +18,50 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem<CalculatorDispl
copy(R.string.c_copy) {
@Override
public void onClick(@NotNull CalculatorDisplayViewState data, @NotNull Context context) {
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
Locator.getInstance().getKeyboard().copyButtonPressed();
}
},
convert_to_bin(R.string.convert_to_bin) {
@Override
public void onClick(@NotNull CalculatorDisplayViewState data, @NotNull Context context) {
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
ConversionMenuItem.convert_to_bin.onClick(data, context);
}
@Override
protected boolean isItemVisibleFor(@NotNull Generic generic, @NotNull JsclOperation operation) {
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
return ConversionMenuItem.convert_to_bin.isItemVisibleFor(generic, operation);
}
},
convert_to_dec(R.string.convert_to_dec) {
@Override
public void onClick(@NotNull CalculatorDisplayViewState data, @NotNull Context context) {
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
ConversionMenuItem.convert_to_dec.onClick(data, context);
}
@Override
protected boolean isItemVisibleFor(@NotNull Generic generic, @NotNull JsclOperation operation) {
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
return ConversionMenuItem.convert_to_dec.isItemVisibleFor(generic, operation);
}
},
convert_to_hex(R.string.convert_to_hex) {
@Override
public void onClick(@NotNull CalculatorDisplayViewState data, @NotNull Context context) {
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
ConversionMenuItem.convert_to_hex.onClick(data, context);
}
@Override
protected boolean isItemVisibleFor(@NotNull Generic generic, @NotNull JsclOperation operation) {
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
return ConversionMenuItem.convert_to_hex.isItemVisibleFor(generic, operation);
}
},
convert(R.string.c_convert) {
@Override
public void onClick(@NotNull CalculatorDisplayViewState data, @NotNull Context context) {
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
final Generic result = data.getResult();
if (result != null) {
new NumeralBaseConverterDialog(result.toString()).show(context);
@ -69,14 +69,14 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem<CalculatorDispl
}
@Override
protected boolean isItemVisibleFor(@NotNull Generic generic, @NotNull JsclOperation operation) {
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
return operation == JsclOperation.numeric && generic.getConstants().isEmpty();
}
},
plot(R.string.c_plot) {
@Override
public void onClick(@NotNull CalculatorDisplayViewState data, @NotNull Context context) {
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
final Generic expression = data.getResult();
assert expression != null;
@ -85,7 +85,7 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem<CalculatorDispl
}
@Override
protected boolean isItemVisibleFor(@NotNull Generic generic, @NotNull JsclOperation operation) {
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
return Locator.getInstance().getPlotter().isPlotPossibleFor(generic);
}
@ -97,18 +97,18 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem<CalculatorDispl
this.captionId = captionId;
}
public final boolean isItemVisible(@NotNull CalculatorDisplayViewState displayViewState) {
public final boolean isItemVisible(@Nonnull CalculatorDisplayViewState displayViewState) {
//noinspection ConstantConditions
return displayViewState.isValid() && displayViewState.getResult() != null && isItemVisibleFor(displayViewState.getResult(), displayViewState.getOperation());
}
protected boolean isItemVisibleFor(@NotNull Generic generic, @NotNull JsclOperation operation) {
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
return true;
}
@NotNull
@Nonnull
@Override
public String getCaption(@NotNull Context context) {
public String getCaption(@Nonnull Context context) {
return context.getString(captionId);
}
}

View File

@ -2,7 +2,7 @@ package org.solovyev.android.calculator;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.menu.ContextMenuBuilder;
import org.solovyev.android.menu.ListContextMenu;
@ -16,10 +16,10 @@ import java.util.List;
*/
public class CalculatorDisplayOnClickListener implements View.OnClickListener {
@NotNull
@Nonnull
private final FragmentActivity activity;
public CalculatorDisplayOnClickListener(@NotNull FragmentActivity activity) {
public CalculatorDisplayOnClickListener(@Nonnull FragmentActivity activity) {
this.activity = activity;
}

View File

@ -3,7 +3,7 @@ package org.solovyev.android.calculator;
import android.content.SharedPreferences;
import jscl.AngleUnit;
import jscl.NumeralBase;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.math.MathType;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
import org.solovyev.android.prefs.*;
@ -59,13 +59,13 @@ public final class CalculatorPreferences {
public static final Preference<Boolean> autoOrientation = BooleanPreference.of("autoOrientation", true);
public static final Preference<Boolean> hideNumeralBaseDigits = BooleanPreference.of("hideNumeralBaseDigits", true);
@NotNull
public static Theme getTheme(@NotNull SharedPreferences preferences) {
@Nonnull
public static Theme getTheme(@Nonnull SharedPreferences preferences) {
return theme.getPreferenceNoError(preferences);
}
@NotNull
public static Layout getLayout(@NotNull SharedPreferences preferences) {
@Nonnull
public static Layout getLayout(@Nonnull SharedPreferences preferences) {
return layout.getPreferenceNoError(preferences);
}
@ -78,23 +78,23 @@ public final class CalculatorPreferences {
metro_purple_theme(ThemeType.metro, R.style.cpp_metro_purple_theme),
metro_green_theme(ThemeType.metro, R.style.cpp_metro_green_theme);
@NotNull
@Nonnull
private final ThemeType themeType;
@NotNull
@Nonnull
private final Integer themeId;
Theme(@NotNull ThemeType themeType, @NotNull Integer themeId) {
Theme(@Nonnull ThemeType themeType, @Nonnull Integer themeId) {
this.themeType = themeType;
this.themeId = themeId;
}
@NotNull
@Nonnull
public ThemeType getThemeType() {
return themeType;
}
@NotNull
@Nonnull
public Integer getThemeId() {
return themeId;
}
@ -136,7 +136,7 @@ public final class CalculatorPreferences {
}
static void setDefaultValues(@NotNull SharedPreferences preferences) {
static void setDefaultValues(@Nonnull SharedPreferences preferences) {
if (!AndroidCalculatorEngine.Preferences.groupingSeparator.isSet(preferences)) {
final Locale locale = Locale.getDefault();
@ -206,7 +206,7 @@ public final class CalculatorPreferences {
}
private static void applyDefaultPreference(@NotNull SharedPreferences preferences, @NotNull Preference<?> preference) {
private static void applyDefaultPreference(@Nonnull SharedPreferences preferences, @Nonnull Preference<?> preference) {
preference.tryPutDefault(preferences);
}

View File

@ -3,7 +3,7 @@ package org.solovyev.android.calculator;
import android.content.Context;
import jscl.NumeralBase;
import jscl.math.Generic;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.jscl.JsclOperation;
import org.solovyev.android.menu.AMenuItem;
@ -18,14 +18,14 @@ enum ConversionMenuItem implements AMenuItem<CalculatorDisplayViewState> {
convert_to_dec(NumeralBase.dec),
convert_to_hex(NumeralBase.hex);
@NotNull
@Nonnull
private final NumeralBase toNumeralBase;
ConversionMenuItem(@NotNull NumeralBase toNumeralBase) {
ConversionMenuItem(@Nonnull NumeralBase toNumeralBase) {
this.toNumeralBase = toNumeralBase;
}
protected boolean isItemVisibleFor(@NotNull Generic generic, @NotNull JsclOperation operation) {
protected boolean isItemVisibleFor(@Nonnull Generic generic, @Nonnull JsclOperation operation) {
boolean result = false;
if (operation == JsclOperation.numeric) {
@ -42,7 +42,7 @@ enum ConversionMenuItem implements AMenuItem<CalculatorDisplayViewState> {
}
@Override
public void onClick(@NotNull CalculatorDisplayViewState data, @NotNull Context context) {
public void onClick(@Nonnull CalculatorDisplayViewState data, @Nonnull Context context) {
final Generic result = data.getResult();
if (result != null) {

View File

@ -6,7 +6,7 @@
package org.solovyev.android.calculator;
import android.view.MotionEvent;
import org.jetbrains.annotations.NotNull;
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;
@ -20,15 +20,15 @@ import org.solovyev.common.math.Point2d;
*/
public class DigitButtonDragProcessor implements SimpleOnDragListener.DragProcessor {
@NotNull
@Nonnull
private CalculatorKeyboard calculatorKeyboard;
public DigitButtonDragProcessor(@NotNull CalculatorKeyboard calculatorKeyboard) {
public DigitButtonDragProcessor(@Nonnull CalculatorKeyboard calculatorKeyboard) {
this.calculatorKeyboard = calculatorKeyboard;
}
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) {
assert dragButton instanceof DirectionDragButton;
calculatorKeyboard.buttonPressed(((DirectionDragButton) dragButton).getText(dragDirection));
return true;

View File

@ -2,8 +2,8 @@ package org.solovyev.android.calculator;
import android.os.Parcel;
import android.os.Parcelable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.common.msg.Message;
import org.solovyev.common.msg.MessageType;
@ -16,7 +16,7 @@ public class FixableMessage implements Parcelable {
public static final Creator<FixableMessage> CREATOR = new Creator<FixableMessage>() {
@Override
public FixableMessage createFromParcel(@NotNull Parcel in) {
public FixableMessage createFromParcel(@Nonnull Parcel in) {
return FixableMessage.fromParcel(in);
}
@ -26,8 +26,8 @@ public class FixableMessage implements Parcelable {
}
};
@NotNull
private static FixableMessage fromParcel(@NotNull Parcel in) {
@Nonnull
private static FixableMessage fromParcel(@Nonnull Parcel in) {
final String message = in.readString();
final MessageType messageType = (MessageType) in.readSerializable();
final FixableError fixableError = (FixableError) in.readSerializable();
@ -35,16 +35,16 @@ public class FixableMessage implements Parcelable {
return new FixableMessage(message, messageType, fixableError);
}
@NotNull
@Nonnull
private final String message;
@NotNull
@Nonnull
private final MessageType messageType;
@Nullable
private final FixableError fixableError;
public FixableMessage(@NotNull Message message) {
public FixableMessage(@Nonnull Message message) {
this.message = message.getLocalizedMessage();
int messageLevel = message.getMessageLevel().getMessageLevel();
if (messageLevel < MessageType.info.getMessageLevel()) {
@ -57,8 +57,8 @@ public class FixableMessage implements Parcelable {
this.fixableError = CalculatorFixableError.getErrorByMessageCode(message.getMessageCode());
}
public FixableMessage(@NotNull String message,
@NotNull MessageType messageType,
public FixableMessage(@Nonnull String message,
@Nonnull MessageType messageType,
@Nullable FixableError fixableError) {
this.message = message;
this.messageType = messageType;
@ -71,18 +71,18 @@ public class FixableMessage implements Parcelable {
}
@Override
public void writeToParcel(@NotNull Parcel out, int flags) {
public void writeToParcel(@Nonnull Parcel out, int flags) {
out.writeString(message);
out.writeSerializable(messageType);
out.writeSerializable(fixableError);
}
@NotNull
@Nonnull
public String getMessage() {
return message;
}
@NotNull
@Nonnull
public MessageType getMessageType() {
return messageType;
}

View File

@ -14,7 +14,7 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockActivity;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.core.R;
import org.solovyev.common.msg.Message;
import org.solovyev.common.text.Strings;
@ -32,7 +32,7 @@ public class FixableMessagesDialog extends SherlockActivity {
private static final String INPUT = "input";
@NotNull
@Nonnull
private Input input = new Input(Collections.<FixableMessage>emptyList(), false);
public FixableMessagesDialog() {
@ -70,7 +70,7 @@ public class FixableMessagesDialog extends SherlockActivity {
});
}
private void parseIntent(@NotNull Intent intent) {
private void parseIntent(@Nonnull Intent intent) {
final Input input = intent.getParcelableExtra(INPUT);
if (input != null) {
this.input = input;
@ -113,7 +113,7 @@ public class FixableMessagesDialog extends SherlockActivity {
}
@Override
protected void onNewIntent(@NotNull Intent intent) {
protected void onNewIntent(@Nonnull Intent intent) {
super.onNewIntent(intent);
parseIntent(intent);
}
@ -126,8 +126,8 @@ public class FixableMessagesDialog extends SherlockActivity {
**********************************************************************
*/
public static void showDialogForMessages(@NotNull List<Message> messages,
@NotNull Context context,
public static void showDialogForMessages(@Nonnull List<Message> messages,
@Nonnull Context context,
boolean showCheckbox) {
if (!messages.isEmpty()) {
final Intent intent = new Intent(context, FixableMessagesDialog.class);
@ -139,8 +139,8 @@ public class FixableMessagesDialog extends SherlockActivity {
}
}
public static void showDialog(@NotNull List<FixableMessage> messages,
@NotNull Context context,
public static void showDialog(@Nonnull List<FixableMessage> messages,
@Nonnull Context context,
boolean showCheckbox) {
if (!messages.isEmpty()) {
final Intent intent = new Intent(context, FixableMessagesDialog.class);
@ -156,7 +156,7 @@ public class FixableMessagesDialog extends SherlockActivity {
public static final Creator<Input> CREATOR = new Creator<Input>() {
@Override
public Input createFromParcel(@NotNull Parcel in) {
public Input createFromParcel(@Nonnull Parcel in) {
return Input.fromParcel(in);
}
@ -166,8 +166,8 @@ public class FixableMessagesDialog extends SherlockActivity {
}
};
@NotNull
private static Input fromParcel(@NotNull Parcel in) {
@Nonnull
private static Input fromParcel(@Nonnull Parcel in) {
final List<FixableMessage> messages = new ArrayList<FixableMessage>();
boolean showCheckbox = in.readInt() == 1;
in.readTypedList(messages, FixableMessage.CREATOR);
@ -175,17 +175,17 @@ public class FixableMessagesDialog extends SherlockActivity {
}
@NotNull
@Nonnull
private List<FixableMessage> messages = new ArrayList<FixableMessage>();
private boolean showCheckbox;
private Input(@NotNull List<FixableMessage> messages, boolean showCheckbox) {
private Input(@Nonnull List<FixableMessage> messages, boolean showCheckbox) {
this.messages = messages;
this.showCheckbox = showCheckbox;
}
@NotNull
@Nonnull
public List<FixableMessage> getMessages() {
return messages;
}
@ -196,13 +196,13 @@ public class FixableMessagesDialog extends SherlockActivity {
}
@Override
public void writeToParcel(@NotNull Parcel out, int flags) {
public void writeToParcel(@Nonnull Parcel out, int flags) {
out.writeInt(showCheckbox ? 1 : 0);
out.writeTypedList(messages);
}
@NotNull
public static Input fromMessages(@NotNull List<Message> messages, boolean showCheckbox) {
@Nonnull
public static Input fromMessages(@Nonnull List<Message> messages, boolean showCheckbox) {
final List<FixableMessage> stringMessages = new ArrayList<FixableMessage>(messages.size());
for (Message message : messages) {
stringMessages.add(new FixableMessage(message));
@ -218,14 +218,14 @@ public class FixableMessagesDialog extends SherlockActivity {
private class FixErrorOnClickListener implements View.OnClickListener {
@NotNull
@Nonnull
private final List<FixableMessage> messages;
@NotNull
@Nonnull
private final FixableMessage currentMessage;
public FixErrorOnClickListener(@NotNull List<FixableMessage> messages,
@NotNull FixableMessage message) {
public FixErrorOnClickListener(@Nonnull List<FixableMessage> messages,
@Nonnull FixableMessage message) {
this.messages = messages;
this.currentMessage = message;
}

View File

@ -3,8 +3,8 @@ package org.solovyev.android.calculator;
import android.os.Parcel;
import android.os.Parcelable;
import jscl.math.Generic;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.jscl.JsclOperation;
/**
@ -16,7 +16,7 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis
public static final Creator<ParcelableCalculatorDisplayViewState> CREATOR = new Creator<ParcelableCalculatorDisplayViewState>() {
@Override
public ParcelableCalculatorDisplayViewState createFromParcel(@NotNull Parcel in) {
public ParcelableCalculatorDisplayViewState createFromParcel(@Nonnull Parcel in) {
return ParcelableCalculatorDisplayViewState.fromParcel(in);
}
@ -26,8 +26,8 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis
}
};
@NotNull
private static ParcelableCalculatorDisplayViewState fromParcel(@NotNull Parcel in) {
@Nonnull
private static ParcelableCalculatorDisplayViewState fromParcel(@Nonnull Parcel in) {
final int selection = in.readInt();
final boolean valid = in.readInt() == 1;
final String stringResult = in.readString();
@ -44,15 +44,15 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis
return new ParcelableCalculatorDisplayViewState(calculatorDisplayViewState);
}
@NotNull
@Nonnull
private CalculatorDisplayViewState viewState;
public ParcelableCalculatorDisplayViewState(@NotNull CalculatorDisplayViewState viewState) {
public ParcelableCalculatorDisplayViewState(@Nonnull CalculatorDisplayViewState viewState) {
this.viewState = viewState;
}
@Override
@NotNull
@Nonnull
public String getText() {
return viewState.getText();
}
@ -80,7 +80,7 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis
}
@Override
@NotNull
@Nonnull
public JsclOperation getOperation() {
return viewState.getOperation();
}
@ -97,7 +97,7 @@ public final class ParcelableCalculatorDisplayViewState implements CalculatorDis
}
@Override
public void writeToParcel(@NotNull Parcel out, int flags) {
public void writeToParcel(@Nonnull Parcel out, int flags) {
out.writeInt(viewState.getSelection());
out.writeInt(viewState.isValid() ? 1 : 0);
out.writeString(viewState.getStringResult());

View File

@ -2,7 +2,7 @@ package org.solovyev.android.calculator;
import android.os.Parcel;
import android.os.Parcelable;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: serso
@ -13,7 +13,7 @@ public final class ParcelableCalculatorEditorViewState implements CalculatorEdit
public static final Creator<ParcelableCalculatorEditorViewState> CREATOR = new Creator<ParcelableCalculatorEditorViewState>() {
@Override
public ParcelableCalculatorEditorViewState createFromParcel(@NotNull Parcel in) {
public ParcelableCalculatorEditorViewState createFromParcel(@Nonnull Parcel in) {
return ParcelableCalculatorEditorViewState.fromParcel(in);
}
@ -23,22 +23,22 @@ public final class ParcelableCalculatorEditorViewState implements CalculatorEdit
}
};
@NotNull
@Nonnull
private CalculatorEditorViewState viewState;
public ParcelableCalculatorEditorViewState(@NotNull CalculatorEditorViewState viewState) {
public ParcelableCalculatorEditorViewState(@Nonnull CalculatorEditorViewState viewState) {
this.viewState = viewState;
}
@NotNull
private static ParcelableCalculatorEditorViewState fromParcel(@NotNull Parcel in) {
@Nonnull
private static ParcelableCalculatorEditorViewState fromParcel(@Nonnull Parcel in) {
final String text = in.readString();
final int selection = in.readInt();
return new ParcelableCalculatorEditorViewState(CalculatorEditorViewStateImpl.newInstance(text, selection));
}
@Override
@NotNull
@Nonnull
public String getText() {
return viewState.getText();
}
@ -54,7 +54,7 @@ public final class ParcelableCalculatorEditorViewState implements CalculatorEdit
}
@Override
public void writeToParcel(@NotNull Parcel out, int flags) {
public void writeToParcel(@Nonnull Parcel out, int flags) {
out.writeString(viewState.getText());
out.writeInt(viewState.getSelection());
}

View File

@ -2,8 +2,8 @@ package org.solovyev.android.calculator;
import android.os.Parcel;
import android.os.Parcelable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.common.msg.MessageLevel;
import org.solovyev.common.msg.MessageType;
@ -24,7 +24,7 @@ public final class ParcelableDialogData implements DialogData, Parcelable {
public final static Creator<ParcelableDialogData> CREATOR = new Creator<ParcelableDialogData>() {
@Override
public ParcelableDialogData createFromParcel(@NotNull Parcel in) {
public ParcelableDialogData createFromParcel(@Nonnull Parcel in) {
return fromParcel(in);
}
@ -42,7 +42,7 @@ public final class ParcelableDialogData implements DialogData, Parcelable {
**********************************************************************
*/
@NotNull
@Nonnull
private DialogData nestedData;
/*
@ -53,12 +53,12 @@ public final class ParcelableDialogData implements DialogData, Parcelable {
**********************************************************************
*/
public ParcelableDialogData(@NotNull DialogData nestedData) {
public ParcelableDialogData(@Nonnull DialogData nestedData) {
this.nestedData = nestedData;
}
@NotNull
public static ParcelableDialogData wrap(@NotNull DialogData nestedData) {
@Nonnull
public static ParcelableDialogData wrap(@Nonnull DialogData nestedData) {
if (nestedData instanceof ParcelableDialogData) {
return ((ParcelableDialogData) nestedData);
} else {
@ -66,21 +66,21 @@ public final class ParcelableDialogData implements DialogData, Parcelable {
}
}
@NotNull
public static ParcelableDialogData fromParcel(@NotNull Parcel in) {
@Nonnull
public static ParcelableDialogData fromParcel(@Nonnull Parcel in) {
final String message = in.readString();
final MessageType messageType = MessageType.values()[in.readInt()];
final String title = in.readString();
return wrap(StringDialogData.newInstance(message, messageType, title));
}
@NotNull
@Nonnull
@Override
public String getMessage() {
return nestedData.getMessage();
}
@NotNull
@Nonnull
@Override
public MessageLevel getMessageLevel() {
return nestedData.getMessageLevel();
@ -98,7 +98,7 @@ public final class ParcelableDialogData implements DialogData, Parcelable {
}
@Override
public void writeToParcel(@NotNull Parcel out, int flags) {
public void writeToParcel(@Nonnull Parcel out, int flags) {
out.writeString(this.getMessage());
out.writeInt(this.getMessageLevel().getMessageLevel());
out.writeString(this.getTitle());

View File

@ -3,11 +3,11 @@ package org.solovyev.android.calculator.external;
import android.content.Context;
import android.content.Intent;
import android.os.Parcelable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.App;
import org.solovyev.android.calculator.*;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.HashSet;
import java.util.Set;
@ -39,19 +39,19 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList
private static final String TAG = "Calculator++ External Listener Helper";
@NotNull
@Nonnull
private final Set<Class<?>> externalListeners = new HashSet<Class<?>>();
@NotNull
@Nonnull
private final CalculatorEventHolder lastEvent = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId());
public AndroidExternalListenersContainer(@NotNull Calculator calculator) {
public AndroidExternalListenersContainer(@Nonnull Calculator calculator) {
calculator.addCalculatorEventListener(this);
}
public void onEditorStateChanged(@NotNull Context context,
@NotNull CalculatorEventData calculatorEventData,
@NotNull CalculatorEditorViewState editorViewState) {
public void onEditorStateChanged(@Nonnull Context context,
@Nonnull CalculatorEventData calculatorEventData,
@Nonnull CalculatorEditorViewState editorViewState) {
for (Class<?> externalListener : getExternalListenersSync()) {
final Intent intent = new Intent(EDITOR_STATE_CHANGED_ACTION);
@ -63,9 +63,9 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList
}
}
private void onDisplayStateChanged(@NotNull Context context,
@NotNull CalculatorEventData calculatorEventData,
@NotNull CalculatorDisplayViewState displayViewState) {
private void onDisplayStateChanged(@Nonnull Context context,
@Nonnull CalculatorEventData calculatorEventData,
@Nonnull CalculatorDisplayViewState displayViewState) {
for (Class<?> externalListener : getExternalListenersSync()) {
final Intent intent = new Intent(DISPLAY_STATE_CHANGED_ACTION);
intent.setClass(context, externalListener);
@ -76,7 +76,7 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList
}
}
@NotNull
@Nonnull
private Set<Class<?>> getExternalListenersSync() {
synchronized (externalListeners) {
return new HashSet<Class<?>>(externalListeners);
@ -84,21 +84,21 @@ public class AndroidExternalListenersContainer implements CalculatorExternalList
}
@Override
public void addExternalListener(@NotNull Class<?> externalCalculatorClass) {
public void addExternalListener(@Nonnull Class<?> externalCalculatorClass) {
synchronized (externalListeners) {
externalListeners.add(externalCalculatorClass);
}
}
@Override
public boolean removeExternalListener(@NotNull Class<?> externalCalculatorClass) {
public boolean removeExternalListener(@Nonnull Class<?> externalCalculatorClass) {
synchronized (externalListeners) {
return externalListeners.remove(externalCalculatorClass);
}
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
final CalculatorEventHolder.Result result = lastEvent.apply(calculatorEventData);
if (result.isNewAfter()) {
switch (calculatorEventType) {

View File

@ -3,7 +3,7 @@ package org.solovyev.android.calculator.external;
import android.content.Context;
import android.content.Intent;
import android.os.Parcelable;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.CalculatorDisplayViewState;
import org.solovyev.android.calculator.CalculatorEditorViewState;
import org.solovyev.android.calculator.Locator;
@ -18,21 +18,21 @@ public class DefaultExternalCalculatorIntentHandler implements ExternalCalculato
private static final String TAG = ExternalCalculatorIntentHandler.class.getSimpleName();
@NotNull
@Nonnull
private final MutableObject<Long> lastDisplayEventId = new MutableObject<Long>(0L);
@NotNull
@Nonnull
private final MutableObject<Long> lastEditorEventId = new MutableObject<Long>(0L);
@NotNull
@Nonnull
private final ExternalCalculatorStateUpdater stateUpdater;
public DefaultExternalCalculatorIntentHandler(@NotNull ExternalCalculatorStateUpdater stateUpdater) {
public DefaultExternalCalculatorIntentHandler(@Nonnull ExternalCalculatorStateUpdater stateUpdater) {
this.stateUpdater = stateUpdater;
}
@Override
public void onIntent(@NotNull Context context, @NotNull Intent intent) {
public void onIntent(@Nonnull Context context, @Nonnull Intent intent) {
if (AndroidExternalListenersContainer.EDITOR_STATE_CHANGED_ACTION.equals(intent.getAction())) {
Locator.getInstance().getNotifier().showDebugMessage(TAG, "Editor state changed broadcast received!");
@ -76,17 +76,17 @@ public class DefaultExternalCalculatorIntentHandler implements ExternalCalculato
}
}
protected void updateState(@NotNull Context context,
@NotNull CalculatorEditorViewState editorViewState,
@NotNull CalculatorDisplayViewState displayViewState) {
protected void updateState(@Nonnull Context context,
@Nonnull CalculatorEditorViewState editorViewState,
@Nonnull CalculatorDisplayViewState displayViewState) {
stateUpdater.updateState(context, editorViewState, displayViewState);
}
protected void onDisplayStateChanged(@NotNull Context context, @NotNull CalculatorDisplayViewState displayViewState) {
protected void onDisplayStateChanged(@Nonnull Context context, @Nonnull CalculatorDisplayViewState displayViewState) {
updateState(context, Locator.getInstance().getEditor().getViewState(), displayViewState);
}
protected void onEditorStateChanged(@NotNull Context context, @NotNull CalculatorEditorViewState editorViewState) {
protected void onEditorStateChanged(@Nonnull Context context, @Nonnull CalculatorEditorViewState editorViewState) {
updateState(context, editorViewState, Locator.getInstance().getDisplay().getViewState());
}
}

View File

@ -2,7 +2,7 @@ package org.solovyev.android.calculator.external;
import android.content.Context;
import android.content.Intent;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: serso
@ -11,5 +11,5 @@ import org.jetbrains.annotations.NotNull;
*/
public interface ExternalCalculatorIntentHandler {
void onIntent(@NotNull Context context, @NotNull Intent intent);
void onIntent(@Nonnull Context context, @Nonnull Intent intent);
}

View File

@ -1,7 +1,7 @@
package org.solovyev.android.calculator.external;
import android.content.Context;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.CalculatorDisplayViewState;
import org.solovyev.android.calculator.CalculatorEditorViewState;
@ -12,7 +12,7 @@ import org.solovyev.android.calculator.CalculatorEditorViewState;
*/
public interface ExternalCalculatorStateUpdater {
void updateState(@NotNull Context context,
@NotNull CalculatorEditorViewState editorState,
@NotNull CalculatorDisplayViewState displayState);
void updateState(@Nonnull Context context,
@Nonnull CalculatorEditorViewState editorState,
@Nonnull CalculatorDisplayViewState displayState);
}

View File

@ -16,7 +16,7 @@ import jscl.NumeralBase;
import jscl.math.function.Function;
import jscl.math.function.IConstant;
import jscl.math.operator.Operator;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.prefs.BooleanPreference;
@ -85,22 +85,22 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen
preferenceKeys.add(maxCalculationTime.getKey());
}
@NotNull
@Nonnull
public static List<String> getPreferenceKeys() {
return Collections.unmodifiableList(preferenceKeys);
}
}
@NotNull
@Nonnull
private final Context context;
@NotNull
@Nonnull
private final CalculatorEngine calculatorEngine;
@NotNull
@Nonnull
private final Object lock;
public AndroidCalculatorEngine(@NotNull Application application) {
public AndroidCalculatorEngine(@Nonnull Application application) {
this.context = application;
PreferenceManager.getDefaultSharedPreferences(application).registerOnSharedPreferenceChangeListener(this);
@ -117,42 +117,42 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen
}
@Override
@NotNull
@Nonnull
public CalculatorMathRegistry<IConstant> getVarsRegistry() {
return calculatorEngine.getVarsRegistry();
}
@Override
@NotNull
@Nonnull
public CalculatorMathRegistry<Function> getFunctionsRegistry() {
return calculatorEngine.getFunctionsRegistry();
}
@Override
@NotNull
@Nonnull
public CalculatorMathRegistry<Operator> getOperatorsRegistry() {
return calculatorEngine.getOperatorsRegistry();
}
@Override
@NotNull
@Nonnull
public CalculatorMathRegistry<Operator> getPostfixFunctionsRegistry() {
return calculatorEngine.getPostfixFunctionsRegistry();
}
@Override
@NotNull
@Nonnull
public CalculatorMathEngine getMathEngine() {
return calculatorEngine.getMathEngine();
}
@NotNull
@Nonnull
@Override
public MathEngine getMathEngine0() {
return calculatorEngine.getMathEngine0();
}
@NotNull
@Nonnull
@Override
public NumeralBase getNumeralBase() {
return calculatorEngine.getNumeralBase();
@ -196,47 +196,47 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen
}
@Override
public void setPrecision(@NotNull Integer precision) {
public void setPrecision(@Nonnull Integer precision) {
calculatorEngine.setPrecision(precision);
}
@Override
public void setRoundResult(@NotNull Boolean round) {
public void setRoundResult(@Nonnull Boolean round) {
calculatorEngine.setRoundResult(round);
}
@NotNull
@Nonnull
@Override
public AngleUnit getAngleUnits() {
return calculatorEngine.getAngleUnits();
}
@Override
public void setAngleUnits(@NotNull AngleUnit angleUnits) {
public void setAngleUnits(@Nonnull AngleUnit angleUnits) {
calculatorEngine.setAngleUnits(angleUnits);
}
@Override
public void setNumeralBase(@NotNull NumeralBase numeralBase) {
public void setNumeralBase(@Nonnull NumeralBase numeralBase) {
calculatorEngine.setNumeralBase(numeralBase);
}
@Override
public void setMultiplicationSign(@NotNull String multiplicationSign) {
public void setMultiplicationSign(@Nonnull String multiplicationSign) {
calculatorEngine.setMultiplicationSign(multiplicationSign);
}
@Override
public void setScienceNotation(@NotNull Boolean scienceNotation) {
public void setScienceNotation(@Nonnull Boolean scienceNotation) {
calculatorEngine.setScienceNotation(scienceNotation);
}
@Override
public void setTimeout(@NotNull Integer timeout) {
public void setTimeout(@Nonnull Integer timeout) {
calculatorEngine.setTimeout(timeout);
}
private void softReset(@NotNull SharedPreferences preferences) {
private void softReset(@Nonnull SharedPreferences preferences) {
this.setPrecision(Preferences.precision.getPreference(preferences));
this.setRoundResult(Preferences.roundResult.getPreference(preferences));
this.setAngleUnits(getAngleUnitsFromPrefs(preferences));
@ -254,23 +254,23 @@ public class AndroidCalculatorEngine implements CalculatorEngine, SharedPreferen
}
}
@NotNull
public NumeralBase getNumeralBaseFromPrefs(@NotNull SharedPreferences preferences) {
@Nonnull
public NumeralBase getNumeralBaseFromPrefs(@Nonnull SharedPreferences preferences) {
return Preferences.numeralBase.getPreference(preferences);
}
@NotNull
public AngleUnit getAngleUnitsFromPrefs(@NotNull SharedPreferences preferences) {
@Nonnull
public AngleUnit getAngleUnitsFromPrefs(@Nonnull SharedPreferences preferences) {
return Preferences.angleUnit.getPreference(preferences);
}
//for tests only
public void setDecimalGroupSymbols(@NotNull DecimalFormatSymbols decimalGroupSymbols) {
public void setDecimalGroupSymbols(@Nonnull DecimalFormatSymbols decimalGroupSymbols) {
this.calculatorEngine.setDecimalGroupSymbols(decimalGroupSymbols);
}
@Override
@NotNull
@Nonnull
public String getMultiplicationSign() {
return calculatorEngine.getMultiplicationSign();
}

View File

@ -5,8 +5,8 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.preference.PreferenceManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
import org.solovyev.android.App;
@ -23,20 +23,20 @@ import java.io.StringWriter;
*/
public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements MathEntityDao<T> {
@NotNull
@Nonnull
private static final String TAG = AndroidMathEntityDao.class.getSimpleName();
@Nullable
private final Integer preferenceStringId;
@NotNull
@Nonnull
private final Context context;
@Nullable
private final Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass;
public AndroidMathEntityDao(@Nullable Integer preferenceStringId,
@NotNull Application application,
@Nonnull Application application,
@Nullable Class<? extends MathEntityPersistenceContainer<T>> persistenceContainerClass) {
this.preferenceStringId = preferenceStringId;
this.context = application;
@ -44,7 +44,7 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
}
@Override
public void save(@NotNull MathEntityPersistenceContainer<T> container) {
public void save(@Nonnull MathEntityPersistenceContainer<T> container) {
if (preferenceStringId != null) {
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
final SharedPreferences.Editor editor = settings.edit();
@ -86,7 +86,7 @@ public class AndroidMathEntityDao<T extends MathPersistenceEntity> implements Ma
}
@Nullable
public String getDescription(@NotNull String descriptionId) {
public String getDescription(@Nonnull String descriptionId) {
final Resources resources = context.getResources();
final int stringId = resources.getIdentifier(descriptionId, "string", App.getApplication().getClass().getPackage().getName());

View File

@ -4,8 +4,8 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import jscl.math.Generic;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorPreferences;
import java.util.List;
@ -17,11 +17,11 @@ import java.util.List;
*/
public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPreferences.OnSharedPreferenceChangeListener {
@NotNull
@Nonnull
private final CalculatorPlotter plotter;
public AndroidCalculatorPlotter(@NotNull Context context,
@NotNull CalculatorPlotter plotter) {
public AndroidCalculatorPlotter(@Nonnull Context context,
@Nonnull CalculatorPlotter plotter) {
this.plotter = plotter;
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
@ -31,72 +31,72 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
}
@Override
@NotNull
@Nonnull
public PlotData getPlotData() {
return plotter.getPlotData();
}
@Override
public boolean addFunction(@NotNull Generic expression) {
public boolean addFunction(@Nonnull Generic expression) {
return plotter.addFunction(expression);
}
@Override
public boolean addFunction(@NotNull PlotFunction plotFunction) {
public boolean addFunction(@Nonnull PlotFunction plotFunction) {
return plotter.addFunction(plotFunction);
}
@Override
public boolean addFunction(@NotNull XyFunction xyFunction) {
public boolean addFunction(@Nonnull XyFunction xyFunction) {
return plotter.addFunction(xyFunction);
}
@Override
public boolean addFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) {
public boolean addFunction(@Nonnull XyFunction xyFunction, @Nonnull PlotLineDef functionLineDef) {
return plotter.addFunction(xyFunction, functionLineDef);
}
@Override
public boolean updateFunction(@NotNull PlotFunction newFunction) {
public boolean updateFunction(@Nonnull PlotFunction newFunction) {
return plotter.updateFunction(newFunction);
}
@Override
public boolean updateFunction(@NotNull XyFunction xyFunction, @NotNull PlotLineDef functionLineDef) {
public boolean updateFunction(@Nonnull XyFunction xyFunction, @Nonnull PlotLineDef functionLineDef) {
return plotter.updateFunction(xyFunction, functionLineDef);
}
@Override
public boolean removeFunction(@NotNull PlotFunction plotFunction) {
public boolean removeFunction(@Nonnull PlotFunction plotFunction) {
return plotter.removeFunction(plotFunction);
}
@Override
public boolean removeFunction(@NotNull XyFunction xyFunction) {
public boolean removeFunction(@Nonnull XyFunction xyFunction) {
return plotter.removeFunction(xyFunction);
}
@NotNull
@Nonnull
@Override
public PlotFunction pin(@NotNull PlotFunction plotFunction) {
public PlotFunction pin(@Nonnull PlotFunction plotFunction) {
return plotter.pin(plotFunction);
}
@NotNull
@Nonnull
@Override
public PlotFunction unpin(@NotNull PlotFunction plotFunction) {
public PlotFunction unpin(@Nonnull PlotFunction plotFunction) {
return plotter.unpin(plotFunction);
}
@NotNull
@Nonnull
@Override
public PlotFunction show(@NotNull PlotFunction plotFunction) {
public PlotFunction show(@Nonnull PlotFunction plotFunction) {
return plotter.show(plotFunction);
}
@NotNull
@Nonnull
@Override
public PlotFunction hide(@NotNull PlotFunction plotFunction) {
public PlotFunction hide(@Nonnull PlotFunction plotFunction) {
return plotter.hide(plotFunction);
}
@ -107,18 +107,18 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
@Nullable
@Override
public PlotFunction getFunctionById(@NotNull String functionId) {
public PlotFunction getFunctionById(@Nonnull String functionId) {
return plotter.getFunctionById(functionId);
}
@Override
@NotNull
@Nonnull
public List<PlotFunction> getFunctions() {
return plotter.getFunctions();
}
@Override
@NotNull
@Nonnull
public List<PlotFunction> getVisibleFunctions() {
return plotter.getVisibleFunctions();
}
@ -129,7 +129,7 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
}
@Override
public void plot(@NotNull Generic expression) {
public void plot(@Nonnull Generic expression) {
plotter.plot(expression);
}
@ -139,7 +139,7 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
}
@Override
public boolean isPlotPossibleFor(@NotNull Generic expression) {
public boolean isPlotPossibleFor(@Nonnull Generic expression) {
return plotter.isPlotPossibleFor(expression);
}
@ -159,12 +159,12 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
}
@Override
public void savePlotBoundaries(@NotNull PlotBoundaries plotBoundaries) {
public void savePlotBoundaries(@Nonnull PlotBoundaries plotBoundaries) {
plotter.savePlotBoundaries(plotBoundaries);
}
@Override
public void setPlotBoundaries(@NotNull PlotBoundaries plotBoundaries) {
public void setPlotBoundaries(@Nonnull PlotBoundaries plotBoundaries) {
plotter.setPlotBoundaries(plotBoundaries);
}

View File

@ -2,8 +2,8 @@ package org.solovyev.android.calculator.plot;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
@ -14,43 +14,43 @@ public enum AndroidPlotLineStyle {
solid(PlotLineStyle.solid) {
@Override
public void applyToPaint(@NotNull Paint paint) {
public void applyToPaint(@Nonnull Paint paint) {
paint.setPathEffect(null);
}
},
dashed(PlotLineStyle.dashed) {
@Override
public void applyToPaint(@NotNull Paint paint) {
public void applyToPaint(@Nonnull Paint paint) {
paint.setPathEffect(new DashPathEffect(new float[]{10, 20}, 0));
}
},
dotted(PlotLineStyle.dotted) {
@Override
public void applyToPaint(@NotNull Paint paint) {
public void applyToPaint(@Nonnull Paint paint) {
paint.setPathEffect(new DashPathEffect(new float[]{5, 1}, 0));
}
},
dash_dotted(PlotLineStyle.dash_dotted) {
@Override
public void applyToPaint(@NotNull Paint paint) {
public void applyToPaint(@Nonnull Paint paint) {
paint.setPathEffect(new DashPathEffect(new float[]{10, 20, 5, 1}, 0));
}
};
@NotNull
@Nonnull
private final PlotLineStyle plotLineStyle;
AndroidPlotLineStyle(@NotNull PlotLineStyle plotLineStyle) {
AndroidPlotLineStyle(@Nonnull PlotLineStyle plotLineStyle) {
this.plotLineStyle = plotLineStyle;
}
public abstract void applyToPaint(@NotNull Paint paint);
public abstract void applyToPaint(@Nonnull Paint paint);
@Nullable
public static AndroidPlotLineStyle valueOf(@NotNull PlotLineStyle plotLineStyle) {
public static AndroidPlotLineStyle valueOf(@Nonnull PlotLineStyle plotLineStyle) {
for (AndroidPlotLineStyle androidPlotLineStyle : values()) {
if (androidPlotLineStyle.plotLineStyle == plotLineStyle) {
return androidPlotLineStyle;

View File

@ -11,7 +11,7 @@ import android.content.res.Resources;
import android.graphics.Paint;
import android.text.TextPaint;
import android.util.AttributeSet;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.view.drag.DirectionDragButton;
@ -23,14 +23,14 @@ import org.solovyev.android.view.drag.DirectionDragButton;
*/
public class AngleUnitsButton extends DirectionDragButton {
public AngleUnitsButton(Context context, @NotNull AttributeSet attrs) {
public AngleUnitsButton(Context context, @Nonnull AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void initDirectionTextPaint(@NotNull Paint basePaint,
@NotNull DirectionTextData directionTextData,
@NotNull Resources resources) {
protected void initDirectionTextPaint(@Nonnull Paint basePaint,
@Nonnull DirectionTextData directionTextData,
@Nonnull Resources resources) {
super.initDirectionTextPaint(basePaint, directionTextData, resources);
final TextPaint directionTextPaint = directionTextData.getPaint();

View File

@ -4,8 +4,8 @@ import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.view.WindowManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorParseException;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.ToJsclTextProcessor;
@ -32,7 +32,7 @@ public class NumeralBaseConverterDialog {
this.initialFromValue = initialFromValue;
}
public void show(@NotNull Context context) {
public void show(@Nonnull Context context) {
final UnitConverterViewBuilder b = new UnitConverterViewBuilder();
b.setFromUnitTypes(Arrays.asList(CalculatorNumeralBase.values()));
b.setToUnitTypes(Arrays.asList(CalculatorNumeralBase.values()));
@ -64,7 +64,7 @@ public class NumeralBaseConverterDialog {
b.setCustomButtonData(new UnitConverterViewBuilder.CustomButtonData(context.getString(R.string.c_use_short), new UnitConverterViewBuilder.CustomButtonOnClickListener() {
@Override
public void onClick(@NotNull Unit<String> fromUnits, @NotNull Unit<String> toUnits) {
public void onClick(@Nonnull Unit<String> fromUnits, @Nonnull Unit<String> toUnits) {
String toUnitsValue = toUnits.getValue();
if (!toUnits.getUnitType().equals(CalculatorNumeralBase.valueOf(Locator.getInstance().getEngine().getNumeralBase()))) {

View File

@ -11,7 +11,7 @@ import android.content.res.Resources;
import android.graphics.Paint;
import android.text.TextPaint;
import android.util.AttributeSet;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.view.drag.DirectionDragButton;
@ -23,14 +23,14 @@ import org.solovyev.android.view.drag.DirectionDragButton;
*/
public class NumeralBasesButton extends DirectionDragButton {
public NumeralBasesButton(Context context, @NotNull AttributeSet attrs) {
public NumeralBasesButton(Context context, @Nonnull AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void initDirectionTextPaint(@NotNull Paint basePaint,
@NotNull DirectionTextData directionTextData,
@NotNull Resources resources) {
protected void initDirectionTextPaint(@Nonnull Paint basePaint,
@Nonnull DirectionTextData directionTextData,
@Nonnull Resources resources) {
super.initDirectionTextPaint(basePaint, directionTextData, resources);
final TextPaint directionTextPaint = directionTextData.getPaint();

View File

@ -6,8 +6,8 @@
package org.solovyev.android.calculator.view;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.math.MathType;
import org.solovyev.android.calculator.text.TextProcessor;
@ -31,7 +31,7 @@ public class TextHighlighter implements TextProcessor<TextHighlighter.Result, St
public static class Result implements CharSequence {
@NotNull
@Nonnull
private final CharSequence charSequence;
@Nullable
@ -39,7 +39,7 @@ public class TextHighlighter implements TextProcessor<TextHighlighter.Result, St
private final int offset;
public Result(@NotNull CharSequence charSequence, int offset) {
public Result(@Nonnull CharSequence charSequence, int offset) {
this.charSequence = charSequence;
this.offset = offset;
}
@ -67,7 +67,7 @@ public class TextHighlighter implements TextProcessor<TextHighlighter.Result, St
return string;
}
@NotNull
@Nonnull
public CharSequence getCharSequence() {
return charSequence;
}
@ -94,9 +94,9 @@ public class TextHighlighter implements TextProcessor<TextHighlighter.Result, St
this.colorBlue = color & 0xFF;
}
@NotNull
@Nonnull
@Override
public Result process(@NotNull String text) throws CalculatorParseException {
public Result process(@Nonnull String text) throws CalculatorParseException {
final CharSequence result;
int maxNumberOfOpenGroupSymbols = 0;
@ -185,7 +185,7 @@ public class TextHighlighter implements TextProcessor<TextHighlighter.Result, St
return new Result(result, resultOffset);
}
private int processHighlightedText(@NotNull StringBuilder result, int i, @NotNull String match, @NotNull String tag, @Nullable Map<String, String> tagAttributes) {
private int processHighlightedText(@Nonnull StringBuilder result, int i, @Nonnull String match, @Nonnull String tag, @Nullable Map<String, String> tagAttributes) {
result.append("<").append(tag);
if (tagAttributes != null && !tagAttributes.entrySet().isEmpty()) {
@ -203,7 +203,7 @@ public class TextHighlighter implements TextProcessor<TextHighlighter.Result, St
}
}
private int processBracketGroup(@NotNull StringBuilder result, @NotNull CharSequence s, int i, int numberOfOpenings, int maxNumberOfGroups) {
private int processBracketGroup(@Nonnull StringBuilder result, @Nonnull CharSequence s, int i, int numberOfOpenings, int maxNumberOfGroups) {
result.append("<font color=\"").append(getColor(maxNumberOfGroups, numberOfOpenings)).append("\">");

View File

@ -8,8 +8,8 @@ import android.text.TextWatcher;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.core.R;
import org.solovyev.android.view.ViewBuilder;
import org.solovyev.android.view.ViewFromLayoutBuilder;
@ -25,16 +25,16 @@ import java.util.List;
*/
public class UnitConverterViewBuilder implements ViewBuilder<View> {
@NotNull
@Nonnull
private List<? extends UnitType<String>> fromUnitTypes = Collections.emptyList();
@NotNull
@Nonnull
private List<? extends UnitType<String>> toUnitTypes = Collections.emptyList();
@Nullable
private Unit<String> fromValue;
@NotNull
@Nonnull
private UnitConverter<String> converter = UnitConverter.Dummy.getInstance();
@Nullable
@ -43,11 +43,11 @@ public class UnitConverterViewBuilder implements ViewBuilder<View> {
@Nullable
private CustomButtonData customButtonData;
public void setFromUnitTypes(@NotNull List<? extends UnitType<String>> fromUnitTypes) {
public void setFromUnitTypes(@Nonnull List<? extends UnitType<String>> fromUnitTypes) {
this.fromUnitTypes = fromUnitTypes;
}
public void setToUnitTypes(@NotNull List<? extends UnitType<String>> toUnitTypes) {
public void setToUnitTypes(@Nonnull List<? extends UnitType<String>> toUnitTypes) {
this.toUnitTypes = toUnitTypes;
}
@ -55,7 +55,7 @@ public class UnitConverterViewBuilder implements ViewBuilder<View> {
this.fromValue = fromValue;
}
public void setConverter(@NotNull UnitConverter<String> converter) {
public void setConverter(@Nonnull UnitConverter<String> converter) {
this.converter = converter;
}
@ -67,9 +67,9 @@ public class UnitConverterViewBuilder implements ViewBuilder<View> {
this.customButtonData = customButtonData;
}
@NotNull
@Nonnull
@Override
public View build(@NotNull final Context context) {
public View build(@Nonnull final Context context) {
final View main = ViewFromLayoutBuilder.newInstance(R.layout.cpp_unit_converter).build(context);
final Spinner fromSpinner = (Spinner) main.findViewById(R.id.unit_types_from);
@ -137,10 +137,10 @@ public class UnitConverterViewBuilder implements ViewBuilder<View> {
return main;
}
private void fillSpinner(@NotNull final View main,
@NotNull final Context context,
private void fillSpinner(@Nonnull final View main,
@Nonnull final Context context,
final int spinnerId,
@NotNull List<? extends UnitType<String>> unitTypes) {
@Nonnull List<? extends UnitType<String>> unitTypes) {
final Spinner spinner = (Spinner) main.findViewById(spinnerId);
final ArrayAdapter<UnitType<String>> adapter = new ArrayAdapter<UnitType<String>>(context, android.R.layout.simple_spinner_item);
@ -161,7 +161,7 @@ public class UnitConverterViewBuilder implements ViewBuilder<View> {
spinner.setAdapter(adapter);
}
private static void doConversion(@NotNull View main, @NotNull Context context, @NotNull UnitConverter<String> converter) {
private static void doConversion(@Nonnull View main, @Nonnull Context context, @Nonnull UnitConverter<String> converter) {
final EditText fromEditText = (EditText) main.findViewById(R.id.units_from);
final EditText toEditText = (EditText) main.findViewById(R.id.units_to);
@ -174,46 +174,46 @@ public class UnitConverterViewBuilder implements ViewBuilder<View> {
}
}
@NotNull
private static Unit<String> getToUnit(@NotNull View main) {
@Nonnull
private static Unit<String> getToUnit(@Nonnull View main) {
final EditText toUnits = (EditText) main.findViewById(R.id.units_to);
return UnitImpl.newInstance(toUnits.getText().toString(), getToUnitType(main));
}
@NotNull
private static UnitType<String> getToUnitType(@NotNull View main) {
@Nonnull
private static UnitType<String> getToUnitType(@Nonnull View main) {
final Spinner toSpinner = (Spinner) main.findViewById(R.id.unit_types_to);
return (UnitType<String>) toSpinner.getSelectedItem();
}
@NotNull
private static Unit<String> getFromUnit(@NotNull View main) {
@Nonnull
private static Unit<String> getFromUnit(@Nonnull View main) {
final EditText fromUnits = (EditText) main.findViewById(R.id.units_from);
return UnitImpl.newInstance(fromUnits.getText().toString(), getFromUnitType(main));
}
@NotNull
private static UnitType<String> getFromUnitType(@NotNull View main) {
@Nonnull
private static UnitType<String> getFromUnitType(@Nonnull View main) {
final Spinner fromSpinner = (Spinner) main.findViewById(R.id.unit_types_from);
return (UnitType<String>) fromSpinner.getSelectedItem();
}
public static class CustomButtonData {
@NotNull
@Nonnull
private String text;
@NotNull
@Nonnull
private CustomButtonOnClickListener clickListener;
public CustomButtonData(@NotNull String text, @NotNull CustomButtonOnClickListener clickListener) {
public CustomButtonData(@Nonnull String text, @Nonnull CustomButtonOnClickListener clickListener) {
this.text = text;
this.clickListener = clickListener;
}
}
public static interface CustomButtonOnClickListener {
void onClick(@NotNull Unit<String> fromUnits, @NotNull Unit<String> toUnits);
void onClick(@Nonnull Unit<String> fromUnits, @Nonnull Unit<String> toUnits);
}
}

View File

@ -2,4 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.solovyev.android.calculator.onscreen"
android:versionCode="1"
android:versionName="1.0" />
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="17" />
</manifest>

View File

@ -5,7 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.CalculatorPreferences;
/**
@ -19,8 +19,8 @@ public final class CalculatorOnscreenBroadcastReceiver extends BroadcastReceiver
}
@Override
public void onReceive(@NotNull Context context,
@NotNull Intent intent) {
public void onReceive(@Nonnull Context context,
@Nonnull Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
if (CalculatorPreferences.OnscreenCalculator.startOnBoot.getPreferenceNoError(preferences)) {

View File

@ -9,8 +9,8 @@ import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.Views;
import org.solovyev.android.calculator.CalculatorDisplayViewState;
import org.solovyev.android.calculator.CalculatorEditorViewState;
@ -29,14 +29,14 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul
private static final int NOTIFICATION_ID = 9031988; // my birthday =)
@NotNull
@Nonnull
private final ExternalCalculatorIntentHandler intentHandler = new DefaultExternalCalculatorIntentHandler(this);
public static final Class<CalculatorOnscreenBroadcastReceiver> INTENT_LISTENER_CLASS = CalculatorOnscreenBroadcastReceiver.class;
@Nullable
private static String cursorColor;
@NotNull
@Nonnull
private CalculatorOnscreenView view;
private boolean compatibilityStart = true;
@ -89,7 +89,7 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul
Locator.getInstance().getExternalListenersContainer().addExternalListener(getIntentListenerClass());
}
@NotNull
@Nonnull
private static Class<?> getIntentListenerClass() {
return INTENT_LISTENER_CLASS;
}
@ -108,13 +108,13 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul
}
@Override
public void updateState(@NotNull Context context, @NotNull CalculatorEditorViewState editorState, @NotNull CalculatorDisplayViewState displayState) {
public void updateState(@Nonnull Context context, @Nonnull CalculatorEditorViewState editorState, @Nonnull CalculatorDisplayViewState displayState) {
view.updateDisplayState(displayState);
view.updateEditorState(editorState);
}
@NotNull
private static String getCursorColor(@NotNull Context context) {
@Nonnull
private static String getCursorColor(@Nonnull Context context) {
if (cursorColor == null) {
cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_onscreen_cursor_color)).substring(2);
}
@ -166,7 +166,7 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul
}
}
private boolean isInitIntent(@NotNull Intent intent) {
private boolean isInitIntent(@Nonnull Intent intent) {
return intent.getAction().equals(AndroidExternalListenersContainer.INIT_ACTION);
}
@ -200,19 +200,19 @@ public class CalculatorOnscreenService extends Service implements ExternalCalcul
nm.notify(NOTIFICATION_ID, builder.getNotification());
}
public static void showNotification(@NotNull Context context) {
public static void showNotification(@Nonnull Context context) {
final Intent intent = new Intent(AndroidExternalListenersContainer.INIT_ACTION);
intent.setClass(context, getIntentListenerClass());
context.sendBroadcast(intent);
}
public static void showOnscreenView(@NotNull Context context) {
public static void showOnscreenView(@Nonnull Context context) {
final Intent intent = createShowOnscreenViewIntent(context);
context.sendBroadcast(intent);
}
@NotNull
private static Intent createShowOnscreenViewIntent(@NotNull Context context) {
@Nonnull
private static Intent createShowOnscreenViewIntent(@Nonnull Context context) {
final Intent intent = new Intent(AndroidExternalListenersContainer.INIT_ACTION);
intent.setClass(context, getIntentListenerClass());
intent.putExtra(AndroidExternalListenersContainer.INIT_ACTION_CREATE_VIEW_EXTRA, true);

View File

@ -5,7 +5,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.Android;
import org.solovyev.android.App;
import org.solovyev.android.calculator.AbstractFixableError;
@ -38,7 +38,7 @@ public class CalculatorOnscreenStartActivity extends Activity {
public static class RemoveIconFixableError extends AbstractFixableError {
public RemoveIconFixableError(@NotNull Context context) {
public RemoveIconFixableError(@Nonnull Context context) {
super(context.getString(R.string.cpp_onscreen_remove_icon_button_text));
}

View File

@ -11,8 +11,8 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.prefs.Preference;
@ -50,28 +50,28 @@ public class CalculatorOnscreenView {
**********************************************************************
*/
@NotNull
@Nonnull
private View root;
@NotNull
@Nonnull
private View content;
@NotNull
@Nonnull
private View header;
@NotNull
@Nonnull
private AndroidCalculatorEditorView editorView;
@NotNull
@Nonnull
private AndroidCalculatorDisplayView displayView;
@NotNull
@Nonnull
private Context context;
@NotNull
@Nonnull
private CalculatorOnscreenViewState state = CalculatorOnscreenViewState.newDefaultState();
@NotNull
@Nonnull
private String cursorColor;
@Nullable
@ -107,9 +107,9 @@ public class CalculatorOnscreenView {
private CalculatorOnscreenView() {
}
public static CalculatorOnscreenView newInstance(@NotNull Context context,
@NotNull CalculatorOnscreenViewState state,
@NotNull String cursorColor,
public static CalculatorOnscreenView newInstance(@Nonnull Context context,
@Nonnull CalculatorOnscreenViewState state,
@Nonnull String cursorColor,
@Nullable OnscreenViewListener viewListener) {
final CalculatorOnscreenView result = new CalculatorOnscreenView();
@ -136,12 +136,12 @@ public class CalculatorOnscreenView {
**********************************************************************
*/
public void updateDisplayState(@NotNull CalculatorDisplayViewState displayState) {
public void updateDisplayState(@Nonnull CalculatorDisplayViewState displayState) {
checkInit();
displayView.setState(displayState);
}
public void updateEditorState(@NotNull CalculatorEditorViewState editorState) {
public void updateEditorState(@Nonnull CalculatorEditorViewState editorState) {
checkInit();
editorView.setState(editorState);
}
@ -312,13 +312,13 @@ public class CalculatorOnscreenView {
}
}
public static void persistState(@NotNull Context context, @NotNull CalculatorOnscreenViewState state) {
public static void persistState(@Nonnull Context context, @Nonnull CalculatorOnscreenViewState state) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
viewStatePreference.putPreference(preferences, state);
}
@Nullable
public static CalculatorOnscreenViewState readState(@NotNull Context context) {
public static CalculatorOnscreenViewState readState(@Nonnull Context context) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
if (viewStatePreference.isSet(preferences)) {
return viewStatePreference.getPreference(preferences);
@ -344,12 +344,12 @@ public class CalculatorOnscreenView {
}
}
@NotNull
@Nonnull
private WindowManager getWindowManager() {
return ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE));
}
@NotNull
@Nonnull
public CalculatorOnscreenViewState getCurrentState(boolean useRealSize) {
final WindowManager.LayoutParams params = (WindowManager.LayoutParams) root.getLayoutParams();
if (useRealSize) {
@ -389,7 +389,7 @@ public class CalculatorOnscreenView {
**********************************************************************
*/
@NotNull
@Nonnull
private final WindowManager wm;
private int orientation;
@ -400,7 +400,7 @@ public class CalculatorOnscreenView {
private long time = 0;
@NotNull
@Nonnull
private final View view;
private int displayWidth;
@ -415,8 +415,8 @@ public class CalculatorOnscreenView {
**********************************************************************
*/
public WindowDragTouchListener(@NotNull WindowManager wm,
@NotNull View view) {
public WindowDragTouchListener(@Nonnull WindowManager wm,
@Nonnull View view) {
this.wm = wm;
this.view = view;
initDisplayParams();
@ -503,7 +503,7 @@ public class CalculatorOnscreenView {
return δx >= DIST_EPS && δx < DIST_MAX;
}
@NotNull
@Nonnull
private static String toString(float x, float y) {
return "(" + formatFloat(x) + ", " + formatFloat(y) + ")";
}

View File

@ -4,8 +4,8 @@ import android.content.SharedPreferences;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.json.JSONException;
import org.json.JSONObject;
import org.solovyev.android.prefs.AbstractPreference;
@ -23,7 +23,7 @@ public class CalculatorOnscreenViewState implements Parcelable {
private static final String TAG = CalculatorOnscreenViewState.class.getSimpleName();
public static final Parcelable.Creator<CalculatorOnscreenViewState> CREATOR = new Parcelable.Creator<CalculatorOnscreenViewState>() {
public CalculatorOnscreenViewState createFromParcel(@NotNull Parcel in) {
public CalculatorOnscreenViewState createFromParcel(@Nonnull Parcel in) {
return CalculatorOnscreenViewState.fromParcel(in);
}
@ -43,8 +43,8 @@ public class CalculatorOnscreenViewState implements Parcelable {
private CalculatorOnscreenViewState() {
}
@NotNull
private static CalculatorOnscreenViewState fromParcel(@NotNull Parcel in) {
@Nonnull
private static CalculatorOnscreenViewState fromParcel(@Nonnull Parcel in) {
final CalculatorOnscreenViewState result = new CalculatorOnscreenViewState();
result.width = in.readInt();
result.height = in.readInt();
@ -53,12 +53,12 @@ public class CalculatorOnscreenViewState implements Parcelable {
return result;
}
@NotNull
@Nonnull
public static CalculatorOnscreenViewState newDefaultState() {
return newInstance(200, 400, 0, 0);
}
@NotNull
@Nonnull
public static CalculatorOnscreenViewState newInstance(int width, int height, int x, int y) {
final CalculatorOnscreenViewState result = new CalculatorOnscreenViewState();
result.width = width;
@ -106,7 +106,7 @@ public class CalculatorOnscreenViewState implements Parcelable {
}
@Override
public void writeToParcel(@NotNull Parcel out, int flags) {
public void writeToParcel(@Nonnull Parcel out, int flags) {
out.writeInt(width);
out.writeInt(height);
out.writeInt(x);
@ -125,13 +125,13 @@ public class CalculatorOnscreenViewState implements Parcelable {
public static class Preference extends AbstractPreference<CalculatorOnscreenViewState> {
public Preference(@NotNull String key, @Nullable CalculatorOnscreenViewState defaultValue) {
public Preference(@Nonnull String key, @Nullable CalculatorOnscreenViewState defaultValue) {
super(key, defaultValue);
}
@Nullable
@Override
protected CalculatorOnscreenViewState getPersistedValue(@NotNull SharedPreferences preferences) {
protected CalculatorOnscreenViewState getPersistedValue(@Nonnull SharedPreferences preferences) {
try {
final CalculatorOnscreenViewState result = new CalculatorOnscreenViewState();
final JSONObject jsonObject = new JSONObject(preferences.getString(getKey(), "{}"));
@ -149,7 +149,7 @@ public class CalculatorOnscreenViewState implements Parcelable {
}
@Override
protected void putPersistedValue(@NotNull SharedPreferences.Editor editor, @NotNull CalculatorOnscreenViewState value) {
protected void putPersistedValue(@Nonnull SharedPreferences.Editor editor, @Nonnull CalculatorOnscreenViewState value) {
final Map<String, Object> properties = new HashMap<String, Object>();
properties.put("width", value.getWidth());
properties.put("height", value.getHeight());

View File

@ -2,4 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.solovyev.android.calculator.widget"
android:versionCode="1"
android:versionName="1.0" />
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="17" />
</manifest>

View File

@ -8,12 +8,13 @@ import android.content.Context;
import android.content.Intent;
import android.text.Html;
import android.widget.RemoteViews;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.external.ExternalCalculatorIntentHandler;
import org.solovyev.android.calculator.external.ExternalCalculatorStateUpdater;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: Solovyev_S
* Date: 19.10.12
@ -37,7 +38,7 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
@Nullable
private String cursorColor;
@NotNull
@Nonnull
private ExternalCalculatorIntentHandler intentHandler = new CalculatorWidgetIntentHandler(this);
@ -70,8 +71,8 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
getCursorColor(context);
}
@NotNull
private String getCursorColor(@NotNull Context context) {
@Nonnull
private String getCursorColor(@Nonnull Context context) {
if (cursorColor == null) {
cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_widget_cursor_color)).substring(2);
}
@ -79,34 +80,34 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
}
@Override
public void onUpdate(@NotNull Context context,
@NotNull AppWidgetManager appWidgetManager,
@NotNull int[] appWidgetIds) {
public void onUpdate(@Nonnull Context context,
@Nonnull AppWidgetManager appWidgetManager,
@Nonnull int[] appWidgetIds) {
super.onUpdate(context, appWidgetManager, appWidgetIds);
updateWidget(context, appWidgetManager, appWidgetIds, Locator.getInstance().getEditor().getViewState(), Locator.getInstance().getDisplay().getViewState());
}
@Override
public void updateState(@NotNull Context context,
@NotNull CalculatorEditorViewState editorState,
@NotNull CalculatorDisplayViewState displayState) {
public void updateState(@Nonnull Context context,
@Nonnull CalculatorEditorViewState editorState,
@Nonnull CalculatorDisplayViewState displayState) {
final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getComponentClass()));
updateWidget(context, appWidgetManager, appWidgetIds, editorState, displayState);
}
@NotNull
@Nonnull
protected Class<? extends AbstractCalculatorWidgetProvider> getComponentClass() {
return this.getClass();
}
private void updateWidget(@NotNull Context context,
@NotNull AppWidgetManager appWidgetManager,
@NotNull int[] appWidgetIds,
@NotNull CalculatorEditorViewState editorState,
@NotNull CalculatorDisplayViewState displayState) {
private void updateWidget(@Nonnull Context context,
@Nonnull AppWidgetManager appWidgetManager,
@Nonnull int[] appWidgetIds,
@Nonnull CalculatorEditorViewState editorState,
@Nonnull CalculatorDisplayViewState displayState) {
for (int appWidgetId : appWidgetIds) {
final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
@ -136,7 +137,7 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
this.intentHandler.onIntent(context, intent);
}
private void updateDisplayState(@NotNull Context context, @NotNull RemoteViews views, @NotNull CalculatorDisplayViewState displayState) {
private void updateDisplayState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorDisplayViewState displayState) {
if (displayState.isValid()) {
views.setTextViewText(R.id.calculator_display, displayState.getText());
views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_default_text_color));
@ -145,7 +146,7 @@ abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implem
}
}
private void updateEditorState(@NotNull Context context, @NotNull RemoteViews views, @NotNull CalculatorEditorViewState editorState) {
private void updateEditorState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorEditorViewState editorState) {
String text = editorState.getText();
CharSequence newText = text;

View File

@ -2,7 +2,7 @@ package org.solovyev.android.calculator.widget;
import android.content.Context;
import android.content.Intent;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.CalculatorButton;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.external.DefaultExternalCalculatorIntentHandler;
@ -15,12 +15,12 @@ import org.solovyev.android.calculator.external.ExternalCalculatorStateUpdater;
*/
public class CalculatorWidgetIntentHandler extends DefaultExternalCalculatorIntentHandler {
public CalculatorWidgetIntentHandler(@NotNull ExternalCalculatorStateUpdater stateUpdater) {
public CalculatorWidgetIntentHandler(@Nonnull ExternalCalculatorStateUpdater stateUpdater) {
super(stateUpdater);
}
@Override
public void onIntent(@NotNull Context context, @NotNull Intent intent) {
public void onIntent(@Nonnull Context context, @Nonnull Intent intent) {
super.onIntent(context, intent);
if (AbstractCalculatorWidgetProvider.BUTTON_PRESSED_ACTION.equals(intent.getAction())) {

View File

@ -1,277 +1,176 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
android:versionCode="117"
android:versionName="1.6.2"
package="org.solovyev.android.calculator">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="117" android:versionName="1.6.3-SNAPSHOT" package="org.solovyev.android.calculator">
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.android.vending.BILLING"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!--TODO: REMOVE IN PRODUCTION-->
<!--<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>-->
<!-- for onscreen -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<supports-screens android:smallScreens="true" />
<supports-screens android:normalScreens="true" />
<supports-screens android:largeScreens="true" />
<supports-screens android:xlargeScreens="true" />
<supports-screens android:anyDensity="true" />
<supports-screens android:smallScreens="true"/>
<supports-screens android:normalScreens="true"/>
<supports-screens android:largeScreens="true"/>
<supports-screens android:xlargeScreens="true"/>
<supports-screens android:anyDensity="true"/>
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="8" />
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17"/>
<application
android:debuggable="false"
android:hardwareAccelerated="false"
android:icon="@drawable/icon"
android:label="@string/c_app_name"
android:name=".CalculatorApplication"
android:theme="@style/cpp_metro_blue_theme">
<application android:allowBackup="true" android:debuggable="true" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/cpp_metro_blue_theme">
<activity
android:clearTaskOnLaunch="true"
android:label="@string/c_app_name"
android:name=".CalculatorActivity"
android:windowSoftInputMode="adjustPan">
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:clearTaskOnLaunch="true"
android:label="@string/c_app_name"
android:name=".CalculatorActivityMobile"
android:windowSoftInputMode="adjustPan" />
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:name=".CalculatorActivityMobile" android:windowSoftInputMode="adjustPan"/>
<!-- settings must use action bar icon-->
<activity
android:icon="@drawable/ab_icon"
android:label="@string/c_app_settings"
android:name=".preferences.CalculatorPreferencesActivity" />
<activity android:icon="@drawable/ab_icon" android:label="@string/c_app_settings" android:name=".preferences.CalculatorPreferencesActivity"/>
<activity
android:label="@string/c_history"
android:name=".history.CalculatorHistoryActivity" />
<activity android:label="@string/c_history" android:name=".history.CalculatorHistoryActivity"/>
<activity
android:excludeFromRecents="true"
android:finishOnTaskLaunch="true"
android:label="@string/calculation_messages_dialog_title"
android:launchMode="singleTask"
android:name=".FixableMessagesDialog"
android:theme="@style/cpp_gray_dialog_theme" />
<activity android:excludeFromRecents="true" android:finishOnTaskLaunch="true" android:label="@string/calculation_messages_dialog_title" android:launchMode="singleTask" android:name=".FixableMessagesDialog" android:theme="@style/cpp_gray_dialog_theme"/>
<activity
android:label="@string/c_about"
android:name=".about.CalculatorAboutActivity" />
<activity android:label="@string/c_about" android:name=".about.CalculatorAboutActivity"/>
<activity
android:label="@string/c_help"
android:name=".help.CalculatorHelpActivity" />
<activity android:label="@string/c_help" android:name=".help.CalculatorHelpActivity"/>
<activity
android:label="@string/c_functions"
android:name=".math.edit.CalculatorFunctionsActivity" />
<activity android:label="@string/c_functions" android:name=".math.edit.CalculatorFunctionsActivity"/>
<activity
android:label="@string/c_operators"
android:name=".math.edit.CalculatorOperatorsActivity" />
<activity android:label="@string/c_operators" android:name=".math.edit.CalculatorOperatorsActivity"/>
<activity
android:label="@string/c_vars_and_constants"
android:name=".math.edit.CalculatorVarsActivity" />
<activity android:label="@string/c_vars_and_constants" android:name=".math.edit.CalculatorVarsActivity"/>
<activity
android:label="@string/c_plot_graph"
android:name=".plot.CalculatorPlotActivity" />
<activity
android:label="@string/cpp_plot_functions"
android:launchMode="singleTop"
android:name=".plot.CalculatorPlotFunctionsActivity"
android:theme="@style/cpp_gray_dialog_theme" />
<activity
android:label="@string/cpp_plot_function_settings"
android:launchMode="singleTop"
android:name=".plot.CalculatorPlotFunctionSettingsActivity"
android:theme="@style/cpp_gray_dialog_theme" />
<activity
android:label="@string/cpp_plot_range"
android:launchMode="singleTop"
android:name=".plot.CalculatorPlotRangeActivity"
android:theme="@style/cpp_gray_dialog_theme" />
<activity android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity"/>
<activity android:label="@string/cpp_plot_functions" android:launchMode="singleTop" android:name=".plot.CalculatorPlotFunctionsActivity" android:theme="@style/cpp_gray_dialog_theme"/>
<activity android:label="@string/cpp_plot_function_settings" android:launchMode="singleTop" android:name=".plot.CalculatorPlotFunctionSettingsActivity" android:theme="@style/cpp_gray_dialog_theme"/>
<activity android:label="@string/cpp_plot_range" android:launchMode="singleTop" android:name=".plot.CalculatorPlotRangeActivity" android:theme="@style/cpp_gray_dialog_theme"/>
<activity
android:label="@string/cpp_purchase_title"
android:launchMode="singleTop"
android:name=".preferences.CalculatorPurchaseDialogActivity"
android:theme="@style/cpp_gray_dialog_theme" />
<activity android:label="@string/cpp_purchase_title" android:launchMode="singleTop" android:name=".preferences.CalculatorPurchaseDialogActivity" android:theme="@style/cpp_gray_dialog_theme"/>
<activity
android:launchMode="singleTop"
android:name=".CalculatorDialogActivity"
android:theme="@style/cpp_gray_dialog_theme" />
<activity android:launchMode="singleTop" android:name=".CalculatorDialogActivity" android:theme="@style/cpp_gray_dialog_theme"/>
<!-- todo serso: strings-->
<activity
android:label="@string/c_plot_graph"
android:name=".matrix.CalculatorMatrixActivity" />
<activity android:label="@string/c_plot_graph" android:name=".matrix.CalculatorMatrixActivity"/>
<activity
android:name=".widget.CalculatorWidgetConfigurationActivity"
android:theme="@style/cpp_metro_blue_theme">
<activity android:name=".widget.CalculatorWidgetConfigurationActivity" android:theme="@style/cpp_metro_blue_theme">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
</intent-filter>
</activity>
<!-- settings must use action bar icon-->
<activity
android:icon="@drawable/ab_icon"
android:label="@string/c_settings"
android:name=".plot.CalculatorPlotPreferenceActivity" />
<activity android:icon="@drawable/ab_icon" android:label="@string/c_settings" android:name=".plot.CalculatorPlotPreferenceActivity"/>
<!-- ONSCREEN CONFIG -->
<activity
android:icon="@drawable/icon_onscreen"
android:label="@string/c_app_name_on_screen"
android:launchMode="singleInstance"
android:name=".onscreen.CalculatorOnscreenStartActivity"
android:theme="@style/cpp_gray_dialog_theme">
<activity android:icon="@drawable/icon_onscreen" android:label="@string/c_app_name_on_screen" android:launchMode="singleInstance" android:name=".onscreen.CalculatorOnscreenStartActivity" android:theme="@style/cpp_gray_dialog_theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<service android:name=".onscreen.CalculatorOnscreenService">
<intent-filter>
<action android:name="org.solovyev.android.calculator.INIT" />
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.INIT"/>
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
</intent-filter>
</service>
<receiver android:name=".onscreen.CalculatorOnscreenBroadcastReceiver">
<intent-filter>
<action android:name="org.solovyev.android.calculator.INIT" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.INIT"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
</intent-filter>
</receiver>
<!-- WIDGET CONFIG -->
<receiver
android:icon="@drawable/icon"
android:label="@string/c_app_widget_3x3_name"
android:name=".widget.CalculatorWidgetProvider">
<receiver android:icon="@drawable/icon" android:label="@string/c_app_widget_3x3_name" android:name=".widget.CalculatorWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="org.solovyev.android.calculator.INIT" />
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.widget.BUTTON_PRESSED" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
<action android:name="org.solovyev.android.calculator.INIT"/>
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.widget.BUTTON_PRESSED"/>
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/calculator_widget_info_3x3" />
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_3x3"/>
</receiver>
<receiver
android:icon="@drawable/icon"
android:label="@string/c_app_widget_3x4_name"
android:name=".widget.CalculatorWidgetProvider3x4">
<receiver android:icon="@drawable/icon" android:label="@string/c_app_widget_3x4_name" android:name=".widget.CalculatorWidgetProvider3x4">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="org.solovyev.android.calculator.INIT" />
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.widget.BUTTON_PRESSED" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
<action android:name="org.solovyev.android.calculator.INIT"/>
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.widget.BUTTON_PRESSED"/>
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/calculator_widget_info_3x4" />
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_3x4"/>
</receiver>
<receiver
android:icon="@drawable/icon"
android:label="@string/c_app_widget_4x4_name"
android:name=".widget.CalculatorWidgetProvider4x4">
<receiver android:icon="@drawable/icon" android:label="@string/c_app_widget_4x4_name" android:name=".widget.CalculatorWidgetProvider4x4">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="org.solovyev.android.calculator.INIT" />
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.widget.BUTTON_PRESSED" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
<action android:name="org.solovyev.android.calculator.INIT"/>
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.widget.BUTTON_PRESSED"/>
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/calculator_widget_info_4x4" />
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_4x4"/>
</receiver>
<receiver
android:icon="@drawable/icon"
android:label="@string/c_app_widget_4x5_name"
android:name=".widget.CalculatorWidgetProvider4x5">
<receiver android:icon="@drawable/icon" android:label="@string/c_app_widget_4x5_name" android:name=".widget.CalculatorWidgetProvider4x5">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="org.solovyev.android.calculator.INIT" />
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED" />
<action android:name="org.solovyev.android.calculator.widget.BUTTON_PRESSED" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
<action android:name="org.solovyev.android.calculator.INIT"/>
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
<action android:name="org.solovyev.android.calculator.widget.BUTTON_PRESSED"/>
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/calculator_widget_info_4x5" />
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_4x5"/>
</receiver>
<!-- ADMOB + BILLING CONFIG -->
<activity
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name="com.google.ads.AdActivity" />
<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.ads.AdActivity"/>
<service android:name="net.robotmedia.billing.BillingService" />
<service android:name="net.robotmedia.billing.BillingService"/>
<receiver android:name="net.robotmedia.billing.BillingReceiver">
<intent-filter>
<action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
<action android:name="com.android.vending.billing.RESPONSE_CODE" />
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
<action android:name="com.android.vending.billing.IN_APP_NOTIFY"/>
<action android:name="com.android.vending.billing.RESPONSE_CODE"/>
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"/>
</intent-filter>
</receiver>
<!-- ACRA CONFIG -->
<activity
android:excludeFromRecents="true"
android:finishOnTaskLaunch="true"
android:launchMode="singleInstance"
android:name="org.acra.CrashReportDialog"
android:theme="@style/Theme.Sherlock.Dialog" />
<activity android:excludeFromRecents="true" android:finishOnTaskLaunch="true" android:launchMode="singleInstance" android:name="org.acra.CrashReportDialog" android:theme="@style/Theme.Sherlock.Dialog"/>
</application>
</manifest>

View File

@ -122,15 +122,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intellij</groupId>
<artifactId>annotations</artifactId>
</dependency>
<dependency>
<groupId>com.pivotallabs</groupId>
<artifactId>robolectric</artifactId>
<version>1.1</version>
<version>1.2</version>
<scope>test</scope>
</dependency>

View File

@ -9,8 +9,8 @@ import android.preference.PreferenceManager;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.history.CalculatorHistoryState;
import org.solovyev.android.calculator.view.AngleUnitsButton;
import org.solovyev.android.calculator.view.NumeralBasesButton;
@ -33,29 +33,29 @@ import java.util.List;
*/
public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSharedPreferenceChangeListener {
@NotNull
@Nonnull
private CalculatorPreferences.Gui.Layout layout;
@NotNull
@Nonnull
private CalculatorPreferences.Gui.Theme theme;
@Nullable
private Vibrator vibrator;
@NotNull
@Nonnull
private final JListeners<DragPreferencesChangeListener> dpclRegister = Listeners.newHardRefListeners();
@NotNull
@Nonnull
private String logTag = "CalculatorActivity";
protected AbstractCalculatorHelper() {
}
protected AbstractCalculatorHelper(@NotNull String logTag) {
protected AbstractCalculatorHelper(@Nonnull String logTag) {
this.logTag = logTag;
}
protected void onCreate(@NotNull Activity activity) {
protected void onCreate(@Nonnull Activity activity) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
vibrator = (Vibrator) activity.getSystemService(Activity.VIBRATOR_SERVICE);
@ -71,15 +71,15 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
}
}
public void logDebug(@NotNull String message) {
public void logDebug(@Nonnull String message) {
Log.d(logTag, message);
}
public void logError(@NotNull String message) {
public void logError(@Nonnull String message) {
Log.e(logTag, message);
}
public void processButtons(@NotNull final Activity activity, @NotNull View root) {
public void processButtons(@Nonnull final Activity activity, @Nonnull View root) {
dpclRegister.removeListeners();
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
@ -97,7 +97,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
if (subtractionButton != null) {
subtractionButton.setOnDragListener(new OnDragListenerVibrator(newOnDragListener(new SimpleOnDragListener.DragProcessor() {
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) {
if (dragDirection == DragDirection.down) {
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.show_operators, null);
return true;
@ -175,7 +175,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
NumeralBaseButtons.toggleNumericDigits(activity, preferences);
}
private void toggleButtonDirectionText(@NotNull View root, int id, boolean showDirectionText, @NotNull DragDirection... dragDirections) {
private void toggleButtonDirectionText(@Nonnull View root, int id, boolean showDirectionText, @Nonnull DragDirection... dragDirections) {
final View v = getButton(root, id);
if (v instanceof DirectionDragButton) {
final DirectionDragButton button = (DirectionDragButton) v;
@ -185,13 +185,13 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
}
}
@NotNull
@Nonnull
private Calculator getCalculator() {
return Locator.getInstance().getCalculator();
}
private void setOnDragListeners(@NotNull View root, @NotNull SimpleOnDragListener.Preferences dragPreferences, @NotNull SharedPreferences preferences) {
private void setOnDragListeners(@Nonnull View root, @Nonnull SimpleOnDragListener.Preferences dragPreferences, @Nonnull SharedPreferences preferences) {
final OnDragListener onDragListener = new OnDragListenerVibrator(newOnDragListener(new DigitButtonDragProcessor(getKeyboard()), dragPreferences), vibrator, preferences);
final List<Integer> dragButtonIds = new ArrayList<Integer>();
@ -219,19 +219,19 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
}
}
@NotNull
@Nonnull
private CalculatorKeyboard getKeyboard() {
return Locator.getInstance().getKeyboard();
}
@Nullable
private <T extends DragButton> T getButton(@NotNull View root, int buttonId) {
private <T extends DragButton> T getButton(@Nonnull View root, int buttonId) {
return (T) root.findViewById(buttonId);
}
@NotNull
private SimpleOnDragListener newOnDragListener(@NotNull SimpleOnDragListener.DragProcessor dragProcessor,
@NotNull SimpleOnDragListener.Preferences dragPreferences) {
@Nonnull
private SimpleOnDragListener newOnDragListener(@Nonnull SimpleOnDragListener.DragProcessor dragProcessor,
@Nonnull SimpleOnDragListener.Preferences dragPreferences) {
final SimpleOnDragListener onDragListener = new SimpleOnDragListener(dragProcessor, dragPreferences);
dpclRegister.addListener(onDragListener);
return onDragListener;
@ -247,7 +247,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
}
}
public void onDestroy(@NotNull Activity activity) {
public void onDestroy(@Nonnull Activity activity) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
preferences.unregisterOnSharedPreferenceChangeListener(this);

View File

@ -7,8 +7,8 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import jscl.NumeralBase;
import jscl.math.Generic;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.history.CalculatorHistoryState;
import org.solovyev.android.calculator.jscl.JsclOperation;
import org.solovyev.common.history.HistoryAction;
@ -23,40 +23,40 @@ import java.util.List;
*/
public class AndroidCalculator implements Calculator, CalculatorEventListener, SharedPreferences.OnSharedPreferenceChangeListener {
@NotNull
@Nonnull
private final CalculatorImpl calculator = new CalculatorImpl();
@NotNull
@Nonnull
private final Application context;
public AndroidCalculator(@NotNull Application application) {
public AndroidCalculator(@Nonnull Application application) {
this.context = application;
this.calculator.addCalculatorEventListener(this);
PreferenceManager.getDefaultSharedPreferences(application).registerOnSharedPreferenceChangeListener(this);
}
public void init(@NotNull final Activity activity) {
public void init(@Nonnull final Activity activity) {
setEditor(activity);
setDisplay(activity);
}
public void setDisplay(@NotNull Activity activity) {
public void setDisplay(@Nonnull Activity activity) {
final AndroidCalculatorDisplayView displayView = (AndroidCalculatorDisplayView) activity.findViewById(R.id.calculator_display);
setDisplay(activity, displayView);
}
public void setDisplay(@NotNull Context context, @NotNull AndroidCalculatorDisplayView displayView) {
public void setDisplay(@Nonnull Context context, @Nonnull AndroidCalculatorDisplayView displayView) {
displayView.init(context);
Locator.getInstance().getDisplay().setView(displayView);
}
public void setEditor(@NotNull Activity activity) {
public void setEditor(@Nonnull Activity activity) {
final AndroidCalculatorEditorView editorView = (AndroidCalculatorEditorView) activity.findViewById(R.id.calculator_editor);
setEditor(activity, editorView);
}
public void setEditor(@NotNull Context context, @NotNull AndroidCalculatorEditorView editorView) {
public void setEditor(@Nonnull Context context, @Nonnull AndroidCalculatorEditorView editorView) {
editorView.init(context);
Locator.getInstance().getEditor().setView(editorView);
}
@ -71,49 +71,49 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S
*/
@Override
@NotNull
public CalculatorEventData evaluate(@NotNull JsclOperation operation, @NotNull String expression) {
@Nonnull
public CalculatorEventData evaluate(@Nonnull JsclOperation operation, @Nonnull String expression) {
return calculator.evaluate(operation, expression);
}
@Override
@NotNull
public CalculatorEventData evaluate(@NotNull JsclOperation operation, @NotNull String expression, @NotNull Long sequenceId) {
@Nonnull
public CalculatorEventData evaluate(@Nonnull JsclOperation operation, @Nonnull String expression, @Nonnull Long sequenceId) {
return calculator.evaluate(operation, expression, sequenceId);
}
@Override
public boolean isConversionPossible(@NotNull Generic generic, @NotNull NumeralBase from, @NotNull NumeralBase to) {
public boolean isConversionPossible(@Nonnull Generic generic, @Nonnull NumeralBase from, @Nonnull NumeralBase to) {
return calculator.isConversionPossible(generic, from, to);
}
@Override
@NotNull
public CalculatorEventData convert(@NotNull Generic generic, @NotNull NumeralBase to) {
@Nonnull
public CalculatorEventData convert(@Nonnull Generic generic, @Nonnull NumeralBase to) {
return calculator.convert(generic, to);
}
@Override
@NotNull
public CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
@Nonnull
public CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
return calculator.fireCalculatorEvent(calculatorEventType, data);
}
@NotNull
@Nonnull
@Override
public CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data, @NotNull Object source) {
public CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data, @Nonnull Object source) {
return calculator.fireCalculatorEvent(calculatorEventType, data, source);
}
@Override
@NotNull
public CalculatorEventData fireCalculatorEvent(@NotNull CalculatorEventType calculatorEventType, @Nullable Object data, @NotNull Long sequenceId) {
@Nonnull
public CalculatorEventData fireCalculatorEvent(@Nonnull CalculatorEventType calculatorEventType, @Nullable Object data, @Nonnull Long sequenceId) {
return calculator.fireCalculatorEvent(calculatorEventType, data, sequenceId);
}
@NotNull
@Nonnull
@Override
public PreparedExpression prepareExpression(@NotNull String expression) throws CalculatorParseException {
public PreparedExpression prepareExpression(@Nonnull String expression) throws CalculatorParseException {
return calculator.prepareExpression(expression);
}
@ -126,37 +126,37 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S
}
@Override
public void addCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener) {
public void addCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener) {
calculator.addCalculatorEventListener(calculatorEventListener);
}
@Override
public void removeCalculatorEventListener(@NotNull CalculatorEventListener calculatorEventListener) {
public void removeCalculatorEventListener(@Nonnull CalculatorEventListener calculatorEventListener) {
calculator.removeCalculatorEventListener(calculatorEventListener);
}
@Override
public void fireCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void fireCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
calculator.fireCalculatorEvent(calculatorEventData, calculatorEventType, data);
}
@Override
public void fireCalculatorEvents(@NotNull List<CalculatorEvent> calculatorEvents) {
public void fireCalculatorEvents(@Nonnull List<CalculatorEvent> calculatorEvents) {
calculator.fireCalculatorEvents(calculatorEvents);
}
@Override
public void doHistoryAction(@NotNull HistoryAction historyAction) {
public void doHistoryAction(@Nonnull HistoryAction historyAction) {
calculator.doHistoryAction(historyAction);
}
@Override
public void setCurrentHistoryState(@NotNull CalculatorHistoryState editorHistoryState) {
public void setCurrentHistoryState(@Nonnull CalculatorHistoryState editorHistoryState) {
calculator.setCurrentHistoryState(editorHistoryState);
}
@Override
@NotNull
@Nonnull
public CalculatorHistoryState getCurrentHistoryState() {
return calculator.getCurrentHistoryState();
}
@ -167,7 +167,7 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S
}
@Override
public void evaluate(@NotNull Long sequenceId) {
public void evaluate(@Nonnull Long sequenceId) {
calculator.evaluate(sequenceId);
}
@ -177,7 +177,7 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) {
case calculation_messages:
CalculatorActivityLauncher.showCalculationMessagesDialog(CalculatorApplication.getInstance(), (List<Message>) data);
@ -222,7 +222,7 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S
}
@Override
public void onSharedPreferenceChanged(@NotNull SharedPreferences prefs, @NotNull String key) {
public void onSharedPreferenceChanged(@Nonnull SharedPreferences prefs, @Nonnull String key) {
if (CalculatorPreferences.Calculations.calculateOnFly.getKey().equals(key)) {
this.calculator.setCalculateOnFly(CalculatorPreferences.Calculations.calculateOnFly.getPreference(prefs));
}

View File

@ -3,7 +3,7 @@ package org.solovyev.android.calculator;
import android.app.Application;
import android.content.Context;
import android.text.ClipboardManager;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: serso
@ -12,10 +12,10 @@ import org.jetbrains.annotations.NotNull;
*/
public class AndroidCalculatorClipboard implements CalculatorClipboard {
@NotNull
@Nonnull
private final Context context;
public AndroidCalculatorClipboard(@NotNull Application application) {
public AndroidCalculatorClipboard(@Nonnull Application application) {
this.context = application;
}
@ -30,13 +30,13 @@ public class AndroidCalculatorClipboard implements CalculatorClipboard {
}
@Override
public void setText(@NotNull String text) {
public void setText(@Nonnull String text) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(text);
}
@Override
public void setText(@NotNull CharSequence text) {
public void setText(@Nonnull CharSequence text) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(text);
}

View File

@ -6,8 +6,8 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.view.VibratorContainer;
/**
@ -17,16 +17,16 @@ import org.solovyev.android.view.VibratorContainer;
*/
public class AndroidCalculatorKeyboard implements CalculatorKeyboard {
@NotNull
@Nonnull
private final CalculatorKeyboard calculatorKeyboard;
@NotNull
@Nonnull
private final Context context;
private VibratorContainer vibrator;
public AndroidCalculatorKeyboard(@NotNull Application application,
@NotNull CalculatorKeyboard calculatorKeyboard) {
public AndroidCalculatorKeyboard(@Nonnull Application application,
@Nonnull CalculatorKeyboard calculatorKeyboard) {
this.context = application;
this.calculatorKeyboard = calculatorKeyboard;
}

View File

@ -1,8 +1,8 @@
package org.solovyev.android.calculator;
import android.util.Log;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
@ -11,26 +11,26 @@ import org.jetbrains.annotations.Nullable;
*/
public class AndroidCalculatorLogger implements CalculatorLogger {
@NotNull
@Nonnull
private static final String TAG = "Calculatorpp";
@Override
public void debug(@Nullable String tag, @NotNull String message) {
public void debug(@Nullable String tag, @Nonnull String message) {
Log.d(getTag(tag), message);
}
@NotNull
@Nonnull
private String getTag(@Nullable String tag) {
return tag != null ? TAG + "/" + tag : TAG;
}
@Override
public void debug(@Nullable String tag, @Nullable String message, @NotNull Throwable e) {
public void debug(@Nullable String tag, @Nullable String message, @Nonnull Throwable e) {
Log.d(getTag(tag), message, e);
}
@Override
public void error(@Nullable String tag, @Nullable String message, @NotNull Throwable e) {
public void error(@Nullable String tag, @Nullable String message, @Nonnull Throwable e) {
Log.e(getTag(tag), message, e);
}

View File

@ -3,8 +3,8 @@ package org.solovyev.android.calculator;
import android.app.Application;
import android.os.Handler;
import android.widget.Toast;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
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;
@ -19,19 +19,19 @@ import java.util.List;
*/
public class AndroidCalculatorNotifier implements CalculatorNotifier {
@NotNull
@Nonnull
private final Application application;
@NotNull
@Nonnull
private final Handler uiHandler = new Handler();
private final boolean showDebugMessages;
public AndroidCalculatorNotifier(@NotNull Application application) {
public AndroidCalculatorNotifier(@Nonnull Application application) {
this(application, false);
}
public AndroidCalculatorNotifier(@NotNull Application application, boolean showDebugMessages) {
public AndroidCalculatorNotifier(@Nonnull Application application, boolean showDebugMessages) {
assert Threads.isUiThread();
this.application = application;
@ -39,28 +39,28 @@ public class AndroidCalculatorNotifier implements CalculatorNotifier {
}
@Override
public void showMessage(@NotNull Message message) {
public void showMessage(@Nonnull Message message) {
showMessageInUiThread(message.getLocalizedMessage());
}
@Override
public void showMessage(@NotNull Integer messageCode, @NotNull MessageType messageType, @NotNull List<Object> parameters) {
public void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nonnull List<Object> parameters) {
showMessage(new AndroidMessage(messageCode, messageType, application, parameters));
}
@Override
public void showMessage(@NotNull Integer messageCode, @NotNull MessageType messageType, @Nullable Object... parameters) {
public void showMessage(@Nonnull Integer messageCode, @Nonnull MessageType messageType, @Nullable Object... parameters) {
showMessage(new AndroidMessage(messageCode, messageType, application, parameters));
}
@Override
public void showDebugMessage(@Nullable final String tag, @NotNull final String message) {
public void showDebugMessage(@Nullable final String tag, @Nonnull final String message) {
if (showDebugMessages) {
showMessageInUiThread(tag == null ? message : tag + ": " + message);
}
}
private void showMessageInUiThread(@NotNull final String message) {
private void showMessageInUiThread(@Nonnull final String message) {
if (Threads.isUiThread()) {
Toast.makeText(application, message, Toast.LENGTH_SHORT).show();
} else {

View File

@ -5,7 +5,7 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import jscl.AngleUnit;
import jscl.NumeralBase;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
import org.solovyev.android.msg.AndroidMessage;
import org.solovyev.common.msg.MessageType;
@ -23,10 +23,10 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS
// one hour
private static final Long PREFERRED_PREFS_INTERVAL_TIME = 1000L * 60L * 60L;
@NotNull
@Nonnull
private final Application application;
public AndroidCalculatorPreferenceService(@NotNull Application application) {
public AndroidCalculatorPreferenceService(@Nonnull Application application) {
this.application = application;
}
@ -58,7 +58,7 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS
}
}
private boolean isTimeForCheck(@NotNull Long currentTime, @NotNull SharedPreferences preferences) {
private boolean isTimeForCheck(@Nonnull Long currentTime, @Nonnull SharedPreferences preferences) {
final Long lastPreferredPreferencesCheckTime = CalculatorPreferences.Calculations.lastPreferredPreferencesCheck.getPreference(preferences);
return currentTime - lastPreferredPreferencesCheckTime > PREFERRED_PREFS_INTERVAL_TIME;
@ -71,7 +71,7 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS
}
@Override
public void setAngleUnits(@NotNull AngleUnit angleUnit) {
public void setAngleUnits(@Nonnull AngleUnit angleUnit) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(application);
AndroidCalculatorEngine.Preferences.angleUnit.putPreference(preferences, angleUnit);
@ -85,7 +85,7 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS
}
@Override
public void setNumeralBase(@NotNull NumeralBase numeralBase) {
public void setNumeralBase(@Nonnull NumeralBase numeralBase) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(application);
AndroidCalculatorEngine.Preferences.numeralBase.putPreference(preferences, numeralBase);

View File

@ -1,7 +1,7 @@
package org.solovyev.android.calculator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
@ -27,7 +27,7 @@ public enum AndroidFunctionCategory {
}
@Nullable
public static AndroidFunctionCategory valueOf(@NotNull FunctionCategory functionCategory) {
public static AndroidFunctionCategory valueOf(@Nonnull FunctionCategory functionCategory) {
for (AndroidFunctionCategory androidFunctionCategory : values()) {
if (androidFunctionCategory.name().equals(functionCategory.name())) {
return androidFunctionCategory;

View File

@ -2,7 +2,7 @@ package org.solovyev.android.calculator;
import android.app.Activity;
import jscl.NumeralBase;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.units.CalculatorNumeralBase;
import org.solovyev.android.view.drag.DirectionDragButton;
import org.solovyev.android.view.drag.DragDirection;
@ -19,7 +19,7 @@ import java.util.List;
public enum AndroidNumeralBase {
bin(CalculatorNumeralBase.bin) {
@NotNull
@Nonnull
@Override
public List<Integer> getButtonIds() {
return Arrays.asList(R.id.cpp_button_0, R.id.cpp_button_1);
@ -27,7 +27,7 @@ public enum AndroidNumeralBase {
},
oct(CalculatorNumeralBase.oct) {
@NotNull
@Nonnull
@Override
public List<Integer> getButtonIds() {
final List<Integer> result = new ArrayList<Integer>(bin.getButtonIds());
@ -37,7 +37,7 @@ public enum AndroidNumeralBase {
},
dec(CalculatorNumeralBase.dec) {
@NotNull
@Nonnull
@Override
public List<Integer> getButtonIds() {
final List<Integer> result = new ArrayList<Integer>(oct.getButtonIds());
@ -48,17 +48,17 @@ public enum AndroidNumeralBase {
hex(CalculatorNumeralBase.hex) {
@NotNull
@Nonnull
private List<Integer> specialHexButtonIds = Arrays.asList(R.id.cpp_button_1, R.id.cpp_button_2, R.id.cpp_button_3, R.id.cpp_button_4, R.id.cpp_button_5, R.id.cpp_button_6);
@NotNull
@Nonnull
@Override
public List<Integer> getButtonIds() {
return dec.getButtonIds();
}
@Override
protected void toggleButton(boolean show, @NotNull DirectionDragButton button) {
protected void toggleButton(boolean show, @Nonnull DirectionDragButton button) {
super.toggleButton(show, button);
if (specialHexButtonIds.contains(button.getId())) {
button.showDirectionText(show, DragDirection.left);
@ -67,17 +67,17 @@ public enum AndroidNumeralBase {
}
};
@NotNull
@Nonnull
private final CalculatorNumeralBase calculatorNumeralBase;
private AndroidNumeralBase(@NotNull CalculatorNumeralBase calculatorNumeralBase) {
private AndroidNumeralBase(@Nonnull CalculatorNumeralBase calculatorNumeralBase) {
this.calculatorNumeralBase = calculatorNumeralBase;
}
@NotNull
@Nonnull
public abstract List<Integer> getButtonIds();
public void toggleButtons(boolean show, @NotNull Activity activity) {
public void toggleButtons(boolean show, @Nonnull Activity activity) {
for (Integer buttonId : getButtonIds()) {
final DirectionDragButton button = (DirectionDragButton) activity.findViewById(buttonId);
if (button != null) {
@ -86,18 +86,18 @@ public enum AndroidNumeralBase {
}
}
protected void toggleButton(boolean show, @NotNull DirectionDragButton button) {
protected void toggleButton(boolean show, @Nonnull DirectionDragButton button) {
button.setShowText(show);
button.invalidate();
}
@NotNull
@Nonnull
public NumeralBase getNumeralBase() {
return calculatorNumeralBase.getNumeralBase();
}
@NotNull
public static AndroidNumeralBase valueOf(@NotNull NumeralBase nb) {
@Nonnull
public static AndroidNumeralBase valueOf(@Nonnull NumeralBase nb) {
for (AndroidNumeralBase androidNumeralBase : values()) {
if (androidNumeralBase.calculatorNumeralBase.getNumeralBase() == nb) {
return androidNumeralBase;

View File

@ -1,7 +1,7 @@
package org.solovyev.android.calculator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
@ -26,7 +26,7 @@ public enum AndroidOperatorCategory {
}
@Nullable
public static AndroidOperatorCategory valueOf(@NotNull OperatorCategory operatorCategory) {
public static AndroidOperatorCategory valueOf(@Nonnull OperatorCategory operatorCategory) {
for (AndroidOperatorCategory androidOperatorCategory : values()) {
if (androidOperatorCategory.name().equals(operatorCategory.name())) {
return androidOperatorCategory;

View File

@ -1,7 +1,7 @@
package org.solovyev.android.calculator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
@ -24,7 +24,7 @@ public enum AndroidVarCategory {
}
@Nullable
public static AndroidVarCategory valueOf(@NotNull VarCategory varCategory) {
public static AndroidVarCategory valueOf(@Nonnull VarCategory varCategory) {
for (AndroidVarCategory androidVarCategory : values()) {
if (androidVarCategory.name().equals(varCategory.name())) {
return androidVarCategory;

View File

@ -21,8 +21,8 @@ import android.widget.Button;
import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.Activities;
import org.solovyev.android.Android;
import org.solovyev.android.Threads;
@ -36,12 +36,12 @@ import org.solovyev.common.text.Strings;
public class CalculatorActivity extends SherlockFragmentActivity implements SharedPreferences.OnSharedPreferenceChangeListener, CalculatorEventListener {
@NotNull
@Nonnull
public static final String TAG = CalculatorActivity.class.getSimpleName();
private boolean useBackAsPrev;
@NotNull
@Nonnull
private CalculatorActivityHelper activityHelper;
/**
@ -96,12 +96,12 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
return findViewById(R.id.main_second_pane) != null;
}
@NotNull
@Nonnull
private AndroidCalculator getCalculator() {
return ((AndroidCalculator) Locator.getInstance().getCalculator());
}
private static void firstTimeInit(@NotNull SharedPreferences preferences, @NotNull Context context) {
private static void firstTimeInit(@Nonnull SharedPreferences preferences, @Nonnull Context context) {
final Integer appOpenedCounter = CalculatorPreferences.appOpenedCounter.getPreference(preferences);
if (appOpenedCounter != null) {
CalculatorPreferences.appOpenedCounter.putPreference(preferences, appOpenedCounter + 1);
@ -149,7 +149,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
}
}
private static boolean showSpecialWindow(@NotNull SharedPreferences preferences, @NotNull Preference<Boolean> specialWindowShownPref, int layoutId, int textViewId, @NotNull Context context) {
private static boolean showSpecialWindow(@Nonnull SharedPreferences preferences, @Nonnull Preference<Boolean> specialWindowShownPref, int layoutId, int textViewId, @Nonnull Context context) {
boolean result = false;
final Boolean specialWindowShown = specialWindowShownPref.getPreference(preferences);
@ -183,7 +183,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
}
@SuppressWarnings({"UnusedDeclaration"})
public void equalsButtonClickHandler(@NotNull View v) {
public void equalsButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.equals);
}
@ -252,47 +252,47 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
*/
@SuppressWarnings({"UnusedDeclaration"})
public void elementaryButtonClickHandler(@NotNull View v) {
public void elementaryButtonClickHandler(@Nonnull View v) {
throw new UnsupportedOperationException("Not implemented yet!");
}
@SuppressWarnings({"UnusedDeclaration"})
public void historyButtonClickHandler(@NotNull View v) {
public void historyButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.history);
}
@SuppressWarnings({"UnusedDeclaration"})
public void eraseButtonClickHandler(@NotNull View v) {
public void eraseButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.erase);
}
@SuppressWarnings({"UnusedDeclaration"})
public void simplifyButtonClickHandler(@NotNull View v) {
public void simplifyButtonClickHandler(@Nonnull View v) {
throw new UnsupportedOperationException("Not implemented yet!");
}
@SuppressWarnings({"UnusedDeclaration"})
public void pasteButtonClickHandler(@NotNull View v) {
public void pasteButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.paste);
}
@SuppressWarnings({"UnusedDeclaration"})
public void copyButtonClickHandler(@NotNull View v) {
public void copyButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.copy);
}
@NotNull
@Nonnull
private static CalculatorKeyboard getKeyboard() {
return Locator.getInstance().getKeyboard();
}
@SuppressWarnings({"UnusedDeclaration"})
public void clearButtonClickHandler(@NotNull View v) {
public void clearButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.clear);
}
@SuppressWarnings({"UnusedDeclaration"})
public void digitButtonClickHandler(@NotNull View v) {
public void digitButtonClickHandler(@Nonnull View v) {
Log.d(String.valueOf(v.getId()), "digitButtonClickHandler() for: " + v.getId() + ". Pressed: " + v.isPressed());
if (v instanceof Button) {
@ -300,36 +300,36 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
}
}
private void buttonPressed(@NotNull CalculatorSpecialButton button) {
private void buttonPressed(@Nonnull CalculatorSpecialButton button) {
buttonPressed(button.getActionCode());
}
private void buttonPressed(@NotNull String text) {
private void buttonPressed(@Nonnull String text) {
getKeyboard().buttonPressed(text);
}
@SuppressWarnings({"UnusedDeclaration"})
public void functionsButtonClickHandler(@NotNull View v) {
public void functionsButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.functions);
}
@SuppressWarnings({"UnusedDeclaration"})
public void operatorsButtonClickHandler(@NotNull View v) {
public void operatorsButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.operators);
}
@SuppressWarnings({"UnusedDeclaration"})
public void varsButtonClickHandler(@NotNull View v) {
public void varsButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.vars);
}
@SuppressWarnings({"UnusedDeclaration"})
public void likeButtonClickHandler(@NotNull View v) {
public void likeButtonClickHandler(@Nonnull View v) {
buttonPressed(CalculatorSpecialButton.like);
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) {
case plot_graph:
Threads.tryRunOnUiThread(this, new Runnable() {

View File

@ -5,8 +5,8 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
@ -15,57 +15,57 @@ import org.jetbrains.annotations.Nullable;
*/
public interface CalculatorActivityHelper {
void onCreate(@NotNull SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState);
void onCreate(@Nonnull SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState);
void onCreate(@NotNull Activity activity, @Nullable Bundle savedInstanceState);
void onCreate(@Nonnull Activity activity, @Nullable Bundle savedInstanceState);
void onSaveInstanceState(@NotNull SherlockFragmentActivity activity, @NotNull Bundle outState);
void onSaveInstanceState(@Nonnull SherlockFragmentActivity activity, @Nonnull Bundle outState);
void onSaveInstanceState(@NotNull Activity activity, @NotNull Bundle outState);
void onSaveInstanceState(@Nonnull Activity activity, @Nonnull Bundle outState);
int getLayoutId();
@NotNull
@Nonnull
CalculatorPreferences.Gui.Theme getTheme();
@NotNull
@Nonnull
CalculatorPreferences.Gui.Layout getLayout();
void onResume(@NotNull SherlockFragmentActivity activity);
void onResume(@Nonnull SherlockFragmentActivity activity);
void onResume(@NotNull Activity activity);
void onResume(@Nonnull Activity activity);
void onPause(@NotNull Activity activity);
void onPause(@Nonnull Activity activity);
void onPause(@NotNull SherlockFragmentActivity activity);
void onPause(@Nonnull SherlockFragmentActivity activity);
void onDestroy(@NotNull SherlockFragmentActivity activity);
void onDestroy(@Nonnull SherlockFragmentActivity activity);
void onDestroy(@NotNull Activity activity);
void onDestroy(@Nonnull Activity activity);
void addTab(@NotNull SherlockFragmentActivity activity,
@NotNull String tag,
@NotNull Class<? extends Fragment> fragmentClass,
void addTab(@Nonnull SherlockFragmentActivity activity,
@Nonnull String tag,
@Nonnull Class<? extends Fragment> fragmentClass,
@Nullable Bundle fragmentArgs,
int captionResId,
int parentViewId);
void addTab(@NotNull SherlockFragmentActivity activity,
@NotNull CalculatorFragmentType fragmentType,
void addTab(@Nonnull SherlockFragmentActivity activity,
@Nonnull CalculatorFragmentType fragmentType,
@Nullable Bundle fragmentArgs,
int parentViewId);
void setFragment(@NotNull SherlockFragmentActivity activity,
@NotNull CalculatorFragmentType fragmentType,
void setFragment(@Nonnull SherlockFragmentActivity activity,
@Nonnull CalculatorFragmentType fragmentType,
@Nullable Bundle fragmentArgs,
int parentViewId);
void logDebug(@NotNull String message);
void logDebug(@Nonnull String message);
void processButtons(@NotNull Activity activity, @NotNull View root);
void processButtons(@Nonnull Activity activity, @Nonnull View root);
void logError(@NotNull String message);
void logError(@Nonnull String message);
void selectTab(@NotNull SherlockFragmentActivity activity, @NotNull CalculatorFragmentType fragmentType);
void selectTab(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType);
}

View File

@ -16,8 +16,8 @@ import android.view.ViewGroup;
import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
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;
@ -49,15 +49,15 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
private boolean homeIcon = false;
@NotNull
@Nonnull
private CalculatorPreferences.Gui.Theme theme;
@NotNull
@Nonnull
private CalculatorPreferences.Gui.Layout layout;
private int selectedNavigationIndex = 0;
public CalculatorActivityHelperImpl(int layoutId, @NotNull String logTag) {
public CalculatorActivityHelperImpl(int layoutId, @Nonnull String logTag) {
super(logTag);
this.layoutId = layoutId;
}
@ -68,7 +68,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onCreate(@NotNull Activity activity, @Nullable Bundle savedInstanceState) {
public void onCreate(@Nonnull Activity activity, @Nullable Bundle savedInstanceState) {
super.onCreate(activity);
if (activity instanceof CalculatorEventListener) {
@ -94,7 +94,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onCreate(@NotNull final SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState) {
public void onCreate(@Nonnull final SherlockFragmentActivity activity, @Nullable Bundle savedInstanceState) {
this.onCreate((Activity) activity, savedInstanceState);
final ActionBar actionBar = activity.getSupportActionBar();
@ -109,7 +109,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
private void toggleTitle(@NotNull SherlockFragmentActivity activity, boolean showTitle) {
private void toggleTitle(@Nonnull SherlockFragmentActivity activity, boolean showTitle) {
final ActionBar actionBar = activity.getSupportActionBar();
if (activity instanceof CalculatorActivity) {
@ -123,7 +123,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
}
public void restoreSavedTab(@NotNull SherlockFragmentActivity activity) {
public void restoreSavedTab(@Nonnull SherlockFragmentActivity activity) {
final ActionBar actionBar = activity.getSupportActionBar();
if (selectedNavigationIndex >= 0 && selectedNavigationIndex < actionBar.getTabCount()) {
actionBar.setSelectedNavigationItem(selectedNavigationIndex);
@ -131,16 +131,16 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onSaveInstanceState(@NotNull SherlockFragmentActivity activity, @NotNull Bundle outState) {
public void onSaveInstanceState(@Nonnull SherlockFragmentActivity activity, @Nonnull Bundle outState) {
onSaveInstanceState((Activity) activity, outState);
}
@Override
public void onSaveInstanceState(@NotNull Activity activity, @NotNull Bundle outState) {
public void onSaveInstanceState(@Nonnull Activity activity, @Nonnull Bundle outState) {
}
@Override
public void onResume(@NotNull Activity activity) {
public void onResume(@Nonnull Activity activity) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
final CalculatorPreferences.Gui.Theme newTheme = CalculatorPreferences.Gui.theme.getPreference(preferences);
@ -150,11 +150,11 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onPause(@NotNull Activity activity) {
public void onPause(@Nonnull Activity activity) {
}
@Override
public void onPause(@NotNull SherlockFragmentActivity activity) {
public void onPause(@Nonnull SherlockFragmentActivity activity) {
onPause((Activity) activity);
final int selectedNavigationIndex = activity.getSupportActionBar().getSelectedNavigationIndex();
@ -167,13 +167,13 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@NotNull
private String getSavedTabPreferenceName(@NotNull Activity activity) {
@Nonnull
private String getSavedTabPreferenceName(@Nonnull Activity activity) {
return "tab_" + activity.getClass().getSimpleName();
}
@Override
public void onDestroy(@NotNull Activity activity) {
public void onDestroy(@Nonnull Activity activity) {
super.onDestroy(activity);
if (activity instanceof CalculatorEventListener) {
@ -182,14 +182,14 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onDestroy(@NotNull SherlockFragmentActivity activity) {
public void onDestroy(@Nonnull SherlockFragmentActivity activity) {
this.onDestroy((Activity) activity);
}
@Override
public void addTab(@NotNull SherlockFragmentActivity activity,
@NotNull String tag,
@NotNull Class<? extends Fragment> fragmentClass,
public void addTab(@Nonnull SherlockFragmentActivity activity,
@Nonnull String tag,
@Nonnull Class<? extends Fragment> fragmentClass,
@Nullable Bundle fragmentArgs,
int captionResId,
int parentViewId) {
@ -205,12 +205,12 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void addTab(@NotNull SherlockFragmentActivity activity, @NotNull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) {
public void addTab(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) {
addTab(activity, fragmentType.getFragmentTag(), fragmentType.getFragmentClass(), fragmentArgs, fragmentType.getDefaultTitleResId(), parentViewId);
}
@Override
public void setFragment(@NotNull SherlockFragmentActivity activity, @NotNull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) {
public void setFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType, @Nullable Bundle fragmentArgs, int parentViewId) {
final FragmentManager fm = activity.getSupportFragmentManager();
Fragment fragment = fm.findFragmentByTag(fragmentType.getFragmentTag());
@ -230,7 +230,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void selectTab(@NotNull SherlockFragmentActivity activity, @NotNull CalculatorFragmentType fragmentType) {
public void selectTab(@Nonnull SherlockFragmentActivity activity, @Nonnull CalculatorFragmentType fragmentType) {
final ActionBar actionBar = activity.getSupportActionBar();
for (int i = 0; i < actionBar.getTabCount(); i++) {
final ActionBar.Tab tab = actionBar.getTabAt(i);
@ -247,19 +247,19 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
}
@Override
@NotNull
@Nonnull
public CalculatorPreferences.Gui.Theme getTheme() {
return theme;
}
@Override
@NotNull
@Nonnull
public CalculatorPreferences.Gui.Layout getLayout() {
return layout;
}
@Override
public void onResume(@NotNull SherlockFragmentActivity activity) {
public void onResume(@Nonnull SherlockFragmentActivity activity) {
onResume((Activity) activity);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
@ -267,7 +267,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
restoreSavedTab(activity);
}
private void addHelpInfo(@NotNull Activity activity, @NotNull View root) {
private void addHelpInfo(@Nonnull Activity activity, @Nonnull View root) {
if (CalculatorApplication.isMonkeyRunner(activity)) {
if (root instanceof ViewGroup) {
final TextView helperTextView = new TextView(activity);

View File

@ -12,8 +12,8 @@ import android.view.View;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import jscl.math.Generic;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.Android;
import org.solovyev.android.App;
import org.solovyev.android.calculator.about.CalculatorAboutActivity;
@ -41,72 +41,72 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
public CalculatorActivityLauncher() {
}
public static void showHistory(@NotNull final Context context) {
public static void showHistory(@Nonnull final Context context) {
showHistory(context, false);
}
public static void showHistory(@NotNull final Context context, boolean detached) {
public static void showHistory(@Nonnull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorHistoryActivity.class);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
public static void showHelp(@NotNull final Context context) {
public static void showHelp(@Nonnull final Context context) {
context.startActivity(new Intent(context, CalculatorHelpActivity.class));
}
public static void showSettings(@NotNull final Context context) {
public static void showSettings(@Nonnull final Context context) {
showSettings(context, false);
}
public static void showSettings(@NotNull final Context context, boolean detached) {
public static void showSettings(@Nonnull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorPreferencesActivity.class);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
public static void showAbout(@NotNull final Context context) {
public static void showAbout(@Nonnull final Context context) {
context.startActivity(new Intent(context, CalculatorAboutActivity.class));
}
public static void showFunctions(@NotNull final Context context) {
public static void showFunctions(@Nonnull final Context context) {
showFunctions(context, false);
}
public static void showFunctions(@NotNull final Context context, boolean detached) {
public static void showFunctions(@Nonnull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorFunctionsActivity.class);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
public static void showOperators(@NotNull final Context context) {
public static void showOperators(@Nonnull final Context context) {
showOperators(context, false);
}
public static void showOperators(@NotNull final Context context, boolean detached) {
public static void showOperators(@Nonnull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorOperatorsActivity.class);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
public static void showVars(@NotNull final Context context) {
public static void showVars(@Nonnull final Context context) {
showVars(context, false);
}
public static void showVars(@NotNull final Context context, boolean detached) {
public static void showVars(@Nonnull final Context context, boolean detached) {
final Intent intent = new Intent(context, CalculatorVarsActivity.class);
Android.addIntentFlags(intent, detached, context);
context.startActivity(intent);
}
public static void plotGraph(@NotNull final Context context) {
public static void plotGraph(@Nonnull final Context context) {
final Intent intent = new Intent();
intent.setClass(context, CalculatorPlotActivity.class);
Android.addIntentFlags(intent, false, context);
context.startActivity(intent);
}
public static void tryCreateVar(@NotNull final Context context) {
public static void tryCreateVar(@Nonnull final Context context) {
final CalculatorDisplay display = Locator.getInstance().getDisplay();
final CalculatorDisplayViewState viewState = display.getViewState();
if (viewState.isValid()) {
@ -132,7 +132,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}
}
public static void tryCreateFunction(@NotNull final Context context) {
public static void tryCreateFunction(@Nonnull final Context context) {
final CalculatorDisplay display = Locator.getInstance().getDisplay();
final CalculatorDisplayViewState viewState = display.getViewState();
@ -150,7 +150,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}
}
@NotNull
@Nonnull
private static CalculatorNotifier getNotifier() {
return Locator.getInstance().getNotifier();
}
@ -177,19 +177,19 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}
}
public static void openApp(@NotNull Context context) {
public static void openApp(@Nonnull Context context) {
final Intent intent = new Intent(context, CalculatorActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(intent);
}
public static void likeButtonPressed(@NotNull final Context context) {
public static void likeButtonPressed(@Nonnull final Context context) {
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(CalculatorApplication.FACEBOOK_APP_URL));
Android.addIntentFlags(intent, false, context);
context.startActivity(intent);
}
public static void showCalculationMessagesDialog(@NotNull Context context, @NotNull List<Message> messages) {
public static void showCalculationMessagesDialog(@Nonnull Context context, @Nonnull List<Message> messages) {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (CalculatorPreferences.Calculations.showCalculationMessagesDialog.getPreference(prefs)) {
@ -198,7 +198,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
final Context context;
final Object source = calculatorEventData.getSource();
@ -261,7 +261,7 @@ public final class CalculatorActivityLauncher implements CalculatorEventListener
}
}
public static void showEvaluationError(@NotNull Context context, @NotNull final String errorMessage) {
public static void showEvaluationError(@Nonnull Context context, @Nonnull final String errorMessage) {
final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
final View errorMessageView = layoutInflater.inflate(R.layout.display_error_message, null);

View File

@ -3,7 +3,7 @@ package org.solovyev.android.calculator;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
/**
* User: serso

View File

@ -12,7 +12,7 @@ import net.robotmedia.billing.model.BillingDB;
import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.Android;
import org.solovyev.android.App;
import org.solovyev.android.ServiceLocator;
@ -59,7 +59,7 @@ public class CalculatorApplication extends android.app.Application implements Sh
public static final String ADMOB_USER_ID = "a14f02cf9c80cbc";
@NotNull
@Nonnull
private static CalculatorApplication instance;
/*
@ -70,10 +70,10 @@ public class CalculatorApplication extends android.app.Application implements Sh
**********************************************************************
*/
@NotNull
@Nonnull
private final List<CalculatorEventListener> listeners = new ArrayList<CalculatorEventListener>();
@NotNull
@Nonnull
protected final Handler uiHandler = new Handler();
/*
@ -171,32 +171,32 @@ public class CalculatorApplication extends android.app.Application implements Sh
Locator.getInstance().getNotifier().showDebugMessage(TAG, "Application started!");
}
private void setTheme(@NotNull SharedPreferences preferences) {
private void setTheme(@Nonnull SharedPreferences preferences) {
final CalculatorPreferences.Gui.Theme theme = CalculatorPreferences.Gui.getTheme(preferences);
setTheme(theme.getThemeId());
}
@NotNull
public CalculatorActivityHelper createActivityHelper(int layoutResId, @NotNull String logTag) {
@Nonnull
public CalculatorActivityHelper createActivityHelper(int layoutResId, @Nonnull String logTag) {
return new CalculatorActivityHelperImpl(layoutResId, logTag);
}
@NotNull
@Nonnull
public CalculatorFragmentHelper createFragmentHelper(int layoutId) {
return new CalculatorFragmentHelperImpl(layoutId);
}
@NotNull
@Nonnull
public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId) {
return new CalculatorFragmentHelperImpl(layoutId, titleResId);
}
@NotNull
@Nonnull
public CalculatorFragmentHelper createFragmentHelper(int layoutId, int titleResId, boolean listenersOnCreate) {
return new CalculatorFragmentHelperImpl(layoutId, titleResId, listenersOnCreate);
}
@NotNull
@Nonnull
public Handler getUiHandler() {
return uiHandler;
}
@ -209,12 +209,12 @@ public class CalculatorApplication extends android.app.Application implements Sh
**********************************************************************
*/
@NotNull
@Nonnull
public static CalculatorApplication getInstance() {
return instance;
}
public static boolean isMonkeyRunner(@NotNull Context context) {
public static boolean isMonkeyRunner(@Nonnull Context context) {
// NOTE: this code is only for monkeyrunner
return context.checkCallingOrSelfPermission(android.Manifest.permission.DISABLE_KEYGUARD) == PackageManager.PERMISSION_GRANTED;
}

View File

@ -9,8 +9,8 @@ import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.Android;
import org.solovyev.android.fragments.FragmentUtils;
import org.solovyev.common.msg.MessageType;
@ -23,13 +23,13 @@ import org.solovyev.common.text.Strings;
*/
public class CalculatorDialogActivity extends SherlockFragmentActivity {
@NotNull
@Nonnull
private static final String TAG = CalculatorDialogActivity.class.getSimpleName();
@NotNull
@Nonnull
private static final String DIALOG_DATA_EXTRA = "dialog_data";
public static void showDialog(@NotNull Context context, @NotNull DialogData dialogData) {
public static void showDialog(@Nonnull Context context, @Nonnull DialogData dialogData) {
final Intent intent = new Intent();
intent.setClass(context, CalculatorDialogActivity.class);
intent.putExtra(DIALOG_DATA_EXTRA, ParcelableDialogData.wrap(dialogData));
@ -91,7 +91,7 @@ public class CalculatorDialogActivity extends SherlockFragmentActivity {
}
@Override
public void onViewCreated(@NotNull View root, Bundle savedInstanceState) {
public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) {
super.onViewCreated(root, savedInstanceState);
final DialogData dialogData = readDialogData(getArguments());

View File

@ -7,7 +7,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.actionbarsherlock.app.SherlockFragment;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: Solovyev_S
@ -16,7 +16,7 @@ import org.jetbrains.annotations.NotNull;
*/
public class CalculatorDisplayFragment extends SherlockFragment {
@NotNull
@Nonnull
private CalculatorFragmentHelper fragmentHelper;
@Override

View File

@ -11,7 +11,7 @@ import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.menu.ActivityMenu;
import org.solovyev.android.menu.ListActivityMenu;
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
@ -23,10 +23,10 @@ import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
*/
public class CalculatorEditorFragment extends SherlockFragment {
@NotNull
@Nonnull
private CalculatorFragmentHelper fragmentHelper;
@NotNull
@Nonnull
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromEnum(CalculatorMenu.class, SherlockMenuHelper.getInstance());
public CalculatorEditorFragment() {

View File

@ -6,7 +6,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.actionbarsherlock.app.SherlockFragment;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: Solovyev_S
@ -15,18 +15,18 @@ import org.jetbrains.annotations.NotNull;
*/
public abstract class CalculatorFragment extends SherlockFragment {
@NotNull
@Nonnull
private final CalculatorFragmentHelper fragmentHelper;
protected CalculatorFragment(int layoutResId, int titleResId) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(layoutResId, titleResId);
}
protected CalculatorFragment(@NotNull CalculatorFragmentType fragmentType) {
protected CalculatorFragment(@Nonnull CalculatorFragmentType fragmentType) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId());
}
protected CalculatorFragment(@NotNull CalculatorFragmentHelper fragmentHelper) {
protected CalculatorFragment(@Nonnull CalculatorFragmentHelper fragmentHelper) {
this.fragmentHelper = fragmentHelper;
}

View File

@ -2,7 +2,7 @@ package org.solovyev.android.calculator;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: Solovyev_S
@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
*/
public abstract class CalculatorFragmentActivity extends SherlockFragmentActivity {
@NotNull
@Nonnull
private final CalculatorActivityHelper activityHelper;
protected CalculatorFragmentActivity() {
@ -22,7 +22,7 @@ public abstract class CalculatorFragmentActivity extends SherlockFragmentActivit
this.activityHelper = CalculatorApplication.getInstance().createActivityHelper(layoutResId, getClass().getSimpleName());
}
@NotNull
@Nonnull
protected CalculatorActivityHelper getActivityHelper() {
return activityHelper;
}

View File

@ -4,8 +4,8 @@ import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
@ -14,20 +14,20 @@ import org.jetbrains.annotations.Nullable;
*/
public interface CalculatorFragmentHelper {
boolean isPane(@NotNull Fragment fragment);
boolean isPane(@Nonnull Fragment fragment);
void setPaneTitle(@NotNull Fragment fragment, int titleResId);
void setPaneTitle(@Nonnull Fragment fragment, int titleResId);
void onCreate(@NotNull Fragment fragment);
void onCreate(@Nonnull Fragment fragment);
@NotNull
View onCreateView(@NotNull Fragment fragment, @NotNull LayoutInflater inflater, @Nullable ViewGroup container);
@Nonnull
View onCreateView(@Nonnull Fragment fragment, @Nonnull LayoutInflater inflater, @Nullable ViewGroup container);
void onViewCreated(@NotNull Fragment fragment, @NotNull View root);
void onViewCreated(@Nonnull Fragment fragment, @Nonnull View root);
void onResume(@NotNull Fragment fragment);
void onResume(@Nonnull Fragment fragment);
void onPause(@NotNull Fragment fragment);
void onPause(@Nonnull Fragment fragment);
void onDestroy(@NotNull Fragment fragment);
void onDestroy(@Nonnull Fragment fragment);
}

View File

@ -6,8 +6,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.ads.AdView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.ads.AdsController;
/**
@ -42,11 +42,11 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public boolean isPane(@NotNull Fragment fragment) {
public boolean isPane(@Nonnull Fragment fragment) {
return fragment.getActivity() instanceof CalculatorActivity;
}
public void setPaneTitle(@NotNull Fragment fragment, int titleResId) {
public void setPaneTitle(@Nonnull Fragment fragment, int titleResId) {
final TextView fragmentTitle = (TextView) fragment.getView().findViewById(R.id.fragment_title);
if (fragmentTitle != null) {
if (!isPane(fragment)) {
@ -58,7 +58,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onCreate(@NotNull Fragment fragment) {
public void onCreate(@Nonnull Fragment fragment) {
super.onCreate(fragment.getActivity());
if (listenersOnCreate) {
@ -69,7 +69,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onResume(@NotNull Fragment fragment) {
public void onResume(@Nonnull Fragment fragment) {
if (!listenersOnCreate) {
if (fragment instanceof CalculatorEventListener) {
Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) fragment);
@ -78,7 +78,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onPause(@NotNull Fragment fragment) {
public void onPause(@Nonnull Fragment fragment) {
if (!listenersOnCreate) {
if (fragment instanceof CalculatorEventListener) {
Locator.getInstance().getCalculator().removeCalculatorEventListener((CalculatorEventListener) fragment);
@ -87,7 +87,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onViewCreated(@NotNull Fragment fragment, @NotNull View root) {
public void onViewCreated(@Nonnull Fragment fragment, @Nonnull View root) {
final ViewGroup adParentView = (ViewGroup) root.findViewById(R.id.ad_parent_view);
final ViewGroup mainFragmentLayout = (ViewGroup) root.findViewById(R.id.main_fragment_layout);
@ -109,7 +109,7 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
}
@Override
public void onDestroy(@NotNull Fragment fragment) {
public void onDestroy(@Nonnull Fragment fragment) {
super.onDestroy(fragment.getActivity());
if (listenersOnCreate) {
@ -123,9 +123,9 @@ public class CalculatorFragmentHelperImpl extends AbstractCalculatorHelper imple
}
}
@NotNull
@Nonnull
@Override
public View onCreateView(@NotNull Fragment fragment, @NotNull LayoutInflater inflater, @Nullable ViewGroup container) {
public View onCreateView(@Nonnull Fragment fragment, @Nonnull LayoutInflater inflater, @Nullable ViewGroup container) {
return inflater.inflate(layoutId, container, false);
}
}

View File

@ -1,7 +1,7 @@
package org.solovyev.android.calculator;
import android.support.v4.app.Fragment;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.about.CalculatorAboutFragment;
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
import org.solovyev.android.calculator.help.CalculatorHelpFaqFragment;
@ -51,14 +51,14 @@ public enum CalculatorFragmentType {
matrix_edit(CalculatorMatrixEditFragment.class, R.layout.matrix_edit_fragment, R.string.c_screens),
release_notes(CalculatorReleaseNotesFragment.class, R.layout.release_notes_fragment, R.string.c_release_notes);
@NotNull
@Nonnull
private Class<? extends Fragment> fragmentClass;
private final int defaultLayoutId;
private int defaultTitleResId;
private CalculatorFragmentType(@NotNull Class<? extends Fragment> fragmentClass,
private CalculatorFragmentType(@Nonnull Class<? extends Fragment> fragmentClass,
int defaultLayoutId,
int defaultTitleResId) {
this.fragmentClass = fragmentClass;
@ -66,7 +66,7 @@ public enum CalculatorFragmentType {
this.defaultTitleResId = defaultTitleResId;
}
@NotNull
@Nonnull
public String getFragmentTag() {
return this.name();
}
@ -75,7 +75,7 @@ public enum CalculatorFragmentType {
return defaultTitleResId;
}
@NotNull
@Nonnull
public Class<? extends Fragment> getFragmentClass() {
return fragmentClass;
}
@ -84,8 +84,8 @@ public enum CalculatorFragmentType {
return defaultLayoutId;
}
@NotNull
public String createSubFragmentTag(@NotNull String subFragmentTag) {
@Nonnull
public String createSubFragmentTag(@Nonnull String subFragmentTag) {
return this.getFragmentTag() + "_" + subFragmentTag;
}
}

View File

@ -7,8 +7,8 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.actionbarsherlock.app.SherlockFragment;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
/**
@ -18,10 +18,10 @@ import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
*/
public class CalculatorKeyboardFragment extends SherlockFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
@NotNull
@Nonnull
private CalculatorPreferences.Gui.Theme theme;
@NotNull
@Nonnull
private CalculatorFragmentHelper fragmentHelper;
@Override
@ -83,7 +83,7 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar
}
/* private static void setMarginsForView(@Nullable View view, int marginLeft, int marginBottom, @NotNull Context context) {
/* private static void setMarginsForView(@Nullable View view, int marginLeft, int marginBottom, @Nonnull Context context) {
// IMPORTANT: this is workaround for probably android bug
// currently margin values set in styles are not applied for some reasons to the views (using include tag) => set them manually
@ -134,12 +134,12 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar
return (AndroidCalculatorDisplayView) Locator.getInstance().getDisplay().getView();
}
@NotNull
@Nonnull
private Calculator getCalculator() {
return Locator.getInstance().getCalculator();
}
@NotNull
@Nonnull
private static CalculatorKeyboard getKeyboard() {
return Locator.getInstance().getKeyboard();
}

View File

@ -6,7 +6,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.actionbarsherlock.app.SherlockListFragment;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: Solovyev_S
@ -15,18 +15,18 @@ import org.jetbrains.annotations.NotNull;
*/
public abstract class CalculatorListFragment extends SherlockListFragment {
@NotNull
@Nonnull
private final CalculatorFragmentHelper fragmentHelper;
protected CalculatorListFragment(int layoutResId, int titleResId) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(layoutResId, titleResId);
}
protected CalculatorListFragment(@NotNull CalculatorFragmentType fragmentType) {
protected CalculatorListFragment(@Nonnull CalculatorFragmentType fragmentType) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId());
}
protected CalculatorListFragment(@NotNull CalculatorFragmentHelper fragmentHelper) {
protected CalculatorListFragment(@Nonnull CalculatorFragmentHelper fragmentHelper) {
this.fragmentHelper = fragmentHelper;
}

View File

@ -4,7 +4,7 @@ import android.app.Activity;
import android.content.Context;
import android.util.Log;
import com.actionbarsherlock.view.MenuItem;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.view.NumeralBaseConverterDialog;
import org.solovyev.android.menu.LabeledMenuItem;
@ -17,35 +17,35 @@ enum CalculatorMenu implements LabeledMenuItem<MenuItem> {
settings(R.string.c_settings) {
@Override
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
CalculatorActivityLauncher.showSettings(context);
}
},
history(R.string.c_history) {
@Override
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
CalculatorActivityLauncher.showHistory(context);
}
},
plotter(R.string.cpp_plotter) {
@Override
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
Locator.getInstance().getPlotter().plot();
}
},
conversion_tool(R.string.c_conversion_tool) {
@Override
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
new NumeralBaseConverterDialog(null).show(context);
}
},
exit(R.string.c_exit) {
@Override
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
if (context instanceof Activity) {
((Activity) context).finish();
} else {
@ -56,14 +56,14 @@ enum CalculatorMenu implements LabeledMenuItem<MenuItem> {
help(R.string.c_help) {
@Override
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
CalculatorActivityLauncher.showHelp(context);
}
},
about(R.string.c_about) {
@Override
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
CalculatorActivityLauncher.showAbout(context);
}
};
@ -74,9 +74,9 @@ enum CalculatorMenu implements LabeledMenuItem<MenuItem> {
this.captionResId = captionResId;
}
@NotNull
@Nonnull
@Override
public String getCaption(@NotNull Context context) {
public String getCaption(@Nonnull Context context) {
return context.getString(captionResId);
}
}

View File

@ -6,7 +6,7 @@
package org.solovyev.android.calculator;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: serso
@ -18,7 +18,7 @@ public final class CalculatorSecurity {
private CalculatorSecurity() {
}
@NotNull
@Nonnull
public static String getPK() {
final StringBuilder result = new StringBuilder();

View File

@ -6,8 +6,8 @@
package org.solovyev.android.calculator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.common.JPredicate;
/**
@ -19,10 +19,10 @@ public class CharacterAtPositionFinder implements JPredicate<Character> {
private int i;
@NotNull
@Nonnull
private final String targetString;
public CharacterAtPositionFinder(@NotNull String targetString, int i) {
public CharacterAtPositionFinder(@Nonnull String targetString, int i) {
this.targetString = targetString;
this.i = i;
}

View File

@ -6,7 +6,7 @@
package org.solovyev.android.calculator;
import android.view.MotionEvent;
import org.jetbrains.annotations.NotNull;
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;
@ -24,7 +24,7 @@ public class CursorDragProcessor implements SimpleOnDragListener.DragProcessor {
}
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) {
boolean result = false;
if (dragButton instanceof DirectionDragButton) {

View File

@ -7,7 +7,7 @@
package org.solovyev.android.calculator;
import android.view.MotionEvent;
import org.jetbrains.annotations.NotNull;
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;
@ -25,7 +25,7 @@ public class EqualsDragProcessor implements SimpleOnDragListener.DragProcessor {
}
@Override
public boolean processDragEvent(@NotNull DragDirection dragDirection, @NotNull DragButton dragButton, @NotNull Point2d startPoint2d, @NotNull MotionEvent motionEvent) {
public boolean processDragEvent(@Nonnull DragDirection dragDirection, @Nonnull DragButton dragButton, @Nonnull Point2d startPoint2d, @Nonnull MotionEvent motionEvent) {
boolean result = false;
if (dragButton instanceof DirectionDragButton) {

View File

@ -3,7 +3,7 @@ package org.solovyev.android.calculator;
import android.app.Activity;
import android.content.SharedPreferences;
import jscl.NumeralBase;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
/**
@ -13,7 +13,7 @@ import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
*/
public class NumeralBaseButtons {
public static void toggleNumericDigits(@NotNull Activity activity, @NotNull NumeralBase currentNumeralBase) {
public static void toggleNumericDigits(@Nonnull Activity activity, @Nonnull NumeralBase currentNumeralBase) {
for (NumeralBase numeralBase : NumeralBase.values()) {
if (currentNumeralBase != numeralBase) {
AndroidNumeralBase.valueOf(numeralBase).toggleButtons(false, activity);
@ -23,7 +23,7 @@ public class NumeralBaseButtons {
AndroidNumeralBase.valueOf(currentNumeralBase).toggleButtons(true, activity);
}
public static void toggleNumericDigits(@NotNull Activity activity, @NotNull SharedPreferences preferences) {
public static void toggleNumericDigits(@Nonnull Activity activity, @Nonnull SharedPreferences preferences) {
if (CalculatorPreferences.Gui.hideNumeralBaseDigits.getPreference(preferences)) {
final NumeralBase nb = AndroidCalculatorEngine.Preferences.numeralBase.getPreference(preferences);
toggleNumericDigits(activity, nb);

View File

@ -6,7 +6,7 @@
package org.solovyev.android.calculator.about;
import android.os.Bundle;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorFragmentActivity;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.R;

View File

@ -12,7 +12,7 @@ import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.widget.TextView;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.Android;
import org.solovyev.android.calculator.CalculatorApplication;
import org.solovyev.android.calculator.CalculatorFragment;
@ -41,13 +41,13 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment {
releaseNotes.setText(Html.fromHtml(getReleaseNotes(this.getActivity())));
}
@NotNull
public static String getReleaseNotes(@NotNull Context context) {
@Nonnull
public static String getReleaseNotes(@Nonnull Context context) {
return getReleaseNotes(context, 0);
}
@NotNull
public static String getReleaseNotes(@NotNull Context context, int minVersion) {
@Nonnull
public static String getReleaseNotes(@Nonnull Context context, int minVersion) {
final StringBuilder result = new StringBuilder();
final String releaseNotesForTitle = context.getString(R.string.c_release_notes_for_title);

View File

@ -1,8 +1,8 @@
package org.solovyev.android.calculator.about;
import android.content.res.Resources;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: serso
@ -11,19 +11,19 @@ import org.jetbrains.annotations.Nullable;
*/
public class TextHelper {
@NotNull
@Nonnull
public String packageName;
@NotNull
@Nonnull
public Resources resources;
public TextHelper(@NotNull Resources resources, @NotNull String packageName) {
public TextHelper(@Nonnull Resources resources, @Nonnull String packageName) {
this.packageName = packageName;
this.resources = resources;
}
@Nullable
public String getText(@NotNull String stringName) {
public String getText(@Nonnull String stringName) {
final int stringId = this.resources.getIdentifier(stringName, "string", this.packageName);
try {
return resources.getString(stringId);

View File

@ -17,8 +17,8 @@ import jscl.math.function.Constant;
import jscl.math.function.CustomFunction;
import jscl.math.function.Function;
import jscl.math.function.IFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsActivity;
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment;
@ -39,14 +39,14 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
private static final String INPUT = "input";
@NotNull
@Nonnull
private Input input;
public FunctionEditDialogFragment() {
this(Input.newInstance());
}
public FunctionEditDialogFragment(@NotNull Input input) {
public FunctionEditDialogFragment(@Nonnull Input input) {
this.input = input;
}
@ -65,7 +65,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
}
@Override
public void onViewCreated(@NotNull View root, Bundle savedInstanceState) {
public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) {
super.onViewCreated(root, savedInstanceState);
final FunctionParamsView paramsView = (FunctionParamsView) root.findViewById(R.id.function_params_layout);
@ -120,7 +120,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
}
@Override
public void onSaveInstanceState(@NotNull Bundle out) {
public void onSaveInstanceState(@Nonnull Bundle out) {
super.onSaveInstanceState(out);
out.putParcelable(INPUT, FunctionEditorSaver.readInput(input.getFunction(), getView()));
@ -141,7 +141,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) {
case function_removed:
case function_added:
@ -162,7 +162,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
**********************************************************************
*/
public static void showDialog(@NotNull Input input, @NotNull Context context) {
public static void showDialog(@Nonnull Input input, @Nonnull Context context) {
if (context instanceof SherlockFragmentActivity) {
FunctionEditDialogFragment.showDialog(input, ((SherlockFragmentActivity) context).getSupportFragmentManager());
} else {
@ -173,7 +173,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
}
}
public static void showDialog(@NotNull Input input, @NotNull FragmentManager fm) {
public static void showDialog(@Nonnull Input input, @Nonnull FragmentManager fm) {
AndroidSherlockUtils.showDialog(new FunctionEditDialogFragment(input), "function-editor", fm);
}
@ -181,7 +181,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
public static final Parcelable.Creator<Input> CREATOR = new Creator<Input>() {
@Override
public Input createFromParcel(@NotNull Parcel in) {
public Input createFromParcel(@Nonnull Parcel in) {
return Input.fromParcel(in);
}
@ -193,7 +193,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
private static final Parcelable.Creator<String> STRING_CREATOR = new Creator<String>() {
@Override
public String createFromParcel(@NotNull Parcel in) {
public String createFromParcel(@Nonnull Parcel in) {
return in.readString();
}
@ -203,8 +203,8 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
}
};
@NotNull
private static Input fromParcel(@NotNull Parcel in) {
@Nonnull
private static Input fromParcel(@Nonnull Parcel in) {
final Input result = new Input();
result.name = in.readString();
result.content = in.readString();
@ -237,24 +237,24 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
private Input() {
}
@NotNull
@Nonnull
public static Input newInstance() {
return new Input();
}
@NotNull
public static Input newFromFunction(@NotNull IFunction function) {
@Nonnull
public static Input newFromFunction(@Nonnull IFunction function) {
final Input result = new Input();
result.function = AFunction.fromIFunction(function);
return result;
}
@NotNull
@Nonnull
public static Input newInstance(@Nullable IFunction function,
@Nullable String name,
@Nullable String value,
@Nullable String description,
@NotNull List<String> parameterNames) {
@Nonnull List<String> parameterNames) {
final Input result = new Input();
if (function != null) {
@ -299,7 +299,7 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
}
@Override
public void writeToParcel(@NotNull Parcel out, int flags) {
public void writeToParcel(@Nonnull Parcel out, int flags) {
out.writeString(name);
out.writeString(content);
out.writeString(description);
@ -307,8 +307,8 @@ public class FunctionEditDialogFragment extends DialogFragment implements Calcul
out.writeSerializable(function);
}
@NotNull
public static Input newFromDisplay(@NotNull CalculatorDisplayViewState viewState) {
@Nonnull
public static Input newFromDisplay(@Nonnull CalculatorDisplayViewState viewState) {
final Input result = new Input();
result.content = viewState.getText();

View File

@ -5,8 +5,8 @@ import android.widget.EditText;
import jscl.CustomFunctionCalculationException;
import jscl.math.function.Function;
import jscl.math.function.IFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorFunctionsMathRegistry;
import org.solovyev.android.calculator.CalculatorMathRegistry;
import org.solovyev.android.calculator.Locator;
@ -21,27 +21,27 @@ import java.util.List;
public class FunctionEditorSaver implements View.OnClickListener {
@NotNull
@Nonnull
private final Object source;
@NotNull
@Nonnull
private final AFunction.Builder builder;
@Nullable
private final IFunction editedInstance;
@NotNull
@Nonnull
private final View view;
@NotNull
@Nonnull
private final CalculatorMathRegistry<Function> mathRegistry;
public FunctionEditorSaver(@NotNull AFunction.Builder builder,
public FunctionEditorSaver(@Nonnull AFunction.Builder builder,
@Nullable IFunction editedInstance,
@NotNull View view,
@NotNull CalculatorMathRegistry<Function> registry,
@NotNull Object source) {
@Nonnull View view,
@Nonnull CalculatorMathRegistry<Function> registry,
@Nonnull Object source) {
this.builder = builder;
this.editedInstance = editedInstance;
@ -111,8 +111,8 @@ public class FunctionEditorSaver implements View.OnClickListener {
}
}
@NotNull
public static FunctionEditDialogFragment.Input readInput(@Nullable IFunction function, @NotNull View root) {
@Nonnull
public static FunctionEditDialogFragment.Input readInput(@Nullable IFunction function, @Nonnull View root) {
final EditText editName = (EditText) root.findViewById(R.id.function_edit_name);
String name = editName.getText().toString();
@ -128,7 +128,7 @@ public class FunctionEditorSaver implements View.OnClickListener {
return FunctionEditDialogFragment.Input.newInstance(function, name, content, description, parameterNames);
}
private boolean validateParameters(@NotNull List<String> parameterNames) {
private boolean validateParameters(@Nonnull List<String> parameterNames) {
for (String parameterName : parameterNames) {
if (!VarEditorSaver.isValidName(parameterName)) {
return false;

View File

@ -9,8 +9,8 @@ import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import jscl.text.MutableInt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.R;
import java.util.ArrayList;
@ -19,10 +19,10 @@ import java.util.List;
public class FunctionParamsView extends LinearLayout {
@NotNull
@Nonnull
private final MutableInt paramsCount = new MutableInt(0);
@NotNull
@Nonnull
private final List<Integer> paramIds = new ArrayList<Integer>(10);
private static final String PARAM_TAG_PREFIX = "function_param_";
@ -43,7 +43,7 @@ public class FunctionParamsView extends LinearLayout {
init(Collections.<String>emptyList());
}
public void init(@NotNull List<String> parameters) {
public void init(@Nonnull List<String> parameters) {
this.setOrientation(VERTICAL);
final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@ -110,7 +110,7 @@ public class FunctionParamsView extends LinearLayout {
}
}
private void downParam(@NotNull Integer id) {
private void downParam(@Nonnull Integer id) {
synchronized (paramsCount) {
int index = paramIds.indexOf(id);
if (index < paramIds.size() - 1) {
@ -119,7 +119,7 @@ public class FunctionParamsView extends LinearLayout {
}
}
private void upParam(@NotNull Integer id) {
private void upParam(@Nonnull Integer id) {
synchronized (paramsCount) {
int index = paramIds.indexOf(id);
if (index > 0) {
@ -139,25 +139,25 @@ public class FunctionParamsView extends LinearLayout {
}
}
private void swap(@NotNull TextView first,
@NotNull TextView second) {
private void swap(@Nonnull TextView first,
@Nonnull TextView second) {
final CharSequence tmp = first.getText();
first.setText(second.getText());
second.setText(tmp);
}
@Nullable
private View getParamView(@NotNull Integer id) {
private View getParamView(@Nonnull Integer id) {
final String tag = getParamTag(id);
return this.findViewWithTag(tag);
}
@NotNull
private String getParamTag(@NotNull Integer index) {
@Nonnull
private String getParamTag(@Nonnull Integer index) {
return PARAM_TAG_PREFIX + index;
}
public void removeParam(@NotNull Integer id) {
public void removeParam(@Nonnull Integer id) {
synchronized (paramsCount) {
if (paramIds.contains(id)) {
final View editParamView = getParamView(id);
@ -169,7 +169,7 @@ public class FunctionParamsView extends LinearLayout {
}
}
@NotNull
@Nonnull
public List<String> getParameterNames() {
synchronized (paramsCount) {
final List<String> result = new ArrayList<String>(paramsCount.intValue());

View File

@ -7,7 +7,7 @@
package org.solovyev.android.calculator.help;
import android.os.Bundle;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorFragmentActivity;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.R;

View File

@ -20,8 +20,8 @@ import com.actionbarsherlock.app.SherlockListFragment;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.jscl.JsclOperation;
import org.solovyev.android.menu.*;
@ -52,7 +52,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
**********************************************************************
*/
@NotNull
@Nonnull
private static final String TAG = "CalculatorHistoryFragment";
public static final Comparator<CalculatorHistoryState> COMPARATOR = new Comparator<CalculatorHistoryState>() {
@ -79,15 +79,15 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
*/
@NotNull
@Nonnull
private ArrayAdapter<CalculatorHistoryState> adapter;
@NotNull
@Nonnull
private CalculatorFragmentHelper fragmentHelper;
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromResource(org.solovyev.android.calculator.R.menu.history_menu, HistoryMenu.class, SherlockMenuHelper.getInstance());
protected AbstractCalculatorHistoryFragment(@NotNull CalculatorFragmentType fragmentType) {
protected AbstractCalculatorHistoryFragment(@Nonnull CalculatorFragmentType fragmentType) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId(), false);
}
@ -102,7 +102,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
logDebug("onCreate");
}
private int logDebug(@NotNull String msg) {
private int logDebug(@Nonnull String msg) {
return Log.d(TAG + ": " + getTag(), msg);
}
@ -212,7 +212,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
adapter.notifyDataSetChanged();
}
public static boolean isAlreadySaved(@NotNull CalculatorHistoryState historyState) {
public static boolean isAlreadySaved(@Nonnull CalculatorHistoryState historyState) {
assert !historyState.isSaved();
boolean result = false;
@ -235,11 +235,11 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
return result;
}
public static void useHistoryItem(@NotNull final CalculatorHistoryState historyState) {
public static void useHistoryItem(@Nonnull final CalculatorHistoryState historyState) {
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.use_history_state, historyState);
}
@NotNull
@Nonnull
private List<CalculatorHistoryState> getHistoryList() {
final List<CalculatorHistoryState> calculatorHistoryStates = getHistoryItems();
@ -258,11 +258,11 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
return calculatorHistoryStates;
}
@NotNull
@Nonnull
protected abstract List<CalculatorHistoryState> getHistoryItems();
@NotNull
public static String getHistoryText(@NotNull CalculatorHistoryState state) {
@Nonnull
public static String getHistoryText(@Nonnull CalculatorHistoryState state) {
final StringBuilder result = new StringBuilder();
result.append(state.getEditorState().getText());
result.append(getIdentitySign(state.getDisplayState().getJsclOperation()));
@ -273,20 +273,20 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
return result.toString();
}
@NotNull
private static String getIdentitySign(@NotNull JsclOperation jsclOperation) {
@Nonnull
private static String getIdentitySign(@Nonnull JsclOperation jsclOperation) {
return jsclOperation == JsclOperation.simplify ? "" : "=";
}
protected abstract void clearHistory();
@NotNull
@Nonnull
protected ArrayAdapter<CalculatorHistoryState> getAdapter() {
return adapter;
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) {
case history_state_added:
getActivity().runOnUiThread(new Runnable() {
@ -337,7 +337,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
clear_history(org.solovyev.android.calculator.R.id.history_menu_clear_history) {
@Override
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.clear_history_requested, null);
}
};
@ -348,7 +348,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
this.itemId = itemId;
}
@NotNull
@Nonnull
@Override
public Integer getItemId() {
return this.itemId;

View File

@ -10,8 +10,8 @@ import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.Calculator;
import org.solovyev.android.calculator.CalculatorEventData;
import org.solovyev.android.calculator.CalculatorEventType;
@ -27,13 +27,13 @@ import java.util.List;
*/
public class AndroidCalculatorHistory implements CalculatorHistory {
@NotNull
@Nonnull
private final CalculatorHistoryImpl calculatorHistory;
@NotNull
@Nonnull
private final Context context;
public AndroidCalculatorHistory(@NotNull Application application, @NotNull Calculator calculator) {
public AndroidCalculatorHistory(@Nonnull Application application, @Nonnull Calculator calculator) {
this.context = application;
calculatorHistory = new CalculatorHistoryImpl(calculator);
}
@ -63,7 +63,7 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
save();
}
public void removeSavedHistory(@NotNull CalculatorHistoryState historyState) {
public void removeSavedHistory(@Nonnull CalculatorHistoryState historyState) {
historyState.setSaved(false);
calculatorHistory.removeSavedHistory(historyState);
save();
@ -100,12 +100,12 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
}
@Override
public boolean isActionAvailable(@NotNull HistoryAction historyAction) {
public boolean isActionAvailable(@Nonnull HistoryAction historyAction) {
return calculatorHistory.isActionAvailable(historyAction);
}
@Override
public CalculatorHistoryState doAction(@NotNull HistoryAction historyAction, @Nullable CalculatorHistoryState currentState) {
public CalculatorHistoryState doAction(@Nonnull HistoryAction historyAction, @Nullable CalculatorHistoryState currentState) {
return calculatorHistory.doAction(historyAction, currentState);
}
@ -114,13 +114,13 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
calculatorHistory.addState(currentState);
}
@NotNull
@Nonnull
@Override
public List<CalculatorHistoryState> getStates() {
return calculatorHistory.getStates();
}
@NotNull
@Nonnull
@Override
public List<CalculatorHistoryState> getStates(boolean includeIntermediateStates) {
return calculatorHistory.getStates(includeIntermediateStates);
@ -131,18 +131,18 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
calculatorHistory.clear();
}
@NotNull
@Nonnull
public List<CalculatorHistoryState> getSavedHistory() {
return calculatorHistory.getSavedHistory();
}
@NotNull
public CalculatorHistoryState addSavedState(@NotNull CalculatorHistoryState historyState) {
@Nonnull
public CalculatorHistoryState addSavedState(@Nonnull CalculatorHistoryState historyState) {
return calculatorHistory.addSavedState(historyState);
}
@Override
public void fromXml(@NotNull String xml) {
public void fromXml(@Nonnull String xml) {
calculatorHistory.fromXml(xml);
}
@ -152,7 +152,7 @@ public class AndroidCalculatorHistory implements CalculatorHistory {
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
calculatorHistory.onCalculatorEvent(calculatorEventData, calculatorEventType, data);
}
}

View File

@ -8,8 +8,8 @@ package org.solovyev.android.calculator.history;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
/**
@ -19,7 +19,7 @@ import org.solovyev.android.calculator.*;
*/
public class CalculatorHistoryActivity extends SherlockFragmentActivity implements CalculatorEventListener {
@NotNull
@Nonnull
private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createActivityHelper(R.layout.main_empty, CalculatorHistoryActivity.class.getSimpleName());
@Override
@ -62,7 +62,7 @@ public class CalculatorHistoryActivity extends SherlockFragmentActivity implemen
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
if (calculatorEventType == CalculatorEventType.use_history_state) {
this.finish();
}

View File

@ -7,7 +7,7 @@
package org.solovyev.android.calculator.history;
import android.preference.PreferenceManager;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.CalculatorPreferences;
import org.solovyev.android.calculator.Locator;
@ -32,7 +32,7 @@ public class CalculatorHistoryFragment extends AbstractCalculatorHistoryFragment
return R.layout.history_item;
}
@NotNull
@Nonnull
@Override
protected List<CalculatorHistoryState> getHistoryItems() {
final boolean showIntermediateCalculations = CalculatorPreferences.History.showIntermediateCalculations.getPreference(PreferenceManager.getDefaultSharedPreferences(getActivity()));

View File

@ -6,7 +6,7 @@
package org.solovyev.android.calculator.history;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.R;
@ -30,7 +30,7 @@ public class CalculatorSavedHistoryFragment extends AbstractCalculatorHistoryFra
return R.layout.saved_history_item;
}
@NotNull
@Nonnull
@Override
protected List<CalculatorHistoryState> getHistoryItems() {
return new ArrayList<CalculatorHistoryState>(Locator.getInstance().getHistory().getSavedHistory());

View File

@ -11,7 +11,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.R;
import org.solovyev.common.text.Strings;
@ -26,7 +26,7 @@ import java.util.List;
*/
public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
HistoryArrayAdapter(Context context, int resource, int textViewResourceId, @NotNull List<CalculatorHistoryState> historyList) {
HistoryArrayAdapter(Context context, int resource, int textViewResourceId, @Nonnull List<CalculatorHistoryState> historyList) {
super(context, resource, textViewResourceId, historyList);
}

View File

@ -7,7 +7,7 @@
package org.solovyev.android.calculator.history;
import android.widget.ArrayAdapter;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/**
* User: serso
@ -16,23 +16,23 @@ import org.jetbrains.annotations.NotNull;
*/
public class HistoryItemMenuData {
@NotNull
@Nonnull
private final ArrayAdapter<CalculatorHistoryState> adapter;
@NotNull
@Nonnull
private final CalculatorHistoryState historyState;
public HistoryItemMenuData(@NotNull CalculatorHistoryState historyState, ArrayAdapter<CalculatorHistoryState> adapter) {
public HistoryItemMenuData(@Nonnull CalculatorHistoryState historyState, ArrayAdapter<CalculatorHistoryState> adapter) {
this.historyState = historyState;
this.adapter = adapter;
}
@NotNull
@Nonnull
public CalculatorHistoryState getHistoryState() {
return historyState;
}
@NotNull
@Nonnull
public ArrayAdapter<CalculatorHistoryState> getAdapter() {
return adapter;
}

View File

@ -16,7 +16,7 @@ import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.R;
import org.solovyev.android.menu.LabeledMenuItem;
@ -31,14 +31,14 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
use(R.string.c_use) {
@Override
public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) {
public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) {
AbstractCalculatorHistoryFragment.useHistoryItem(data.getHistoryState());
}
},
copy_expression(R.string.c_copy_expression) {
@Override
public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) {
public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) {
final CalculatorHistoryState calculatorHistoryState = data.getHistoryState();
final String text = calculatorHistoryState.getEditorState().getText();
if (!Strings.isEmpty(text)) {
@ -51,7 +51,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
copy_result(R.string.c_copy_result) {
@Override
public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) {
public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) {
final CalculatorHistoryState calculatorHistoryState = data.getHistoryState();
final String text = calculatorHistoryState.getDisplayState().getEditorState().getText();
if (!Strings.isEmpty(text)) {
@ -64,7 +64,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
save(R.string.c_save) {
@Override
public void onClick(@NotNull final HistoryItemMenuData data, @NotNull final Context context) {
public void onClick(@Nonnull final HistoryItemMenuData data, @Nonnull final Context context) {
final CalculatorHistoryState historyState = data.getHistoryState();
if (!historyState.isSaved()) {
createEditHistoryDialog(data, context, true);
@ -76,7 +76,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
edit(R.string.c_edit) {
@Override
public void onClick(@NotNull final HistoryItemMenuData data, @NotNull final Context context) {
public void onClick(@Nonnull final HistoryItemMenuData data, @Nonnull final Context context) {
final CalculatorHistoryState historyState = data.getHistoryState();
if (historyState.isSaved()) {
createEditHistoryDialog(data, context, false);
@ -88,7 +88,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
remove(R.string.c_remove) {
@Override
public void onClick(@NotNull HistoryItemMenuData data, @NotNull Context context) {
public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) {
final CalculatorHistoryState historyState = data.getHistoryState();
if (historyState.isSaved()) {
data.getAdapter().remove(historyState);
@ -99,7 +99,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
}
};
private static void createEditHistoryDialog(@NotNull final HistoryItemMenuData data, @NotNull final Context context, final boolean save) {
private static void createEditHistoryDialog(@Nonnull final HistoryItemMenuData data, @Nonnull final Context context, final boolean save) {
final CalculatorHistoryState historyState = data.getHistoryState();
final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@ -142,9 +142,9 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
this.captionId = captionId;
}
@NotNull
@Nonnull
@Override
public String getCaption(@NotNull Context context) {
public String getCaption(@Nonnull Context context) {
return context.getString(captionId);
}
}

View File

@ -8,8 +8,8 @@ package org.solovyev.android.calculator.history;
import android.widget.EditText;
import android.widget.TextView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.Editor;
/**
@ -19,10 +19,10 @@ import org.solovyev.android.calculator.Editor;
*/
public class TextViewEditorAdapter implements Editor {
@NotNull
@Nonnull
private final TextView textView;
public TextViewEditorAdapter(@NotNull TextView textView) {
public TextViewEditorAdapter(@Nonnull TextView textView) {
this.textView = textView;
}

View File

@ -16,8 +16,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.actionbarsherlock.app.SherlockListFragment;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.menu.AMenuItem;
import org.solovyev.android.menu.ContextMenuBuilder;
@ -67,13 +67,13 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
@Nullable
private String category;
@NotNull
@Nonnull
private final CalculatorFragmentHelper fragmentHelper;
@NotNull
@Nonnull
private final Handler uiHandler = new Handler();
protected AbstractMathEntityListFragment(@NotNull CalculatorFragmentType fragmentType) {
protected AbstractMathEntityListFragment(@Nonnull CalculatorFragmentType fragmentType) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId());
}
@ -142,8 +142,8 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
super.onDestroy();
}
@NotNull
protected abstract List<LabeledMenuItem<T>> getMenuItemsOnLongClick(@NotNull T item);
@Nonnull
protected abstract List<LabeledMenuItem<T>> getMenuItemsOnLongClick(@Nonnull T item);
@Override
public void onPause() {
@ -164,7 +164,7 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
sort();
}
@NotNull
@Nonnull
private List<T> getMathEntitiesByCategory() {
final List<T> result = getMathEntities();
@ -182,14 +182,14 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
return t != null && (category == null || Objects.areEqual(getMathEntityCategory(t), category));
}
@NotNull
@Nonnull
protected abstract MathEntityDescriptionGetter getDescriptionGetter();
@NotNull
@Nonnull
protected abstract List<T> getMathEntities();
@Nullable
abstract String getMathEntityCategory(@NotNull T t);
abstract String getMathEntityCategory(@Nonnull T t);
protected void sort() {
final MathEntityArrayAdapter<T> localAdapter = adapter;
@ -207,14 +207,14 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
protected static class MathEntityArrayAdapter<T extends MathEntity> extends ArrayAdapter<T> {
@NotNull
@Nonnull
private final MathEntityDescriptionGetter descriptionGetter;
private MathEntityArrayAdapter(@NotNull MathEntityDescriptionGetter descriptionGetter,
@NotNull Context context,
private MathEntityArrayAdapter(@Nonnull MathEntityDescriptionGetter descriptionGetter,
@Nonnull Context context,
int resource,
int textViewResourceId,
@NotNull List<T> objects) {
@Nonnull List<T> objects) {
super(context, resource, textViewResourceId, objects);
this.descriptionGetter = descriptionGetter;
@ -236,7 +236,7 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
return result;
}
private void fillView(int position, @NotNull ViewGroup result) {
private void fillView(int position, @Nonnull ViewGroup result) {
final T mathEntity = getItem(position);
final TextView text = (TextView) result.findViewById(R.id.math_entity_text);
@ -256,15 +256,15 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
protected static class MathEntityDescriptionGetterImpl implements MathEntityDescriptionGetter {
@NotNull
@Nonnull
private final CalculatorMathRegistry<?> mathRegistry;
public MathEntityDescriptionGetterImpl(@NotNull CalculatorMathRegistry<?> mathRegistry) {
public MathEntityDescriptionGetterImpl(@Nonnull CalculatorMathRegistry<?> mathRegistry) {
this.mathRegistry = mathRegistry;
}
@Override
public String getDescription(@NotNull Context context, @NotNull String mathEntityName) {
public String getDescription(@Nonnull Context context, @Nonnull String mathEntityName) {
return this.mathRegistry.getDescription(mathEntityName);
}
}
@ -272,16 +272,16 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
protected static interface MathEntityDescriptionGetter {
@Nullable
String getDescription(@NotNull Context context, @NotNull String mathEntityName);
String getDescription(@Nonnull Context context, @Nonnull String mathEntityName);
}
public void addToAdapter(@NotNull T mathEntity) {
public void addToAdapter(@Nonnull T mathEntity) {
if (this.adapter != null) {
this.adapter.add(mathEntity);
}
}
public void removeFromAdapter(@NotNull T mathEntity) {
public void removeFromAdapter(@Nonnull T mathEntity) {
if (this.adapter != null) {
this.adapter.remove(mathEntity);
}
@ -298,7 +298,7 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
return adapter;
}
@NotNull
@Nonnull
protected Handler getUiHandler() {
return uiHandler;
}
@ -311,12 +311,12 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
**********************************************************************
*/
static void createTab(@NotNull Context context,
@NotNull TabHost tabHost,
@NotNull String tabId,
@NotNull String categoryId,
static void createTab(@Nonnull Context context,
@Nonnull TabHost tabHost,
@Nonnull String tabId,
@Nonnull String categoryId,
int tabCaptionId,
@NotNull Class<? extends Activity> activityClass,
@Nonnull Class<? extends Activity> activityClass,
@Nullable Intent parentIntent) {
TabHost.TabSpec spec;
@ -336,18 +336,18 @@ public abstract class AbstractMathEntityListFragment<T extends MathEntity> exten
tabHost.addTab(spec);
}
@NotNull
public static Bundle createBundleFor(@NotNull String categoryId) {
@Nonnull
public static Bundle createBundleFor(@Nonnull String categoryId) {
final Bundle result = new Bundle(1);
putCategory(result, categoryId);
return result;
}
static void putCategory(@NotNull Bundle bundle, @NotNull String categoryId) {
static void putCategory(@Nonnull Bundle bundle, @Nonnull String categoryId) {
bundle.putString(MATH_ENTITY_CATEGORY_EXTRA_STRING, categoryId);
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
}
}

View File

@ -10,8 +10,8 @@ import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
@ -22,7 +22,7 @@ import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
*/
public class CalculatorFunctionsActivity extends SherlockFragmentActivity implements CalculatorEventListener {
@NotNull
@Nonnull
private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createActivityHelper(R.layout.main_empty, CalculatorHistoryActivity.class.getSimpleName());
@Override
@ -93,7 +93,7 @@ public class CalculatorFunctionsActivity extends SherlockFragmentActivity implem
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) {
case use_function:
this.finish();

View File

@ -17,8 +17,8 @@ import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import jscl.math.function.Function;
import jscl.math.function.IFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.function.FunctionEditDialogFragment;
import org.solovyev.android.menu.AMenuItem;
@ -66,9 +66,9 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
return LongClickMenuItem.use;
}
@NotNull
@Nonnull
@Override
protected List<LabeledMenuItem<Function>> getMenuItemsOnLongClick(@NotNull Function item) {
protected List<LabeledMenuItem<Function>> getMenuItemsOnLongClick(@Nonnull Function item) {
List<LabeledMenuItem<Function>> result = new ArrayList<LabeledMenuItem<Function>>(Arrays.asList(LongClickMenuItem.values()));
final CalculatorMathRegistry<Function> functionsRegistry = Locator.getInstance().getEngine().getFunctionsRegistry();
@ -85,25 +85,25 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
return result;
}
@NotNull
@Nonnull
@Override
protected MathEntityDescriptionGetter getDescriptionGetter() {
return new MathEntityDescriptionGetterImpl(Locator.getInstance().getEngine().getFunctionsRegistry());
}
@NotNull
@Nonnull
@Override
protected List<Function> getMathEntities() {
return new ArrayList<Function>(Locator.getInstance().getEngine().getFunctionsRegistry().getEntities());
}
@Override
protected String getMathEntityCategory(@NotNull Function function) {
protected String getMathEntityCategory(@Nonnull Function function) {
return Locator.getInstance().getEngine().getFunctionsRegistry().getCategory(function);
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
super.onCalculatorEvent(calculatorEventData, calculatorEventType, data);
switch (calculatorEventType) {
@ -122,7 +122,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
}
private void processFunctionRemoved(@NotNull final Function function) {
private void processFunctionRemoved(@Nonnull final Function function) {
if (this.isInCategory(function)) {
getUiHandler().post(new Runnable() {
@Override
@ -134,7 +134,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
}
}
private void processFunctionChanged(@NotNull final Change<IFunction> change) {
private void processFunctionChanged(@Nonnull final Change<IFunction> change) {
final IFunction newFunction = change.getNewValue();
if (newFunction instanceof Function) {
@ -169,7 +169,7 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
}
}
private void processFunctionAdded(@NotNull final Function function) {
private void processFunctionAdded(@Nonnull final Function function) {
if (this.isInCategory(function)) {
getUiHandler().post(new Runnable() {
@Override
@ -222,14 +222,14 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
private static enum LongClickMenuItem implements LabeledMenuItem<Function> {
use(R.string.c_use) {
@Override
public void onClick(@NotNull Function function, @NotNull Context context) {
public void onClick(@Nonnull Function function, @Nonnull Context context) {
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.use_function, function);
}
},
edit(R.string.c_edit) {
@Override
public void onClick(@NotNull Function function, @NotNull Context context) {
public void onClick(@Nonnull Function function, @Nonnull Context context) {
if (function instanceof IFunction) {
FunctionEditDialogFragment.showDialog(FunctionEditDialogFragment.Input.newFromFunction((IFunction) function), ((SherlockFragmentActivity) context).getSupportFragmentManager());
}
@ -238,14 +238,14 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
remove(R.string.c_remove) {
@Override
public void onClick(@NotNull Function function, @NotNull Context context) {
public void onClick(@Nonnull Function function, @Nonnull Context context) {
MathEntityRemover.newFunctionRemover(function, null, context, context).showConfirmationDialog();
}
},
copy_description(R.string.c_copy_description) {
@Override
public void onClick(@NotNull Function function, @NotNull Context context) {
public void onClick(@Nonnull Function function, @Nonnull Context context) {
final String text = Locator.getInstance().getEngine().getFunctionsRegistry().getDescription(function.getName());
if (!Strings.isEmpty(text)) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE);
@ -259,9 +259,9 @@ public class CalculatorFunctionsFragment extends AbstractMathEntityListFragment<
this.captionId = captionId;
}
@NotNull
@Nonnull
@Override
public String getCaption(@NotNull Context context) {
public String getCaption(@Nonnull Context context) {
return context.getString(captionId);
}
}

View File

@ -8,8 +8,8 @@ package org.solovyev.android.calculator.math.edit;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
@ -20,7 +20,7 @@ import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
*/
public class CalculatorOperatorsActivity extends SherlockFragmentActivity implements CalculatorEventListener {
@NotNull
@Nonnull
private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createActivityHelper(R.layout.main_empty, CalculatorHistoryActivity.class.getSimpleName());
@Override
@ -71,7 +71,7 @@ public class CalculatorOperatorsActivity extends SherlockFragmentActivity implem
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) {
case use_operator:
this.finish();

View File

@ -4,7 +4,7 @@ import android.app.Activity;
import android.content.Context;
import android.text.ClipboardManager;
import jscl.math.operator.Operator;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.CalculatorEventType;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.Locator;
@ -34,9 +34,9 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
return LongClickMenuItem.use;
}
@NotNull
@Nonnull
@Override
protected List<LabeledMenuItem<Operator>> getMenuItemsOnLongClick(@NotNull Operator item) {
protected List<LabeledMenuItem<Operator>> getMenuItemsOnLongClick(@Nonnull Operator item) {
final List<LabeledMenuItem<Operator>> result = new ArrayList<LabeledMenuItem<Operator>>(Arrays.asList(LongClickMenuItem.values()));
if (Strings.isEmpty(OperatorDescriptionGetter.instance.getDescription(this.getActivity(), item.getName()))) {
@ -46,14 +46,14 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
return result;
}
@NotNull
@Nonnull
@Override
protected MathEntityDescriptionGetter getDescriptionGetter() {
return OperatorDescriptionGetter.instance;
}
@NotNull
@Nonnull
@Override
protected List<Operator> getMathEntities() {
final List<Operator> result = new ArrayList<Operator>();
@ -65,7 +65,7 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
}
@Override
protected String getMathEntityCategory(@NotNull Operator operator) {
protected String getMathEntityCategory(@Nonnull Operator operator) {
String result = Locator.getInstance().getEngine().getOperatorsRegistry().getCategory(operator);
if (result == null) {
result = Locator.getInstance().getEngine().getPostfixFunctionsRegistry().getCategory(operator);
@ -79,7 +79,7 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
instance;
@Override
public String getDescription(@NotNull Context context, @NotNull String mathEntityName) {
public String getDescription(@Nonnull Context context, @Nonnull String mathEntityName) {
String result = Locator.getInstance().getEngine().getOperatorsRegistry().getDescription(mathEntityName);
if (Strings.isEmpty(result)) {
result = Locator.getInstance().getEngine().getPostfixFunctionsRegistry().getDescription(mathEntityName);
@ -101,14 +101,14 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
use(R.string.c_use) {
@Override
public void onClick(@NotNull Operator data, @NotNull Context context) {
public void onClick(@Nonnull Operator data, @Nonnull Context context) {
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.use_operator, data);
}
},
copy_description(R.string.c_copy_description) {
@Override
public void onClick(@NotNull Operator data, @NotNull Context context) {
public void onClick(@Nonnull Operator data, @Nonnull Context context) {
final String text = OperatorDescriptionGetter.instance.getDescription(context, data.getName());
if (!Strings.isEmpty(text)) {
final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Activity.CLIPBOARD_SERVICE);
@ -122,9 +122,9 @@ public class CalculatorOperatorsFragment extends AbstractMathEntityListFragment<
this.captionId = captionId;
}
@NotNull
@Nonnull
@Override
public String getCaption(@NotNull Context context) {
public String getCaption(@Nonnull Context context) {
return context.getString(captionId);
}
}

View File

@ -9,8 +9,8 @@ package org.solovyev.android.calculator.math.edit;
import android.content.Intent;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
@ -21,7 +21,7 @@ import org.solovyev.android.calculator.history.CalculatorHistoryActivity;
*/
public class CalculatorVarsActivity extends SherlockFragmentActivity implements CalculatorEventListener {
@NotNull
@Nonnull
private final CalculatorActivityHelper activityHelper = CalculatorApplication.getInstance().createActivityHelper(R.layout.main_empty, CalculatorHistoryActivity.class.getSimpleName());
@Override
@ -94,7 +94,7 @@ public class CalculatorVarsActivity extends SherlockFragmentActivity implements
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) {
case use_constant:
this.finish();

View File

@ -14,8 +14,8 @@ import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import jscl.math.function.IConstant;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
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;
@ -64,9 +64,9 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
return LongClickMenuItem.use;
}
@NotNull
@Nonnull
@Override
protected List<LabeledMenuItem<IConstant>> getMenuItemsOnLongClick(@NotNull IConstant item) {
protected List<LabeledMenuItem<IConstant>> getMenuItemsOnLongClick(@Nonnull IConstant item) {
final List<LabeledMenuItem<IConstant>> result = new ArrayList<LabeledMenuItem<IConstant>>(Arrays.asList(LongClickMenuItem.values()));
if (item.isSystem()) {
@ -85,18 +85,18 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
return result;
}
@NotNull
@Nonnull
@Override
protected MathEntityDescriptionGetter getDescriptionGetter() {
return new MathEntityDescriptionGetterImpl(Locator.getInstance().getEngine().getVarsRegistry());
}
@SuppressWarnings({"UnusedDeclaration"})
public void addVarButtonClickHandler(@NotNull View v) {
public void addVarButtonClickHandler(@Nonnull View v) {
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newInstance(), this.getActivity().getSupportFragmentManager());
}
@NotNull
@Nonnull
@Override
protected List<IConstant> getMathEntities() {
final List<IConstant> result = new ArrayList<IConstant>(Locator.getInstance().getEngine().getVarsRegistry().getEntities());
@ -112,11 +112,11 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
}
@Override
protected String getMathEntityCategory(@NotNull IConstant var) {
protected String getMathEntityCategory(@Nonnull IConstant var) {
return Locator.getInstance().getEngine().getVarsRegistry().getCategory(var);
}
public static boolean isValidValue(@NotNull String value) {
public static boolean isValidValue(@Nonnull String value) {
try {
final PreparedExpression expression = ToJsclTextProcessor.getInstance().process(value);
final List<IConstant> constants = expression.getUndefinedVars();
@ -158,7 +158,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
super.onCalculatorEvent(calculatorEventData, calculatorEventType, data);
switch (calculatorEventType) {
@ -176,7 +176,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
}
}
private void processConstantRemoved(@NotNull final IConstant constant) {
private void processConstantRemoved(@Nonnull final IConstant constant) {
if (this.isInCategory(constant)) {
getUiHandler().post(new Runnable() {
@Override
@ -188,7 +188,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
}
}
private void processConstantChanged(@NotNull final Change<IConstant> change) {
private void processConstantChanged(@Nonnull final Change<IConstant> change) {
final IConstant newConstant = change.getNewValue();
if (this.isInCategory(newConstant)) {
getUiHandler().post(new Runnable() {
@ -202,7 +202,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
}
}
private void processConstantAdded(@NotNull final IConstant constant) {
private void processConstantAdded(@Nonnull final IConstant constant) {
if (this.isInCategory(constant)) {
getUiHandler().post(new Runnable() {
@Override
@ -225,28 +225,28 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
private static enum LongClickMenuItem implements LabeledMenuItem<IConstant> {
use(R.string.c_use) {
@Override
public void onClick(@NotNull IConstant data, @NotNull Context context) {
public void onClick(@Nonnull IConstant data, @Nonnull Context context) {
Locator.getInstance().getCalculator().fireCalculatorEvent(CalculatorEventType.use_constant, data);
}
},
edit(R.string.c_edit) {
@Override
public void onClick(@NotNull IConstant constant, @NotNull Context context) {
public void onClick(@Nonnull IConstant constant, @Nonnull Context context) {
VarEditDialogFragment.showDialog(VarEditDialogFragment.Input.newFromConstant(constant), ((SherlockFragmentActivity) context).getSupportFragmentManager());
}
},
remove(R.string.c_remove) {
@Override
public void onClick(@NotNull IConstant constant, @NotNull Context context) {
public void onClick(@Nonnull IConstant constant, @Nonnull Context context) {
MathEntityRemover.newConstantRemover(constant, null, context, context).showConfirmationDialog();
}
},
copy_value(R.string.c_copy_value) {
@Override
public void onClick(@NotNull IConstant data, @NotNull Context context) {
public void onClick(@Nonnull IConstant data, @Nonnull Context context) {
final String text = data.getValue();
if (!Strings.isEmpty(text)) {
assert text != null;
@ -257,7 +257,7 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
copy_description(R.string.c_copy_description) {
@Override
public void onClick(@NotNull IConstant data, @NotNull Context context) {
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;
@ -271,9 +271,9 @@ public class CalculatorVarsFragment extends AbstractMathEntityListFragment<ICons
this.captionId = captionId;
}
@NotNull
@Nonnull
@Override
public String getCaption(@NotNull Context context) {
public String getCaption(@Nonnull Context context) {
return context.getString(captionId);
}
}

View File

@ -13,8 +13,8 @@ import android.view.View;
import android.widget.TextView;
import jscl.math.function.Function;
import jscl.math.function.IConstant;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorEventType;
import org.solovyev.android.calculator.CalculatorMathRegistry;
import org.solovyev.android.calculator.Locator;
@ -28,7 +28,7 @@ import org.solovyev.common.math.MathEntity;
*/
public class MathEntityRemover<T extends MathEntity> implements View.OnClickListener, DialogInterface.OnClickListener {
@NotNull
@Nonnull
private final T mathEntity;
@Nullable
@ -36,16 +36,16 @@ public class MathEntityRemover<T extends MathEntity> implements View.OnClickList
private final boolean confirmed;
@NotNull
@Nonnull
private final CalculatorMathRegistry<? super T> varsRegistry;
@NotNull
@Nonnull
private Context context;
@NotNull
@Nonnull
private final Object source;
@NotNull
@Nonnull
private final Params params;
/*
@ -56,13 +56,13 @@ public class MathEntityRemover<T extends MathEntity> implements View.OnClickList
**********************************************************************
*/
private MathEntityRemover(@NotNull T mathEntity,
private MathEntityRemover(@Nonnull T mathEntity,
@Nullable DialogInterface.OnClickListener callbackOnCancel,
boolean confirmed,
@NotNull CalculatorMathRegistry<? super T> varsRegistry,
@NotNull Context context,
@NotNull Object source,
@NotNull Params params) {
@Nonnull CalculatorMathRegistry<? super T> varsRegistry,
@Nonnull Context context,
@Nonnull Object source,
@Nonnull Params params) {
this.mathEntity = mathEntity;
this.callbackOnCancel = callbackOnCancel;
this.confirmed = confirmed;
@ -72,17 +72,17 @@ public class MathEntityRemover<T extends MathEntity> implements View.OnClickList
this.params = params;
}
public static MathEntityRemover<IConstant> newConstantRemover(@NotNull IConstant constant,
public static MathEntityRemover<IConstant> newConstantRemover(@Nonnull IConstant constant,
@Nullable DialogInterface.OnClickListener callbackOnCancel,
@NotNull Context context,
@NotNull Object source) {
@Nonnull Context context,
@Nonnull Object source) {
return new MathEntityRemover<IConstant>(constant, callbackOnCancel, false, Locator.getInstance().getEngine().getVarsRegistry(), context, source, Params.newConstantInstance());
}
public static MathEntityRemover<Function> newFunctionRemover(@NotNull Function function,
public static MathEntityRemover<Function> newFunctionRemover(@Nonnull Function function,
@Nullable DialogInterface.OnClickListener callbackOnCancel,
@NotNull Context context,
@NotNull Object source) {
@Nonnull Context context,
@Nonnull Object source) {
return new MathEntityRemover<Function>(function, callbackOnCancel, false, Locator.getInstance().getEngine().getFunctionsRegistry(), context, source, Params.newFunctionInstance());
}

View File

@ -12,8 +12,8 @@ import android.view.WindowManager;
import android.widget.EditText;
import android.widget.Toast;
import jscl.math.function.IConstant;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.model.Var;
import org.solovyev.android.sherlock.AndroidSherlockUtils;
@ -25,14 +25,14 @@ import org.solovyev.android.sherlock.AndroidSherlockUtils;
*/
public class VarEditDialogFragment extends DialogFragment implements CalculatorEventListener {
@NotNull
@Nonnull
private final Input input;
public VarEditDialogFragment() {
this(Input.newInstance());
}
public VarEditDialogFragment(@NotNull Input input) {
public VarEditDialogFragment(@Nonnull Input input) {
this.input = input;
}
@ -56,7 +56,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
}
@Override
public void onViewCreated(@NotNull View root, Bundle savedInstanceState) {
public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) {
super.onViewCreated(root, savedInstanceState);
final String errorMsg = this.getString(R.string.c_char_is_not_accepted);
@ -126,7 +126,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
}
@Override
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable Object data) {
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) {
case constant_removed:
case constant_added:
@ -147,7 +147,7 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
**********************************************************************
*/
public static void showDialog(@NotNull Input input, @NotNull FragmentManager fm) {
public static void showDialog(@Nonnull Input input, @Nonnull FragmentManager fm) {
AndroidSherlockUtils.showDialog(new VarEditDialogFragment(input), "constant-editor", fm);
}
@ -168,26 +168,26 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
private Input() {
}
@NotNull
@Nonnull
public static Input newInstance() {
return new Input();
}
@NotNull
public static Input newFromConstant(@NotNull IConstant constant) {
@Nonnull
public static Input newFromConstant(@Nonnull IConstant constant) {
final Input result = new Input();
result.constant = constant;
return result;
}
@NotNull
@Nonnull
public static Input newFromValue(@Nullable String value) {
final Input result = new Input();
result.value = value;
return result;
}
@NotNull
@Nonnull
public static Input newInstance(@Nullable IConstant constant, @Nullable String name, @Nullable String value, @Nullable String description) {
final Input result = new Input();
result.constant = constant;

View File

@ -12,8 +12,8 @@ import jscl.text.Identifier;
import jscl.text.MutableInt;
import jscl.text.ParseException;
import jscl.text.Parser;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
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;
@ -31,26 +31,26 @@ import org.solovyev.common.text.Strings;
*/
public class VarEditorSaver<T extends MathEntity> implements View.OnClickListener {
@NotNull
@Nonnull
private final MathEntityBuilder<? extends T> varBuilder;
@Nullable
private final T editedInstance;
@NotNull
@Nonnull
private final CalculatorMathRegistry<T> mathRegistry;
@NotNull
@Nonnull
private final Object source;
@NotNull
@Nonnull
private View editView;
public VarEditorSaver(@NotNull MathEntityBuilder<? extends T> varBuilder,
public VarEditorSaver(@Nonnull MathEntityBuilder<? extends T> varBuilder,
@Nullable T editedInstance,
@NotNull View editView,
@NotNull CalculatorMathRegistry<T> mathRegistry,
@NotNull Object source) {
@Nonnull View editView,
@Nonnull CalculatorMathRegistry<T> mathRegistry,
@Nonnull Object source) {
this.varBuilder = varBuilder;
this.editedInstance = editedInstance;
this.editView = editView;

View File

@ -2,8 +2,8 @@ package org.solovyev.android.calculator.matrix;
import android.os.Bundle;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.solovyev.android.calculator.CalculatorFragment;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.R;
@ -86,24 +86,24 @@ public class CalculatorMatrixEditFragment extends CalculatorFragment implements
}
@Override
public void onSaveInstanceState(@NotNull Bundle out) {
public void onSaveInstanceState(@Nonnull Bundle out) {
super.onSaveInstanceState(out);
out.putSerializable(MATRIX, new Matrix(getMatrixView(getView()).toMatrix()));
}
@NotNull
private MatrixView getMatrixView(@NotNull View root) {
@Nonnull
private MatrixView getMatrixView(@Nonnull View root) {
return (MatrixView) root.findViewById(R.id.matrix_layout);
}
private void initPicker(@NotNull Picker<Integer> picker) {
private void initPicker(@Nonnull Picker<Integer> picker) {
picker.setRange(new IntegerRange(MIN_COUNT, MAX_COUNT, 1, 0, null));
picker.setOnChangeListener(this);
}
@Override
public void onChanged(@NotNull Picker picker, @NotNull Integer value) {
public void onChanged(@Nonnull Picker picker, @Nonnull Integer value) {
switch (picker.getId()) {
case R.id.matrix_rows_count_picker:
onRowsCountChange(value);
@ -114,23 +114,23 @@ public class CalculatorMatrixEditFragment extends CalculatorFragment implements
}
}
private void onColsCountChange(@NotNull Integer newCols) {
private void onColsCountChange(@Nonnull Integer newCols) {
getMatrixView(getView()).setMatrixCols(newCols);
}
private void onRowsCountChange(@NotNull Integer newRows) {
private void onRowsCountChange(@Nonnull Integer newRows) {
getMatrixView(getView()).setMatrixRows(newRows);
}
public static class Matrix implements Serializable {
@NotNull
@Nonnull
private String[][] bakingArray;
public Matrix() {
}
public Matrix(@NotNull String[][] bakingArray) {
public Matrix(@Nonnull String[][] bakingArray) {
this.bakingArray = bakingArray;
}
}

View File

@ -8,8 +8,8 @@ import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* User: Solovyev_S
@ -122,7 +122,7 @@ public class MatrixView extends TableLayout {
}
}
public void setMatrix(@NotNull Object[][] matrix) {
public void setMatrix(@Nonnull Object[][] matrix) {
final int rows = matrix.length;
final int cols = matrix[0].length;
@ -134,7 +134,7 @@ public class MatrixView extends TableLayout {
}
}
@NotNull
@Nonnull
public String[][] toMatrix() {
final String[][] result = new String[rows][cols];
@ -223,11 +223,11 @@ public class MatrixView extends TableLayout {
}
@Nullable
private View getCell(@NotNull View view, int row, int col) {
private View getCell(@Nonnull View view, int row, int col) {
return view.findViewWithTag(getCellTag(row, col));
}
@NotNull
@Nonnull
private String getRowTag(int row) {
if (row != NUMBER_INDEX) {
return "row_" + row;
@ -236,7 +236,7 @@ public class MatrixView extends TableLayout {
}
}
@NotNull
@Nonnull
private View createRowView(int row, int cols) {
final ViewGroup rowView = new TableRow(this.getContext());
@ -255,7 +255,7 @@ public class MatrixView extends TableLayout {
return rowView;
}
@NotNull
@Nonnull
private View createCellView(int row, int col) {
final TextView result;
@ -277,7 +277,7 @@ public class MatrixView extends TableLayout {
}
@NotNull
@Nonnull
private String getCellTag(int row, int col) {
if (row != NUMBER_INDEX) {
return "cell_" + row + "_" + col;

Some files were not shown because too many files have changed in this diff Show More