code cleanup
This commit is contained in:
parent
59a2c7dbc7
commit
2b5e51c857
45 changed files with 99 additions and 140 deletions
|
@ -6,5 +6,4 @@ import dagger.Module
|
|||
includes = [
|
||||
]
|
||||
)
|
||||
open class SharedModule {
|
||||
}
|
||||
open class SharedModule
|
|
@ -97,9 +97,7 @@ public class GraphView extends View {
|
|||
lastDown = 0;
|
||||
}
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
if (System.currentTimeMillis() - lastDown < 400) {
|
||||
return true;
|
||||
}
|
||||
return System.currentTimeMillis() - lastDown < 400;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public interface LabelFormatter {
|
|||
* false if it is a value for the y axis
|
||||
* @return the formatted number as string
|
||||
*/
|
||||
public String formatLabel(double value, boolean isValueX);
|
||||
String formatLabel(double value, boolean isValueX);
|
||||
|
||||
/**
|
||||
* will be called in order to have a
|
||||
|
@ -50,5 +50,5 @@ public interface LabelFormatter {
|
|||
*
|
||||
* @param viewport the used viewport
|
||||
*/
|
||||
public void setViewport(Viewport viewport);
|
||||
void setViewport(Viewport viewport);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class LegendRenderer {
|
|||
/**
|
||||
* wrapped styles
|
||||
*/
|
||||
private Styles mStyles;
|
||||
private final Styles mStyles;
|
||||
|
||||
/**
|
||||
* reference to the graphview
|
||||
|
@ -94,7 +94,7 @@ public class LegendRenderer {
|
|||
/**
|
||||
* paint for the drawing
|
||||
*/
|
||||
private Paint mPaint;
|
||||
private final Paint mPaint;
|
||||
|
||||
/**
|
||||
* cached legend width
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SecondScale {
|
|||
* For the current version this is always
|
||||
* true.
|
||||
*/
|
||||
private boolean mYAxisBoundsManual = true;
|
||||
private final boolean mYAxisBoundsManual = true;
|
||||
|
||||
/**
|
||||
* min y value for the y axis bounds
|
||||
|
|
|
@ -37,5 +37,5 @@ public interface ValueDependentColor<T extends DataPointInterface> {
|
|||
* @return the color that the bar should be drawn with
|
||||
* Generate the int via the android.graphics.Color class.
|
||||
*/
|
||||
public int get(T data);
|
||||
int get(T data);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BarGraphSeries<E extends DataPointInterface> extends BaseSeries<E>
|
|||
/**
|
||||
* paint to do drawing on canvas
|
||||
*/
|
||||
private Paint mPaint;
|
||||
private final Paint mPaint;
|
||||
|
||||
/**
|
||||
* spacing between the bars in percentage.
|
||||
|
@ -83,7 +83,7 @@ public class BarGraphSeries<E extends DataPointInterface> extends BaseSeries<E>
|
|||
* stores the coordinates of the bars to
|
||||
* trigger tap on series events.
|
||||
*/
|
||||
private Map<RectF, E> mDataPoints = new HashMap<RectF, E>();
|
||||
private final Map<RectF, E> mDataPoints = new HashMap<RectF, E>();
|
||||
|
||||
/**
|
||||
* creates bar series without any data
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.util.Log;
|
|||
import com.jjoe64.graphview.GraphView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -61,7 +62,7 @@ public abstract class BaseSeries<E extends DataPointInterface> implements Series
|
|||
*
|
||||
* will be filled while drawing via {@link #registerDataPoint(float, float, DataPointInterface)}
|
||||
*/
|
||||
private Map<PointF, E> mDataPoints = new HashMap<PointF, E>();
|
||||
private final Map<PointF, E> mDataPoints = new HashMap<PointF, E>();
|
||||
|
||||
/**
|
||||
* title for this series that can be displayed
|
||||
|
@ -84,7 +85,7 @@ public abstract class BaseSeries<E extends DataPointInterface> implements Series
|
|||
* stores the graphviews where this series is used.
|
||||
* Can be more than one.
|
||||
*/
|
||||
private List<GraphView> mGraphViews;
|
||||
private final List<GraphView> mGraphViews;
|
||||
|
||||
/**
|
||||
* creates series without data
|
||||
|
@ -101,9 +102,7 @@ public abstract class BaseSeries<E extends DataPointInterface> implements Series
|
|||
*/
|
||||
public BaseSeries(E[] data) {
|
||||
mGraphViews = new ArrayList<GraphView>();
|
||||
for (E d : data) {
|
||||
mData.add(d);
|
||||
}
|
||||
Collections.addAll(mData, data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,7 +167,7 @@ public abstract class BaseSeries<E extends DataPointInterface> implements Series
|
|||
return mData.iterator();
|
||||
} else {
|
||||
return new Iterator<E>() {
|
||||
Iterator<E> org = mData.iterator();
|
||||
final Iterator<E> org = mData.iterator();
|
||||
E nextValue = null;
|
||||
E nextNextValue = null;
|
||||
boolean plusOne = true;
|
||||
|
@ -350,9 +349,7 @@ public abstract class BaseSeries<E extends DataPointInterface> implements Series
|
|||
*/
|
||||
public void resetData(E[] data) {
|
||||
mData.clear();
|
||||
for (E d : data) {
|
||||
mData.add(d);
|
||||
}
|
||||
Collections.addAll(mData, data);
|
||||
checkValueOrder(null);
|
||||
|
||||
// update graphview
|
||||
|
|
|
@ -33,8 +33,8 @@ import java.util.Date;
|
|||
public class DataPoint implements DataPointInterface, Serializable {
|
||||
private static final long serialVersionUID=1428263322645L;
|
||||
|
||||
private double x;
|
||||
private double y;
|
||||
private final double x;
|
||||
private final double y;
|
||||
|
||||
public DataPoint(double x, double y) {
|
||||
this.x=x;
|
||||
|
|
|
@ -32,10 +32,10 @@ public interface DataPointInterface {
|
|||
/**
|
||||
* @return the x value
|
||||
*/
|
||||
public double getX();
|
||||
double getX();
|
||||
|
||||
/**
|
||||
* @return the y value
|
||||
*/
|
||||
public double getY();
|
||||
double getY();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class PointsGraphSeries<E extends DataPointInterface> extends BaseSeries<
|
|||
* interface to implement a custom
|
||||
* drawing for the data points.
|
||||
*/
|
||||
public static interface CustomShape {
|
||||
public interface CustomShape {
|
||||
/**
|
||||
* called when drawing a single data point.
|
||||
* use the x and y coordinates to render your
|
||||
|
@ -201,10 +201,8 @@ public class PointsGraphSeries<E extends DataPointInterface> extends BaseSeries<
|
|||
double orgY = y;
|
||||
|
||||
// overdraw
|
||||
boolean overdraw = false;
|
||||
if (x > graphWidth) { // end right
|
||||
overdraw = true;
|
||||
}
|
||||
boolean overdraw = x > graphWidth;
|
||||
// end right
|
||||
if (y < 0) { // end bottom
|
||||
overdraw = true;
|
||||
}
|
||||
|
|
|
@ -42,22 +42,22 @@ public interface Series<E extends DataPointInterface> {
|
|||
/**
|
||||
* @return the lowest x-value of the data
|
||||
*/
|
||||
public double getLowestValueX();
|
||||
double getLowestValueX();
|
||||
|
||||
/**
|
||||
* @return the highest x-value of the data
|
||||
*/
|
||||
public double getHighestValueX();
|
||||
double getHighestValueX();
|
||||
|
||||
/**
|
||||
* @return the lowest y-value of the data
|
||||
*/
|
||||
public double getLowestValueY();
|
||||
double getLowestValueY();
|
||||
|
||||
/**
|
||||
* @return the highest y-value of the data
|
||||
*/
|
||||
public double getHighestValueY();
|
||||
double getHighestValueY();
|
||||
|
||||
/**
|
||||
* get the values for a specific range. It is
|
||||
|
@ -69,7 +69,7 @@ public interface Series<E extends DataPointInterface> {
|
|||
* @return all datapoints between the from and until x-value
|
||||
* including the from and until data points.
|
||||
*/
|
||||
public Iterator<E> getValues(double from, double until);
|
||||
Iterator<E> getValues(double from, double until);
|
||||
|
||||
/**
|
||||
* Plots the series to the viewport.
|
||||
|
@ -82,25 +82,25 @@ public interface Series<E extends DataPointInterface> {
|
|||
* @param canvas canvas to draw on
|
||||
* @param isSecondScale true if the drawing is for the second scale
|
||||
*/
|
||||
public void draw(GraphView graphView, Canvas canvas, boolean isSecondScale);
|
||||
void draw(GraphView graphView, Canvas canvas, boolean isSecondScale);
|
||||
|
||||
/**
|
||||
* @return the title of the series. Used in the legend
|
||||
*/
|
||||
public String getTitle();
|
||||
String getTitle();
|
||||
|
||||
/**
|
||||
* @return the color of the series. Used in the legend and should
|
||||
* be used for the plotted points or lines.
|
||||
*/
|
||||
public int getColor();
|
||||
int getColor();
|
||||
|
||||
/**
|
||||
* set a listener for tap on a data point.
|
||||
*
|
||||
* @param l listener
|
||||
*/
|
||||
public void setOnDataPointTapListener(OnDataPointTapListener l);
|
||||
void setOnDataPointTapListener(OnDataPointTapListener l);
|
||||
|
||||
/**
|
||||
* called by the tap detector in order to trigger
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
package info.nightscout.interfaces.source
|
||||
|
||||
interface DoingOwnUploadSource {
|
||||
}
|
||||
interface DoingOwnUploadSource
|
|
@ -68,7 +68,8 @@ public class InsightPairingActivity extends DaggerAppCompatActivity implements I
|
|||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder binder) {
|
||||
service = ((InsightConnectionService.LocalBinder) binder).getService();
|
||||
if (service.isPaired()) return;
|
||||
if (service.isPaired()) {
|
||||
}
|
||||
else {
|
||||
service.requestConnection(InsightPairingActivity.this);
|
||||
service.registerStateCallback(InsightPairingActivity.this);
|
||||
|
|
|
@ -29,7 +29,7 @@ abstract class SourceModule {
|
|||
@ContributesAndroidInjector abstract fun contributesBGSourceFragment(): BGSourceFragment
|
||||
|
||||
@ContributesAndroidInjector abstract fun contributesNSProfileWorker(): ProfilePlugin.NSProfileWorker
|
||||
@ContributesAndroidInjector abstract fun contributesNSClientSourceWorker(): info.nightscout.plugins.source.NSClientSourcePlugin.NSClientSourceWorker
|
||||
@ContributesAndroidInjector abstract fun contributesNSClientSourceWorker(): NSClientSourcePlugin.NSClientSourceWorker
|
||||
@ContributesAndroidInjector abstract fun contributesXdripWorker(): XdripPlugin.XdripWorker
|
||||
@ContributesAndroidInjector abstract fun contributesDexcomWorker(): DexcomPlugin.DexcomWorker
|
||||
@ContributesAndroidInjector abstract fun contributesMM640gWorker(): MM640gPlugin.MM640gWorker
|
||||
|
@ -43,6 +43,6 @@ abstract class SourceModule {
|
|||
|
||||
@Module
|
||||
interface Bindings {
|
||||
@Binds fun bindNSClientSource(nsClientSourcePlugin: info.nightscout.plugins.source.NSClientSourcePlugin): NSClientSource
|
||||
@Binds fun bindNSClientSource(nsClientSourcePlugin: NSClientSourcePlugin): NSClientSource
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ class ProfileElement(ps: EffectiveProfileSwitch, serialNumber: String, dateUtil:
|
|||
|
||||
init {
|
||||
type = "pumpSettings"
|
||||
val profile: Profile? = ProfileSealed.EPS(ps)
|
||||
val profile: Profile = ProfileSealed.EPS(ps)
|
||||
checkNotNull(profile)
|
||||
for (br in profile.getBasalValues())
|
||||
basalSchedules.Normal.add(BasalRate(br.timeAsSeconds * 1000, br.value))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.pump.combo.ruffyscripter.history;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PumpAlert extends HistoryRecord {
|
||||
public final Integer warningCode;
|
||||
|
@ -23,11 +24,11 @@ public class PumpAlert extends HistoryRecord {
|
|||
PumpAlert pumpAlert = (PumpAlert) o;
|
||||
|
||||
if (timestamp != pumpAlert.timestamp) return false;
|
||||
if (warningCode != null ? !warningCode.equals(pumpAlert.warningCode) : pumpAlert.warningCode != null)
|
||||
if (!Objects.equals(warningCode, pumpAlert.warningCode))
|
||||
return false;
|
||||
if (errorCode != null ? !errorCode.equals(pumpAlert.errorCode) : pumpAlert.errorCode != null)
|
||||
if (!Objects.equals(errorCode, pumpAlert.errorCode))
|
||||
return false;
|
||||
return message != null ? message.equals(pumpAlert.message) : pumpAlert.message == null;
|
||||
return Objects.equals(message, pumpAlert.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -719,8 +719,7 @@ object ApplicationLayer {
|
|||
command = extractAppLayerPacketCommand(tpLayerPacket),
|
||||
version = tpLayerPacket.payload[VERSION_BYTE_OFFSET],
|
||||
payload = ArrayList<Byte>(tpLayerPacket.payload.subList(PAYLOAD_BYTES_OFFSET, tpLayerPacket.payload.size))
|
||||
) {
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Produces transport layer DATA packet info containing this application layer
|
||||
|
@ -1680,10 +1679,10 @@ object ApplicationLayer {
|
|||
* This is preferred over directly using the [Packet] constructor.
|
||||
*/
|
||||
fun checkAndParseTransportLayerDataPacket(tpLayerPacket: TransportLayer.Packet):
|
||||
ApplicationLayer.Packet {
|
||||
Packet {
|
||||
try {
|
||||
logger(LogLevel.VERBOSE) { "Parsing DATA packet as application layer packet" }
|
||||
val appLayerPacket = ApplicationLayer.Packet(tpLayerPacket)
|
||||
val appLayerPacket = Packet(tpLayerPacket)
|
||||
logger(LogLevel.VERBOSE) {
|
||||
"This is an application layer packet with command ${appLayerPacket.command} and payload ${appLayerPacket.payload.toHexString()}"
|
||||
}
|
||||
|
@ -1709,7 +1708,7 @@ object ApplicationLayer {
|
|||
}
|
||||
|
||||
return appLayerPacket
|
||||
} catch (e: ApplicationLayer.InvalidCommandIDException) {
|
||||
} catch (e: InvalidCommandIDException) {
|
||||
logger(LogLevel.WARN) {
|
||||
"Got an application layer packet with invalid/unknown command ID 0x${e.commandID.toString(16)} " +
|
||||
"service ID ${e.serviceID.name} and payload (with ${e.payload.size} byte(s)) ${e.payload.toHexString()}" +
|
||||
|
@ -1719,7 +1718,7 @@ object ApplicationLayer {
|
|||
} catch (e: ErrorCodeException) {
|
||||
// We already logged the error code, so just pass through the exception
|
||||
throw e
|
||||
} catch (e: ApplicationLayer.ExceptionBase) {
|
||||
} catch (e: ExceptionBase) {
|
||||
logger(LogLevel.ERROR) { "Could not parse DATA packet as application layer packet: $e" }
|
||||
throw e
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ class PumpIO(
|
|||
// and [List<Byte>.toComboFrame] for details).
|
||||
private val framedComboIO = FramedComboIO(bluetoothDevice)
|
||||
|
||||
private var initialMode: PumpIO.Mode? = null
|
||||
private var initialMode: Mode? = null
|
||||
|
||||
private var transportLayerIO = TransportLayer.IO(
|
||||
pumpStateStore, bluetoothDevice.address, framedComboIO
|
||||
|
|
|
@ -159,8 +159,8 @@ object TransportLayer {
|
|||
|
||||
// Utility function to be able to throw an exception in case of
|
||||
// an invalid command ID in the Packet constructor below.
|
||||
private fun checkedGetCommand(value: Int, bytes: List<Byte>): TransportLayer.Command =
|
||||
TransportLayer.Command.fromInt(value) ?: throw TransportLayer.InvalidCommandIDException(value, bytes)
|
||||
private fun checkedGetCommand(value: Int, bytes: List<Byte>): Command =
|
||||
Command.fromInt(value) ?: throw InvalidCommandIDException(value, bytes)
|
||||
|
||||
/**
|
||||
* Class containing Combo transport layer packet data.
|
||||
|
@ -835,7 +835,7 @@ object TransportLayer {
|
|||
* @throws IncorrectPacketException if expectedCommand is non-null and
|
||||
* the received packet's command does not match expectedCommand.
|
||||
*/
|
||||
suspend fun receive(expectedCommand: Command? = null): TransportLayer.Packet {
|
||||
suspend fun receive(expectedCommand: Command? = null): Packet {
|
||||
// In here, we mainly listen to the packetReceiverChannel
|
||||
// for incoming packets from the packet receiver coroutine.
|
||||
// The actual reception takes place there. startInternal()
|
||||
|
|
|
@ -953,7 +953,7 @@ suspend fun navigateToRTScreen(
|
|||
null
|
||||
}
|
||||
|
||||
if (path?.isEmpty() ?: false)
|
||||
if (path?.isEmpty() == true)
|
||||
return currentParsedScreen
|
||||
|
||||
if (path == null) {
|
||||
|
|
|
@ -37,18 +37,14 @@ import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchConfig;
|
|||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchLifecycleEvent;
|
||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.PatchState;
|
||||
import info.nightscout.androidaps.plugins.pump.eopatch.vo.TempBasal;
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin;
|
||||
import info.nightscout.interfaces.profile.ProfileFunction;
|
||||
import info.nightscout.interfaces.pump.DetailedBolusInfo;
|
||||
import info.nightscout.interfaces.pump.PumpSync;
|
||||
import info.nightscout.interfaces.pump.defs.PumpType;
|
||||
import info.nightscout.interfaces.queue.CommandQueue;
|
||||
import info.nightscout.rx.AapsSchedulers;
|
||||
import info.nightscout.rx.bus.RxBus;
|
||||
import info.nightscout.rx.events.EventCustomActionsChanged;
|
||||
import info.nightscout.rx.events.EventPumpStatusChanged;
|
||||
import info.nightscout.rx.events.EventRefreshOverview;
|
||||
import info.nightscout.rx.logging.AAPSLogger;
|
||||
import info.nightscout.shared.interfaces.ResourceHelper;
|
||||
import info.nightscout.shared.sharedPreferences.SP;
|
||||
import info.nightscout.shared.utils.DateUtil;
|
||||
|
@ -63,10 +59,6 @@ public class PatchManager implements IPatchManager {
|
|||
|
||||
@Inject PatchManagerImpl patchManager;
|
||||
@Inject IPreferenceManager pm;
|
||||
@Inject ProfileFunction profileFunction;
|
||||
@Inject ActivePlugin activePlugin;
|
||||
@Inject CommandQueue commandQueue;
|
||||
@Inject AAPSLogger aapsLogger;
|
||||
@Inject ResourceHelper resourceHelper;
|
||||
@Inject RxBus rxBus;
|
||||
@Inject Context context;
|
||||
|
|
|
@ -80,10 +80,10 @@ public class PatchStateManager {
|
|||
// Resume --> onBasalResume
|
||||
onBasalResumeState();
|
||||
|
||||
} else if (oldState.isNormalBasalAct() == false) {
|
||||
} else if (!oldState.isNormalBasalAct()) {
|
||||
// Start --> onBasalStarted
|
||||
}
|
||||
} else if (oldState.isNormalBasalPaused() == false && newState.isNormalBasalPaused()) {
|
||||
} else if (!oldState.isNormalBasalPaused() && newState.isNormalBasalPaused()) {
|
||||
if (newState.isTempBasalAct()) {
|
||||
} else {
|
||||
// pause
|
||||
|
@ -93,25 +93,21 @@ public class PatchStateManager {
|
|||
|
||||
/* Temp Basal ------------------------------------------------------------------------------------------- */
|
||||
if (newState.isTempBasalAct()) {
|
||||
if (oldState.isTempBasalAct() == false) {
|
||||
if (!oldState.isTempBasalAct()) {
|
||||
// Start
|
||||
onTempBasalStartState();
|
||||
}
|
||||
}
|
||||
|
||||
boolean tempBasalStopped = false;
|
||||
boolean tempBasalFinished = false;
|
||||
boolean tempBasalFinished = newState.isTempBasalDone() && !newState.isPatchInternalSuspended();
|
||||
|
||||
if (newState.isTempBasalDone() && !newState.isPatchInternalSuspended()) {
|
||||
tempBasalFinished = true;
|
||||
}
|
||||
|
||||
if (oldState.isTempBasalDone() == false) {
|
||||
if (!oldState.isTempBasalDone()) {
|
||||
if (newState.isTempBasalDone()) {
|
||||
tempBasalStopped = true;
|
||||
|
||||
onTempBasalDoneState();
|
||||
} else if (oldState.isTempBasalAct() && newState.isTempBasalAct() == false) {
|
||||
} else if (oldState.isTempBasalAct() && !newState.isTempBasalAct()) {
|
||||
tempBasalStopped = true;
|
||||
|
||||
onTempBasalCancelState();
|
||||
|
@ -126,15 +122,15 @@ public class PatchStateManager {
|
|||
}
|
||||
}
|
||||
|
||||
if (newState.isTempBasalAct() == false && pm.getTempBasalManager().getStartedBasal() != null) {
|
||||
if (!newState.isTempBasalAct() && pm.getTempBasalManager().getStartedBasal() != null) {
|
||||
pm.getTempBasalManager().updateBasalStopped();
|
||||
}
|
||||
|
||||
/* Now Bolus -------------------------------------------------------------------------------------------- */
|
||||
if (oldState.isNowBolusRegAct() == false && newState.isNowBolusRegAct() == true) {
|
||||
if (!oldState.isNowBolusRegAct() && newState.isNowBolusRegAct()) {
|
||||
// Start
|
||||
} else if (oldState.isNowBolusDone() == false) {
|
||||
if (oldState.isNowBolusRegAct() && newState.isNowBolusRegAct() == false) {
|
||||
} else if (!oldState.isNowBolusDone()) {
|
||||
if (oldState.isNowBolusRegAct() && !newState.isNowBolusRegAct()) {
|
||||
// Cancel
|
||||
} else if (newState.isNowBolusDone()) {
|
||||
// Done
|
||||
|
@ -143,23 +139,23 @@ public class PatchStateManager {
|
|||
|
||||
BolusCurrent bolusCurrent = pm.getBolusCurrent();
|
||||
|
||||
if (newState.isNowBolusRegAct() == false && bolusCurrent.historyId(BolusType.NOW) > 0
|
||||
if (!newState.isNowBolusRegAct() && bolusCurrent.historyId(BolusType.NOW) > 0
|
||||
&& bolusCurrent.endTimeSynced(BolusType.NOW)) {
|
||||
bolusCurrent.clearBolus(BolusType.NOW);
|
||||
}
|
||||
|
||||
/* Extended Bolus --------------------------------------------------------------------------------------- */
|
||||
if (oldState.isExtBolusRegAct() == false && newState.isExtBolusRegAct() == true) {
|
||||
if (!oldState.isExtBolusRegAct() && newState.isExtBolusRegAct()) {
|
||||
// Start
|
||||
} else if (oldState.isExtBolusDone() == false) {
|
||||
if (oldState.isExtBolusRegAct() && newState.isExtBolusRegAct() == false) {
|
||||
} else if (!oldState.isExtBolusDone()) {
|
||||
if (oldState.isExtBolusRegAct() && !newState.isExtBolusRegAct()) {
|
||||
// Cancel
|
||||
} else if (newState.isExtBolusDone()) {
|
||||
// Done
|
||||
}
|
||||
}
|
||||
|
||||
if (newState.isExtBolusRegAct() == false && bolusCurrent.historyId(BolusType.EXT) > 0
|
||||
if (!newState.isExtBolusRegAct() && bolusCurrent.historyId(BolusType.EXT) > 0
|
||||
&& bolusCurrent.endTimeSynced(BolusType.EXT)) {
|
||||
bolusCurrent.clearBolus(BolusType.EXT);
|
||||
}
|
||||
|
@ -243,7 +239,7 @@ public class PatchStateManager {
|
|||
if (normalBasal != null) {
|
||||
pm.getNormalBasalManager().updateBasalStarted();
|
||||
normalBasal.updateNormalBasalIndex();
|
||||
pm.flushNormalBasalManager();;
|
||||
pm.flushNormalBasalManager();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public class SyncBasalHistoryTask extends TaskBase {
|
|||
}
|
||||
|
||||
public synchronized int updateInjected(float[] normal, float[] temp, int start, int end) {
|
||||
if (pm.getPatchState().isPatchInternalSuspended() && pm.getPatchConfig().isInBasalPausedTime() == false) {
|
||||
if (pm.getPatchState().isPatchInternalSuspended() && !pm.getPatchConfig().isInBasalPausedTime()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import io.reactivex.rxjava3.core.Single;
|
|||
public class UpdateConnectionTask extends TaskBase {
|
||||
@Inject PatchStateManager patchStateManager;
|
||||
|
||||
private UpdateConnection UPDATE_CONNECTION;
|
||||
private final UpdateConnection UPDATE_CONNECTION;
|
||||
|
||||
@Inject
|
||||
public UpdateConnectionTask() {
|
||||
|
|
|
@ -10,7 +10,7 @@ import kotlin.reflect.KClass
|
|||
|
||||
@MustBeDocumented
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MapKey
|
||||
internal annotation class ViewModelKey(val value: KClass<out ViewModel>)
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import io.reactivex.rxjava3.subjects.BehaviorSubject
|
|||
* BolusCurrent : 현재 패치에서 진행 중인 '볼루스의 정보'를 표현한 클래스.
|
||||
*/
|
||||
|
||||
class BolusCurrent(): IPreference<BolusCurrent> {
|
||||
class BolusCurrent : IPreference<BolusCurrent> {
|
||||
@Transient
|
||||
private val subject: BehaviorSubject<BolusCurrent> = BehaviorSubject.create()
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ class PatchState: IPreference<PatchState> {
|
|||
private val stateBytes: ByteArray
|
||||
var updatedTimestamp: Long = 0
|
||||
|
||||
constructor(): this(ByteArray(SIZE), 0) {
|
||||
}
|
||||
constructor(): this(ByteArray(SIZE), 0)
|
||||
|
||||
constructor(stateBytes: ByteArray, updatedTimestamp: Long) {
|
||||
this.stateBytes = stateBytes
|
||||
|
|
|
@ -79,9 +79,7 @@ class MedtronicUITask {
|
|||
|
||||
MedtronicCommandType.SetTemporaryBasal -> {
|
||||
val tbr = getTbrSettings()
|
||||
if (tbr != null) {
|
||||
result = communicationManager.setTemporaryBasal(tbr)
|
||||
}
|
||||
result = communicationManager.setTemporaryBasal(tbr)
|
||||
}
|
||||
|
||||
MedtronicCommandType.ReadTemporaryBasal -> {
|
||||
|
@ -128,7 +126,7 @@ class MedtronicUITask {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getTbrSettings(): TempBasalPair? {
|
||||
private fun getTbrSettings(): TempBasalPair {
|
||||
return TempBasalPair(getDoubleFromParameters(0)!!, //
|
||||
false, //
|
||||
getIntegerFromParameters(1))
|
||||
|
|
|
@ -13,7 +13,7 @@ import kotlin.reflect.KClass
|
|||
annotation class OmnipodPluginQualifier
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MapKey
|
||||
annotation class ViewModelKey(val value: KClass<out ViewModel>)
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ class OmnipodDashManagerImpl @Inject constructor(
|
|||
.setUniqueId(podStateManager.uniqueId!!.toInt())
|
||||
.setSequenceNumber(podStateManager.messageSequenceNumber)
|
||||
.setNonce(NONCE)
|
||||
.setNumberOfUnits(Round.roundTo(podStateManager.firstPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS, POD_PULSE_BOLUS_UNITS))
|
||||
.setNumberOfUnits(Round.roundTo(podStateManager.firstPrimeBolusVolume!! * POD_PULSE_BOLUS_UNITS, POD_PULSE_BOLUS_UNITS))
|
||||
.setDelayBetweenPulsesInEighthSeconds(podStateManager.primePulseRate!!.toByte())
|
||||
.setProgramReminder(ProgramReminder(atStart = false, atEnd = false, atInterval = 0))
|
||||
.build(),
|
||||
|
@ -412,7 +412,7 @@ class OmnipodDashManagerImpl @Inject constructor(
|
|||
)
|
||||
observables.add(
|
||||
observeSendProgramBolusCommand(
|
||||
Round.roundTo(podStateManager.secondPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS, PodConstants.POD_PULSE_BOLUS_UNITS),
|
||||
Round.roundTo(podStateManager.secondPrimeBolusVolume!! * POD_PULSE_BOLUS_UNITS, POD_PULSE_BOLUS_UNITS),
|
||||
podStateManager.primePulseRate!!.toByte(),
|
||||
confirmationBeeps = false,
|
||||
completionBeeps = false
|
||||
|
|
|
@ -75,7 +75,6 @@ abstract class PumpPluginAbstract protected constructor(
|
|||
protected var displayConnectionMessages = false
|
||||
|
||||
var pumpType: PumpType = PumpType.GENERIC_AAPS
|
||||
get() = field
|
||||
set(value) {
|
||||
field = value
|
||||
pumpDescription.fillFor(value)
|
||||
|
|
|
@ -9,6 +9,5 @@ public enum BasalProfileStatus {
|
|||
NotInitialized, //
|
||||
ProfileOK, //
|
||||
ProfileChanged, //
|
||||
;
|
||||
|
||||
}
|
||||
|
|
|
@ -65,11 +65,11 @@ enum class PumpHistoryEntryGroup(val resourceId: Int, val pumpTypeGroupConfig: P
|
|||
if (pumpTypeGroupConfig == PumpTypeGroupConfig.All) {
|
||||
outList = translatedList!!.stream()
|
||||
.filter { pre -> pre.pumpTypeGroupConfig == PumpTypeGroupConfig.All }
|
||||
.toList();
|
||||
.toList()
|
||||
} else {
|
||||
outList = translatedList!!.stream()
|
||||
.filter { pre -> (pre.pumpTypeGroupConfig == PumpTypeGroupConfig.All || pre.pumpTypeGroupConfig == pumpTypeGroupConfig) }
|
||||
.toList();
|
||||
.toList()
|
||||
}
|
||||
|
||||
return outList
|
||||
|
|
|
@ -28,22 +28,21 @@ enum class PumpUpdateFragmentType {
|
|||
Custom_8
|
||||
;
|
||||
|
||||
final var children: List<PumpUpdateFragmentType>? = null
|
||||
var children: List<PumpUpdateFragmentType>? = null
|
||||
|
||||
constructor() {
|
||||
}
|
||||
constructor()
|
||||
|
||||
constructor(children: List<PumpUpdateFragmentType>) {
|
||||
this.children = children;
|
||||
this.children = children
|
||||
}
|
||||
|
||||
fun isOptionIncluded(type: PumpUpdateFragmentType): Boolean {
|
||||
if (this == type)
|
||||
return true
|
||||
else if (this.children != null && this.children!!.contains(type))
|
||||
return true;
|
||||
return true
|
||||
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
package info.nightscout.pump.common.driver.history
|
||||
|
||||
interface PumpDataConverter {
|
||||
}
|
||||
interface PumpDataConverter
|
|
@ -7,7 +7,7 @@ import java.util.GregorianCalendar
|
|||
abstract class PumpHistoryDataProviderAbstract : PumpHistoryDataProvider {
|
||||
|
||||
override fun getInitialData(): List<PumpHistoryEntry> {
|
||||
return getData(getInitialPeriod());
|
||||
return getData(getInitialPeriod())
|
||||
}
|
||||
|
||||
override fun getSpinnerWidthInPixels(): Int {
|
||||
|
|
|
@ -4,5 +4,4 @@ import info.nightscout.rx.events.Event
|
|||
|
||||
class EventPumpChanged(var serialNumber: String,
|
||||
var connectionAddress: String,
|
||||
var parameters: MutableMap<String, Any>? = null) : Event() {
|
||||
}
|
||||
var parameters: MutableMap<String, Any>? = null) : Event()
|
|
@ -2,5 +2,4 @@ package info.nightscout.pump.common.events
|
|||
|
||||
import info.nightscout.rx.events.Event
|
||||
|
||||
class EventPumpConnectionParametersChanged : Event() {
|
||||
}
|
||||
class EventPumpConnectionParametersChanged : Event()
|
|
@ -77,7 +77,7 @@ data class PumpDbEntryCarbs(var date: Long,
|
|||
var pumpId: Long? = null) {
|
||||
|
||||
constructor(detailedBolusInfo: DetailedBolusInfo,
|
||||
creator: info.nightscout.pump.common.sync.PumpSyncEntriesCreator
|
||||
creator: PumpSyncEntriesCreator
|
||||
) : this(detailedBolusInfo.timestamp,
|
||||
detailedBolusInfo.carbs,
|
||||
creator.model(),
|
||||
|
|
|
@ -110,7 +110,7 @@ class PumpSyncStorage @Inject constructor(
|
|||
return pumpSyncStorageTBR
|
||||
}
|
||||
|
||||
fun addBolusWithTempId(detailedBolusInfo: DetailedBolusInfo, writeToInternalHistory: Boolean, creator: info.nightscout.pump.common.sync.PumpSyncEntriesCreator): Boolean {
|
||||
fun addBolusWithTempId(detailedBolusInfo: DetailedBolusInfo, writeToInternalHistory: Boolean, creator: PumpSyncEntriesCreator): Boolean {
|
||||
val temporaryId = creator.generateTempId(detailedBolusInfo.timestamp)
|
||||
val result = pumpSync.addBolusWithTempId(
|
||||
detailedBolusInfo.timestamp,
|
||||
|
@ -157,7 +157,7 @@ class PumpSyncStorage @Inject constructor(
|
|||
"carbs=${carbsDto.carbs}, pumpSerial=${carbsDto.serialNumber}] - Result: $result")
|
||||
}
|
||||
|
||||
fun addTemporaryBasalRateWithTempId(temporaryBasal: PumpDbEntryTBR, writeToInternalHistory: Boolean, creator: info.nightscout.pump.common.sync.PumpSyncEntriesCreator): Boolean {
|
||||
fun addTemporaryBasalRateWithTempId(temporaryBasal: PumpDbEntryTBR, writeToInternalHistory: Boolean, creator: PumpSyncEntriesCreator): Boolean {
|
||||
val timeNow: Long = System.currentTimeMillis()
|
||||
val temporaryId = creator.generateTempId(timeNow)
|
||||
|
||||
|
|
|
@ -72,14 +72,6 @@ class PumpHistoryActivity : DaggerAppCompatActivity() {
|
|||
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
//filterHistory(selectedGroup)
|
||||
//setHistoryTypeSpinner()
|
||||
//aapsLogger.info(LTag.PUMP, "onResume")
|
||||
//binding.pumpHistoryRoot.requestLayout()
|
||||
}
|
||||
|
||||
private fun setHistoryTypeSpinner() {
|
||||
manualChange = true
|
||||
for (i in typeListFull!!.indices) {
|
||||
|
@ -119,12 +111,12 @@ class PumpHistoryActivity : DaggerAppCompatActivity() {
|
|||
binding.pumpHistoryText.text = historyDataProvider.getText(PumpHistoryText.PUMP_HISTORY)
|
||||
|
||||
binding.pumpHistoryType.adapter = spinnerAdapter
|
||||
binding.pumpHistoryType.getLayoutParams().width = fromDpToSize(historyDataProvider.getSpinnerWidthInPixels())
|
||||
binding.pumpHistoryType.requestLayout();
|
||||
binding.pumpHistoryType.setOnItemSelectedListener(object : AdapterView.OnItemSelectedListener {
|
||||
binding.pumpHistoryType.layoutParams.width = fromDpToSize(historyDataProvider.getSpinnerWidthInPixels())
|
||||
binding.pumpHistoryType.requestLayout()
|
||||
binding.pumpHistoryType.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
|
||||
if (manualChange) return
|
||||
val selected = binding.pumpHistoryType.getSelectedItem() as TypeList
|
||||
val selected = binding.pumpHistoryType.selectedItem as TypeList
|
||||
showingType = selected
|
||||
selectedGroup = selected.entryGroup
|
||||
filterHistory(selectedGroup)
|
||||
|
@ -138,7 +130,7 @@ class PumpHistoryActivity : DaggerAppCompatActivity() {
|
|||
if (manualChange) return
|
||||
filterHistory(PumpHistoryEntryGroup.All)
|
||||
}
|
||||
})
|
||||
}
|
||||
binding.pumpHistoryTypeText.requestLayout()
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ object ProfileUtil {
|
|||
return if (stringBuilder.length > 3) stringBuilder.substring(0, stringBuilder.length - 2) else stringBuilder.toString()
|
||||
}
|
||||
|
||||
fun getBasalProfilesDisplayableAsStringOfArray(profile: Profile, pumpType: PumpType): String? {
|
||||
fun getBasalProfilesDisplayableAsStringOfArray(profile: Profile, pumpType: PumpType): String {
|
||||
val stringBuilder = java.lang.StringBuilder()
|
||||
// for (basalValue in profiles) {
|
||||
// val basalValueValue = pumpType.determineCorrectBasalSize(basalValue.value)
|
||||
|
|
|
@ -157,7 +157,7 @@ public abstract class RileyLinkCommunicationManager<T extends RLMessage> {
|
|||
|
||||
// FIXME wakeUp successful !!!!!!!!!!!!!!!!!!
|
||||
|
||||
nextWakeUpRequired = System.currentTimeMillis() + (receiverDeviceAwakeForMinutes * 60 * 1000);
|
||||
nextWakeUpRequired = System.currentTimeMillis() + ((long) receiverDeviceAwakeForMinutes * 60 * 1000);
|
||||
} else {
|
||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Last pump communication was recent, not waking pump.");
|
||||
}
|
||||
|
|
|
@ -58,10 +58,6 @@ class DataLayerListenerServiceWear : WearableListenerService() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onPeerConnected(p0: Node) {
|
||||
super.onPeerConnected(p0)
|
||||
}
|
||||
|
||||
override fun onCapabilityChanged(p0: CapabilityInfo) {
|
||||
super.onCapabilityChanged(p0)
|
||||
handler.post { updateTranscriptionCapability() }
|
||||
|
|
Loading…
Reference in a new issue