fixes + @NotNull -> @Nonnull
This commit is contained in:
@@ -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);
|
||||
|
@@ -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));
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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 {
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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() {
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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());
|
||||
|
@@ -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
|
||||
|
@@ -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() {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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());
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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()));
|
||||
|
@@ -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());
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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) {
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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());
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
@@ -14,8 +15,8 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
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.Android;
|
||||
import org.solovyev.android.Threads;
|
||||
import org.solovyev.android.calculator.*;
|
||||
@@ -64,17 +65,17 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
|
||||
private int bgColor;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private PlotData plotData = new PlotData(Collections.<PlotFunction>emptyList(), false, PlotBoundaries.newDefaultInstance());
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private ActivityMenu<Menu, MenuItem> fragmentMenu;
|
||||
|
||||
// thread which calculated data for graph view
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Executor plotExecutor = Executors.newSingleThreadExecutor();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorEventHolder lastEventHolder = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId());
|
||||
|
||||
|
||||
@@ -133,7 +134,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculatorEvent(@NotNull CalculatorEventData calculatorEventData, @NotNull CalculatorEventType calculatorEventType, @Nullable final Object data) {
|
||||
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable final Object data) {
|
||||
switch (calculatorEventType) {
|
||||
case plot_data_changed:
|
||||
final CalculatorEventHolder.Result result = this.lastEventHolder.apply(calculatorEventData);
|
||||
@@ -145,14 +146,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
|
||||
}
|
||||
|
||||
private void onNewPlotData(@NotNull final PlotData plotData) {
|
||||
private void onNewPlotData(@Nonnull final PlotData plotData) {
|
||||
this.plotData = plotData;
|
||||
|
||||
final SherlockFragmentActivity activity = getSherlockActivity();
|
||||
updateChart(plotData, activity);
|
||||
}
|
||||
|
||||
private void updateChart(@NotNull final PlotData plotData, @Nullable final SherlockFragmentActivity activity) {
|
||||
private void updateChart(@Nonnull final PlotData plotData, @Nullable final SherlockFragmentActivity activity) {
|
||||
Threads.tryRunOnUiThread(activity, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -170,9 +171,9 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
|
||||
protected abstract void onError();
|
||||
|
||||
protected abstract void createGraphicalView(@NotNull View view, @NotNull PlotData plotData);
|
||||
protected abstract void createGraphicalView(@Nonnull View view, @Nonnull PlotData plotData);
|
||||
|
||||
protected abstract void createChart(@NotNull PlotData plotData);
|
||||
protected abstract void createChart(@Nonnull PlotData plotData);
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
@@ -186,7 +187,7 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
return bgColor;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public Executor getPlotExecutor() {
|
||||
return plotExecutor;
|
||||
}
|
||||
@@ -208,14 +209,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
menuItems.add(PlotMenu.functions);
|
||||
|
||||
final IdentifiableMenuItem<MenuItem> plotRangeMenuItem = new IdentifiableMenuItem<MenuItem>() {
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public Integer getItemId() {
|
||||
return R.id.menu_plot_range;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
savePlotBoundaries();
|
||||
|
||||
context.startActivity(new Intent(context, CalculatorPlotRangeActivity.class));
|
||||
@@ -224,14 +225,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
menuItems.add(plotRangeMenuItem);
|
||||
|
||||
final IdentifiableMenuItem<MenuItem> plot3dMenuItem = new IdentifiableMenuItem<MenuItem>() {
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public Integer getItemId() {
|
||||
return R.id.menu_plot_3d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
savePlotBoundaries();
|
||||
|
||||
Locator.getInstance().getPlotter().setPlot3d(true);
|
||||
@@ -241,14 +242,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
|
||||
|
||||
final IdentifiableMenuItem<MenuItem> plot2dMenuItem = new IdentifiableMenuItem<MenuItem>() {
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public Integer getItemId() {
|
||||
return R.id.menu_plot_2d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
savePlotBoundaries();
|
||||
|
||||
Locator.getInstance().getPlotter().setPlot3d(false);
|
||||
@@ -257,14 +258,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
menuItems.add(plot2dMenuItem);
|
||||
|
||||
final IdentifiableMenuItem<MenuItem> captureScreenshotMenuItem = new IdentifiableMenuItem<MenuItem>() {
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public Integer getItemId() {
|
||||
return R.id.menu_plot_schreeshot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
captureScreehshot();
|
||||
}
|
||||
};
|
||||
@@ -299,14 +300,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
|
||||
protected abstract boolean isScreenshotSupported();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
protected abstract Bitmap getScreehshot();
|
||||
|
||||
private void captureScreehshot() {
|
||||
if (isScreenshotSupported()) {
|
||||
final Bitmap screenshot = getScreehshot();
|
||||
final String screenShotFileName = generateScreenshotFileName();
|
||||
final File externalFilesDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
|
||||
final File externalFilesDir = getActivity().getExternalFilesDir(getPicturesDirectory());
|
||||
if (externalFilesDir != null) {
|
||||
final String path = externalFilesDir.getPath();
|
||||
Android.saveBitmap(screenshot, path, screenShotFileName);
|
||||
@@ -317,6 +318,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
}
|
||||
}
|
||||
|
||||
private String getPicturesDirectory() {
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) {
|
||||
return Environment.DIRECTORY_PICTURES;
|
||||
} else {
|
||||
return "Pictures";
|
||||
}
|
||||
}
|
||||
|
||||
private String generateScreenshotFileName() {
|
||||
final Date now = new Date();
|
||||
final String timestamp = new SimpleDateFormat("yyyy.MM.dd HH.mm.ss.S").format(now);
|
||||
@@ -353,14 +362,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
|
||||
functions(R.id.menu_plot_functions) {
|
||||
@Override
|
||||
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
context.startActivity(new Intent(context, CalculatorPlotFunctionsActivity.class));
|
||||
}
|
||||
},
|
||||
|
||||
preferences(R.id.menu_plot_settings) {
|
||||
@Override
|
||||
public void onClick(@NotNull MenuItem data, @NotNull Context context) {
|
||||
public void onClick(@Nonnull MenuItem data, @Nonnull Context context) {
|
||||
context.startActivity(new Intent(context, CalculatorPlotPreferenceActivity.class));
|
||||
}
|
||||
};
|
||||
@@ -372,14 +381,14 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public Integer getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
}
|
||||
|
||||
public static void applyToPaint(@NotNull PlotLineDef plotLineDef, @NotNull Paint paint) {
|
||||
public static void applyToPaint(@Nonnull PlotLineDef plotLineDef, @Nonnull Paint paint) {
|
||||
paint.setColor(plotLineDef.getLineColor());
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -9,22 +9,22 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public abstract class AbstractGraphCalculator implements GraphCalculator {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
protected final GraphData next = GraphData.newEmptyInstance();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final GraphData endGraph = GraphData.newEmptyInstance();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final GraphData startGraph = GraphData.newEmptyInstance();
|
||||
|
||||
@Override
|
||||
public final void computeGraph(@NotNull XyFunction f,
|
||||
public final void computeGraph(@Nonnull XyFunction f,
|
||||
float xMin,
|
||||
float xMax,
|
||||
@NotNull GraphData graph,
|
||||
@NotNull GraphsData graphsData,
|
||||
@NotNull Graph2dDimensions dimensions) {
|
||||
@Nonnull GraphData graph,
|
||||
@Nonnull GraphsData graphsData,
|
||||
@Nonnull Graph2dDimensions dimensions) {
|
||||
if (f.getArity() == 0) {
|
||||
final float v = (float) f.eval();
|
||||
graph.clear();
|
||||
@@ -96,11 +96,11 @@ public abstract class AbstractGraphCalculator implements GraphCalculator {
|
||||
startGraph.clear();
|
||||
}
|
||||
|
||||
protected abstract void compute(@NotNull XyFunction f,
|
||||
protected abstract void compute(@Nonnull XyFunction f,
|
||||
float xMin,
|
||||
float xMax,
|
||||
float yMin,
|
||||
float yMax,
|
||||
@NotNull GraphData graph,
|
||||
@NotNull Graph2dDimensions dimensions);
|
||||
@Nonnull GraphData graph,
|
||||
@Nonnull Graph2dDimensions dimensions);
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Scroller;
|
||||
import android.widget.ZoomButtonsController;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.solovyev.common.math.Point2d;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -46,41 +46,41 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Matrix matrix = new Matrix();
|
||||
|
||||
// paints
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Paint paint = new Paint();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Paint textPaint = new Paint();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private GraphViewHelper graphViewHelper = GraphViewHelper.newDefaultInstance();
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final GraphsData graphsData = new GraphsData(this);
|
||||
|
||||
private float lastTouchXPxs = NO_TOUCH;
|
||||
private float lastTouchYPxs = NO_TOUCH;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private TouchHandler touchHandler;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
protected ZoomButtonsController zoomController = new ZoomButtonsController(this);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private ZoomTracker zoomTracker = new ZoomTracker();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private Scroller scroller;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Graph2dDimensions dimensions = new Graph2dDimensions(this);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final GraphCalculator graphCalculator = new GraphCalculatorImpl();
|
||||
|
||||
private boolean mDrawn = false;
|
||||
@@ -115,7 +115,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@NotNull PlotViewDef plotViewDef) {
|
||||
public void init(@Nonnull PlotViewDef plotViewDef) {
|
||||
this.graphViewHelper = GraphViewHelper.newInstance(plotViewDef, Collections.<PlotFunction>emptyList());
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
public void setPlotFunctions(@NotNull List<PlotFunction> plotFunctions) {
|
||||
public void setPlotFunctions(@Nonnull List<PlotFunction> plotFunctions) {
|
||||
|
||||
for (PlotFunction plotFunction : plotFunctions) {
|
||||
final int arity = plotFunction.getXyFunction().getArity();
|
||||
@@ -140,7 +140,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
invalidateGraphs();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<PlotFunction> getPlotFunctions() {
|
||||
return this.graphViewHelper.getPlotFunctions();
|
||||
@@ -151,7 +151,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
onPause();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public Bitmap captureScreenshot() {
|
||||
final Bitmap result = Bitmap.createBitmap(dimensions.getVWidthPxs(), dimensions.getVHeightPxs(), Bitmap.Config.RGB_565);
|
||||
onDraw(new Canvas(result));
|
||||
@@ -183,7 +183,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
dimensions.setViewDimensions(w, h);
|
||||
}
|
||||
|
||||
protected void onDraw(@NotNull Canvas canvas) {
|
||||
protected void onDraw(@Nonnull Canvas canvas) {
|
||||
if (!graphViewHelper.getPlotFunctions().isEmpty()) {
|
||||
|
||||
if (scroller.computeScrollOffset()) {
|
||||
@@ -199,7 +199,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
}
|
||||
}
|
||||
|
||||
private static void graphToPath(@NotNull GraphData graph, @NotNull Path path) {
|
||||
private static void graphToPath(@Nonnull GraphData graph, @Nonnull Path path) {
|
||||
|
||||
final int size = graph.getSize();
|
||||
final float[] xs = graph.getXs();
|
||||
@@ -227,7 +227,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
}
|
||||
}
|
||||
|
||||
private void drawGraph(@NotNull Canvas canvas) {
|
||||
private void drawGraph(@Nonnull Canvas canvas) {
|
||||
mDrawn = true;
|
||||
|
||||
final float graphWidth = dimensions.getGWidth();
|
||||
@@ -300,8 +300,8 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
graphsData.setLastXMax(xMax);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TickDigits drawGridAndAxis(@NotNull Canvas canvas) {
|
||||
@Nonnull
|
||||
private TickDigits drawGridAndAxis(@Nonnull Canvas canvas) {
|
||||
final TickDigits result = new TickDigits();
|
||||
|
||||
final float xMin = dimensions.getXMin();
|
||||
@@ -412,7 +412,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public static CharSequence formatTick(final float tickValue, final int tickDigits) {
|
||||
String result = "0";
|
||||
|
||||
@@ -545,7 +545,7 @@ public class CalculatorGraph2dView extends View implements GraphView {
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(@NotNull MotionEvent event) {
|
||||
public boolean onTouchEvent(@Nonnull MotionEvent event) {
|
||||
boolean handled = touchHandler.handleTouchEvent(event);
|
||||
if (!handled) {
|
||||
handled = super.onTouchEvent(event);
|
||||
|
@@ -7,7 +7,7 @@ import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.ZoomButtonsController;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
import javax.microedition.khronos.opengles.GL11;
|
||||
@@ -44,13 +44,13 @@ public class CalculatorGraph3dView extends GLView implements GraphView {
|
||||
private float zoomStep = 0;
|
||||
private float currentZoom;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private List<Graph3d> graphs = new ArrayList<Graph3d>();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private GraphViewHelper graphViewHelper = GraphViewHelper.newDefaultInstance();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private Graph2dDimensions dimensions = new Graph2dDimensions(this);
|
||||
|
||||
/*
|
||||
@@ -136,12 +136,12 @@ public class CalculatorGraph3dView extends GLView implements GraphView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@NotNull PlotViewDef plotViewDef) {
|
||||
public void init(@Nonnull PlotViewDef plotViewDef) {
|
||||
this.graphViewHelper = GraphViewHelper.newInstance(plotViewDef, Collections.<PlotFunction>emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPlotFunctions(@NotNull List<PlotFunction> plotFunctions) {
|
||||
public void setPlotFunctions(@Nonnull List<PlotFunction> plotFunctions) {
|
||||
for (PlotFunction plotFunction : plotFunctions) {
|
||||
final int arity = plotFunction.getXyFunction().getArity();
|
||||
if (arity != 0 && arity != 1 && arity != 2) {
|
||||
@@ -154,7 +154,7 @@ public class CalculatorGraph3dView extends GLView implements GraphView {
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<PlotFunction> getPlotFunctions() {
|
||||
return this.graphViewHelper.getPlotFunctions();
|
||||
@@ -278,7 +278,7 @@ public class CalculatorGraph3dView extends GLView implements GraphView {
|
||||
|
||||
}
|
||||
|
||||
private void ensureGraphsSize(@NotNull GL11 gl) {
|
||||
private void ensureGraphsSize(@Nonnull GL11 gl) {
|
||||
while (graphViewHelper.getPlotFunctions().size() > graphs.size()) {
|
||||
graphs.add(new Graph3d(gl, useHighQuality3d));
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@ package org.solovyev.android.calculator.plot;
|
||||
import android.app.ActionBar;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentActivity;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.R;
|
||||
@@ -33,7 +33,7 @@ public class CalculatorPlotActivity extends CalculatorFragmentActivity {
|
||||
getActivityHelper().setFragment(this, getPlotterFragmentType(), arguments, R.id.main_layout);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public static CalculatorFragmentType getPlotterFragmentType() {
|
||||
return CalculatorFragmentType.plotter;
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
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;
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createGraphicalView(@NotNull View root, @NotNull PlotData plotData) {
|
||||
protected void createGraphicalView(@Nonnull View root, @Nonnull PlotData plotData) {
|
||||
|
||||
// remove old
|
||||
final ViewGroup graphContainer = (ViewGroup) root.findViewById(R.id.main_fragment_layout);
|
||||
@@ -59,7 +59,7 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createChart(@NotNull PlotData plotData) {
|
||||
protected void createChart(@Nonnull PlotData plotData) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +67,7 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
protected Bitmap getScreehshot() {
|
||||
assert this.graphView != null;
|
||||
|
@@ -11,8 +11,8 @@ import android.widget.Button;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.Spinner;
|
||||
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.CalculatorFragment;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
@@ -23,7 +23,7 @@ public class CalculatorPlotFunctionSettingsActivity extends SherlockFragmentActi
|
||||
|
||||
private static final String INPUT_FUNCTION_ID = "plot-function-id";
|
||||
|
||||
public static void startActivity(@NotNull Context context, @NotNull PlotFunction plotFunction) {
|
||||
public static void startActivity(@Nonnull Context context, @Nonnull PlotFunction plotFunction) {
|
||||
final Intent intent = new Intent(context, CalculatorPlotFunctionSettingsActivity.class);
|
||||
intent.putExtra(INPUT_FUNCTION_ID, plotFunction.getXyFunction().getId());
|
||||
context.startActivity(intent);
|
||||
@@ -65,7 +65,7 @@ public class CalculatorPlotFunctionSettingsActivity extends SherlockFragmentActi
|
||||
@Nullable
|
||||
private PlotFunction plotFunction;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
|
||||
|
||||
public CalculatorPlotFunctionSettingsFragment() {
|
||||
|
@@ -4,7 +4,7 @@ import android.os.Bundle;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.CalculatorListFragment;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
|
@@ -4,8 +4,8 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
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.CalculatorFragment;
|
||||
import org.solovyev.android.calculator.CalculatorFragmentType;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
@@ -36,7 +36,7 @@ public class CalculatorPlotRangeActivity extends SherlockFragmentActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NotNull View root, Bundle savedInstanceState) {
|
||||
public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) {
|
||||
super.onViewCreated(root, savedInstanceState);
|
||||
|
||||
final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
|
||||
|
@@ -10,7 +10,7 @@ import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import javax.microedition.khronos.egl.*;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
@@ -35,11 +35,15 @@ abstract class GLView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
|
||||
abstract void onSurfaceCreated(GL10 gl, int width, int height);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public Bitmap captureScreenshot() {
|
||||
final Bitmap result = getRawPixels(gl, width, height);
|
||||
bitmapBGRtoRGB(result, width, height);
|
||||
return result;
|
||||
if (gl != null) {
|
||||
final Bitmap result = getRawPixels(gl, width, height);
|
||||
bitmapBGRtoRGB(result, width, height);
|
||||
return result;
|
||||
} else {
|
||||
return Bitmap.createBitmap(width == 0 ? 1 : width, height == 0 ? 1 : height, Bitmap.Config.RGB_565);
|
||||
}
|
||||
}
|
||||
|
||||
private static Bitmap getRawPixels(GL10 gl, int width, int height) {
|
||||
@@ -55,7 +59,7 @@ abstract class GLView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final Handler uiHandler = new Handler() {
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import android.view.View;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.solovyev.common.math.Point2d;
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ public class Graph2dDimensions {
|
||||
* */
|
||||
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private GraphView graphView;
|
||||
|
||||
// view width and height in pixels
|
||||
@@ -55,7 +55,7 @@ public class Graph2dDimensions {
|
||||
private float gWidth = 20;
|
||||
private float gHeight = 20;
|
||||
|
||||
public Graph2dDimensions(@NotNull GraphView graphView) {
|
||||
public Graph2dDimensions(@Nonnull GraphView graphView) {
|
||||
this.graphView = graphView;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class Graph2dDimensions {
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
Point2d toGraphCoordinates(float xPxs, float yPxs) {
|
||||
return new Point2d(scaleXPxs(xPxs) + getXMin(), (getGHeight() - scaleYPxs(yPxs)) + getYMin());
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class Graph2dDimensions {
|
||||
this.graphView.invalidateGraphs();
|
||||
}
|
||||
|
||||
public void setViewDimensions(@NotNull View view) {
|
||||
public void setViewDimensions(@Nonnull View view) {
|
||||
this.vWidthPxs = view.getWidth();
|
||||
this.vHeightPxs = view.getHeight();
|
||||
|
||||
@@ -225,7 +225,7 @@ public class Graph2dDimensions {
|
||||
this.y0 += dy;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public Graph2dDimensions copy() {
|
||||
final Graph2dDimensions copy = new Graph2dDimensions(this.graphView);
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import android.graphics.Color;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
import javax.microedition.khronos.opengles.GL11;
|
||||
@@ -91,7 +91,7 @@ class Graph3d {
|
||||
return bb;
|
||||
}
|
||||
|
||||
public void update(@NotNull GL11 gl, @NotNull PlotFunction fpd, @NotNull Graph2dDimensions dimensions) {
|
||||
public void update(@Nonnull GL11 gl, @Nonnull PlotFunction fpd, @Nonnull Graph2dDimensions dimensions) {
|
||||
final XyFunction function = fpd.getXyFunction();
|
||||
final PlotLineDef lineDef = fpd.getPlotLineDef();
|
||||
final int NTICK = useHighQuality3d ? 5 : 0;
|
||||
@@ -227,7 +227,7 @@ class Graph3d {
|
||||
}
|
||||
}
|
||||
|
||||
private float fillFunctionPolygonVertices(XyFunction function, @NotNull Graph2dDimensions dimensions, float[] vertices) {
|
||||
private float fillFunctionPolygonVertices(XyFunction function, @Nonnull Graph2dDimensions dimensions, float[] vertices) {
|
||||
final int arity = function.getArity();
|
||||
|
||||
final float xMin = dimensions.getXMin();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -9,10 +9,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public interface GraphCalculator {
|
||||
|
||||
void computeGraph(@NotNull XyFunction f,
|
||||
void computeGraph(@Nonnull XyFunction f,
|
||||
float xMin,
|
||||
float xMax,
|
||||
@NotNull GraphData graph,
|
||||
@NotNull GraphsData graphsData,
|
||||
@NotNull Graph2dDimensions dimensions);
|
||||
@Nonnull GraphData graph,
|
||||
@Nonnull GraphsData graphsData,
|
||||
@Nonnull Graph2dDimensions dimensions);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -10,13 +10,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class GraphCalculatorImpl extends AbstractGraphCalculator {
|
||||
|
||||
@Override
|
||||
protected void compute(@NotNull XyFunction f,
|
||||
protected void compute(@Nonnull XyFunction f,
|
||||
float xMin,
|
||||
float xMax,
|
||||
float yMin,
|
||||
float yMax,
|
||||
@NotNull GraphData graph,
|
||||
@NotNull Graph2dDimensions dimensions) {
|
||||
@Nonnull GraphData graph,
|
||||
@Nonnull Graph2dDimensions dimensions) {
|
||||
graph.push(xMin, (float) f.eval(xMin));
|
||||
|
||||
final float xScale = dimensions.getXGraphToViewScale();
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
class GraphData {
|
||||
|
||||
@@ -13,12 +13,12 @@ class GraphData {
|
||||
private GraphData() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
static GraphData newEmptyInstance() {
|
||||
return new GraphData();
|
||||
}
|
||||
|
||||
void swap(@NotNull GraphData that) {
|
||||
void swap(@Nonnull GraphData that) {
|
||||
float savedXs[] = that.xs;
|
||||
float savedYs[] = that.ys;
|
||||
int savedSize = that.size;
|
||||
|
@@ -2,17 +2,17 @@ package org.solovyev.android.calculator.plot;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.widget.ZoomButtonsController;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GraphView extends ZoomButtonsController.OnZoomListener, TouchHandler.TouchHandlerListener {
|
||||
|
||||
public void init(@NotNull PlotViewDef plotViewDef);
|
||||
public void init(@Nonnull PlotViewDef plotViewDef);
|
||||
|
||||
public void setPlotFunctions(@NotNull List<PlotFunction> plotFunctions);
|
||||
public void setPlotFunctions(@Nonnull List<PlotFunction> plotFunctions);
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public List<PlotFunction> getPlotFunctions();
|
||||
|
||||
public void onDestroy();
|
||||
@@ -21,7 +21,7 @@ public interface GraphView extends ZoomButtonsController.OnZoomListener, TouchHa
|
||||
|
||||
public void onResume();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public Bitmap captureScreenshot();
|
||||
|
||||
void setXRange(float xMin, float xMax);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -12,23 +12,23 @@ import java.util.List;
|
||||
*/
|
||||
public class GraphViewHelper {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private PlotViewDef plotViewDef = PlotViewDef.newDefaultInstance();
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private List<PlotFunction> plotFunctions = Collections.emptyList();
|
||||
|
||||
private GraphViewHelper() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public static GraphViewHelper newDefaultInstance() {
|
||||
return new GraphViewHelper();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static GraphViewHelper newInstance(@NotNull PlotViewDef plotViewDef,
|
||||
@NotNull List<PlotFunction> plotFunctions) {
|
||||
@Nonnull
|
||||
public static GraphViewHelper newInstance(@Nonnull PlotViewDef plotViewDef,
|
||||
@Nonnull List<PlotFunction> plotFunctions) {
|
||||
final GraphViewHelper result = new GraphViewHelper();
|
||||
|
||||
result.plotViewDef = plotViewDef;
|
||||
@@ -37,8 +37,8 @@ public class GraphViewHelper {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GraphViewHelper copy(@NotNull List<PlotFunction> plotFunctions) {
|
||||
@Nonnull
|
||||
public GraphViewHelper copy(@Nonnull List<PlotFunction> plotFunctions) {
|
||||
final GraphViewHelper result = new GraphViewHelper();
|
||||
|
||||
result.plotViewDef = plotViewDef;
|
||||
@@ -47,12 +47,12 @@ public class GraphViewHelper {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public List<PlotFunction> getPlotFunctions() {
|
||||
return plotFunctions;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public PlotViewDef getPlotViewDef() {
|
||||
return plotViewDef;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -12,10 +12,10 @@ import java.util.List;
|
||||
*/
|
||||
public class GraphsData {
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final GraphView graphView;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private List<GraphData> graphs;
|
||||
|
||||
private float lastXMin;
|
||||
@@ -25,7 +25,7 @@ public class GraphsData {
|
||||
|
||||
private float lastYMax;
|
||||
|
||||
public GraphsData(@NotNull GraphView graphView) {
|
||||
public GraphsData(@Nonnull GraphView graphView) {
|
||||
this.graphView = graphView;
|
||||
graphs = new ArrayList<GraphData>(graphView.getPlotFunctions().size());
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class GraphsData {
|
||||
lastYMax = 0;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public List<GraphData> getGraphs() {
|
||||
return graphs;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class GraphsData {
|
||||
this.lastXMax = lastXMax;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public GraphData get(int i) {
|
||||
return this.graphs.get(i);
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
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.Locator;
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.list.ListItem;
|
||||
@@ -18,16 +18,16 @@ public class PlotFunctionListItem implements ListItem {
|
||||
|
||||
private static final String PREFIX = "plot_function_";
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private PlotFunction plotFunction;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private ViewBuilder<View> viewBuilder;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private String tag;
|
||||
|
||||
public PlotFunctionListItem(@NotNull PlotFunction plotFunction) {
|
||||
public PlotFunctionListItem(@Nonnull PlotFunction plotFunction) {
|
||||
this.plotFunction = plotFunction;
|
||||
this.viewBuilder = ViewFromLayoutBuilder.newInstance(R.layout.cpp_plot_function_list_item);
|
||||
this.tag = PREFIX + plotFunction.getXyFunction().getExpressionString();
|
||||
@@ -45,9 +45,9 @@ public class PlotFunctionListItem implements ListItem {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public View updateView(@NotNull Context context, @NotNull View view) {
|
||||
public View updateView(@Nonnull Context context, @Nonnull View view) {
|
||||
final Object viewTag = view.getTag();
|
||||
if (viewTag instanceof String) {
|
||||
if (this.tag.equals(viewTag)) {
|
||||
@@ -63,19 +63,19 @@ public class PlotFunctionListItem implements ListItem {
|
||||
return build(context);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
@Override
|
||||
public View build(@NotNull Context context) {
|
||||
public View build(@Nonnull Context context) {
|
||||
final View root = buildView(context);
|
||||
fillView(root, context);
|
||||
return root;
|
||||
}
|
||||
|
||||
private View buildView(@NotNull Context context) {
|
||||
private View buildView(@Nonnull Context context) {
|
||||
return viewBuilder.build(context);
|
||||
}
|
||||
|
||||
private void fillView(@NotNull View root, @NotNull final Context context) {
|
||||
private void fillView(@Nonnull View root, @Nonnull final Context context) {
|
||||
root.setTag(tag);
|
||||
|
||||
final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
import android.graphics.Color;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
@@ -48,12 +48,12 @@ public class PlotViewDef {
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public static PlotViewDef newDefaultInstance() {
|
||||
return new PlotViewDef();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
public static PlotViewDef newInstance(int axisColor, int axisLabelColor, int gridColor, int backgroundColor) {
|
||||
return new PlotViewDef(axisColor, axisLabelColor, gridColor, backgroundColor);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ package org.solovyev.android.calculator.plot;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.solovyev.android.Views;
|
||||
|
||||
class TouchHandler {
|
||||
@@ -21,19 +21,19 @@ class TouchHandler {
|
||||
void onTouchZoomMove(float x1, float y1, float x2, float y2);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final VelocityTracker velocityTracker = VelocityTracker.obtain();
|
||||
|
||||
private boolean afterZoom;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private TouchHandlerListener listener;
|
||||
|
||||
TouchHandler(@NotNull TouchHandlerListener listener) {
|
||||
TouchHandler(@Nonnull TouchHandlerListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public boolean handleTouchEvent(@NotNull MotionEvent event) {
|
||||
public boolean handleTouchEvent(@Nonnull MotionEvent event) {
|
||||
// Calculator.log("touch " + event + ' ' + event.getPointerCount() + event.getPointerId(0));
|
||||
|
||||
final int fullAction = event.getAction();
|
||||
|
@@ -20,7 +20,7 @@ import net.robotmedia.billing.IBillingObserver;
|
||||
import net.robotmedia.billing.ResponseCode;
|
||||
import net.robotmedia.billing.helper.AbstractBillingObserver;
|
||||
import net.robotmedia.billing.model.Transaction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.solovyev.android.Activities;
|
||||
import org.solovyev.android.App;
|
||||
import org.solovyev.android.ads.AdsController;
|
||||
@@ -82,7 +82,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeBillingInformation(@NotNull Context context, @NotNull SharedPreferences preferences) {
|
||||
public static void removeBillingInformation(@Nonnull Context context, @Nonnull SharedPreferences preferences) {
|
||||
final SharedPreferences.Editor editor = preferences.edit();
|
||||
editor.putBoolean(AbstractBillingObserver.KEY_TRANSACTIONS_RESTORED, false);
|
||||
editor.commit();
|
||||
@@ -138,17 +138,17 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchaseIntentOK(@NotNull String productId, @NotNull PendingIntent purchaseIntent) {
|
||||
public void onPurchaseIntentOK(@Nonnull String productId, @Nonnull PendingIntent purchaseIntent) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchaseIntentFailure(@NotNull String productId, @NotNull ResponseCode responseCode) {
|
||||
public void onPurchaseIntentFailure(@Nonnull String productId, @Nonnull ResponseCode responseCode) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPurchaseStateChanged(@NotNull String itemId, @NotNull Transaction.PurchaseState state) {
|
||||
public void onPurchaseStateChanged(@Nonnull String itemId, @Nonnull Transaction.PurchaseState state) {
|
||||
if (CalculatorApplication.AD_FREE_PRODUCT_ID.equals(itemId)) {
|
||||
final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY);
|
||||
if (adFreePreference != null) {
|
||||
@@ -171,7 +171,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPurchaseResponse(@NotNull String itemId, @NotNull ResponseCode response) {
|
||||
public void onRequestPurchaseResponse(@Nonnull String itemId, @Nonnull ResponseCode response) {
|
||||
final Preference adFreePreference = findPreference(CalculatorApplication.AD_FREE_P_KEY);
|
||||
if (adFreePreference != null) {
|
||||
if (response == ResponseCode.RESULT_OK) {
|
||||
@@ -189,7 +189,7 @@ public class CalculatorPreferencesActivity extends SherlockPreferenceActivity im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onErrorRestoreTransactions(@NotNull ResponseCode responseCode) {
|
||||
public void onErrorRestoreTransactions(@Nonnull ResponseCode responseCode) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
@@ -10,8 +10,8 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import com.actionbarsherlock.app.SherlockFragmentActivity;
|
||||
import net.robotmedia.billing.BillingController;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.solovyev.android.ads.AdsController;
|
||||
import org.solovyev.android.calculator.CalculatorApplication;
|
||||
import org.solovyev.android.calculator.CalculatorFragment;
|
||||
@@ -42,7 +42,7 @@ public class CalculatorPurchaseDialogActivity extends SherlockFragmentActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NotNull View root, Bundle savedInstanceState) {
|
||||
public void onViewCreated(@Nonnull View root, Bundle savedInstanceState) {
|
||||
super.onViewCreated(root, savedInstanceState);
|
||||
|
||||
((TextView) root.findViewById(R.id.cpp_purchase_text)).setMovementMethod(ScrollingMovementMethod.getInstance());
|
||||
|
@@ -10,8 +10,8 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.AttributeSet;
|
||||
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.Locator;
|
||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CalculatorAdditionalTitle extends TextView implements SharedPrefere
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
public void init(@NotNull SharedPreferences preferences) {
|
||||
public void init(@Nonnull SharedPreferences preferences) {
|
||||
onSharedPreferenceChanged(preferences, null);
|
||||
}
|
||||
|
||||
|
@@ -2,8 +2,8 @@ package org.solovyev.android.calculator.view;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Vibrator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.solovyev.android.view.VibratorContainer;
|
||||
import org.solovyev.android.view.drag.DragButton;
|
||||
import org.solovyev.android.view.drag.OnDragListener;
|
||||
@@ -18,18 +18,18 @@ public class OnDragListenerVibrator extends OnDragListenerWrapper {
|
||||
|
||||
private static final float VIBRATION_TIME_SCALE = 0.5f;
|
||||
|
||||
@NotNull
|
||||
@Nonnull
|
||||
private final VibratorContainer vibrator;
|
||||
|
||||
public OnDragListenerVibrator(@NotNull OnDragListener onDragListener,
|
||||
public OnDragListenerVibrator(@Nonnull OnDragListener onDragListener,
|
||||
@Nullable Vibrator vibrator,
|
||||
@NotNull SharedPreferences preferences) {
|
||||
@Nonnull SharedPreferences preferences) {
|
||||
super(onDragListener);
|
||||
this.vibrator = new VibratorContainer(vibrator, preferences, VIBRATION_TIME_SCALE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDrag(@NotNull DragButton dragButton, @NotNull org.solovyev.android.view.drag.DragEvent event) {
|
||||
public boolean onDrag(@Nonnull DragButton dragButton, @Nonnull org.solovyev.android.view.drag.DragEvent event) {
|
||||
boolean result = super.onDrag(dragButton, event);
|
||||
|
||||
if (result) {
|
||||
|
@@ -6,8 +6,8 @@ import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
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.common.collections.Collections;
|
||||
|
||||
import java.util.List;
|
||||
@@ -19,17 +19,17 @@ import java.util.List;
|
||||
*/
|
||||
public class FragmentUtils {
|
||||
|
||||
public static void createFragment(@NotNull FragmentActivity activity,
|
||||
@NotNull Class<? extends Fragment> fragmentClass,
|
||||
public static void createFragment(@Nonnull FragmentActivity activity,
|
||||
@Nonnull Class<? extends Fragment> fragmentClass,
|
||||
int parentViewId,
|
||||
@NotNull String tag) {
|
||||
@Nonnull String tag) {
|
||||
createFragment(activity, fragmentClass, parentViewId, tag, null);
|
||||
}
|
||||
|
||||
public static void createFragment(@NotNull FragmentActivity activity,
|
||||
@NotNull Class<? extends Fragment> fragmentClass,
|
||||
public static void createFragment(@Nonnull FragmentActivity activity,
|
||||
@Nonnull Class<? extends Fragment> fragmentClass,
|
||||
int parentViewId,
|
||||
@NotNull String tag,
|
||||
@Nonnull String tag,
|
||||
@Nullable Bundle args) {
|
||||
final FragmentManager fm = activity.getSupportFragmentManager();
|
||||
|
||||
@@ -50,27 +50,27 @@ public class FragmentUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeFragments(@NotNull SherlockFragmentActivity activity, @NotNull String... fragmentTags) {
|
||||
public static void removeFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull String... fragmentTags) {
|
||||
removeFragments(activity, Collections.asList(fragmentTags));
|
||||
}
|
||||
|
||||
public static void removeFragments(@NotNull SherlockFragmentActivity activity, @NotNull List<String> fragmentTags) {
|
||||
public static void removeFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull List<String> fragmentTags) {
|
||||
for (String fragmentTag : fragmentTags) {
|
||||
removeFragment(activity, fragmentTag);
|
||||
}
|
||||
}
|
||||
|
||||
public static void detachFragments(@NotNull SherlockFragmentActivity activity, @NotNull String... fragmentTags) {
|
||||
public static void detachFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull String... fragmentTags) {
|
||||
detachFragments(activity, Collections.asList(fragmentTags));
|
||||
}
|
||||
|
||||
public static void detachFragments(@NotNull SherlockFragmentActivity activity, @NotNull List<String> fragmentTags) {
|
||||
public static void detachFragments(@Nonnull SherlockFragmentActivity activity, @Nonnull List<String> fragmentTags) {
|
||||
for (String fragmentTag : fragmentTags) {
|
||||
detachFragment(activity, fragmentTag);
|
||||
}
|
||||
}
|
||||
|
||||
public static void detachFragment(@NotNull SherlockFragmentActivity activity, @NotNull String fragmentTag) {
|
||||
public static void detachFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull String fragmentTag) {
|
||||
final Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
||||
if (fragment != null) {
|
||||
if (!fragment.isDetached()) {
|
||||
@@ -81,7 +81,7 @@ public class FragmentUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeFragment(@NotNull SherlockFragmentActivity activity, @NotNull String fragmentTag) {
|
||||
public static void removeFragment(@Nonnull SherlockFragmentActivity activity, @Nonnull String fragmentTag) {
|
||||
final Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(fragmentTag);
|
||||
if (fragment != null) {
|
||||
if (fragment.isAdded()) {
|
||||
|
Reference in New Issue
Block a user