Merge branch 'dev' into smb
This commit is contained in:
commit
838deed1e8
6 changed files with 42 additions and 42 deletions
|
@ -212,7 +212,8 @@ public class Profile {
|
||||||
retValue += format.format(o2.getDouble("value"));
|
retValue += format.format(o2.getDouble("value"));
|
||||||
}
|
}
|
||||||
retValue += " " + units;
|
retValue += " " + units;
|
||||||
retValue += "\n";
|
if (index + 1 < array.length())
|
||||||
|
retValue += "\n";
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -392,8 +393,9 @@ public class Profile {
|
||||||
else return DecimalFormatter.to1Decimal(valueInMmol);
|
else return DecimalFormatter.to1Decimal(valueInMmol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// targets are stored in mg/dl
|
||||||
public static String toTargetRangeString(double low, double high, String units) {
|
public static String toTargetRangeString(double low, double high, String units) {
|
||||||
if (low == high) return toUnitsString(low, low, units);
|
if (low == high) return toUnitsString(low, Profile.fromMgdlToUnits(low, Constants.MMOL), units);
|
||||||
else return toUnitsString(low, low, units) + " - " + toUnitsString(high, high, units);
|
else return toUnitsString(low, Profile.fromMgdlToUnits(low, Constants.MMOL), units) + " - " + toUnitsString(high, Profile.fromMgdlToUnits(high, Constants.MMOL), units);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,14 +24,14 @@ public class NSProfileFragment extends SubscriberFragment {
|
||||||
return nsProfilePlugin;
|
return nsProfilePlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextView noProfile;
|
private TextView noProfile;
|
||||||
private static TextView units;
|
private TextView units;
|
||||||
private static TextView dia;
|
private TextView dia;
|
||||||
private static TextView activeProfile;
|
private TextView activeProfile;
|
||||||
private static TextView ic;
|
private TextView ic;
|
||||||
private static TextView isf;
|
private TextView isf;
|
||||||
private static TextView basal;
|
private TextView basal;
|
||||||
private static TextView target;
|
private TextView target;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
|
|
@ -33,16 +33,16 @@ import info.nightscout.utils.DecimalFormatter;
|
||||||
public class ProfileViewDialog extends DialogFragment {
|
public class ProfileViewDialog extends DialogFragment {
|
||||||
private static Logger log = LoggerFactory.getLogger(ProfileViewDialog.class);
|
private static Logger log = LoggerFactory.getLogger(ProfileViewDialog.class);
|
||||||
|
|
||||||
private static TextView noProfile;
|
private TextView noProfile;
|
||||||
private static TextView units;
|
private TextView units;
|
||||||
private static TextView dia;
|
private TextView dia;
|
||||||
private static TextView activeProfile;
|
private TextView activeProfile;
|
||||||
private static TextView ic;
|
private TextView ic;
|
||||||
private static TextView isf;
|
private TextView isf;
|
||||||
private static TextView basal;
|
private TextView basal;
|
||||||
private static TextView target;
|
private TextView target;
|
||||||
|
|
||||||
private static Button refreshButton;
|
private Button refreshButton;
|
||||||
|
|
||||||
Handler mHandler;
|
Handler mHandler;
|
||||||
static HandlerThread mHandlerThread;
|
static HandlerThread mHandlerThread;
|
||||||
|
|
|
@ -30,18 +30,18 @@ public class ProfileViewerDialog extends DialogFragment {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(ProfileViewDialog.class);
|
private static Logger log = LoggerFactory.getLogger(ProfileViewDialog.class);
|
||||||
|
|
||||||
private static TextView noProfile;
|
private TextView noProfile;
|
||||||
private static TextView units;
|
private TextView units;
|
||||||
private static TextView dia;
|
private TextView dia;
|
||||||
private static TextView activeProfile;
|
private TextView activeProfile;
|
||||||
private static TextView ic;
|
private TextView ic;
|
||||||
private static TextView isf;
|
private TextView isf;
|
||||||
private static TextView basal;
|
private TextView basal;
|
||||||
private static TextView target;
|
private TextView target;
|
||||||
private static View dateDelimiter;
|
private View dateDelimiter;
|
||||||
private static LinearLayout dateLayout;
|
private LinearLayout dateLayout;
|
||||||
private static TextView dateTextView;
|
private TextView dateTextView;
|
||||||
private static Button refreshButton;
|
private Button refreshButton;
|
||||||
|
|
||||||
static ProfileViewerDialog newInstance(long time) {
|
static ProfileViewerDialog newInstance(long time) {
|
||||||
ProfileViewerDialog dialog = new ProfileViewerDialog();
|
ProfileViewerDialog dialog = new ProfileViewerDialog();
|
||||||
|
@ -88,7 +88,7 @@ public class ProfileViewerDialog extends DialogFragment {
|
||||||
private void setContent() {
|
private void setContent() {
|
||||||
Profile profile = null;
|
Profile profile = null;
|
||||||
ProfileSwitch profileSwitch = MainApp.getConfigBuilder().getProfileSwitchFromHistory(time);
|
ProfileSwitch profileSwitch = MainApp.getConfigBuilder().getProfileSwitchFromHistory(time);
|
||||||
if(profileSwitch!=null){
|
if(profileSwitch!=null && profileSwitch.profileJson != null){
|
||||||
profile = profileSwitch.getProfileObject();
|
profile = profileSwitch.getProfileObject();
|
||||||
}
|
}
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
|
@ -105,9 +105,4 @@ public class ProfileViewerDialog extends DialogFragment {
|
||||||
noProfile.setVisibility(View.VISIBLE);
|
noProfile.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,9 +130,11 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
||||||
final ProfileSwitch profileSwitch = (ProfileSwitch) v.getTag();
|
final ProfileSwitch profileSwitch = (ProfileSwitch) v.getTag();
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.profileswitch_remove:
|
case R.id.profileswitch_remove:
|
||||||
OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.confirmation), MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(profileSwitch.date), new Runnable() {
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
@Override
|
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||||
public void run() {
|
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(profileSwitch.date));
|
||||||
|
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
final String _id = profileSwitch._id;
|
final String _id = profileSwitch._id;
|
||||||
if (_id != null && !_id.equals("")) {
|
if (_id != null && !_id.equals("")) {
|
||||||
NSUpload.removeCareportalEntryFromNS(_id);
|
NSUpload.removeCareportalEntryFromNS(_id);
|
||||||
|
@ -140,6 +142,8 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
||||||
MainApp.getDbHelper().delete(profileSwitch);
|
MainApp.getDbHelper().delete(profileSwitch);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
|
||||||
|
builder.show();
|
||||||
break;
|
break;
|
||||||
case R.id.profileswitch_date:
|
case R.id.profileswitch_date:
|
||||||
case R.id.profileswitch_name:
|
case R.id.profileswitch_name:
|
||||||
|
|
|
@ -141,7 +141,6 @@ public class TreatmentsTempTargetFragment extends SubscriberFragment implements
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final TempTarget tempTarget = (TempTarget) v.getTag();
|
final TempTarget tempTarget = (TempTarget) v.getTag();
|
||||||
final Context finalContext = context;
|
|
||||||
switch (v.getId()) {
|
switch (v.getId()) {
|
||||||
case R.id.temptargetrange_remove:
|
case R.id.temptargetrange_remove:
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
|
Loading…
Reference in a new issue