fixes + @NotNull -> @Nonnull
This commit is contained in:
@@ -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);
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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());
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -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());
|
||||
|
@@ -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) {
|
||||
|
@@ -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());
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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());
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
@@ -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()))) {
|
||||
|
@@ -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();
|
||||
|
@@ -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("\">");
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user