2016-06-10 18:50:46 +02:00
|
|
|
package info.nightscout.androidaps.plugins;
|
|
|
|
|
2016-06-12 10:53:19 +02:00
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
|
|
|
|
import info.nightscout.androidaps.MainActivity;
|
|
|
|
import info.nightscout.androidaps.MainApp;
|
|
|
|
import info.nightscout.androidaps.R;
|
|
|
|
|
2016-06-10 18:50:46 +02:00
|
|
|
/**
|
|
|
|
* Created by mike on 09.06.2016.
|
|
|
|
*/
|
|
|
|
public class APSResult {
|
|
|
|
public String reason;
|
|
|
|
public double rate;
|
|
|
|
public int duration;
|
|
|
|
public boolean changeRequested = false;
|
2016-06-12 10:53:19 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
Context context = MainApp.instance().getApplicationContext();
|
|
|
|
|
|
|
|
DecimalFormat formatNumber0decimalplaces = new DecimalFormat("0");
|
|
|
|
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
|
|
|
|
|
|
|
|
if (changeRequested)
|
2016-06-12 13:30:34 +02:00
|
|
|
return context.getString(R.string.rate) + " " + formatNumber2decimalplaces.format(rate) + " U/h\n" +
|
|
|
|
context.getString(R.string.duration) + " " + formatNumber0decimalplaces.format(duration) + " min\n" +
|
|
|
|
context.getString(R.string.reason) + " " + reason;
|
2016-06-12 10:53:19 +02:00
|
|
|
else
|
|
|
|
return MainApp.instance().getApplicationContext().getString(R.string.nochangerequested);
|
|
|
|
}
|
2016-06-10 18:50:46 +02:00
|
|
|
}
|